1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
page 80,132
title CP/DOS DosDevIOCTl mapper
dosxxx segment byte public 'dos'
assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;
;**********************************************************************
;*
;* MODULE: dosdevioctl
;*
;* FILE NAME: dos007.asm
;*
;* CALLING SEQUENCE:
;*
;* push@ dword Data
;* push@ dword Paramlist
;* push word Function
;* push word Category
;* push@ word Devicehandle
;*
;* call doschgfileptr
;*
;* MODULES CALLED: PC-DOS Int 21h, ah=42h, move file pointer
;*
;*********************************************************************
public dosdevioctl
.sall
.xlist
include macros.inc
.list
str struc
Old_bp dw ?
Return dd ?
Handle dw ? ; handle
Category dw ? ; device category
Function dw ? ; device function
Parmlist dd ? ; command arguments
Data dd ? ; data area
str ends
dosdevioctl proc far
Enter dosdevioctl ; push registers
mov bx,[bp].handle ; get handle
cmp bx,0ffe5h ; is it a device handle ??
jl filehandle ; branch if not
; Convert DASD device handle to drive number as follows:
; Drive Open IOCTL
; Letter Handle DASD #
; -----------------------------
; A -2 1
; B -3 2
; C -4 3
; D -5 4
; E -6 5
neg bx ; convert dev handle to
dec bx ; drive number
filehandle:
mov ax,[bp].function ; get function code
cmp ax,020H ; check for right function
je continue1 ; continue if right function code
mov ax,01H ; else, load error code
jmp exit ; return
continue1: ; only category 8 is supported
mov ax,[bp].category ; set category
mov ah,44h
int 21h ; do ioctl
jnc continue ; check for error
cmp ax,1 ; if error and return code = 1
jne exit ; then it is network drive
; therefore continue
continue:
lds si,[bp].data ; media changable
mov byte ptr [si],al ; save in data area
xor ax,ax ; set no error coe
exit: mexit ; pop registers
ret size str - 6 ; return
dosdevioctl endp
dosxxx ends
end
|