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.

616 lines
10 KiB

  1. //
  2. // migmainp.h - private declarations for migmain library
  3. //
  4. #pragma once
  5. #include "master.h"
  6. #include "masternt.h"
  7. #ifdef DEBUG
  8. extern BOOL g_NoReloadsAllowed;
  9. #endif
  10. //
  11. // Externs
  12. //
  13. extern HKEY g_hKeyRoot95, g_hKeyRootNT;
  14. extern PCTSTR g_DomainUserName;
  15. extern PCTSTR g_Win9xUserName;
  16. extern PCTSTR g_FixedUserName;
  17. extern PVOID g_HiveTable;
  18. extern POOLHANDLE g_HivePool;
  19. extern TCHAR g_UserDatLocation[MAX_TCHAR_PATH];
  20. extern PVOID g_NulSessionTable;
  21. extern BOOL g_WorkgroupFlag;
  22. extern BOOL g_DomainProblem;
  23. extern INT g_RetryCount;
  24. extern PCTSTR g_EveryoneStr;
  25. extern PCTSTR g_AdministratorsGroupStr;
  26. extern PCTSTR g_PowerUsersGroupStr;
  27. extern PCTSTR g_DomainUsersGroupStr;
  28. extern PCTSTR g_NoneGroupStr;
  29. extern TCHAR g_DefaultUserName[MAX_USER_NAME];
  30. extern BOOL g_PersonalSKU;
  31. extern GROWLIST g_StartMenuItemsForCleanUpCommon;
  32. extern GROWLIST g_StartMenuItemsForCleanUpPrivate;
  33. extern BOOL g_BlowAwayTempShellFolders;
  34. //
  35. // Defines
  36. //
  37. #define INDEX_MAX 3
  38. #define INDEX_ADMINISTRATOR 2
  39. #define INDEX_LOGON_PROMPT 1
  40. #define INDEX_DEFAULT_USER 0
  41. #define MAX_SID_SIZE 1024
  42. #define DOMAIN_RETRY_ABORT -2
  43. #define DOMAIN_RETRY_NO -1
  44. #define DOMAIN_RETRY_RESET 0
  45. #define DOMAIN_RETRY_MAX 3
  46. //
  47. // Bit test macros
  48. //
  49. #define BITSARESET(bits,mask) (((bits) & (mask)) == (mask))
  50. #define BITSARECLEAR(bits,mask) (((bits) & (mask)) == 0)
  51. //
  52. // Typedefs
  53. //
  54. typedef struct {
  55. PCWSTR User;
  56. PCWSTR Password;
  57. PCWSTR EncryptedPassword;
  58. DWORD PasswordAttribs;
  59. PCWSTR AdminComment;
  60. PCWSTR FullName;
  61. } ACCOUNTPROPERTIES, *PACCOUNTPROPERTIES;
  62. typedef struct {
  63. PCWSTR DomainName;
  64. PCWSTR Server;
  65. INT DomainNumber; // for enumeration
  66. } TRUST_ENUM, *PTRUST_ENUM;
  67. typedef struct _tagACCT_POSSIBLE_DOMAINS {
  68. struct _tagACCT_DOMAINS *DomainPtr;
  69. struct _tagACCT_POSSIBLE_DOMAINS *Next;
  70. } ACCT_POSSIBLE_DOMAINS, *PACCT_POSSIBLE_DOMAINS;
  71. typedef struct _tagACCT_USERS {
  72. PCWSTR User;
  73. INT PossibleDomains;
  74. struct _tagACCT_USERS *Next, *Prev;
  75. struct _tagACCT_DOMAINS *DomainPtr;
  76. // for users with unknown domains
  77. struct _tagACCT_POSSIBLE_DOMAINS *FirstPossibleDomain;
  78. } ACCT_USERS, *PACCT_USERS;
  79. typedef struct _tagACCT_DOMAINS {
  80. PCWSTR Domain;
  81. PCWSTR Server; // NULL if nul session not established
  82. INT UserCount;
  83. struct _tagACCT_DOMAINS *Next;
  84. struct _tagACCT_USERS *FirstUserPtr;
  85. } ACCT_DOMAINS, *PACCT_DOMAINS;
  86. typedef struct {
  87. PACCT_DOMAINS DomainPtr;
  88. PACCT_USERS UserPtr;
  89. PACCT_POSSIBLE_DOMAINS PossibleDomainPtr;
  90. } ACCT_ENUM, *PACCT_ENUM;
  91. typedef struct {
  92. DWORD Attribs;
  93. BOOL Enabled;
  94. BOOL Failed;
  95. PSID Sid; // used only in CreateAclFromMemberList
  96. TCHAR UserOrGroup[];
  97. } ACLMEMBER, *PACLMEMBER;
  98. //
  99. // Prototypes
  100. //
  101. PCTSTR
  102. GetMemDbDat (
  103. VOID
  104. );
  105. VOID
  106. RunExternalProcesses (
  107. IN HINF Inf,
  108. IN PMIGRATE_USER_ENUM EnumPtr
  109. );
  110. VOID
  111. UninstallUserProfileCleanupPreparation (
  112. IN HINF Inf,
  113. IN PMIGRATE_USER_ENUM EnumPtr,
  114. IN BOOL bPlayback
  115. );
  116. DWORD
  117. ProcessUser (
  118. IN DWORD Request,
  119. IN PMIGRATE_USER_ENUM EnumPtr
  120. );
  121. DWORD
  122. ProcessLocalMachine_First (
  123. DWORD Request
  124. );
  125. DWORD
  126. ProcessLocalMachine_Last (
  127. DWORD Request
  128. );
  129. DWORD
  130. ProcessMigrationDLLs (
  131. DWORD Request
  132. );
  133. PCTSTR GetString (WORD wMsg);
  134. VOID
  135. PrepareMigrationProgressBar (
  136. VOID
  137. );
  138. BOOL
  139. CallAllMigrationFunctions (
  140. VOID
  141. );
  142. VOID
  143. FindAccountInit (
  144. VOID
  145. );
  146. VOID
  147. FindAccountTerminate (
  148. VOID
  149. );
  150. BOOL
  151. SearchDomainsForUserAccounts (
  152. VOID
  153. );
  154. BOOL
  155. RetryMessageBox (
  156. DWORD Id,
  157. PCTSTR *ArgArray
  158. );
  159. PCWSTR
  160. GetDomainForUser (
  161. IN PCWSTR User
  162. );
  163. PSID
  164. GetSidForUser (
  165. PCWSTR User
  166. );
  167. PCTSTR
  168. GetUserProfilePath (
  169. IN PCTSTR AccountName,
  170. OUT PTSTR *BufferPtr
  171. );
  172. PCTSTR
  173. GetUserDatLocation (
  174. IN PCTSTR User,
  175. OUT PBOOL CreateOnlyFlag OPTIONAL
  176. );
  177. //
  178. // acctlist.c functions
  179. //
  180. VOID
  181. InitAccountList (
  182. VOID
  183. );
  184. VOID
  185. TerminateAccountList (
  186. VOID
  187. );
  188. PCWSTR
  189. ListFirstDomain (
  190. OUT PACCT_ENUM DomainEnumPtr
  191. );
  192. PCWSTR
  193. ListNextDomain (
  194. IN OUT PACCT_ENUM DomainEnumPtr
  195. );
  196. BOOL
  197. IsTrustedDomain (
  198. IN PACCT_ENUM DomainEnumPtr
  199. );
  200. BOOL
  201. FindDomainInList (
  202. OUT PACCT_ENUM DomainEnumPtr,
  203. IN PCWSTR DomainToFind
  204. );
  205. PCWSTR
  206. ListFirstUserInDomain (
  207. IN PACCT_ENUM DomainEnumPtr,
  208. OUT PACCT_ENUM UserEnumPtr
  209. );
  210. PCWSTR
  211. ListNextUserInDomain (
  212. IN OUT PACCT_ENUM UserEnumPtr
  213. );
  214. BOOL
  215. FindUserInDomain (
  216. IN PACCT_ENUM DomainEnumPtr,
  217. OUT PACCT_ENUM UserEnumPtr,
  218. IN PCWSTR UserToFind
  219. );
  220. INT
  221. CountUsersInDomain (
  222. IN PACCT_ENUM DomainEnumPtr
  223. );
  224. VOID
  225. AddDomainToList (
  226. IN PCWSTR Domain
  227. );
  228. BOOL
  229. AddUserToDomainList (
  230. IN PCWSTR User,
  231. IN PCWSTR Domain
  232. );
  233. VOID
  234. DeleteUserFromDomainList (
  235. IN PACCT_ENUM UserEnumPtr
  236. );
  237. BOOL
  238. MoveUserToNewDomain (
  239. IN OUT PACCT_ENUM UserEnumPtr,
  240. IN PCWSTR NewDomain
  241. );
  242. VOID
  243. UserMayBeInDomain (
  244. IN PACCT_ENUM UserEnumPtr,
  245. IN PACCT_ENUM DomainEnumPtr
  246. );
  247. VOID
  248. ClearPossibleDomains (
  249. IN PACCT_ENUM UserEnumPtr
  250. );
  251. VOID
  252. PrepareForRetry (
  253. VOID
  254. );
  255. PCWSTR
  256. ListFirstPossibleDomain (
  257. IN PACCT_ENUM UserEnumPtr,
  258. OUT PACCT_ENUM PossibleDomainEnumPtr
  259. );
  260. PCWSTR
  261. ListNextPossibleDomain (
  262. IN OUT PACCT_ENUM PossibleDomainEnumPtr
  263. );
  264. INT
  265. CountPossibleDomains (
  266. IN OUT PACCT_ENUM UserEnumPtr
  267. );
  268. BOOL
  269. BuildDomainList (
  270. VOID
  271. );
  272. BOOL
  273. QueryDomainForUser (
  274. IN PACCT_ENUM DomainEnumPtr,
  275. IN PACCT_ENUM UserEnumPtr
  276. );
  277. BOOL
  278. GetUserSid (
  279. IN PCWSTR User,
  280. IN PCWSTR Domain,
  281. IN OUT PGROWBUFFER SidBufPtr
  282. );
  283. BOOL
  284. GetUserType (
  285. IN PCWSTR User,
  286. IN PCWSTR Domain,
  287. OUT SID_NAME_USE *UseType
  288. );
  289. PCWSTR
  290. GetProfilePathForUser (
  291. IN PCWSTR User
  292. );
  293. VOID
  294. AutoStartProcessing (
  295. VOID
  296. );
  297. //
  298. // security.c functions
  299. //
  300. DWORD
  301. AddAclMember (
  302. IN OUT PGROWBUFFER GrowBuf,
  303. IN PCTSTR UserOrGroup,
  304. IN DWORD Attributes
  305. );
  306. VOID
  307. GetNextAclMember (
  308. IN OUT PACLMEMBER *AclMemberPtrToPtr
  309. );
  310. PACL
  311. CreateAclFromMemberList (
  312. IN OUT PBYTE AclMemberList,
  313. IN DWORD MemberCount
  314. );
  315. VOID
  316. FreeMemberListAcl (
  317. PACL Acl
  318. );
  319. LONG
  320. CreateLocalAccount (
  321. IN PACCOUNTPROPERTIES Properties,
  322. IN PCWSTR User OPTIONAL
  323. );
  324. BOOL
  325. AddSidToLocalGroup (
  326. IN PSID Sid,
  327. IN PCWSTR Group
  328. );
  329. BOOL
  330. IsMemberOfDomain (
  331. VOID
  332. );
  333. LONG
  334. GetAnyDC (
  335. IN PCWSTR Domain,
  336. IN PWSTR ServerBuf,
  337. IN BOOL GetNewServer
  338. );
  339. VOID
  340. ClearAdminPassword (
  341. VOID
  342. );
  343. #define SF_EVERYONE_NONE 0x00000001
  344. #define SF_EVERYONE_READ 0x00000002
  345. #define SF_EVERYONE_WRITE 0x00000004
  346. #define SF_EVERYONE_FULL 0x0000000e
  347. #define SF_EVERYONE_MASK 0x0000000f
  348. #define SF_ADMINISTRATORS_NONE 0x00000010
  349. #define SF_ADMINISTRATORS_READ 0x00000020
  350. #define SF_ADMINISTRATORS_WRITE 0x00000040
  351. #define SF_ADMINISTRATORS_FULL 0x000000e0
  352. #define SF_ADMINISTRATORS_MASK 0x000000f0
  353. DWORD
  354. SetRegKeySecurity (
  355. IN PCTSTR KeyStr,
  356. IN DWORD DaclFlags, OPTIONAL // see SF_* constants above
  357. IN PSID Owner, OPTIONAL
  358. IN PSID PrimaryGroup, OPTIONAL
  359. IN BOOL Recursive
  360. );
  361. //
  362. // FileMig stuff
  363. //
  364. BOOL
  365. DoFileDel (
  366. VOID
  367. );
  368. BOOL
  369. DoLinkEdit (
  370. VOID
  371. );
  372. DWORD
  373. DoCopyFile (
  374. DWORD Request
  375. );
  376. DWORD
  377. DoMoveFile (
  378. DWORD Request
  379. );
  380. BOOL
  381. RemoveEmptyDirs (
  382. VOID
  383. );
  384. BOOL
  385. ProcessStfFiles (
  386. VOID
  387. );
  388. BOOL
  389. UpdateBriefcaseDatabasePaths (
  390. VOID
  391. );
  392. //
  393. // iniact.c
  394. //
  395. typedef enum {
  396. INIACT_WKS_FIRST,
  397. INIACT_WKS_LAST
  398. } INIACT_CONTEXT;
  399. BOOL
  400. DoIniActions (
  401. IN INIACT_CONTEXT Context
  402. );
  403. //
  404. // inifiles.c
  405. //
  406. BOOL
  407. ProcessIniFileMapping (
  408. IN BOOL UserMode
  409. );
  410. BOOL
  411. MoveIniSettings (
  412. VOID
  413. );
  414. BOOL
  415. MergeIniFile (
  416. IN PCTSTR FileNtLocation,
  417. IN PCTSTR FileTempLocation,
  418. IN BOOL TempHasPriority
  419. );
  420. BOOL
  421. ConvertIniFile (
  422. IN PCTSTR IniFilePath
  423. );
  424. BOOL
  425. ConvertIniFiles (
  426. VOID
  427. );
  428. BOOL
  429. MergeIniSettings (
  430. VOID
  431. );
  432. BOOL
  433. RestoreMMSettings_System (
  434. VOID
  435. );
  436. BOOL
  437. RestoreMMSettings_User (
  438. IN PCTSTR UserName,
  439. IN HKEY UserRoot
  440. );
  441. //
  442. // shllink.c
  443. //
  444. BOOL
  445. ModifyShellLink(
  446. IN PCWSTR FileName,
  447. IN PCWSTR NewTarget,
  448. IN PCWSTR NewArgs,
  449. IN PCWSTR NewWorkDir,
  450. IN PCWSTR NewIconPath,
  451. IN INT NewIconNumber,
  452. IN BOOL ConvertToLnk,
  453. IN PLNK_EXTRA_DATA ExtraData, OPTIONAL
  454. IN BOOL ForceToShowNormal
  455. );
  456. BOOL
  457. RestoreInfoFromDefaultPif (
  458. IN PCTSTR UserName,
  459. IN HKEY KeyRoot
  460. );
  461. BOOL
  462. OurMoveFileExW (
  463. IN PCWSTR ExistingFile,
  464. IN PCWSTR DestinationFile,
  465. IN DWORD Flags
  466. );
  467. #define OurMoveFileW(exist,dest) OurMoveFileExW(exist,dest,0)
  468. BOOL
  469. OurMoveFileExA (
  470. IN PCSTR ExistingFile,
  471. IN PCSTR DestinationFile,
  472. IN DWORD Flags
  473. );
  474. #define OurMoveFileA(exist,dest) OurMoveFileExA(exist,dest,0)
  475. BOOL
  476. OurCopyFileW (
  477. IN PCWSTR ExistingFile,
  478. IN PCWSTR DestinationFile
  479. );
  480. VOID
  481. SetClassicLogonType (
  482. VOID
  483. );
  484. #ifdef UNICODE
  485. #define OurMoveFileEx OurMoveFileExW
  486. #define OurMoveFile OurMoveFileW
  487. #else
  488. #define OurMoveFileEx OurMoveFileExA
  489. #define OurMoveFile OurMoveFileA
  490. #endif