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.

60 lines
1.6 KiB

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <ftapi.h>
  4. void __cdecl
  5. main(
  6. int argc,
  7. char** argv
  8. )
  9. {
  10. FT_MIRROR_SET_CONFIGURATION_INFORMATION config;
  11. int i;
  12. BOOL b;
  13. FT_LOGICAL_DISK_ID diskId[2], newDiskId;
  14. LONGLONG memberSize, zeroMemberSize;
  15. if (argc != 3) {
  16. printf("usage: %s <diskId1> <diskId2>\n", argv[0]);
  17. return;
  18. }
  19. config.MemberSize = MAXLONGLONG;
  20. printf("Creating a mirror set for");
  21. for (i = 1; i < argc; i++) {
  22. sscanf(argv[i], "%I64X", &diskId[i - 1]);
  23. printf(" %I64X", diskId[i - 1]);
  24. b = FtQueryLogicalDiskInformation(diskId[i - 1], NULL, &memberSize,
  25. 0, NULL, NULL, 0, NULL, 0, NULL);
  26. if (!b) {
  27. printf("Could not query disk info, error = %d\n", GetLastError());
  28. return;
  29. }
  30. if (memberSize < config.MemberSize) {
  31. config.MemberSize = memberSize;
  32. }
  33. if (i == 1) {
  34. zeroMemberSize = memberSize;
  35. }
  36. }
  37. printf(" ...\n");
  38. if (memberSize < zeroMemberSize) {
  39. printf("First member too big.\n");
  40. return;
  41. }
  42. b = FtCreateLogicalDisk(FtMirrorSet, 2, diskId, sizeof(config), &config,
  43. &newDiskId);
  44. if (b) {
  45. printf("Mirror %I64X created.\n", newDiskId);
  46. } else {
  47. printf("Mirror create failed with %d\n", GetLastError());
  48. }
  49. }