ReactOS  0.4.14-dev-608-gd495a4f
nt_vdd.h
Go to the documentation of this file.
1 /*
2  * nt_vdd.h
3  *
4  * Windows NT Device Driver Kit
5  *
6  * This file is part of the ReactOS DDK package.
7  *
8  * Contributors:
9  * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #pragma once
24 
25 #define _NT_VDD
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* VDM Control */
32 
33 VOID
34 WINAPI
36 
37 VOID
38 WINAPI
40 
41 
42 /* VDD User Hooks */
43 
44 typedef VOID
46 
47 typedef VOID
49 
50 typedef VOID
52 
53 typedef VOID
55 
56 // NOTE: Kept there for WinDDK compatibility, but it is in any case unused.
57 #ifndef NO_NTVDD_COMPAT
58 typedef struct _VDD_USER_HANDLERS {
66 #endif
67 
68 BOOL
69 WINAPI
76 
77 BOOL
78 WINAPI
80  _In_ HANDLE hVdd);
81 
82 
83 /* IRQ services */
84 
85 WORD
86 WINAPI
89  _In_ WORD IrqLine);
90 
91 BOOL
92 WINAPI
95  _In_ WORD IrqLine);
96 
97 
98 /* I/O Port services */
99 
100 typedef VOID
102  WORD iport,
103  PBYTE data);
104 
105 typedef VOID
107  WORD iport,
108  PWORD data);
109 
110 typedef VOID
112  WORD iport,
113  PBYTE data,
114  WORD count);
115 
116 typedef VOID
118  WORD iport,
119  PWORD data,
120  WORD count);
121 
122 typedef VOID
124  WORD iport,
125  BYTE data);
126 
127 typedef VOID
129  WORD iport,
130  WORD data);
131 
132 typedef VOID
134  WORD iport,
135  PBYTE data,
136  WORD count);
137 
138 typedef VOID
140  WORD iport,
141  PWORD data,
142  WORD count);
143 
144 typedef struct _VDD_IO_HANDLERS {
154 
155 typedef struct _VDD_IO_PORTRANGE {
159 
160 BOOL
161 WINAPI
163  _In_ HANDLE hVdd,
164  _In_ WORD cPortRange,
165  _In_ PVDD_IO_PORTRANGE pPortRange,
166  _In_ PVDD_IO_HANDLERS IoHandlers);
167 
168 VOID
169 WINAPI
171  _In_ HANDLE hVdd,
172  _In_ WORD cPortRange,
173  _In_ PVDD_IO_PORTRANGE pPortRange);
174 
175 
176 /* DMA services */
177 
178 typedef struct _VDD_DMA_INFO {
186 
187 #define VDD_DMA_ADDR 0x01
188 #define VDD_DMA_COUNT 0x02
189 #define VDD_DMA_PAGE 0x04
190 #define VDD_DMA_STATUS 0x08
191 #define VDD_DMA_ALL (VDD_DMA_ADDR | VDD_DMA_COUNT | VDD_DMA_PAGE | VDD_DMA_STATUS)
192 
193 DWORD
194 WINAPI
196  _In_ HANDLE hVdd,
197  _In_ WORD iChannel,
199  _In_ DWORD length);
200 
201 BOOL
202 WINAPI
204  _In_ HANDLE hVdd,
205  _In_ WORD iChannel,
206  _In_ PVDD_DMA_INFO pDmaInfo);
207 
208 BOOL
209 WINAPI
210 VDDSetDMA(
211  _In_ HANDLE hVdd,
212  _In_ WORD iChannel,
213  _In_ WORD fDMA,
214  _In_ PVDD_DMA_INFO pDmaInfo);
215 
216 
217 /* Memory services */
218 
219 typedef enum {
222 } VDM_MODE;
223 
224 #ifndef MSW_PE
225 #define MSW_PE 0x0001
226 #endif
227 
228 #define getMODE() ((getMSW() & MSW_PE) ? VDM_PM : VDM_V86)
229 
230 typedef VOID
232  PVOID FaultAddress,
233  ULONG RWMode);
234 
235 PVOID
236 WINAPI
237 VdmMapFlat(
239  _In_ ULONG Offset,
240  _In_ VDM_MODE Mode);
241 
242 #ifdef _X86_
243 
244 #define VdmFlushCache(sel, off, len, mode) TRUE
245 #define VdmUnmapFlat(sel, off, buf, mode) TRUE
246 
247 #else
248 
249 BOOL
250 WINAPI
253  _In_ ULONG Offset,
254  _In_ ULONG Size,
255  _In_ VDM_MODE Mode);
256 
257 BOOL
258 WINAPI
261  _In_ ULONG Offset,
262  _In_ PVOID Buffer,
263  _In_ VDM_MODE Mode);
264 
265 #endif
266 
267 BOOL
268 WINAPI
270  _In_ HANDLE hVdd,
271  _In_ PVOID pStart,
272  _In_ DWORD dwCount,
274 
275 BOOL
276 WINAPI
278  _In_ HANDLE hVdd,
279  _In_ PVOID pStart,
280  _In_ DWORD dwCount);
281 
282 BOOL
283 WINAPI
285  _In_ HANDLE hVdd,
287  _In_ ULONG Size);
288 
289 BOOL
290 WINAPI
291 VDDFreeMem(
292  _In_ HANDLE hVdd,
294  _In_ ULONG Size);
295 
296 BOOL
297 WINAPI
299  _In_ HANDLE hVdd,
301  _In_ ULONG Size);
302 
303 BOOL
304 WINAPI
306  _In_ HANDLE hVdd,
308  _In_ ULONG Size);
309 
310 #ifdef __cplusplus
311 }
312 #endif
313 
314 /* EOF */
BYTE mask
Definition: nt_vdd.h:184
VOID(WINAPI * PFNVDD_OUTSW)(WORD iport, PWORD data, WORD count)
Definition: nt_vdd.h:139
VOID(WINAPI * PFNVDD_OUTW)(WORD iport, WORD data)
Definition: nt_vdd.h:128
Definition: nt_vdd.h:221
VOID(WINAPI * PFNVDD_INSW)(WORD iport, PWORD data, WORD count)
Definition: nt_vdd.h:117
BOOL WINAPI VdmFlushCache(_In_ USHORT Segment, _In_ ULONG Offset, _In_ ULONG Size, _In_ VDM_MODE Mode)
BOOL WINAPI VDDIncludeMem(_In_ HANDLE hVdd, _In_ PVOID Address, _In_ ULONG Size)
BOOL WINAPI VDDQueryDMA(_In_ HANDLE hVdd, _In_ WORD iChannel, _In_ PVDD_DMA_INFO pDmaInfo)
PFNVDD_INW inw_handler
Definition: nt_vdd.h:146
_In_ ULONG Mode
Definition: hubbusif.h:303
BOOL WINAPI VDDReleaseIrqLine(_In_ HANDLE hVdd, _In_ WORD IrqLine)
PFNVDD_URESUME uresume_handler
Definition: nt_vdd.h:63
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _VDD_USER_HANDLERS * next
Definition: nt_vdd.h:64
PFNVDD_OUTSW outsw_handler
Definition: nt_vdd.h:152
PFNVDD_INSW insw_handler
Definition: nt_vdd.h:148
BOOL WINAPI VDDExcludeMem(_In_ HANDLE hVdd, _In_ PVOID Address, _In_ ULONG Size)
VDM_MODE
Definition: nt_vdd.h:219
PFNVDD_INB inb_handler
Definition: nt_vdd.h:145
WORD WINAPI VDDReserveIrqLine(_In_ HANDLE hVdd, _In_ WORD IrqLine)
VOID(WINAPI * PFNVDD_OUTSB)(WORD iport, PBYTE data, WORD count)
Definition: nt_vdd.h:133
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
PFNVDD_URESUME Uresume_Handler
Definition: vddsup.c:41
WORD count
Definition: nt_vdd.h:180
VOID WINAPI VDDSimulate16(VOID)
Definition: emulator.c:670
struct _VDD_DMA_INFO VDD_DMA_INFO
BOOL WINAPI VDDDeInstallMemoryHook(_In_ HANDLE hVdd, _In_ PVOID pStart, _In_ DWORD dwCount)
static WCHAR Address[46]
Definition: ping.c:68
struct _VDD_USER_HANDLERS VDD_USER_HANDLERS
Definition: bufpool.h:45
BOOL WINAPI VdmUnmapFlat(_In_ USHORT Segment, _In_ ULONG Offset, _In_ PVOID Buffer, _In_ VDM_MODE Mode)
_Inout_ PVOID Segment
Definition: exfuncs.h:893
BOOL WINAPI VDDAllocMem(_In_ HANDLE hVdd, _In_ PVOID Address, _In_ ULONG Size)
VOID(WINAPI * PFNVDD_UBLOCK)(VOID)
Definition: nt_vdd.h:51
WORD * PWORD
Definition: pedump.c:67
struct _VDD_IO_PORTRANGE VDD_IO_PORTRANGE
PFNVDD_UBLOCK ublock_handler
Definition: nt_vdd.h:62
struct _VDD_IO_HANDLERS * PVDD_IO_HANDLERS
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
struct _VDD_USER_HANDLERS * PVDD_USER_HANDLERS
VOID(WINAPI * PFNVDD_INW)(WORD iport, PWORD data)
Definition: nt_vdd.h:106
PFNVDD_OUTSB outsb_handler
Definition: nt_vdd.h:151
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
WORD addr
Definition: nt_vdd.h:179
struct _VDD_IO_PORTRANGE * PVDD_IO_PORTRANGE
VOID WINAPI VDDTerminateVDM(VOID)
Definition: emulator.c:677
#define _Inout_
Definition: no_sal2.h:244
VOID(WINAPI * PVDD_MEMORY_HANDLER)(PVOID FaultAddress, ULONG RWMode)
Definition: nt_vdd.h:231
PFNVDD_UCREATE Ucr_Handler
Definition: vddsup.c:38
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
PFNVDD_OUTW outw_handler
Definition: nt_vdd.h:150
PVOID WINAPI VdmMapFlat(_In_ USHORT Segment, _In_ ULONG Offset, _In_ VDM_MODE Mode)
BOOL WINAPI VDDInstallIOHook(_In_ HANDLE hVdd, _In_ WORD cPortRange, _In_ PVDD_IO_PORTRANGE pPortRange, _In_ PVDD_IO_HANDLERS IoHandlers)
VOID(WINAPI * PFNVDD_OUTB)(WORD iport, BYTE data)
Definition: nt_vdd.h:123
PFNVDD_UCREATE ucr_handler
Definition: nt_vdd.h:60
VOID(WINAPI * PFNVDD_URESUME)(VOID)
Definition: nt_vdd.h:54
BOOL WINAPI VDDSetDMA(_In_ HANDLE hVdd, _In_ WORD iChannel, _In_ WORD fDMA, _In_ PVDD_DMA_INFO pDmaInfo)
#define VOID
Definition: acefi.h:82
unsigned char BYTE
Definition: mem.h:68
BYTE status
Definition: nt_vdd.h:182
BOOL WINAPI VDDInstallUserHook(_In_ HANDLE hVdd, _In_ PFNVDD_UCREATE Ucr_Handler, _In_ PFNVDD_UTERMINATE Uterm_Handler, _In_ PFNVDD_UBLOCK Ublock_Handler, _In_ PFNVDD_URESUME Uresume_Handler)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
BOOL WINAPI VDDInstallMemoryHook(_In_ HANDLE hVdd, _In_ PVOID pStart, _In_ DWORD dwCount, _In_ PVDD_MEMORY_HANDLER MemoryHandler)
BOOL WINAPI VDDDeInstallUserHook(_In_ HANDLE hVdd)
#define _In_
Definition: no_sal2.h:204
DWORD WINAPI VDDRequestDMA(_In_ HANDLE hVdd, _In_ WORD iChannel, _Inout_ PVOID Buffer, _In_ DWORD length)
PFNVDD_OUTB outb_handler
Definition: nt_vdd.h:149
VOID(WINAPI * PFNVDD_INSB)(WORD iport, PBYTE data, WORD count)
Definition: nt_vdd.h:111
unsigned short USHORT
Definition: pedump.c:61
VOID(WINAPI * PFNVDD_INB)(WORD iport, PBYTE data)
Definition: nt_vdd.h:101
PFNVDD_UTERMINATE Uterm_Handler
Definition: vddsup.c:39
struct _VDD_DMA_INFO * PVDD_DMA_INFO
BOOL WINAPI VDDFreeMem(_In_ HANDLE hVdd, _In_ PVOID Address, _In_ ULONG Size)
PFNVDD_UBLOCK Ublock_Handler
Definition: vddsup.c:40
VOID(WINAPI * PFNVDD_UCREATE)(USHORT DosPDB)
Definition: nt_vdd.h:45
struct _VDD_IO_HANDLERS VDD_IO_HANDLERS
unsigned int ULONG
Definition: retypes.h:1
VOID WINAPI VDDDeInstallIOHook(_In_ HANDLE hVdd, _In_ WORD cPortRange, _In_ PVDD_IO_PORTRANGE pPortRange)
VOID WINAPI MemoryHandler(IN PVOID FaultAddress, IN ULONG RWMode)
Definition: testvdd.c:217
BYTE mode
Definition: nt_vdd.h:183
WORD page
Definition: nt_vdd.h:181
PFNVDD_INSB insb_handler
Definition: nt_vdd.h:147
PFNVDD_UTERMINATE uterm_handler
Definition: nt_vdd.h:61
BYTE * PBYTE
Definition: pedump.c:66
VOID(WINAPI * PFNVDD_UTERMINATE)(USHORT DosPDB)
Definition: nt_vdd.h:48
HANDLE hVdd
Definition: testvdd.c:87