debugsys.h

来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 1,732 行 · 第 1/4 页

H
1,732
字号
       word                                    h
       dword                                   l

       Used with s,A,S,G,M,g,m:

       Address Argument Size
       ---------------------
       16 bit DS relative                      h
       16:16 segment:offset                    hF or Fh
       32 bit flat relative                    l
       16:32 segment:offset (2 dwords)         lF or Fl
       pointer to AddrS structure              a
       segment is a real mode segment          R
       segment is a protected mode selector    P

       Default segment type is the current code type.

       Used with A,S,G,M,g,m:

       Address Display Size or Format
       ------------------------------
       16 bit offset                           H
       32 bit offset                           L
       offset only                             N
       no address                              Z

       Default display size depends on the "386env" flag setting.

       Used with S,G,M,g,m:

       gets the previous symbol                p
       gets the next symbol                    n

       Used with A:

       gets the previous symbol address        p
       gets the next symbol address            n

       Used with d,u,x,X,o,b:

       gets the previous symbol offset         p
       gets the next symbol offset             n
*/

#define DS_Printf               0x73

/***     DS_Printf16

       This function allows formatted output with the standard "C"
       printf syntax.

       ENTRY:  (AX) = 0074h
               (DS:SI) = address of format string
               (ES:DI) = address of the start of the word or dword arguments

       EXIT:   (AX) = number of characters printed

       The format options and parameters are the same as DS_Printf except
       the default parameter size is a word (the h option is implicit).
*/

#define DS_Printf16             0x74

/***     DS_GetRegisterSet

       This function copies the current register set.

       ENTRY:  (AX) = 0075h
               (DS:ESI) = address of SaveRegs_Struc structure

       EXIT:   NONE
*/

#define DS_GetRegisterSet       0x75

/***     DS_SetAlternateRegisterSet

       This function temporary sets the debugger's registers to values
       passed in the structure.  If an "r" command is executed or the
       debugged code is returned to (via the "g", "t" or "p" commands),
       the register set reverts to the debugged code's registers.

       ENTRY:  (AX) = 0076h
               (CX) = thread ID, 0 use current thread ID
               (DS:ESI) = address of SaveRegs_Struc structure

       EXIT:   NONE
*/

#define DS_SetAlternateRegisterSet 0x76

/***     DS_GetCommandLineChar

       This services gets the next character off the command line.

       ENTRY:  (AX) = 0077h
               (BL) = 0 just peek the character, don't increment text pointer
                        leading white space isn't ignored
               (BL) = 1 get the character, increment text pointer
                        leading white space is skipped
               (BL) = 2 peek the character, don't increment text pointer
                        leading white space is skipped

       EXIT:   (AL) = command line character
               (AH) == 0 if no more characters (EOL)
               (AH) != 0 if more characters
*/

#define DS_GetCommandLineChar   0x77

/***     DS_EvaluateExpression

       Expressions can be numbers of various radices, symbols, addresses
       or an combination of the above hooked together with various
       operators.  Expressions are separated by blanks or commas.  This
       function is passed a pointer to the beginning of the text of the
       expression (i.e. "%80003444+4232").  The expression is either
       evaluated down into a dword value if there are no addresses or
       into a linear address.

       ENTRY:  (AX) = 0078h

       EXIT:   (AX) == 0, returning a data value
               (AX) != 0, returning a linear address
               (CX) = thread id
               (EBX) = return value

       NOTE:   If the expression is invalid, this service will not
               return.  A message is printed and control returns to
               the command loop.
*/

#define DS_EvaluateExpression   0x78

/***     DS_VerifyMemory

       ENTRY:  (AX) = 0079h
               (ECX) = length of memory region
               (DS:ESI) = address of memory to verify

       EXIT:   (AX) == 0, no errors
               (AX) != 0, invalid memory
*/

#define DS_VerifyMemory         0x79

/***     DS_PrintRegisters

       This function prints (just like the "r" command) the either the
       debugged code's registers or the alternate register set, set with
       DS_SetAlternateRegisterSet function.

       ENTRY:  (AX) = 007ah

       EXIT:   NONE

       NOTE:   If the CS:EIP is invalid, this service will not return
               because of an error when the code is disassembled.  A
               message is printed and control returns to the command loop.
*/

#define DS_PrintRegisters       0x7a

/***     DS_PrintStackDump

       This function prints (just like the "k" command) the stack dump
       based on the current register set that may have been set with
       DS_SetAlternateRegisterSet function.

       ENTRY:  (AX) = 007bh
               (BX) = flags
                       01h - verbose stack dump
                       02h - 16 bit stack dump
                       04h - 32 bit stack dump

       EXIT:   NONE

       NOTE:   If the CS:EIP or SS:EBP are invalid, this service will not
               return because of an error when accessing the stack.  A
               message is printed and control returns to the command loop.
*/

#define DS_PrintStackDump       0x7b

/***     DS_SetThreadID

       This function sets what the debugger thinks the thread ID is
       for memory address in other address contexts.  It stays set
       until the debugged code is returned to (via "g", "t" or "p")
       or set back to 0.

       ENTRY:  (AX) = 007ch
               (CX) = thread ID or 0 for currently executed thread

       EXIT:   NONE
*/

#define DS_SetThreadID          0x7c

/***     DS_ExecDebugCommand

       This service allows any debugger command to be executed.  In can
       be a multi-lined script with the lines separated by CR, LF.  MUST
       have a "g" command at the end of script so the debugger doesn't
       stop while in the INT 41.

       ENTRY:  (AX) = 007dh
               (DS:ESI) = pointer to debugger command script string
               (CX) = size of script

       EXIT:   NONE

       NOTE:   If the any kind of error happens, this service will not
               return.  A message is printed and control returns to the
               command loop.
*/

#define DS_ExecDebugCommand     0x7d

/***     DS_GetDebuggerInfo

       This service returns various debugger info and routines.

       ENTRY:  (AX) = 007eh
               (DS:ESI) = pointer to DebInfoBuf structure
               (ECX) = size of the above buffer.  Only this many bytes are
                       copied to the buffer this allows more info to be
                       passed in future versions without breaking anything.

       EXIT:   (AX) == 0, no errors
               (AX) != 0, error:   (AX) == 007eh, function not implemented
                                   (AX) == anything else, invalid buffer
*/

#define DS_GetDebuggerInfo      0x7e

/***     DS_CheckFault

       This service checks if the debugger wants control on the fault.

       ENTRY:  (AX) = 007fh
               (BX) = fault number
               (CX) = fault type mask
                       DEBUG_FAULT_TYPE_V86
                       DEBUG_FAULT_TYPE_PM
                       DEBUG_FAULT_TYPE_RING0
                       DEBUG_FAULT_TYPE_FIRST
                       DEBUG_FAULT_TYPE_LAST

       EXIT:   (AX) == 0, handle fault normally
               (AX) != 0, handled by debugger
*/

#define DS_CheckFault           0x7f

/***     DS_SetBreak

       This service allows an error break or ctrl-c handler to be
       set.  The old value that is returned must be save and set
       back to remove the break handler.

       ENTRY:  (AX) = 0080h
               (DS:ESI) = pointer to BreakStruc with the CS:EIP and
               SS:ESP values to be used when a error break or ctrl-c
               happens.  The old value is copied into this buffer.

       EXIT:   (AX) == 0, no error
               (AX) != 0, error on BreakStruc address
*/

#define DS_SetBreak             0x80

/***     DS_RedirectExec

       This service redirects the input and output streams to the
       specified buffers for the debugger command line passed.

       ENTRY:  (AX) = 0081h
               (DS:ESI) = pointer to RedirectExecStruc

       EXIT:   (ECX) = number of bytes written
               (AX) == 0, no error
               (AX) != 0, error
                       1 to 10 = memory access error
                       -1      = buffer overflow
                       -2      = invalid parameter, not on a 386, or reentered
*/

#define DS_RedirectExec         0x81

/***     DS_PassOnDebugCommand

       Used to tell the debugger to pass this dot command on to the
       next handler.

       ENTRY:  (AX) = 0082h

       EXIT:   NONE
*/

#define DS_PassOnDebugCommand   0x82

/***     DS_TrapFault

       Allows ring 3 code to send a fault to the debugger

       ENTRY:  (AX) = 0083h
               (BX) = fault number
               (CX) = faulting CS
               (EDX) = faulting EIP
               (ESI) = fault error code
               (EDI) = faulting flags

       EXIT:   (CX) = replacement CS
               (EDX) = replacement EIP
*/

#define DS_TrapFault            0x83

/***     DS_SetStackTraceCallBack

       Sets the "k" command callback filter used to back trace
       thru thunks.

       ENTRY:  (AX) = 0084h
               (EBX) = linear address of call back routine, zero to uninstall
               (ECX) = linear address of the end of the call back routine
               (EDX) = EIP to use for for faults in call back routine

       EXIT:   NONE

       CALLBACK:
               ENTRY:  (EAX) = linear base of SS
                       (EBX) = linear address of SS:EBP
                       (DS, ES) = flat ds
                       (SS) = NOT flat ds !!!!!!!!!

               EXIT:   (EAX) = FALSE, no thunk
                               TRUE, is a thunk
                                       (CX:ESI) = new SS:EBP
                                       (DX:EDI) = new CS:EIP
*/

#define DS_SetStackTraceCallBack 0x84

/***     DS_RemoveSegs

       Removes all the undefined groups from a map file.

       ENTRY:  (AX) = 0085h
               (ES:EDI) pointer to module name

       EXIT:   NONE
*/

#define DS_RemoveSegs            0x85

/***     DS_DefineDebugSegs

       Defines the debugger's code and data symbols.

       ENTRY:  (AX) = 0086h

       EXIT:   NONE
*/

#define DS_DefineDebugSegs       0x86

/***     DS_SetBaudRate

       Sets the com port's baud rate.
       Use DS_SetBaudRateEx to get 115200bps (only on WDEB98 and up)

       ENTRY:  (AX) = 0087h
               (BX) = baud rate

       EXIT:   NONE
*/

#define DS_SetBaudRate           0x87

/***     DS_SetComPort

       Sets the com port's baud rate

       ENTRY:  (AX) = 0088h
               (BX) = com port number

       EXIT:   (AX) == 0, ok
               (AX) != 0, error bad com port
*/

#define DS_SetComPort            0x88

/***     DS_ChangeTaskNum

       Changes a task number to another task number or
       indicates that the task has gone away.

       ENTRY:  (AX) = 0089h
               (CX) = old task number
               (DX) = new task number or -1 if process terminated.

       EXIT:   NONE
*/

#define DS_ChangeTaskNum         0x89

/***     DS_ExitCleanup

       Called when Windows exits.

       ENTRY:  (AX) = 008ah

       EXIT:   NONE
*/

#define DS_ExitCleanup           0x8a

/***     DS_InstallVGAHandler

       Called when the Debug VxD is initializing (during Device Init),
       to specify an alternate I/O handler for VGA.  The handler accepts the
       following inputs:

           BX == subfunction #:
                   0 == save screen state (switch to debugger context)
                        No inputs/outputs
                   1 == restore screen state (switch to windows context)
                        No inputs/outputs
                   2 == display output character (ie, OEMOutputCharCOM)
                        on input, AL == character
                   3 == check for input character (ie, OEMScanCharCOM)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?