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.

105 lines
2.8 KiB

  1. /////////////////////////////////////////////////////////////////////////
  2. //
  3. // resourcedesc.h
  4. //
  5. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. // History: 10/15/97 Sanj Created by Sanj
  8. // 10/17/97 jennymc Moved things a tiny bit
  9. //
  10. /////////////////////////////////////////////////////////////////////////
  11. #ifndef __RESOURCEDESC_H__
  12. #define __RESOURCEDESC_H__
  13. #include "refptr.h"
  14. #include "refptrlite.h"
  15. #define ResType_DeviceMgr_Ignored_Bit 0x00000040 // Don't know the exact reason for this but Device manager ignores them, so we will also ignore.
  16. // Forward Class Definitions
  17. class CConfigMgrDevice;
  18. class
  19. __declspec(uuid("CD545F0E-D350-11d2-B35E-00104BC97924"))
  20. CResourceDescriptor : public CRefPtrLite
  21. {
  22. public:
  23. // Construction/Destruction
  24. CResourceDescriptor( PPOORMAN_RESDESC_HDR pResDescHdr, CConfigMgrDevice* pDevice );
  25. CResourceDescriptor( DWORD dwResourceId, LPVOID pResource, DWORD dwResourceSize, CConfigMgrDevice* pOwnerDevice );\
  26. CResourceDescriptor( const CResourceDescriptor& resource );
  27. ~CResourceDescriptor();
  28. // Must be overridden by derived class, since we will only know
  29. // about the resource header. From there, we assume that a class
  30. // derived off of us knows what to do with the remainder (if any)
  31. // of the data.
  32. virtual void * GetResource();
  33. BOOL GetOwnerDeviceID( CHString& str );
  34. BOOL GetOwnerHardwareKey( CHString& str );
  35. BOOL GetOwnerName( CHString& str );
  36. CConfigMgrDevice* GetOwner( void );
  37. DWORD GetOEMNumber( void );
  38. DWORD GetResourceType( void );
  39. BOOL IsIgnored( void );
  40. protected:
  41. BYTE* m_pbResourceDescriptor;
  42. DWORD m_dwResourceSize;
  43. private:
  44. DWORD m_dwResourceId;
  45. CConfigMgrDevice* m_pOwnerDevice;
  46. };
  47. _COM_SMARTPTR_TYPEDEF(CResourceDescriptor, __uuidof(CResourceDescriptor));
  48. inline DWORD CResourceDescriptor::GetOEMNumber( void )
  49. {
  50. return ( m_dwResourceId & OEM_NUMBER_MASK );
  51. }
  52. inline DWORD CResourceDescriptor::GetResourceType( void )
  53. {
  54. return ( m_dwResourceId & RESOURCE_TYPE_MASK );
  55. }
  56. inline BOOL CResourceDescriptor::IsIgnored( void )
  57. {
  58. return ( (m_dwResourceId & ResType_Ignored_Bit) || (m_dwResourceId & ResType_DeviceMgr_Ignored_Bit) );
  59. }
  60. // A collection of Resource Descriptors
  61. class CResourceCollection : public TRefPtr<CResourceDescriptor>
  62. {
  63. public:
  64. // Construction/Destruction
  65. CResourceCollection();
  66. ~CResourceCollection();
  67. // Because we're inheriting, we need to declare this here
  68. // (= operator is not inherited).
  69. const CResourceCollection& operator = ( const CResourceCollection& srcCollection );
  70. };
  71. inline const CResourceCollection& CResourceCollection::operator = ( const CResourceCollection& srcCollection )
  72. {
  73. // Call into the templated function
  74. Copy( srcCollection );
  75. return *this;
  76. }
  77. #endif