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.

582 lines
9.3 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. osc.h
  5. Abstract:
  6. This file containes definitions for the OS chooser server part.
  7. Author:
  8. Adam Barr (adamba) 08-Jul-1997
  9. Environment:
  10. User Mode - Win32 - MIDL
  11. Revision History:
  12. --*/
  13. #ifndef _OSCSERVER_
  14. #define _OSCSERVER_
  15. //
  16. // list and lock for keeping track of queued DS names
  17. //
  18. extern LIST_ENTRY QueuedDSNamesList;
  19. extern CRITICAL_SECTION QueuedDSNamesCriticalSection;
  20. //
  21. // Functions in osc.c.
  22. //
  23. DWORD
  24. OscInitialize(
  25. VOID
  26. );
  27. VOID
  28. OscUninitialize(
  29. VOID
  30. );
  31. DWORD
  32. OscProcessMessage(
  33. LPBINL_REQUEST_CONTEXT RequestContext
  34. );
  35. DWORD
  36. OscVerifyLastResponseSize(
  37. PCLIENT_STATE clientState
  38. );
  39. DWORD
  40. OscProcessNegotiate(
  41. LPBINL_REQUEST_CONTEXT RequestContext,
  42. PCLIENT_STATE clientState
  43. );
  44. DWORD
  45. OscProcessAuthenticate(
  46. LPBINL_REQUEST_CONTEXT RequestContext,
  47. PCLIENT_STATE clientState
  48. );
  49. DWORD
  50. OscProcessScreenArguments(
  51. LPBINL_REQUEST_CONTEXT RequestContext,
  52. PCLIENT_STATE clientState,
  53. PUCHAR *NameLoc
  54. );
  55. DWORD
  56. OscProcessRequestUnsigned(
  57. LPBINL_REQUEST_CONTEXT RequestContext,
  58. PCLIENT_STATE clientState
  59. );
  60. OscInstallClient(
  61. LPBINL_REQUEST_CONTEXT RequestContext,
  62. PCLIENT_STATE clientState,
  63. PCREATE_DATA createData
  64. );
  65. DWORD
  66. OscGetCreateData(
  67. LPBINL_REQUEST_CONTEXT RequestContext,
  68. PCLIENT_STATE clientState,
  69. PCREATE_DATA CreateData
  70. );
  71. DWORD
  72. OscProcessRequestSigned(
  73. LPBINL_REQUEST_CONTEXT RequestContext,
  74. PCLIENT_STATE clientState
  75. );
  76. DWORD
  77. OscProcessSetupRequest(
  78. LPBINL_REQUEST_CONTEXT RequestContext,
  79. PCLIENT_STATE clientState
  80. );
  81. DWORD
  82. OscProcessLogoff(
  83. LPBINL_REQUEST_CONTEXT RequestContext,
  84. PCLIENT_STATE clientState
  85. );
  86. DWORD
  87. OscProcessNetcardRequest(
  88. LPBINL_REQUEST_CONTEXT RequestContext
  89. );
  90. DWORD
  91. OscProcessHalRequest(
  92. LPBINL_REQUEST_CONTEXT RequestContext,
  93. PCLIENT_STATE clientState
  94. );
  95. DWORD
  96. OscProcessSifFile(
  97. PCLIENT_STATE clientState,
  98. LPWSTR TemplateFile,
  99. LPWSTR WinntSifPath
  100. );
  101. DWORD
  102. OscSetupClient(
  103. PCLIENT_STATE clientState,
  104. BOOLEAN ErrorDuplicateName
  105. );
  106. VOID
  107. OscUndoSetupClient(
  108. PCLIENT_STATE clientState
  109. );
  110. USHORT
  111. OscPlatformToArchitecture(
  112. PCLIENT_STATE clientState
  113. );
  114. //
  115. // client.c
  116. //
  117. DWORD
  118. OscUpdatePassword(
  119. IN PCLIENT_STATE ClientState,
  120. IN PWCHAR SamAccountName,
  121. IN PWCHAR Password,
  122. IN LDAP * LdapHandle,
  123. IN PLDAPMessage LdapMessage
  124. );
  125. VOID
  126. FreeClient(
  127. PCLIENT_STATE client
  128. );
  129. VOID
  130. OscFreeClientVariables(
  131. PCLIENT_STATE clientState
  132. );
  133. BOOLEAN
  134. OscInitializeClientVariables(
  135. PCLIENT_STATE clientState
  136. );
  137. DWORD
  138. OscFindClient(
  139. ULONG RemoteIp,
  140. BOOL Remove,
  141. PCLIENT_STATE * pClientState
  142. );
  143. VOID
  144. OscFreeClients(
  145. VOID
  146. );
  147. VOID
  148. SearchAndReplace(
  149. LPSAR psarList,
  150. LPSTR *pszString,
  151. DWORD ArraySize,
  152. DWORD dwSize,
  153. DWORD dwExtraSize
  154. );
  155. VOID
  156. ProcessUniqueUdb(
  157. LPSTR *pszString,
  158. DWORD dwSize,
  159. LPWSTR UniqueUdbPath,
  160. LPWSTR UniqueUdbId
  161. );
  162. LPSTR
  163. OscFindVariableA(
  164. PCLIENT_STATE clientState,
  165. LPSTR variableName
  166. );
  167. LPWSTR
  168. OscFindVariableW(
  169. PCLIENT_STATE clientState,
  170. LPSTR variableName
  171. );
  172. BOOLEAN
  173. OscCheckVariableLength(
  174. PCLIENT_STATE clientState,
  175. LPSTR variableName,
  176. ULONG variableLength
  177. );
  178. DWORD
  179. OscAddVariableA(
  180. PCLIENT_STATE clientState,
  181. LPSTR variableName,
  182. LPSTR variableValue
  183. );
  184. DWORD
  185. OscAddVariableW(
  186. PCLIENT_STATE clientState,
  187. LPSTR variableName,
  188. LPWSTR variableValue
  189. );
  190. VOID
  191. OscResetVariable(
  192. PCLIENT_STATE clientState,
  193. LPSTR variableName
  194. );
  195. //
  196. // ds.c
  197. //
  198. DWORD
  199. OscGetUserDetails (
  200. PCLIENT_STATE clientState
  201. );
  202. DWORD
  203. OscCreateAccount(
  204. PCLIENT_STATE clientState,
  205. PCREATE_DATA CreateData
  206. );
  207. DWORD
  208. CheckForDuplicateMachineName(
  209. PCLIENT_STATE clientState,
  210. LPWSTR pszMachineName
  211. );
  212. DWORD
  213. GenerateMachineName(
  214. PCLIENT_STATE clientState
  215. );
  216. DWORD
  217. OscCheckMachineDN(
  218. PCLIENT_STATE clientState
  219. );
  220. DWORD
  221. OscGetDefaultContainerForDomain (
  222. PCLIENT_STATE clientState,
  223. PWCHAR DomainDN
  224. );
  225. //
  226. // menu.c
  227. //
  228. DWORD
  229. OscAppendTemplatesMenus(
  230. PCHAR *GeneratedScreen,
  231. PDWORD dwGeneratedSize,
  232. PCHAR DirToEnum,
  233. PCLIENT_STATE clientState,
  234. BOOLEAN RecoveryOptionsOnly
  235. );
  236. DWORD
  237. SearchAndGenerateOSMenu(
  238. PCHAR *GeneratedScreen,
  239. PDWORD dwGeneratedSize,
  240. PCHAR DirToEnum,
  241. PCLIENT_STATE clientState
  242. );
  243. DWORD
  244. FilterFormOptions(
  245. PCHAR OutMessage,
  246. PCHAR FilterStart,
  247. PULONG OutMessageLength,
  248. PCHAR SectionName,
  249. PCLIENT_STATE ClientState
  250. );
  251. //
  252. // utils.c
  253. //
  254. void
  255. OscCreateWin32SubError(
  256. PCLIENT_STATE clientState,
  257. DWORD Error
  258. );
  259. void
  260. OscCreateLDAPSubError(
  261. PCLIENT_STATE clientState,
  262. DWORD Error
  263. );
  264. VOID
  265. OscGenerateSeed(
  266. UCHAR Seed[1]
  267. );
  268. DWORD
  269. OscRunEncode(
  270. IN PCLIENT_STATE ClientState,
  271. IN LPSTR Data,
  272. OUT LPSTR * EncodedData
  273. );
  274. DWORD
  275. OscRunDecode(
  276. IN PCLIENT_STATE ClientState,
  277. IN LPSTR EncodedData,
  278. OUT LPSTR * Data
  279. );
  280. BOOLEAN
  281. OscGenerateRandomBits(
  282. PUCHAR Buffer,
  283. ULONG BufferLen
  284. );
  285. VOID
  286. OscGeneratePassword(
  287. OUT PWCHAR Password,
  288. OUT PULONG PasswordLength
  289. );
  290. DWORD
  291. GenerateErrorScreen(
  292. PCHAR *OutMessage,
  293. PULONG OutMessageLength,
  294. DWORD Error,
  295. PCLIENT_STATE clientState
  296. );
  297. PCHAR
  298. FindNext(
  299. PCHAR Start,
  300. CHAR ch,
  301. PCHAR End
  302. );
  303. PCHAR
  304. FindScreenName(
  305. PCHAR Screen
  306. );
  307. DWORD
  308. OscImpersonate(
  309. PCLIENT_STATE ClientState
  310. );
  311. DWORD
  312. OscRevert(
  313. PCLIENT_STATE ClientState
  314. );
  315. DWORD
  316. OscGuidToBytes(
  317. LPSTR pszGuid,
  318. LPBYTE Guid
  319. );
  320. BOOLEAN
  321. OscSifIsSysPrep(
  322. PWCHAR pSysPrepSifPath
  323. );
  324. BOOLEAN
  325. OscSifIsCmdConsA(
  326. PCHAR pSysPrepSifPath
  327. );
  328. BOOLEAN
  329. OscSifIsASR(
  330. PCHAR pSysPrepSifPath
  331. );
  332. BOOLEAN
  333. OscSifIsWinPE(
  334. PCHAR pSysPrepSifPath
  335. );
  336. BOOLEAN
  337. OscGetClosestNt(
  338. IN LPWSTR PathToKernel,
  339. IN DWORD SkuType,
  340. IN PCLIENT_STATE ClientState,
  341. OUT LPWSTR SetupPath,
  342. IN DWORD SetupPathSize,
  343. OUT PBOOLEAN ExactMatch
  344. );
  345. BOOLEAN
  346. OscGetNtVersionInfo(
  347. PULONGLONG Version,
  348. PWCHAR SearchDir,
  349. PCLIENT_STATE ClientState
  350. );
  351. DWORD
  352. SendUdpMessage(
  353. LPBINL_REQUEST_CONTEXT RequestContext,
  354. PCLIENT_STATE clientState,
  355. BOOL bFragment,
  356. BOOL bResend
  357. );
  358. DWORD
  359. OscVerifySignature(
  360. PCLIENT_STATE clientState,
  361. SIGNED_PACKET UNALIGNED * signedMessage
  362. );
  363. DWORD
  364. OscSendSignedMessage(
  365. LPBINL_REQUEST_CONTEXT RequestContext,
  366. PCLIENT_STATE clientState,
  367. PCHAR Message,
  368. ULONG MessageLength
  369. );
  370. DWORD
  371. OscSendUnsignedMessage(
  372. LPBINL_REQUEST_CONTEXT RequestContext,
  373. PCLIENT_STATE clientState,
  374. PCHAR Message,
  375. ULONG MessageLength
  376. );
  377. DWORD
  378. OscSendSetupMessage(
  379. LPBINL_REQUEST_CONTEXT RequestContext,
  380. PCLIENT_STATE clientState,
  381. ULONG RequestType,
  382. PCHAR Message,
  383. ULONG MessageLength
  384. );
  385. DWORD
  386. OscConstructSecret(
  387. PCLIENT_STATE clientState,
  388. PWCHAR UnicodePassword,
  389. ULONG UnicodePasswordLength,
  390. PCREATE_DATA CreateData
  391. );
  392. #if defined(SET_ACLS_ON_CLIENT_DIRS)
  393. DWORD
  394. OscSetClientDirectoryPermissions(
  395. PCLIENT_STATE clientState
  396. );
  397. #endif
  398. DWORD
  399. OscSetupMachinePassword(
  400. PCLIENT_STATE clientState,
  401. PCWSTR SifFile
  402. );
  403. DWORD
  404. MyGetDcHandle(
  405. PCLIENT_STATE clientState,
  406. PCSTR DomainName,
  407. PHANDLE Handle
  408. );
  409. DWORD
  410. GetDomainNetBIOSName(
  411. IN PCWSTR DomainNameInAnyFormat,
  412. OUT PWSTR *NetBIOSName
  413. );
  414. //
  415. //
  416. //
  417. DWORD
  418. AddQueuedDSName(
  419. PWCHAR Name
  420. );
  421. DWORD
  422. RemoveQueuedDSName(
  423. PWCHAR Name
  424. );
  425. BOOL
  426. IsQueuedDSName(
  427. PWCHAR Name
  428. );
  429. VOID
  430. FreeQueuedDSNameList(
  431. VOID
  432. );
  433. //
  434. // OSC packet definitions.
  435. //
  436. #define OSC_REQUEST 0x81
  437. //
  438. // Miscellaneous definitions.
  439. //
  440. #define DESCRIPTION_SIZE 70 // 70 cols
  441. #define HELPLINES_SIZE 4 * 70 // 4 lines of text
  442. #define OSCHOOSER_SIF_SECTIONA "OSChooser"
  443. #define OSCHOOSER_SIF_SECTIONW L"OSChooser"
  444. #define COMPUTER_DEFAULT_CONTAINER_IN_B32_FORM L"B:32:AA312825768811D1ADED00C04FD8D5CD:"
  445. //
  446. // Default "default screen" (the first one sent down) if none is specified
  447. // in the registry. Note that this is the actual filename, not the NAME
  448. // value within it.
  449. //
  450. #define DEFAULT_SCREEN_NAME L"welcome.osc"
  451. //
  452. // This defines the size by which the generated screen buffers will grow.
  453. //
  454. #define GENERATED_SCREEN_GROW_SIZE 512
  455. //
  456. // Make English default
  457. //
  458. #define DEFAULT_LANGUAGE L"English"
  459. //
  460. // Default value for %ORGNAME%
  461. //
  462. #define DEFAULT_ORGNAME L""
  463. //
  464. // Default value for %TIMEZONE% (GMT)
  465. //
  466. #define DEFAULT_TIMEZONE L"085"
  467. //
  468. // Name of the tmp directory we create below the REMINST share.
  469. //
  470. #define TEMP_DIRECTORY L"tmp"
  471. #endif