medium.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #include "./main.h"
  2. #include "./medium.h"
  3. #include "./drive.h"
  4. #include "./resource.h"
  5. //#include <primosdk.h>
  6. static int pType[] =
  7. {
  8. IDS_STAMPED_DISC_OR_RECORDABLE_THAT_HAS_BEEN_RECORDED,
  9. IDS_REWRITEABLE_DISC_HAS_DATA_BUT_KEPT_OPEN_FOR_APPEND,
  10. IDS_REWRITEABLE_DISC_NOT_POSSIBLE_TO_APPEND_DATA,
  11. IDS_BLANK_REWRITEABLE_DISC,
  12. };
  13. static int pFormat[] =
  14. {
  15. IDS_MEDIA_BLANK_DISC,
  16. IDS_MEDIA_DATA_MODE_1_DAO,
  17. IDS_MEDIA_KODAK_PHOTO_CD,
  18. IDS_MEDIA_DATA_MULTISESSION_MODE_1_CLOSED,
  19. IDS_MEDIA_DATA_MULTISESSION_MODE_2_CLOSED,
  20. IDS_MEDIA_DATA_MODE_2_DAO,
  21. IDS_MEDIA_CDRFS,
  22. IDS_MEDIA_PACKET_WRITING,
  23. IDS_MEDIA_DATA_MULTISESSION_MODE_1_OPEN,
  24. IDS_MEDIA_DATA_MULTISESSION_MODE_2_OPEN,
  25. IDS_MEDIA_AUDIO_DAO_SAO_TAO,
  26. IDS_MEDIA_AUDIO_REWRITEABLE_DISC_WITH_SESSION_NOT_CLOSED,
  27. IDS_MEDIA_FIRST_TYPE_OF_ENHANCED_CD_ABORTED,
  28. IDS_MEDIA_CD_EXTRA,
  29. IDS_MEDIA_AUDIO_TAO_WITH_SESSION_NOT_WRITTEN,
  30. IDS_MEDIA_FIRST_TRACK_DATA_OTHERS_AUDIO,
  31. IDS_MEDIA_MIXED_MODE_MADE_TAO,
  32. IDS_MEDIA_KODAK_PORTFOLIO,
  33. IDS_MEDIA_VIDEO_CD,
  34. IDS_MEDIA_CDi,
  35. IDS_MEDIA_PLAYSTATION_SONY_GAMES,
  36. IDS_MEDIA_OBSOLETE,
  37. IDS_MEDIA_OBSOLETE_FOR_RESTRICTED_OVERWRITE_DVD,
  38. IDS_MEDIA_DVDROM_OR_CLOSED_RECORDABLE,
  39. IDS_MEDIA_INCREMENTAL_DVD_WITH_APPENDABLE_ZONE,
  40. IDS_MEDIA_APPENDABLE_DVD_OF_ANY_TYPE,
  41. IDS_MEDIA_DVDRAM_CARTRIDGE,
  42. IDS_MEDIA_CD_OTHER_TYPE,
  43. };
  44. static wchar_t buffer[256];
  45. LPCWSTR Medium_GetTypeString(DWORD nType)
  46. {
  47. int index = -1;
  48. #if 0
  49. switch(nType)
  50. {
  51. case PRIMOSDK_SILVER: index = 0; break;
  52. case PRIMOSDK_COMPLIANTGOLD: index = 1; break;
  53. case PRIMOSDK_OTHERGOLD: index = 2; break;
  54. case PRIMOSDK_BLANK: index = 3; break;
  55. }
  56. #endif
  57. return WASABI_API_LNGSTRINGW_BUF((-1 != index) ? pType[index] : IDS_UNKNOWN, buffer,
  58. sizeof(buffer)/sizeof(wchar_t));
  59. }
  60. LPCWSTR Medium_GetPhysicalTypeString(DWORD nType)
  61. {
  62. return Drive_GetTypeString(nType);
  63. }
  64. LPCWSTR Medium_GetFormatString(DWORD nFormat)
  65. {
  66. int index = -1;
  67. #if 0
  68. switch(nFormat)
  69. {
  70. case PRIMOSDK_B1: index = 0; break;
  71. case PRIMOSDK_D1: index = 1; break;
  72. case PRIMOSDK_D2: index = 2; break;
  73. case PRIMOSDK_D3: index = 3; break;
  74. case PRIMOSDK_D4: index = 4; break;
  75. case PRIMOSDK_D5: index = 5; break;
  76. case PRIMOSDK_D6: index = 6; break;
  77. case PRIMOSDK_D7: index = 7; break;
  78. case PRIMOSDK_D8: index = 8; break;
  79. case PRIMOSDK_D9: index = 9; break;
  80. case PRIMOSDK_A1: index = 10; break;
  81. case PRIMOSDK_A2: index = 11; break;
  82. case PRIMOSDK_A3: index = 12; break;
  83. case PRIMOSDK_A4: index = 13; break;
  84. case PRIMOSDK_A5: index = 14; break;
  85. case PRIMOSDK_M1: index = 15; break;
  86. case PRIMOSDK_M2: index = 16; break;
  87. case PRIMOSDK_M3: index = 17; break;
  88. case PRIMOSDK_M4: index = 18; break;
  89. case PRIMOSDK_M5: index = 19; break;
  90. case PRIMOSDK_M6: index = 20; break;
  91. case PRIMOSDK_F1: index = 21; break;
  92. case PRIMOSDK_F2: index = 22; break;
  93. case PRIMOSDK_F3: index = 23; break;
  94. case PRIMOSDK_F4: index = 24; break;
  95. case PRIMOSDK_F8: index = 25; break;
  96. case PRIMOSDK_FA: index = 26; break;
  97. case PRIMOSDK_GENERICCD: index = 27; break;
  98. }
  99. #endif
  100. return WASABI_API_LNGSTRINGW_BUF((-1 != index) ? pFormat[index] : IDS_UNKNOWN, buffer,
  101. sizeof(buffer)/sizeof(wchar_t));
  102. }
  103. BOOL Medium_IsRecordableType(DWORD nType)
  104. {
  105. #if 0
  106. return (PRIMOSDK_COMPLIANTGOLD == nType || PRIMOSDK_BLANK == nType);
  107. #else
  108. return FALSE;
  109. #endif
  110. }
  111. BOOL Medium_IsRecordable(CHAR cLetter)
  112. {
  113. wchar_t info[128] = {0};
  114. wchar_t name[] = L"cda://X.cda";
  115. DWORD result;
  116. BOOL reloaded = FALSE;
  117. name[6] = cLetter;
  118. for(;;)
  119. {
  120. result = getFileInfoW(name, L"cdtype", info, sizeof(info)/sizeof(wchar_t));
  121. if (result || reloaded || !getFileInfoW(name, L"reloadsonic", NULL, 0)) break;
  122. reloaded = TRUE;
  123. }
  124. return (result) ? (!lstrcmpW(info, L"CDR") || !lstrcmpW(info, L"CDRW")) : FALSE;
  125. }