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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
vrdisp.c
Abstract:
Contains dispatcher for VdmRedir (Vr) functions
Contents:
VrDispatch
Author:
Richard L Firth (rfirth) 13-Sep-1991
Environment:
Flat 32-bit
Revision History:
13-Sep-1991 rfirth
Created
--*/
#include <nt.h>
#include <ntrtl.h> // ASSERT, DbgPrint
#include <nturtl.h>
#include <windows.h>
#include <softpc.h> // x86 virtual machine definitions
#include <vrdlctab.h>
#include <vdmredir.h> // common VdmRedir stuff
#include <vrinit.h> // Vr init prototypes
#include <vrmisc.h> // Vr miscellaneous prototypes
#include <vrnmpipe.h> // Vr named pipe prototypes
#include <vrmslot.h> // Vr mailslot prototypes
#include <vrnetapi.h> // Vr net api prototypes
#include <nb30.h> // NCBNAMSZ etc.
#include <netb.h> // Vr netbios api prototypes
#include <rdrexp.h> // VrDispatch prototypes
#include <rdrsvc.h> // SVC_RDR... defines
#include <smbgtpt.h>
#include <dlcapi.h> // Official DLC API definition
#include <ntdddlc.h> // IOCTL commands
#include <dlcio.h> // Internal IOCTL API interface structures
#include <vrdlc.h> // Vr dlc prototypes, etc.
//
// The functions in VrDispatchTable must be in the same order as the
// corresponding SVC codes in rdrsvc.h
//
VOID (*VrDispatchTable[])(VOID) = {
VrInitialize, // 0x00
VrUninitialize, // 0x01
VrGetNamedPipeInfo, // 0x02
VrGetNamedPipeHandleState, // 0x03
VrSetNamedPipeHandleState, // 0x04
VrPeekNamedPipe, // 0x05
VrTransactNamedPipe, // 0x06
VrCallNamedPipe, // 0x07
VrWaitNamedPipe, // 0x08
VrDeleteMailslot, // 0x09
VrGetMailslotInfo, // 0x0a
VrMakeMailslot, // 0x0b
VrPeekMailslot, // 0x0c
VrReadMailslot, // 0x0d
VrWriteMailslot, // 0x0e
VrTerminateDosProcess, // 0x0f
VrNetTransactApi, // 0x10
VrNetRemoteApi, // 0x11
VrNetNullTransactApi, // 0x12
VrNetServerEnum, // 0x13
VrNetUseAdd, // 0x14
VrNetUseDel, // 0x15
VrNetUseEnum, // 0x16
VrNetUseGetInfo, // 0x17
VrNetWkstaGetInfo, // 0x18
VrNetWkstaSetInfo, // 0x19
VrNetMessageBufferSend, // 0x1a
VrGetCDNames, // 0x1b
VrGetComputerName, // 0x1c
VrGetUserName, // 0x1d
VrGetDomainName, // 0x1e
VrGetLogonServer, // 0x1f
VrNetHandleGetInfo, // 0x20
VrNetHandleSetInfo, // 0x21
VrNetGetDCName, // 0x22
VrReadWriteAsyncNmPipe, // 0x23
VrReadWriteAsyncNmPipe, // 0x24
VrNetbios5c, // 0x25
VrHandleAsyncCompletion, // 0x26
VrDlc5cHandler, // 0x27
VrVdmWindowInit, // 0x28
VrReturnAssignMode, // 0x29
VrSetAssignMode, // 0x2a
VrGetAssignListEntry, // 0x2b
VrDefineMacro, // 0x2c
VrBreakMacro, // 0x2d
VrNetServiceControl, // 0x2e
VrDismissInterrupt, // 0x2f
VrEoiAndDismissInterrupt, // 0x30
VrCheckPmNetbiosAnr // 0x31
};
#define LAST_VR_FUNCTION LAST_ELEMENT(VrDispatchTable)
BOOL
VrDispatch(
IN ULONG SvcCode
)
/*++
Routine Description:
Dispatches a Vdm Redir support function based on the SVC code
Arguments:
SvcCode - Function dispatcher
Return Value:
BOOL
TRUE - Function executed
FALSE - Function not executed
--*/
{
#if 0
#if DBG
DbgPrint("VrDisp: You have successfully made a Bop into VdmRedir (%d)\n",
SvcCode
);
#endif
#endif
if (SvcCode > LAST_VR_FUNCTION) {
#if DBG
DbgPrint("Error: VrDisp: Unsupported SVC code: %d\n", SvcCode);
VrUnsupportedFunction();
#endif
return FALSE;
}
VrDispatchTable[SvcCode]();
return TRUE;
}
//
// BUGBUG - this goes away when all C compilers understand inline functions
//
#ifndef i386
LPVOID _inlinePointerFromWords(WORD seg, WORD off) {
WORD _seg = seg;
WORD _off = off;
if (seg + off) {
return (LPVOID)GetVDMAddr(_seg, _off);
}
return 0;
}
LPVOID _inlineConvertAddress(WORD Seg, WORD Off, WORD Size, BOOLEAN Pm) {
WORD _seg = Seg;
WORD _off = Off;
return (_seg | _off) ? Sim32GetVDMPointer(((DWORD)_seg << 16) + _off, Size, Pm) : 0;
}
#endif
|