;*******************************************; FFDiscInfo PROC PARM_1:DWORD, PARM_2:DWORD, PARM_3:DWORD, PARM_4:DWORD ;===========================================; PUSH ESI ; PUSH EDI ; PUSH EBP ; PUSH EBX ; ;===========================================;PARAMETERS: <<<<======== IMPORTANT !!! PUSH PARM_1 ; POP cdhWnd ;window handle of the calling program PUSH PARM_2 ; POP cdAdapId ;host adapter Id PUSH PARM_3 ; POP cdSCSIid ;SCSI Id of the CD-R writer PUSH PARM_4 ; POP cdSCSIlun ;SCSI LUN of the CD-R writer ;===========================================;TEST UNIT READY COMMAND INVOKE ResetEvent, hEventSRB CALL RESET_SRB_EXEC MOV SRB_EXEC.SRB_Cmd,SC_EXEC_SCSI_CMD MOV EAX,cdAdapId MOV SRB_EXEC.SRB_HaId,AL MOV SRB_EXEC.SRB_Flags,SRB_EVENT_NOTIFY MOV EAX,cdSCSIid MOV SRB_EXEC.SRB_Target,AL MOV SRB_EXEC.SRB_SenseLen,SENSE_LEN MOV SRB_EXEC.SRB_CDBLen,6 MOV EAX,hEventSRB MOV SRB_EXEC.SRB_PostProc,EAX LEA EDI,SRB_EXEC.CDBByte MOV AL,SCSI_TST_U_RDY MOV [EDI],AL MOV EAX,fnSendASPI32Command PUSH OFFSET SRB_EXEC CALL EAX ADD ESP,4 ;absolutely required CMP SRB_EXEC.SRB_Status,SS_PENDING JNZ FFCF1_1 INVOKE WaitForSingleObject, hEventSRB, INFINITE FFCF1_1: CMP SRB_EXEC.SRB_Status,SS_COMP JNZ FFC_CHECK_SENSE ;===========================================;READ DISC INFORMATION INVOKE ResetEvent, hEventSRB CALL RESET_SRB_EXEC MOV SRB_EXEC.SRB_Cmd,SC_EXEC_SCSI_CMD MOV EAX,cdAdapId MOV SRB_EXEC.SRB_HaId,AL MOV AL,SRB_DIR_IN ADD AL,SRB_EVENT_NOTIFY MOV SRB_EXEC.SRB_Flags,AL MOV EAX,cdSCSIid MOV SRB_EXEC.SRB_Target,AL MOV SRB_EXEC.SRB_BufLen,34 LEA EAX,DiscInfoBlock MOV SRB_EXEC.SRB_BufPointer,EAX MOV SRB_EXEC.SRB_SenseLen,SENSE_LEN MOV SRB_EXEC.SRB_CDBLen,10 MOV EAX,hEventSRB MOV SRB_EXEC.SRB_PostProc,EAX LEA EDI,SRB_EXEC.CDBByte MOV AL,51H ;READ DISC INFORMATION MOV [EDI],AL MOV AL,34 MOV [EDI + 8],AL FFCF2_1: MOV EAX,fnSendASPI32Command PUSH OFFSET SRB_EXEC CALL EAX ADD ESP,4 ;absolutely required CMP SRB_EXEC.SRB_Status,SS_PENDING JNZ FFCF2_2 INVOKE WaitForSingleObject, hEventSRB, INFINITE FFCF2_2: CMP SRB_EXEC.SRB_Status,SS_COMP JNZ FFC_CHECK_SENSE ;===========================================;FORMATTING THE USER MESSAGE ; erasable LEA ESI,DiscInfoBlock MOV AL,[ESI+2] AND AL,00010000b CMP AL,0 JNZ FFC_LAB_0_A LEA ESI,_no LEA EDI,_erasable MOV ECX,3 CALL ESI2EDI JMP FFC_LAB_1 FFC_LAB_0_A: LEA ESI,_yes LEA EDI,_erasable MOV ECX,3 CALL ESI2EDI ; state of last session FFC_LAB_1: LEA ESI,DiscInfoBlock MOV EAX,0 MOV AL,[ESI+2] AND AL,00001100b SHR EAX,2 CMP AL,0 JNZ FFC_LAB_1_A LEA ESI,_empty_session LEA EDI,_session_state MOV ECX,18 CALL ESI2EDI JMP FFC_LAB_2 FFC_LAB_1_A: CMP AL,1 JNZ FFC_LAB_1_B LEA ESI,_incomplete_sess LEA EDI,_session_state MOV ECX,18 CALL ESI2EDI JMP FFC_LAB_2 FFC_LAB_1_B: CMP AL,2 JNZ FFC_LAB_1_C LEA ESI,_reserved LEA EDI,_session_state MOV ECX,18 CALL ESI2EDI JMP FFC_LAB_2 FFC_LAB_1_C: CMP AL,3 JNZ FFC_LAB_2 LEA ESI,_complete_session LEA EDI,_session_state MOV ECX,18 CALL ESI2EDI ; disc status FFC_LAB_2: LEA ESI,DiscInfoBlock MOV AL,[ESI+2] AND AL,00000011b CMP AL,0 JNZ FFC_LAB_2_A LEA ESI,_empty LEA EDI,_disc_status MOV ECX,30 CALL ESI2EDI JZ FFC_LAB_3 FFC_LAB_2_A: CMP AL,1 JNZ FFC_LAB_2_B LEA ESI,_incomplete LEA EDI,_disc_status MOV ECX,30 CALL ESI2EDI JZ FFC_LAB_3 FFC_LAB_2_B: CMP AL,2 JNZ FFC_LAB_2_C LEA ESI,_complete LEA EDI,_disc_status MOV ECX,30 CALL ESI2EDI JZ FFC_LAB_3 FFC_LAB_2_C: CMP AL,3 JNZ FFC_LAB_3 LEA ESI,_reserved LEA EDI,_disc_status MOV ECX,30 CALL ESI2EDI ; num of 1 track FFC_LAB_3: LEA ESI,DiscInfoBlock MOV AL,[ESI+3] CALL BYTE2HEX LEA EDI,_num_of_1_track MOV [EDI],BH MOV [EDI+1],BL ; num of sessions FFC_LAB_4: LEA ESI,DiscInfoBlock MOV AL,[ESI+4] CALL BYTE2HEX LEA EDI,_num_of_sessions MOV [EDI],BH MOV [EDI+1],BL ; first track FFC_LAB_5: LEA ESI,DiscInfoBlock MOV AL,[ESI+5] CALL BYTE2HEX LEA EDI,_first_track MOV [EDI],BH MOV [EDI+1],BL ; last track FFC_LAB_6: LEA ESI,DiscInfoBlock MOV AL,[ESI+6] CALL BYTE2HEX LEA EDI,_last_track MOV [EDI],BH MOV [EDI+1],BL ; did valid FFC_LAB_7: LEA ESI,DiscInfoBlock MOV AL,[ESI+7] AND AL,10000000b CMP AL,0 JNZ FFC_LAB_7_A LEA ESI,_no LEA EDI,_did_v MOV ECX,3 CALL ESI2EDI JMP FFC_LAB_8 FFC_LAB_7_A: LEA ESI,_yes LEA EDI,_did_v MOV ECX,3 CALL ESI2EDI ; dbc valid FFC_LAB_8: LEA ESI,DiscInfoBlock MOV AL,[ESI+7] AND AL,01000000b CMP AL,0 JNZ FFC_LAB_8_A LEA ESI,_no LEA EDI,_dbc_v MOV ECX,3 CALL ESI2EDI JMP FFC_LAB_9 FFC_LAB_8_A: LEA ESI,_yes LEA EDI,_dbc_v MOV ECX,3 CALL ESI2EDI ; uru FFC_LAB_9: LEA ESI,DiscInfoBlock MOV AL,[ESI+7] AND AL,00100000b CMP AL,0 JNZ FFC_LAB_9_A LEA ESI,_no LEA EDI,_uru MOV ECX,3 CALL ESI2EDI JMP FFC_LAB_10 FFC_LAB_9_A: LEA ESI,_yes LEA EDI,_uru MOV ECX,3 CALL ESI2EDI ; disk type FFC_LAB_10: LEA ESI,DiscInfoBlock MOV AL,[ESI+8] CMP AL,0 JNZ FFC_LAB_10_A LEA ESI,_cd_da LEA EDI,_disc_type MOV ECX,20 CALL ESI2EDI JMP FFC_LAB_11 FFC_LAB_10_A: CMP AL,10h JNZ FFC_LAB_10_B LEA ESI,_cd_i LEA EDI,_disc_type MOV ECX,20 CALL ESI2EDI JMP FFC_LAB_11 FFC_LAB_10_B: CMP AL,20h JNZ FFC_LAB_10_C LEA ESI,_cd_xa LEA EDI,_disc_type MOV ECX,20 CALL ESI2EDI JMP FFC_LAB_11 FFC_LAB_10_C: CMP AL,0FFh JNZ FFC_LAB_11 LEA ESI,_undefined LEA EDI,_disc_type MOV ECX,20 CALL ESI2EDI ; disk identification FFC_LAB_11: LEA ESI,DiscInfoBlock MOV AL,[ESI+12] CALL BYTE2HEX LEA EDI,_did MOV [EDI],BH MOV [EDI+1],BL MOV AL,[ESI+13] CALL BYTE2HEX MOV [EDI+2],BH MOV [EDI+3],BL MOV AL,[ESI+14] CALL BYTE2HEX MOV [EDI+4],BH MOV [EDI+5],BL MOV AL,[ESI+15] CALL BYTE2HEX MOV [EDI+6],BH MOV [EDI+7],BL ; last 1 FFC_LAB_12: LEA ESI,DiscInfoBlock MOV AL,[ESI+16] CALL BYTE2HEX LEA EDI,_last_1 MOV [EDI],BH MOV [EDI+1],BL MOV AL,[ESI+17] CALL BYTE2HEX MOV [EDI+2],BH MOV [EDI+3],BL MOV AL,[ESI+18] CALL BYTE2HEX MOV [EDI+4],BH MOV [EDI+5],BL MOV AL,[ESI+19] CALL BYTE2HEX MOV [EDI+6],BH MOV [EDI+7],BL ; last 2 FFC_LAB_13: LEA ESI,DiscInfoBlock MOV AL,[ESI+20] CALL BYTE2HEX LEA EDI,_last_2 MOV [EDI],BH MOV [EDI+1],BL MOV AL,[ESI+21] CALL BYTE2HEX MOV [EDI+2],BH MOV [EDI+3],BL MOV AL,[ESI+22] CALL BYTE2HEX MOV [EDI+4],BH MOV [EDI+5],BL MOV AL,[ESI+23] CALL BYTE2HEX MOV [EDI+6],BH MOV [EDI+7],BL ; bar code FFC_LAB_14: LEA ESI,DiscInfoBlock MOV AL,[ESI+24] CALL BYTE2HEX LEA EDI,_dbc MOV [EDI],BH MOV [EDI+1],BL MOV AL,[ESI+25] CALL BYTE2HEX MOV [EDI+2],BH MOV [EDI+3],BL MOV AL,[ESI+26] CALL BYTE2HEX MOV [EDI+4],BH MOV [EDI+5],BL MOV AL,[ESI+27] CALL BYTE2HEX MOV [EDI+6],BH MOV [EDI+7],BL MOV AL,[ESI+28] CALL BYTE2HEX MOV [EDI+8],BH MOV [EDI+9],BL MOV AL,[ESI+29] CALL BYTE2HEX MOV [EDI+10],BH MOV [EDI+11],BL MOV AL,[ESI+30] CALL BYTE2HEX MOV [EDI+12],BH MOV [EDI+13],BL MOV AL,[ESI+31] CALL BYTE2HEX MOV [EDI+14],BH MOV [EDI+15],BL JMP FFC_OK ;===========================================;read CHECK SENSE data FFC_CHECK_SENSE: LEA EDI,szMsgSense ;prepare the message MOV AL,SRB_EXEC.SRB_Status CALL BYTE2DEC MOV [EDI + 13],AH MOV [EDI + 14],BH MOV [EDI + 15],BL MOV AL,SRB_EXEC.SRB_HaStat CALL BYTE2DEC MOV [EDI + 30],AH MOV [EDI + 31],BH MOV [EDI + 32],BL MOV AL,SRB_EXEC.SRB_TargStat CALL BYTE2DEC MOV [EDI + 51],AH MOV [EDI + 52],BH MOV [EDI + 53],BL LEA ESI,SRB_EXEC.SenseArea MOV AL,[ESI + 2] AND AL,0FH ;sense key CALL BYTE2HEX MOV [EDI + 68],BH MOV [EDI + 69],BL MOV AL,[ESI + 12] ;ASC CALL BYTE2HEX MOV [EDI + 79],BH MOV [EDI + 80],BL MOV AL,[ESI + 13] ;ASCQ CALL BYTE2HEX MOV [EDI + 91],BH MOV [EDI + 92],BL INVOKE MessageBoxA, cdhWnd, OFFSET szMsgSense, OFFSET szCaptionSense, MB_OK ;===========================================; FFC_OK: LEA EAX,DiscInfoMsg POP EBX ; POP EBP ; POP EDI ; POP ESI ; RET ; FFDiscInfo ENDP ; ;*******************************************; ESI2EDI PROC E2E: MOV AL,[ESI] INC ESI MOV [EDI],AL INC EDI LOOP E2E RET ESI2EDI ENDP ;*******************************************;