📄 int2f.asm
字号:
;****************************************************************************
; INT2F-MSCDEX (Windows CDFS) CD-ROM support VxD
; Version: 1.0
; Copyright (C) 2001 Alexander & Christian Grau, All Rights Reserved
;****************************************************************************
.386p
;******************************************************************************
; I N C L U D E S
;******************************************************************************
DEBUG equ 1
.XLIST
INCLUDE VMM.Inc
INCLUDE Debug.Inc
INCLUDE v86mmgr.inc
include vwin32.inc
include shell.inc
.LIST
;******************************************************************************
; V I R T U A L D E V I C E D E C L A R A T I O N
;******************************************************************************
Declare_Virtual_Device INT2F, \
INT2F_MAJOR_VERSION, \
INT2F_MINOR_VERSION, \
INT2F_Control, , \
UNDEFINED_INIT_ORDER
;******************************************************************************
; E Q U A T E S
;******************************************************************************
INT2F_MAJOR_VERSION EQU 1
INT2F_MINOR_VERSION EQU 0
DIOC_ISCDROMDRIVE EQU 1
DIOC_READSECTOR EQU 2
INT2F_ERROR_SUCCESS EQU 0
INT2F_ERROR_NOSUCHSERVICE EQU 1
INT2F_ERROR_FAILED EQU 2
INT2F_ERROR_OUTOFMEMORY EQU 3
CARRY_FLAG EQU 1
;******************************************************************************
; S T R U C T U R E S
;******************************************************************************
cdstruc struc
cd_Drv db ?
cd_LBA dd ?
cd_Blocks db ?
cd_Buf dd ?
cdstruc ends
;******************************************************************************
; D A T A
;******************************************************************************
VxD_IDATA_SEG
; Initialization data here - discarded after Init_Complete
VxD_IDATA_ENDS
VxD_DATA_SEG
; Normal Data here
VxD_DATA_ENDS
VxD_LOCKED_DATA_SEG
; Pagelocked data here - try to keep this to a minimum.
ioctlerror dd 0
AllocLenBuf dd ?
VxD_LOCKED_DATA_ENDS
;******************************************************************************
; I N I T I A L I Z A T I O N C O D E
;------------------------------------------------------------------------------
; Code in the initialization segment is discarded after Init_Complete
;******************************************************************************
VxD_ICODE_SEG
;******************************************************************************
;
; INT2F_Device_Init
;
; DESCRIPTION:
; This is a shell for a routine that is called at system BOOT.
; Typically, a VxD would do its initialization in this routine.
;
; ENTRY:
; EBX = System VM handle
;
; EXIT:
; Carry clear to indicate load success
; Carry set to abort loading this VxD
;
; USES:
; flags
;
;==============================================================================
VxdCaption db "VxD Extensions",0
VxdMessage db " Loading...",0
BeginProc INT2F_Device_Init
Trace_Out "INT2F_Device_Init"
ifdef debugmsg
; Put up message box indicating we're loading
VMMcall Get_Cur_VM_Handle
mov eax, MB_OK
mov ecx, OFFSET32 VxdMessage
mov edi, OFFSET32 VxdCaption
VxDcall SHELL_SYSMODAL_Message
endif
clc ;no error - load VxD
ret
EndProc INT2F_Device_Init
VxD_ICODE_ENDS
;******************************************************************************
; C O D E
;------------------------------------------------------------------------------
; The 'body' of the VxD would typically be in the standard code segment.
;******************************************************************************
VxD_CODE_SEG
VxD_CODE_ENDS
;******************************************************************************
; P A G E L O C K E D C O D E
;------------------------------------------------------------------------------
; Memory is a scarce resource. Use this only where necessary.
;******************************************************************************
VxD_LOCKED_CODE_SEG
;******************************************************************************
;
; INT2F_Control
;
; DESCRIPTION:
; This is a call-back routine to handle the messages that are sent
;
; ENTRY:
; EAX = Message number
; EBX = VM Handle
;
;==============================================================================
public INT2F_control
BeginProc INT2F_Control
Control_Dispatch SYS_DYNAMIC_DEVICE_INIT, INT2F_Device_Init
Control_Dispatch SYS_DYNAMIC_DEVICE_EXIT, INT2F_Device_Exit
Control_Dispatch W32_DEVICEIOCONTROL, INT2F_ioctl
clc
ret
EndProc INT2F_Control
;******************************************************************************
;
; INT2F_ioctl - Respond to DeviceIOcontrol messages sent by Win32 program.
;
; Entry: esi -> DIOC block
; DIOCParams STRUC
; Internal1 DD ?
; VMHandle DD ?
; Internal2 DD ?
; dwIoControlCode DD ? ; 0=IsCDRomDrive
; lpvInBuffer DD ?
; cbInBuffer DD ?
; lpvOutBuffer DD ?
; cbOutBuffer DD ?
; lpcbBytesReturned DD
; lpoOverlapped DD ?
; hDevice DD ?
; tagProcess DD ?
; DIOCParams ENDS
;
; Exit:
;
;******************************************************************************
BeginProc INT2F_ioctl
Debug_Out "Debug_Out!!"
Trace_Out "INT2F_ioctl..."
mov ioctlerror, INT2F_ERROR_NOSUCHSERVICE
mov ecx,[esi].dwIoControlCode ; get ioctl code
cmp ecx, DIOC_OPEN ; DIOC_OPEN is sent when VxD is loaded w/ CreateFile
je ioctl_open
cmp ecx, DIOC_CLOSEHANDLE ; DIOC_CLOSEHANDLE is sent when VxD is unloaded w/ CloseHandle
je ioctl_close
cmp ecx, DIOC_ISCDROMDRIVE
je ioctl_iscdrom
cmp ecx, DIOC_READSECTOR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -