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.

53 lines
1.5 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_STRIPE_SET_WITH_PARITY_CONFIGURATION_INFORMATION config;
  11. int i;
  12. BOOL b;
  13. FT_LOGICAL_DISK_ID diskId[100], newDiskId;
  14. LONGLONG memberSize;
  15. if (argc < 4) {
  16. printf("usage: %s <diskId1> <diskId2> <diskId3>...\n", argv[0]);
  17. return;
  18. }
  19. config.MemberSize = MAXLONGLONG;
  20. printf("Creating a stripe set with parity 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. }
  34. printf(" ...\n");
  35. config.StripeSize = 0x10000;
  36. b = FtCreateLogicalDisk(FtStripeSetWithParity, (WORD) (argc - 1), diskId,
  37. sizeof(config), &config, &newDiskId);
  38. if (b) {
  39. printf("Stripe set with parity %I64X created.\n", newDiskId);
  40. } else {
  41. printf("Stripe set with parity create failed with %d\n", GetLastError());
  42. }
  43. }