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.

97 lines
3.3 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 GetMultiSZString( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, LPTSTR pszValue, DWORD* pcchValue,
  43. DWORD dwFlags = METADATA_INHERIT );
  44. BOOL GetData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwDataType,
  45. PVOID pData, DWORD* pcbData, DWORD dwFlags = METADATA_INHERIT );
  46. PVOID GetData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwUserType, DWORD dwDataType,
  47. DWORD* pcbData, DWORD dwFlags = METADATA_INHERIT );
  48. // deleting values
  49. BOOL DeleteData( LPCTSTR pszPath, DWORD dwPropID, DWORD dwDataType );
  50. // free memory returned by GetData
  51. void FreeWrapData( PVOID pData );
  52. protected:
  53. // pointer to the real metabase object as defined in mb.hxx
  54. // by casting it PVOID, those files including this will not have to include mb.hxx, which
  55. // is the whole point of wrapping it like this.
  56. // PVOID m_pvMB;
  57. // pointer to the dcom interface it should use
  58. IMSAdminBase* m_pMetabase;
  59. // the open metabase handle
  60. METADATA_HANDLE m_hMeta;
  61. // size of the local buffer
  62. #define BUFFER_SIZE 2000
  63. // local buffer - allocated once, used many times
  64. PVOID m_pBuffer;
  65. DWORD m_cbBuffer;
  66. // path conversion utilities
  67. WCHAR* PrepPath( LPCTSTR psz );
  68. void UnprepPath();
  69. WCHAR* m_pPathBuffer;
  70. DWORD m_cchPathBuffer;
  71. };
  72. #endif //_WRAPMB_