misc.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. misc.c
  9. Abstract:
  10. This module implements miscellaneous OS support functions for the setup
  11. application on a Windows host.
  12. Author:
  13. Evan Green 8-Oct-2014
  14. Environment:
  15. User
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. #include <assert.h>
  21. #include <errno.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <sys/types.h>
  26. #include "../setup.h"
  27. //
  28. // ---------------------------------------------------------------- Definitions
  29. //
  30. //
  31. // ------------------------------------------------------ Data Type Definitions
  32. //
  33. //
  34. // ----------------------------------------------- Internal Function Prototypes
  35. //
  36. //
  37. // -------------------------------------------------------------------- Globals
  38. //
  39. //
  40. // ------------------------------------------------------------------ Functions
  41. //
  42. INT
  43. SetupOsReboot (
  44. VOID
  45. )
  46. /*++
  47. Routine Description:
  48. This routine reboots the machine.
  49. Arguments:
  50. None.
  51. Return Value:
  52. 0 on success.
  53. Non-zero on failure.
  54. --*/
  55. {
  56. fprintf(stderr, "Not rebooting on Windows.\n");
  57. return ENOSYS;
  58. }
  59. INT
  60. SetupOsGetPlatformName (
  61. PSTR *Name,
  62. PSETUP_RECIPE_ID Fallback
  63. )
  64. /*++
  65. Routine Description:
  66. This routine gets the platform name.
  67. Arguments:
  68. Name - Supplies a pointer where a pointer to an allocated string containing
  69. the SMBIOS system information product name will be returned if
  70. available. The caller is responsible for freeing this memory when done.
  71. Fallback - Supplies a fallback platform to use if the given platform
  72. string was not returned or did not match a known platform.
  73. Return Value:
  74. 0 on success.
  75. Non-zero on failure.
  76. --*/
  77. {
  78. *Name = NULL;
  79. return ENOSYS;
  80. }
  81. INT
  82. SetupOsGetSystemMemorySize (
  83. PULONGLONG Megabytes
  84. )
  85. /*++
  86. Routine Description:
  87. This routine returns the number of megabytes of memory installed on the
  88. currently running system.
  89. Arguments:
  90. Megabytes - Supplies a pointer to where the system memory capacity in
  91. megabytes will be returned on success.
  92. Return Value:
  93. 0 on success.
  94. Non-zero on failure.
  95. --*/
  96. {
  97. *Megabytes = 0;
  98. return ENOSYS;
  99. }
  100. //
  101. // --------------------------------------------------------- Internal Functions
  102. //