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.

390 lines
14 KiB

  1. //**********************************************************************
  2. //
  3. // SETUP31.H
  4. //
  5. // Copyright (c) 1993-1996 - Microsoft Corp.
  6. // All rights reserved.
  7. // Microsoft Confidential
  8. //
  9. // Public include file for Windows 3.1 Setup services. (Based on
  10. // Windows 95 SETUPX.DLL)
  11. //
  12. //**********************************************************************
  13. #ifndef SETUP31_INC
  14. #define SETUP31_INC 1
  15. // Need commctrl.h for some struct defines
  16. #include <comctlie.h>
  17. #include <stdlib.h> // Stuff including _MAX_PATH
  18. /********************************************************************
  19. Stuff that should be in Windows.h
  20. **********************************************************************/
  21. #ifndef MAX_PATH
  22. #define MAX_PATH _MAX_PATH
  23. #endif
  24. /********************************************************************
  25. Manifest constants
  26. **********************************************************************/
  27. #define MAX_DEVICE_ID_LEN 256
  28. #define LINE_LEN 256
  29. #define MAX_CLASS_NAME_LEN 32
  30. #define MAX_SECT_NAME_LEN 32
  31. /********************************************************************
  32. Errors
  33. **********************************************************************/
  34. typedef UINT RETERR; // Return Error code type.
  35. #define OK 0 // success error code
  36. #define DI_ERROR (500) // Device Installer
  37. /*******************************************************************************
  38. * AUTODOC
  39. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  40. *
  41. * @typee _ERR_DEVICE_INSTALL | Error return codes for Device Installation
  42. * APIs.
  43. *
  44. * @emem ERR_DI_INVALID_DEVICE_ID | Incorrectly formed device ID.
  45. *
  46. * @emem ERR_DI_INVALID_COMPATIBLE_DEVICE_LIST | Invalid compatible device list.
  47. *
  48. * @emem ERR_DI_LOW_MEM | Insufficient memory to complete.
  49. *
  50. * @emem ERR_DI_BAD_DEV_INFO | A passed in DEVICE_INFO struct is invalid.
  51. *
  52. * @emem ERR_DI_DO_DEFAULT | Do the default action for the requested operation.
  53. *
  54. * @emem ERR_DI_USER_CANCEL | The user cancelled the operation.
  55. *
  56. * @emem ERR_DI_BAD_INF | An invalid INF file was encountered.
  57. *
  58. * @emem ERR_DI_NO_INF | No INF found on supplied OEM path.
  59. *
  60. * @emem ERR_DI_FAIL_QUERY | The queried action should not take place.
  61. *
  62. * @emem ERR_DI_API_ERROR | One of the Device installation APIs was called
  63. * incorrectly or with invalid parameters.
  64. *
  65. * @emem ERR_DI_BAD_PATH | An OEM path was specified incorrectly.
  66. *
  67. *******************************************************************************/
  68. enum _ERR_DEVICE_INSTALL
  69. {
  70. ERR_DI_INVALID_DEVICE_ID = DI_ERROR,
  71. ERR_DI_INVALID_COMPATIBLE_DEVICE_LIST,
  72. ERR_DI_LOW_MEM,
  73. ERR_DI_BAD_DEV_INFO,
  74. ERR_DI_DO_DEFAULT,
  75. ERR_DI_USER_CANCEL,
  76. ERR_DI_BAD_INF,
  77. ERR_DI_NO_INF,
  78. ERR_DI_FAIL_QUERY,
  79. ERR_DI_API_ERROR,
  80. ERR_DI_BAD_PATH,
  81. ERR_DI_NO_SECTION,
  82. ERR_DI_NO_LINE,
  83. ERR_DI_NO_STRING,
  84. ERR_ID_NO_MORE_LINES,
  85. ERR_DI_INVALID_FIELD
  86. };
  87. /********************************************************************
  88. Structure Definitions
  89. **********************************************************************/
  90. /*******************************************************************************
  91. * AUTODOC
  92. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  93. *
  94. * @types DRIVER_NODE | This strucure represents a driver which can be
  95. * installed for a specific device.
  96. *
  97. * @field struct _DRIVER_NODE FAR* | lpNextDN | Pointer to the next driver node
  98. * in a list.
  99. *
  100. * @field UINT | Rank | The Rank match of this driver. Ranks go from 0 to n, where 0
  101. * is the most compatible.
  102. *
  103. * @field UINT | InfType | Type of INF this driver cam from. This will
  104. * be either INFTYPE_TEXT or INFTYPE_EXECUTABLE
  105. *
  106. * @field unsigned | InfDate | DOS date stamp of the INF file.
  107. *
  108. * @field LPSTR | lpszDescription | Pointer to a the descriptrion of the device being
  109. * supported by this driver.
  110. *
  111. * @field LPSTR | lpszSectionName | Pointer to the name of INF install section for
  112. * this driver.
  113. *
  114. * @field ATOM | atInfFileName | Global ATOM containing the name of the INF file.
  115. *
  116. * @field ATOM | atMfgName | Global ATOM containing the name of this driver's
  117. * manufacture.
  118. *
  119. * @field ATOM | atProviderName | Global ATOM containing the name of this driver's
  120. * provider.
  121. *
  122. * @field DWORD | Flags | Flags that control functions using this DRIVER_NODE
  123. * @flag DNF_DUPDESC | This driver has the same device description
  124. * from by more than one provider.
  125. * @flag DNF_OLDDRIVER | Driver node specifies old/current driver
  126. * @flag DNF_EXCLUDEFROMLIST | If set, this driver node will not be displayed
  127. * in any driver select dialogs.
  128. * @flag DNF_NODRIVER | Set if we want to install no driver e.g no mouse drv
  129. * @flag DNF_CONVERTEDLPINFO | Set if this Driver Node was converted from an Info Node.
  130. * Setting this flag will cause the cleanup functions to explicitly delete it.
  131. *
  132. * @field DWORD | dwPrivateData | Reserved
  133. *
  134. * @field LPSTR | lpszDrvDescription | Pointer to a driver description.
  135. *
  136. * @field LPSTR | lpszHardwareID | Pointer to a list of Plug-and-Play hardware IDs for
  137. * this driver.
  138. *
  139. * @field LPSTR | lpszCompatIDs | Pointer to a list of Plug-and-Play compatible IDs for
  140. * this driver.
  141. *
  142. *******************************************************************************/
  143. typedef struct _DRIVER_NODE
  144. {
  145. struct _DRIVER_NODE FAR* lpNextDN;
  146. UINT Rank;
  147. unsigned InfDate;
  148. LPSTR lpszDescription;
  149. LPSTR lpszSectionName;
  150. ATOM atInfFileName;
  151. ATOM atMfgName;
  152. ATOM atProviderName;
  153. DWORD Flags;
  154. LPSTR lpszHardwareID;
  155. } DRIVER_NODE, NEAR* PDRIVER_NODE, FAR* LPDRIVER_NODE, FAR* FAR* LPLPDRIVER_NODE;
  156. #define DNF_DUPDESC 0x00000001 // Multiple providers have same desc
  157. /*******************************************************************************
  158. * AUTODOC
  159. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  160. *
  161. * @types DEVICE_INFO | Device Information struct
  162. *
  163. * @field UINT | cbSize | Size of the DEVICE_INFO struct.
  164. *
  165. * @field struct _DEVICE_INFO FAR | *lpNextDi | Pointer to the next DEVICE_INFO struct
  166. * in a linked list.
  167. *
  168. * @field char | szDescription[LINE_LEN] | Buffer containing the description of the
  169. * device.
  170. *
  171. * @field char | szClassName[MAX_CLASS_NAME_LEN] | Buffer containing the device's
  172. * class name. (Can be a GUID str)
  173. *
  174. * @field DWORD | Flags | Flags for controlling installation and U/I functions. Some
  175. * flags can be set prior to calling device installer APIs, and other are set
  176. * automatically during the processing of some APIs.
  177. *
  178. * @field HWND | hwndParent | Window handle that will own U/I dialogs related to this
  179. * device.
  180. *
  181. * @field LPDRIVER_NODE | lpCompatDrvList | Pointer to a linked list of DRIVER_NODES
  182. * representing the compatible drivers for this device.
  183. *
  184. * @field LPDRIVER_NODE | lpClassDrvList | Pointer to a linked list of DRIVER_NODES
  185. * representing all drivers of this device's class.
  186. *
  187. * @field LPDRIVER_NODE | lpSelectedDriver | Pointer to a single DRIVER_NODE that
  188. * has been selected as the driver for this device.
  189. *
  190. * @field ATOM | atDriverPath | Global ATOM containing the path to this device's INF
  191. * file. This is set only of the driver came from an OEM INF file. This will be
  192. * 0 if the INF is a standard Windows INF file.
  193. *
  194. *******************************************************************************/
  195. typedef struct _DEVICE_INFO
  196. {
  197. UINT cbSize;
  198. struct _DEVICE_INFO FAR *lpNextDi;
  199. char szDescription[LINE_LEN];
  200. char szClassName[MAX_CLASS_NAME_LEN];
  201. DWORD Flags;
  202. HWND hwndParent;
  203. LPDRIVER_NODE lpCompatDrvList;
  204. LPDRIVER_NODE lpClassDrvList;
  205. LPDRIVER_NODE lpSelectedDriver;
  206. ATOM atDriverPath;
  207. } DEVICE_INFO, FAR * LPDEVICE_INFO, FAR * FAR * LPLPDEVICE_INFO;
  208. // Flags for DEVICE_INFO
  209. #define DI_SHOWOEM 0x00000001L // support Other... button
  210. #define DI_SHOWCOMPAT 0x00000002L // show compatibility list
  211. #define DI_SHOWCLASS 0x00000004L // show class list
  212. #define DI_SHOWALL 0x00000007L
  213. #define DI_DIDCOMPAT 0x00000010L // Searched for compatible devices
  214. #define DI_DIDCLASS 0x00000020L // Searched for class devices
  215. #define DI_MULTMFGS 0x00000400L // Set if multiple manufacturers in
  216. #define ASSERT_DI_STRUC(lpdi) if (lpdi->cbSize != sizeof(DEVICE_INFO)) return (ERR_DI_BAD_DEV_INFO)
  217. /*******************************************************************************
  218. * AUTODOC
  219. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  220. *
  221. * @types SUBSTR_DATA | Data structure used to manage substrings.
  222. * struct is used by class installers to extend the operation of the hardware
  223. * installation wizard by adding custom pages.
  224. *
  225. * @field LPSTR | lpFirstSubstr | Pointer to the first substring in the list.
  226. *
  227. * @field LPSTR | lpCurSubstr | Pointer to the current substring in the list.
  228. *
  229. * @field LPSTR | lpLastSubstr | Pointer to the last substring in the list.
  230. *
  231. * @xref InitSubstrData
  232. * @xref GetFirstSubstr
  233. * @xref GetNextSubstr
  234. *
  235. *******************************************************************************/
  236. typedef struct _SUBSTR_DATA
  237. {
  238. LPSTR lpFirstSubstr;
  239. LPSTR lpCurSubstr;
  240. LPSTR lpLastSubstr;
  241. } SUBSTR_DATA;
  242. typedef SUBSTR_DATA* PSUBSTR_DATA;
  243. typedef SUBSTR_DATA NEAR* NPSUBSTR_DATA;
  244. typedef SUBSTR_DATA FAR* LPSUBSTR_DATA;
  245. /*******************************************************************************
  246. * AUTODOC
  247. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  248. *
  249. * @types INF | Handle to an opened INF file
  250. *
  251. * @field CHAR | szInfPath | Copy of the INF's path
  252. *
  253. *******************************************************************************/
  254. typedef struct _INF
  255. {
  256. WORD cbSize;
  257. char szInfPath[MAX_PATH];
  258. HDPA hdpaStrings;
  259. HDPA hdpaSections; // Array of INF section structs
  260. }INF, FAR * LPINF, FAR * FAR * LPLPINF;
  261. /*******************************************************************************
  262. * AUTODOC
  263. * @doc EXTERNAL SETUP31 DEVICE_INSTALLER
  264. *
  265. * @types INFSECT | A section in an INF file
  266. *
  267. * @field WORD | cbSize | size of struct
  268. *
  269. *******************************************************************************/
  270. typedef struct _INFSECT
  271. {
  272. WORD cbSize;
  273. char szSectionName[MAX_SECT_NAME_LEN];
  274. WORD wCurrentLine;
  275. HDPA hdpaLines;
  276. }INFSECT, FAR * LPINFSECT, FAR * FAR * LPLPINFSECT;
  277. /********************************************************************
  278. Exported Function Prototypes constants
  279. **********************************************************************/
  280. RETERR WINAPI DiBuildClassDrvList(LPDEVICE_INFO lpdi);
  281. RETERR WINAPI DiBuildCompatDrvList(LPDEVICE_INFO lpdi, LPCSTR lpcszDeviceID);
  282. RETERR WINAPI DiDestroyDriverNodeList(LPDRIVER_NODE lpDNList);
  283. RETERR WINAPI DiDestroyDeviceInfoList(LPDEVICE_INFO lpdi);
  284. RETERR WINAPI DiCreateDeviceInfo
  285. (
  286. LPLPDEVICE_INFO lplpdi,
  287. LPCSTR lpszDescription,
  288. LPCSTR lpszClassName,
  289. HWND hwndParent
  290. );
  291. RETERR WINAPI IpOpen
  292. (
  293. LPCSTR lpcszFileSpec,
  294. LPLPINF lplpInf
  295. );
  296. RETERR WINAPI IpClose
  297. (
  298. LPINF lpInf
  299. );
  300. BOOL WINAPI InitSubstrData(LPSUBSTR_DATA lpSubstrData, LPSTR lpStr);
  301. BOOL WINAPI GetFirstSubstr(LPSUBSTR_DATA lpSubstrData);
  302. BOOL WINAPI GetNextSubstr(LPSUBSTR_DATA lpSubStrData);
  303. BOOL WINAPI InitSubstrDataEx(LPSUBSTR_DATA lpssd, LPSTR lpString, char chDelim); /* ;Internal */
  304. BOOL WINAPI InitSubstrDataNulls(LPSUBSTR_DATA lpssd, LPSTR lpString);
  305. int WINAPI _i_strnicmp
  306. (
  307. LPCSTR lpOne,
  308. LPCSTR lpTwo,
  309. int n
  310. );
  311. void WINAPI FormStrWithoutPlaceHolders(LPSTR lpszDest, LPSTR lpszSource, LPINF lpInf);
  312. RETERR WINAPI IpFindFirstLine
  313. (
  314. LPINF lpInf,
  315. LPCSTR lpcszSection,
  316. LPCSTR lpcszEntry,
  317. LPLPINFSECT lplpInfSection
  318. );
  319. RETERR WINAPI IpFindNextLine
  320. (
  321. LPINF lpInf,
  322. LPINFSECT lpInfSect
  323. );
  324. RETERR WINAPI IpGetStringField
  325. (
  326. LPINF lpInf,
  327. LPINFSECT lpInfSect,
  328. WORD wField,
  329. LPSTR lpszBuffer,
  330. WORD cbBuffer,
  331. LPWORD lpwcbCopied
  332. );
  333. RETERR WINAPI IpGetFieldCount
  334. (
  335. LPINF lpInf,
  336. LPINFSECT lpInfSect,
  337. LPWORD lpwFields
  338. );
  339. void WINAPI IpSaveRestorePosition
  340. (
  341. LPINF lpInf,
  342. BOOL bSave
  343. );
  344. //////////////////////////////////////////////////////////////////////////
  345. // API that adds an icon into a Program Manager group. The group name can
  346. // be gotten either from the INI file or from allowing the user to choose
  347. // from the existing program manager groups.
  348. //
  349. BOOL CALLBACK __export
  350. AddProgmanIcon
  351. (
  352. LPCSTR lpszExeFile, // executable file that goes with the icon
  353. LPCSTR lpszCmdLine, // command line parameters for the exe file
  354. LPCSTR lpszDescription, // description under the icon
  355. LPCSTR lpszIconFile, // file that contains the icon
  356. int nIconIndex, // index of the icon in the icon file
  357. BOOL fVerbose // if TRUE and no name in the INI file, ask
  358. // the user, else skip adding the icon
  359. );
  360. #endif // SETUP31_INC