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.

89 lines
3.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ObjectManager.h
  7. //
  8. // Description:
  9. // Data Manager implementation.
  10. //
  11. // Maintained By:
  12. // Galen Barbee (GalenB) 22-NOV-1999
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #pragma once
  16. class CStandardInfo;
  17. // CObjectManager
  18. class CObjectManager
  19. : public IObjectManager
  20. {
  21. private:
  22. // IUnknown
  23. LONG m_cRef;
  24. // data
  25. ULONG m_cAllocSize; // Size of the cookie array.
  26. ULONG m_cCurrentUsed; // Current count used in the cookie array.
  27. CStandardInfo ** m_pCookies; // Cookie array (note: zero-th element is not used)
  28. CCriticalSection m_csInstanceGuard; // Spin lock to restrict access to one thread at a time.
  29. private: // Methods
  30. CObjectManager( void );
  31. ~CObjectManager( void );
  32. STDMETHOD( HrInit )( void );
  33. // Private copy constructor to prevent copying.
  34. CObjectManager( const CObjectManager & );
  35. // Private assignment operator to prevent copying.
  36. CObjectManager & operator=( const CObjectManager & );
  37. HRESULT
  38. HrSearchForExistingCookie( REFCLSID rclsidTypeIn,
  39. OBJECTCOOKIE cookieParentIn,
  40. LPCWSTR pcszNameIn,
  41. OBJECTCOOKIE * pcookieOut
  42. );
  43. HRESULT HrDeleteCookie( OBJECTCOOKIE cookieIn );
  44. HRESULT HrDeleteInstanceAndChildren( OBJECTCOOKIE cookieIn );
  45. HRESULT
  46. HrCreateNewCookie( REFCLSID rclsidTypeIn,
  47. OBJECTCOOKIE cookieParentIn,
  48. LPCWSTR pcszNameIn,
  49. OBJECTCOOKIE * pcookieOut
  50. );
  51. public: // Methods
  52. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  53. //
  54. // IUnknown
  55. //
  56. STDMETHOD( QueryInterface )( REFIID riidIn, LPVOID * ppvOut );
  57. STDMETHOD_( ULONG, AddRef )( void );
  58. STDMETHOD_( ULONG, Release )( void );
  59. //
  60. // IObjectManager
  61. //
  62. STDMETHOD( FindObject )( REFCLSID rclsidTypeIn,
  63. OBJECTCOOKIE cookieParent,
  64. LPCWSTR pcszNameIn,
  65. REFCLSID rclsidFormatIn,
  66. OBJECTCOOKIE * pcookieOut,
  67. LPUNKNOWN * ppunkOut
  68. );
  69. STDMETHOD( GetObject )( REFCLSID rclsidFormatIn,
  70. OBJECTCOOKIE cookieIn,
  71. LPUNKNOWN * ppunkOut
  72. );
  73. STDMETHOD( RemoveObject )( OBJECTCOOKIE cookieIn );
  74. STDMETHOD( SetObjectStatus )( OBJECTCOOKIE cookieIn,
  75. HRESULT hrIn
  76. );
  77. }; //*** class CObjectManager