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
2.7 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. * snapshot.h
  7. *
  8. * Abstract:
  9. * CSnapshot, CSnapshot class definitions
  10. *
  11. * Revision History:
  12. * Ashish Sikka (ashishs) 05/05/2000
  13. * created
  14. *
  15. *****************************************************************************/
  16. #ifndef _SNAPSHOT_H_
  17. #define _SNAPSHOT_H_
  18. typedef HRESULT (WINAPI *PF_REG_DB_API)(PWCHAR);
  19. typedef DWORD (WINAPI *PSNAPSHOTCALLBACK) (LPCWSTR);
  20. class CTokenPrivilege
  21. {
  22. public:
  23. DWORD SetPrivilegeInAccessToken(WCHAR * pszPrivilegeName);
  24. CTokenPrivilege ()
  25. {
  26. m_fNewToken = FALSE;
  27. }
  28. ~CTokenPrivilege ()
  29. {
  30. if (m_fNewToken)
  31. SetThreadToken (NULL, NULL); // remove impersonation token
  32. }
  33. private:
  34. BOOL m_fNewToken;
  35. };
  36. class CSnapshot
  37. {
  38. public:
  39. CSnapshot();
  40. ~CSnapshot();
  41. DWORD CreateSnapshot(WCHAR * pszRestoreDir, HMODULE hCOMDll, LPWSTR pszRpLast, BOOL fSerialized);
  42. // This function must be called to Initialize a restore
  43. // operation. This must be called before calling
  44. // GetSystemHivePath GetSoftwareHivePath
  45. DWORD InitRestoreSnapshot(WCHAR * pszRestoreDir);
  46. // Caller must reboot machine after calling this function
  47. DWORD RestoreSnapshot(WCHAR * pszRestoreDir);
  48. DWORD DeleteSnapshot(WCHAR * pszRestoreDir);
  49. // this returns the path of the system hive. The caller must pass
  50. // in a buffer with length of this buffer in dwNumChars
  51. DWORD GetSystemHivePath(WCHAR * pszRestoreDir,
  52. WCHAR * pszHivePath,
  53. DWORD dwNumChars);
  54. // this returns the path of the software hive. The caller must pass
  55. // in a buffer with length of this buffer in dwNumChars
  56. DWORD GetSoftwareHivePath(WCHAR * pszRestoreDir,
  57. WCHAR * pszHivePath,
  58. DWORD dwNumChars);
  59. DWORD GetSamHivePath (WCHAR * pszRestoreDir,
  60. WCHAR * pszHivePath,
  61. DWORD dwNumChars);
  62. // this function must be called after a restore operation to
  63. // cleanup files created by RegReplaceKey.
  64. DWORD CleanupAfterRestore(WCHAR * pszRestoreDir);
  65. private:
  66. HMODULE m_hRegdbDll ;
  67. PF_REG_DB_API m_pfnRegDbBackup;
  68. PF_REG_DB_API m_pfnRegDbRestore;
  69. DWORD DoCOMDbSnapshot(WCHAR * pszSnapshotDir, HMODULE hCOMDll);
  70. DWORD DoRegistrySnapshot(WCHAR * pszSnapshotDir);
  71. DWORD RestoreRegistrySnapshot(WCHAR * pszSnapShotDir);
  72. DWORD RestoreCOMDbSnapshot(WCHAR * pszSnapShotDir);
  73. DWORD GetCOMplusBackupFN(HMODULE hCOMDll);
  74. DWORD GetCOMplusRestoreFN();
  75. };
  76. #endif // _SNAPSHOT_H_