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.

303 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. osfiles.h
  5. Abstract:
  6. Header file for implementing migdb functionality
  7. Author:
  8. Calin Negreanu (calinn) 07-Ian-1998
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. //
  13. // Includes
  14. //
  15. // None
  16. //
  17. // Strings
  18. //
  19. // None
  20. //
  21. // Constants
  22. //
  23. // None
  24. //
  25. // Macros
  26. //
  27. // None
  28. //
  29. // Types
  30. //
  31. typedef struct {
  32. ENCODEDSTRHANDLE ObjectName;
  33. PCTSTR NativeObjectName;
  34. PCTSTR ObjectNode;
  35. PCTSTR ObjectLeaf;
  36. BOOL IsNode;
  37. BOOL IsLeaf;
  38. DWORD Handled;
  39. WIN32_FIND_DATA * FindData;
  40. } FILE_HELPER_PARAMS, * PFILE_HELPER_PARAMS;
  41. typedef struct _MIGDB_ATTRIB {
  42. INT AttribIndex;
  43. UINT ArgCount;
  44. PCTSTR Arguments;
  45. BOOL NotOperator;
  46. struct _MIGDB_ATTRIB *Next;
  47. } MIGDB_ATTRIB, *PMIGDB_ATTRIB;
  48. typedef struct _MIGDB_CONTEXT;
  49. typedef struct _MIGDB_SECTION {
  50. BOOL Satisfied;
  51. struct _MIGDB_CONTEXT *Context;
  52. struct _MIGDB_SECTION *Next;
  53. } MIGDB_SECTION, *PMIGDB_SECTION;
  54. typedef struct _MIGDB_CONTEXT {
  55. INT ActionIndex;
  56. UINT TriggerCount;
  57. PCTSTR SectName;
  58. PCTSTR SectLocalizedName;
  59. PCTSTR SectNameForDisplay; // SectLocalizedName, or SectName if not localized
  60. PCTSTR Message;
  61. PCTSTR Arguments;
  62. GROWBUFFER FileList;
  63. PMIGDB_SECTION Sections;
  64. struct _MIGDB_CONTEXT *Next;
  65. } MIGDB_CONTEXT, *PMIGDB_CONTEXT;
  66. typedef struct _MIGDB_FILE {
  67. PMIGDB_SECTION Section;
  68. PMIGDB_ATTRIB Attributes;
  69. struct _MIGDB_FILE *Next;
  70. } MIGDB_FILE, *PMIGDB_FILE;
  71. typedef struct {
  72. PMIGDB_FILE First;
  73. PMIGDB_FILE Last;
  74. } FILE_LIST_STRUCT, *PFILE_LIST_STRUCT;
  75. typedef struct {
  76. PFILE_HELPER_PARAMS FileParams;
  77. } DBATTRIB_PARAMS, *PDBATTRIB_PARAMS;
  78. typedef struct _TAG_MIGDB_RULE {
  79. PCTSTR NodeBase;
  80. MIG_OBJECTSTRINGHANDLE ObjectPattern;
  81. POBSPARSEDPATTERN ParsedPattern;
  82. PMIGDB_SECTION Section;
  83. PMIGDB_ATTRIB Attributes;
  84. INT IncludeNodes;
  85. struct _TAG_MIGDB_RULE *NextRule;
  86. } MIGDB_RULE, *PMIGDB_RULE;
  87. typedef struct _TAG_CHAR_NODE {
  88. PMIGDB_RULE RuleList;
  89. WORD Char;
  90. WORD Flags;
  91. struct _TAG_CHAR_NODE *NextLevel;
  92. struct _TAG_CHAR_NODE *NextPeer;
  93. } MIGDB_CHAR_NODE, *PMIGDB_CHAR_NODE;
  94. typedef struct {
  95. PMIGDB_RULE RuleList;
  96. PMIGDB_CHAR_NODE FirstLevel;
  97. } MIGDB_TYPE_RULE, *PMIGDB_TYPE_RULE;
  98. //
  99. // Declare the attribute functions prototype
  100. //
  101. typedef BOOL (ATTRIBUTE_PROTOTYPE) (PDBATTRIB_PARAMS AttribParams, PCTSTR Args);
  102. typedef ATTRIBUTE_PROTOTYPE * PATTRIBUTE_PROTOTYPE;
  103. //
  104. // Declare the action functions prototype
  105. //
  106. typedef BOOL (ACTION_PROTOTYPE) (PMIGDB_CONTEXT Context);
  107. typedef ACTION_PROTOTYPE * PACTION_PROTOTYPE;
  108. //
  109. // Declare MigDb hook function prototype
  110. //
  111. typedef BOOL (MIGDB_HOOK_PROTOTYPE) (PCTSTR FileName, PMIGDB_CONTEXT Context, PMIGDB_SECTION Section, PMIGDB_FILE File, PMIGDB_ATTRIB Attrib);
  112. typedef MIGDB_HOOK_PROTOTYPE * PMIGDB_HOOK_PROTOTYPE;
  113. //
  114. // Globals
  115. //
  116. extern HINF g_OsFilesInf;
  117. extern MIG_ATTRIBUTEID g_OsFileAttribute;
  118. //
  119. // Macro expansion list
  120. //
  121. // None
  122. //
  123. // Macro expansion definition
  124. //
  125. // None
  126. //
  127. // Public function declarations
  128. //
  129. PATTRIBUTE_PROTOTYPE
  130. MigDb_GetAttributeAddr (
  131. IN INT AttributeIdx
  132. );
  133. INT
  134. MigDb_GetAttributeIdx (
  135. IN PCTSTR AttributeStr
  136. );
  137. UINT
  138. MigDb_GetReqArgCount (
  139. IN INT AttributeIndex
  140. );
  141. PCTSTR
  142. MigDb_GetAttributeName (
  143. IN INT AttributeIdx
  144. );
  145. PACTION_PROTOTYPE
  146. MigDb_GetActionAddr (
  147. IN INT ActionIdx
  148. );
  149. INT
  150. MigDb_GetActionIdx (
  151. IN PCTSTR ActionStr
  152. );
  153. PCTSTR
  154. MigDb_GetActionName (
  155. IN INT ActionIdx
  156. );
  157. BOOL
  158. MigDb_IsPatternFormat (
  159. IN INT ActionIdx
  160. );
  161. BOOL
  162. MigDb_CallWhenTriggered (
  163. IN INT ActionIdx
  164. );
  165. BOOL
  166. MigDb_CallAlways (
  167. IN INT ActionIdx
  168. );
  169. PMIGDB_HOOK_PROTOTYPE
  170. SetMigDbHook (
  171. PMIGDB_HOOK_PROTOTYPE HookFunction
  172. );
  173. BOOL
  174. CallAttribute (
  175. IN PMIGDB_ATTRIB MigDbAttrib,
  176. IN PDBATTRIB_PARAMS AttribParams
  177. );
  178. ULONGLONG
  179. GetBinFileVer (
  180. IN PCTSTR FileName
  181. );
  182. ULONGLONG
  183. GetBinProductVer (
  184. IN PCTSTR FileName
  185. );
  186. DWORD
  187. GetFileDateHi (
  188. IN PCTSTR FileName
  189. );
  190. DWORD
  191. GetFileDateLo (
  192. IN PCTSTR FileName
  193. );
  194. DWORD
  195. GetFileVerOs (
  196. IN PCTSTR FileName
  197. );
  198. DWORD
  199. GetFileVerType (
  200. IN PCTSTR FileName
  201. );
  202. BOOL
  203. InitMigDb (
  204. IN PCTSTR MigDbFile
  205. );
  206. BOOL
  207. InitMigDbEx (
  208. IN HINF InfHandle
  209. );
  210. BOOL
  211. DoneMigDbEx (
  212. VOID
  213. );
  214. BOOL
  215. DoneMigDb (
  216. VOID
  217. );
  218. BOOL
  219. MigDbTestFile (
  220. IN PFILE_HELPER_PARAMS Params
  221. );
  222. BOOL
  223. IsKnownMigDbFile (
  224. IN PCTSTR FileName
  225. );
  226. BOOL
  227. AddFileToMigDbLinkage (
  228. IN PCTSTR FileName,
  229. IN PINFCONTEXT Context, OPTIONAL
  230. IN DWORD FieldIndex OPTIONAL
  231. );
  232. //
  233. // ANSI/UNICODE macros
  234. //
  235. // None