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.

231 lines
5.7 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1995-1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: cdm.cpp
  6. //
  7. // Owner: YanL
  8. //
  9. // Description:
  10. //
  11. // Public header file for Windows NT Code Download Manager services Dll.
  12. //
  13. //=======================================================================
  14. #ifndef _INC_CDM
  15. #define _INC_CDM
  16. //
  17. // Define API decoration for direct importing of DLL references.
  18. //
  19. #if !defined(_CDM_)
  20. #define CDMAPI DECLSPEC_IMPORT
  21. #else
  22. #define CDMAPI
  23. #endif
  24. #define HWID_LEN 2048
  25. #ifndef LINE_LEN
  26. #define LINE_LEN 256 // Win95-compatible maximum for displayable
  27. // strings coming from a device INF.
  28. #endif
  29. typedef struct _DOWNLOADINFO {
  30. DWORD dwDownloadInfoSize; // size of this structure
  31. LPCWSTR lpHardwareIDs; // multi_sz list of Hardware PnP IDs
  32. LPCWSTR lpDeviceInstanceID; // Device Instance ID
  33. LPCWSTR lpFile; // File name (string)
  34. OSVERSIONINFOW OSVersionInfo; // OSVERSIONINFO from GetVersionEx()
  35. DWORD dwArchitecture; // Specifies the system's processor architecture.
  36. //This value can be one of the following values:
  37. //PROCESSOR_ARCHITECTURE_INTEL
  38. //Windows NT only: PROCESSOR_ARCHITECTURE_MIPS
  39. //Windows NT only: PROCESSOR_ARCHITECTURE_ALPHA
  40. //Windows NT only: PROCESSOR_ARCHITECTURE_PPC
  41. //Windows NT only: PROCESSOR_ARCHITECTURE_UNKNOWN
  42. DWORD dwFlags; // Flags
  43. DWORD dwClientID; // Client ID
  44. LCID localid; // local id
  45. } DOWNLOADINFO, *PDOWNLOADINFO;
  46. typedef struct _WUDRIVERINFO
  47. {
  48. DWORD dwStructSize; // size of this structure
  49. WCHAR wszHardwareID[HWID_LEN]; // ID being used to match
  50. WCHAR wszDescription[LINE_LEN]; // from INF
  51. WCHAR wszMfgName[LINE_LEN]; // from INF
  52. WCHAR wszProviderName[LINE_LEN]; // INF provider
  53. WCHAR wszDriverVer[LINE_LEN]; // from INF
  54. } WUDRIVERINFO, *PWUDRIVERINFO;
  55. CDMAPI
  56. HANDLE
  57. WINAPI
  58. OpenCDMContext(
  59. IN HWND hwnd
  60. );
  61. CDMAPI
  62. HANDLE
  63. WINAPI
  64. OpenCDMContextEx(
  65. IN BOOL fConnectIfNotConnected
  66. );
  67. CDMAPI
  68. BOOL
  69. WINAPI
  70. DownloadIsInternetAvailable(
  71. void
  72. );
  73. CDMAPI
  74. BOOL
  75. WINAPI
  76. DownloadUpdatedFiles(
  77. IN HANDLE hConnection,
  78. IN HWND hwnd,
  79. IN PDOWNLOADINFO pDownloadInfo,
  80. OUT LPWSTR lpDownloadPath,
  81. IN UINT uSize,
  82. OUT PUINT puRequiredSize
  83. );
  84. typedef void (*PFN_QueryDetectionFilesCallback)(void* pCallbackParam, LPCWSTR pszURL, LPCWSTR pszLocalFile);
  85. CDMAPI
  86. int
  87. WINAPI
  88. QueryDetectionFiles(
  89. IN HANDLE hConnection,
  90. IN void* pCallbackParam,
  91. IN PFN_QueryDetectionFilesCallback pCallback
  92. );
  93. CDMAPI
  94. void
  95. WINAPI
  96. DetFilesDownloaded(
  97. IN HANDLE hConnection
  98. );
  99. CDMAPI
  100. BOOL
  101. WINAPI
  102. FindMatchingDriver(
  103. IN HANDLE hConnection,
  104. IN PDOWNLOADINFO pDownloadInfo,
  105. OUT PWUDRIVERINFO pWuDriverInfo
  106. );
  107. CDMAPI
  108. void
  109. WINAPI
  110. LogDriverNotFound(
  111. IN HANDLE hConnection,
  112. IN LPCWSTR lpDeviceInstanceID,
  113. IN DWORD dwFlags
  114. );
  115. CDMAPI
  116. VOID
  117. WINAPI
  118. CloseCDMContext(
  119. IN HANDLE hConnection
  120. );
  121. //
  122. // CDM prototypes
  123. //
  124. typedef HANDLE (WINAPI *OPEN_CDM_CONTEXT_PROC)(
  125. IN HWND hwnd
  126. );
  127. typedef HANDLE (WINAPI *OPEN_CDM_CONTEXT_EX_PROC)(
  128. IN BOOL fConnectIfNotConnected
  129. );
  130. typedef BOOL (WINAPI *DOWNLOAD_UPDATED_FILES_PROC)(
  131. IN HANDLE hConnection,
  132. IN HWND hwnd,
  133. IN PDOWNLOADINFO pDownloadInfo,
  134. OUT LPWSTR lpDownloadPath,
  135. IN UINT uSize,
  136. OUT PUINT puRequiredSize
  137. );
  138. typedef int (WINAPI *QUERY_DETECTION_FILES_PROC)(
  139. IN HANDLE hConnection,
  140. IN void* pCallbackParam,
  141. IN PFN_QueryDetectionFilesCallback pCallback
  142. );
  143. typedef void (WINAPI *DET_FILES_DOWNLOADED_PROC)(
  144. IN HANDLE hConnection
  145. );
  146. typedef BOOL (WINAPI *FIND_MATCHING_DRIVER_PROC)(
  147. IN HANDLE hConnection,
  148. IN PDOWNLOADINFO pDownloadInfo,
  149. OUT PWUDRIVERINFO pWuDriverInfo
  150. );
  151. typedef void (WINAPI *LOG_DRIVER_NOT_FOUND_PROC)(
  152. IN HANDLE hConnection,
  153. IN LPCWSTR lpDeviceInstanceID,
  154. IN DWORD dwFlags
  155. );
  156. typedef VOID (WINAPI *CLOSE_CDM_CONTEXT_PROC)(
  157. IN HANDLE hConnection
  158. );
  159. typedef BOOL (WINAPI *CDM_INTERNET_AVAILABLE_PROC)(
  160. void
  161. );
  162. //
  163. // The following defines and structures are private internal interfaces so
  164. // they are in cdm.h and not in setupapi.h
  165. //
  166. #define DIF_GETWINDOWSUPDATEINFO 0x00000025
  167. #define DI_FLAGSEX_SHOWWINDOWSUPDATE 0x00400000L
  168. //For dwFlags parameter of LogDriverNotFound(...)
  169. //used with bitwising
  170. #define BEGINLOGFLAG 0x00000002 //if 1, batch logging ends, flushing internal hardware id list to file
  171. //
  172. // Structure corresponding to a DIF_GETWINDOWSUPDATEINFO install function.
  173. //
  174. typedef struct _SP_WINDOWSUPDATE_PARAMS_A {
  175. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  176. CHAR PackageId[MAX_PATH];
  177. HANDLE CDMContext;
  178. } SP_WINDOWSUPDATE_PARAMS_A, *PSP_WINDOWSUPDATE_PARAMS_A;
  179. typedef struct _SP_WINDOWSUPDATE_PARAMS_W {
  180. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  181. WCHAR PackageId[MAX_PATH];
  182. HANDLE CDMContext;
  183. } SP_WINDOWSUPDATE_PARAMS_W, *PSP_WINDOWSUPDATE_PARAMS_W;
  184. #ifdef UNICODE
  185. typedef SP_WINDOWSUPDATE_PARAMS_W SP_WINDOWSUPDATE_PARAMS;
  186. typedef PSP_WINDOWSUPDATE_PARAMS_W PSP_WINDOWSUPDATE_PARAMS;
  187. #else
  188. typedef SP_WINDOWSUPDATE_PARAMS_A SP_WINDOWSUPDATE_PARAMS;
  189. typedef PSP_WINDOWSUPDATE_PARAMS_A PSP_WINDOWSUPDATE_PARAMS;
  190. #endif
  191. #endif // _INC_CDM