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.

126 lines
2.8 KiB

  1. /*++
  2. Copyright (C) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. BackupRestore.H
  5. Abstract:
  6. Backup Restore Interface.
  7. History:
  8. --*/
  9. #ifndef __BACKUPRESTORE_H__
  10. #define __BACKUPRESTORE_H__
  11. #include "precomp.h"
  12. #include <statsync.h>
  13. interface IWmiDbController;
  14. class CWbemBackupRestore : IWbemBackupRestoreEx
  15. {
  16. public:
  17. enum CallerType
  18. {
  19. VssWriter = 'wssV',
  20. NtBackup = 'kcaB'
  21. };
  22. enum Traces
  23. {
  24. MaxTraceSize = 8
  25. };
  26. enum MethodTypes
  27. {
  28. mBackup = 1,
  29. mRestore = 2,
  30. mPause = 4,
  31. mResume = 8
  32. };
  33. protected:
  34. long m_cRef;
  35. TCHAR *m_pDbDir;
  36. TCHAR *m_pWorkDir;
  37. HINSTANCE m_hInstance;
  38. HANDLE m_hTimer;
  39. DWORD m_dwDueTime;
  40. // used by extended interface
  41. IWmiDbController* m_pController;
  42. LONG m_PauseCalled;
  43. LONG m_lResumeCalled;
  44. //instrumentation;
  45. LIST_ENTRY m_ListEntry;
  46. int m_Method;
  47. DWORD m_CallerId;
  48. PVOID m_Trace[MaxTraceSize];
  49. // statics for instrumentation
  50. static LIST_ENTRY s_ListHead;
  51. static CStaticCritSec s_CritSec;
  52. public:
  53. CWbemBackupRestore(HINSTANCE hInstance);
  54. virtual ~CWbemBackupRestore(void);
  55. //IUnknown members
  56. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv)
  57. {
  58. if (IID_IUnknown==riid ||
  59. IID_IWbemBackupRestore==riid ||
  60. IID_IWbemBackupRestoreEx==riid)
  61. {
  62. *ppv=this;
  63. }
  64. else
  65. {
  66. *ppv=NULL;
  67. return E_NOINTERFACE;
  68. }
  69. ((IUnknown*)(*ppv))->AddRef();
  70. return NOERROR;
  71. };
  72. STDMETHODIMP_(ULONG) AddRef(void)
  73. {
  74. return InterlockedIncrement(&m_cRef);
  75. };
  76. STDMETHODIMP_(ULONG) Release(void)
  77. {
  78. long lRef = InterlockedDecrement(&m_cRef);
  79. if (0L == lRef)
  80. delete this;
  81. return lRef;
  82. };
  83. HRESULT STDMETHODCALLTYPE Backup(
  84. LPCWSTR strBackupToFile,
  85. long lFlags);
  86. HRESULT STDMETHODCALLTYPE Restore(
  87. LPCWSTR strRestoreFromFile,
  88. long lFlags);
  89. void InitEmpty(){};
  90. TCHAR *GetDbDir();
  91. TCHAR *GetFullFilename(const TCHAR *pszFilename);
  92. TCHAR *GetExePath(const TCHAR *pszFilename);
  93. HRESULT GetDefaultRepDriverClsId(CLSID &clsid);
  94. // EXTENDED interface
  95. HRESULT STDMETHODCALLTYPE Pause();
  96. HRESULT STDMETHODCALLTYPE Resume();
  97. HRESULT pResume();
  98. static VOID CALLBACK TimeOutCallback(PVOID lpParameter, BOOLEAN TimerOrWaitFired);
  99. };
  100. #endif /*__BACKUPRESTORE_H__*/