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.

135 lines
4.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // dsobject.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class DBObject.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/20/1998 Original version.
  16. // 10/02/1998 Allow rename through PutValue.
  17. // 04/13/2000 Port to ATL 3.0
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #ifndef _DSOBJECT_H_
  21. #define _DSOBJECT_H_
  22. #include <dsproperty.h>
  23. #include <dstorex.h>
  24. #include <propbag.h>
  25. //////////
  26. // 'Secret' UUID used to cast an interface to the implementing DBObject.
  27. //////////
  28. class __declspec(uuid("7677647C-AA27-11D1-BB27-00C04FC2E20D")) DBObject;
  29. ///////////////////////////////////////////////////////////////////////////////
  30. //
  31. // CLASS
  32. //
  33. // DBObject
  34. //
  35. // DESCRIPTION
  36. //
  37. // This class implements an object in an OLE-DB database. All objects
  38. // are also containers.
  39. //
  40. ///////////////////////////////////////////////////////////////////////////////
  41. class DBObject
  42. : public CComObjectRootEx< CComMultiThreadModel >,
  43. public IDispatchImpl< IDataStoreObjectEx,
  44. &__uuidof(IDataStoreObject),
  45. &__uuidof(DataStore2Lib) >,
  46. public IDispatchImpl< IDataStoreContainerEx,
  47. &__uuidof(IDataStoreContainer),
  48. &__uuidof(DataStore2Lib) >
  49. {
  50. public:
  51. DECLARE_NO_REGISTRY()
  52. BEGIN_COM_MAP(DBObject)
  53. COM_INTERFACE_ENTRY_IID(__uuidof(DBObject), DBObject)
  54. COM_INTERFACE_ENTRY_IID(__uuidof(IDataStoreObject), IDataStoreObject)
  55. COM_INTERFACE_ENTRY_IID(__uuidof(IDataStoreContainer), IDataStoreContainer)
  56. COM_INTERFACE_ENTRY2(IDispatch, IDataStoreObject)
  57. END_COM_MAP()
  58. // Create a new DBObject
  59. static DBObject* createInstance(
  60. OleDBDataStore* owner,
  61. IDataStoreContainer* container,
  62. ULONG uniqueID,
  63. PCWSTR relativeName
  64. );
  65. // Create a child DBObject.
  66. IDataStoreObject* spawn(ULONG childID, BSTR childName);
  67. //////////
  68. // IDataStoreObject
  69. //////////
  70. STDMETHOD(get_Name)(/*[out, retval]*/ BSTR* pVal);
  71. STDMETHOD(get_Class)(/*[out, retval]*/ BSTR* pVal);
  72. STDMETHOD(get_GUID)(/*[out, retval]*/ BSTR* pVal);
  73. STDMETHOD(get_Container)(/*[out, retval]*/ IDataStoreContainer** pVal);
  74. STDMETHOD(GetValue)(/*[in]*/ BSTR bstrName, /*[out, retval]*/ VARIANT* pVal);
  75. STDMETHOD(GetValueEx)(/*[in]*/ BSTR bstrName,
  76. /*[out, retval]*/ VARIANT* pVal);
  77. STDMETHOD(PutValue)(/*[in]*/ BSTR bstrName, /*[in]*/ VARIANT* pVal);
  78. STDMETHOD(Update)();
  79. STDMETHOD(Restore)();
  80. STDMETHOD(Item)(BSTR bstrName, IDataStoreProperty** pVal);
  81. //////////
  82. // IDataStoreObjectEx
  83. //////////
  84. STDMETHOD(get_PropertyCount)(long* pVal);
  85. STDMETHOD(get_NewPropertyEnum)(IUnknown** pVal);
  86. //////////
  87. // IDataStoreContainer
  88. //////////
  89. STDMETHOD(Item)(/*[in]*/ BSTR bstrName,
  90. /*[out, retval]*/ IDataStoreObject** ppObject);
  91. STDMETHOD(Create)(/*[in]*/ BSTR bstrClass,
  92. /*[in]*/ BSTR bstrName,
  93. /*[out, retval]*/ IDataStoreObject** ppObject);
  94. STDMETHOD(MoveHere)(/*[in]*/ IDataStoreObject* pObject,
  95. /*[in]*/ BSTR bstrNewName);
  96. STDMETHOD(Remove)(/*[in]*/ BSTR bstrClass, /*[in]*/ BSTR bstrName);
  97. //////////
  98. // IDataStoreContainerEx
  99. //////////
  100. STDMETHOD(get_ChildCount)(/*[out, retval]*/ long *pVal);
  101. STDMETHOD(get_NewChildEnum)(/*[out, retval]*/ IUnknown** pVal);
  102. protected:
  103. // Initialize a newly allocated DBObject. Used by createInstance.
  104. void initialize(
  105. OleDBDataStore* owner,
  106. IDataStoreContainer* container,
  107. ULONG uniqueID,
  108. PCWSTR relativeName
  109. );
  110. // Narrows a COM Interface to the implementing DBObject.
  111. static DBObject* narrow(IUnknown* p);
  112. CComPtr<OleDBDataStore> store; // DataStore where this object lives.
  113. CComPtr<IDataStoreContainer> parent; // Parent container.
  114. ULONG identity; // Unique identity.
  115. _bstr_t name; // Relative name of this object.
  116. bool nameDirty; // true if the object has been renamed.
  117. PropertyBag properties; // Bag of associated properties.
  118. };
  119. #endif // _DSOBJECT_H_