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.

140 lines
4.5 KiB

  1. //=================================================================
  2. //
  3. // ConfgMgr.h
  4. //
  5. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #pragma once
  9. #include <chstring.h>
  10. #include <chptrarr.h>
  11. #include "refptr.h"
  12. #include "poormansresource.h"
  13. //#include <cfgmgrdevice.h>
  14. #include "resourcedesc.h"
  15. #include "cfgmgrdevice.h"
  16. #include "irqdesc.h"
  17. #include "dmadesc.h"
  18. #include "devdesc.h"
  19. #include "configmgrapi.h"
  20. #define CFGMGR_WORRY_SIZE 250
  21. typedef std::map<CHString, _GUID> STRING2GUID;
  22. typedef struct _IO_INFO{
  23. DWORD StartingAddress;
  24. DWORD EndingAddress;
  25. DWORD Alias;
  26. DWORD Decode;
  27. CHString OwnerName;
  28. CHString DeviceType;
  29. } IO_INFO;
  30. typedef struct _DMA_INFO{
  31. DWORD Channel;
  32. DWORD ChannelWidth;
  33. CHString OwnerDeviceId;
  34. CHString OwnerName;
  35. DWORD OEMNumber;
  36. CHString DeviceType;
  37. DWORD Port;
  38. } DMA_INFO;
  39. typedef struct _IRQ_INFO{
  40. BOOL Shareable;
  41. DWORD IRQNumber;
  42. CHString OwnerDeviceId;
  43. CHString OwnerName;
  44. DWORD OEMNumber;
  45. CHString DeviceType;
  46. DWORD Vector;
  47. } IRQ_INFO;
  48. typedef struct _MEM_INFO{
  49. DWORD StartingAddress;
  50. DWORD EndingAddress;
  51. CHString OwnerName;
  52. CHString DeviceType;
  53. CHString MemoryType;
  54. } MEM_INFO;
  55. class CConfigManager
  56. {
  57. public:
  58. // The Type to get parameter should be discarded whenever we get a chance.
  59. CConfigManager( DWORD dwTypeToGet = ResType_All );
  60. ~CConfigManager() { ResetList();}
  61. //////////////////////////////////////////////////////////////////
  62. // The following functions are LEGACY! Phase these out ASAP! //
  63. // DO NOT USE! //
  64. //////////////////////////////////////////////////////////////////
  65. BOOL BuildListsForThisDevice(CConfigMgrDevice *pDevice);
  66. BOOL RefreshList();
  67. inline IRQ_INFO * GetIRQ(int i) { return(( IRQ_INFO * ) m_List.GetAt(i));}
  68. inline DMA_INFO * GetDMA(int i) { return(( DMA_INFO * ) m_List.GetAt(i));}
  69. inline IO_INFO * GetIO(int i) { return(( IO_INFO * ) m_List.GetAt(i));}
  70. inline MEM_INFO * GetMem(int i) { return(( MEM_INFO * ) m_List.GetAt(i));}
  71. inline int GetTotal() { return m_List.GetSize(); }
  72. //////////////////////////////
  73. // End Legacy functions //
  74. //////////////////////////////
  75. BOOL GetDeviceList( CDeviceCollection& deviceList, LPCWSTR pszFilter = NULL, ULONG ulProperty = CM_DRP_MAX );
  76. BOOL LocateDevice( LPCWSTR pszDeviceID, CConfigMgrDevicePtr & pCfgMgrDevice );
  77. // Device List Helper functions
  78. BOOL GetDeviceListFilterByClass( CDeviceCollection& deviceList, LPCWSTR pszFilter );
  79. BOOL GetDeviceListFilterByService( CDeviceCollection& deviceList, LPCWSTR pszFilter );
  80. BOOL GetDeviceListFilterByDriver( CDeviceCollection& deviceList, LPCWSTR pszFilter );
  81. BOOL GetDeviceListFilterByClassGUID( CDeviceCollection& deviceList, LPCWSTR pszFilter );
  82. static STRING2GUID s_ClassMap;
  83. private:
  84. // Legacy function
  85. void ResetList();
  86. static BOOL s_ClassIsValid;
  87. DWORD GetIRQVector(PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor, DWORD dwCount, DWORD dwIRQNum);
  88. LPCWSTR GetMemoryType(PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor, DWORD dwCount, ULONGLONG ulStartAddress);
  89. DWORD GetDMAPort(PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor, DWORD dwCount, DWORD dwChannel);
  90. BOOL WalkDeviceTree( DEVNODE dn, CDeviceCollection& deviceList, LPCWSTR pszFilter, ULONG ulFilterProperty, CConfigMgrAPI *a_pconfigmgr );
  91. BOOL WalkDeviceTree2( DEVNODE dn, CDeviceCollection& deviceList, CConfigMgrAPI *a_pconfigmgr ) ;
  92. // Legacy variables
  93. CHPtrArray m_List;
  94. DWORD m_dwTypeToGet;
  95. BOOL CheckForLoop(CDeviceCollection& deviceList, CConfigMgrDevice* pDevice);
  96. };
  97. // Device List Helper functions
  98. inline BOOL CConfigManager::GetDeviceListFilterByService( CDeviceCollection& deviceList, LPCWSTR pszFilter )
  99. {
  100. return GetDeviceList( deviceList, pszFilter, CM_DRP_SERVICE );
  101. }
  102. inline BOOL CConfigManager::GetDeviceListFilterByDriver( CDeviceCollection& deviceList, LPCWSTR pszFilter )
  103. {
  104. return GetDeviceList( deviceList, pszFilter, CM_DRP_DRIVER );
  105. }
  106. inline BOOL CConfigManager::GetDeviceListFilterByClassGUID( CDeviceCollection& deviceList, LPCWSTR pszFilter )
  107. {
  108. return GetDeviceList( deviceList, pszFilter, CM_DRP_CLASSGUID );
  109. }