// GET THE ISO 9660 IMAGE FILE OF AN EXISTING CD-ROM // Directions: put the CD-ROM into the CD-R/CD-RW writer device, then // compile, link and run this program. Give the output file the name // that you chose (C:\MY_FILE.ISO in this example). // A) PROTOTYPES TO PUT INTO THE HEADER: HINSTANCE MMC1DllHandle; bool ( __stdcall *pfnFFAspiStart )( HWND ); int ( __stdcall *pfnFFCDReadSect)( HWND, int, int, int, int, char* ); 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 FFCDReadSect address pfnFFCDReadSect = ( int ( __stdcall *)( HWND, int, int, int, int, char* ) ) GetProcAddress ( MMC1DllHandle, "FFCDReadSect" ); if ( pfnFFCDReadSect == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFCDReadSect 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; } // declarations int rc; unsigned long iBytesWritten; char sectBuf [ 2050 ]; // create the empty file to accomodate the ISO 9660 image file HANDLE fontHandle = CreateFile ( "C:\\MY_FILE.ISO", GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 ); // read any possible block int blocknum = 0; while ( true ) { rc = pfnFFCDReadSect ( Application -> Handle, 0, 2, 0, blocknum, sectBuf ); blocknum++; if ( rc == 0 ) WriteFile ( fontHandle, sectBuf, 2048, &iBytesWritten, 0 ); else break; // EXIT AT THE FIRST READ ERROR (nothing more to read) // USUALLY the error is SENSE CODE = 5, Additional // Sense Code = 21h, Additional Sense Code Qualifier = 0 // (meaning: LBA out of range). } // close the ISO 9660 image file CloseHandle ( fontHandle ); // stop ASPI support pfnFFAspiStop ( ); // unload the DLL FreeLibrary ( MMC1DllHandle );