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.

110 lines
2.9 KiB

  1. #ifndef _metabase_h_
  2. #define _metabase_h_
  3. #define MAX_METABASE_PATH 1024
  4. #define METABASE_TIMEOUT 5000
  5. // declare a synch object for write access of metabase
  6. class CSynchObject
  7. {
  8. private:
  9. CRITICAL_SECTION m_cs;
  10. public:
  11. CSynchObject()
  12. {
  13. // Initialize the critical section
  14. InitializeCriticalSection(&m_cs);
  15. }
  16. ~CSynchObject()
  17. {
  18. // Release resources used by the critical section object
  19. DeleteCriticalSection(&m_cs);
  20. }
  21. void Enter()
  22. {
  23. // wait for and take ownership of the critical section object
  24. EnterCriticalSection(&m_cs);
  25. }
  26. void Leave()
  27. {
  28. // Release ownership of the critical section object
  29. LeaveCriticalSection(&m_cs);
  30. }
  31. };
  32. class CMetabase
  33. {
  34. private:
  35. IMSAdminBase* m_pIABase;
  36. void CreateMultiSzFromSafeArray(_variant_t&, WCHAR**,DWORD*);
  37. void LoadSafeArrayFromMultiSz(WCHAR*, _variant_t&);
  38. bool CheckKeyType(enum_KEY_TYPE&, LPCWSTR);
  39. bool CompareMultiSz(WCHAR* a_pmsz1, WCHAR* a_pmsz2);
  40. public:
  41. CMetabase();
  42. ~CMetabase();
  43. HRESULT Backup(LPCWSTR, DWORD, DWORD);
  44. HRESULT DeleteBackup(LPCWSTR, DWORD);
  45. HRESULT EnumBackups(LPWSTR, DWORD*, PFILETIME, DWORD);
  46. HRESULT Restore(LPCWSTR, DWORD, DWORD);
  47. void CloseKey(METADATA_HANDLE);
  48. METADATA_HANDLE OpenKey(LPCWSTR, BOOL);
  49. METADATA_HANDLE CreateKey(LPCWSTR);
  50. bool CheckKey(LPCWSTR);
  51. HRESULT DeleteKey(METADATA_HANDLE, LPCWSTR);
  52. void GetDword(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&);
  53. void GetString(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&);
  54. void GetMultiSz(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&);
  55. long GetWin32Error(METADATA_HANDLE);
  56. void PutDword(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&, _variant_t*, bool=false);
  57. void PutString(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&, _variant_t*, bool=false);
  58. void PutMultiSz(METADATA_HANDLE, METABASE_PROPERTY*, _variant_t&, _variant_t*, bool=false);
  59. void PutMethod(METADATA_HANDLE, DWORD);
  60. void DeleteData(METADATA_HANDLE, METABASE_PROPERTY*);
  61. void DeleteData(METADATA_HANDLE, DWORD, DWORD);
  62. HRESULT EnumKeys(METADATA_HANDLE, LPCWSTR, LPWSTR, DWORD*, enum_KEY_TYPE&);
  63. HRESULT WebAppCheck(METADATA_HANDLE);
  64. HRESULT WebAppGetStatus(METADATA_HANDLE, PDWORD);
  65. HRESULT WebAppSetStatus(METADATA_HANDLE, DWORD);
  66. };
  67. class CWebAppMethod
  68. {
  69. private:
  70. IWamAdmin2* m_pWamAdmin;
  71. public:
  72. CWebAppMethod();
  73. ~CWebAppMethod();
  74. HRESULT AppCreate(LPCWSTR, bool);
  75. HRESULT AppCreate2(LPCWSTR, long);
  76. HRESULT AppDelete(LPCWSTR, bool);
  77. HRESULT AppUnLoad(LPCWSTR, bool);
  78. HRESULT AppDisable(LPCWSTR, bool);
  79. HRESULT AppEnable(LPCWSTR, bool);
  80. HRESULT AppGetStatus(LPCWSTR, DWORD*);
  81. HRESULT AspAppRestart(LPCWSTR);
  82. };
  83. #endif