Thanks GPI, but that didn't make it work either....
Here's the full code in C++ and Purebasic:
C++
Code: Select all
// GETTING INFO ABOUT THE CD-R DISC INSERTED INTO THE CD-R/CD-RW WRITER DEVICE
// A) PROTOTYPES TO PUT INTO THE HEADER:
HINSTANCE MMC1DllHandle;
bool ( __stdcall *pfnFFAspiStart )( HWND );
char* ( __stdcall *pfnFFDiscInfo )( HWND, int, int, int );
void ( __stdcall *pfnFFAspiStop )( void );
// B) SOURCE CODE TO PUT INTO CPP FILE:
// load MMC1DLL.DLL
MMC1DllHandle = LoadLibrary ( "MMC1DLL.DLL" );
if ( MMC1DllHandle == 0 )
{
MessageBox ( NULL, "LoadLibrary:\nMMC1DLL.DLL not found.",
"Error FS 001", MB_SYSTEMMODAL );
return;
}
// load FFAspiStart address
pfnFFAspiStart = ( bool ( __stdcall *)( HWND ) )
GetProcAddress ( MMC1DllHandle, "FFAspiStart" );
if ( pfnFFAspiStart == NULL )
{
MessageBox ( NULL, "GetProcAddress:\nFFAspiStart not found.",
"Error FS 002", MB_SYSTEMMODAL );
return;
}
// load FFDiscInfo address
pfnFFDiscInfo = ( char* ( __stdcall *)( HWND, int, int, int ) )
GetProcAddress ( MMC1DllHandle, "FFDiscInfo" );
if ( pfnFFDiscInfo == NULL )
{
MessageBox ( NULL, "GetProcAddress:\nFFDiscInfo not found.",
"Error FS 003", MB_SYSTEMMODAL );
return;
}
// load FFAspiStop address
pfnFFAspiStop = ( void ( __stdcall *)( void ) )
GetProcAddress ( MMC1DllHandle, "FFAspiStop" );
if ( pfnFFAspiStop == NULL )
{
MessageBox ( NULL, "GetProcAddress:\nFFAspiStop not found.",
"Error FS 004", MB_SYSTEMMODAL );
return;
}
// check ASPI support
if ( pfnFFAspiStart ( Application -> Handle ) == false )
{
MessageBox ( NULL, "No ASPI support.",
"Error FS 005", MB_SYSTEMMODAL );
return;
}
// get disc info
// -- parameters:
// -- 1st parm: handle of the window of the calling program
// -- 2nd parm: host adapter Id (usually 0)
// -- 3rd parm: CD-R writer SCSI Id
// -- 4th parm: CD-R writer SCSI LUN (usually 0)
char* info;
info = pfnFFDiscInfo ( Application -> Handle, 0, 2, 0 );
MessageBox ( 0, info, "Disc Information Block:", MB_SYSTEMMODAL );
// stop ASPI support
pfnFFAspiStop ( );
// unload the DLL
FreeLibrary ( MMC1DllHandle );
PureBasic:
Code: Select all
If OpenLibrary(0,"mmc.dll")
*aspistart.l=IsFunction(0,"FFAspiStart")
*aspistop.l=IsFunction(0,"FFAspiStop")
*aspiinfo.l=IsFunction(0,"FFDiskInfo")
Debug "Loaded"
OpenWindow(0,10,10,320,200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Drive Check")
If CallFunctionFast(*aspistart)
Debug "Aspi Layer - OK"
Delay(100)
txt.s="Drive Check"
x=CallFunctionFast(*aspiinfo,WindowID(), 0,2, 0 )
Debug x
CallFunctionFast(*aspistop)
Debug "Aspi Layer - Closed"
EndIf
CloseLibrary(0)
EndIf