;*******************************************; ; This procedure does the following: ; ; - load WNASPI32.DLL, if one exists ; - load the address of GetASPI32Support and SendASPI32Command ; - check proper ASPI support, included a SCSI2 host adapter being installed ; - prepare the event object used for event notification ; ; This procedure takes one parameter: ; ; - the window handle of the main window (used for user messages) ; ;*******************************************; FFAspiStart PROC PARM_1:DWORD ;===========================================; PUSH ESI ; PUSH EDI ; PUSH EBP ; PUSH EBX ; ;===========================================; PUSH PARM_1 ; POP ashWnd ; ;===========================================; ; load the dinamic link library INVOKE LoadLibrary, ADDR szAspiDllName MOV hAspiLib, EAX CMP EAX,0 JNZ ASTA_1 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_1, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ; get the address of the first function ASTA_1: INVOKE GetProcAddress, hAspiLib, ADDR szGetASPI32SupportInfo MOV fnGetASPI32SupportInfo,EAX CMP EAX,0 JNZ ASTA_2 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_2, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ; get the address of the second function ASTA_2: INVOKE GetProcAddress, hAspiLib, ADDR szSendASPI32Command MOV fnSendASPI32Command,EAX CMP EAX,0 JNZ ASTA_3 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_3, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;-------------------------------------------;check ASPI support ASTA_3: MOV EAX,fnGetASPI32SupportInfo CALL EAX ;...........................................;support OK !!! CMP AH,SS_COMP JZ ASTA_OK ;...........................................;support not present CMP AH,SS_NO_ASPI JNZ ASTA_4 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_4, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................;real mode ASTA_4: CMP AH,SS_ILLEGAL_MODE JNZ ASTA_5 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_5, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................;old manager ASTA_5: CMP AH,SS_OLD_MANAGER JNZ ASTA_6 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_6, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................; ASTA_6: CMP AH,SS_NO_ADAPTERS JNZ ASTA_7 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_7, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................; ASTA_7: CMP AH,SS_MISMATCHED_COMPONENTS JNZ ASTA_8 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_8, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................; ASTA_8: CMP AH,SS_INSUFFICIENT_RESOURCES JNZ ASTA_9 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_9, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................; ASTA_9: CMP AH,SS_FAILED_INIT JNZ ASTA_10 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_10, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;...........................................;generic error ASTA_10: INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_11, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ;===========================================; ASTA_OK: AND EAX,0FH MOV HA_Count,EAX ;# of installed HA ; creating the event INVOKE CreateEvent, NULL, TRUE, FALSE, NULL MOV hEventSRB,EAX CMP EAX,0 JNZ ASTA_11 INVOKE MessageBoxA, ashWnd, OFFSET szMsg_ASTA_12, OFFSET szCaption_ASTA, MB_OK JMP ASTA_NOK ; preparing the return code in EAX ASTA_11: MOV EAX,TRUE ;true = ASPI support OK JMP ASTA_0 ASTA_NOK: MOV EAX,FALSE JMP ASTA_0 ;===========================================; ASTA_0: POP EBX ; POP EBP ; POP EDI ; POP ESI ; RET FFAspiStart ENDP ;*******************************************;