Source code of Windows XP (NT5)
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.

95 lines
3.2 KiB

  1. #ifndef _WRAPMB_
  2. #define _WRAPMB_
  3. #include "iadmw.h"
  4. //--------------------------------------------------------
  5. // startup & closeing utilities
  6. IMSAdminBase* FInitMetabaseWrapper( OLECHAR* pocMachineName );
  7. BOOL FCloseMetabaseWrapper( IMSAdminBase* pMBCom );
  8. //--------------------------------------------------------
  9. class CWrapMetaBase
  10. {
  11. public:
  12. WORD m_count;
  13. // construct - destruct
  14. CWrapMetaBase();
  15. ~CWrapMetaBase();
  16. // second stage initialization
  17. BOOL FInit( PVOID pMBCom );
  18. // open, close and save the object and such
  19. BOOL Open( LPCTSTR pszPath, DWORD dwFlags = METADATA_PERMISSION_READ );
  20. BOOL Open( METADATA_HANDLE hOpenRoot, LPCTSTR pszPath,
  21. DWORD dwFlags = METADATA_PERMISSION_READ );
  22. BOOL Close( void );
  23. BOOL Save( void );
  24. // enumerate the objects
  25. BOOL EnumObjects( LPCTSTR pszPath, LPTSTR Name, DWORD Index );
  26. // Add and delete objects
  27. BOOL AddObject( LPCTSTR pszPath );
  28. BOOL DeleteObject( LPCTSTR pszPath );
  29. // rename an object
  30. BOOL RenameObject( LPCTSTR pszPathOld, LPCTSTR pszNewName );
  31. // access the metahandle
  32. METADATA_HANDLE QueryHandle();
  33. // setting values
  34. BOOL SetDword( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwValue, DWORD dwFlags = METADATA_INHERIT );
  35. BOOL SetString( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, LPCTSTR dwValue, DWORD dwFlags = METADATA_INHERIT );
  36. BOOL SetData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwDataType,
  37. PVOID pData, DWORD cbData, DWORD dwFlags = METADATA_INHERIT );
  38. // getting values
  39. BOOL GetDword( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD* dwValue, DWORD dwFlags = METADATA_INHERIT );
  40. BOOL GetString( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, LPTSTR pszValue, DWORD* pcchValue,
  41. DWORD dwFlags = METADATA_INHERIT );
  42. BOOL GetData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwDataType,
  43. PVOID pData, DWORD* pcbData, DWORD dwFlags = METADATA_INHERIT );
  44. PVOID GetData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwDataType,
  45. DWORD* pcbData, DWORD dwFlags = METADATA_INHERIT );
  46. // deleting values
  47. BOOL DeleteData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwDataType );
  48. // free memory returned by GetData
  49. void FreeWrapData( PVOID pData );
  50. protected:
  51. // pointer to the real metabase object as defined in mb.hxx
  52. // by casting it PVOID, those files including this will not have to include mb.hxx, which
  53. // is the whole point of wrapping it like this.
  54. // PVOID m_pvMB;
  55. // pointer to the dcom interface it should use
  56. IMSAdminBase* m_pMetabase;
  57. // the open metabase handle
  58. METADATA_HANDLE m_hMeta;
  59. // size of the local buffer
  60. #define BUFFER_SIZE 2000
  61. // local buffer - allocated once, used many times
  62. PVOID m_pBuffer;
  63. DWORD m_cbBuffer;
  64. // path conversion utilities
  65. WCHAR* PrepPath( LPCTSTR psz );
  66. void UnprepPath();
  67. WCHAR* m_pPathBuffer;
  68. DWORD m_cchPathBuffer;
  69. };
  70. #endif //_WRAPMB_