1 | /*
|
---|
2 | * tdikrnl.h
|
---|
3 | *
|
---|
4 | * TDI kernel mode definitions
|
---|
5 | *
|
---|
6 | * This file is part of the w32api package.
|
---|
7 | *
|
---|
8 | * Contributors:
|
---|
9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
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 | #ifndef __TDIKRNL_H
|
---|
24 | #define __TDIKRNL_H
|
---|
25 |
|
---|
26 | #if __GNUC__ >=3
|
---|
27 | #pragma GCC system_header
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #ifdef __cplusplus
|
---|
31 | extern "C" {
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "ntddk.h"
|
---|
35 | #include "tdi.h"
|
---|
36 |
|
---|
37 | #if defined(_TDI_)
|
---|
38 | #define TDIKRNLAPI DECLSPEC_EXPORT
|
---|
39 | #else
|
---|
40 | #define TDIKRNLAPI DECLSPEC_IMPORT
|
---|
41 | #endif
|
---|
42 |
|
---|
43 |
|
---|
44 | typedef struct _TDI_REQUEST_KERNEL {
|
---|
45 | ULONG RequestFlags;
|
---|
46 | PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
|
---|
47 | PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
|
---|
48 | PVOID RequestSpecific;
|
---|
49 | } TDI_REQUEST_KERNEL, *PTDI_REQUEST_KERNEL;
|
---|
50 |
|
---|
51 | /* Request codes */
|
---|
52 | #define TDI_ASSOCIATE_ADDRESS 0x01
|
---|
53 | #define TDI_DISASSOCIATE_ADDRESS 0x02
|
---|
54 | #define TDI_CONNECT 0x03
|
---|
55 | #define TDI_LISTEN 0x04
|
---|
56 | #define TDI_ACCEPT 0x05
|
---|
57 | #define TDI_DISCONNECT 0x06
|
---|
58 | #define TDI_SEND 0x07
|
---|
59 | #define TDI_RECEIVE 0x08
|
---|
60 | #define TDI_SEND_DATAGRAM 0x09
|
---|
61 | #define TDI_RECEIVE_DATAGRAM 0x0A
|
---|
62 | #define TDI_SET_EVENT_HANDLER 0x0B
|
---|
63 | #define TDI_QUERY_INFORMATION 0x0C
|
---|
64 | #define TDI_SET_INFORMATION 0x0D
|
---|
65 | #define TDI_ACTION 0x0E
|
---|
66 |
|
---|
67 | #define TDI_DIRECT_SEND 0x27
|
---|
68 | #define TDI_DIRECT_SEND_DATAGRAM 0x29
|
---|
69 |
|
---|
70 | #define TDI_TRANSPORT_ADDRESS_FILE 1
|
---|
71 | #define TDI_CONNECTION_FILE 2
|
---|
72 | #define TDI_CONTROL_CHANNEL_FILE 3
|
---|
73 |
|
---|
74 | /* Internal TDI IOCTLS */
|
---|
75 | #define IOCTL_TDI_QUERY_DIRECT_SEND_HANDLER _TDI_CONTROL_CODE(0x80, METHOD_NEITHER)
|
---|
76 | #define IOCTL_TDI_QUERY_DIRECT_SENDDG_HANDLER _TDI_CONTROL_CODE(0x81, METHOD_NEITHER)
|
---|
77 |
|
---|
78 | /* TdiAssociateAddress */
|
---|
79 | typedef struct _TDI_REQUEST_KERNEL_ASSOCIATE {
|
---|
80 | HANDLE AddressHandle;
|
---|
81 | } TDI_REQUEST_KERNEL_ASSOCIATE, *PTDI_REQUEST_KERNEL_ASSOCIATE;
|
---|
82 |
|
---|
83 | /* TdiDisassociateAddress */
|
---|
84 | typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISASSOCIATE,
|
---|
85 | *PTDI_REQUEST_KERNEL_DISASSOCIATE;
|
---|
86 |
|
---|
87 | /* TdiAccept */
|
---|
88 | typedef struct _TDI_REQUEST_KERNEL_ACCEPT {
|
---|
89 | PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
|
---|
90 | PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
|
---|
91 | } TDI_REQUEST_KERNEL_ACCEPT, *PTDI_REQUEST_KERNEL_ACCEPT;
|
---|
92 |
|
---|
93 | /* TdiConnect */
|
---|
94 | typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_CONNECT,
|
---|
95 | *PTDI_REQUEST_KERNEL_CONNECT;
|
---|
96 |
|
---|
97 | /* TdiDisconnect */
|
---|
98 | typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISCONNECT,
|
---|
99 | *PTDI_REQUEST_KERNEL_DISCONNECT;
|
---|
100 |
|
---|
101 | /* TdiListen */
|
---|
102 | typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_LISTEN,
|
---|
103 | *PTDI_REQUEST_KERNEL_LISTEN;
|
---|
104 |
|
---|
105 | /* TdiReceive */
|
---|
106 | typedef struct _TDI_REQUEST_KERNEL_RECEIVE {
|
---|
107 | ULONG ReceiveLength;
|
---|
108 | ULONG ReceiveFlags;
|
---|
109 | } TDI_REQUEST_KERNEL_RECEIVE, *PTDI_REQUEST_KERNEL_RECEIVE;
|
---|
110 |
|
---|
111 | /* TdiReceiveDatagram */
|
---|
112 | typedef struct _TDI_REQUEST_KERNEL_RECEIVEDG {
|
---|
113 | ULONG ReceiveLength;
|
---|
114 | PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
|
---|
115 | PTDI_CONNECTION_INFORMATION ReturnDatagramInformation;
|
---|
116 | ULONG ReceiveFlags;
|
---|
117 | } TDI_REQUEST_KERNEL_RECEIVEDG, *PTDI_REQUEST_KERNEL_RECEIVEDG;
|
---|
118 |
|
---|
119 | /* TdiSend */
|
---|
120 | typedef struct _TDI_REQUEST_KERNEL_SEND {
|
---|
121 | ULONG SendLength;
|
---|
122 | ULONG SendFlags;
|
---|
123 | } TDI_REQUEST_KERNEL_SEND, *PTDI_REQUEST_KERNEL_SEND;
|
---|
124 |
|
---|
125 | /* TdiSendDatagram */
|
---|
126 | typedef struct _TDI_REQUEST_KERNEL_SENDDG {
|
---|
127 | ULONG SendLength;
|
---|
128 | PTDI_CONNECTION_INFORMATION SendDatagramInformation;
|
---|
129 | } TDI_REQUEST_KERNEL_SENDDG, *PTDI_REQUEST_KERNEL_SENDDG;
|
---|
130 |
|
---|
131 | /* TdiSetEventHandler */
|
---|
132 | typedef struct _TDI_REQUEST_KERNEL_SET_EVENT {
|
---|
133 | LONG EventType;
|
---|
134 | PVOID EventHandler;
|
---|
135 | PVOID EventContext;
|
---|
136 | } TDI_REQUEST_KERNEL_SET_EVENT, *PTDI_REQUEST_KERNEL_SET_EVENT;
|
---|
137 |
|
---|
138 | /* TdiQueryInformation */
|
---|
139 | typedef struct _TDI_REQUEST_KERNEL_QUERY_INFO {
|
---|
140 | LONG QueryType;
|
---|
141 | PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
|
---|
142 | } TDI_REQUEST_KERNEL_QUERY_INFORMATION, *PTDI_REQUEST_KERNEL_QUERY_INFORMATION;
|
---|
143 |
|
---|
144 | /* TdiSetInformation */
|
---|
145 | typedef struct _TDI_REQUEST_KERNEL_SET_INFO {
|
---|
146 | LONG SetType;
|
---|
147 | PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
|
---|
148 | } TDI_REQUEST_KERNEL_SET_INFORMATION, *PTDI_REQUEST_KERNEL_SET_INFORMATION;
|
---|
149 |
|
---|
150 |
|
---|
151 | /* Event types */
|
---|
152 | #define TDI_EVENT_CONNECT 0
|
---|
153 | #define TDI_EVENT_DISCONNECT 1
|
---|
154 | #define TDI_EVENT_ERROR 2
|
---|
155 | #define TDI_EVENT_RECEIVE 3
|
---|
156 | #define TDI_EVENT_RECEIVE_DATAGRAM 4
|
---|
157 | #define TDI_EVENT_RECEIVE_EXPEDITED 5
|
---|
158 | #define TDI_EVENT_SEND_POSSIBLE 6
|
---|
159 | #define TDI_EVENT_CHAINED_RECEIVE 7
|
---|
160 | #define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM 8
|
---|
161 | #define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED 9
|
---|
162 | #define TDI_EVENT_ERROR_EX 10
|
---|
163 |
|
---|
164 | typedef NTSTATUS DDKAPI
|
---|
165 | (*PTDI_IND_CONNECT)(
|
---|
166 | /*IN*/ PVOID TdiEventContext,
|
---|
167 | /*IN*/ LONG RemoteAddressLength,
|
---|
168 | /*IN*/ PVOID RemoteAddress,
|
---|
169 | /*IN*/ LONG UserDataLength,
|
---|
170 | /*IN*/ PVOID UserData,
|
---|
171 | /*IN*/ LONG OptionsLength,
|
---|
172 | /*IN*/ PVOID Options,
|
---|
173 | /*OUT*/ CONNECTION_CONTEXT *ConnectionContext,
|
---|
174 | /*OUT*/ PIRP *AcceptIrp);
|
---|
175 |
|
---|
176 | TDIKRNLAPI
|
---|
177 | NTSTATUS
|
---|
178 | DDKAPI
|
---|
179 | TdiDefaultConnectHandler(
|
---|
180 | /*IN*/ PVOID TdiEventContext,
|
---|
181 | /*IN*/ LONG RemoteAddressLength,
|
---|
182 | /*IN*/ PVOID RemoteAddress,
|
---|
183 | /*IN*/ LONG UserDataLength,
|
---|
184 | /*IN*/ PVOID UserData,
|
---|
185 | /*IN*/ LONG OptionsLength,
|
---|
186 | /*IN*/ PVOID Options,
|
---|
187 | /*OUT*/ CONNECTION_CONTEXT *ConnectionContext,
|
---|
188 | /*OUT*/ PIRP *AcceptIrp);
|
---|
189 |
|
---|
190 | typedef NTSTATUS DDKAPI
|
---|
191 | (*PTDI_IND_DISCONNECT)(
|
---|
192 | /*IN*/ PVOID TdiEventContext,
|
---|
193 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
194 | /*IN*/ LONG DisconnectDataLength,
|
---|
195 | /*IN*/ PVOID DisconnectData,
|
---|
196 | /*IN*/ LONG DisconnectInformationLength,
|
---|
197 | /*IN*/ PVOID DisconnectInformation,
|
---|
198 | /*IN*/ ULONG DisconnectFlags);
|
---|
199 |
|
---|
200 | TDIKRNLAPI
|
---|
201 | NTSTATUS
|
---|
202 | DDKAPI
|
---|
203 | TdiDefaultDisconnectHandler(
|
---|
204 | /*IN*/ PVOID TdiEventContext,
|
---|
205 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
206 | /*IN*/ LONG DisconnectDataLength,
|
---|
207 | /*IN*/ PVOID DisconnectData,
|
---|
208 | /*IN*/ LONG DisconnectInformationLength,
|
---|
209 | /*IN*/ PVOID DisconnectInformation,
|
---|
210 | /*IN*/ ULONG DisconnectFlags);
|
---|
211 |
|
---|
212 | typedef NTSTATUS DDKAPI
|
---|
213 | (*PTDI_IND_ERROR)(
|
---|
214 | /*IN*/ PVOID TdiEventContext,
|
---|
215 | /*IN*/ NTSTATUS Status);
|
---|
216 |
|
---|
217 | typedef NTSTATUS DDKAPI
|
---|
218 | (*PTDI_IND_ERROR_EX)(
|
---|
219 | /*IN*/ PVOID TdiEventContext,
|
---|
220 | /*IN*/ NTSTATUS Status,
|
---|
221 | /*IN*/ PVOID Buffer);
|
---|
222 |
|
---|
223 | TDIKRNLAPI
|
---|
224 | NTSTATUS
|
---|
225 | DDKAPI
|
---|
226 | TdiDefaultErrorHandler(
|
---|
227 | /*IN*/ PVOID TdiEventContext,
|
---|
228 | /*IN*/ NTSTATUS Status);
|
---|
229 |
|
---|
230 | typedef NTSTATUS DDKAPI
|
---|
231 | (*PTDI_IND_RECEIVE)(
|
---|
232 | /*IN*/ PVOID TdiEventContext,
|
---|
233 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
234 | /*IN*/ ULONG ReceiveFlags,
|
---|
235 | /*IN*/ ULONG BytesIndicated,
|
---|
236 | /*IN*/ ULONG BytesAvailable,
|
---|
237 | /*OUT*/ ULONG *BytesTaken,
|
---|
238 | /*IN*/ PVOID Tsdu,
|
---|
239 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
240 |
|
---|
241 | TDIKRNLAPI
|
---|
242 | NTSTATUS
|
---|
243 | DDKAPI
|
---|
244 | TdiDefaultReceiveHandler(
|
---|
245 | /*IN*/ PVOID TdiEventContext,
|
---|
246 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
247 | /*IN*/ ULONG ReceiveFlags,
|
---|
248 | /*IN*/ ULONG BytesIndicated,
|
---|
249 | /*IN*/ ULONG BytesAvailable,
|
---|
250 | /*OUT*/ ULONG *BytesTaken,
|
---|
251 | /*IN*/ PVOID Tsdu,
|
---|
252 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
253 |
|
---|
254 | typedef NTSTATUS DDKAPI
|
---|
255 | (*PTDI_IND_RECEIVE_DATAGRAM)(
|
---|
256 | /*IN*/ PVOID TdiEventContext,
|
---|
257 | /*IN*/ LONG SourceAddressLength,
|
---|
258 | /*IN*/ PVOID SourceAddress,
|
---|
259 | /*IN*/ LONG OptionsLength,
|
---|
260 | /*IN*/ PVOID Options,
|
---|
261 | /*IN*/ ULONG ReceiveDatagramFlags,
|
---|
262 | /*IN*/ ULONG BytesIndicated,
|
---|
263 | /*IN*/ ULONG BytesAvailable,
|
---|
264 | /*OUT*/ ULONG *BytesTaken,
|
---|
265 | /*IN*/ PVOID Tsdu,
|
---|
266 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
267 |
|
---|
268 | TDIKRNLAPI
|
---|
269 | NTSTATUS DDKAPI
|
---|
270 | TdiDefaultRcvDatagramHandler(
|
---|
271 | /*IN*/ PVOID TdiEventContext,
|
---|
272 | /*IN*/ LONG SourceAddressLength,
|
---|
273 | /*IN*/ PVOID SourceAddress,
|
---|
274 | /*IN*/ LONG OptionsLength,
|
---|
275 | /*IN*/ PVOID Options,
|
---|
276 | /*IN*/ ULONG ReceiveDatagramFlags,
|
---|
277 | /*IN*/ ULONG BytesIndicated,
|
---|
278 | /*IN*/ ULONG BytesAvailable,
|
---|
279 | /*OUT*/ ULONG *BytesTaken,
|
---|
280 | /*IN*/ PVOID Tsdu,
|
---|
281 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
282 |
|
---|
283 | typedef NTSTATUS DDKAPI
|
---|
284 | (*PTDI_IND_RECEIVE_EXPEDITED)(
|
---|
285 | /*IN*/ PVOID TdiEventContext,
|
---|
286 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
287 | /*IN*/ ULONG ReceiveFlags,
|
---|
288 | /*IN*/ ULONG BytesIndicated,
|
---|
289 | /*IN*/ ULONG BytesAvailable,
|
---|
290 | /*OUT*/ ULONG *BytesTaken,
|
---|
291 | /*IN*/ PVOID Tsdu,
|
---|
292 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
293 |
|
---|
294 | TDIKRNLAPI
|
---|
295 | NTSTATUS
|
---|
296 | DDKAPI
|
---|
297 | TdiDefaultRcvExpeditedHandler(
|
---|
298 | /*IN*/ PVOID TdiEventContext,
|
---|
299 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
300 | /*IN*/ ULONG ReceiveFlags,
|
---|
301 | /*IN*/ ULONG BytesIndicated,
|
---|
302 | /*IN*/ ULONG BytesAvailable,
|
---|
303 | /*OUT*/ ULONG *BytesTaken,
|
---|
304 | /*IN*/ PVOID Tsdu,
|
---|
305 | /*OUT*/ PIRP *IoRequestPacket);
|
---|
306 |
|
---|
307 | typedef NTSTATUS DDKAPI
|
---|
308 | (*PTDI_IND_CHAINED_RECEIVE)(
|
---|
309 | /*IN*/ PVOID TdiEventContext,
|
---|
310 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
311 | /*IN*/ ULONG ReceiveFlags,
|
---|
312 | /*IN*/ ULONG ReceiveLength,
|
---|
313 | /*IN*/ ULONG StartingOffset,
|
---|
314 | /*IN*/ PMDL Tsdu,
|
---|
315 | /*IN*/ PVOID TsduDescriptor);
|
---|
316 |
|
---|
317 | TDIKRNLAPI
|
---|
318 | NTSTATUS
|
---|
319 | DDKAPI
|
---|
320 | TdiDefaultChainedReceiveHandler(
|
---|
321 | /*IN*/ PVOID TdiEventContext,
|
---|
322 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
323 | /*IN*/ ULONG ReceiveFlags,
|
---|
324 | /*IN*/ ULONG ReceiveLength,
|
---|
325 | /*IN*/ ULONG StartingOffset,
|
---|
326 | /*IN*/ PMDL Tsdu,
|
---|
327 | /*IN*/ PVOID TsduDescriptor);
|
---|
328 |
|
---|
329 | typedef NTSTATUS DDKAPI
|
---|
330 | (*PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(
|
---|
331 | /*IN*/ PVOID TdiEventContext,
|
---|
332 | /*IN*/ LONG SourceAddressLength,
|
---|
333 | /*IN*/ PVOID SourceAddress,
|
---|
334 | /*IN*/ LONG OptionsLength,
|
---|
335 | /*IN*/ PVOID Options,
|
---|
336 | /*IN*/ ULONG ReceiveDatagramFlags,
|
---|
337 | /*IN*/ ULONG ReceiveDatagramLength,
|
---|
338 | /*IN*/ ULONG StartingOffset,
|
---|
339 | /*IN*/ PMDL Tsdu,
|
---|
340 | /*IN*/ PVOID TsduDescriptor);
|
---|
341 |
|
---|
342 | TDIKRNLAPI
|
---|
343 | NTSTATUS
|
---|
344 | DDKAPI
|
---|
345 | TdiDefaultChainedRcvDatagramHandler(
|
---|
346 | /*IN*/ PVOID TdiEventContext,
|
---|
347 | /*IN*/ LONG SourceAddressLength,
|
---|
348 | /*IN*/ PVOID SourceAddress,
|
---|
349 | /*IN*/ LONG OptionsLength,
|
---|
350 | /*IN*/ PVOID Options,
|
---|
351 | /*IN*/ ULONG ReceiveDatagramFlags,
|
---|
352 | /*IN*/ ULONG ReceiveDatagramLength,
|
---|
353 | /*IN*/ ULONG StartingOffset,
|
---|
354 | /*IN*/ PMDL Tsdu,
|
---|
355 | /*IN*/ PVOID TsduDescriptor);
|
---|
356 |
|
---|
357 | typedef NTSTATUS DDKAPI
|
---|
358 | (*PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(
|
---|
359 | /*IN*/ PVOID TdiEventContext,
|
---|
360 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
361 | /*IN*/ ULONG ReceiveFlags,
|
---|
362 | /*IN*/ ULONG ReceiveLength,
|
---|
363 | /*IN*/ ULONG StartingOffset,
|
---|
364 | /*IN*/ PMDL Tsdu,
|
---|
365 | /*IN*/ PVOID TsduDescriptor);
|
---|
366 |
|
---|
367 | TDIKRNLAPI
|
---|
368 | NTSTATUS
|
---|
369 | DDKAPI
|
---|
370 | TdiDefaultChainedRcvExpeditedHandler(
|
---|
371 | /*IN*/ PVOID TdiEventContext,
|
---|
372 | /*IN*/ CONNECTION_CONTEXT ConnectionContext,
|
---|
373 | /*IN*/ ULONG ReceiveFlags,
|
---|
374 | /*IN*/ ULONG ReceiveLength,
|
---|
375 | /*IN*/ ULONG StartingOffset,
|
---|
376 | /*IN*/ PMDL Tsdu,
|
---|
377 | /*IN*/ PVOID TsduDescriptor);
|
---|
378 |
|
---|
379 | typedef NTSTATUS DDKAPI
|
---|
380 | (*PTDI_IND_SEND_POSSIBLE)(
|
---|
381 | /*IN*/ PVOID TdiEventContext,
|
---|
382 | /*IN*/ PVOID ConnectionContext,
|
---|
383 | /*IN*/ ULONG BytesAvailable);
|
---|
384 |
|
---|
385 | TDIKRNLAPI
|
---|
386 | NTSTATUS
|
---|
387 | DDKAPI
|
---|
388 | TdiDefaultSendPossibleHandler(
|
---|
389 | /*IN*/ PVOID TdiEventContext,
|
---|
390 | /*IN*/ PVOID ConnectionContext,
|
---|
391 | /*IN*/ ULONG BytesAvailable);
|
---|
392 |
|
---|
393 |
|
---|
394 |
|
---|
395 | /* Macros and functions to build IRPs */
|
---|
396 |
|
---|
397 | #define TdiBuildBaseIrp( \
|
---|
398 | bIrp, bDevObj, bFileObj, bCompRoutine, bContxt, bIrpSp, bMinor) \
|
---|
399 | { \
|
---|
400 | bIrpSp->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
|
---|
401 | bIrpSp->MinorFunction = (bMinor); \
|
---|
402 | bIrpSp->DeviceObject = (bDevObj); \
|
---|
403 | bIrpSp->FileObject = (bFileObj); \
|
---|
404 | if (bCompRoutine) \
|
---|
405 | IoSetCompletionRoutine(bIrp, bCompRoutine, bContxt, TRUE, TRUE, TRUE) \
|
---|
406 | else \
|
---|
407 | IoSetCompletionRoutine(bIrp, NULL, NULL, FALSE, FALSE, FALSE); \
|
---|
408 | }
|
---|
409 |
|
---|
410 | /*
|
---|
411 | * VOID
|
---|
412 | * TdiBuildAccept(
|
---|
413 | * IN PIRP Irp,
|
---|
414 | * IN PDEVICE_OBJECT DevObj,
|
---|
415 | * IN PFILE_OBJECT FileObj,
|
---|
416 | * IN PVOID CompRoutine,
|
---|
417 | * IN PVOID Contxt,
|
---|
418 | * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
|
---|
419 | * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
|
---|
420 | */
|
---|
421 | #define TdiBuildAccept( \
|
---|
422 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
423 | RequestConnectionInfo, ReturnConnectionInfo) \
|
---|
424 | { \
|
---|
425 | PTDI_REQUEST_KERNEL_ACCEPT _Request; \
|
---|
426 | PIO_STACK_LOCATION _IrpSp; \
|
---|
427 | \
|
---|
428 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
429 | \
|
---|
430 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
431 | Contxt, _IrpSp, TDI_ACCEPT); \
|
---|
432 | \
|
---|
433 | _Request = (PTDI_REQUEST_KERNEL_ACCEPT)&_IrpSp->Parameters; \
|
---|
434 | _Request->RequestConnectionInformation = (RequestConnectionInfo); \
|
---|
435 | _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
|
---|
436 | }
|
---|
437 |
|
---|
438 | /*
|
---|
439 | * VOID
|
---|
440 | * TdiBuildAction(
|
---|
441 | * IN PIRP Irp,
|
---|
442 | * IN PDEVICE_OBJECT DevObj,
|
---|
443 | * IN PFILE_OBJECT FileObj,
|
---|
444 | * IN PVOID CompRoutine,
|
---|
445 | * IN PVOID Contxt,
|
---|
446 | * IN PMDL MdlAddr);
|
---|
447 | */
|
---|
448 | #define TdiBuildAction( \
|
---|
449 | Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr) \
|
---|
450 | { \
|
---|
451 | PIO_STACK_LOCATION _IrpSp; \
|
---|
452 | \
|
---|
453 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
454 | \
|
---|
455 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
456 | Contxt, _IrpSp, TDI_ACTION); \
|
---|
457 | \
|
---|
458 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
459 | }
|
---|
460 |
|
---|
461 | /*
|
---|
462 | * VOID
|
---|
463 | * TdiBuildAssociateAddress(
|
---|
464 | * IN PIRP Irp,
|
---|
465 | * IN PDEVICE_OBJECT DevObj,
|
---|
466 | * IN PFILE_OBJECT FileObj,
|
---|
467 | * IN PVOID CompRoutine,
|
---|
468 | * IN PVOID Contxt,
|
---|
469 | * IN HANDLE AddrHandle);
|
---|
470 | */
|
---|
471 | #define TdiBuildAssociateAddress( \
|
---|
472 | Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle) \
|
---|
473 | { \
|
---|
474 | PTDI_REQUEST_KERNEL_ASSOCIATE _Request; \
|
---|
475 | PIO_STACK_LOCATION _IrpSp; \
|
---|
476 | \
|
---|
477 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
478 | \
|
---|
479 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
480 | Contxt, _IrpSp, TDI_ASSOCIATE_ADDRESS); \
|
---|
481 | \
|
---|
482 | _Request = (PTDI_REQUEST_KERNEL_ASSOCIATE)&_IrpSp->Parameters; \
|
---|
483 | _Request->AddressHandle = (HANDLE)(AddrHandle); \
|
---|
484 | }
|
---|
485 |
|
---|
486 | /*
|
---|
487 | * VOID
|
---|
488 | * TdiBuildConnect(
|
---|
489 | * IN PIRP Irp,
|
---|
490 | * IN PDEVICE_OBJECT DevObj,
|
---|
491 | * IN PFILE_OBJECT FileObj,
|
---|
492 | * IN PVOID CompRoutine,
|
---|
493 | * IN PVOID Contxt,
|
---|
494 | * IN PLARGE_INTEGER Time,
|
---|
495 | * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
|
---|
496 | * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
|
---|
497 | */
|
---|
498 | #define TdiBuildConnect( \
|
---|
499 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
500 | Time, RequestConnectionInfo, ReturnConnectionInfo) \
|
---|
501 | { \
|
---|
502 | PTDI_REQUEST_KERNEL _Request; \
|
---|
503 | PIO_STACK_LOCATION _IrpSp; \
|
---|
504 | \
|
---|
505 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
506 | \
|
---|
507 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
508 | Contxt, _IrpSp, TDI_CONNECT); \
|
---|
509 | \
|
---|
510 | _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
|
---|
511 | _Request->RequestConnectionInformation = (RequestConnectionInfo); \
|
---|
512 | _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
|
---|
513 | _Request->RequestSpecific = (PVOID)(Time); \
|
---|
514 | }
|
---|
515 |
|
---|
516 | /*
|
---|
517 | * VOID
|
---|
518 | * TdiBuildDisassociateAddress(
|
---|
519 | * IN PIRP Irp,
|
---|
520 | * IN PDEVICE_OBJECT DevObj,
|
---|
521 | * IN PFILE_OBJECT FileObj,
|
---|
522 | * IN PVOID CompRoutine,
|
---|
523 | * IN PVOID Contxt);
|
---|
524 | */
|
---|
525 | #define TdiBuildDisassociateAddress( \
|
---|
526 | Irp, DevObj, FileObj, CompRoutine, Contxt) \
|
---|
527 | { \
|
---|
528 | PIO_STACK_LOCATION _IrpSp; \
|
---|
529 | \
|
---|
530 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
531 | \
|
---|
532 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
533 | Contxt, _IrpSp, TDI_DISASSOCIATE_ADDRESS); \
|
---|
534 | }
|
---|
535 |
|
---|
536 | /*
|
---|
537 | * VOID
|
---|
538 | * TdiBuildDisconnect(
|
---|
539 | * IN PIRP Irp,
|
---|
540 | * IN PDEVICE_OBJECT DevObj,
|
---|
541 | * IN PFILE_OBJECT FileObj,
|
---|
542 | * IN PVOID CompRoutine,
|
---|
543 | * IN PVOID Contxt,
|
---|
544 | * IN PLARGE_INTEGER Time,
|
---|
545 | * IN PULONG Flags,
|
---|
546 | * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
|
---|
547 | * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
|
---|
548 | */
|
---|
549 | #define TdiBuildDisconnect( \
|
---|
550 | Irp, DevObj, FileObj, CompRoutine, Contxt, Time, \
|
---|
551 | Flags, RequestConnectionInfo, ReturnConnectionInfo) \
|
---|
552 | { \
|
---|
553 | PTDI_REQUEST_KERNEL _Request; \
|
---|
554 | PIO_STACK_LOCATION _IrpSp; \
|
---|
555 | \
|
---|
556 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
557 | \
|
---|
558 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
559 | Contxt, _IrpSp, TDI_DISCONNECT); \
|
---|
560 | \
|
---|
561 | _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
|
---|
562 | _Request->RequestConnectionInformation = (RequestConnectionInfo); \
|
---|
563 | _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
|
---|
564 | _Request->RequestSpecific = (PVOID)(Time); \
|
---|
565 | _Request->RequestFlags = (Flags); \
|
---|
566 | }
|
---|
567 |
|
---|
568 | /*
|
---|
569 | * PIRP
|
---|
570 | * TdiBuildInternalDeviceControlIrp(
|
---|
571 | * IN CCHAR IrpSubFunction,
|
---|
572 | * IN PDEVICE_OBJECT DeviceObject,
|
---|
573 | * IN PFILE_OBJECT FileObject,
|
---|
574 | * IN PKEVENT Event,
|
---|
575 | * IN PIO_STATUS_BLOCK IoStatusBlock);
|
---|
576 | */
|
---|
577 | #define TdiBuildInternalDeviceControlIrp( \
|
---|
578 | IrpSubFunction, DeviceObject, \
|
---|
579 | FileObject, Event, IoStatusBlock) \
|
---|
580 | IoBuildDeviceIoControlRequest( \
|
---|
581 | 0x00000003, DeviceObject, \
|
---|
582 | NULL, 0, NULL, 0, \
|
---|
583 | TRUE, Event, IoStatusBlock)
|
---|
584 |
|
---|
585 | /*
|
---|
586 | * VOID
|
---|
587 | * TdiBuildListen(
|
---|
588 | * IN PIRP Irp,
|
---|
589 | * IN PDEVICE_OBJECT DevObj,
|
---|
590 | * IN PFILE_OBJECT FileObj,
|
---|
591 | * IN PVOID CompRoutine,
|
---|
592 | * IN PVOID Contxt,
|
---|
593 | * IN ULONG Flags,
|
---|
594 | * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
|
---|
595 | * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
|
---|
596 | */
|
---|
597 | #define TdiBuildListen( \
|
---|
598 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
599 | Flags, RequestConnectionInfo, ReturnConnectionInfo) \
|
---|
600 | { \
|
---|
601 | PTDI_REQUEST_KERNEL _Request; \
|
---|
602 | PIO_STACK_LOCATION _IrpSp; \
|
---|
603 | \
|
---|
604 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
605 | \
|
---|
606 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
607 | Contxt, _IrpSp, TDI_LISTEN); \
|
---|
608 | \
|
---|
609 | _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
|
---|
610 | _Request->RequestConnectionInformation = (RequestConnectionInfo); \
|
---|
611 | _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
|
---|
612 | _Request->RequestFlags = (Flags); \
|
---|
613 | }
|
---|
614 |
|
---|
615 | TDIKRNLAPI
|
---|
616 | VOID
|
---|
617 | DDKAPI
|
---|
618 | TdiBuildNetbiosAddress(
|
---|
619 | /*IN*/ PUCHAR NetbiosName,
|
---|
620 | /*IN*/ BOOLEAN IsGroupName,
|
---|
621 | /*IN OUT*/ PTA_NETBIOS_ADDRESS NetworkName);
|
---|
622 |
|
---|
623 | TDIKRNLAPI
|
---|
624 | NTSTATUS
|
---|
625 | DDKAPI
|
---|
626 | TdiBuildNetbiosAddressEa(
|
---|
627 | /*IN*/ PUCHAR Buffer,
|
---|
628 | /*IN*/ BOOLEAN IsGroupName,
|
---|
629 | /*IN*/ PUCHAR NetbiosName);
|
---|
630 |
|
---|
631 | /*
|
---|
632 | * VOID
|
---|
633 | * TdiBuildQueryInformation(
|
---|
634 | * IN PIRP Irp,
|
---|
635 | * IN PDEVICE_OBJECT DevObj,
|
---|
636 | * IN PFILE_OBJECT FileObj,
|
---|
637 | * IN PVOID CompRoutine,
|
---|
638 | * IN PVOID Contxt,
|
---|
639 | * IN UINT QType,
|
---|
640 | * IN PMDL MdlAddr);
|
---|
641 | */
|
---|
642 | #define TdiBuildQueryInformation( \
|
---|
643 | Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr) \
|
---|
644 | { \
|
---|
645 | PTDI_REQUEST_KERNEL_QUERY_INFORMATION _Request; \
|
---|
646 | PIO_STACK_LOCATION _IrpSp; \
|
---|
647 | \
|
---|
648 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
649 | \
|
---|
650 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
651 | Contxt, _IrpSp, TDI_QUERY_INFORMATION); \
|
---|
652 | \
|
---|
653 | _Request = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)&_IrpSp->Parameters; \
|
---|
654 | _Request->RequestConnectionInformation = NULL; \
|
---|
655 | _Request->QueryType = (ULONG)(QType); \
|
---|
656 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
657 | }
|
---|
658 |
|
---|
659 | /*
|
---|
660 | * VOID
|
---|
661 | * TdiBuildReceive(
|
---|
662 | * IN PIRP Irp,
|
---|
663 | * IN PDEVICE_OBJECT DevObj,
|
---|
664 | * IN PFILE_OBJECT FileObj,
|
---|
665 | * IN PVOID CompRoutine,
|
---|
666 | * IN PVOID Contxt,
|
---|
667 | * IN PMDL MdlAddr,
|
---|
668 | * IN ULONG InFlags,
|
---|
669 | * IN ULONG ReceiveLen);
|
---|
670 | */
|
---|
671 | #define TdiBuildReceive( \
|
---|
672 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
673 | MdlAddr, InFlags, ReceiveLen) \
|
---|
674 | { \
|
---|
675 | PTDI_REQUEST_KERNEL_RECEIVE _Request; \
|
---|
676 | PIO_STACK_LOCATION _IrpSp; \
|
---|
677 | \
|
---|
678 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
679 | \
|
---|
680 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
681 | Contxt, _IrpSp, TDI_RECEIVE); \
|
---|
682 | \
|
---|
683 | _Request = (PTDI_REQUEST_KERNEL_RECEIVE)&_IrpSp->Parameters; \
|
---|
684 | _Request->ReceiveFlags = (InFlags); \
|
---|
685 | _Request->ReceiveLength = (ReceiveLen); \
|
---|
686 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
687 | }
|
---|
688 |
|
---|
689 | /*
|
---|
690 | * VOID
|
---|
691 | * TdiBuildReceiveDatagram(
|
---|
692 | * IN PIRP Irp,
|
---|
693 | * IN PDEVICE_OBJECT DevObj,
|
---|
694 | * IN PFILE_OBJECT FileObj,
|
---|
695 | * IN PVOID CompRoutine,
|
---|
696 | * IN PVOID Contxt,
|
---|
697 | * IN PMDL MdlAddr,
|
---|
698 | * IN ULONG ReceiveLen,
|
---|
699 | * IN PTDI_CONNECTION_INFORMATION ReceiveDatagramInfo,
|
---|
700 | * OUT PTDI_CONNECTION_INFORMATION ReturnInfo,
|
---|
701 | * ULONG InFlags);
|
---|
702 | */
|
---|
703 | #define TdiBuildReceiveDatagram( \
|
---|
704 | Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, \
|
---|
705 | ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags) \
|
---|
706 | { \
|
---|
707 | PTDI_REQUEST_KERNEL_RECEIVEDG _Request; \
|
---|
708 | PIO_STACK_LOCATION _IrpSp; \
|
---|
709 | \
|
---|
710 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
711 | \
|
---|
712 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
713 | Contxt, _IrpSp, TDI_RECEIVE_DATAGRAM); \
|
---|
714 | \
|
---|
715 | _Request = (PTDI_REQUEST_KERNEL_RECEIVEDG)&_IrpSp->Parameters; \
|
---|
716 | _Request->ReceiveDatagramInformation = (ReceiveDatagramInfo); \
|
---|
717 | _Request->ReturnDatagramInformation = (ReturnInfo); \
|
---|
718 | _Request->ReceiveLength = (ReceiveLen); \
|
---|
719 | _Request->ReceiveFlags = (InFlags); \
|
---|
720 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
721 | }
|
---|
722 |
|
---|
723 | /*
|
---|
724 | * VOID
|
---|
725 | * TdiBuildSend(
|
---|
726 | * IN PIRP Irp,
|
---|
727 | * IN PDEVICE_OBJECT DevObj,
|
---|
728 | * IN PFILE_OBJECT FileObj,
|
---|
729 | * IN PVOID CompRoutine,
|
---|
730 | * IN PVOID Contxt,
|
---|
731 | * IN PMDL MdlAddr,
|
---|
732 | * IN ULONG InFlags,
|
---|
733 | * IN ULONG SendLen);
|
---|
734 | */
|
---|
735 | #define TdiBuildSend( \
|
---|
736 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
737 | MdlAddr, InFlags, SendLen) \
|
---|
738 | { \
|
---|
739 | PTDI_REQUEST_KERNEL_SEND _Request; \
|
---|
740 | PIO_STACK_LOCATION _IrpSp; \
|
---|
741 | \
|
---|
742 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
743 | \
|
---|
744 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
745 | Contxt, _IrpSp, TDI_SEND); \
|
---|
746 | \
|
---|
747 | _Request = (PTDI_REQUEST_KERNEL_SEND)&_IrpSp->Parameters; \
|
---|
748 | _Request->SendFlags = (InFlags); \
|
---|
749 | _Request->SendLength = (SendLen); \
|
---|
750 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
751 | }
|
---|
752 |
|
---|
753 | /*
|
---|
754 | * VOID
|
---|
755 | * TdiBuildSendDatagram(
|
---|
756 | * IN PIRP Irp,
|
---|
757 | * IN PDEVICE_OBJECT DevObj,
|
---|
758 | * IN PFILE_OBJECT FileObj,
|
---|
759 | * IN PVOID CompRoutine,
|
---|
760 | * IN PVOID Contxt,
|
---|
761 | * IN PMDL MdlAddr,
|
---|
762 | * IN ULONG SendLen,
|
---|
763 | * IN PTDI_CONNECTION_INFORMATION SendDatagramInfo);
|
---|
764 | */
|
---|
765 | #define TdiBuildSendDatagram( \
|
---|
766 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
767 | MdlAddr, SendLen, SendDatagramInfo) \
|
---|
768 | { \
|
---|
769 | PTDI_REQUEST_KERNEL_SENDDG _Request; \
|
---|
770 | PIO_STACK_LOCATION _IrpSp; \
|
---|
771 | \
|
---|
772 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
773 | \
|
---|
774 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
775 | Contxt, _IrpSp, TDI_SEND_DATAGRAM); \
|
---|
776 | \
|
---|
777 | _Request = (PTDI_REQUEST_KERNEL_SENDDG)&_IrpSp->Parameters; \
|
---|
778 | _Request->SendDatagramInformation = (SendDatagramInfo); \
|
---|
779 | _Request->SendLength = (SendLen); \
|
---|
780 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
781 | }
|
---|
782 |
|
---|
783 | /*
|
---|
784 | * VOID
|
---|
785 | * TdiBuildSetEventHandler(
|
---|
786 | * IN PIRP Irp,
|
---|
787 | * IN PDEVICE_OBJECT DevObj,
|
---|
788 | * IN PFILE_OBJECT FileObj,
|
---|
789 | * IN PVOID CompRoutine,
|
---|
790 | * IN PVOID Contxt,
|
---|
791 | * IN INT InEventType,
|
---|
792 | * IN PVOID InEventHandler,
|
---|
793 | * IN PVOID InEventContext);
|
---|
794 | */
|
---|
795 | #define TdiBuildSetEventHandler( \
|
---|
796 | Irp, DevObj, FileObj, CompRoutine, Contxt, \
|
---|
797 | InEventType, InEventHandler, InEventContext) \
|
---|
798 | { \
|
---|
799 | PTDI_REQUEST_KERNEL_SET_EVENT _Request; \
|
---|
800 | PIO_STACK_LOCATION _IrpSp; \
|
---|
801 | \
|
---|
802 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
803 | \
|
---|
804 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
805 | Contxt, _IrpSp, TDI_SET_EVENT_HANDLER); \
|
---|
806 | \
|
---|
807 | _Request = (PTDI_REQUEST_KERNEL_SET_EVENT)&_IrpSp->Parameters; \
|
---|
808 | _Request->EventType = (InEventType); \
|
---|
809 | _Request->EventHandler = (PVOID)(InEventHandler); \
|
---|
810 | _Request->EventContext = (PVOID)(InEventContext); \
|
---|
811 | }
|
---|
812 |
|
---|
813 | /*
|
---|
814 | * VOID
|
---|
815 | * TdiBuildSetInformation(
|
---|
816 | * IN PIRP Irp,
|
---|
817 | * IN PDEVICE_OBJECT DevObj,
|
---|
818 | * IN PFILE_OBJECT FileObj,
|
---|
819 | * IN PVOID CompRoutine,
|
---|
820 | * IN PVOID Contxt,
|
---|
821 | * IN UINT SType,
|
---|
822 | * IN PMDL MdlAddr);
|
---|
823 | */
|
---|
824 | #define TdiBuildSetInformation( \
|
---|
825 | Irp, DevObj, FileObj, CompRoutine, Contxt, SType, MdlAddr) \
|
---|
826 | { \
|
---|
827 | PTDI_REQUEST_KERNEL_SET_INFORMATION _Request; \
|
---|
828 | PIO_STACK_LOCATION _IrpSp; \
|
---|
829 | \
|
---|
830 | _IrpSp = IoGetNextIrpStackLocation(Irp); \
|
---|
831 | \
|
---|
832 | TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
|
---|
833 | Contxt, _IrpSp, TDI_SET_INFORMATION); \
|
---|
834 | \
|
---|
835 | _Request = (PTDI_REQUEST_KERNEL_SET_INFORMATION)&_IrpSp->Parameters; \
|
---|
836 | _Request->RequestConnectionInformation = NULL; \
|
---|
837 | _Request->SetType = (ULONG)(SType); \
|
---|
838 | (Irp)->MdlAddress = (MdlAddr); \
|
---|
839 | }
|
---|
840 |
|
---|
841 | /* TDI20_CLIENT_INTERFACE_INFO.TdiVersion constants */
|
---|
842 | #define TDI_CURRENT_MAJOR_VERSION 2
|
---|
843 | #define TDI_CURRENT_MINOR_VERSION 0
|
---|
844 |
|
---|
845 | #define TDI_CURRENT_VERSION ((TDI_CURRENT_MINOR_VERSION) << 8 \
|
---|
846 | | (TDI_CURRENT_MAJOR_VERSION))
|
---|
847 |
|
---|
848 | #define TDI_VERSION_ONE 0x0001
|
---|
849 |
|
---|
850 | typedef enum _TDI_PNP_OPCODE {
|
---|
851 | TDI_PNP_OP_MIN,
|
---|
852 | TDI_PNP_OP_ADD,
|
---|
853 | TDI_PNP_OP_DEL,
|
---|
854 | TDI_PNP_OP_UPDATE,
|
---|
855 | TDI_PNP_OP_PROVIDERREADY,
|
---|
856 | TDI_PNP_OP_NETREADY,
|
---|
857 | TDI_PNP_OP_ADD_IGNORE_BINDING,
|
---|
858 | TDI_PNP_OP_DELETE_IGNORE_BINDING,
|
---|
859 | TDI_PNP_OP_MAX
|
---|
860 | } TDI_PNP_OPCODE;
|
---|
861 |
|
---|
862 | /* TDI_PNP_CONTEXT.ContextType */
|
---|
863 | #define TDI_PNP_CONTEXT_TYPE_IF_NAME 0x1
|
---|
864 | #define TDI_PNP_CONTEXT_TYPE_IF_ADDR 0x2
|
---|
865 | #define TDI_PNP_CONTEXT_TYPE_PDO 0x3
|
---|
866 | #define TDI_PNP_CONTEXT_TYPE_FIRST_OR_LAST_IF 0x4
|
---|
867 |
|
---|
868 | typedef struct _TDI_PNP_CONTEXT {
|
---|
869 | USHORT ContextSize;
|
---|
870 | USHORT ContextType;
|
---|
871 | UCHAR ContextData[1];
|
---|
872 | } TDI_PNP_CONTEXT, *PTDI_PNP_CONTEXT;
|
---|
873 |
|
---|
874 | typedef VOID DDKAPI
|
---|
875 | (*TDI_ADD_ADDRESS_HANDLER)(
|
---|
876 | /*IN*/ PTA_ADDRESS Address);
|
---|
877 |
|
---|
878 | typedef VOID DDKAPI
|
---|
879 | (*TDI_ADD_ADDRESS_HANDLER_V2)(
|
---|
880 | /*IN*/ PTA_ADDRESS Address,
|
---|
881 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
882 | /*IN*/ PTDI_PNP_CONTEXT Context);
|
---|
883 |
|
---|
884 | typedef VOID DDKAPI
|
---|
885 | (*TDI_BINDING_HANDLER)(
|
---|
886 | /*IN*/ TDI_PNP_OPCODE PnPOpcode,
|
---|
887 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
888 | /*IN*/ PWSTR MultiSZBindList);
|
---|
889 |
|
---|
890 | typedef VOID DDKAPI
|
---|
891 | (*TDI_BIND_HANDLER)(
|
---|
892 | /*IN*/ PUNICODE_STRING DeviceName);
|
---|
893 |
|
---|
894 | typedef VOID DDKAPI
|
---|
895 | (*TDI_DEL_ADDRESS_HANDLER)(
|
---|
896 | /*IN*/ PTA_ADDRESS Address);
|
---|
897 |
|
---|
898 | typedef VOID DDKAPI
|
---|
899 | (*TDI_DEL_ADDRESS_HANDLER_V2)(
|
---|
900 | /*IN*/ PTA_ADDRESS Address,
|
---|
901 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
902 | /*IN*/ PTDI_PNP_CONTEXT Context);
|
---|
903 |
|
---|
904 | typedef NTSTATUS DDKAPI
|
---|
905 | (*TDI_PNP_POWER_HANDLER)(
|
---|
906 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
907 | /*IN*/ PNET_PNP_EVENT PowerEvent,
|
---|
908 | /*IN*/ PTDI_PNP_CONTEXT Context1,
|
---|
909 | /*IN*/ PTDI_PNP_CONTEXT Context2);
|
---|
910 |
|
---|
911 | typedef VOID DDKAPI
|
---|
912 | (*TDI_UNBIND_HANDLER)(
|
---|
913 | /*IN*/ PUNICODE_STRING DeviceName);
|
---|
914 |
|
---|
915 | typedef VOID DDKAPI
|
---|
916 | (*ProviderPnPPowerComplete)(
|
---|
917 | /*IN*/ PNET_PNP_EVENT NetEvent,
|
---|
918 | /*IN*/ NTSTATUS ProviderStatus);
|
---|
919 |
|
---|
920 | typedef struct _TDI20_CLIENT_INTERFACE_INFO {
|
---|
921 | _ANONYMOUS_UNION union {
|
---|
922 | _ANONYMOUS_STRUCT struct {
|
---|
923 | UCHAR MajorTdiVersion;
|
---|
924 | UCHAR MinorTdiVersion;
|
---|
925 | } DUMMYSTRUCTNAME;
|
---|
926 | USHORT TdiVersion;
|
---|
927 | } DUMMYUNIONNAME;
|
---|
928 | USHORT Unused;
|
---|
929 | PUNICODE_STRING ClientName;
|
---|
930 | TDI_PNP_POWER_HANDLER PnPPowerHandler;
|
---|
931 | _ANONYMOUS_UNION union {
|
---|
932 | TDI_BINDING_HANDLER BindingHandler;
|
---|
933 | _ANONYMOUS_STRUCT struct {
|
---|
934 | TDI_BIND_HANDLER BindHandler;
|
---|
935 | TDI_UNBIND_HANDLER UnBindHandler;
|
---|
936 | } DUMMYSTRUCTNAME;
|
---|
937 | }DUMMYUNIONNAME2;
|
---|
938 | _ANONYMOUS_UNION union {
|
---|
939 | _ANONYMOUS_STRUCT struct {
|
---|
940 | TDI_ADD_ADDRESS_HANDLER_V2 AddAddressHandlerV2;
|
---|
941 | TDI_DEL_ADDRESS_HANDLER_V2 DelAddressHandlerV2;
|
---|
942 | } DUMMYSTRUCTNAME;
|
---|
943 | _ANONYMOUS_STRUCT struct {
|
---|
944 | TDI_ADD_ADDRESS_HANDLER AddAddressHandler;
|
---|
945 | TDI_DEL_ADDRESS_HANDLER DelAddressHandler;
|
---|
946 | } DUMMYSTRUCTNAME2;
|
---|
947 | } DUMMYUNIONNAME3;
|
---|
948 | } TDI20_CLIENT_INTERFACE_INFO, *PTDI20_CLIENT_INTERFACE_INFO;
|
---|
949 |
|
---|
950 | typedef TDI20_CLIENT_INTERFACE_INFO TDI_CLIENT_INTERFACE_INFO;
|
---|
951 | typedef TDI_CLIENT_INTERFACE_INFO *PTDI_CLIENT_INTERFACE_INFO;
|
---|
952 |
|
---|
953 |
|
---|
954 | /* TDI functions */
|
---|
955 |
|
---|
956 | /*
|
---|
957 | * VOID
|
---|
958 | * TdiCompleteRequest(
|
---|
959 | * IN PIRP Irp,
|
---|
960 | * IN NTSTATUS Status);
|
---|
961 | */
|
---|
962 | #define TdiCompleteRequest(Irp, Status) \
|
---|
963 | { \
|
---|
964 | (Irp)->IoStatus.Status = (Status); \
|
---|
965 | IoCompleteRequest((Irp), IO_NETWORK_INCREMENT); \
|
---|
966 | }
|
---|
967 |
|
---|
968 | TDIKRNLAPI
|
---|
969 | NTSTATUS
|
---|
970 | DDKAPI
|
---|
971 | TdiCopyBufferToMdl(
|
---|
972 | /*IN*/ PVOID SourceBuffer,
|
---|
973 | /*IN*/ ULONG SourceOffset,
|
---|
974 | /*IN*/ ULONG SourceBytesToCopy,
|
---|
975 | /*IN*/ PMDL DestinationMdlChain,
|
---|
976 | /*IN*/ ULONG DestinationOffset,
|
---|
977 | /*IN*/ PULONG BytesCopied);
|
---|
978 |
|
---|
979 | /*
|
---|
980 | * VOID
|
---|
981 | * TdiCopyLookaheadData(
|
---|
982 | * IN PVOID Destination,
|
---|
983 | * IN PVOID Source,
|
---|
984 | * IN ULONG Length,
|
---|
985 | * IN ULONG ReceiveFlags);
|
---|
986 | */
|
---|
987 | #define TdiCopyLookaheadData(Destination, Source, Length, ReceiveFlags) \
|
---|
988 | RtlCopyMemory(Destination, Source, Length)
|
---|
989 |
|
---|
990 | TDIKRNLAPI
|
---|
991 | NTSTATUS
|
---|
992 | DDKAPI
|
---|
993 | TdiCopyMdlChainToMdlChain (
|
---|
994 | /*IN*/ PMDL SourceMdlChain,
|
---|
995 | /*IN*/ ULONG SourceOffset,
|
---|
996 | /*IN*/ PMDL DestinationMdlChain,
|
---|
997 | /*IN*/ ULONG DestinationOffset,
|
---|
998 | /*OUT*/ PULONG BytesCopied);
|
---|
999 |
|
---|
1000 | TDIKRNLAPI
|
---|
1001 | NTSTATUS
|
---|
1002 | DDKAPI
|
---|
1003 | TdiCopyMdlToBuffer(
|
---|
1004 | /*IN*/ PMDL SourceMdlChain,
|
---|
1005 | /*IN*/ ULONG SourceOffset,
|
---|
1006 | /*IN*/ PVOID DestinationBuffer,
|
---|
1007 | /*IN*/ ULONG DestinationOffset,
|
---|
1008 | /*IN*/ ULONG DestinationBufferSize,
|
---|
1009 | /*OUT*/ PULONG BytesCopied);
|
---|
1010 |
|
---|
1011 | TDIKRNLAPI
|
---|
1012 | NTSTATUS
|
---|
1013 | DDKAPI
|
---|
1014 | TdiDeregisterAddressChangeHandler(
|
---|
1015 | /*IN*/ HANDLE BindingHandle);
|
---|
1016 |
|
---|
1017 | TDIKRNLAPI
|
---|
1018 | NTSTATUS
|
---|
1019 | DDKAPI
|
---|
1020 | TdiDeregisterDeviceObject(
|
---|
1021 | /*IN*/ HANDLE DevRegistrationHandle);
|
---|
1022 |
|
---|
1023 | TDIKRNLAPI
|
---|
1024 | NTSTATUS
|
---|
1025 | DDKAPI
|
---|
1026 | TdiDeregisterNetAddress(
|
---|
1027 | /*IN*/ HANDLE AddrRegistrationHandle);
|
---|
1028 |
|
---|
1029 | TDIKRNLAPI
|
---|
1030 | NTSTATUS
|
---|
1031 | DDKAPI
|
---|
1032 | TdiDeregisterPnPHandlers(
|
---|
1033 | /*IN*/ HANDLE BindingHandle);
|
---|
1034 |
|
---|
1035 | TDIKRNLAPI
|
---|
1036 | NTSTATUS
|
---|
1037 | DDKAPI
|
---|
1038 | TdiDeregisterProvider(
|
---|
1039 | /*IN*/ HANDLE ProviderHandle);
|
---|
1040 |
|
---|
1041 | TDIKRNLAPI
|
---|
1042 | NTSTATUS
|
---|
1043 | DDKAPI
|
---|
1044 | TdiEnumerateAddresses(
|
---|
1045 | /*IN*/ HANDLE BindingHandle);
|
---|
1046 |
|
---|
1047 | TDIKRNLAPI
|
---|
1048 | VOID
|
---|
1049 | DDKAPI
|
---|
1050 | TdiInitialize(
|
---|
1051 | VOID);
|
---|
1052 |
|
---|
1053 | TDIKRNLAPI
|
---|
1054 | VOID
|
---|
1055 | DDKAPI
|
---|
1056 | TdiMapBuffer(
|
---|
1057 | /*IN*/ PMDL MdlChain);
|
---|
1058 |
|
---|
1059 | TDIKRNLAPI
|
---|
1060 | NTSTATUS
|
---|
1061 | DDKAPI
|
---|
1062 | TdiMapUserRequest(
|
---|
1063 | /*IN*/ PDEVICE_OBJECT DeviceObject,
|
---|
1064 | /*IN*/ PIRP Irp,
|
---|
1065 | /*IN*/ PIO_STACK_LOCATION IrpSp);
|
---|
1066 |
|
---|
1067 | TDIKRNLAPI
|
---|
1068 | BOOLEAN
|
---|
1069 | DDKAPI
|
---|
1070 | TdiMatchPdoWithChainedReceiveContext(
|
---|
1071 | /*IN*/ PVOID TsduDescriptor,
|
---|
1072 | /*IN*/ PVOID PDO);
|
---|
1073 |
|
---|
1074 | TDIKRNLAPI
|
---|
1075 | VOID
|
---|
1076 | DDKAPI
|
---|
1077 | TdiPnPPowerComplete(
|
---|
1078 | /*IN*/ HANDLE BindingHandle,
|
---|
1079 | /*IN*/ PNET_PNP_EVENT PowerEvent,
|
---|
1080 | /*IN*/ NTSTATUS Status);
|
---|
1081 |
|
---|
1082 | TDIKRNLAPI
|
---|
1083 | NTSTATUS
|
---|
1084 | DDKAPI
|
---|
1085 | TdiPnPPowerRequest(
|
---|
1086 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
1087 | /*IN*/ PNET_PNP_EVENT PowerEvent,
|
---|
1088 | /*IN*/ PTDI_PNP_CONTEXT Context1,
|
---|
1089 | /*IN*/ PTDI_PNP_CONTEXT Context2,
|
---|
1090 | /*IN*/ ProviderPnPPowerComplete ProtocolCompletionHandler);
|
---|
1091 |
|
---|
1092 | TDIKRNLAPI
|
---|
1093 | NTSTATUS
|
---|
1094 | DDKAPI
|
---|
1095 | TdiProviderReady(
|
---|
1096 | /*IN*/ HANDLE ProviderHandle);
|
---|
1097 |
|
---|
1098 | TDIKRNLAPI
|
---|
1099 | NTSTATUS
|
---|
1100 | DDKAPI
|
---|
1101 | TdiRegisterAddressChangeHandler(
|
---|
1102 | /*IN*/ TDI_ADD_ADDRESS_HANDLER AddHandler,
|
---|
1103 | /*IN*/ TDI_DEL_ADDRESS_HANDLER DeleteHandler,
|
---|
1104 | /*OUT*/ HANDLE *BindingHandle);
|
---|
1105 |
|
---|
1106 | TDIKRNLAPI
|
---|
1107 | NTSTATUS
|
---|
1108 | DDKAPI
|
---|
1109 | TdiRegisterDeviceObject(
|
---|
1110 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
1111 | /*OUT*/ HANDLE *DevRegistrationHandle);
|
---|
1112 |
|
---|
1113 | TDIKRNLAPI
|
---|
1114 | NTSTATUS
|
---|
1115 | DDKAPI
|
---|
1116 | TdiRegisterNetAddress(
|
---|
1117 | /*IN*/ PTA_ADDRESS Address,
|
---|
1118 | /*IN*/ PUNICODE_STRING DeviceName,
|
---|
1119 | /*IN*/ PTDI_PNP_CONTEXT Context,
|
---|
1120 | /*OUT*/ HANDLE *AddrRegistrationHandle);
|
---|
1121 |
|
---|
1122 | TDIKRNLAPI
|
---|
1123 | NTSTATUS
|
---|
1124 | DDKAPI
|
---|
1125 | TdiRegisterNotificationHandler(
|
---|
1126 | /*IN*/ TDI_BIND_HANDLER BindHandler,
|
---|
1127 | /*IN*/ TDI_UNBIND_HANDLER UnbindHandler,
|
---|
1128 | /*OUT*/ HANDLE *BindingHandle);
|
---|
1129 |
|
---|
1130 | TDIKRNLAPI
|
---|
1131 | NTSTATUS
|
---|
1132 | DDKAPI
|
---|
1133 | TdiRegisterPnPHandlers(
|
---|
1134 | /*IN*/ PTDI_CLIENT_INTERFACE_INFO ClientInterfaceInfo,
|
---|
1135 | /*IN*/ ULONG InterfaceInfoSize,
|
---|
1136 | /*OUT*/ HANDLE *BindingHandle);
|
---|
1137 |
|
---|
1138 | TDIKRNLAPI
|
---|
1139 | NTSTATUS
|
---|
1140 | DDKAPI
|
---|
1141 | TdiRegisterProvider(
|
---|
1142 | /*IN*/ PUNICODE_STRING ProviderName,
|
---|
1143 | /*OUT*/ HANDLE *ProviderHandle);
|
---|
1144 |
|
---|
1145 | TDIKRNLAPI
|
---|
1146 | VOID
|
---|
1147 | DDKAPI
|
---|
1148 | TdiReturnChainedReceives(
|
---|
1149 | /*IN*/ PVOID *TsduDescriptors,
|
---|
1150 | /*IN*/ ULONG NumberOfTsdus);
|
---|
1151 |
|
---|
1152 | TDIKRNLAPI
|
---|
1153 | VOID
|
---|
1154 | DDKAPI
|
---|
1155 | TdiUnmapBuffer(
|
---|
1156 | /*IN*/ PMDL MdlChain);
|
---|
1157 |
|
---|
1158 | #ifdef __cplusplus
|
---|
1159 | }
|
---|
1160 | #endif
|
---|
1161 |
|
---|
1162 | #endif /* __TDIKRNL_H */
|
---|