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.

282 lines
8.4 KiB

  1. //
  2. // Header file for inflib.lib
  3. //
  4. #define MAX_PLATFORMS 5
  5. #define MAX_SOURCEIDWIDTH 3
  6. #define LAYOUTPLATFORMS_ALL 0x0000001F // - (default) - Grovels through all the platform-specific section
  7. #define LAYOUTPLATFORMS_X86 0x00000001 // - Grovels through the SourcedisksFiles.x86 section
  8. #define LAYOUTPLATFORMS_AMD64 0x00000002 // - Grovels through the SourcedisksFiles.amd64 section
  9. #define LAYOUTPLATFORMS_IA64 0x00000004 // - Grovels through the SourcedisksFiles.ia64 section
  10. #define LAYOUTPLATFORMS_FREE 0x00000008 // - Grovels through the SourcedisksFiles.obsolete section
  11. #define LAYOUTPLATFORMS_COMMON 0x00000010 // - Grovels through the SourcedisksFiles section
  12. #define LAYOUTPLATFORMINDEX_X86 0 // - The platform index for x86
  13. #define LAYOUTPLATFORMINDEX_AMD64 1 // - The platform index for AMD64
  14. #define LAYOUTPLATFORMINDEX_IA64 2 // - The platform index for IA64
  15. #define LAYOUTPLATFORMINDEX_FREE 3 // - The platform index for obsolete
  16. #define LAYOUTPLATFORMINDEX_COMMON 4 // - The platform index for Common
  17. // BUGBUG: Should make this opaque at some time
  18. typedef struct _LAYOUT_CONTEXT{
  19. PVOID Context;
  20. UINT ExtraDataSize;
  21. PVOID MediaInfo[MAX_PLATFORMS];
  22. }LAYOUT_CONTEXT, *PLAYOUT_CONTEXT;
  23. typedef struct _FILE_LAYOUTINFORMATION{
  24. TCHAR TargetFileName[MAX_PATH];
  25. TCHAR Directory[MAX_PATH];
  26. ULONG Size;
  27. int Directory_Code;
  28. int BootMediaNumber;
  29. int UpgradeDisposition;
  30. int CleanInstallDisposition;
  31. TCHAR Media_tagID[MAX_SOURCEIDWIDTH];
  32. BOOL Compression;
  33. UINT SectionIndex;
  34. int Count;
  35. }FILE_LAYOUTINFORMATION, *PFILE_LAYOUTINFORMATION;
  36. typedef struct _MEDIA_INFO{
  37. TCHAR MediaName[MAX_PATH];
  38. TCHAR TagFilename[MAX_PATH];
  39. TCHAR RootDir[MAX_PATH];
  40. }MEDIA_INFO, *PMEDIA_INFO;
  41. typedef BOOL
  42. (CALLBACK *PLAYOUTENUMCALLBACK) (
  43. IN PLAYOUT_CONTEXT Context,
  44. IN PCTSTR FileName,
  45. IN PFILE_LAYOUTINFORMATION LayoutInformation,
  46. IN PVOID ExtraData,
  47. IN UINT ExtraDataSize,
  48. IN OUT DWORD_PTR Param
  49. );
  50. PLAYOUT_CONTEXT
  51. BuildLayoutInfContext(
  52. IN PCTSTR LayoutInfName,
  53. IN DWORD PlatformMask,
  54. IN UINT MaxExtraSize
  55. );
  56. /*
  57. Function to generate a internal representation of files listed in a layout INF file.
  58. It returns an opaque context that can be used with other APIs to
  59. manipulate/query this representation. The internal representation builds a structure
  60. associated with each file that lists its attributes.
  61. Arguments :
  62. LayoutInfName - Full path to Layout file.
  63. PlatFormMask - Can be one of the following....
  64. LAYOUTPLATFORMS_ALL (default) - Grovels through all the platform-specific section
  65. LAYOUTPLATFORMS_X86 - Grovels through the SourcedisksFiles.x86 section
  66. LAYOUTPLATFORMS_AMD64 - Grovels through the SourcedisksFiles.amd64 section
  67. LAYOUTPLATFORMS_IA64 - Grovels through the SourcedisksFiles.ia64 section
  68. LAYOUTPLATFORMS_COMMON - Grovels through the SourcedisksFiles section
  69. MaxExtraSize - Largest possible extra-data size that we may want to associate with
  70. each file
  71. Return value :
  72. An opaque LAYOUT_HANDLE used to access the data structure in other calls.
  73. Returns NULL if we had a failure.
  74. */
  75. BOOL
  76. EnumerateLayoutInf(
  77. IN PLAYOUT_CONTEXT LayoutContext,
  78. IN PLAYOUTENUMCALLBACK LayoutEnumCallback,
  79. IN DWORD_PTR Param
  80. );
  81. /*
  82. This function calls the specified callback function for each
  83. element in the SourceDisksFilesSection associated with the
  84. Layout Inf Context specified.
  85. It is required that the user has a LayoutInfContext open from a call to
  86. BuildLayoutInfContext.
  87. Arguments:
  88. Context - A LAYOUT_CONTEXT returned by BuildLayoutInfContext
  89. LayoutEnumCallback - specifies a callback function called for each file in the SourceDisksFile section
  90. CallerContext - An opaque context pointer passed on to the callback function
  91. The callback is of the form:
  92. typedef BOOL
  93. (CALLBACK *PLAYOUTENUMCALLBACK) (
  94. IN PLAYOUT_CONTEXT Context,
  95. IN PCTSTR FileName,
  96. IN PFILE_LAYOUTINFORMATION LayoutInformation,
  97. IN PVOID ExtraData,
  98. IN UINT ExtraDataSize,
  99. IN OUT DWORD_PTR Param
  100. );
  101. where
  102. Context - Pointer to open LAYOUT_CONTEXT
  103. FileName - Specifies the individual filename
  104. LayoutInformation - Pointer to Layout Information for this file. User should not modify this directly.
  105. ExtraData - Pointer to the ExtraData that the caller may have stored. User should not modify this directly.
  106. ExtraDataSize - Size in bytes of the ExtraData
  107. Param - the opaque param passed into this function is passed
  108. into the callback function
  109. Return value:
  110. TRUE if all the elements were enumerated. If not it returns
  111. FALSE and GetLastError() returns ERROR_CANCELLED. If the callback
  112. returns FALSE then the enumeration stops but this API returns TRUE.
  113. */
  114. BOOL
  115. FindFileInLayoutInf(
  116. IN PLAYOUT_CONTEXT LayoutContext,
  117. IN PCTSTR Filename,
  118. OUT PFILE_LAYOUTINFORMATION LayoutInformation, OPTIONAL
  119. OUT PVOID ExtraData, OPTIONAL
  120. OUT PUINT ExtraDataSize, OPTIONAL
  121. OUT PMEDIA_INFO Media_Info OPTIONAL
  122. );
  123. /*
  124. This function finds the file information for a given filename inside a
  125. built layout context. It returns the layout information as well as the
  126. extra data (if any) associated with the file.
  127. Arguments:
  128. Context - Pointer to open LAYOUT_CONTEXT
  129. Filename - Specifies the filename to search for
  130. LayoutInformation - Pointer to Layout Information for this file. User should not modify this directly.
  131. ExtraData - Pointer to the ExtraData that the caller may have stored. User should not modify this directly.
  132. ExtraDataSize - Size in bytes of the ExtraData returned.
  133. Media_Info - Pointer to MEDIA_INFO structure that will get filled
  134. with the file's corresponding Media information.
  135. Return value;
  136. TRUE if the file is found - False otherwise.
  137. */
  138. BOOL
  139. CloseLayoutInfContext(
  140. IN PLAYOUT_CONTEXT LayoutContext);
  141. /*
  142. This function closes a Layout Inf Context and frees all memory
  143. associated with it.
  144. Arguments :
  145. LayoutContext - LayoutContext to close
  146. Return values :
  147. TRUE if it succeeds, else FALSE
  148. */
  149. VOID
  150. MyConcatenatePaths(
  151. IN OUT PTSTR Path1,
  152. IN LPCTSTR Path2,
  153. IN DWORD BufferSizeChars
  154. );
  155. /*++
  156. Routine Description:
  157. Concatenate two path strings together, supplying a path separator
  158. character (\) if necessary between the 2 parts.
  159. Arguments:
  160. Path1 - supplies prefix part of path. Path2 is concatenated to Path1.
  161. Path2 - supplies the suffix part of path. If Path1 does not end with a
  162. path separator and Path2 does not start with one, then a path sep
  163. is appended to Path1 before appending Path2.
  164. BufferSizeChars - supplies the size in chars (Unicode version) or
  165. bytes (Ansi version) of the buffer pointed to by Path1. The string
  166. will be truncated as necessary to not overflow that size.
  167. Return Value:
  168. None.
  169. --*/
  170. BOOL ValidateTextmodeDirCodesSection(
  171. PCTSTR LayoutFile,
  172. PCTSTR WinntdirSection
  173. );
  174. /*
  175. Routine to validate the [WinntDirectories] section for a setup layout INF. This checks for errors that maybe encountered
  176. when people add/remove stuff from this section.
  177. Arguments:
  178. LayoutInf - Name of setup layout INF that contains the specified section
  179. WinntdirSection - Section that contains dir codes
  180. Checks -
  181. 1) Looks for duplicate or reused dir codes
  182. Return value:
  183. TRUE - Validation succeeded
  184. FALSE- Validation failed
  185. */