1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
//++
//
// Copyright (c) 1990 Microsoft Corporation
//
// Module Name:
//
// debug3.c
//
// Abstract:
//
// This module implements architecture specific functions to support debugging NT.
//
// Author:
//
// Steven R. Wood (stevewo) 3-Aug-1989
//
// Environment:
//
// Any mode.
//
// Revision History:
//
//--
#include "stdarg.h"
#include "stdio.h"
#include "string.h"
#include "ntrtlp.h"
//
// Prototype for local procedure
//
NTSTATUS
DebugService(
ULONG ServiceClass,
PVOID Arg1,
PVOID Arg2
);
VOID _fptrap() {};
NTSTATUS
DebugPrint(
IN PSTRING Output
)
{
return DebugService( BREAKPOINT_PRINT, Output, 0 );
}
ULONG
DebugPrompt(
IN PSTRING Output,
IN PSTRING Input
)
{
return DebugService( BREAKPOINT_PROMPT, Output, Input );
}
VOID
DebugLoadImageSymbols(
IN PSTRING FileName,
IN PKD_SYMBOLS_INFO SymbolInfo
)
{
DebugService( BREAKPOINT_LOAD_SYMBOLS, FileName, SymbolInfo );
}
VOID
DebugUnLoadImageSymbols(
IN PSTRING FileName,
IN PKD_SYMBOLS_INFO SymbolInfo
)
{
DebugService( BREAKPOINT_UNLOAD_SYMBOLS, FileName, SymbolInfo );
}
NTSTATUS
DebugService(
ULONG ServiceClass,
PVOID Arg1,
PVOID Arg2
)
//++
//
// Routine Description:
//
// Allocate an ExceptionRecord, fill in data to allow exception
// dispatch code to do the right thing with the service, and
// call RtlRaiseException (NOT ExRaiseException!!!).
//
// Arguments:
// ServiceClass - which call is to be performed
// Arg1 - generic first argument
// Arg2 - generic second argument
//
// Returns:
// Whatever the exception returns in eax
//
//--
{
NTSTATUS RetValue;
_asm {
mov eax, ServiceClass
mov ecx, Arg1
mov edx, Arg2
int 2dh ; Raise exception
int 3 ; DO NOT REMOVE (See KiDebugService)
mov RetValue, eax
}
return RetValue;
}
|