| 1 | ; $Id: vddentry.asm,v 1.3 2001/03/22 18:13:01 sandervl Exp $
|
|---|
| 2 |
|
|---|
| 3 | .386
|
|---|
| 4 | .seq
|
|---|
| 5 |
|
|---|
| 6 | include ..\include\segments.inc
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | _TEXT SEGMENT DWORD PUBLIC USE16 'CODE'
|
|---|
| 10 | assume cs:cgroup, ds:dgroup
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | ; Route VDD IDC request to C code to implement
|
|---|
| 14 | ; 16:16 entry from 16:32 caller
|
|---|
| 15 | ;
|
|---|
| 16 | ; Called from VDD using pascal calling conventions:
|
|---|
| 17 | ; Parms pushed left to right, callee clears the stack
|
|---|
| 18 | ;
|
|---|
| 19 | ulFunc EQU DWORD PTR [bp+18] ; Pascal conventions push parms left to right
|
|---|
| 20 | ul1 EQU DWORD PTR [bp+14] ; 8 bytes for 16:32 far return address
|
|---|
| 21 | ul2 EQU DWORD PTR [bp+10] ; 2 bytes for save of callers stack frame ptr
|
|---|
| 22 |
|
|---|
| 23 | PUBLIC IDCENTRY_VDD
|
|---|
| 24 | EXTERN IDCENTRY_VDD_C:near
|
|---|
| 25 | IDCENTRY_VDD PROC FAR ; 16:16 entry from 16:32 ; VDD calls PDD
|
|---|
| 26 | push bp
|
|---|
| 27 | mov bp, sp
|
|---|
| 28 | push ds
|
|---|
| 29 | push es
|
|---|
| 30 | mov ax, seg _DATA
|
|---|
| 31 | push ulFunc ; pascal calling convention
|
|---|
| 32 | mov ds, ax
|
|---|
| 33 | push ul1
|
|---|
| 34 | push ul2
|
|---|
| 35 | call IDCENTRY_VDD_C
|
|---|
| 36 | shl edx, 16 ; Move DX:AX return value
|
|---|
| 37 | movzx eax, ax ; into eax
|
|---|
| 38 | pop es
|
|---|
| 39 | pop ds
|
|---|
| 40 | or eax, edx
|
|---|
| 41 | leave
|
|---|
| 42 | db 66h ; Force next instruction 32-bit
|
|---|
| 43 | ret 12 ; 16:32 far return, pop parms
|
|---|
| 44 | IDCENTRY_VDD ENDP
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | usCmd EQU WORD PTR [bp+10] ; cdecl conventions push parms right to left
|
|---|
| 50 | pPacket EQU DWORD PTR [bp+14] ; 8 bytes for 16:32 far return address
|
|---|
| 51 |
|
|---|
| 52 | PUBLIC _OSSIDC_ENTRY
|
|---|
| 53 | EXTERN OSSIDC_ENTRYPOINT:near
|
|---|
| 54 | _OSSIDC_ENTRY PROC FAR ; 16:16 entry from 16:32 ; called from 32 bits pdd
|
|---|
| 55 | push bp
|
|---|
| 56 | mov bp, sp
|
|---|
| 57 | push ds
|
|---|
| 58 | push es
|
|---|
| 59 | mov ax, seg _DATA
|
|---|
| 60 | push usCmd ; pascal calling convention
|
|---|
| 61 | mov ds, ax
|
|---|
| 62 | push pPacket
|
|---|
| 63 | call OSSIDC_ENTRYPOINT
|
|---|
| 64 | shl edx, 16 ; Move DX:AX return value
|
|---|
| 65 | movzx eax, ax ; into eax
|
|---|
| 66 | pop es
|
|---|
| 67 | pop ds
|
|---|
| 68 | or eax, edx
|
|---|
| 69 | leave
|
|---|
| 70 | db 66h ; Force next instruction 32-bit
|
|---|
| 71 | ret ; 16:32 far return
|
|---|
| 72 | _OSSIDC_ENTRY ENDP
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | ; hook procedure is called with parameter in EAX
|
|---|
| 77 | ; we only need the lower part ...
|
|---|
| 78 |
|
|---|
| 79 | ; PUBLIC HookHandlerAsm_
|
|---|
| 80 | ; EXTERN _HookHandler:near
|
|---|
| 81 | ;HookHandlerAsm_ PROC FAR
|
|---|
| 82 | ; pushad
|
|---|
| 83 | ; push ds
|
|---|
| 84 | ; push es
|
|---|
| 85 | ; mov bx, seg _DATA
|
|---|
| 86 | ; mov ds, bx
|
|---|
| 87 | ; push ax
|
|---|
| 88 | ; call _HookHandler
|
|---|
| 89 | ; add sp, 2
|
|---|
| 90 | ; pop es
|
|---|
| 91 | ; pop ds
|
|---|
| 92 | ; popad
|
|---|
| 93 | ; retf
|
|---|
| 94 | ;HookHandlerAsm_ ENDP
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | ; hook procedure is called with parameter in EAX
|
|---|
| 99 | ; since we use a pointer to a WAVESTREAM instance
|
|---|
| 100 | ; here, we can directly call WAVESTREAM::Process
|
|---|
| 101 |
|
|---|
| 102 | PUBLIC ProcessHookStub_
|
|---|
| 103 | EXTERN `W?Process$:WAVESTREAM$n()v`:near
|
|---|
| 104 | ProcessHookStub_ PROC FAR
|
|---|
| 105 | pushad
|
|---|
| 106 | push ds
|
|---|
| 107 | push es
|
|---|
| 108 | mov bx, seg _DATA
|
|---|
| 109 | mov ds, bx
|
|---|
| 110 | call `W?Process$:WAVESTREAM$n()v` ; AX: pointer to WAVESTREAM instance
|
|---|
| 111 | pop es
|
|---|
| 112 | pop ds
|
|---|
| 113 | popad
|
|---|
| 114 | retf
|
|---|
| 115 | ProcessHookStub_ ENDP
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 | ; PUBLIC _inpd
|
|---|
| 121 | ;_inpd proc near
|
|---|
| 122 | ; in eax, dx
|
|---|
| 123 | ; mov dx, ax
|
|---|
| 124 | ; shr eax, 16
|
|---|
| 125 | ; xchg dx, ax
|
|---|
| 126 | ; ret
|
|---|
| 127 | ;_inpd endp
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | ; PUBLIC _outpd
|
|---|
| 132 | ;_outpd proc near
|
|---|
| 133 | ; mov ax, cx
|
|---|
| 134 | ; shl eax, 16
|
|---|
| 135 | ; mov ax, bx
|
|---|
| 136 | ; out dx, eax
|
|---|
| 137 | ; ret
|
|---|
| 138 | ;_outpd endp
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 | _TEXT ENDS
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | END
|
|---|
| 146 |
|
|---|