From 7787631c6ee37a489732c95cb0864422e3a3bdd1 Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 12 Oct 2003 05:15:00 +0000 Subject: AT LAST!!! Windows 2k/XP CD reading works using raw ioctls!!!! HURRAY!!!!!!!! --- includes/cdabstract.h | 40 ++++++++++++++++++++++++++++++++++++++-- includes/cdreader.h | 11 +++++++---- 2 files changed, 45 insertions(+), 6 deletions(-) (limited to 'includes') diff --git a/includes/cdabstract.h b/includes/cdabstract.h index 66aa909..60061d4 100644 --- a/includes/cdabstract.h +++ b/includes/cdabstract.h @@ -1,8 +1,44 @@ #ifndef __CD_ABSTRACT_H__ #define __CD_ABSTRACT_H__ -#include "Handle.h" +#if defined (_MSC_VER) || defined (__MINGW32__) +#include + +#define IOCTL_SCSI_BASE 0x00000004 + +#define METHOD_BUFFERED 0 +#define METHOD_OUT_DIRECT 2 + +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 0x0001 + +#define CTL_CODE( DevType, Function, Method, Access ) ( \ + ((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE( IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS ) +#define FILE_DEVICE_CD_ROM 0x00000002 +#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM +#define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS) + +#endif + +#include +#include +#include -Handle * open_iso(const String &); +class cdabstract : public Base { + public: + static Handle * open_cd(const String &); + static bool canprobe(); + static std::vector probe() throw (GeneralException); +#if defined (_MSC_VER) || defined (__MINGW32__) + protected: + static HANDLE OpenIOCTLFile(char cLetter); + static void GetIOCTLAdapter(HANDLE hF, int * iDA, int * iDT, int * iDL); +#endif + private: + static bool subprobe(String &); + friend class cdreader; +}; #endif diff --git a/includes/cdreader.h b/includes/cdreader.h index 8ebe362..acf6765 100644 --- a/includes/cdreader.h +++ b/includes/cdreader.h @@ -1,11 +1,11 @@ #ifndef __CDREADER_H__ #define __CDREADER_H__ -#ifdef __cplusplus #include #include #include #include +#include "cdabstract.h" class cdreader : public Handle { public: @@ -15,6 +15,9 @@ class cdreader : public Handle { virtual bool CanWrite() const; virtual bool CanRead() const; virtual bool CanSeek() const; +#if defined (_MSC_VER) || defined (__MINGW32__) + virtual void close() throw (GeneralException); +#endif virtual ssize_t read(void *buf, size_t count) throw (GeneralException); virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); virtual String GetName() const; @@ -25,9 +28,9 @@ class cdreader : public Handle { private: String n; int sector; +#if defined (_MSC_VER) || defined (__MINGW32__) + HANDLE hF; +#endif }; -#else -#error This only works with a C++ compiler -#endif #endif -- cgit v1.2.3