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.

79 lines
1.9 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. * rplog.cpp
  7. *
  8. * Abstract:
  9. * Tool for enumerating the restore points - forward/reverse
  10. *
  11. * Revision History:
  12. * Brijesh Krishnaswami (brijeshk) 04/13/2000
  13. * created
  14. *
  15. *****************************************************************************/
  16. #include <windows.h>
  17. #include <shellapi.h>
  18. #include "enumlogs.h"
  19. #include <dbgtrace.h>
  20. void __cdecl
  21. main()
  22. {
  23. LPWSTR * argv = NULL;
  24. int argc;
  25. HGLOBAL hMem = NULL;
  26. BOOL fForward = TRUE;
  27. InitAsyncTrace();
  28. argv = CommandLineToArgvW(GetCommandLine(), &argc);
  29. if (! argv)
  30. {
  31. printf("Error parsing arguments");
  32. exit(1);
  33. }
  34. if (argc < 2)
  35. {
  36. printf("Usage: rplog <driveletter> [forward=1/0]");
  37. exit(1);
  38. }
  39. if (argc == 3)
  40. fForward = _wtoi(argv[2]);
  41. CRestorePointEnum RPEnum(argv[1], fForward, FALSE);
  42. CRestorePoint RP;
  43. DWORD dwRc;
  44. dwRc = RPEnum.FindFirstRestorePoint(RP);
  45. while (dwRc == ERROR_SUCCESS || dwRc == ERROR_FILE_NOT_FOUND)
  46. {
  47. if (IsSystemDrive(argv[1]) && dwRc == ERROR_SUCCESS)
  48. {
  49. printf("Dir=%S\tType=%ld\tName=%S\t%S\n",
  50. RP.GetDir(),
  51. RP.GetType(),
  52. RP.GetName(),
  53. RP.IsDefunct() ? L"[Cancelled]" : L"");
  54. }
  55. else
  56. {
  57. printf("Dir=%S\n", RP.GetDir());
  58. }
  59. dwRc = RPEnum.FindNextRestorePoint(RP);
  60. }
  61. RPEnum.FindClose();
  62. if (argv) hMem = GlobalHandle(argv);
  63. if (hMem) GlobalFree(hMem);
  64. TermAsyncTrace();
  65. return;
  66. }