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.

289 lines
7.1 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1995-2000 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: cdm.h
  6. //
  7. // Description:
  8. //
  9. // Public header file for the IU (V4) Code Download Manager (CDM.DLL).
  10. //
  11. //=======================================================================
  12. #ifndef _INC_CDM
  13. #define _INC_CDM
  14. #if defined(__cplusplus)
  15. extern "C" {
  16. #endif
  17. //
  18. // Define API decoration for direct importing of DLL references.
  19. //
  20. #if !defined(_CDM_)
  21. #define CDMAPI DECLSPEC_IMPORT
  22. #else
  23. #define CDMAPI
  24. #endif
  25. //
  26. // HWID_LEN must remain 2048 for backwards CDM compatibility, however note that the maximum
  27. // length for a hardware ID is defined in //depot/Lab04_N/Root/Public/sdk/inc/cfgmgr32.h
  28. // as #define MAX_DEVICE_ID_LEN 200
  29. //
  30. #define HWID_LEN 2048
  31. #ifndef LINE_LEN
  32. #define LINE_LEN 256 // Win95-compatible maximum for displayable
  33. // strings coming from a device INF.
  34. #endif
  35. //Win 98 DOWNLOADINFO
  36. typedef struct _DOWNLOADINFOWIN98
  37. {
  38. DWORD dwDownloadInfoSize; //size of this structure
  39. LPTSTR lpHardwareIDs; //multi_sz list of Hardware PnP IDs
  40. LPTSTR lpCompatIDs; //multi_sz list of compatible IDs
  41. LPTSTR lpFile; //File name (string)
  42. OSVERSIONINFO OSVersionInfo; //OSVERSIONINFO from GetVersionEx()
  43. DWORD dwFlags; //Flags
  44. DWORD dwClientID; //Client ID
  45. } DOWNLOADINFOWIN98, *PDOWNLOADINFOWIN98;
  46. typedef struct _DOWNLOADINFO {
  47. DWORD dwDownloadInfoSize; // size of this structure
  48. LPCWSTR lpHardwareIDs; // multi_sz list of Hardware PnP IDs
  49. LPCWSTR lpDeviceInstanceID; // Device Instance ID
  50. LPCWSTR lpFile; // File name (string)
  51. OSVERSIONINFOW OSVersionInfo; // OSVERSIONINFO from GetVersionEx()
  52. DWORD dwArchitecture; // Specifies the system's processor architecture.
  53. //This value can be one of the following values:
  54. //PROCESSOR_ARCHITECTURE_INTEL
  55. //Windows NT only: PROCESSOR_ARCHITECTURE_MIPS
  56. //Windows NT only: PROCESSOR_ARCHITECTURE_ALPHA
  57. //Windows NT only: PROCESSOR_ARCHITECTURE_PPC
  58. //Windows NT only: PROCESSOR_ARCHITECTURE_UNKNOWN
  59. DWORD dwFlags; // Flags
  60. DWORD dwClientID; // Client ID
  61. LCID localid; // local id
  62. } DOWNLOADINFO, *PDOWNLOADINFO;
  63. typedef struct _WUDRIVERINFO
  64. {
  65. DWORD dwStructSize; // size of this structure
  66. WCHAR wszHardwareID[HWID_LEN]; // ID being used to match
  67. WCHAR wszDescription[LINE_LEN]; // from INF
  68. WCHAR wszMfgName[LINE_LEN]; // from INF
  69. WCHAR wszProviderName[LINE_LEN]; // INF provider
  70. WCHAR wszDriverVer[LINE_LEN]; // from INF
  71. } WUDRIVERINFO, *PWUDRIVERINFO;
  72. typedef void (*PFN_QueryDetectionFilesCallback)(void* pCallbackParam, LPCWSTR pszURL, LPCWSTR pszLocalFile);
  73. //
  74. // CDM exported function declarations
  75. //
  76. CDMAPI
  77. VOID
  78. WINAPI
  79. CloseCDMContext(
  80. IN HANDLE hConnection
  81. );
  82. CDMAPI
  83. void
  84. WINAPI
  85. DetFilesDownloaded(
  86. IN HANDLE hConnection
  87. );
  88. //
  89. // IMPORTANT: DownloadGetUpdatedFiles is only exported from the IU CDM.DLL stub.
  90. // It is NOT present in the Whistler version of the "Classic" V3 control.
  91. //
  92. CDMAPI
  93. BOOL
  94. DownloadGetUpdatedFiles(
  95. IN PDOWNLOADINFOWIN98 pDownloadInfoWin98,
  96. IN OUT LPTSTR lpDownloadPath,
  97. IN UINT uSize
  98. );
  99. CDMAPI
  100. BOOL
  101. WINAPI
  102. DownloadIsInternetAvailable(
  103. void
  104. );
  105. CDMAPI
  106. BOOL
  107. WINAPI
  108. DownloadUpdatedFiles(
  109. IN HANDLE hConnection,
  110. IN HWND hwnd,
  111. IN PDOWNLOADINFO pDownloadInfo,
  112. OUT LPWSTR lpDownloadPath,
  113. IN UINT uSize,
  114. OUT PUINT puRequiredSize
  115. );
  116. CDMAPI
  117. BOOL
  118. WINAPI
  119. FindMatchingDriver(
  120. IN HANDLE hConnection,
  121. IN PDOWNLOADINFO pDownloadInfo,
  122. OUT PWUDRIVERINFO pWuDriverInfo
  123. );
  124. CDMAPI
  125. void
  126. WINAPI
  127. LogDriverNotFound(
  128. IN HANDLE hConnection,
  129. IN LPCWSTR lpDeviceInstanceID,
  130. IN DWORD dwFlags
  131. );
  132. CDMAPI
  133. HANDLE
  134. WINAPI
  135. OpenCDMContext(
  136. IN HWND hwnd
  137. );
  138. CDMAPI
  139. HANDLE
  140. WINAPI
  141. OpenCDMContextEx(
  142. IN BOOL fConnectIfNotConnected
  143. );
  144. CDMAPI
  145. int
  146. WINAPI
  147. QueryDetectionFiles(
  148. IN HANDLE hConnection,
  149. IN void* pCallbackParam,
  150. IN PFN_QueryDetectionFilesCallback pCallback
  151. );
  152. //
  153. // 502965 Windows Error Reporting bucket 2096553: Hang following NEWDEV.DLL!CancelDriverSearch
  154. //
  155. CDMAPI
  156. HRESULT
  157. WINAPI
  158. CancelCDMOperation(
  159. void
  160. );
  161. //
  162. // CDM prototypes
  163. //
  164. typedef VOID (WINAPI *CLOSE_CDM_CONTEXT_PROC)(
  165. IN HANDLE hConnection
  166. );
  167. typedef void (WINAPI *DET_FILES_DOWNLOADED_PROC)(
  168. IN HANDLE hConnection
  169. );
  170. typedef BOOL (WINAPI *DOWNLOAD_GET_UPDATED_FILES)(
  171. IN PDOWNLOADINFOWIN98 pDownloadInfoWin98,
  172. IN OUT LPTSTR lpDownloadPath,
  173. IN UINT uSize
  174. );
  175. typedef BOOL (WINAPI *CDM_INTERNET_AVAILABLE_PROC)(
  176. void
  177. );
  178. typedef BOOL (WINAPI *DOWNLOAD_UPDATED_FILES_PROC)(
  179. IN HANDLE hConnection,
  180. IN HWND hwnd,
  181. IN PDOWNLOADINFO pDownloadInfo,
  182. OUT LPWSTR lpDownloadPath,
  183. IN UINT uSize,
  184. OUT PUINT puRequiredSize
  185. );
  186. typedef BOOL (WINAPI *FIND_MATCHING_DRIVER_PROC)(
  187. IN HANDLE hConnection,
  188. IN PDOWNLOADINFO pDownloadInfo,
  189. OUT PWUDRIVERINFO pWuDriverInfo
  190. );
  191. typedef void (WINAPI *LOG_DRIVER_NOT_FOUND_PROC)(
  192. IN HANDLE hConnection,
  193. IN LPCWSTR lpDeviceInstanceID,
  194. IN DWORD dwFlags
  195. );
  196. typedef HANDLE (WINAPI *OPEN_CDM_CONTEXT_PROC)(
  197. IN HWND hwnd
  198. );
  199. typedef HANDLE (WINAPI *OPEN_CDM_CONTEXT_EX_PROC)(
  200. IN BOOL fConnectIfNotConnected
  201. );
  202. typedef int (WINAPI *QUERY_DETECTION_FILES_PROC)(
  203. IN HANDLE hConnection,
  204. IN void* pCallbackParam,
  205. IN PFN_QueryDetectionFilesCallback pCallback
  206. );
  207. typedef HRESULT (WINAPI *CANCEL_CDM_OPERATION_PROC)(
  208. void
  209. );
  210. //
  211. // The following defines and structures are private internal interfaces so
  212. // they are in cdm.h and not in setupapi.h
  213. //
  214. #define DIF_GETWINDOWSUPDATEINFO 0x00000025
  215. #define DI_FLAGSEX_SHOWWINDOWSUPDATE 0x00400000L
  216. //For dwFlags parameter of LogDriverNotFound(...)
  217. //used with bitwising
  218. #define BEGINLOGFLAG 0x00000002 //if 1, batch logging ends, flushing internal hardware id list to file
  219. //
  220. // Structure corresponding to a DIF_GETWINDOWSUPDATEINFO install function.
  221. //
  222. typedef struct _SP_WINDOWSUPDATE_PARAMS_A {
  223. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  224. CHAR PackageId[MAX_PATH];
  225. HANDLE CDMContext;
  226. } SP_WINDOWSUPDATE_PARAMS_A, *PSP_WINDOWSUPDATE_PARAMS_A;
  227. typedef struct _SP_WINDOWSUPDATE_PARAMS_W {
  228. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  229. WCHAR PackageId[MAX_PATH];
  230. HANDLE CDMContext;
  231. } SP_WINDOWSUPDATE_PARAMS_W, *PSP_WINDOWSUPDATE_PARAMS_W;
  232. #ifdef UNICODE
  233. typedef SP_WINDOWSUPDATE_PARAMS_W SP_WINDOWSUPDATE_PARAMS;
  234. typedef PSP_WINDOWSUPDATE_PARAMS_W PSP_WINDOWSUPDATE_PARAMS;
  235. #else
  236. typedef SP_WINDOWSUPDATE_PARAMS_A SP_WINDOWSUPDATE_PARAMS;
  237. typedef PSP_WINDOWSUPDATE_PARAMS_A PSP_WINDOWSUPDATE_PARAMS;
  238. #endif
  239. #if defined(__cplusplus)
  240. } // end extern "C"
  241. #endif
  242. #endif // _INC_CDM