Amlan,
The EA ‘value’ is packed in the buffer immediately following the EaName as
you have pointed out.
For a TDI Connection file object, the ConnectionContext can be anything your
TDI client would find useful to identify the connection in a callback from
TDI. You mention using your DeviceExtensionand perhaps this would serve
your purpose. Often, however, this is the address of some internal object
in your client that represents the ‘connection’. If your driver maps a
‘device extensinion’ to a connection then this seems perfectly reasonable.
For a TDI Address file object, the code fragment you posted below can be
greatly simplified in the case of passing a single IP4 style address by
using the structure TA_IP_ADDRESS which is essentially a short-hand for a
TRANSPORT_ADDRESS with exactly one TDI_ADDRESS_IP. It is a bit simpler to
setup without all of the casts, FIELD_OFFSET() calculations, etc.
The ‘value’ of the TDI_ADDRESS_IP fields is entirely up to you. More often
than not, the values are initialized with sin_port=0 and sin_addr=0 to
simply allow TCP/IP to select a reasonable ‘interface address’ and port when
it needs to. If you are going to ‘listen’ on a transport address, then
sin_port should be initialized to the port value (UDP or TCP depending on
the transport) you wish to listen on. If you want to listen or send from
only a single interface, then yes, you can put the interface IP address in
sin_addr.
One bit of caution when packing TDI structures and EA structures - you need
to carefully consider alignment on architectures other than x86. In other
words, you need to use UNALIGNED to decorate pointers that are ‘cast’ from
packed byte-aligned fields like the ‘value’ of an EA you wish to treat as a
PVOID.
Also, you are correct that the FILE_FULL_EA_INFORMATION::EaValueLength is
the number of bytes of the “value” portion of the buffer only found at the
address &ea->EaName[ea->EaNameLength]
For a typical TransportAddress open you might do something like this:
UCHAR eaBuffer[FIELD_OFFSET(FILE_FULL_EA_INFORMATION,EaName) +
TDI_TRANSPORT_ADDRESS_LENGTH + sizeof(TA_IP_ADDRESS)];
PFILE_FULL_EA_INFORMATION ea = (PFILE_FULL_EA_INFORMATION)eaBuffer;
TA_IP_ADDRESS UNALIGNED *taAddr =
(PTA_IP_ADDRESS)(&ea->EaName[TDI_TRANSPORT_ADDRESS_LENGTH]);
Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amlan Mandal
Sent: Wednesday, October 05, 2005 2:34 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] TDI Client
Thank you, David & Tony.
As I understand EA value(s) have to be stored just after(in memory)
FILE_FULL_EA_INFORMATION data structure is stored. So basically u need to
2(TWO) RtlCopyMemory one for copying EaName, other for EaValue
TABLE FOR ENTRIES
**************************************************************************
Opening TRANSPORT ADDRESS | Opening
CONNECTION
EaNameLength TDI_TRANSPORT_ADDRESS_LENGTH TDI_CONNECTION_CONTEXT_LENGTH
(defined in tdi.h)
(defined in tdi.h)
EaValuelength ??
sizeof (CONNECTION_CONTEXT)
EaName TdiTransportAddress
TdiConnectioncontext
CONNECTION_CONTEXT is nothing but PVOID as define in tdi.h
Tony I saw ur code but I CANT agree with u.
EaValueLength for Transport address should be
FIELD_OFFSET(TRANSPORT_ADDRESS, Address[0]) + FIELD_OFFSET(TA_ADDRESS,
Address[0])+ sizeof(TDI_ADDRESS_IP)
(which is total size of TRANSPORT_ADDRESS data stucture)
NOT
**TDI_TRANSPORT_ADDRESS_LENGTH + sizeof(TRANSPORT_ADDRESS) +
sizeof(TDI_ADDRESS_IP)** this as mentioned in tony’s tutorial
Now what to Copy in EaValue
in case of Opening TRANSPORT ADDRESS copy the TRANSPORT_ADDRESS of local
machine
in case of Opening CONNECTION copy pointer to DeviceExtension
I may be wrong. but I suggested what I understand. IF I am wrong can some
one explain.
P.S Thomas Divine can you throw some light on it
“David R. Cattley” wrote:
Amlan,
If you look in the DDK header file TDI.H you will find that pre-processor
symbols are defined for TdiTransportAddress and TDI_TRANSPORT_ADDRESS_LENGTH
as well as TdiTransportConnection and TDI_TRANSPORT_CONNECTION_LENGTH.
These are the values that the EA EaName & EaNameLength are initialized with.
More information on creating an EA for openning a Transport Address file and
Connection file can be found in the DDK docs. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kmarch/hh/k
march/k111_80b1882a-8617-45d4-a783-dbc3bfc9aad4.xml.asp
Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amlan Mandal
Sent: Tuesday, October 04, 2005 2:56 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] TDI Client
What will be the EaValueLength & EA value for FILE_FULL_EA_INFORMATION which
I send as a arguement to ZwCreateFile during 1.opening transport address 2.
opening connction
If someone elaborate, it will be of immense help
Thanks in advance
Amlan
Yahoo! for Good
Click http:</http:> here to donate to the
Hurricane Katrina relief effort. — Questions? First check the Kernel
Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently
subscribed to ntdev as: xxxxx@msn.com To unsubscribe send a blank email
to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
_____
Yahoo! for Good
Click here http:</http:> to donate to the
Hurricane Katrina relief effort. — Questions? First check the Kernel
Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently
subscribed to ntdev as: xxxxx@msn.com To unsubscribe send a blank email
to xxxxx@lists.osr.com