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.

149 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Abstract:
  4. @doc
  5. @module sqlwriter.h | Declaration of the sql wrier
  6. @end
  7. Author:
  8. Brian Berkowitz [brianb] 04/17/2000
  9. TBD:
  10. Add comments.
  11. Revision History:
  12. Name Date Comments
  13. brianb 04/17/2000 created
  14. brianb 05/05/2000 added OnIdentify support
  15. mikejohn 09/18/2000 176860: Added calling convention methods where missing
  16. --*/
  17. ////////////////////////////////////////////////////////////////////////
  18. // Standard foo for file name aliasing. This code block must be after
  19. // all includes of VSS header files.
  20. //
  21. #ifdef VSS_FILE_ALIAS
  22. #undef VSS_FILE_ALIAS
  23. #endif
  24. #define VSS_FILE_ALIAS "INCSQLWH"
  25. //
  26. ////////////////////////////////////////////////////////////////////////
  27. #ifndef __SQLWRITER_H_
  28. #define __SQLWRITER_H_
  29. class CSqlWriter :
  30. public CVssWriter,
  31. public CCheckPath
  32. {
  33. public:
  34. STDMETHODCALLTYPE CSqlWriter() :
  35. m_pSqlSnapshot(NULL),
  36. m_pSqlRestore(NULL),
  37. m_fFrozen(false),
  38. m_bComponentsSelected(false),
  39. m_rgwszDatabases(NULL),
  40. m_rgwszInstances(NULL),
  41. m_cDatabases(0)
  42. {
  43. }
  44. STDMETHODCALLTYPE ~CSqlWriter()
  45. {
  46. delete m_pSqlSnapshot;
  47. delete m_pSqlRestore;
  48. if (m_rgwszDatabases)
  49. {
  50. for(UINT i = 0; i < m_cDatabases; i++)
  51. {
  52. delete m_rgwszDatabases[i];
  53. delete m_rgwszInstances[i];
  54. }
  55. delete m_rgwszDatabases;
  56. delete m_rgwszInstances;
  57. }
  58. }
  59. bool STDMETHODCALLTYPE OnIdentify(IVssCreateWriterMetadata *pMetadata);
  60. bool STDMETHODCALLTYPE OnPrepareBackup(IN IVssWriterComponents *pComponents);
  61. bool STDMETHODCALLTYPE OnPrepareSnapshot();
  62. bool STDMETHODCALLTYPE OnFreeze();
  63. bool STDMETHODCALLTYPE OnThaw();
  64. bool STDMETHODCALLTYPE OnAbort();
  65. bool STDMETHODCALLTYPE OnPostSnapshot(IVssWriterComponents *pMetadata);
  66. bool STDMETHODCALLTYPE OnPreRestore(IVssWriterComponents *pMetadata);
  67. bool STDMETHODCALLTYPE OnPostRestore(IVssWriterComponents *pMetadata);
  68. // CCheckPath methods
  69. bool IsComponentBased() throw();
  70. bool IsPathInSnapshot(const WCHAR *path) throw();
  71. LPCWSTR EnumerateSelectedDatabases(LPCWSTR wszInstanceName, UINT *pNextIndex) throw();
  72. HRESULT STDMETHODCALLTYPE Initialize();
  73. HRESULT STDMETHODCALLTYPE Uninitialize();
  74. private:
  75. CSqlSnapshot *m_pSqlSnapshot;
  76. // restore object
  77. CSqlRestore *m_pSqlRestore;
  78. // array of selected databases
  79. LPWSTR *m_rgwszDatabases;
  80. LPWSTR *m_rgwszInstances;
  81. UINT m_cDatabases;
  82. void TranslateWriterError(HRESULT hr);
  83. bool m_fFrozen;
  84. // are components selected for backup
  85. bool m_bComponentsSelected;
  86. };
  87. // wrapper class used to create and destroy the writer
  88. // used by coordinator
  89. class CVssSqlWriterWrapper
  90. {
  91. public:
  92. CVssSqlWriterWrapper();
  93. ~CVssSqlWriterWrapper();
  94. HRESULT CreateSqlWriter();
  95. void DestroySqlWriter();
  96. private:
  97. // initialization function
  98. static DWORD InitializeThreadFunc(VOID *pv);
  99. // snapshot object
  100. CSqlWriter *m_pSqlWriter;
  101. // result of initialization
  102. HRESULT m_hrInitialize;
  103. };
  104. #endif // _SQLWRITER_H_