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