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.

535 lines
22 KiB

  1. #ifndef __MACHINE_H_
  2. #define __MACHINE_H_
  3. /*++
  4. Copyright (C) 1997-1999 Microsoft Corporation
  5. Module Name:
  6. machine.h
  7. Abstract:
  8. header file that declares CMachine, CDevInfoist and CMachineList classes
  9. Author:
  10. William Hsieh (williamh) created
  11. Revision History:
  12. --*/
  13. LRESULT CALLBACK dmNotifyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  14. typedef BOOL (*LPFNINSTALLDEVINST)(HWND hwndParent, LPCTSTR DeviceId, BOOL UpdateDriver, DWORD* pReboot);
  15. typedef BOOL (*LPFNROLLBACKDRIVER)(HWND hwndParent, LPCTSTR RegistryKey, DWORD Flags, DWORD* pReboot);
  16. class CDevice;
  17. class CClass;
  18. class CComputer;
  19. class CLogConf;
  20. class CResDes;
  21. class CMachineList;
  22. class CFolder;
  23. #define DM_NOTIFY_TIMERID 0x444d4d44
  24. //This class represents SETUPAPI's <Device Information List>
  25. //
  26. // WARNING !!!
  27. // no copy constructor and assignment operator are provided ---
  28. // DO NOT ASSIGN A CDevInfoList from one to another!!!!!
  29. class CDevInfoList
  30. {
  31. public:
  32. CDevInfoList(HDEVINFO hDevInfo = INVALID_HANDLE_VALUE, HWND hwndParent = NULL)
  33. :m_hDevInfo(hDevInfo), m_hwndParent(hwndParent)
  34. {
  35. }
  36. virtual ~CDevInfoList()
  37. {
  38. if (INVALID_HANDLE_VALUE != m_hDevInfo)
  39. DiDestroyDeviceInfoList();
  40. }
  41. operator HDEVINFO()
  42. {
  43. return m_hDevInfo;
  44. }
  45. BOOL DiGetDeviceInfoListDetail(PSP_DEVINFO_LIST_DETAIL_DATA DetailData)
  46. {
  47. return SetupDiGetDeviceInfoListDetail(m_hDevInfo, DetailData);
  48. }
  49. BOOL DiOpenDeviceInfo(LPCTSTR DeviceID, HWND hwndParent, DWORD OpenFlags,
  50. PSP_DEVINFO_DATA DevData)
  51. {
  52. return SetupDiOpenDeviceInfo(m_hDevInfo, DeviceID, hwndParent, OpenFlags,
  53. DevData);
  54. }
  55. BOOL DiEnumDeviceInfo(DWORD Index, PSP_DEVINFO_DATA DevData)
  56. {
  57. return SetupDiEnumDeviceInfo(m_hDevInfo, Index, DevData);
  58. }
  59. BOOL DiBuildDriverInfoList(PSP_DEVINFO_DATA DevData, DWORD DriverType)
  60. {
  61. return SetupDiBuildDriverInfoList(m_hDevInfo, DevData, DriverType);
  62. }
  63. BOOL DiEnumDriverInfo(PSP_DEVINFO_DATA DevData, DWORD DriverType, DWORD Index,
  64. PSP_DRVINFO_DATA DrvData)
  65. {
  66. return SetupDiEnumDriverInfo(m_hDevInfo, DevData, DriverType, Index, DrvData);
  67. }
  68. BOOL DiGetDriverInfoDetail(PSP_DEVINFO_DATA DevData, PSP_DRVINFO_DATA DrvData,
  69. PSP_DRVINFO_DETAIL_DATA DrvDetailData,
  70. DWORD DrvDetailDataSize,
  71. PDWORD RequiredSize)
  72. {
  73. return SetupDiGetDriverInfoDetail(m_hDevInfo, DevData, DrvData,
  74. DrvDetailData,
  75. DrvDetailDataSize,
  76. RequiredSize);
  77. }
  78. BOOL DiDestroyDriverInfoList(PSP_DEVINFO_DATA DevData, DWORD DriverType)
  79. {
  80. return SetupDiDestroyDriverInfoList(m_hDevInfo, DevData, DriverType);
  81. }
  82. BOOL DiCallClassInstaller(DI_FUNCTION InstallFunction, PSP_DEVINFO_DATA DevData)
  83. {
  84. return SetupDiCallClassInstaller(InstallFunction, m_hDevInfo, DevData);
  85. }
  86. BOOL DiRemoveDevice(PSP_DEVINFO_DATA DevData)
  87. {
  88. return SetupDiRemoveDevice(m_hDevInfo, DevData);
  89. }
  90. BOOL DiChangeState(PSP_DEVINFO_DATA DevData)
  91. {
  92. return SetupDiChangeState(m_hDevInfo, DevData);
  93. }
  94. HKEY DiOpenDevRegKey(PSP_DEVINFO_DATA DevData, DWORD Scope, DWORD HwProfile,
  95. DWORD KeyType, REGSAM samDesired)
  96. {
  97. return SetupDiOpenDevRegKey(m_hDevInfo, DevData, Scope, HwProfile,
  98. KeyType, samDesired);
  99. }
  100. BOOL DiGetDeviceRegistryProperty(PSP_DEVINFO_DATA DevData, DWORD Property,
  101. PDWORD PropertyDataType, PBYTE PropertyBuffer,
  102. DWORD PropertyBufferSize, PDWORD RequiredSize)
  103. {
  104. return SetupDiGetDeviceRegistryProperty(m_hDevInfo, DevData,
  105. Property, PropertyDataType,
  106. PropertyBuffer,
  107. PropertyBufferSize,
  108. RequiredSize
  109. );
  110. }
  111. BOOL DiGetDeviceInstallParams(PSP_DEVINFO_DATA DevData,
  112. PSP_DEVINSTALL_PARAMS DevInstParams)
  113. {
  114. return SetupDiGetDeviceInstallParams(m_hDevInfo, DevData, DevInstParams);
  115. }
  116. BOOL DiGetClassInstallParams(PSP_DEVINFO_DATA DevData,
  117. PSP_CLASSINSTALL_HEADER ClassInstallHeader,
  118. DWORD ClassInstallParamsSize,
  119. PDWORD RequiredSize)
  120. {
  121. return SetupDiGetClassInstallParams(m_hDevInfo, DevData,
  122. ClassInstallHeader,
  123. ClassInstallParamsSize,
  124. RequiredSize);
  125. }
  126. BOOL DiSetDeviceInstallParams(PSP_DEVINFO_DATA DevData,
  127. PSP_DEVINSTALL_PARAMS DevInstParams)
  128. {
  129. return SetupDiSetDeviceInstallParams(m_hDevInfo, DevData, DevInstParams);
  130. }
  131. BOOL DiSetClassInstallParams(PSP_DEVINFO_DATA DevData,
  132. PSP_CLASSINSTALL_HEADER ClassInstallHeader,
  133. DWORD ClassInstallParamsSize)
  134. {
  135. return SetupDiSetClassInstallParams(m_hDevInfo, DevData,
  136. ClassInstallHeader,
  137. ClassInstallParamsSize);
  138. }
  139. BOOL DiGetClassDevPropertySheet(PSP_DEVINFO_DATA DevData,
  140. LPPROPSHEETHEADER PropertySheetHeader,
  141. DWORD PagesAllowed,
  142. DWORD Flags)
  143. {
  144. return SetupDiGetClassDevPropertySheets(m_hDevInfo, DevData,
  145. PropertySheetHeader, PagesAllowed,
  146. NULL, Flags);
  147. }
  148. BOOL DiGetExtensionPropSheetPage(PSP_DEVINFO_DATA DevData,
  149. LPFNADDPROPSHEETPAGE pfnAddPropSheetPage,
  150. DWORD PageType,
  151. LPARAM lParam
  152. );
  153. BOOL DiGetSelectedDriver(PSP_DEVINFO_DATA DevData, PSP_DRVINFO_DATA DriverInfoData)
  154. {
  155. return SetupDiGetSelectedDriver(m_hDevInfo, DevData, DriverInfoData);
  156. }
  157. BOOL DiSetSelectedDriver(PSP_DEVINFO_DATA DevData, PSP_DRVINFO_DATA DriverInfoData)
  158. {
  159. return SetupDiSetSelectedDriver(m_hDevInfo, DevData, DriverInfoData);
  160. }
  161. BOOL DiEnumDeviceInterfaces(DWORD Index, LPGUID InterfaceGuid, PSP_DEVICE_INTERFACE_DATA InterfaceData)
  162. {
  163. return SetupDiEnumDeviceInterfaces(m_hDevInfo, NULL, InterfaceGuid, Index, InterfaceData);
  164. }
  165. BOOL DiGetInterfaceDetailData(PSP_DEVICE_INTERFACE_DATA pInterfaceData,
  166. PSP_DEVICE_INTERFACE_DETAIL_DATA pDetailData,
  167. DWORD Size, DWORD* pRequiredSize)
  168. {
  169. return SetupDiGetDeviceInterfaceDetail(m_hDevInfo, pInterfaceData,
  170. pDetailData, Size,
  171. pRequiredSize, NULL);
  172. }
  173. BOOL DiTurnOnDiFlags(PSP_DEVINFO_DATA DevData, DWORD FlagMask );
  174. BOOL DiTurnOffDiFlags(PSP_DEVINFO_DATA DevData, DWORD FlagsMask);
  175. BOOL DiTurnOnDiExFlags(PSP_DEVINFO_DATA DevData, DWORD FlagMask );
  176. BOOL DiTurnOffDiExFlags(PSP_DEVINFO_DATA DevData, DWORD FlagsMask);
  177. BOOL InstallDevInst(HWND hwndParent, LPCTSTR DeviceID, BOOL UpdateDriver, DWORD* pReboot);
  178. BOOL RollbackDriver(HWND hwndParent, LPCTSTR RegistryKeyName, DWORD Flags, DWORD* pReboot);
  179. DWORD DiGetFlags(PSP_DEVINFO_DATA DevData = NULL);
  180. DWORD DiGetExFlags(PSP_DEVINFO_DATA DevData = NULL);
  181. void DiDestroyDeviceInfoList();
  182. BOOL DiGetDeviceMFGString(PSP_DEVINFO_DATA DevData, String& str);
  183. BOOL DiGetDeviceMFGString(PSP_DEVINFO_DATA DevData, TCHAR* pBuffer, DWORD Size, DWORD* pRequiredSize = NULL);
  184. BOOL DiGetDeviceIDString(PSP_DEVINFO_DATA DevData, String& str);
  185. BOOL DiGetDeviceIDString(PSP_DEVINFO_DATA DevData, TCHAR* pBuffer, DWORD Size, DWORD* pRequiredSize = NULL);
  186. HWND OwnerWindow()
  187. {
  188. return m_hwndParent;
  189. }
  190. protected:
  191. HDEVINFO m_hDevInfo;
  192. HWND m_hwndParent;
  193. private:
  194. CDevInfoList(const CDevInfoList&);
  195. CDevInfoList& operator=(const CDevInfoList&);
  196. };
  197. class CMachine : public CDevInfoList
  198. {
  199. public:
  200. CMachine(LPCTSTR MachineName = NULL);
  201. virtual ~CMachine();
  202. operator HMACHINE()
  203. {
  204. return m_hMachine;
  205. }
  206. LPCTSTR GetMachineDisplayName()
  207. {
  208. return (LPCTSTR)m_strMachineDisplayName;
  209. }
  210. LPCTSTR GetMachineFullName()
  211. {
  212. return (LPCTSTR)m_strMachineFullName;
  213. }
  214. LPCTSTR GetRemoteMachineFullName()
  215. {
  216. return m_IsLocal ? NULL : (LPCTSTR)m_strMachineFullName;
  217. }
  218. HMACHINE GetHMachine()
  219. {
  220. return m_hMachine;
  221. }
  222. BOOL LoadStringWithMachineName(int StringId, LPTSTR Buffer, DWORD* BufferLen);
  223. BOOL IsLocal()
  224. {
  225. return m_IsLocal;
  226. }
  227. BOOL AttachFolder(CFolder* pFolder);
  228. void DetachFolder(CFolder* pFolder);
  229. BOOL IsFolderAttached(CFolder* pFolder);
  230. BOOL AttachPropertySheet(HWND hwndPropertySheet);
  231. void DetachPropertySheet(HWND hwndPropertySheet);
  232. HWND GetDeviceWindowHandle(LPCTSTR DeviceId);
  233. HWND GetClassWindowHandle(LPGUID ClassGuid);
  234. BOOL AttachChildMachine(CMachine* ChildMachine);
  235. void DetachChildMachine(CMachine* ChildMachine);
  236. BOOL EnuemerateDevice(int Index, CDevice** ppDevice);
  237. BOOL Initialize(
  238. HWND hwndParent = NULL,
  239. LPCTSTR DeviceId = NULL,
  240. LPGUID ClassGuid = NULL
  241. );
  242. DWORD GetNumberOfClasses() const
  243. {
  244. return m_listClass.GetCount();
  245. }
  246. DWORD GetNumberOfDevices() const
  247. {
  248. return (DWORD)m_listDevice.GetCount();
  249. }
  250. BOOL GetFirstClass(CClass** ppClass, PVOID& Context);
  251. BOOL GetNextClass(CClass** ppClass, PVOID& Context);
  252. BOOL GetFirstDevice(CDevice** ppDevice, PVOID& Context);
  253. BOOL GetNextDevice(CDevice** ppDevice, PVOID& Context);
  254. CDevice* DevNodeToDevice(DEVNODE dn);
  255. CDevice* DeviceIDToDevice(LPCTSTR DeviceID);
  256. CClass* ClassGuidToClass(LPGUID ClassGuid);
  257. BOOL Reenumerate();
  258. BOOL DoMiniRefresh();
  259. BOOL Refresh();
  260. int GetComputerIconIndex()
  261. {
  262. return m_ComputerIndex;
  263. }
  264. int GetResourceIconIndex()
  265. {
  266. return m_ResourceIndex;
  267. }
  268. BOOL ShouldPropertySheetDestroy()
  269. {
  270. return m_PropertySheetShoudDestroy;
  271. }
  272. void SetPropertySheetShouldDestroy()
  273. {
  274. m_PropertySheetShoudDestroy = TRUE;
  275. }
  276. BOOL GetDigitalSigner(LPTSTR FullInfPath, String& DigitalSigner);
  277. BOOL DoNotCreateDevice(SC_HANDLE SCMHandle, LPGUID ClassGuid, DEVINST DevInst);
  278. BOOL IsUserAGuest()
  279. {
  280. return m_UserIsAGuest;
  281. }
  282. HDEVINFO DiCreateDeviceInfoList(LPGUID ClassGuid, HWND hwndParent)
  283. {
  284. return SetupDiCreateDeviceInfoListEx(ClassGuid, hwndParent,
  285. GetRemoteMachineFullName(), NULL);
  286. }
  287. HDEVINFO DiCreateDeviceInterfaceList(LPGUID InterfaceGuid, LPCTSTR DeviceId, HWND hwndParent)
  288. {
  289. return SetupDiGetClassDevsEx(InterfaceGuid, DeviceId, m_hwndParent, DIGCF_DEVICEINTERFACE,
  290. NULL, GetRemoteMachineFullName(), NULL);
  291. }
  292. HDEVINFO DiGetClassDevs(LPGUID ClassGuid, LPCTSTR Enumerator, HWND hwndParent, DWORD Flags)
  293. {
  294. return SetupDiGetClassDevsEx(ClassGuid, Enumerator, hwndParent,
  295. Flags, NULL, GetRemoteMachineFullName(), NULL
  296. );
  297. }
  298. HIMAGELIST DiGetClassImageList()
  299. {
  300. return m_ImageListData.ImageList;
  301. }
  302. BOOL DiBuildClassInfoList(DWORD Flags, LPGUID ClassGuid,
  303. DWORD ClassGuidListSize, PDWORD RequiredSize)
  304. {
  305. return SetupDiBuildClassInfoListEx(Flags, ClassGuid,
  306. ClassGuidListSize, RequiredSize,
  307. GetRemoteMachineFullName(), NULL);
  308. }
  309. BOOL DiGetClassDescription(LPGUID ClassGuid, LPTSTR ClassDescription,
  310. DWORD ClassDescriptionSize, PDWORD RequiredSize)
  311. {
  312. return SetupDiGetClassDescriptionEx(ClassGuid, ClassDescription,
  313. ClassDescriptionSize,
  314. RequiredSize,
  315. GetRemoteMachineFullName(),
  316. NULL);
  317. }
  318. HKEY DiOpenClassRegKey(LPGUID ClassGuid, REGSAM samDesired, DWORD Flags)
  319. {
  320. return SetupDiOpenClassRegKeyEx(ClassGuid, samDesired, Flags,
  321. GetRemoteMachineFullName(), NULL);
  322. }
  323. BOOL DiGetHwProfileList(PDWORD HwProfileList, DWORD HwProfileListSize,
  324. PDWORD RequiredSize, PDWORD CurrentIndex)
  325. {
  326. return SetupDiGetHwProfileListEx(HwProfileList, HwProfileListSize,
  327. RequiredSize, CurrentIndex,
  328. GetRemoteMachineFullName(), NULL);
  329. }
  330. BOOL DiLoadClassIcon(LPGUID ClassGuid, HICON* LargeIcon, PINT MiniIconIndex)
  331. {
  332. return SetupDiLoadClassIcon(ClassGuid, LargeIcon, MiniIconIndex);
  333. }
  334. BOOL DiGetClassImageList(PSP_CLASSIMAGELIST_DATA pImageListData)
  335. {
  336. return SetupDiGetClassImageListEx(pImageListData,
  337. GetRemoteMachineFullName(), NULL);
  338. }
  339. BOOL DiDestroyClassImageList(PSP_CLASSIMAGELIST_DATA pImageListData)
  340. {
  341. return SetupDiDestroyClassImageList(pImageListData);
  342. }
  343. BOOL DiGetClassImageIndex(LPGUID ClassGuid, PINT ImageIndex)
  344. {
  345. return SetupDiGetClassImageIndex(&m_ImageListData, ClassGuid, ImageIndex);
  346. }
  347. int DiDrawMiniIcon(HDC hdc, RECT rc, int IconIndex, DWORD Flags)
  348. {
  349. return SetupDiDrawMiniIcon(hdc, rc, IconIndex, Flags);
  350. }
  351. BOOL DiClassNameFromGuid(LPGUID ClassGuid, LPTSTR ClassName,
  352. DWORD ClassNameSize, PDWORD RequiredSize)
  353. {
  354. return SetupDiClassNameFromGuidEx(ClassGuid, ClassName,
  355. ClassNameSize, RequiredSize,
  356. GetRemoteMachineFullName(), NULL);
  357. }
  358. BOOL DiGetHwProfileFriendlyName(DWORD HwProfile, LPTSTR FriendlyName,
  359. DWORD FriendlyNameSize,
  360. PDWORD RequiredSize)
  361. {
  362. return SetupDiGetHwProfileFriendlyNameEx(HwProfile, FriendlyName,
  363. FriendlyNameSize,
  364. RequiredSize,
  365. GetRemoteMachineFullName(),
  366. NULL);
  367. }
  368. BOOL DiGetClassFriendlyNameString(LPGUID Guid, String& strClass);
  369. BOOL DiDestroyDeviceInfoList(HDEVINFO hDevInfo)
  370. {
  371. return SetupDiDestroyDeviceInfoList(hDevInfo);
  372. }
  373. ///////////////////////////////////////////////////////////////////////////
  374. //// Configuration Manager APIs
  375. ////
  376. CONFIGRET GetLastCR()
  377. {
  378. return m_LastCR;
  379. }
  380. BOOL CmGetConfigFlags(DEVNODE dn, DWORD* pFlags);
  381. BOOL CmGetCapabilities(DEVNODE dn, DWORD* pCapabilities);
  382. BOOL CmGetDeviceIDString(DEVNODE dn, String& str);
  383. BOOL CmGetDescriptionString(DEVNODE dn, String& str);
  384. BOOL CmGetMFGString(DEVNODE dn, String& str);
  385. BOOL CmGetProviderString(DEVNODE dn, String& str);
  386. BOOL CmGetDriverDateString(DEVNODE dn, String& str);
  387. BOOL CmGetDriverDateData(DEVNODE dn, FILETIME *ft);
  388. BOOL CmGetDriverVersionString(DEVNODE dn, String& str);
  389. BOOL CmGetClassGuid(DEVNODE dn, GUID& Guid);
  390. BOOL CmGetHardwareIDs(DEVNODE dn, PVOID Buffer, ULONG* BufferLen);
  391. BOOL CmGetCompatibleIDs(DEVNODE dn, PVOID Buffer, ULONG* BufferLen);
  392. BOOL CmGetStatus(DEVNODE dn, DWORD* pProblem, DWORD* pStatus);
  393. BOOL CmGetKnownLogConf(DEVNODE dn, LOG_CONF* plc, DWORD* plcType);
  394. BOOL CmReenumerate(DEVNODE dn, ULONG Flags);
  395. BOOL CmGetHwProfileFlags(DEVNODE dn, ULONG Profile, ULONG* pFlags);
  396. BOOL CmGetHwProfileFlags(LPCTSTR DeviceID, ULONG Profile, ULONG* pFlags);
  397. BOOL CmSetHwProfileFlags(DEVNODE dn, ULONG Profile, ULONG Flags);
  398. BOOL CmSetHwProfileFlags(LPCTSTR DeviceID, ULONG Profile, ULONG Flags);
  399. BOOL CmGetCurrentHwProfile(ULONG* phwpf);
  400. BOOL CmGetHwProfileInfo(int Index, PHWPROFILEINFO pHwProfileInfo);
  401. BOOL CmGetBusGuid(DEVNODE dn, LPGUID Guid);
  402. BOOL CmGetBusGuidString(DEVNODE dn, String& str);
  403. DEVNODE CmGetParent(DEVNODE dn);
  404. DEVNODE CmGetChild(DEVNODE dn);
  405. DEVNODE CmGetSibling(DEVNODE dn);
  406. DEVNODE CmGetRootDevNode();
  407. BOOL CmHasResources(DEVNODE dn);
  408. BOOL CmHasDrivers(DEVNODE dn);
  409. DWORD CmGetResDesDataSize(RES_DES rd);
  410. BOOL CmGetResDesData(RES_DES rd, PVOID pData, ULONG DataSize);
  411. BOOL CmGetNextResDes(PRES_DES prdNext, RES_DES rd, RESOURCEID ForResource,
  412. PRESOURCEID pTheResource);
  413. void CmFreeResDesHandle(RES_DES rd);
  414. void CmFreeResDes(PRES_DES prdPrev, RES_DES rd);
  415. void CmFreeLogConfHandle(LOG_CONF lc);
  416. int CmGetNumberOfBasicLogConf(DEVNODE dn);
  417. BOOL CmGetFirstLogConf(DEVNODE dn, LOG_CONF* plc, ULONG Type);
  418. BOOL CmGetNextLogConf(LOG_CONF* plcNext, LOG_CONF lcRef, ULONG Type);
  419. ULONG CmGetArbitratorFreeDataSize(DEVNODE dn, RESOURCEID ResType);
  420. BOOL CmGetArbitratorFreeData(DEVNODE dn, PVOID pBuffer, ULONG BufferSize,
  421. RESOURCEID ResType);
  422. BOOL CmTestRangeAvailable(RANGE_LIST RangeList, DWORDLONG dlBase,
  423. DWORDLONG dlEnd);
  424. void CmDeleteRange(RANGE_LIST RangeList, DWORDLONG dlBase, DWORDLONG dlLen);
  425. BOOL CmGetFirstRange(RANGE_LIST RangeList, DWORDLONG* pdlBase,
  426. DWORDLONG* pdlLen, RANGE_ELEMENT* pre);
  427. BOOL CmGetNextRange(RANGE_ELEMENT* pre, DWORDLONG* pdlBase, DWORDLONG* pdlLen);
  428. void CmFreeRangeList(RANGE_LIST RangeList);
  429. BOOL CmGetDeviceIdListSize(LPCTSTR Fileter, ULONG* Size, ULONG Flags);
  430. BOOL CmGetDeviceIdList(LPCTSTR Filter, TCHAR* Buffer, ULONG BufferSize, ULONG Flags);
  431. CONFIGRET CmGetRegistryProperty(DEVNODE dn, ULONG Property,
  432. PVOID pBuffer,
  433. ULONG* BufferSize);
  434. BOOL EnableRefresh(BOOL fEnable);
  435. BOOL ScheduleRefresh();
  436. void Lock()
  437. {
  438. EnterCriticalSection(&m_CriticalSection);
  439. }
  440. void Unlock()
  441. {
  442. LeaveCriticalSection(&m_CriticalSection);
  443. }
  444. CComputer* m_pComputer;
  445. CMachine* m_ParentMachine;
  446. UINT m_msgRefresh;
  447. static DWORD WaitDialogThread(PVOID Parameter);
  448. private:
  449. // no copy constructor and no assigment operator
  450. CMachine(const CMachine& MachineSrc);
  451. CMachine& operator=(const CMachine& MachineSrc);
  452. BOOL BuildClassesFromGuidList(LPGUID GuidList, DWORD Guids);
  453. CONFIGRET CmGetRegistrySoftwareProperty(DEVNODE dn, LPCTSTR ValueName,
  454. PVOID pBuffer, ULONG* pBufferSize);
  455. void CreateDeviceTree(CDevice* pParent, CDevice* pSibling, DEVNODE dn);
  456. BOOL CreateClassesAndDevices(LPCTSTR DeviceId = NULL, LPGUID ClassGuid = NULL);
  457. void DestroyClassesAndDevices();
  458. BOOL CreateNotifyWindow();
  459. BOOL pGetOriginalInfName(LPTSTR InfName, String& OriginalInfName);
  460. String m_strMachineDisplayName;
  461. String m_strMachineFullName;
  462. HMACHINE m_hMachine;
  463. CONFIGRET m_LastCR;
  464. CList<CClass*, CClass*> m_listClass;
  465. SP_CLASSIMAGELIST_DATA m_ImageListData;
  466. int m_ComputerIndex;
  467. int m_ResourceIndex;
  468. CList<CDevice*, CDevice*> m_listDevice;
  469. DWORD m_Flags;
  470. BOOL m_Initialized;
  471. BOOL m_IsLocal;
  472. BOOL m_PropertySheetShoudDestroy;
  473. BOOL m_UserIsAGuest;
  474. HWND m_hwndNotify;
  475. CList<CFolder*, CFolder*> m_listFolders;
  476. int m_RefreshDisableCounter;
  477. BOOL m_RefreshPending;
  478. BOOL m_ShowNonPresentDevices;
  479. CRITICAL_SECTION m_CriticalSection;
  480. CRITICAL_SECTION m_PropertySheetCriticalSection;
  481. CRITICAL_SECTION m_ChildMachineCriticalSection;
  482. CList<HWND, HWND> m_listPropertySheets;
  483. CList<CMachine*, CMachine*> m_listChildMachines;
  484. };
  485. class CMachineList
  486. {
  487. public:
  488. CMachineList() {};
  489. ~CMachineList();
  490. BOOL CreateMachine(HWND hwndParent, LPCTSTR MachineName, CMachine** ppMachine);
  491. CMachine* FindMachine(LPCTSTR MachineName);
  492. private:
  493. CMachineList(const CMachineList& MachineListSrc);
  494. CMachineList& operator=(const CMachineList& MachineListSrc);
  495. CList<CMachine*, CMachine*> m_listMachines;
  496. };
  497. #endif //__MACHINE_H_