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.

121 lines
2.6 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. Wsbdbkey.h
  5. Abstract:
  6. The CWsbDbKey class, which provides support for IDB entities.
  7. Author:
  8. Ron White [ronw] 23-Dec-1996
  9. Revision History:
  10. --*/
  11. #ifndef _WSBDBKEY_
  12. #define _WSBDBKEY_
  13. #include "resource.h"
  14. #include "wsbdb.h"
  15. /*++
  16. Class Name:
  17. CWsbDbKey
  18. Class Description:
  19. A data base key object.
  20. --*/
  21. class CWsbDbKey :
  22. public CWsbObject,
  23. public IWsbDbKey,
  24. public IWsbDbKeyPriv,
  25. public CComCoClass<CWsbDbKey,&CLSID_CWsbDbKey>
  26. {
  27. friend class CWsbDbEntity;
  28. public:
  29. CWsbDbKey() {}
  30. BEGIN_COM_MAP(CWsbDbKey)
  31. COM_INTERFACE_ENTRY(IWsbDbKey)
  32. COM_INTERFACE_ENTRY(IWsbDbKeyPriv)
  33. COM_INTERFACE_ENTRY(IWsbCollectable)
  34. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  35. COM_INTERFACE_ENTRY(IPersistStream)
  36. COM_INTERFACE_ENTRY(IWsbPersistStream)
  37. COM_INTERFACE_ENTRY(IWsbTestable)
  38. END_COM_MAP()
  39. DECLARE_REGISTRY_RESOURCEID(IDR_CWsbDbKey)
  40. // CComObjectRoot
  41. public:
  42. STDMETHOD(FinalConstruct)(void);
  43. void FinalRelease(void);
  44. // IPersist
  45. public:
  46. STDMETHOD(GetClassID)(LPCLSID pClsid);
  47. // IPersistStream
  48. public:
  49. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  50. STDMETHOD(Load)(IStream* pStream);
  51. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  52. // IWsbCollectable
  53. public:
  54. STDMETHOD(CompareTo)(IUnknown* pCollectable, SHORT* pResult);
  55. WSB_FROM_CWSBOBJECT;
  56. // IWsbDbKey
  57. public:
  58. STDMETHOD(AppendBool)(BOOL value);
  59. STDMETHOD(AppendBytes)(UCHAR* value, ULONG size);
  60. STDMETHOD(AppendFiletime)(FILETIME value);
  61. STDMETHOD(AppendGuid)(GUID value);
  62. STDMETHOD(AppendLonglong)(LONGLONG value);
  63. STDMETHOD(AppendString)(OLECHAR* value);
  64. STDMETHOD(GetType)(ULONG* pType);
  65. STDMETHOD(SetToBool)(BOOL value);
  66. STDMETHOD(SetToBytes)(UCHAR* value, ULONG size);
  67. STDMETHOD(SetToFiletime)(FILETIME value);
  68. STDMETHOD(SetToGuid)(GUID value);
  69. STDMETHOD(SetToLonglong)(LONGLONG value);
  70. STDMETHOD(SetToString)(OLECHAR* value);
  71. STDMETHOD(SetToUlong)(ULONG value);
  72. // IWsbTestable
  73. public:
  74. STDMETHOD(Test)(USHORT *passed, USHORT *failed);
  75. // Internal helper functions
  76. public:
  77. STDMETHOD(GetBytes)(UCHAR** ppBytes, ULONG* pSize);
  78. STDMETHOD(SetType)(ULONG type) {
  79. m_type = type; return(S_OK); }
  80. protected:
  81. BOOL make_key(ULONG size);
  82. protected:
  83. ULONG m_max; // Max size of m_value
  84. ULONG m_size; // Number of bytes in m_value being used
  85. UCHAR* m_value;
  86. ULONG m_type; // Key type
  87. };
  88. #endif // _WSBDBKEY_