📄 tdi.h
字号:
TDI_ADDRESS_NETBIOS Address[1];
} Address [1];
} TA_NETBIOS_ADDRESS, *PTA_NETBIOS_ADDRESS;
typedef struct _TA_ADDRESS_NETBIOS_EX {
LONG TAAddressCount;
struct _AddrNetbiosEx {
USHORT AddressLength; // length in bytes of this address == 36
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NETBIOS_EX
TDI_ADDRESS_NETBIOS_EX Address[1];
} Address [1];
} TA_NETBIOS_EX_ADDRESS, *PTA_NETBIOS_EX_ADDRESS;
typedef struct _TA_APPLETALK_ADDR {
LONG TAAddressCount;
struct _AddrAtalk {
USHORT AddressLength; // length in bytes of this address == 4
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_APPLETALK
TDI_ADDRESS_APPLETALK Address[1];
} Address[1];
} TA_APPLETALK_ADDRESS, *PTA_APPLETALK_ADDRESS;
typedef struct _TA_ADDRESS_IP {
LONG TAAddressCount;
struct _AddrIp {
USHORT AddressLength; // length in bytes of this address == 14
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IP
TDI_ADDRESS_IP Address[1];
} Address [1];
} TA_IP_ADDRESS, *PTA_IP_ADDRESS;
typedef struct _TA_ADDRESS_IP6 {
LONG TAAddressCount;
struct _AddrIp6 {
USHORT AddressLength; // length in bytes of this address == 24
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IP6
TDI_ADDRESS_IP6 Address[1];
} Address [1];
} TA_IP6_ADDRESS, *PTA_IP6_ADDRESS;
typedef struct _TA_ADDRESS_IPX {
LONG TAAddressCount;
struct _AddrIpx {
USHORT AddressLength; // length in bytes of this address == 12
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IPX
TDI_ADDRESS_IPX Address[1];
} Address [1];
} TA_IPX_ADDRESS, *PTA_IPX_ADDRESS;
typedef struct _TA_ADDRESS_NS {
LONG TAAddressCount;
struct _AddrNs {
USHORT AddressLength; // length in bytes of this address == 12
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NS
TDI_ADDRESS_NS Address[1];
} Address [1];
} TA_NS_ADDRESS, *PTA_NS_ADDRESS;
typedef struct _TA_ADDRESS_VNS {
LONG TAAddressCount;
struct _AddrVns {
USHORT AddressLength; // length in bytes of this address == 14
USHORT AddressType; // this will == TDI_ADDRESS_TYPE_VNS
TDI_ADDRESS_VNS Address[1];
} Address [1];
} TA_VNS_ADDRESS, *PTA_VNS_ADDRESS;
#include <packoff.h>
//
// This structure is passed with every request to TDI. It describes that
// request and the parameters to it.
//
typedef struct _TDI_REQUEST {
union {
HANDLE AddressHandle;
CONNECTION_CONTEXT ConnectionContext;
HANDLE ControlChannel;
} Handle;
PVOID RequestNotifyObject;
PVOID RequestContext;
TDI_STATUS TdiStatus;
} TDI_REQUEST, *PTDI_REQUEST;
//
// Structure for information returned by the TDI provider. This structure is
// filled in upon request completion.
//
typedef struct _TDI_REQUEST_STATUS {
TDI_STATUS Status; // status of request completion
PVOID RequestContext; // the request Context
ULONG BytesTransferred; // number of bytes transferred in the request
} TDI_REQUEST_STATUS, *PTDI_REQUEST_STATUS;
//
// connection primitives information structure. This is passed to the TDI calls
// (Accept, Connect, xxx) that do connecting sorts of things.
//
typedef struct _TDI_CONNECTION_INFORMATION {
LONG UserDataLength; // length of user data buffer
PVOID UserData; // pointer to user data buffer
LONG OptionsLength; // length of follwoing buffer
PVOID Options; // pointer to buffer containing options
LONG RemoteAddressLength; // length of following buffer
PVOID RemoteAddress; // buffer containing the remote address
} TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION;
//
// structure defining a counted string is defined in
// \nt\public\sdk\inc\ntdefs.h as
// typedef struct _STRING {
// USHORT Length;
// USHORT MaximumLength;
// PCHAR Buffer;
// } STRING;
// typedef STRING *PSTRING;
// typedef STRING ANSI_STRING;
// typedef PSTRING PANSI_STRING;
//
//
// Event types that are known
//
#define TDI_EVENT_CONNECT ((USHORT)0) // TDI_IND_CONNECT event handler.
#define TDI_EVENT_DISCONNECT ((USHORT)1) // TDI_IND_DISCONNECT event handler.
#define TDI_EVENT_ERROR ((USHORT)2) // TDI_IND_ERROR event handler.
#define TDI_EVENT_RECEIVE ((USHORT)3) // TDI_IND_RECEIVE event handler.
#define TDI_EVENT_RECEIVE_DATAGRAM ((USHORT)4) // TDI_IND_RECEIVE_DATAGRAM event handler.
#define TDI_EVENT_RECEIVE_EXPEDITED ((USHORT)5) // TDI_IND_RECEIVE_EXPEDITED event handler.
#define TDI_EVENT_SEND_POSSIBLE ((USHORT)6) // TDI_IND_SEND_POSSIBLE event handler
//
// Associate Address is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call.
//
typedef struct _TDI_REQUEST_ASSOCIATE {
TDI_REQUEST Request;
HANDLE AddressHandle;
} TDI_REQUEST_ASSOCIATE_ADDRESS, *PTDI_REQUEST_ASSOCIATE_ADDRESS;
//
// Disassociate Address passes no structure, uses the request code
// IOCTL_TDI_DISASSOCIATE_ADDRESS. This call will never pend.
//
//
// Connect is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call.
//
typedef struct _TDI_CONNECT_REQUEST {
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
LARGE_INTEGER Timeout;
} TDI_REQUEST_CONNECT, *PTDI_REQUEST_CONNECT;
//
// Accept is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call. Accept is called by the user when a listen completes,
// before any activity can occur on a connection. AcceptConnectionId specifies
// the connection on which the connection is accepted; in most cases, this
// will be null, which that the connection is to be accepted on the
// connection on which the listen completed. If the transport provider supports
// "forwarding" of connections (the idea that a particular connection listens
// all the time, and creates new connections as needed for incoming connection
// requests and attaches them to the listen), this is the mechanism used to
// associate connections with the listen.
//
typedef struct _TDI_REQUEST_ACCEPT {
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
} TDI_REQUEST_ACCEPT, *PTDI_REQUEST_ACCEPT;
//
// Listen is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call. RequestConnectionInformation contains information about
// the remote address to be listen for connections from; if NULL, any address
// is accepted. ReturnConnectionInformation returns information about the
// remote node that actually connected.
//
typedef struct _TDI_REQUEST_LISTEN {
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
USHORT ListenFlags;
} TDI_REQUEST_LISTEN, *PTDI_REQUEST_LISTEN;
//
// Disconnect is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call. Disconnect differs from Close in offering more options.
// For example, Close terminates all activity on a connection (immediately),
// failing all outstanding requests, and tearing down the connection. With
// some providers, Disconnect allows a "graceful" disconnect, causing new activity
// to be rejected but allowing old activity to run down to completion.
//
typedef struct _TDI_DISCONNECT_REQUEST {
TDI_REQUEST Request;
LARGE_INTEGER Timeout;
} TDI_REQUEST_DISCONNECT, *PTDI_REQUEST_DISCONNECT;
//
// Send is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call. Note that it is possible to Send using the file system's
// Write call. This will have the same effect as doing a Send with all flags
// set to null.
//
typedef struct _TDI_REQUEST_SEND {
TDI_REQUEST Request;
USHORT SendFlags;
} TDI_REQUEST_SEND, *PTDI_REQUEST_SEND;
//
// Receive is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the connection returned in the
// NtCreateFile call. Note that it is possible to Receive using the file
// system's Read call. Note further that receive returns a number of TDI_STATUS
// values, which indicate things such as partial receives.
//
typedef struct _TDI_REQUEST_RECEIVE {
TDI_REQUEST Request;
USHORT ReceiveFlags;
} TDI_REQUEST_RECEIVE, *PTDI_REQUEST_RECEIVE;
//
// SendDatagram is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
// different than above!!) returned in the NtCreateFile call. Send Datagram
// specifies the address of the receiver through the SendDatagramInformation
// structure, using RemoteAddress to point to the transport address of the
// destination of the datagram.
//
typedef struct _TDI_REQUEST_SEND_DATAGRAM {
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION SendDatagramInformation;
} TDI_REQUEST_SEND_DATAGRAM, *PTDI_REQUEST_SEND_DATAGRAM;
//
// ReceiveDatagram is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
// different than above!!) returned in the NtCreateFile call. Receive Datagram
// specifies the address from which to receive a datagram through the
// ReceiveDatagramInformation structure, using RemoteAddress to point to the
// transport address of the origin of the datagram. (Broadcast datagrams are
// received by making the pointer NULL.) The actual address of the sender of
// the datagram is returned in ReturnInformation.
//
// for the receive datagram call
//
typedef struct _TDI_REQUEST_RECEIVE_DATAGRAM {
TDI_REQUEST Request;
PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
PTDI_CONNECTION_INFORMATION ReturnInformation;
USHORT ReceiveFlags;
} TDI_REQUEST_RECEIVE_DATAGRAM, *PTDI_REQUEST_RECEIVE_DATAGRAM;
//
// SetEventHandler is done through NtDeviceIoControlFile, which passes this
// structure as its input buffer. The Handle specified in the
// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
// different than above!!) returned in the NtCreateFile call.
typedef struct _TDI_REQUEST_SET_EVENT {
TDI_REQUEST Request;
LONG EventType;
PVOID EventHandler;
PVOID EventContext;
} TDI_REQUEST_SET_EVENT_HANDLER, *PTDI_REQUEST_SET_EVENT_HANDLER;
//
// ReceiveIndicator values (from TdiReceive and TdiReceiveDatagram requests,
// and also presented at TDI_IND_RECEIVE and TDI_IND_RECEIVE_DATAGRAM time).
//
// The TDI_RECEIVE_PARTIAL bit is no longer used at the kernel level
// interface. TDI_RECEIVE_ENTIRE_MESSAGE has replaced it. Providers
// may continue to set TDI_RECEIVE_PARTIAL when appropriate if they so
// desire, but the TDI_RECEIVE_ENTIRE_MESSAGE bit must be set or
// cleared as appropriate on all receive indications.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -