debugsys.h
来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 1,732 行 · 第 1/4 页
H
1,732 行
on output, ZR if no chars, else NZ and AL == char
ENTRY: (AX) = 008bh
(DX:EDI) == 16:32 address to call, with BX == subfunction above
EXIT: NONE
*/
#define DS_InstallVGAHandler 0x8b
/*** DS_GetComBase
Called when Debug VxD is initializing (during Device Init),
to get the base of the com port being used by wdeb386.
Entry:
(AX) == 008ch
Exit:
(AX) = base of COM port.
*/
#define DS_GetComBase 0x8c
/*** DS_GetSymbol
Looks up a symbol and returns the linear address and segment/offset.
ENTRY: (AX) == 008dh
(DS:ESI) = ptr to null-terminated symbol
EXIT: (AX) == 0, no error
(AX) == 1, symbol not found
(AX) == 2, memory not loaded yet
(ECX) = linear address of variable (if AX == 0)
(EDX) = seg:offset of variable (if AX == 0)
*/
#define DS_GetSymbol 0x8d
/*** DS_CopyMem
Copys memory from one AddrS to another AddrS
ENTRY: (AX) == 008eh
(DS:ESI) = pointer to source AddrS block
(ES:EDI) = pointer to destination AddrS block
(CX) = number of bytes
EXIT: (AX) == 0, no error
(AX) != 0, invalid address
*/
#define DS_CopyMem 0x8e
#ifdef WDEB98
#define DS_Reserved0 0x8f
#define DS_IsCompatibleWDeb 0x90
/*** DS_IsCompatibleWDeb
Used to determine WDeb version.
ENTRY: (AX) = 0090h
(BX) = WDeb version, major version in hiword, minor version
in low word. For example:
BH == 98T BL == 0
EXIT: (AX) == 0, version is supported,
(AX) != 0, version is not supported
*/
#define DS_SetBaudRateEx 0x91
/*** DS_SetBaudRateEx
Sets the com port's baud rate. Supports >57600kbps
Only available on WDEB98 and up
ENTRY: (AX) = 0091h
(EBX) = baud rate
EXIT: EBX == 0, no error
EBX != 0, error or not supported function (try DS_SetBaudRate)
*/
#define DS_GetSetDebuggerState 0x92
/*** DS_GetSetDebuggerState
This function can be used to temporarily change the state of the
debugger (this function might be called if the comm port were about
to turn off or on).
ENTRY: (AX) = 0092h
(BX) = Debugger State:
0 == No state change will occur if this value is used. Use this
value to retrieve the current state of the debugger.
1 == Debugger is on and responds to all faults, CTRL-C attempts,
comm port input requests, and comm port output requests.
2 == Debugger does not respond to traps, but still responds to all
CTRL-C attempts, comm port input requests, and comm port
output requests. This means the Windows Debug Kernel
"Abort, Retry, ..." messages will still work, but no Win32
or Ring0 assertions will stop the machine.
3 == Debugger does not respond to traps, or CTRL-C attempts. Comm
port input requests, and comm port input and output requests
are honored still, as above.
4 == Debugger does not respond to traps, or CTRL-C attempts, or
comm port input requests. Only comm port output requests are
processed.
5 == Debugger does not respond to traps, CTRL-C attempts,
comm port input requests, or comm port output requests. The
debugger is essentially "silent". Most other API calls
(DS_LoadSeg, DS_EvaluateExpression, etc) are still supported.
EXIT: AX == 0, if successful. BX is the new state.
AX != 0, not successful
*/
#define DS_TestDebugComPort 0x93
/*** DS_TestDebugComPort
This function determines whether the passed in port range is in
use by WDEB98, and determines the state of Rterm98 on the other
end of the port. Calling this function can also allow "late" binding
on WDeb to a com port (useful if the OS needs to "turn on" the
port range first.) If this function finds an Rterm98, an implicit
call to DS_GetSetDebuggerState with BX==1 is made.
ENTRY: (AX) = 0093h
(BX) = Port range to test (3F8, 2F8, etc)
(CX==0) - If WDeb has not found it's com port yet (ie, the
port is set to auto, or was not available at boot
time), WDeb can acquire this port. In the case of
auto port selection, this port will be acquired
only if Rterm98 is detected on the other side.
(CX==1) - WDeb will _not_ take this com port if it does not
already have one.
EXIT: (AX) != 0, API error (for example, called on WDeb386)
(AX) == 0, then...
(BH==0) - Debugger is not on this port.
(BL==0) - Debugger is on another port already
(BL==1) - Debugger does not have a port yet.
(BL==2) - Debugger could not initialize this port
(BL==3) - Debugger could not find an Rterm98 on this port.
(BH==1) - Debugger is using this port
(BL==0) - Rterm98 cannot be found, or not responding.
(BL==1) - Rterm98 version is too old.
(BL==2) - WDeb98 version is too old.
(BL==3) - Rterm present and fully compatible.
*/
#define DS_Reserved4 0x94
#define DS_Reserved5 0x95
#define DS_Reserved6 0x96
#define DS_Reserved7 0x97
#define DS_Reserved8 0x98
#define DS_Reserved9 0x99
#define DS_Reserved10 0x9A
#define DS_Reserved11 0x9B
#define DS_Reserved12 0x9C
#define DS_Reserved13 0x9D
#define DS_Reserved14 0x9E
#define DS_Reserved15 0x9F
/*** DS_InstallVxDThunk
Installs a private callback for WDeb98 and it's accompanying VxD.
This routine is the 16 -> 32 bit portion of the thunk layer.
ENTRY: (AX) = 00A0h
(DX:EDI) == 16:32 address to call
BUGBUG: DOC this better!
*/
#define DS_InstallVxDThunk 0xA0
/*** DS_ThunkDownTo16
Entry into a private callback into 16bit WDeb98 for it's VxD.
This int is the 32 -> 16 bit portion of the thunk layer.
ENTRY: (AX) = 00A1h
BUGBUG: DOC this better!
*/
#define DS_ThunkDownTo16 0xA1
#define DS_JumpTableEnd 0xA1
#else // WDEB98
#define DS_JumpTableEnd 0x8e
#endif // WDEB98
struct SaveRegs_Struc {
DWORD Debug_EAX ;
DWORD Debug_EBX ;
DWORD Debug_ECX ;
DWORD Debug_EDX ;
DWORD Debug_ESP ;
DWORD Debug_EBP ;
DWORD Debug_ESI ;
DWORD Debug_EDI ;
WORD Debug_ES ;
WORD Debug_SS ;
WORD Debug_DS ;
WORD Debug_FS ;
WORD Debug_GS ;
DWORD Debug_EIP ;
WORD Debug_CS ;
DWORD dwReserved ;
DWORD Debug_EFlags ;
DWORD Debug_CR0 ;
QWORD Debug_GDT ;
QWORD Debug_IDT ;
WORD Debug_LDT ;
WORD Debug_TR ;
DWORD Debug_CR2 ;
DWORD Debug_CR3 ;
DWORD Debug_DR0 ;
DWORD Debug_DR1 ;
DWORD Debug_DR2 ;
DWORD Debug_DR3 ;
DWORD Debug_DR6 ;
DWORD Debug_DR7 ;
DWORD Debug_DR7_2 ;
DWORD Debug_TR6 ;
DWORD Debug_TR7 ;
WORD Debug_TrapNumber ; // -1 means no trap number
WORD Debug_ErrorCode ; // 0 means no error code
} ;
// Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
/*XLATOFF*/
struct DebInfoBuf {
BYTE DIB_MajorVersion ;
BYTE DIB_MinorVersion ;
BYTE DIB_Revision ;
BYTE DIB_Reserved ;
DWORD DIB_DebugTrap16 ; // send 16 bit trap to debugger
FWORD DIB_DebugTrap32 ; // send 32 bit trap to debugger
DWORD DIB_DebugBreak16 ; // 16 bit break in debugger
FWORD DIB_DebugBreak32 ; // 32 bit break in debugger
DWORD DIB_DebugCtrlC16 ; // 16 bit check for ctrl C
FWORD DIB_DebugCtrlC32 ; // 32 bit check for ctrl C
} ;
/*XLATON*/
/* ASM
DebInfoBuf STRUC
DIB_MajorVersion DB ?
DIB_MinorVersion DB ?
DIB_Revision DB ?
DIB_Reserved DB ?
DIB_DebugTrap16 DD ?
DIB_DebugTrap32 DF ?
DIB_DebugBreak16 DD ?
DIB_DebugBreak32 DF ?
DIB_DebugCtrlC16 DD ?
DIB_DebugCtrlC32 DF ?
DebInfoBuf ENDS
*/
struct BreakStruc {
DWORD BS_BreakEIP ; // CS:EIP, SS:ESP to go to on a error or ctrlc break
WORD BS_BreakCS ;
DWORD BS_BreakESP ;
WORD BS_BreakSS ;
} ;
// Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
/*XLATOFF*/
struct RedirectExecStruc {
FWORD RDE_fpbufDebugCommand ; // debugger command script
WORD RDE_cbDebugCommand ; // debugger command script len
FWORD RDE_fpszInput ; // input stream pointer
WORD RDE_usFlags ; // reserved (must be 0)
DWORD RDE_cbOutput ; // size of output buffer
FWORD RDE_fpbufOutput ; // output buffer pointer
} ;
/*XLATON*/
/* ASM
RedirectExecStruc STRUC
RDE_fpbufDebugCommand DF ?
RDE_cbDebugCommand DW ?
RDE_fpszInput DF ?
RDE_usFlags DW ?
RDE_cbOutput DD ?
RDE_fpbufOutput DF ?
RedirectExecStruc ENDS
*/
#define REPEAT_FOREVER_CHAR 0x0fe // send next character until
// end of debugger command
// for printf service
struct AddrS {
DWORD AddrOff ;
WORD AddrSeg ;
BYTE AddrType ;
BYTE AddrSize ;
WORD AddrTask ;
} ;
//AddrTypeSize equ word ptr AddrType
#define EXPR_TYPE_SEG 0x0001 // 00000001b address type segment:offset
#define EXPR_TYPE_SEL 0x0009 // 00001001b address type selector:offset
#define EXPR_TYPE_LIN 0x0002 // 00000010b address type linear
#define EXPR_TYPE_PHY 0x000A // 00001010b address type physical
#define EXPR_TYPE_LOG 0x0008 // 00001000b logical address (no sel yet)
#define EXPR_TYPE_MOD 0x000B // 00001011b module address (no sel yet)
#define DEBUG_FAULT_TYPE_V86 0x0001 // 00000001b
#define DEBUG_FAULT_TYPE_PM 0x0002 // 00000010b
#define DEBUG_FAULT_TYPE_RING0 0x0004 // 00000100b
#define DEBUG_FAULT_TYPE_FIRST 0x0008 // 00001000b
#define DEBUG_FAULT_TYPE_LAST 0x0010 // 00010000b
//
// Interrupt and services that Win386 provides to the debugger
//
#define Win386_Query_Int 0x22 // interrupt for Win386 protected mode
// interface requests
#define Win386_Alive 0 // function 0, query Win386 installation
#define Win386_Q_Ack 0x0F386 // good response from func 43h, of
// INT 68h & func 4fh of INT 41h
#define Win386_Query 1 // function 1, query Win386 state
// ds:esi points to command string
// that Win386 needs to process
// ds:edi points to the SaveRegs_Struc
// that the debugger has stored all the
// client register state into.
// (Win386 just writes the query
// answers directly to the output
// device, so no response is returned)
#define Win386_PhysToLinr 2 // function 2, have Win386 convert a
// physical address into a valid
// linear address that Deb386 can
// use. esi is physicaladdress
// cx is # of bytes required
// returns esi as linear address
// returns ax = 1, if okay, else
// 0, if request couldn't be completed
#define Win386_AddrValid 3 // function 3, have Win386 check the
// validity of a linear address
// esi is linear address to check
// cx is # of bytes required
// returns ax = 1, if address okay
// else ax = 0
#define Win386_MapVM 4 // function 4, make sure that the VM's
// low memory is mapped in, in case
// it is touched (a count is maintained)
#define Win386_UnmapVM 5 // function 5, map out the VM's low
// memory (dec the count)
#define Win386_GetDLAddr 6 // function 6, return offset of dyna-link
// service. EBX = Device ID << 10h +
// Service #. Returns EAX = Offset.
#define Win386_GetVXDName 7 // function 7, determines whether an address
// is within a VXD object.
// DS:ESI -> buffer to receive object name
// BX = thread number
// EDX = linear address to query
// If EAX == 0, EDX = base address of object
// If EAX != 0, error
#define Win386_GetPDE 8 // function 8, get pde for a context
// BX = thread number
// EDX = linear address
// if EAX == 0, ECX = PDE
// if EAX != 0, error
#define Win386_GetFrame 9 // function 9, get phys addr for not pres ptes
// BX = thread number
// EDX = linear address
// ECX = PDE or PTE
// ESI = 0 if PDE, !0 if PTE
// if EAX == 0, EDX = physical address
// if EAX != 0, error
#define Win386_GetLDTAddress 10 // function 10,
// BX = thread number
// if EAX == 0,
// EDI = pointer to LDT
// ECX = ldt limit
// if EAX != 0, error
#define Win386_GetThreadID 11 // function 11, AX = Current Thread ID
#define Win386_GetTSHandler 12 // function 12, return offset of transfer-space
// fault handler. EBX = 16:16 addr of
// int 30h. Returns EAX = Offset or 0.
#define Win386_GetArplHandler 13 // function 12, return offset of ARPL fault
// fault handler. Eb = 16:16 addr of
// ARPL. Returns EAX = Offset or 0.
#define Max_Win386_Services 13
#endif // _DEBUGSYS_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?