Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
5.1 KiB

  1. //
  2. // Headless communication constants and structures.
  3. //
  4. #define VTUTF8_CLEAR_SCREEN L"\033[2J\033[0;0H"
  5. #define MY_MAX_STRING_LENGTH (256)
  6. typedef struct _UserInputParams {
  7. EMSVTUTF8Channel* Channel; // headless channel object
  8. HANDLE hInputCompleteEvent; //signals that the user is done.
  9. HANDLE hRemoveUI; //signals that we should abort.
  10. } UserInputParams, *PUserInputParams;
  11. typedef BOOL ( STDAPICALLTYPE *SETUPPIDGENW )(
  12. LPWSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
  13. LPCWSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
  14. LPCWSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
  15. BOOL fOem, // [IN] is this an OEM install?
  16. LPWSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
  17. LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
  18. LPBOOL pfCCP); // [OUT] optional ptr to Compliance Checking flag (can be NULL)
  19. DEFINE_GUID(
  20. SAC_CHANNEL_GUI_SETUP_PROMPT, /* 77320899-e37c-41bc-8cbc-840920e12b60 */
  21. 0x77320899,0xe37c,0x41bc,0x8c, 0xbc, 0x84, 0x09, 0x20, 0xe1, 0x2b, 0x60);
  22. //
  23. // PID presentation constants.
  24. //
  25. #define MAX_PID30_SITE (3)
  26. #define MAX_PID30_RPC (5)
  27. #define SETUP_TYPE_BUFFER_LEN (8)
  28. //
  29. // EULA presentation constants.
  30. //
  31. #define EULA_LINES_PER_SCREEN (15)
  32. //
  33. // EMS communication function prototypes.
  34. //
  35. BOOL
  36. IsHeadlessPresent(
  37. OUT EMSVTUTF8Channel **Channel
  38. );
  39. BOOL
  40. InitializeGlobalChannelAttributes(
  41. PSAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  42. );
  43. BOOL
  44. WaitForUserInputFromEMS(
  45. IN DWORD TimeOut,
  46. OUT BOOL *TimedOut, OPTIONAL
  47. IN HANDLE hCancelEvent OPTIONAL
  48. );
  49. BOOL
  50. ReadCharFromEMS(
  51. OUT PWCHAR awc,
  52. IN HANDLE hCancelEvent OPTIONAL
  53. );
  54. BOOL
  55. GetStringFromEMS(
  56. OUT PWSTR String,
  57. IN ULONG BufferSize,
  58. IN BOOL GetAllChars,
  59. IN BOOL EchoClearText,
  60. IN HANDLE hCancelEvent OPTIONAL
  61. );
  62. VOID
  63. ClearEMSScreen();
  64. BOOL
  65. GetDecodedKeyPressFromEMS(
  66. OUT PULONG KeyPress,
  67. IN HANDLE hCancelEvent OPTIONAL
  68. );
  69. #define ASCI_ETX 3 // control-C
  70. #define ASCI_BS 8
  71. #define ASCI_NL 10
  72. #define ASCI_C 67
  73. #define ASCI_LOWER_C 99
  74. #define ASCI_CR 13
  75. #define ASCI_ESC 27
  76. //
  77. // Character codes are passed around as ULONGs within setup.
  78. // The low word is a Unicode character value; the high word
  79. // is used for various other keypresses.
  80. //
  81. #define KEY_PAGEUP 0x00010000
  82. #define KEY_PAGEDOWN 0x00020000
  83. #define KEY_UP 0x00030000
  84. #define KEY_DOWN 0x00040000
  85. #define KEY_LEFT 0x00050000
  86. #define KEY_RIGHT 0x00060000
  87. #define KEY_HOME 0x00070000
  88. #define KEY_END 0x00080000
  89. #define KEY_INSERT 0x00090000
  90. #define KEY_DELETE 0x000a0000
  91. #define KEY_F1 0x00110000
  92. #define KEY_F2 0x00120000
  93. #define KEY_F3 0x00130000
  94. #define KEY_F4 0x00140000
  95. #define KEY_F5 0x00150000
  96. #define KEY_F6 0x00160000
  97. #define KEY_F7 0x00170000
  98. #define KEY_F8 0x00180000
  99. #define KEY_F9 0x00190000
  100. #define KEY_F10 0x001a0000
  101. #define KEY_F11 0x001b0000
  102. #define KEY_F12 0x001c0000
  103. //
  104. // PID function prototypes.
  105. //
  106. BOOL
  107. InitializePidVariables(
  108. );
  109. BOOL
  110. ValidatePidEx(
  111. LPTSTR PID,
  112. BOOL *pbStepup,
  113. BOOL *bSelect
  114. );
  115. BOOL
  116. ValidatePid30(
  117. LPTSTR aPID
  118. );
  119. BOOL
  120. ValidatePid30Assemble(
  121. LPTSTR Edit1,
  122. LPTSTR Edit2,
  123. LPTSTR Edit3,
  124. LPTSTR Edit4,
  125. LPTSTR Edit5
  126. );
  127. BOOL
  128. GetPid(
  129. IN PWSTR PidString,
  130. IN ULONG BufferSize,
  131. IN HANDLE hCancelEvent
  132. );
  133. //
  134. // EULA function prototypes
  135. //
  136. BOOL
  137. PresentEula(
  138. HANDLE hCancelEvent
  139. );
  140. //
  141. // Core Functionality
  142. //
  143. INT_PTR CALLBACK
  144. UserInputAbortProc(
  145. HWND hwndDlg, // handle to dialog box
  146. UINT uMsg, // message
  147. WPARAM wParam, // first message parameter
  148. LPARAM lParam // second message parameter
  149. );
  150. DWORD
  151. PromptForUserInputThreadOverHeadlessConnection(
  152. PVOID params
  153. );
  154. DWORD
  155. PromptForUserInputThreadViaLocalDialog(
  156. PVOID params
  157. );
  158. BOOL
  159. LoadStringResource(
  160. PUNICODE_STRING pUnicodeString,
  161. INT MsgId
  162. );
  163. BOOL
  164. WriteResourceMessage(
  165. ULONG MessageID
  166. );
  167. BOOL
  168. PromptForPassword(
  169. IN PWSTR Password,
  170. IN ULONG BufferSize,
  171. IN HANDLE hCancelEvent
  172. );
  173. DWORD
  174. ProcessUnattendFile(
  175. BOOL FixUnattendFile,
  176. PBOOL ProcessingRequired, OPTIONAL
  177. PHANDLE hCancelEvent OPTIONAL
  178. );
  179. extern "C"
  180. BOOL
  181. CheckEMS(
  182. IN int argc,
  183. WCHAR *argvW[]
  184. );