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.

728 lines
15 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. v1p.h
  5. Abstract:
  6. Header file for shared types, macros, etc., common to all v1 source files.
  7. Author:
  8. Jim Schmidt (jimschm) 14-Mar-2000
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. //
  13. // Includes
  14. //
  15. #include "logmsg.h"
  16. //
  17. // Strings
  18. //
  19. #define S_SOURCE_MACHINE_SECTION TEXT("Source Machine")
  20. #define S_VERSION_INFKEY TEXT("version")
  21. #define S_ACP_INFKEY TEXT("acp")
  22. #define S_USER_SECTION TEXT("User")
  23. #define S_USER_INFKEY TEXT("User")
  24. #define S_DOMAIN_INFKEY TEXT("Domain")
  25. #define S_HKCU TEXT("HKCU")
  26. #define S_HKCC TEXT("HKCC")
  27. #define S_HKLM TEXT("HKLM")
  28. #define S_HKR TEXT("HKR")
  29. #define S_V1PROP_ICONDATA TEXT("V1.PROP.ICONDATA")
  30. #define S_V1PROP_FILECOLLPATTERN TEXT("V1.PROP.FILECOLLPATTERN")
  31. #define S_OE_COMPONENT TEXT("$Outlook Express")
  32. #define S_OUTLOOK9798_COMPONENT TEXT("$Microsoft Outlook 97 & 98")
  33. #define S_OFFICE_COMPONENT TEXT("$Microsoft Office")
  34. #define S_OE4_APPDETECT TEXT("Outlook Express.OutlookExpress4")
  35. #define S_OE5_APPDETECT TEXT("Outlook Express.OutlookExpress5")
  36. #define S_OUTLOOK9798_APPDETECT TEXT("Microsoft Outlook 97 & 98.Outlook98.97")
  37. #define S_OFFICE9798_APPDETECT TEXT("Microsoft Office.Microsoft Office 97")
  38. #define S_FIXED_DRIVES TEXT("FIXED_DRIVES")
  39. //
  40. // Constants
  41. //
  42. #define ACTION_PERSIST 0x0001
  43. #define ACTION_PERSIST_PATH_IN_DATA 0x0002
  44. #define ACTION_PERSIST_ICON_IN_DATA 0x0004
  45. #define ACTION_PRIORITYSRC 0x0001
  46. #define ACTION_PRIORITYDEST 0x0002
  47. typedef enum {
  48. ACTIONGROUP_NONE = 0,
  49. ACTIONGROUP_DEFAULTPRIORITY,
  50. ACTIONGROUP_SPECIFICPRIORITY,
  51. ACTIONGROUP_FILECOLLPATTERN,
  52. ACTIONGROUP_EXCLUDE,
  53. ACTIONGROUP_EXCLUDEEX,
  54. ACTIONGROUP_INCLUDE,
  55. ACTIONGROUP_INCLUDEEX,
  56. ACTIONGROUP_RENAME,
  57. ACTIONGROUP_RENAMEEX,
  58. ACTIONGROUP_INCLUDERELEVANT,
  59. ACTIONGROUP_INCLUDERELEVANTEX,
  60. ACTIONGROUP_RENAMERELEVANT,
  61. ACTIONGROUP_RENAMERELEVANTEX,
  62. ACTIONGROUP_INCFILE,
  63. ACTIONGROUP_INCFILEEX,
  64. ACTIONGROUP_INCFOLDER,
  65. ACTIONGROUP_INCFOLDEREX,
  66. ACTIONGROUP_INCICON,
  67. ACTIONGROUP_INCICONEX,
  68. ACTIONGROUP_DELREGKEY,
  69. } ACTIONGROUP, *PACTIONGROUP;
  70. #define ACTIONWEIGHT_EXCLUDE 0x00000001
  71. #define ACTIONWEIGHT_EXCLUDEEX 0x00000002
  72. #define ACTIONWEIGHT_DELREGKEY 0x00000003
  73. #define ACTIONWEIGHT_INCLUDE 0x00000004
  74. #define ACTIONWEIGHT_INCLUDEEX 0x00000005
  75. #define ACTIONWEIGHT_RENAME 0x00000006
  76. #define ACTIONWEIGHT_RENAMEEX 0x00000007
  77. #define ACTIONWEIGHT_INCLUDERELEVANT 0x00000008
  78. #define ACTIONWEIGHT_INCLUDERELEVANTEX 0x00000009
  79. #define ACTIONWEIGHT_RENAMERELEVANT 0x0000000A
  80. #define ACTIONWEIGHT_RENAMERELEVANTEX 0x0000000B
  81. #define ACTIONWEIGHT_INCFILE 0x0000000C
  82. #define ACTIONWEIGHT_INCFILEEX 0x0000000D
  83. #define ACTIONWEIGHT_INCFOLDER 0x0000000E
  84. #define ACTIONWEIGHT_INCFOLDEREX 0x0000000F
  85. #define ACTIONWEIGHT_INCICON 0x00000010
  86. #define ACTIONWEIGHT_INCICONEX 0x00000011
  87. #define ACTIONWEIGHT_DEFAULTPRIORITY 0x00000001
  88. #define ACTIONWEIGHT_SPECIFICPRIORITY 0x10000000
  89. #define ACTIONWEIGHT_FILECOLLPATTERN 0x00000000
  90. typedef enum {
  91. RULEGROUP_NORMAL = 0,
  92. RULEGROUP_PRIORITY,
  93. RULEGROUP_COLLPATTERN
  94. } RULEGROUP;
  95. #define PFF_NO_PATTERNS_ALLOWED 0x0001
  96. #define PFF_COMPUTE_BASE 0x0002
  97. #define PFF_NO_SUBDIR_PATTERN 0x0004
  98. #define PFF_NO_LEAF_PATTERN 0x0008
  99. #define PFF_PATTERN_IS_DIR 0x0010
  100. #define PFF_NO_LEAF_AT_ALL (PFF_NO_LEAF_PATTERN|PFF_PATTERN_IS_DIR)
  101. //
  102. // Macros
  103. //
  104. // None
  105. //
  106. // Types
  107. //
  108. typedef struct {
  109. PMAPSTRUCT AppEnvMapSrc;
  110. PMAPSTRUCT AppEnvMapDest;
  111. PMAPSTRUCT UndefEnvMapSrc;
  112. PMAPSTRUCT UndefEnvMapDest;
  113. } APP_SPECIFIC_DATA, *PAPP_SPECIFIC_DATA;
  114. typedef struct {
  115. MIG_OBJECTSTRINGHANDLE ObjectBase;
  116. MIG_OBJECTSTRINGHANDLE ObjectDest;
  117. MIG_OBJECTSTRINGHANDLE AddnlDest;
  118. PCTSTR ObjectHint;
  119. PAPP_SPECIFIC_DATA AppSpecificData;
  120. } ACTION_STRUCT, *PACTION_STRUCT;
  121. typedef struct {
  122. MIG_PLATFORMTYPEID Platform;
  123. PCTSTR ScriptSpecifiedType;
  124. PCTSTR ScriptSpecifiedObject;
  125. PCTSTR ApplicationName;
  126. PCTSTR ReturnString;
  127. union {
  128. struct _TAG_ISM_OBJECT {
  129. MIG_OBJECTTYPEID ObjectTypeId;
  130. MIG_OBJECTSTRINGHANDLE ObjectName;
  131. PMIG_CONTENT ObjectContent;
  132. };
  133. struct _TAG_OBJECT {
  134. UINT DataSize;
  135. PCBYTE Data;
  136. };
  137. };
  138. } ATTRIB_DATA, *PATTRIB_DATA;
  139. ETMINITIALIZE ScriptEtmInitialize;
  140. ETMPARSE ScriptEtmParse;
  141. ETMTERMINATE ScriptEtmTerminate;
  142. ETMINITIALIZE CertificatesEtmInitialize;
  143. ETMTERMINATE CertificatesEtmTerminate;
  144. ETMNEWUSERCREATED CertificatesEtmNewUserCreated;
  145. VCMINITIALIZE ScriptVcmInitialize;
  146. VCMPARSE ScriptVcmParse;
  147. VCMQUEUEENUMERATION ScriptVcmQueueEnumeration;
  148. VCMTERMINATE ScriptTerminate;
  149. SGMINITIALIZE ScriptSgmInitialize;
  150. SGMPARSE ScriptSgmParse;
  151. SGMQUEUEENUMERATION ScriptSgmQueueEnumeration;
  152. DGMINITIALIZE ScriptDgmInitialize;
  153. DGMQUEUEENUMERATION ScriptDgmQueueEnumeration;
  154. CSMINITIALIZE ScriptCsmInitialize;
  155. CSMTERMINATE ScriptCsmTerminate;
  156. CSMEXECUTE ScriptCsmExecute;
  157. OPMINITIALIZE ScriptOpmInitialize;
  158. OPMTERMINATE ScriptOpmTerminate;
  159. //
  160. // Globals
  161. //
  162. extern PMAPSTRUCT g_EnvMap;
  163. extern PMAPSTRUCT g_UndefMap;
  164. extern PMAPSTRUCT g_RevEnvMap;
  165. extern HASHTABLE g_RenameSrcTable;
  166. extern HASHTABLE g_RenameDestTable;
  167. extern HASHTABLE g_DePersistTable;
  168. extern PMHANDLE g_V1Pool;
  169. extern MIG_OBJECTTYPEID g_FileType;
  170. extern MIG_OBJECTTYPEID g_RegType;
  171. extern MIG_OBJECTTYPEID g_IniType;
  172. extern MIG_OBJECTTYPEID g_CertType;
  173. extern MIG_OPERATIONID g_RenameOp;
  174. extern MIG_OPERATIONID g_RenameIniOp;
  175. extern MIG_OPERATIONID g_RenameFileExOp;
  176. extern MIG_OPERATIONID g_RenameFileOp;
  177. extern MIG_OPERATIONID g_DeleteOp;
  178. extern MIG_OPERATIONID g_RenameExOp;
  179. extern MIG_OPERATIONID g_RenameIniExOp;
  180. extern MIG_ATTRIBUTEID g_OsFileAttribute;
  181. extern MIG_ATTRIBUTEID g_CopyIfRelevantAttr;
  182. extern MIG_ATTRIBUTEID g_LockPartitionAttr;
  183. extern MIG_PROPERTYID g_DefaultIconData;
  184. extern MIG_PROPERTYID g_FileCollPatternData;
  185. extern MIG_OPERATIONID g_DefaultIconOp;
  186. extern MIG_OPERATIONID g_DestAddObject;
  187. extern MIG_OPERATIONID g_RegAutoFilterOp;
  188. extern MIG_OPERATIONID g_IniAutoFilterOp;
  189. extern BOOL g_PreParse;
  190. extern PMAPSTRUCT g_DestEnvMap;
  191. extern PMAPSTRUCT g_FileNodeFilterMap;
  192. extern BOOL g_OERulesMigrated;
  193. extern GROWLIST g_SectionStack;
  194. //
  195. // Macro expansion lists
  196. //
  197. #define STANDARD_DWORD_SETTINGS \
  198. #define STANDARD_STRING_SETTINGS \
  199. DEFMAC("timezone", "hklm\\System\\CurrentControlSet\\Control\\TimeZoneInformation", "StandardName") \
  200. DEFMAC("locale", "hklm\\System\\CurrentControlSet\\Control\\Nls\\Locale", "") \
  201. #define STANDARD_STRING_SETTINGS_9X \
  202. DEFMAC("fullname", "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "RegisteredOwner") \
  203. DEFMAC("orgname", "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "RegisteredOrganization") \
  204. #define STANDARD_STRING_SETTINGS_NT \
  205. DEFMAC("fullname", "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOwner") \
  206. DEFMAC("orgname", "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "RegisteredOrganization")\
  207. //
  208. // Public function prototypes
  209. //
  210. MIG_OBJECTSTRINGHANDLE
  211. MakeRegExBase (
  212. IN PCTSTR Node,
  213. IN PCTSTR Leaf
  214. );
  215. MIG_OBJECTSTRINGHANDLE
  216. CreatePatternFromNodeLeaf (
  217. IN PCTSTR Node,
  218. IN PCTSTR Leaf
  219. );
  220. MIG_OBJECTSTRINGHANDLE
  221. TurnRegStringIntoHandle (
  222. IN PCTSTR String,
  223. IN BOOL Pattern,
  224. OUT PBOOL HadLeaf OPTIONAL
  225. );
  226. MIG_OBJECTSTRINGHANDLE
  227. TurnFileStringIntoHandle (
  228. IN PCTSTR String,
  229. IN DWORD Flags
  230. );
  231. MIG_OBJECTSTRINGHANDLE
  232. TurnIniSpecIntoHandle (
  233. IN PCTSTR IniFile,
  234. IN PCTSTR Section,
  235. IN PCTSTR Key,
  236. IN BOOL NodePatternsAllowed,
  237. IN BOOL LeafPatternsAllowed
  238. );
  239. MIG_OBJECTSTRINGHANDLE
  240. TurnCertSpecIntoHandle (
  241. IN PCTSTR CertStore,
  242. IN PCTSTR CertName,
  243. IN BOOL PatternsAllowed
  244. );
  245. BOOL
  246. AllocScriptType (
  247. IN OUT PATTRIB_DATA AttribData CALLER_INITIALIZED
  248. );
  249. BOOL
  250. FreeScriptType (
  251. IN PATTRIB_DATA AttribData ZEROED
  252. );
  253. VOID
  254. InitSpecialConversion (
  255. IN MIG_PLATFORMTYPEID Platform
  256. );
  257. VOID
  258. TerminateSpecialConversion (
  259. VOID
  260. );
  261. VOID
  262. InitSpecialRename (
  263. IN MIG_PLATFORMTYPEID Platform
  264. );
  265. VOID
  266. TerminateSpecialRename (
  267. VOID
  268. );
  269. VOID
  270. InitRules (
  271. VOID
  272. );
  273. VOID
  274. TerminateRules (
  275. VOID
  276. );
  277. BOOL
  278. AddRuleEx (
  279. IN MIG_OBJECTTYPEID Type,
  280. IN MIG_OBJECTSTRINGHANDLE ObjectBase,
  281. IN MIG_OBJECTSTRINGHANDLE ObjectPattern,
  282. IN ACTIONGROUP ActionGroup,
  283. IN DWORD ActionFlags,
  284. IN PACTION_STRUCT ActionStruct, OPTIONAL
  285. IN RULEGROUP RuleGroup
  286. );
  287. #define AddRule(t,b,p,g,f,s) AddRuleEx(t,b,p,g,f,s,RULEGROUP_NORMAL)
  288. BOOL
  289. QueryRuleEx (
  290. IN MIG_OBJECTTYPEID Type,
  291. IN MIG_OBJECTSTRINGHANDLE EncodedString,
  292. IN PCTSTR ObjectNode,
  293. OUT PACTIONGROUP ActionGroup,
  294. OUT PDWORD ActionFlags,
  295. OUT PACTION_STRUCT ActionStruct, OPTIONAL
  296. IN RULEGROUP RuleGroup
  297. );
  298. #define QueryRule(t,e,n,g,f,s) QueryRuleEx(t,e,n,g,f,s,RULEGROUP_NORMAL)
  299. //
  300. // renregfn.c
  301. //
  302. BOOL
  303. DoRegistrySpecialConversion (
  304. IN HINF InfHandle,
  305. IN PCTSTR Section
  306. );
  307. BOOL
  308. DoRegistrySpecialRename (
  309. IN HINF InfHandle,
  310. IN PCTSTR Section
  311. );
  312. BOOL
  313. AddSpecialRenameRule (
  314. IN PCTSTR Pattern,
  315. IN PCTSTR Function
  316. );
  317. //
  318. // sgmutils.c
  319. //
  320. PCTSTR
  321. GetShellFolderPath (
  322. IN INT Folder,
  323. IN PCTSTR FolderStr,
  324. IN BOOL UserFolder,
  325. OUT PTSTR Buffer
  326. );
  327. PCTSTR
  328. GetAllUsersProfilePath (
  329. OUT PTSTR Buffer
  330. );
  331. PCTSTR
  332. GetUserProfileRootPath (
  333. OUT PTSTR Buffer
  334. );
  335. PCTSTR
  336. IsValidUncPath (
  337. IN PCTSTR Path
  338. );
  339. BOOL
  340. IsValidFileSpec (
  341. IN PCTSTR FileSpec
  342. );
  343. VOID
  344. QueueAllFiles (
  345. IN BOOL VcmMode
  346. );
  347. VOID
  348. AddRemappingEnvVar (
  349. IN PMAPSTRUCT Map,
  350. IN PMAPSTRUCT ReMap,
  351. IN PMAPSTRUCT UndefMap, OPTIONAL
  352. IN PCTSTR VariableName,
  353. IN PCTSTR VariableData
  354. );
  355. VOID
  356. SetIsmEnvironmentFromPhysicalMachine (
  357. IN PMAPSTRUCT Map,
  358. IN BOOL MapDestToSource,
  359. IN PMAPSTRUCT UndefMap OPTIONAL
  360. );
  361. VOID
  362. SetIsmEnvironmentFromVirtualMachine (
  363. IN PMAPSTRUCT DirectMap,
  364. IN PMAPSTRUCT ReverseMap,
  365. IN PMAPSTRUCT UndefMap
  366. );
  367. //
  368. // app.c
  369. //
  370. PCTSTR
  371. GetMostSpecificSection (
  372. IN MIG_PLATFORMTYPEID Platform,
  373. IN PINFSTRUCT InfStruct,
  374. IN HINF InfFile,
  375. IN PCTSTR BaseSection
  376. );
  377. VOID
  378. InitAppModule (
  379. VOID
  380. );
  381. VOID
  382. TerminateAppModule (
  383. VOID
  384. );
  385. PAPP_SPECIFIC_DATA
  386. FindAppSpecificData (
  387. IN PCTSTR AppTag
  388. );
  389. BOOL
  390. AppCheckAndLogUndefVariables (
  391. IN MIG_PLATFORMTYPEID Platform,
  392. IN PCTSTR Application,
  393. IN PCTSTR UnexpandedString
  394. );
  395. BOOL
  396. AppSearchAndReplace (
  397. IN MIG_PLATFORMTYPEID Platform,
  398. IN PCTSTR Application,
  399. IN PCTSTR UnexpandedString,
  400. OUT PTSTR ExpandedString,
  401. IN UINT ExpandedStringTchars
  402. );
  403. BOOL
  404. ParseOneApplication (
  405. IN MIG_PLATFORMTYPEID Platform,
  406. IN HINF Inf,
  407. IN PCTSTR Section,
  408. IN BOOL PreParse,
  409. IN UINT MasterGroup,
  410. IN PCTSTR Application,
  411. IN PCTSTR LocSection,
  412. IN PCTSTR AliasType,
  413. IN PCTSTR MultiSz
  414. );
  415. BOOL
  416. ParseApplications (
  417. IN MIG_PLATFORMTYPEID Platform,
  418. IN HINF Inf,
  419. IN PCTSTR Section,
  420. IN BOOL PreParse,
  421. IN UINT MasterGroup
  422. );
  423. BOOL
  424. ProcessFilesAndFolders (
  425. IN HINF InfHandle,
  426. IN PCTSTR Section,
  427. IN BOOL PreParse
  428. );
  429. BOOL
  430. ParseAppDetectSection (
  431. IN MIG_PLATFORMTYPEID Platform,
  432. IN HINF InfFile,
  433. IN PCTSTR Application,
  434. IN PCTSTR Section
  435. );
  436. //
  437. // sgmcallback.c
  438. //
  439. MIG_OBJECTENUMCALLBACK GatherVirtualComputer;
  440. MIG_OBJECTENUMCALLBACK PrepareActions;
  441. MIG_OBJECTENUMCALLBACK NulCallback;
  442. MIG_OBJECTENUMCALLBACK ObjectPriority;
  443. MIG_OBJECTENUMCALLBACK FileCollPattern;
  444. MIG_OBJECTENUMCALLBACK ExcludeKeyIfValueExists;
  445. MIG_OBJECTENUMCALLBACK LockPartition;
  446. MIG_POSTENUMCALLBACK PostDelregKeyCallback;
  447. //
  448. // sgmqueue.c
  449. //
  450. BOOL
  451. ParseInfInstructions (
  452. IN HINF InfHandle,
  453. IN PCTSTR Application,
  454. IN PCTSTR Section
  455. );
  456. BOOL
  457. ParseTranslationSection (
  458. IN HINF InfHandle,
  459. IN PCTSTR Application,
  460. IN PCTSTR Section
  461. );
  462. //
  463. // attrib.c
  464. //
  465. BOOL
  466. TestAttributes (
  467. IN PMHANDLE WorkPool,
  468. IN PCTSTR ArgumentMultiSz,
  469. IN PATTRIB_DATA AttribData
  470. );
  471. //
  472. // opm.c
  473. //
  474. BOOL
  475. WINAPI
  476. FilterRenameExFilter (
  477. IN PCMIG_FILTERINPUT InputData,
  478. OUT PMIG_FILTEROUTPUT OutputData,
  479. IN BOOL NoRestoreObject,
  480. IN PCMIG_BLOB SourceOperationData, OPTIONAL
  481. IN PCMIG_BLOB DestinationOperationData OPTIONAL
  482. );
  483. //
  484. // regconv.c
  485. //
  486. BOOL
  487. DoesDestRegExist (
  488. IN MIG_OBJECTSTRINGHANDLE DestName,
  489. IN DWORD RegType
  490. );
  491. BOOL
  492. IsValidRegSz (
  493. IN PCMIG_CONTENT CurrentContent
  494. );
  495. BOOL
  496. IsValidRegType (
  497. IN PCMIG_CONTENT CurrentContent,
  498. IN DWORD RegType
  499. );
  500. BOOL
  501. CreateDwordRegObject (
  502. IN PCTSTR KeyStr,
  503. IN PCTSTR ValueName,
  504. IN DWORD Value
  505. );
  506. // oeutils.c
  507. VOID
  508. OETerminate (
  509. VOID
  510. );
  511. BOOL
  512. OEIsIdentityAssociated (
  513. IN PTSTR IdStr
  514. );
  515. BOOL
  516. OEIAMAssociateId (
  517. IN PTSTR SrcId
  518. );
  519. PTSTR
  520. OEGetRemappedId (
  521. IN PCTSTR IdStr
  522. );
  523. PTSTR
  524. OEGetAssociatedId (
  525. IN MIG_PLATFORMTYPEID Platform
  526. );
  527. PTSTR
  528. OEGetDefaultId (
  529. IN MIG_PLATFORMTYPEID Platform
  530. );
  531. VOID
  532. WABMerge (
  533. VOID
  534. );
  535. VOID
  536. OE5MergeStoreFolders (
  537. VOID
  538. );
  539. VOID
  540. OE4MergeStoreFolder (
  541. VOID
  542. );
  543. BOOL
  544. OE5RemapDefaultId (
  545. VOID
  546. );
  547. BOOL
  548. OEAddComplexRules (
  549. VOID
  550. );
  551. PTSTR
  552. OECreateFirstIdentity (
  553. VOID
  554. );
  555. BOOL
  556. OEInitializeIdentity (
  557. VOID
  558. );
  559. BOOL
  560. OEFixLastUser (
  561. VOID
  562. );
  563. //
  564. // restore.c
  565. //
  566. BOOL
  567. InitRestoreCallback (
  568. IN MIG_PLATFORMTYPEID Platform
  569. );
  570. VOID
  571. TerminateRestoreCallback (
  572. VOID
  573. );
  574. //
  575. // cert.c
  576. //
  577. BOOL
  578. CertificatesInitialize (
  579. VOID
  580. );
  581. VOID
  582. CertificatesTerminate (
  583. VOID
  584. );
  585. //
  586. // Macro expansion definition
  587. //
  588. // None
  589. //
  590. // ANSI/UNICODE macros
  591. //
  592. // None