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.

115 lines
3.2 KiB

  1. #include "..\datastormgr.h"
  2. #include <stdio.h>
  3. void __cdecl main ()
  4. {
  5. DWORD dwErr = ERROR_SUCCESS;
  6. CDriveTable *pdt = NULL;
  7. g_pDataStoreMgr = new CDataStoreMgr();
  8. if (g_pDataStoreMgr == NULL)
  9. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  10. if (dwErr == ERROR_SUCCESS)
  11. dwErr = g_pDataStoreMgr->Initialize(TRUE);
  12. pdt = g_pDataStoreMgr->GetDriveTable ();
  13. if (dwErr == ERROR_SUCCESS)
  14. dwErr = pdt->SaveDriveTable (L"dstortest.txt");
  15. pdt = new CDriveTable();
  16. if (pdt == NULL)
  17. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  18. if (dwErr == ERROR_SUCCESS)
  19. dwErr = pdt->LoadDriveTable (L"dstortest.txt");
  20. if (dwErr == ERROR_SUCCESS)
  21. dwErr = pdt->SaveDriveTable (L"CONOUT$");
  22. if (dwErr == ERROR_SUCCESS)
  23. dwErr = g_pDataStoreMgr->Compress (NULL, 25);
  24. if (dwErr == ERROR_SUCCESS)
  25. {
  26. delete g_pDataStoreMgr;
  27. g_pDataStoreMgr = new CDataStoreMgr();
  28. if (g_pDataStoreMgr == NULL)
  29. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  30. WCHAR wcsPath[MAX_PATH];
  31. MakeRestorePath (wcsPath, L"C:\\", L"RP1");
  32. CreateDirectory (wcsPath, NULL);
  33. MakeRestorePath (wcsPath, L"C:\\", L"RP2");
  34. CreateDirectory (wcsPath, NULL);
  35. lstrcat (wcsPath, L"\\A1.TXT");
  36. FILE *f = _wfopen(wcsPath, L"w");
  37. if (f) fclose (f);
  38. MakeRestorePath (wcsPath, L"C:\\", L"RP2");
  39. lstrcat (wcsPath, L"\\change1.log");
  40. f = _wfopen(wcsPath, L"w");
  41. if (f) fclose (f);
  42. }
  43. if (dwErr == ERROR_SUCCESS)
  44. dwErr = g_pDataStoreMgr->Initialize(FALSE);
  45. if (dwErr == ERROR_SUCCESS)
  46. dwErr = g_pDataStoreMgr->CountChangeLogs (NULL);
  47. pdt = g_pDataStoreMgr->GetDriveTable ();
  48. if (dwErr == ERROR_SUCCESS)
  49. dwErr = pdt->SaveDriveTable (L"dstortest.txt");
  50. pdt = new CDriveTable();
  51. if (pdt == NULL)
  52. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  53. if (dwErr == ERROR_SUCCESS)
  54. dwErr = pdt->LoadDriveTable (L"dstortest.txt");
  55. if (dwErr == ERROR_SUCCESS)
  56. dwErr = pdt->SaveDriveTable (L"CONOUT$");
  57. if (dwErr == ERROR_SUCCESS)
  58. dwErr = g_pDataStoreMgr->Compress (NULL, 25);
  59. if (dwErr == ERROR_SUCCESS)
  60. {
  61. SDriveTableEnumContext dtec;
  62. CDataStore *pds = pdt->FindFirstDrive (dtec);
  63. while (pds != NULL)
  64. {
  65. printf ("Found drive %ws %ws\n", pds->GetDrive(), pds->GetGuid());
  66. pds = pdt->FindNextDrive (dtec);
  67. }
  68. printf ("Found drive DONE.\n");
  69. }
  70. if (dwErr == ERROR_SUCCESS)
  71. dwErr = pdt->AddDriveToTable (L"Z:\\", NULL);
  72. if (dwErr == ERROR_SUCCESS)
  73. {
  74. SDriveTableEnumContext dtec;
  75. CDataStore *pds = pdt->FindFirstDrive (dtec);
  76. while (pds != NULL)
  77. {
  78. printf ("Found drive %ws %ws\n", pds->GetDrive(), pds->GetGuid());
  79. pds = pdt->FindNextDrive (dtec);
  80. }
  81. printf ("Found drive DONE.\n");
  82. }
  83. if (dwErr == ERROR_SUCCESS)
  84. {
  85. dwErr = GetDomainMembershipInfo (L"domain.txt");
  86. }
  87. if (dwErr != ERROR_SUCCESS)
  88. printf ("Failed with %d\n", dwErr);
  89. }