Hi Everybody,
I am trying to get Tdi Dispatch table on Windows 98.
But VTDI_Get_Info function is returning 0 in eax.
I have set Load order of my vxd properly so that it will be loaded
after vtdi.386. But what is the error I am not able to trace.
See some of my code as follows ------
Waiting for your comments.
Cheers
Rajesh
// ===== mytdi.h =====
#define VMM_Init_Order VMM_INIT_ORDER
#include <netvxd.h>
#define MYTDI_Major 1
#define MYTDI_Minor 0
#define MYTDI_DeviceID UNDEFINED_DEVICE_ID
#define MYTDI_Init_Order (0xF000 + VTDI_Init_Order)
//===== mytdi.c =======
// function in xmytdi.asm file
extern DWORD __stdcall Hook_TdiDispatchTable () ;
// Device parameters
Declare_Virtual_Device(MYTDI)
// Declare prototypes for control message handlers
DefineControlHandler(DEVICE_INIT, OnDeviceInit) ;
// This is the control message dispatcher
BOOL ControlDispatcher(
DWORD dwControlMessage,
DWORD EBX,
DWORD EDX,
DWORD ESI,
DWORD EDI,
DWORD ECX)
{
START_CONTROL_DISPATCH
ON_DEVICE_INIT(OnDeviceInit) ;
END_CONTROL_DISPATCH
return TRUE;
}
// This is the handler for control message DEVICE_INIT
BOOL OnDeviceInit(VMHANDLE hVM, PCHAR CommandTail)
{
dprintf (“OnDeviceInit: Before Hook_TdiDispatchTable\n”) ;
Hook_TdiDispatchTable () ;
dprintf (“OnDeviceInit: After Hook_TdiDispatchTable\n”) ;
return TRUE ;
}
VOID__stdcall MyDbgPrint (PCHAR s)
{
dprintf (“MyTdi: %s\n”, s) ;
}
VOID __stdcall MyDbgPrintInt (int dwAddr)
{
dprintf (“%08X\n”, dwAddr) ;
}
//===== xmytdi.asm =======
VTDI_Device_ID equ 0488h
INCLUDE VTDI.INC
//
// functions declaraed in mytdi.c
//
EXTSFUNC MyDbgPrint, 4
EXTSFUNC MyDbgPrintInt, 4
VxD_LOCKED_DATA_SEG
TCPName db ‘MSTCP’, 0
TdiDispatchTable dd 0
dbgHKDisp db “Hook_TdiDispatchTable Called.”, 0
dbgHKDisp1 db “Hook_TdiDispatchTable Success.”, 0
dbgHKDisp0 db “Hook_TdiDispatchTable Failed.”, 0
dbgDisp db "TdiDispatch Table : ", 0
VxD_LOCKED_DATA_ENDS
VxD_LOCKED_CODE_SEG
DEFSPROC Hook_TdiDispatchTable
; Make sure VTDI is present
push offset32 dbgHKDisp
call MyDbgPrint ; this function prints passed string
VxDcall VTDI_Get_Version
jc Abort
; Get a pointer to the TCP dispatch table
push offset32 TCPName
VxDcall VTDI_Get_Info
add esp, 4
mov TdiDispatchTable, eax ; Save the address of TdiDispatchTable
push offset32 dbgDisp
call MyDbgPrint
push eax
call MyDbgPrintInt
cmp eax, 0
je Abort
push offset32 dbgHKDisp1
call MyDbgPrint
ret
Abort :
push offset32 dbgHKDisp0
call MyDbgPrint
ret
ENDSPROC Hook_TdiDispatchTable
VXD_LOCKED_CODE_ENDS
End</netvxd.h>