debugsys.h
来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 1,732 行 · 第 1/4 页
H
1,732 行
// (EDX) = lin addr the PTE is
#define PMINIT_SET_ENTER_EXIT_VMM 0x4 // (EBX) = Enter VMM routine addr
// (ECX) = Exit VMM routine addr
// This routines must return
// with a retfd.
#define PMINIT_GET_SIZE_PHYS 0x5 // get debugger size/phys addr
// returns:
// AL = 0 (don't call AL=1)
// ECX = size in bytes
// ESI = starting phys addr
// if this call is ignored
// (AL = 5) then function 1 is
// called with a phys-linear
// region
#define PMINIT_SET_BASE_SPARE_PTE 0x6 // set debugger base/spare PTE
// EBX = laddr of spare PTE
// EDX = laddr the PTE represents
// ESI = starting linear address
#define PMINIT_ENABLE_MEMORY_CONTEXT 0x7 // enables mem context functions
#define PMINIT_MAX 0x7
/*
VCPI information, passed to debugger when client is DOS Extender
running as a VCPI client. This information is used to get into
and out of protected mode when running under a VCPI server.
This structure is also used by the DOS Extender.
*/
// Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
/*XLATOFF*/
struct WdebVCPIInfo {
// Enter protected mode information.
FWORD fnVCPI ; // VCPI protect mode server entry point
WORD rdsVCPI ; // Selector for VCPI server
// Enter v86 mode information.
DWORD laVTP ; // linear address of data structure containing
// values for system registers.
WORD Port67 ; // Qualitas magic port for emulating INT 67h
} ;
/*XLATON*/
/* ASM
WdebVCPIInfo STRUC
fnVCPI DF ?
rdsVCPI DW ?
laVTP DD ?
Port67 DW ?
WdebVCPIInfo ENDS
*/
/*
The following structure contains the system register contents for the
VCPI server to use when switching to protected mode. It is taken
from dxvcpi.inc in the DOSX project, and is part of the VCPI spec.
*/
struct VTP {
DWORD zaCr3VTP ; // physical addr of page directory
DWORD laGdtrVTP ; // linear addr in first meg of gdtr
DWORD laIdtrVTP ; // linear addr in first meg of idtr
WORD selLdtVTP ; // selector of ldt
WORD selTrVTP ; // selector of tr
WORD ipVTP ; // 48-bit address of protect
WORD unusedVTP ; // mode entry point to xfer to
WORD csVTP ; //
} ;
#define VCPI_RM_CALLOUT_INT 0x67 // v86 mode call to VCPI server
/*
Send this value in AX to the VCPI server to request V86 to protected
mode switch or protected to V86 mode switch.
*/
#define VCPI_PROT_ENTRY 0x0DE0C
/*****************************************************************************
Protected mode Debugger services:
*/
#define Debug_Serv_Int 0x41 // Interrupt that calls Deb386 to perform
// debugging I/O, AX selects the function as
// described by the following equates
#define DS_Out_Char 0x0 // function to display the char in DL
#define DS_In_Char 0x1 // function to read a char into AL
#define DS_Out_Str 0x2 // function to display a NUL terminated string
// pointed to by DS:ESI
#define DS_Is_Char 0x3 // Non blocking In_Chr
#define DS_Out_Str16 0x12 // function to display a NUL terminated string
// pointed to by DS:SI
// (same as function 2, but for 16 bit callers)
#define DS_ForcedGO16 0x40 // enter the debugger and perform the equivalent
// of a GO command to force a stop at the
// specified CS:IP
// CX is the desired CS
// BX is the desired IP
#define DS_LinkMap 0x45 // DX:(E)DI = ptr to paragraph in front of map
#define DS_UnlinkMap 0x46 // DX:(E)DI = ptr to paragraph in front of map
#define DS_CheckMap 0x47 // DX:(E)DI = pointer to module name
// returns AX != 0, map found
// AX == 0, map not found
#define DS_IsAutoLoadSym 0x48 // returns AX != 0, auto load symbols
// AX == 0, don't auto load symbols
#define DS_DebLoaded 0x4F // check to see if the debugger is installed and
// knows how to deal with protected mode programs
// return AX = F386h, if true
#define DS_DebPresent 0x0F386
#define DS_LoadSeg 0x50 // define a segment value for the
// debugger's symbol handling
// SI type 0 - code selector
// 1 - data selector
// 80h - code segment
// 81h - data segment
// BX segment #
// CX actual segment/selector
// DX data instance
// ES:(E)DI pointer to module name
// [PTrace]
#define DS_LoadSeg_32 0x0150 // Define a 32-bit segment for Windows 32
// SI type 0 - code selector
// 1 - data selector
// DX:EBX points to a D386_Device_Params STRUC
// with all the necessaries in it
#define DS_MoveSeg 0x51 // notify the debugger that a segment has moved
// BX old segment value
// CX new segment value
// [PTrace]
#define DS_FreeSeg 0x52 // notify the debugger that a segment has been
// freed
// BX segment value
// [PTrace]
#define DS_FreeSeg_32 0x0152 // notify the debugger that a segment has been
// freed
// BX segment number
// DX:EDI pointer to module name
#define DS_DGH 0x56 // register "dump global heap" handler
// BX is code offset
// CX is code segment
// [PTrace]
#define DS_DFL 0x57 // register "dump free list" handler
// BX is code offset
// CX is code segment
// [PTrace]
#define DS_DLL 0x58 // register "dump LRU list" handler
// BX is code offset
// CX is code segment
// [PTrace]
#define DS_StartTask 0x59 // notify debugger that a new task is starting
// BX is task handle
// task's initial registers are stored on the
// stack:
// push cs
// push ip
// pusha
// push ds
// push es
// push ss
// push sp
// [PTrace]
#define DS_Kernel_Vars 0x5a // Used by the Windows kernel to tell the
// debugger the location of kernel variables
// used in the heap dump commands.
// BX = version number of this data (03a0h)
// DX:CX points to:
// WORD hGlobalHeap ****
// WORD pGlobalHeap ****
// WORD hExeHead ****
// WORD hExeSweep
// WORD topPDB
// WORD headPDB
// WORD topsizePDB
// WORD headTDB ****
// WORD curTDB ****
// WORD loadTDB
// WORD LockTDB
// WORD SelTableLen ****
// DWORD SelTableStart ****
//
// The starred fields are used by the
// heap dump commands which are internal
// to WDEB386.
#define DS_VCPI_Notify 0x5b // notify debugger that DOS extender is
// running under a VCPI implementation,
// and register VCPI protect mode interface
// ES:DI points to a data structure used to
// get from V86 mode to Pmode under VCPI.
// This is defined in the VCPI version
// 1.0 spec.
#define DS_ReleaseSeg 0x5c // This does the same as a DS_FreeSeg, but
// it restores any breakpoints first.
// [PTrace]
#define DS_User_Vars 0x5d // DS:SI = pointer to an array of offsets:
// BX = windows version
// CX = number of words in array
// WORD = fDebugUser (1 = DEBUG, 0 = RETAIL)
// WORD = 16 bit offset to hHmenuSel
// WORD = 16 bit offset to hHwndSel
// WORD = 16 bit offset to pclsList
// WORD = 16 bit offset to pdceFirst
// WORD = 16 bit offset to hwndDesktop
// This array MUST BE COPIED it goes away
// when we return from this service.
#define DS_POSTLOAD 0x60 // Used by the RegisterPTrace interface
#define DS_EXITCALL 0x62 // Somebody will fill these in if we ever
#define DS_INT2 0x63 // figure out what they are supposed to do.
#define DS_LOADDLL 0x64
#define DS_DELMODULE 0x65
#define DS_LOGERROR 0x66 // CX==error code, dx:bx = ptr to optional info
#define DS_LOGPARAMERROR 0x67 // ES:BX = ptr to struct { err, lpfn, param } ;
#define DS_RIN 0x09
#define DS_BANKLINE 0x0A
#define DS_NEWTASK 0x0B
#define DS_FLUSHTASK 0x0C
#define DS_SWITCHOUT 0x0D
#define DS_SWITCHIN 0x0E
//#define DS_KEYBOARD 0x0F // Conflicts with DS_Out_Symbol
#define DS_IntRings 0x20 // function to tell debugger which INT 1's & 3's
// to grab
// BX == 0, grab only ring 0 ints
// BX != 0, grab all ints
#define DS_IncludeSegs 0x21 // function to tell debugger to go ahead and
// process INT 1's & 3's which occur in this
// DX:DI points to list of selectors
// (1 word per entry)
// CX = # of selectors (maximum of 20)
// CX = 0, to remove the list of segs
#define MaxDebugSegs 20
#define DS_CondBP 0x0F001 // conditional break pt, if the command line
// switch /B is given when the debugger is run
// or the conditional flag is later set, then
// this int should cause the program to break
// into the debugger, else this int should be
// ignored!
// ESI points to a nul terminated string to
// display if break is to happen.
#define DS_ForcedBP 0x0F002 // break pt, which accomplishes the same thing
// as an INT 1 or an INT 3, but is a break point
// that should be permanently left in the code,
// so that a random search of source code would
// not result in the accidental removal of this
// necessary break_pt
#define DS_ForcedGO 0x0F003 // enter the debugger and perform the equivalent
// of a GO command to force a stop at the
// specified CS:EIP
// CX is the desired CS
// EBX is the desired EIP
#define DS_HardINT1 0x0F004 // check to see if INT 1 hooked for all rings
// ENTER: nothing
// EXIT: AX = 0, if no, 1, if yes
#define DS_Out_Symbol 0x0F // find the symbol nearest to the address in
// CX:EBX and display the result in the format
// symbol name <+offset>
// the offset is only included if needed, and
// no CR&LF is displayed
#define DS_Disasm_Ins 0x10 // function to disassemble the instruction
// pointed to by DS:ESI
#define DS_JumpTableStart 0x70
/*** DS_RegisterDotCommand
This interface is used to register wdeb386 dot commands by FLAT 32
bit code. The following conditions apply:
* The code will be run at ring 0
* Interrupts may be enabled
* Must not access any invalid pages or load invalid selectors
* Must stay on the stack called with when calling INT 41 services
* Must not change DS or ES from the FLAT selector
The help text is printed when .? is executed in the order of
registration. The text must include CR/LF at the end; nothing
is added to the help text.
ENTRY: (AX) = 0070h
(BL) = dot command to register
(ESI) = linear address of dot command routine
Dot command routine:
ENTRY: (AL) = command character
(DS, ES) = flat data selector
EXIT: (AX) == 0, no errors
(AX) != 0, command line or option error
NOTE: MUST return with a 32 bit FAR return (retfd)
(EDI) = linear address of help text
EXIT: (AX) == 0, no errors
(AX) != 0, dot command already used or out of dot commands
*/
#define DS_RegisterDotCommand 0x70
/*** DS_RegisterDotCommand16
This interface is used to register wdeb386 dot commands by 16 bit
code. The following conditions apply:
* The code will be run at ring 0 or in real mode
* Interrupts may not be enabled
* Must not access any not present pages or load invalid selectors
* Must stay on the stack called with when calling INT 41 services
The help text is printed when .? is executed in the order of
registration. The text must include CR/LF at the end; nothing
is added to the help text.
ENTRY: (AX) = 0071h
(BL) = dot command to register
(CX:SI) = address of dot command routine
Dot command routine:
ENTRY: (AL) = command character
(DS, ES) = debugger's data selector
EXIT: (AX) == 0, no errors
(AX) != 0, command line or option error
NOTE: MUST return with a 16 bit FAR return (retf)
(DX:DI) = address of help text
EXIT: (AX) == 0, no errors
(AX) != 0, dot command already used or out of dot commands
*/
#define DS_RegisterDotCommand16 0x71
/*** DS_DeRegisterDotCommand
This interface is used to de-register wdeb386 dot commands registered
by the above 16 or 32 bit services. Care should be used not to
de-register dot commands that weren't registered by your code.
ENTRY: (AX) = 0072h
(BL) = dot command to de-register
EXIT: NONE
*/
#define DS_DeRegisterDotCommand 0x72
/*** DS_Printf
This function allows formatted output with the standard "C"
printf syntax.
ENTRY: (AX) = 0073h
(DS:ESI) = address of format string
(ES:EDI) = address of the start of the dword arguments
EXIT: (EAX) = number of characters printed
Supported types are:
%% %
%[l][h]c character
%[-][+][ ][0][width][.precision][l|h|p|n]d decimal
%[-][0][width][.precision][l|h|p|n]u unsigned decimal
%[-][#][0][width][.precision][l|h|p|n]x hex
%[-][#][0][width][.precision][l|h|p|n]X hex
%[-][0][width][.precision][l|h|p|n]o octal
%[-][0][width][.precision][l|h|p|n]b binary
%[-][width][.precision][l|h|a|F|R|P]s string
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]A address
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]S symbol
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]G group:symbol
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]M map:group:symbol
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]g group
%[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]m map
Where "width" or "precision" is a decimal number or the '*'
character; '*' causes the field width or precision to be picked
up from the next parameter. []'ed parameters are optional.
"\r", "\t", "\n", "\a", "\b", are supported directly.
Prefixes
--------
Used with c,d,u,x,X,o,b:
Parameter Argument Size
-----------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?