1
0

drive.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #include "./main.h"
  2. #include "./drive.h"
  3. #include "./resource.h"
  4. //#include <primosdk.h>
  5. #include <strsafe.h>
  6. static LPCWSTR pszBusType[] =
  7. {
  8. L"ATAPI",
  9. L"SCSI",
  10. L"1394",
  11. L"USB",
  12. L"USB2"
  13. };
  14. static LPCWSTR pszType[] =
  15. {
  16. L"CD-ROM",
  17. L"CD-R",
  18. L"CD-RW",
  19. L"DVD-ROM",
  20. L"DVD-R",
  21. L"DVD-RW",
  22. L"DVD+R",
  23. L"DVD+RW",
  24. L"DVD-RAM",
  25. L"DDCD-ROM",
  26. L"DDCD-R",
  27. L"DDCD-RW",
  28. L"DL DVD+R",
  29. L"DL DVD-R",
  30. L"BD-RW",
  31. L"BD-R",
  32. L"BD-ROM",
  33. L"HDDVD-RW",
  34. L"HDDVD-R",
  35. L"HDDVD-ROM",
  36. };
  37. static wchar_t buffer[64];
  38. LPCWSTR Drive_GetBusTypeString(DWORD nBusType)
  39. {
  40. int index = -1;
  41. #if 0
  42. switch (nBusType)
  43. {
  44. case PRIMOSDK_ATAPI: index = 0; break;
  45. case PRIMOSDK_SCSI: index = 1; break;
  46. case PRIMOSDK_1394: index = 2; break;
  47. case PRIMOSDK_USB: index = 3; break;
  48. case PRIMOSDK_USB2: index = 4; break;
  49. }
  50. #endif
  51. return (-1 != index) ? pszBusType[index] :
  52. WASABI_API_LNGSTRINGW_BUF(IDS_UNKNOWN, buffer, sizeof(buffer)/sizeof(wchar_t));
  53. }
  54. LPCWSTR Drive_GetTypeString(DWORD nType)
  55. {
  56. int index = -1;
  57. #if 0
  58. switch (nType)
  59. {
  60. case PRIMOSDK_CDROM: index = 0; break;
  61. case PRIMOSDK_CDR: index = 1; break;
  62. case PRIMOSDK_CDRW: index = 2; break;
  63. case PRIMOSDK_DVDROM: index = 3; break;
  64. case PRIMOSDK_DVDR: index = 4; break;
  65. case PRIMOSDK_DVDRW: index = 5; break;
  66. case PRIMOSDK_DVDPR: index = 6; break;
  67. case PRIMOSDK_DVDPRW: index = 7; break;
  68. case PRIMOSDK_DVDRAM: index = 8; break;
  69. case PRIMOSDK_DDCDROM: index = 9; break;
  70. case PRIMOSDK_DDCDR: index = 10; break;
  71. case PRIMOSDK_DDCDRW: index = 11; break;
  72. case PRIMOSDK_DVDPR9: index = 12; break;
  73. case PRIMOSDK_DVDR9: index = 13; break;
  74. case PRIMOSDK_BDRE: index = 14; break;
  75. case PRIMOSDK_BDR: index = 15; break;
  76. case PRIMOSDK_BDROM: index = 16; break;
  77. case PRIMOSDK_HDDVDRW: index = 17; break;
  78. case PRIMOSDK_HDDVDR: index = 18; break;
  79. case PRIMOSDK_HDDVDROM: index = 19; break;
  80. }
  81. #endif
  82. return (-1 != index) ? pszType[index] :
  83. WASABI_API_LNGSTRINGW_BUF(IDS_UNKNOWN, buffer, sizeof(buffer)/sizeof(wchar_t));
  84. }
  85. BOOL Drive_IsRecorderType(DWORD nType)
  86. {
  87. #if 0
  88. switch(nType)
  89. {
  90. case PRIMOSDK_CDR:
  91. case PRIMOSDK_CDRW:
  92. case PRIMOSDK_DVDR:
  93. case PRIMOSDK_DVDRW:
  94. case PRIMOSDK_DVDPR:
  95. case PRIMOSDK_DVDPRW:
  96. case PRIMOSDK_DVDRAM:
  97. case PRIMOSDK_DDCDR:
  98. case PRIMOSDK_DDCDRW:
  99. case PRIMOSDK_DVDPR9:
  100. case PRIMOSDK_DVDR9:
  101. case PRIMOSDK_BDRE:
  102. case PRIMOSDK_BDR:
  103. case PRIMOSDK_HDDVDRW:
  104. case PRIMOSDK_HDDVDR:
  105. return TRUE;
  106. }
  107. #endif
  108. return FALSE;
  109. }
  110. BOOL Drive_IsRecorder(CHAR cLetter)
  111. {
  112. #if 0
  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"cdinfo", info, sizeof(info)/sizeof(wchar_t));
  121. if (result || reloaded || !getFileInfoW(name, L"reloadsonic", NULL, 0)) break;
  122. reloaded = TRUE;
  123. }
  124. return (result) ? Drive_IsRecorderType(_wtoi(info)) : FALSE;
  125. #else
  126. return FALSE;
  127. #endif
  128. }