bool ASPIStart ( void ) { // load WNASPI32.DLL WnASPI32DllHandle = LoadLibrary ( "WNASPI32.DLL" ); if ( WnASPI32DllHandle == 0 ) { MessageBox ( NULL, "LoadLibrary:\nWNASPI32.DLL not found.", "Error FS 002", MB_ICONSTOP ); return false; } // load the address of GetASPI32SupportInfo pfnGetASPI32SupportInfo = ( DWORD ( __stdcall *)( void ) ) GetProcAddress ( WnASPI32DllHandle, "GetASPI32SupportInfo" ); if ( pfnGetASPI32SupportInfo == NULL ) { MessageBox ( NULL, "GetProcAddress:\nGetASPI32SupportInfo not fount.", "Error FS 003", MB_ICONSTOP ); return false; } // load the address of SendASPI32Command pfnSendASPI32Command = ( DWORD ( __stdcall *)( LPSRB psrb ) ) GetProcAddress ( WnASPI32DllHandle, "SendASPI32Command" ); if ( pfnSendASPI32Command == NULL ) { MessageBox ( NULL, "GetProcAddress:\npfnSendASPI32Command not found.", "Error FS 004", MB_ICONSTOP ); return false; } // call GetASPI32SupportInfo DWORD dwSupportInfo = pfnGetASPI32SupportInfo ( ); BYTE byHaCount; BYTE byASPIStatus; byHaCount = LOBYTE ( LOWORD ( dwSupportInfo ) ); byASPIStatus = HIBYTE ( LOWORD ( dwSupportInfo ) ); switch ( byASPIStatus ) { case SS_COMP: // ASPI support OK, now create the event object hEventSRB = CreateEvent ( NULL, true, false, NULL ); if ( !hEventSRB ) { MessageBox ( NULL, "Could not create the event object.", "Error FS 005", MB_ICONEXCLAMATION ); return false; } return true; // true = everything OK !!! case SS_NO_ASPI: MessageBox ( NULL, "Could not find the ASPI manager.", "GetASPISupportInfo:", MB_ICONSTOP ); return false; case SS_ILLEGAL_MODE: MessageBox ( NULL, "ASPI for Windows does not support real mode.", "GetASPISupportInfo:", MB_ICONSTOP ); return false; case SS_OLD_MANAGER: MessageBox ( NULL, "Old ASPI manager.", "GetASPISupportInfo:", MB_ICONSTOP ); return false; default: MessageBox ( NULL, "Error initializing ASPI.", "GetASPISupportInfo:", MB_ICONSTOP ); return false; } }