4 title CP
/DOS DosQFileInfo mapper
7 FileAttributeSegment
segment word public 'fat'
9 extrn FileAttributeTable
:word
11 FileAttributeSegment ends
13 dosxxx
segment byte public 'dos'
14 assume
cs:dosxxx
,ds:nothing
,es:nothing
,ss:nothing
16 ;**********************************************************************
18 ;* MODULE: dosQfileinfo
20 ;* FILE NAME: dos052.asm
24 ;* push word filehandle
25 ;* push word fileinfolevel
26 ;* push@ other fileinfobuffer
27 ;* push word filebuffersize
28 ;* call dossetfileinfo
30 ;* MODULES CALLED: PC-DOS Int 21h, ah=57h, set file's date/time
32 ;*********************************************************************
48 DataLength dd ?
; File size
49 FileSpace dd ?
; falloc_size
50 Attributes dw ?
; attributes
57 BufferSize dw ?
; file data buffer size
58 BufferPtr dd ?
; file data buffer
59 Level dw ?
; file data info level
60 Handle dw ?
; file handle
64 Enter dosQfileinfo
; save registers
66 mov bx,[bp].handle
;fill registers for function call
69 int 21h
; get file date and time
70 jc ErrorExit
; jump if error
72 lds si,[bp].BufferPtr
; copy date and time to
73 mov ds:[si].CreateDate
,dx ; file info return data area
74 mov ds:[si].CreateTime
,cx
75 mov ds:[si].LastAccessDate
,dx
76 mov ds:[si].LastAccessTime
,cx
77 mov ds:[si].LastWriteDate
,dx
78 mov ds:[si].LastWriteTime
,cx
80 ; Calculate the file length and file space and save in the file info data area
82 mov cx,0 ; get the current position
84 mov bx,[bp].handle
; get file handle
87 int 21h
; move file pointer to the
88 jc ErrorExit
; current position
97 mov ax,04202h ; move file pointer to end-of-file
100 lds si,[bp].BufferPtr
; save the file length in
101 mov ds:word ptr DataLength
[si+0],ax ; file info data area
102 mov ds:word ptr DataLength
[si+2],dx
112 mov ds:word ptr FileSpace
[si+0],ax ; save file space
113 mov ds:word ptr FileSpace
[si+2],dx ; in return data area
115 ; calculate the file attribute and save
123 int 21h
; move the file pointer
126 mov ax,seg FileAttributeSegment
128 assume
ds:FileAttributeSegment
133 mov ax,FileAttributeTable
[bx]
134 mov [bp].Attributes
,ax ; save file attribute
136 sub ax,ax ; set good return code
139 mexit
; restore registers
140 ret size
str - 6 ; return