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.

275 lines
6.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: devmgr.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __DEVMGR_H_
  11. #define __DEVMGR_H_
  12. //
  13. // header files from public tree
  14. //
  15. #include <nt.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #include <windows.h>
  19. #include <windowsx.h>
  20. #include <tchar.h>
  21. #include <new.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <prsht.h>
  25. #include <prshtp.h>
  26. #include <commctrl.h>
  27. #include <commctrl.h>
  28. #include <shellapi.h>
  29. #include <shlwapi.h>
  30. #include <shlapip.h>
  31. #include <ole2.h>
  32. #include <mmc.h>
  33. #include <objsel.h>
  34. #include <htmlhelp.h>
  35. #include <wincrypt.h>
  36. #include <mscat.h>
  37. #include <softpub.h>
  38. #include <wintrust.h>
  39. #include <shfusion.h>
  40. extern "C" {
  41. #include <commdlg.h>
  42. #include <cfgmgr32.h>
  43. #include <setupapi.h>
  44. #include <spapip.h>
  45. #include <regstr.h>
  46. #include <shimdb.h>
  47. }
  48. #define STRSAFE_NO_DEPRECATE
  49. #include <strsafe.h>
  50. #define ARRAYLEN(array) (sizeof(array) / sizeof(array[0]))
  51. typedef enum tagCookieType
  52. {
  53. COOKIE_TYPE_SCOPEITEM_DEVMGR = 0,
  54. COOKIE_TYPE_RESULTITEM_RESOURCE_IRQ,
  55. COOKIE_TYPE_RESULTITEM_RESOURCE_DMA,
  56. COOKIE_TYPE_RESULTITEM_RESOURCE_IO,
  57. COOKIE_TYPE_RESULTITEM_RESOURCE_MEMORY,
  58. COOKIE_TYPE_RESULTITEM_COMPUTER,
  59. COOKIE_TYPE_RESULTITEM_DEVICE,
  60. COOKIE_TYPE_RESULTITEM_CLASS,
  61. COOKIE_TYPE_RESULTITEM_RESTYPE,
  62. COOKIE_TYPE_UNKNOWN
  63. } COOKIE_TYPE, *PCOOKIE_TYPE;
  64. #define COOKIE_FLAGS_EXPANDED 0x00000001
  65. #define COOKIE_FLAGS_SELECTED 0x00000002
  66. const int TOTAL_COOKIE_TYPES = COOKIE_TYPE_RESULTITEM_RESTYPE - COOKIE_TYPE_SCOPEITEM_DEVMGR + 1;
  67. const int NODETYPE_FIRST = (int)COOKIE_TYPE_SCOPEITEM_DEVMGR;
  68. const int NODETYPE_LAST = (int)COOKIE_TYPE_RESULTITEM_RESTYPE;
  69. typedef struct tagNodeInfo {
  70. COOKIE_TYPE ct;
  71. int idsName;
  72. int idsFormat;
  73. GUID Guid;
  74. TCHAR* GuidString;
  75. } NODEINFO, *PNODEINFO;
  76. //
  77. // Device manager needs to keep track of the largest problem code that it
  78. // currently knows about. Using the NUM_CM_PROB defined in cfg.h is a bad
  79. // idea because if more problem codes are added that device manager doesn't
  80. // know about it will cause us to overrun the end of the CMPROBLEM_INFO array.
  81. //
  82. // Note that the +2 are for
  83. // 1) the working case (0 index in the array)
  84. // 2) the unknown problem case (last problem + 1 index in the array)
  85. //
  86. #define DEVMGR_NUM_CM_PROB 0x33
  87. #if DEVMGR_NUM_CM_PROB != (NUM_CM_PROB + 1)
  88. #error Update DEVMGR_NUM_CM_PROB and update tswizard.cpp and globals.cpp.
  89. #endif
  90. #define PIF_CODE_EMBEDDED 0x01
  91. typedef struct tagProblemInfo {
  92. int StringId;
  93. DWORD Flags;
  94. } PROBLEMINFO, *PPROBLEMINFO;
  95. typedef struct tagInternalData {
  96. DATA_OBJECT_TYPES dot;
  97. COOKIE_TYPE ct;
  98. MMC_COOKIE cookie;
  99. } INTERNAL_DATA, *PINTERNAL_DATA;
  100. typedef enum tagTreeType {
  101. TREE_TYPE_CLASS = 0,
  102. TREE_TYPE_CONNECTION
  103. } TREE_TYPE, *PTREE_TYPE;
  104. typedef enum tagDriverType{
  105. DRIVER_TYPE_CLASS = 0,
  106. DRIVER_TYPE_COMPATIBLE
  107. } DRIVER_TYPE, *PDRIVER_TYPE;
  108. typedef enum tagPropertyChangeType
  109. {
  110. PCT_STARTUP_INFODATA = 0,
  111. PCT_DEVICE,
  112. PCT_CLASS
  113. }PROPERTY_CHANGE_TYPE, *PPROPERTY_CHANGE_TYPE;
  114. typedef struct tagPropertyChangeInfo
  115. {
  116. PROPERTY_CHANGE_TYPE Type;
  117. BYTE InfoData[1];
  118. }PROPERTY_CHANGE_INFO, *PPROPERTY_CHANGE_INFO;
  119. typedef struct tagStartupInfoData
  120. {
  121. DWORD Size;
  122. COOKIE_TYPE ct;
  123. TCHAR MachineName[MAX_PATH + 3];
  124. }STARTUP_INFODATA, *PSTARTUP_INFODATA;
  125. typedef struct tagDeviceInfoData
  126. {
  127. DWORD Size;
  128. TCHAR DeviceId[MAX_DEVICE_ID_LEN];
  129. } DEVICE_INFODATA, *PDEVICE_INFODATA;
  130. typedef struct tagClassInfoData
  131. {
  132. DWORD Size;
  133. GUID ClassGuid;
  134. } CLASS_INFODATA, *PCLASS_INFODATA;
  135. typedef enum tagdmQuerySiblingCode
  136. {
  137. QSC_TO_FOREGROUND = 0,
  138. QSC_PROPERTY_CHANGED,
  139. }DMQUERYSIBLINGCODE, *PDMQUERYSIBLINGCODE;
  140. //
  141. // private header files
  142. //
  143. #include "..\inc\tvintf.h"
  144. #include "resource.h"
  145. #include "prndlg.h"
  146. #include "globals.h"
  147. #include "utils.h"
  148. #include "ccookie.h"
  149. #include "machine.h"
  150. #include "compdata.h"
  151. #include "componet.h"
  152. #include "cnode.h"
  153. #include "cfolder.h"
  154. #include "dataobj.h"
  155. BOOL InitGlobals(HINSTANCE hInstance);
  156. extern LPCTSTR DEVMGR_DEVICEID_SWITCH;
  157. extern LPCTSTR DEVMGR_MACHINENAME_SWITCH;
  158. extern LPCTSTR DEVMGR_COMMAND_SWITCH;
  159. void * __cdecl operator new(size_t size);
  160. void __cdecl operator delete(void *ptr);
  161. __cdecl _purecall(void);
  162. STDAPI
  163. DllRegisterServer();
  164. STDAPI
  165. DllUnregisterServer();
  166. STDAPI
  167. DllCanUnloadNow();
  168. STDAPI
  169. DllGetClassObject(REFCLSID rclsid, REFIID iid, void** ppv);
  170. //
  171. // CDMCommandLine class defination
  172. //
  173. class CDMCommandLine : public CCommandLine
  174. {
  175. public:
  176. CDMCommandLine() : m_WaitForDeviceId(FALSE),
  177. m_WaitForMachineName(FALSE),
  178. m_WaitForCommand(FALSE)
  179. {}
  180. virtual void ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
  181. {
  182. if (bFlag)
  183. {
  184. if (!lstrcmpi(DEVMGR_DEVICEID_SWITCH, lpszParam))
  185. m_WaitForDeviceId = TRUE;
  186. else if (!lstrcmpi(DEVMGR_MACHINENAME_SWITCH, lpszParam))
  187. m_WaitForMachineName = TRUE;
  188. else if (!lstrcmpi(DEVMGR_COMMAND_SWITCH, lpszParam))
  189. m_WaitForCommand = TRUE;
  190. }
  191. else
  192. {
  193. if (m_WaitForDeviceId) {
  194. m_strDeviceId = lpszParam;
  195. m_WaitForDeviceId = FALSE;
  196. }
  197. else if (m_WaitForMachineName) {
  198. m_strMachineName = lpszParam;
  199. m_WaitForMachineName = FALSE;
  200. }
  201. else if (m_WaitForCommand) {
  202. m_strCommand = lpszParam;
  203. m_WaitForCommand = FALSE;
  204. }
  205. }
  206. }
  207. LPCTSTR GetDeviceId()
  208. {
  209. return m_strDeviceId.IsEmpty() ? NULL : (LPCTSTR)m_strDeviceId;
  210. }
  211. LPCTSTR GetMachineName()
  212. {
  213. return m_strMachineName.IsEmpty() ? NULL : (LPCTSTR)m_strMachineName;
  214. }
  215. LPCTSTR GetCommand()
  216. {
  217. return m_strCommand.IsEmpty() ? NULL : (LPCTSTR)m_strCommand;
  218. }
  219. private:
  220. String m_strDeviceId;
  221. String m_strMachineName;
  222. String m_strCommand;
  223. BOOL m_WaitForDeviceId;
  224. BOOL m_WaitForMachineName;
  225. BOOL m_WaitForCommand;
  226. };
  227. #endif