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.

235 lines
10 KiB

  1. //=================================================================
  2. //
  3. // CfgMgr32.h
  4. //
  5. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #ifndef __CFGMGR32_H__
  9. #define __CFGMGR32_H__
  10. extern "C"
  11. {
  12. #include <cfgmgr32.h>
  13. }
  14. #ifdef WIN9XONLY
  15. #include "Cim32NetApi.h"
  16. #endif
  17. #include "sms95lanexp.h"
  18. /**********************************************************************************************************
  19. * #includes to Register this class with the CResourceManager.
  20. **********************************************************************************************************/
  21. #include "ResourceManager.h"
  22. #include "TimedDllResource.h"
  23. extern const GUID guidCFGMGRAPI ;
  24. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_CONNECT_MACHINEA) ( PCSTR UNCServerName,
  25. PHMACHINE phMachine
  26. );
  27. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_DISCONNECT_MACHINE) ( HMACHINE hMachine
  28. );
  29. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_LOCATE_DEVNODE) ( PDEVINST pdnDevInst,
  30. TCHAR *pDeviceID,
  31. ULONG ulFlags
  32. );
  33. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_PARENT) ( PDEVINST pdnDevInst,
  34. DEVINST dnDevInst,
  35. ULONG ulFlags
  36. );
  37. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_CHILD) ( PDEVINST pdnDevInst,
  38. DEVINST dnDevInst,
  39. ULONG ulFlags
  40. );
  41. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_SIBLING) ( PDEVINST pdnDevInst,
  42. DEVINST dnDevInst,
  43. ULONG ulFlags
  44. );
  45. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_DEVNODE_REGISTRY_PROPERTY) ( DEVINST dnDevInst,
  46. ULONG ulProperty,
  47. PULONG pulRegDataType,
  48. PVOID Buffer,
  49. PULONG pulLength,
  50. ULONG ulFlags
  51. );
  52. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_DEVNODE_STATUS) ( PULONG pulStatus,
  53. PULONG pulProblemNumber,
  54. DEVINST dnDevInst,
  55. ULONG ulFlags
  56. );
  57. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_FIRST_LOG_CONF) ( PLOG_CONF plcLogConf,
  58. DEVINST dnDevInst,
  59. ULONG ulFlags
  60. );
  61. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_NEXT_RES_DES) ( PRES_DES prdResDes,
  62. RES_DES rdResDes,
  63. RESOURCEID ForResource,
  64. PRESOURCEID pResourceID,
  65. ULONG ulFlags
  66. );
  67. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_RES_DES_DATA) ( RES_DES rdResDes,
  68. PVOID Buffer,
  69. ULONG BufferLen,
  70. ULONG ulFlags
  71. );
  72. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_RES_DES_DATA_SIZE) ( PULONG pulSize,
  73. RES_DES rdResDes,
  74. ULONG ulFlags
  75. );
  76. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_FREE_LOG_CONF_HANDLE) ( LOG_CONF lcLogConf
  77. );
  78. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_FREE_RES_DES_HANDLE) ( RES_DES rdResDes
  79. );
  80. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_DEVICE_IDA) ( DEVNODE dnDevNode,
  81. PCHAR Buffer,
  82. ULONG BufferLen,
  83. ULONG ulFlags
  84. );
  85. typedef CONFIGRET (WINAPI* PCFGMGR32_CM_GET_DEVICE_ID_SIZE) ( PULONG pulLen,
  86. DEVNODE dnDevNode,
  87. ULONG ulFlags
  88. );
  89. class CConfigMgrAPI : public CTimedDllResource
  90. {
  91. public:
  92. CConfigMgrAPI();
  93. ~CConfigMgrAPI();
  94. BOOL IsValid () ;
  95. CONFIGRET CM_Connect_MachineA( PCSTR UNCServerName, PHMACHINE phMachine );
  96. CONFIGRET CM_Disconnect_Machine( HMACHINE hMachine );
  97. CONFIGRET CM_Get_Parent( PDEVINST pdnDevInst, DEVINST DevInst, ULONG ulFlags );
  98. CONFIGRET CM_Get_Child( PDEVINST pdnDevInst, DEVINST DevInst, ULONG ulFlags );
  99. CONFIGRET CM_Get_Sibling( PDEVINST pdnDevInst, DEVINST DevInst, ULONG ulFlags );
  100. CONFIGRET CM_Locate_DevNode( PDEVINST pdnDevInst, TCHAR *pDeviceID, ULONG ulFlags );
  101. CONFIGRET CM_Get_DevNode_Registry_PropertyA( DEVINST dnDevInst, ULONG ulProperty, PULONG pulRegDataType,
  102. PVOID Buffer, PULONG pulLength, ULONG ulFlags );
  103. CONFIGRET CM_Get_DevNode_Status( PULONG pulStatus, PULONG pulProblemNumber, DEVINST dnDevInst, ULONG ulFlags );
  104. CONFIGRET CM_Get_First_Log_Conf( PLOG_CONF plcLogConf, DEVINST dnDevInst, ULONG ulFlags );
  105. CONFIGRET CM_Get_Next_Res_Des( PRES_DES prdResDes, RES_DES rdResDes, RESOURCEID ForResource, PRESOURCEID pResourceID, ULONG ulFlags );
  106. CONFIGRET CM_Get_Res_Des_Data( RES_DES rdResDes, PVOID Buffer, ULONG BufferLen, ULONG ulFlags );
  107. CONFIGRET CM_Get_Res_Des_Data_Size( PULONG pulSize, RES_DES rdResDes, ULONG ulFlags );
  108. CONFIGRET CM_Free_Log_Conf_Handle( LOG_CONF lcLogConf );
  109. CONFIGRET CM_Free_Res_Des_Handle( RES_DES rdResDes );
  110. CONFIGRET CM_Get_Device_IDA( DEVNODE dnDevNode, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags );
  111. CONFIGRET CM_Get_Device_ID_Size( PULONG pulLen, DEVNODE dnDevNode, ULONG ulFlags );
  112. // Win 95/98 only
  113. #ifdef WIN9XONLY
  114. CONFIGRET CM_Get_Bus_Info( DEVNODE dnDevNode, PCMBUSTYPE pbtBusType, LPULONG pulSizeOfInfo, LPVOID pInfo, ULONG ulFlags );
  115. // So far these are only needed on 9x.
  116. CONFIGRET CM_Query_Arbitrator_Free_Data(PVOID pData, ULONG DataLen, DEVINST dnDevInst, RESOURCEID ResourceID, ULONG ulFlags);
  117. CONFIGRET CM_Delete_Range(ULONG ulStartValue, ULONG ulEndValue, RANGE_LIST rlh, ULONG ulFlags);
  118. CONFIGRET CM_First_Range(RANGE_LIST rlh, LPULONG pulStart, LPULONG pulEnd, PRANGE_ELEMENT preElement, ULONG ulFlags);
  119. CONFIGRET CM_Next_Range(PRANGE_ELEMENT preElement, LPULONG pulStart, LPULONG pullEnd, ULONG ulFlags);
  120. CONFIGRET CM_Free_Range_List(RANGE_LIST rlh, ULONG ulFlags);
  121. #endif
  122. private:
  123. #ifdef NTONLY
  124. HINSTANCE m_hConfigMgrDll;
  125. #endif
  126. #ifdef WIN9XONLY
  127. CCim32NetApi* m_pCim32NetApi;
  128. #endif
  129. #ifdef NTONLY
  130. // 32-bit Config Manager pointers
  131. PCFGMGR32_CM_CONNECT_MACHINEA m_pCM_Connect_MachineA;
  132. PCFGMGR32_CM_DISCONNECT_MACHINE m_pCM_Disconnect_Machine;
  133. PCFGMGR32_CM_LOCATE_DEVNODE m_pCM_Locate_DevNode;
  134. PCFGMGR32_CM_GET_CHILD m_pCM_Get_Child;
  135. PCFGMGR32_CM_GET_SIBLING m_pCM_Get_Sibling;
  136. PCFGMGR32_CM_GET_DEVNODE_REGISTRY_PROPERTY m_pCM_Get_DevNode_Registry_Property;
  137. PCFGMGR32_CM_GET_DEVNODE_STATUS m_pCM_Get_DevNode_Status;
  138. PCFGMGR32_CM_GET_FIRST_LOG_CONF m_pCM_Get_First_Log_Config;
  139. PCFGMGR32_CM_GET_NEXT_RES_DES m_pCM_Get_Next_Res_Des;
  140. PCFGMGR32_CM_GET_RES_DES_DATA m_pCM_Get_Res_Des_Data;
  141. PCFGMGR32_CM_GET_RES_DES_DATA_SIZE m_pCM_Get_Res_Des_Data_Size;
  142. PCFGMGR32_CM_FREE_LOG_CONF_HANDLE m_pCM_Free_Log_Conf_Handle;
  143. PCFGMGR32_CM_FREE_RES_DES_HANDLE m_pCM_Free_Res_Des_Handle;
  144. PCFGMGR32_CM_GET_DEVICE_IDA m_pCM_Get_Device_IDA;
  145. PCFGMGR32_CM_GET_DEVICE_ID_SIZE m_pCM_Get_Device_ID_Size;
  146. PCFGMGR32_CM_GET_PARENT m_pCM_Get_Parent;
  147. #endif
  148. #ifdef WIN9XONLY
  149. // 16-bit Config Manager Thunking Pass-Thrus
  150. /*
  151. PCIM32THK_CM_LOCATE_DEVNODE m_pCM16_Locate_DevNode;
  152. PCIM32THK_CM_GET_CHILD m_pCM16_Get_Child;
  153. PCIM32THK_CM_GET_SIBLING m_pCM16_Get_Sibling;
  154. PCIM32THK_CM_READ_REGISTRY_VALUE m_pCM16_Read_Registry_Value;
  155. PCIM32THK_CM_GET_DEVNODE_STATUS m_pCM16_Get_DevNode_Status;
  156. PCIM32THK_CM_GET_DEVICE_ID m_pCM16_Get_Device_ID;
  157. PCIM32THK_CM_GET_DEVICE_ID_SIZE m_pCM16_Get_Device_ID_Size;
  158. PCIM32THK_CM_GET_FIRST_LOG_CONF m_pCM16_Get_First_Log_Conf;
  159. PCIM32THK_CM_GET_NEXT_RES_DES m_pCM16_Get_Next_Res_Des;
  160. PCIM32THK_CM_GET_RES_DES_DATA_SIZE m_pCM16_Get_Res_Des_Data_Size;
  161. PCIM32THK_CM_GET_RES_DES_DATA m_pCM16_Get_Res_Des_Data;
  162. PCIM32THK_CM_GET_BUS_INFO m_pCM16_Get_Bus_Info;
  163. PCIM32THK_CM_GET_PARENT m_pCM16_Get_Parent;
  164. */
  165. #endif
  166. const static char* s_pszRegistryStrings[];
  167. static ULONG s_pszRegistryValueTypes[];
  168. };
  169. // CIM16 registry ULONG to Str conversions
  170. #define CM_DRP_DEVICEDESC_S "DeviceDesc" // DeviceDesc REG_SZ property (RW)
  171. #define CM_DRP_HARDWAREID_S "HardwareID" // HardwareID REG_MULTI_SZ property (RW)
  172. #define CM_DRP_COMPATIBLEIDS_S "CompatibleIDs" // CompatibleIDs REG_MULTI_SZ property (RW)
  173. #define CM_DRP_NTDEVICEPATHS_S "NtDevicePaths" // NTDevicePaths (NT4)
  174. #define CM_DRP_SERVICE_S "Service" // Service REG_SZ property (RW)
  175. #define CM_DRP_CONFIGURATION_S "Configuration" // Configuration (NT4)
  176. #define CM_DRP_CONFIGURATIONVECTOR_S "ConfigurationVector" // ConfigurationVector(NT4)
  177. #define CM_DRP_CLASS_S "Class" // Class REG_SZ property (RW)
  178. #define CM_DRP_CLASSGUID_S "ClassGUID" // ClassGUID REG_SZ property (RW)
  179. #define CM_DRP_DRIVER_S "Driver" // Driver REG_SZ property (RW)
  180. #define CM_DRP_CONFIGFLAGS_S "ConfigFlags" // ConfigFlags REG_DWORD property (RW)
  181. #define CM_DRP_MFG_S "Mfg" // Mfg REG_SZ property (RW)
  182. #define CM_DRP_FRIENDLYNAME_S "FriendlyName" // FriendlyName REG_SZ property (RW)
  183. #define CM_DRP_LOCATION_INFORMATION_S "LocationInformation" // LocationInformation REG_SZ property (RW)
  184. #define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME_S "PhysicalDeviceObjectName" // PhysicalDeviceObjectName REG_SZ property (R)
  185. #define CM_DRP_CAPABILITIES_S "Capabilities" // Capabilities REG_DWORD property (R)
  186. #define CM_DRP_UI_NUMBER_S "UiNumber" // UiNumber REG_DWORD property (R)
  187. #define CM_DRP_UPPERFILTERS_S "UpperFilters" // UpperFilters REG_MULTI_SZ property (RW)
  188. #define CM_DRP_LOWERFILTERS_S "LowerFilters" // LowerFilters REG_MULTI_SZ property (RW)
  189. #define CM_DRP_BUSTYPEGUID_S "BusTypeGuid" // Bus Type Guid, GUID, (R)
  190. #define CM_DRP_LEGACYBUSTYPE_S "LegacyBusType" // Legacy bus type, INTERFACE_TYPE, (R)
  191. #define CM_DRP_BUSNUMBER_S "BusNumber" // Bus Number, DWORD, (R)
  192. #define CM_DRP_ENUMERATOR_NAME_S "Enumerator" // Enumerator Name REG_SZ property (R)
  193. #define CM_DRP_MIN_S "" // Min
  194. #define CM_DRP_MAX_S "" // Max
  195. #endif //__CFGMGRCOMPUTER_H__