; CD-ROM eject/load progrm
; Ver 1.20 ------ Jan 6,1996
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 100H
START:
jmp install
COPYRIGHT DB 'CD-ROM drive eject/close prg. V1.20',0dh,0ah
DB 'Copyright (c) by Luo Yun Bin, Jan 6,1996',0dh,0ah
DB 'http://asm.yeah.net,Email: luoyunbin@telekbird.com.cn'
DB 0dh,0ah,0ah,24h
D_HELP DB 'Usage: EJ [drive:] [/?|/L|/U]',0dh,0ah
DB ' /? -------- Display this help',0dh,0ah
DB ' /L -------- Lock door',0dh,0ah
DB ' /U -------- Unlock door',0dh,0ah,24h
MESS_WAIT DB '[ENTER] to close, [Esc] to quit.',24h
MESS_ESC DB 'tray keep open...',0dh,0ah,24h
MESS_NO_CD DB 'MSCDEX not installed!',0dh,0ah,24h
MESS_STATUS DB 'There are '
DRV_NUMBER DB '0 CD-ROM drive(s) starting at '
DRV DB 'A:',0dh,0ah,24h
MESS_DRV DB 0dh,' ',0dh
DB 'drive '
DRV1 DB 'A: ',24h
MESS_EJECT DB 'ejecting....',24h
MESS_CLOSE DB 'closing ....',24h
MESS_LOCK DB 'locking ....',24h
MESS_UNLOCK DB 'unlocking...',24h
MESS_DONE DB ' Done!',0dh,0ah,24h
CD_DRV DW ?
FLAG DB ?
;======================================================
REQ_HEAD DB 1ah,0 ;IOCTL input
REQ_CMD DB 3
REQ_ERR DW ?
DB 9 dup (0)
BUF_OFF DW buffer
BUF_SEG DW ?
BUF_LEN DW ?
DB 6 dup (0)
;======================================================
BUFFER DB 5 dup (0) ;Max used 5 bytes
CMD_LINE PROC
mov si,81h ;处理命令行参数
mov di,80h
cld
cmd_reload:
lodsb
cmp al,0dh
jz conv_end ;将命令行小写字母换成大写
cmp al,'a'
jb conv_ok
cmp al,'z'
ja conv_ok
sub al,20h
conv_ok:
stosb
jmp short cmd_reload
conv_end:
xor al,al
stosb
mov si,80h
cmd_reload1:
lodsb
or al,al
jz cmd_end
cmp al,'/'
jz cmd_switch
cmp al,':'
jnz cmd_reload1
mov al,[si-2]
cmp al,'A'
jb cmd_end
cmp al,'Z'
ja cmd_end
sub al,'A'
xor ah,ah
mov cd_drv,ax
jmp short cmd_reload1
cmd_switch:
lodsb
cmp al,'?'
jz cmd_help
cmp al,'L'
jz cmd_lock
cmp al,'U'
jz cmd_unlock
jmp short cmd_reload1
cmd_end:
ret
cmd_help:
mov dx,offset d_help
call print
int 20h
cmd_lock:
or flag,1
jmp short cmd_reload1
cmd_unlock:
or flag,2
jmp short cmd_reload1
CMD_LINE ENDP
CD_INT PROC
mov ax,1510h
mov buf_seg,cs
mov bx,offset req_head
mov cx,cd_drv
int 2fh
procedure TForm1.Button1Click(Sender: TObject);
var
var
dwTemp1,dwTemp2: DWord;
NResult: DWORD;
begin
new(NResult);
GetVolumeInformation(PChar('g:\'), Nil, 0, @Result, dwTemp1, dwTemp2, Nil, 0);
if Result = 0 then
ShowMessage('CDROM is not Ready!');
end;