summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2003-10-12 13:51:09 +0000
committerpixel <pixel>2003-10-12 13:51:09 +0000
commit9f4bc95bd406adecf8803b455cb20e79f3cccadb (patch)
tree16196fc7e196ae8b794a8534dfadfd23bf9b05a5 /lib
parent7787631c6ee37a489732c95cb0864422e3a3bdd1 (diff)
Some minor fixes and improvements
Diffstat (limited to 'lib')
-rw-r--r--lib/cdabstract.cpp21
-rw-r--r--lib/cdreader.cpp6
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/cdabstract.cpp b/lib/cdabstract.cpp
index f5f0d08..ce22fad 100644
--- a/lib/cdabstract.cpp
+++ b/lib/cdabstract.cpp
@@ -38,6 +38,7 @@ bool cdabstract::canprobe() {
}
std::vector<String> cdabstract::probe() throw (GeneralException) {
+ int i;
std::vector<String> r;
String probed;
@@ -45,9 +46,27 @@ std::vector<String> cdabstract::probe() throw (GeneralException) {
throw GeneralException("Can't probe CD devices on this platform.");
#ifdef __linux__
+ if (subprobe(probed = "/dev/cdrom"))
+ r.push_back(probed);
+
+ for (i = 0; i < 63; i++) {
+ probed.set("/dev/cdroms/cdrom%i", i);
+ if (subprobe(probed))
+ r.push_back(probed);
+ }
+ for (i = 'a'; i <= 'z'; i++) {
+ probed.set("/dev/hd%c", i);
+ if (subprobe(probed))
+ r.push_back(probed);
+ }
#endif
#if defined (_MSC_VER) || defined (__MINGW32__)
+ for (i = 'A'; i <= 'Z'; i++) {
+ probed.set("%c:\\", i);
+ if (subprobe(probed))
+ r.push_back(probed);
+ }
#endif
return r;
@@ -69,7 +88,7 @@ HANDLE cdabstract::OpenIOCTLFile(char cLetter) {
dwFlags = GENERIC_READ | GENERIC_WRITE; // add gen write on W2k/XP
else dwFlags = GENERIC_READ;
- wsprintf(szFName, "\\\\.\\%c:", cLetter);
+ sprintf(szFName, "\\\\.\\%c:", cLetter);
hF = CreateFile(szFName, dwFlags, FILE_SHARE_READ, // open drive
NULL, OPEN_EXISTING, dwIOCTLAttr, NULL);
diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp
index 5e88e98..bb785cf 100644
--- a/lib/cdreader.cpp
+++ b/lib/cdreader.cpp
@@ -168,6 +168,12 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) {
buf, 2352, &dwRet, NULL);
if (!bStat) {
DWORD dwErrCode = GetLastError();
+ if (dwErrCode == ERROR_INVALID_FUNCTION) {
+ if (rawIOCTL.TrackMode == YellowMode2) {
+ rawIOCTL.TrackMode = XAForm2;
+ continue;
+ }
+ }
if (dwErrCode != ERROR_IO_PENDING) {
throw GeneralException("Gave up on reading CD");
}