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