debugsys.h
来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 1,732 行 · 第 1/4 页
H
1,732 行
/*****************************************************************************
(C) Copyright MICROSOFT Corp., 1988-1992
Title: DEBUGSYS.INC - VMM debugging include file
Version: 1.00
Date: 13-Jun-1988
Author: RAL
------------------------------------------------------------------------------
Change log:
DATE REV DESCRIPTION
----------- --- -----------------------------------------------------------
13-Jun-1988 RAL
24-Oct-1988 RAP changed INT from 2E to 41, and added functions for
Windows to notify the debugger about segment selectors
14-Dec-1988 RAP split services into ones available through INT 41h
for non-ring 0 clients and those available through INT 21h
for ring 0 clients
11-Dec-1990 ERH Merged WIN386 copy with file actually used by the
debugger.
11-Dec-1990 ERH Merged file describing real mode services with this
one.
24-Feb-1997 AJO Converted from inc to h, added WDeb98 stuff, PTrace stuff
==============================================================================*/
#ifndef _DEBUGSYS_H
#define _DEBUGSYS_H
/*
* Note: You must define WDEB98 to use any of the new WDEB98 services...
*
*/
/******************************************************************************
Real mode Debugger services:
*/
// hooked by the debugger in real mode.
#define D386_RM_Int 0x68
// debugger identification code
#define D386_Id 0x0F386
// minimum INT 68 function code
#define D386_MIN 0x43
// returns debugger identification, if debugger loaded
#define D386_Identify 0x43
// partially prepare for protected mode operation.
#define D386_Prepare_PMode 0x44
/*
A pointer to a procedure is returned so that the IDT can also be set in
protected mode
INPUT:
AL 0 - retail version of Win386
1 - debugging version
BX a valid selector that gives access to all of memory
CX first of 2 selectors reserved for WDeb386 to use
DX is GDT selector
DS:SI pointer to working copy of GDT
ES:DI pointer to working copy of IDT
RETURN:
ES:EDI points to a protected mode procedure (selector:offset32) that can
be called to set the IDT when it has been created. Takes a function
number in AL. See the PMINIT equates.
*/
// re-init from real mode after entering pmode
#define D386_Real_Mode_Init 0x45
// set debugging switches
#define D386_Set_Switches 0x46
/*
BL = verbose switch
- 00b - no segment display
- 01b - display win386 segments only
- 10b - display ring 1 segments only
- 11b - display win386 & ring 1 segs
BH = conditional brkpts
0 - off
1 - on
-1 for BX means no change (default)
*/
// execute conditional BP (/B option)
#define D386_Execute_Cond 0x47
// ES:SI points to NUL terminated string to print if conditional flag set.
// undefine the real mode segment's symbols
#define D386_Free_Segment 0x48
// BX = real mode segment to undefined
// set com port baud rate
#define D386_Set_Baudrate 0x49
// BX = baud rate
// reinitialize debugger for protected mode
#define D386_Reinit 0x4a
/*
AL 0 - retail version of Win386
1 - debugging version of Win386
2 - 286 DOS extender (3.0)
3 - 286 DOS extender under VCPI (3.1)
4 - 286 DOS extender (3.1)
BX a valid selector that gives access to all of memory
CX first of 2 selectors reserved for wdeb386 to use
DX is GDT selector
This function can after a function 45h only if function 44h was executed in
the past on the IDT/GDT.
*/
// define debugger's segments
#define D386_Def_Deb_Segs 0x4b
// set com port number
#define D386_Set_Com_Port 0x4c
// BX = com port number
// returns AX != 0, error bad com port
// link sym file map
#define D386_Link_Sym 0x4d
/*
ES:DI pointer to AddrS struc in front of sym file map.
BX loader ID (used to unlink sym file maps)
A loader ID of 0 is used for all the maps
wdeb386 loads via /S is ran as a program and
-1 is used by the device driver version. All
loader IDs of 0 are automaticly unlinked when
wdeb386 exits.
*/
// unlink sym file maps
#define D386_Unlink_Sym 0x4e
/*
BX = loader ID - this routine looks at all
of the maps that are currently linked and
removes the ones that were loaded with this
ID.
*/
// remove any undefined segments from the name module's symbols
#define D386_Remove_Segs 0x4f
// ES:DI pointer to module name
// defines the actual segment/selector for a loaded segment to allow for
// symbol processing
#define D386_Load_Segment 0x50
/*
INPUT:
AL segment type 0 - code selector
1 - data selector
10h - code segment
11h - data segment
20h - real-mode EXE
40h - code segment & sel
41h - data segment & sel
80h - device driver code seg
81h - device driver data seg
If AL = 20h then
CX = paragraph number
ES:DI pointer to module name
Else If AL < 80h then
BX segment #
CX actual segment/selector
DX actual selector (if 40h or 41h)
ES:DI pointer to module name
Else
ES:DI points to D386_Device_Params struc
RETURN:
AL = 1, if successful, else 0
*/
// display a character to the debugging terminal
#define D386_Display_Char 0x51
// AL = char to display
// display a string to the debugging terminal
#define D386_Display_Str 0x52
// ES:SI points to NUL terminated string
// returns if debug VxD has been installed
#define D386_IsVxDInstalled 0x53
// AL == 0 if not install, AL != 0 if installed
// sets that the debug VxD installed/uninstalled
#define D386_VxDInstall 0x54
// BL == 0 if uninstall, BL != 0 if installed
// registers dot command
#define D386_RegisterDotCmd 0x55
/*
INPUTS
BL = command letter
CX:SI = address of dot command routine
DX:DI = address of help text
RETURNS
AX == 0, no errors
AX != 0, dot command already used or out of dot commands
Dot command routine:
-------------------
CALLED WITH
AL = command character
DS:SI = linear address of command line terminated by a NULL or ";".
DS,ES = debugger's data selector
RETURNS
AX ==0, no errors
AX !=0, command line or option error
*/
// de-registers dot command
#define D386_DeRegisterDotCmd 0x56
// BL = command letter
// Printf
#define D386_Printf 0x57
/*
(DS:SI) = address of format string
(ES:DI) = address of the start of parameters
set DS_Printf for format char information
returns (AX) = number of characters printed
*/
// link symbol file with physical address
#define D386_Link_Sym_Phys 0x58
/*
(DX:CX) = physical address of one extra
paragraph front of map file image.
(SI) = XMS handle (0 if just physical)
(BX) = load id
*/
#define D386_CheckMap 0x59
/*
DX:DI = pointer to module name
returns AX != 0, map found
AX == 0, map not found
*/
#define D386_SetAutoLoadSym 0x5a
/*
(BL) != 0, auto load symbols
(BL) == 0, don't auto load symbols
*/
#define D386_SetTeftiPort 0x5b
// (BX) = TEFTI port address
// execute debugger command script
#define D386_ExecDebugCommand 0x5c
/*
(DS:SI) = ptr to debugger command script str
(CX) = size of script
*/
// makes the debugger copy its code/data high
#define D386_LoadCodeDataHigh 0x5d
// (DX:BX) = physical address to put debugger
// sets Windows version number
#define D386_SetWinVersion 0x5e
// (DI) = Version number (default if this api not called is 0300h).
// scan for character
#define D386_ScanChar 0x5f
// returns AL == 0, no char. AL != 0, char
// ungetchar scaned character
#define D386_UnGetChar 0x60
// AL = char
// stop at the CS:IP specified
#define D386_Stop 0x61
/*
TOS + 0 = AX
TOS + 2 = IP
TOS + 4 = CS
*/
#ifdef WDEB98
// set com port baud rate (beyond 57600)
#define D386_Set_Baudrate_Ex 0x62
// EBX = baud rate, EBX is zero if successful
// programs wdeb with windows info
#define D386_SetBuildInfo 0x63
// DS:EDX points to string of from "4.00.0950" or similar.
// Sets new switches for WDEB
#define D386_Set_Switches_Ex 0x64
// EBX [0:1] controls text packet usage:
// 00 - No change
// 01 - Off
// 10 - On with timeouts (switchbox environment)
// 11 - On with infinite retries
//
// All other bits in EBX are reserved and must be zero.
//
#define D386_MAX 0x64 // maximum INT 68 function code
#else // WDEB98
#define D386_MAX 0x61 // maximum INT 68 function code
#endif // WDEB98
// D386_Load_Segment type ates:
#define ST_code_sel 0x0 // code selector
#define ST_data_sel 0x1 // data selector
#define ST_code_seg 0x10 // code segment
#define ST_data_seg 0x11 // data segment
#define ST_dual_code 0x40 // code segment and selector
#define ST_dual_data 0x41 // data segment and selector
#define ST_device_code 0x80 // device driver code segment
#define ST_device_data 0x81 // device driver data segment
// D386_Load_Segment device load parameters structure
// Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
/*XLATOFF*/
struct D386_Device_Params {
WORD DD_logical_seg ; // logical segment # from map
WORD DD_actual_sel ; // actual selector value
DWORD DD_base ; // linear address offset for start of segment
DWORD DD_length ; // actual length of segment
FWORD DD_name ; // 16:32 ptr to null terminated device name
FWORD DD_sym_name ; // 16:32 ptr to null terminated symbolic
// module name (i.e. Win386)
WORD DD_alias_sel ; // alias selector value (0 = none)
} ;
/*XLATON*/
/* ASM
D386_Device_Params STRUC
DD_logical_seg DW ?
DD_actual_sel DW ?
DD_base DD ?
DD_length DD ?
DD_name DF ?
DD_sym_name DF ?
DD_alias_sel DW ?
D386_Device_Params ENDS
*/
// WDEB int 2f subfunctions (AH = W386_INT_MULTIPLEX, AL = W386_WDEB)
// Entry: BX = subfunction number
#define WDEB_INT2F_STARTING 0x0 // first time starting
#define WDEB_INT2F_ENDING 0x1 // first time ending
#define WDEB_INT2F_NESTED_STARTING 0x2 // start on level of nesting
#define WDEB_INT2F_NESTED_ENDING 0x3 // end one level of nesting
// PMINIT routine functions
#define PMINIT_INIT_IDT 0x0 // (ES:EDI) = pointer to PM IDT
#define PMINIT_INIT_PAGING 0x1 // (BX) = phys-linear selector
// (ECX) = phys-linear bias
#define PMINIT_ENABLE_DEBUG_QUERYS 0x2 // enables dot commands, etc.
#define PMINIT_INIT_SPARE_PTE 0x3 // (EBX) = lin addr of spare PTE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?