diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/nbt/vxd/cvxdfile.asm | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to '')
-rw-r--r-- | private/ntos/nbt/vxd/cvxdfile.asm | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/private/ntos/nbt/vxd/cvxdfile.asm b/private/ntos/nbt/vxd/cvxdfile.asm new file mode 100644 index 000000000..451f18501 --- /dev/null +++ b/private/ntos/nbt/vxd/cvxdfile.asm @@ -0,0 +1,186 @@ +;/**********************************************************************/ +;/** Microsoft Windows/NT **/ +;/** Copyright(c) Microsoft Corp., 1994 **/ +;/**********************************************************************/ + +;/* +; cvxdFile.asm +; +; Contains simple VXD File I/O routines (that use VxdInt 21h macro) +; for dhcp.bin support +; +; FILE HISTORY: +; madana 07-May-1994 Created +; koti 10-Oct-1994 Copied over/modified for vnbt +; +;*/ + + .386p + include vmm.inc + include v86mmgr.inc + include dosmgr.inc + include opttest.inc + include netvxd.inc + include debug.inc + include pageable.inc + +EXTRN _fInInit:DWORD +EXTRN _GetInDosFlag:NEAR + + +;**************************************************************************** +;** PushState Macro +; +; Saves the client state. +; +PushState MACRO + + push edi + push esi + push ebx + + mov ecx, 0 + VMMCall Begin_Critical_Section + +ENDM + +;**************************************************************************** +;** PopState Macro +; +; Restores client state. +; +PopState MACRO + + VMMCall End_Critical_Section + + pop ebx + pop esi + pop edi + +ENDM + +NBT_PAGEABLE_CODE_SEG + +;**************************************************************************** +;** _VxdFileOpen +; +; Opens a file +; +; Entry: [ESP+4] - Pointer to full path of file, path must be flat +; pointer. +; +; Exit: EAX will contain a handle to the openned file +; +BeginProc _VxdFileOpen + + PushState ; This pushes lots of crap + + mov edx, [esp+16] ; move flat pointer file name + mov eax, 3d02h ; Open file, read/write, share + + VxDInt 21h + + jc VFO_6 ; Carry set if error + jmp VFO_10 ; successful file open, eax has file handle + +VFO_6: +; Debug_Out "VxdFileOpen failed, error #EAX" + mov eax, 0 ; Failed to open the file + +VFO_10: + PopState + ret + +EndProc _VxdFileOpen + + +;**************************************************************************** +;** _VxdFileRead +; +; Reads x bytes from a previously openned file +; +; Entry: [ESP+4] - Handle from _VxdFileOpen +; [ESP+8] - Count of bytes to read +; [ESP+12]- flat pointer to destination buffer +; +; Exit: EAX will contain the number of bytes read, 0 if EOF or +; an error occurred. +; +BeginProc _VxdFileRead + + PushState ; Pushes lots of crap + + mov ebx, [esp+16] ; File Handle + mov ecx, [esp+20] ; Bytes to read + mov edx, [esp+24] ; flat buffer pointer + mov eax, 3f00h + + VxDInt 21h + + jc VFR_6 ; Carry set if error + jmp VFR_7 ; successful file open, eax has bytes read + +VFR_6: +; Debug_Out "VxdFileRead failed" + mov eax, 0 ; Failed to read the file +VFR_7: + PopState + ret + +EndProc _VxdFileRead + +;**************************************************************************** +;** _VxdFileClose +; +; Closes a file openned with VxdOpenFile +; +; Entry: [ESP+4] - Handle from _VxdFileOpen +; +BeginProc _VxdFileClose + + PushState ; Pushes lots of crap + + mov ebx, [esp+16] ; File Handle + mov eax, 3e00h + + VxDInt 21h + + jc VFCL_6 ; Carry set if error + jmp VFCL_7 ; successful set. + +VFCL_6: + Debug_Out "VxdFileClose - Read failed" + mov eax, 0 ; Failed to close the file +VFCL_7: + PopState + ret + +EndProc _VxdFileClose + +;**************************************************************************** +;** _VxdWindowsPath +; +; Gets a pointer to (null-terminated) path to the windows directory +; +; This is an Init time only routine +; +; Entry: nothing +; +; Exit: pointer to path to windows directory +; +BeginProc _VxdWindowsPath + PushState ; Pushes lots of crap + + VmmCall Get_Config_Directory + + mov eax, edx ; path is returned in edx + + PopState ; now pop all that crap + + ret + +EndProc _VxdWindowsPath + +NBT_PAGEABLE_CODE_ENDS + +END |