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.

116 lines
3.0 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. Wsbdbsys.h
  5. Abstract:
  6. The CWsbDbSys class.
  7. Author:
  8. Ron White [ronw] 7-May-1997
  9. Revision History:
  10. --*/
  11. #ifndef _WSBDBSYS_
  12. #define _WSBDBSYS_
  13. #include "wsbdb.h"
  14. #include "wsbdbses.h"
  15. #include "resource.h"
  16. #define IDB_DB_FILE_SUFFIX L"jet"
  17. // Default no. of Jet sessions per process is currently 128 which may not be enough for HSM
  18. #define IDB_MAX_NOF_SESSIONS 32
  19. /*++
  20. Class Name:
  21. CWsbDbSys
  22. Class Description:
  23. The IDB system object. One must be created for each process
  24. that wants to use the IDB system. The Init method needs to be
  25. called after the object is created.
  26. --*/
  27. class CWsbDbSys :
  28. public IWsbDbSys,
  29. public IWsbDbSysPriv,
  30. public CComObjectRoot,
  31. public CComCoClass<CWsbDbSys,&CLSID_CWsbDbSys>
  32. {
  33. friend class CWsbDb;
  34. friend class CWsbDbSes;
  35. public:
  36. CWsbDbSys() {}
  37. BEGIN_COM_MAP( CWsbDbSys )
  38. COM_INTERFACE_ENTRY( IWsbDbSys )
  39. COM_INTERFACE_ENTRY( IWsbDbSysPriv )
  40. END_COM_MAP( )
  41. DECLARE_REGISTRY_RESOURCEID( IDR_CWsbDbSys )
  42. // CComObjectRoot
  43. public:
  44. STDMETHOD(FinalConstruct)(void);
  45. void FinalRelease(void);
  46. // IWsbDbSys
  47. public:
  48. STDMETHOD(Backup)(OLECHAR* path, ULONG flags);
  49. STDMETHOD(Init)(OLECHAR* path, ULONG flags);
  50. STDMETHOD(Terminate)(void);
  51. STDMETHOD(NewSession)(IWsbDbSession** ppSession);
  52. STDMETHOD(GetGlobalSession)(IWsbDbSession** ppSession);
  53. STDMETHOD(Restore)(OLECHAR* fromPath, OLECHAR* toPath);
  54. STDMETHOD(IncrementChangeCount)(void);
  55. // IWsbDbSysPriv
  56. public:
  57. STDMETHOD(DbAttachedAdd)(OLECHAR* name, BOOL attach);
  58. STDMETHOD(DbAttachedEmptySlot)(void);
  59. STDMETHOD(DbAttachedInit)(void);
  60. STDMETHOD(DbAttachedRemove)(OLECHAR* name);
  61. // Internal
  62. STDMETHOD(AutoBackup)(void);
  63. // Data
  64. private:
  65. HANDLE m_AutoThread;
  66. CWsbStringPtr m_BackupPath; // File path for backup directory
  67. CWsbStringPtr m_InitPath; // File path from Init() call
  68. LONG m_ChangeCount; // Count of DB changes since last backup
  69. FILETIME m_LastChange; // Time of last DB change
  70. CComPtr<IWsbDbSession> m_pWsbDbSession; // A global Jet session for this Jet instance
  71. HANDLE m_BackupEvent; // An event to sync Jet backups
  72. HANDLE m_terminateEvent; // An event for signaling termination to the auto-backup thread
  73. BOOL m_bLogErrors; // Whether to log errors or not
  74. BOOL m_jet_initialized;
  75. JET_INSTANCE m_jet_instance;
  76. };
  77. HRESULT wsb_db_jet_check_error(LONG jstat, char *fileName, DWORD lineNo);
  78. HRESULT wsb_db_jet_fix_path(OLECHAR* path, OLECHAR* ext, char** new_path);
  79. // Capture FILE/LINE info on a JET error
  80. #define jet_error(_jstat) \
  81. wsb_db_jet_check_error(_jstat, __FILE__, __LINE__)
  82. #endif // _WSBDBSYS_