Extra-simple C++ Builder project. Use it even if a SCSI2 host adapter is not installed into your PC. ATAPI devices will be listed as well !
HINSTANCE AspiDllHandle; bool ( __stdcall *pfnFFAspiStart )( HWND ); void ( __stdcall *pfnFFSCSIBusScan )( HWND ); void ( __stdcall *pfnFFAspiStop )( void );
void __fastcall TForm1::Button1Click(TObject *Sender) { // load ASPIDLL.DLL AspiDllHandle = LoadLibrary ( "ASPIDLL.DLL" ); if ( AspiDllHandle == 0 ) { MessageBox ( NULL, "LoadLibrary:\nASPIDLL.DLL not found.", "Error FS 001", MB_SYSTEMMODAL ); return; } // load FFAspiStart address pfnFFAspiStart = ( bool ( __stdcall *)( HWND ) ) GetProcAddress ( AspiDllHandle, "FFAspiStart" ); if ( pfnFFAspiStart == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFAspiStart not found.", "Error FS 002", MB_SYSTEMMODAL ); return; } // load FFSCSIBusScan address pfnFFSCSIBusScan = ( void ( __stdcall *)( HWND ) ) GetProcAddress ( AspiDllHandle, "FFSCSIBusScan" ); if ( pfnFFSCSIBusScan == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFSCSIBusScan not found.", "Error FS 003", MB_SYSTEMMODAL ); return; } // load FFAspiStop address pfnFFAspiStop = ( void ( __stdcall *)( void ) ) GetProcAddress ( AspiDllHandle, "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; } // start ASPI support pfnFFAspiStart ( Application -> Handle ); // scan the SCSI2 bus pfnFFSCSIBusScan ( Application -> Handle ); // stop ASPI support pfnFFAspiStop ( ); // unload the DLL FreeLibrary ( AspiDllHandle ); }