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.

256 lines
7.5 KiB

  1. /*****************************************************************************\
  2. * MODULE: geninf.h
  3. *
  4. * This is the main header for the INF generation module.
  5. *
  6. * Copyright (C) 1996-1997 Microsoft Corporation
  7. * Copyright (C) 1996-1997 Hewlett Packard
  8. *
  9. * History:
  10. * 22-Nov-1996 HWP-Guys Created.
  11. *
  12. \*****************************************************************************/
  13. #define INF_SECTION_BLOCK 4096 // Used as a block-size for section gets.
  14. #define INF_SECTION_LIMIT 8 // Limit of section blocks to allocate.
  15. #define INF_ITEM_BLOCK 16 // Number of items/per alloc-block.
  16. #define INF_MAX_BUFFER 512 // Maximum size buffer.
  17. #define INF_MIN_BUFFER 64 // Minimum size buffer.
  18. #define INF_DRV_DRID 66000 // Setup dir-id for Driver-directory.
  19. #define INF_PRC_DRID 66001 // Setup dir-id for Processor-directory.
  20. #define INF_SYS_DRID 66002 // Setup dir-id for System-directory.
  21. #define INF_ICM_DRID 66003 // Setup dir-id for Color-directory.
  22. typedef BOOL (CALLBACK* INFENUMPROC)(LPCTSTR, LPCTSTR, BOOL, LPVOID);
  23. typedef BOOL (CALLBACK* INFSCANPROC)(HINF, LPCTSTR, LPVOID);
  24. typedef HANDLE (WINAPI* PSETUPCREATE)(LPVOID);
  25. typedef BOOL (WINAPI* PSETUPDESTROY)(LPVOID);
  26. typedef BOOL (WINAPI* PSETUPGET)(HANDLE, LPCWSTR, LPCWSTR, LPVOID);
  27. // Parameter Structure for infCreate().
  28. //
  29. typedef struct _INFGENPARM {
  30. LPCTSTR lpszFriendlyName; // Friendly-name for printer.
  31. LPCTSTR lpszShareName; // Share-name of printer.
  32. LPCTSTR lpszPortName; // Name of output-port.
  33. DWORD idxPlt; // Client platform index.
  34. DWORD idxVer; // Client version index.
  35. DWORD dwCliInfo; // Client Information.
  36. LPCTSTR lpszDrvName; // Driver-name.
  37. LPCTSTR lpszDstName; // Name of target-file.
  38. LPCTSTR lpszDstPath; // Dest-directory to place target files.
  39. } INFGENPARM;
  40. typedef INFGENPARM *PINFGENPARM;
  41. typedef INFGENPARM NEAR *NPINFGENPARM;
  42. typedef INFGENPARM FAR *LPINFGENPARM;
  43. // INF File-Item.
  44. //
  45. typedef struct _INFITEM {
  46. TCHAR szName[INF_MIN_BUFFER]; // Name of file-item.
  47. TCHAR szSource[INF_MIN_BUFFER]; // Original Name of file-item
  48. TCHAR szPath[MAX_PATH]; // Path of file-item.
  49. TCHAR szOrd[INF_MIN_BUFFER]; // Ordinal value of winntdir section.
  50. BOOL bInf; // Specifies if this is an inf-file-item.
  51. } INFITEM;
  52. typedef INFITEM *PINFITEM;
  53. typedef INFITEM NEAR *NPINFITEM;
  54. typedef INFITEM FAR *LPINFITEM;
  55. // INF Item-Obj-Header
  56. //
  57. typedef struct _INFITEMINFO {
  58. DWORD dwCount; // Count of file-items in inf-build.
  59. INFITEM aItems[1]; // Contiguous array of file-items.
  60. } INFITEMINFO;
  61. typedef INFITEMINFO *PINFITEMINFO;
  62. typedef INFITEMINFO NEAR *NPINFITEMINFO;
  63. typedef INFITEMINFO FAR *LPINFITEMINFO;
  64. // INF Object/Methods.
  65. //
  66. typedef struct _INFINFO {
  67. DWORD idxPlt; // architecture/Environment index.
  68. DWORD idxVer; // version index.
  69. DWORD dwCliInfo; // Client Information.
  70. DWORD dwError; // Error if INF processing fails
  71. HINF hInfObj; // handle to an INF file object.
  72. LPTSTR lpszInfName; // name of main inf file.
  73. LPTSTR lpszFrnName; // friendly name of printer.
  74. LPTSTR lpszDrvName; // name of driver.
  75. LPTSTR lpszDrvPath; // windows driver directory.
  76. LPTSTR lpszDstName; // name of destination file.
  77. LPTSTR lpszDstPath; // output directory for destination file.
  78. LPTSTR lpszPrtName; // name of output port.
  79. LPTSTR lpszShrName; // share name of printer.
  80. LPINFITEMINFO lpInfItems; // object array of file-items.
  81. SP_ORIGINAL_FILE_INFO OriginalFileInfo; // orignal name of .inf and .cat file for this inf
  82. } INFINFO;
  83. typedef INFINFO *PINFINFO;
  84. typedef INFINFO NEAR *NPINFINFO;
  85. typedef INFINFO FAR *LPINFINFO;
  86. // INF Scan Structure.
  87. //
  88. typedef struct _INFSCAN {
  89. LPINFINFO lpInf;
  90. LPINFITEMINFO lpII;
  91. } INFSCAN;
  92. typedef INFSCAN *PINFSCAN;
  93. typedef INFSCAN NEAR *NPINFSCAN;
  94. typedef INFSCAN FAR *LPINFSCAN;
  95. // CATCOUNT and CATCOUNTARRAY structures used for determining
  96. // the CAT file to use.
  97. //
  98. typedef struct _CATCOUNT {
  99. LPWSTR lpszCATName;
  100. UINT uCount;
  101. } CATCOUNT, *LPCATCOUNT;
  102. typedef struct _CATCOUNTARRAY {
  103. DWORD dwIndivSigned; // Individually signed file count
  104. UINT uItems;
  105. UINT uNextAvailable;
  106. HCATADMIN hCatAdmin;
  107. LPCATCOUNT lpArray;
  108. } CATCOUNTARRAY, *LPCATCOUNTARRAY;
  109. HANDLE infCreate(
  110. LPINFGENPARM lpInf);
  111. BOOL infProcess(
  112. HANDLE hInf);
  113. BOOL infDestroy(
  114. HANDLE hInf);
  115. BOOL infEnumItems(
  116. HANDLE hInf,
  117. INFENUMPROC pfnEnum,
  118. LPVOID lpvData);
  119. WORD infGetEnvArch(
  120. HANDLE hInf);
  121. WORD infGetEnvArchCurr(
  122. HANDLE hInf);
  123. /***************************************\
  124. * infGetInfName
  125. \***************************************/
  126. __inline LPCTSTR infGetInfName(
  127. HANDLE hInf)
  128. {
  129. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszInfName : NULL);
  130. }
  131. /***************************************\
  132. * infGetDrvName
  133. \***************************************/
  134. __inline LPCTSTR infGetDrvName(
  135. HANDLE hInf)
  136. {
  137. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszDrvName : NULL);
  138. }
  139. /***************************************\
  140. * infGetPrtName
  141. \***************************************/
  142. __inline LPCTSTR infGetPrtName(
  143. HANDLE hInf)
  144. {
  145. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszPrtName : NULL);
  146. }
  147. /***************************************\
  148. * infGetDstName
  149. \***************************************/
  150. __inline LPCTSTR infGetDstName(
  151. HANDLE hInf)
  152. {
  153. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszDstName : NULL);
  154. }
  155. /***************************************\
  156. * infGetDstPath
  157. \***************************************/
  158. __inline LPCTSTR infGetDstPath(
  159. HANDLE hInf)
  160. {
  161. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszDstPath : NULL);
  162. }
  163. /***************************************\
  164. * infGetFriendlyName
  165. \***************************************/
  166. __inline LPCTSTR infGetFriendlyName(
  167. HANDLE hInf)
  168. {
  169. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszFrnName : NULL);
  170. }
  171. /***************************************\
  172. * infGetShareName
  173. \***************************************/
  174. __inline LPCTSTR infGetShareName(
  175. HANDLE hInf)
  176. {
  177. return (hInf ? (LPCTSTR)((LPINFINFO)hInf)->lpszShrName : NULL);
  178. }
  179. /***************************************\
  180. * infGetCliInfo
  181. \***************************************/
  182. __inline DWORD infGetCliInfo(
  183. HANDLE hInf)
  184. {
  185. return (hInf ? (DWORD)((LPINFINFO)hInf)->dwCliInfo : 0);
  186. }
  187. /***************************************\
  188. * infGetError
  189. \***************************************/
  190. __inline DWORD infGetError(
  191. HANDLE hInf)
  192. {
  193. return (hInf ? (DWORD)((LPINFINFO)hInf)->dwError : ERROR_SUCCESS);
  194. }
  195. /***************************************\
  196. * infSetError
  197. \***************************************/
  198. __inline VOID infSetError(
  199. LPINFINFO hInf,
  200. DWORD dwError )
  201. {
  202. hInf->dwError = dwError;
  203. }