Source code of Windows XP (NT5)
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.

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