[75337] | 1 | ; $Id: VBoxSFUtilA.asm 75337 2018-11-09 01:39:01Z vboxsync $
|
---|
| 2 | ;; @file
|
---|
| 3 | ; VBoxSF - OS/2 Shared Folders Utility, Assembly code for calling 16-bit APIs.
|
---|
| 4 | ;
|
---|
| 5 |
|
---|
| 6 | ;
|
---|
| 7 | ; Copyright (c) 2007-2017 knut st. osmundsen <bird-src-spam@anduin.net>
|
---|
| 8 | ;
|
---|
| 9 | ; Permission is hereby granted, free of charge, to any person
|
---|
| 10 | ; obtaining a copy of this software and associated documentation
|
---|
| 11 | ; files (the "Software"), to deal in the Software without
|
---|
| 12 | ; restriction, including without limitation the rights to use,
|
---|
| 13 | ; copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
| 14 | ; copies of the Software, and to permit persons to whom the
|
---|
| 15 | ; Software is furnished to do so, subject to the following
|
---|
| 16 | ; conditions:
|
---|
| 17 | ;
|
---|
| 18 | ; The above copyright notice and this permission notice shall be
|
---|
| 19 | ; included in all copies or substantial portions of the Software.
|
---|
| 20 | ;
|
---|
| 21 | ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
| 22 | ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
| 23 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
| 24 | ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
| 25 | ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
| 26 | ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 27 | ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
| 28 | ; OTHER DEALINGS IN THE SOFTWARE.
|
---|
| 29 | ;
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | ;*********************************************************************************************************************************
|
---|
| 34 | ;* Header Files *
|
---|
| 35 | ;*********************************************************************************************************************************
|
---|
| 36 | %define RT_INCL_16BIT_SEGMENTS
|
---|
| 37 | %include "iprt/asmdefs.mac"
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | ;*********************************************************************************************************************************
|
---|
| 41 | ;* External symbols *
|
---|
| 42 | ;*********************************************************************************************************************************
|
---|
| 43 | BEGINCODE16
|
---|
| 44 | extern DOSQFILEMODE
|
---|
| 45 | IMPORT DOSQFILEMODE DOSCALLS 75
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | BEGINCODE
|
---|
| 49 | BEGINPROC CallDosQFileMode
|
---|
| 50 | push ebp
|
---|
| 51 | mov ebp, esp
|
---|
| 52 |
|
---|
| 53 | ;
|
---|
| 54 | ; Make a LSS frame to ease switching back the stack.
|
---|
| 55 | ;
|
---|
| 56 | push ss
|
---|
| 57 | push esp
|
---|
| 58 |
|
---|
| 59 | ;
|
---|
| 60 | ; Create the PASCAL stackframe.
|
---|
| 61 | ;
|
---|
| 62 |
|
---|
| 63 | ; Use tile algorithm to convert pointers.
|
---|
| 64 | mov eax, [ebp + 08h] ; PCSZ pszPath
|
---|
| 65 | ror eax, 16
|
---|
| 66 | shl ax, 3
|
---|
| 67 | or eax, 0007h
|
---|
| 68 | rol eax, 16
|
---|
| 69 | push eax
|
---|
| 70 |
|
---|
| 71 | ; Use the tiled algorithm to convert flat to 16:16 pointer.
|
---|
| 72 | mov ecx, [ebp + 0ch] ; PUSHORT pfAttrib
|
---|
| 73 | ror ecx, 16
|
---|
| 74 | shl cx, 3
|
---|
| 75 | or ecx, 0007h
|
---|
| 76 | rol ecx, 16
|
---|
| 77 | push ecx
|
---|
| 78 |
|
---|
| 79 | mov eax, [ebp + 10h] ; ULONG ulReserved
|
---|
| 80 | push eax
|
---|
| 81 |
|
---|
| 82 | ;
|
---|
| 83 | ; Convert the stack in the same manner.
|
---|
| 84 | ;
|
---|
| 85 | movzx edx, sp
|
---|
| 86 | mov eax, esp
|
---|
| 87 | shr eax, 16
|
---|
| 88 | shl eax, 3
|
---|
| 89 | or eax, 0007h
|
---|
| 90 | push eax
|
---|
| 91 | push edx
|
---|
| 92 | lss esp, [esp]
|
---|
| 93 |
|
---|
| 94 | ;jmp far dword .thunked_to_16bit wrt CODE16
|
---|
| 95 | db 066h
|
---|
| 96 | db 0eah
|
---|
| 97 | dw .thunked_to_16bit wrt CODE16
|
---|
| 98 | dw CODE16
|
---|
| 99 | BEGINCODE16
|
---|
| 100 | .thunked_to_16bit:
|
---|
| 101 | call far DOSQFILEMODE
|
---|
| 102 |
|
---|
| 103 | ;jmp far dword NAME(%i %+ _32) wrt FLAT
|
---|
| 104 | db 066h
|
---|
| 105 | db 0eah
|
---|
| 106 | dd .thunked_back_to_32bit ;wrt FLAT
|
---|
| 107 | dw TEXT32 wrt FLAT
|
---|
| 108 | BEGINCODE
|
---|
| 109 | .thunked_back_to_32bit:
|
---|
| 110 | lss esp, [ds:ebp - 8]
|
---|
| 111 | movzx eax, ax
|
---|
| 112 | leave
|
---|
| 113 | ret
|
---|
| 114 | ENDPROC CallDosQFileMode
|
---|
| 115 |
|
---|