Initial
This commit is contained in:
83
uudecode/MASM/CFILE.ASM
Normal file
83
uudecode/MASM/CFILE.ASM
Normal file
@@ -0,0 +1,83 @@
|
||||
;*************************************************************************************
|
||||
; MODULE: CFILE.ASM DATE: APRIL 27,1997
|
||||
; AUTHOR: SEAN M. KESSLER
|
||||
; TARGET: 32 BIT LAT MODEL
|
||||
; FUNCTION : BUFFERED FILE FUNCTIONS
|
||||
;*************************************************************************************
|
||||
.386
|
||||
.MODEL FLAT
|
||||
INCLUDE devioctl.inc
|
||||
INCLUDE string.inc
|
||||
INCLUDE openfile.inc
|
||||
.CODE
|
||||
|
||||
_FileOpen proc near ; int FileOpen(char *pathFileName,FileInfo *pFileInfo,int access,int share,int open,int attributes)
|
||||
push ebp ; save stack frame
|
||||
mov ebp,esp ; create new frame
|
||||
push esi ; save source index
|
||||
CREATEFILE [ebp+08h],[ebp+10h],[ebp+14h],[ebp+18h],[ebp+1Ch] ; call create file
|
||||
mov esi,[ebp+0Ch] ; move FileInfo ptr to esi
|
||||
mov [FileInfo ptr [esi]].FileInfo@@mhFileHandle,eax ; store handle
|
||||
pop esi ; restore source index
|
||||
pop ebp ; restore previous frame
|
||||
retn ; return near to caller
|
||||
_FileOpen endp
|
||||
|
||||
_FileClose proc near
|
||||
push ebp ; save prior frame
|
||||
mov esp,esp ; create new stack frame
|
||||
push esi ; save source index register
|
||||
mov esi,[ebp+0Ch] ; move FileInfo ptr to esi
|
||||
cmp [FileInfo ptr [esi]].FileInfo@@mhFileHandle,INVALID_HANDLE ; check for valid handle
|
||||
je @@FileCloseEnd ; handle is not valid
|
||||
CLOSEHANDLE [FileInfo ptr [esi]].FileInfo@@mhFileHandle ; close handle
|
||||
mov [FileInfo ptr [esi]].FileInfo@@mhFileHandle,INVALID_HANDLE ; set handle to invalid state
|
||||
@@FileCloseEnd: ; end sync address
|
||||
pop esi ; restore source index
|
||||
pop ebp ; restore prior stack frame
|
||||
retn ; return near to caller
|
||||
_FileClose endp
|
||||
|
||||
;FCLOSE MACRO sFileInfo
|
||||
; LOCAL @@FCLOSEend
|
||||
; cmp sFileInfo.FileInfo@@mhFileHandle,INVALID_HANDLE
|
||||
; je @@FCLOSEend
|
||||
; CLOSEHANDLE sFileInfo.FileInfo@@mhFileHandle
|
||||
; mov sFileInfo.FileInfo@@mhFileHandle,INVALID_HANDLE
|
||||
;@@FCLOSEend:
|
||||
;ENDM
|
||||
|
||||
_FileRead proc near
|
||||
push ebp
|
||||
mov esp,esp
|
||||
pop ebp
|
||||
retn
|
||||
_FileRead endp
|
||||
_FileReadLine proc near
|
||||
push ebp
|
||||
mov esp,esp
|
||||
pop ebp
|
||||
retn
|
||||
_FileReadLine endp
|
||||
|
||||
_FileWrite proc near
|
||||
push ebp
|
||||
mov esp,esp
|
||||
pop ebp
|
||||
retn
|
||||
_FileWrite endp
|
||||
|
||||
_FileFlush proc near
|
||||
push ebp
|
||||
mov esp,esp
|
||||
pop ebp
|
||||
retn
|
||||
_FileFlush endp
|
||||
|
||||
public _FileOpen
|
||||
public _FileClose
|
||||
public _FileRead
|
||||
public _FileReadLine
|
||||
public _FileWrite
|
||||
public _FileFlush
|
||||
END
|
||||
Reference in New Issue
Block a user