Re: 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 here to donate to the Hurricane Katrina relief effort.

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 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

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/kmarch/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 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 to donate to the Hurricane Katrina relief effort.

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

Thank you David for ur elaborate mail clearing my doubts.
Now I want to put forward Few more doubts.(Forgive me being a newbie)
I want to write a function to accept/reject connection offer from a remote node.
First I call TdiBuildInternalDeviceControlIrp(…,FileObj,…).
1.I understand this is the FileObj which I opened during Opening TDI connection.
NOT during transport address.Is this correct?

Now I call TdiBuildListen()
Now in Flags I can have to choice 0/TDI_QUERY_ACCEPT. If I choose 0, then connection will
be established before IRP will complete.

2.Then how to get the data which comes before IRP completes?
Suppose I choose TDI_ACCEPT_QUERY.Then I call IoCallDriver().

3.I suppose I have to block the thread untill this IRP complete.Is this correct?

4.Then once gain I have to build one IRP using TdiBuildInternalDeviceControlIrp and TdiBuildAccept().
Then call IoCallDriver().Do I have to block this thread once again untill this IRP completes?

“David R. Cattley” wrote: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/kmarch/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 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 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 to donate to the Hurricane Katrina relief effort.

Does the generic code below correct?

**********************************************
SomeFunction()
{
PIRP pIrp;
NtStatus status;
KEVENT event;

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx();

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

KeClearEvent(event);

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx(); // some other TdiBuildXxx

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

}

**************************************************

Basically can I assume IRP is complete when my wait is OVER after geeting STATUS_PENDING from lower drivers. So that I can use pIrp again.

“David R. Cattley” wrote:
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/kmarch/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 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 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 to donate to the Hurricane Katrina relief effort.

I am posting this query once again. Suppose I create an IRP with TdiBuildInternalDeviceControlIrp & TdiBuildXxx. Then I block the thread if I get STATUS_PENDING from lower level drivers.
Now the thread will be unblocked my IRP will be complete by lower level drivers.
Now can I again use the same IRP variable to create an IRP with TdiBuildInternalDeviceControlIrp & TdiBuildXxx. I suppose we can do that.When IoComplete is called IRP is freed.
One generic code is given below.

**********************************************
SomeFunction()
{
PIRP pIrp;
NtStatus status;
KEVENT event;

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx();

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

KeClearEvent(event);

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx(); // some other TdiBuildXxx

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

}

**************************************************

Someone please explain.
Thanks in advance
Amlan K Mandal

Amlan Mandal wrote:
Does the generic code below correct?

**********************************************
SomeFunction()
{
PIRP pIrp;
NtStatus status;
KEVENT event;

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx();

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

KeClearEvent(event);

pIrp = TdiBuildInternalDeviceControlIrp();

TdiBuildXxx(); // some other TdiBuildXxx

status = IoCallDriver();

if(status == STATUS_PENDING)
{
KeWaitSingleObject(&event,…);


}

}



Basically can I assume IRP is complete when my wait is OVER after geeting STATUS_PENDING from lower drivers. So that I can use pIrp again.

“David R. Cattley” wrote:
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/kmarch/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 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 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 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@yahoo.com To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

Amlan Mandal wrote:

I am posting this query once again. Suppose I create an IRP with
TdiBuildInternalDeviceControlIrp & TdiBuildXxx. Then I block the
thread if I get STATUS_PENDING from lower level drivers.
Now the thread will be unblocked my IRP will be complete by lower
level drivers.
Now can I again use the same IRP variable to create an IRP with
TdiBuildInternalDeviceControlIrp & TdiBuildXxx. I suppose we can do
that.When IoComplete is called IRP is freed.

Are you asking if this technique is OK to use? Yes, this is perfectly
fine. Remember that you aren’t really reusing the “IRP variable”. You
are reusing a pointer to IRP. TdiBuildInternalDeviceControlIrp returns
a brand new IRP to you each time.

You do check for pIrp being NULL, don’t you? PREfast will complain if
you don’t.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I have written all the TDI client functions for communicating through TCP protocol driver namely
Openning transport address, Opening connection, Associating connection with trnasport address, sending , receiving ETC.
Now I want to send data to remote computer using this TDI client functions.BUT I want to do this in KERNEL level only.
NOT using any interface so that I can send data from user level.
Can any one help me in this regard?


Yahoo! FareChase - Search multiple travel sites in one click.

I am writing TDI client functions. Now for receiving data I have two option

  1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

  2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?


Yahoo! FareChase - Search multiple travel sites in one click.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from
underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Now my question: Is EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

my second question:what is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

my third question: difference between stream mode transfer & message mode transfer in this regard

last question: difference between BytesIndicated & BytesAvailable

If someone take the pain to explain my doubts I will be grateful

PS: Thomas Divine can you please throw some light on it


Yahoo! FareChase - Search multiple travel sites in one click.

ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

  1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

  2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?


Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click.

Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

--------------------------------------------------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Maxim, I still don’t understand the difference between stream mode transfer & message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL, TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:
Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click.

Amlan,

The difference is based on the type of Transport and the semantics of the
underlying protocol. TCP is a ‘stream’ mode transport. That means that
receive indications do not necessarily correspond ‘one-for-one’ with send
requests (at the other end). Contrast that with message mode Transports
like SPX (a Novell/Xerox protocol on IPX) which transfers ‘messages’
reliably, in order. On SPX the unit of transfer is the ‘message’. On TCP
the unit of transfer is the octet.

The bottom line is that you don’t get to choose. TCP is a stream mode
Transport.

The flags are very well defined in the DDK documentation for
ClientEventReceive(). You need to be prepaired to deal with whatever the
Transport chooses to set in them.

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 26, 2005 6:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] TDI Client

Maxim, I still don’t understand the difference between stream mode transfer
& message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls
ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL,
TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:

Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>

----- Original Message -----
From: Amlan mailto:xxxxx Mandal
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node
peer as an event notification from underlying TDI transport driver(TCP).
Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to
ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName +
TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in
this regard

“Maxim S. Shatskih” wrote:

ClientEventReceive is called with BytesAvailable == total amount of the
data available in the transport. Some (or even all) of this data is
accessible in a single memory chunk by pointer, and the size of this data is
BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form
the TDI_RECEIVE IRP which will describe the rest of client’s buffer after
copying the directly indicated data (BytesIndicated), call
IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP
via parameter together with some particular return status value (forgot
which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>

----- Original Message -----
From: Amlan mailto:xxxxx Mandal
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say
ClientEventReceive.

Now I suppose I have to implement the function with the function
specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference
between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?



Yahoo!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/ **http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@storagecraft.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!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/** http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@storagecraft.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!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/**http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
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</http:></http:></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

TCP does not support message mode transfers. You can forget about them.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 2:35 PM
Subject: Re: [ntdev] TDI Client

Maxim, I still don’t understand the difference between stream mode transfer & message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL, TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:
Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

----------------------------------------------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

David, Thanks you a lot for your detailed explanation.
Can you clear my doubt below as well. What will be the arguements to TdiBuildSetEventHandler fir setting ClientEventReceive i.e.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, // IS IT CORRECT???
NULL, // IS IT CORRECT???(Suppose I dont want any completion routine)
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext // Arguement to ClientEventReceive
)

“David R. Cattley” wrote:
Amlan,

The difference is based on the type of Transport and the semantics of the underlying protocol. TCP is a ‘stream’ mode transport. That means that receive indications do not necessarily correspond ‘one-for-one’ with send requests (at the other end). Contrast that with message mode Transports like SPX (a Novell/Xerox protocol on IPX) which transfers ‘messages’ reliably, in order. On SPX the unit of transfer is the ‘message’. On TCP the unit of transfer is the octet.

The bottom line is that you don’t get to choose. TCP is a stream mode Transport.

The flags are very well defined in the DDK documentation for ClientEventReceive(). You need to be prepaired to deal with whatever the Transport chooses to set in them.

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 26, 2005 6:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] TDI Client

Maxim, I still don’t understand the difference between stream mode transfer & message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL, TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:
Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — 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! FareChase - Search multiple travel sites in one click.

Amlan,

Setting the CompletionRoutine and CompletionContext to NULL is fine if you
intend to wait on an event specified in TdiBuildInternalDeviceControlIrp()
*and* you are willing to let the I/O manager free the IRP. Essentially
this requires you to be runing at PASSIVE_LEVEL (you must have been to call
TdiBuildInternalDeviceControlIrp()).

TdiBuildInternalDeviceControl() is really just a call to
IoBuildDeviceIoControlRequest() and nothing more. I recommend you read the
DDK documentation for IoBuildDeviceIoControlRequest() and pay careful
attention to the section on how the IRP completes (and must complete). If
you are not trying to reuse that IRP for another subsequent request and you
can ‘wait’ on the event, the completion routine is typically not necessary.
If you wish to reuse the IRP or wish to process the completion
asyncronously, then you will need a CRTN and should set the CRTN and Context
to something relevant.

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 26, 2005 11:29 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] TDI Client

David, Thanks you a lot for your detailed explanation.
Can you clear my doubt below as well. What will be the arguements to
TdiBuildSetEventHandler fir setting ClientEventReceive i.e.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, // IS IT CORRECT???
NULL, // IS IT CORRECT???(Suppose I dont want any completion routine)
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext // Arguement to ClientEventReceive
)

“David R. Cattley” wrote:

Amlan,

The difference is based on the type of Transport and the semantics of the
underlying protocol. TCP is a ‘stream’ mode transport. That means that
receive indications do not necessarily correspond ‘one-for-one’ with send
requests (at the other end). Contrast that with message mode Transports
like SPX (a Novell/Xerox protocol on IPX) which transfers ‘messages’
reliably, in order. On SPX the unit of transfer is the ‘message’. On TCP
the unit of transfer is the octet.

The bottom line is that you don’t get to choose. TCP is a stream mode
Transport.

The flags are very well defined in the DDK documentation for
ClientEventReceive(). You need to be prepaired to deal with whatever the
Transport chooses to set in them.

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 26, 2005 6:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] TDI Client

Maxim, I still don’t understand the difference between stream mode transfer
& message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls
ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL,
TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:

Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>

----- Original Message -----
From: Amlan mailto:xxxxx Mandal
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node
peer as an event notification from underlying TDI transport driver(TCP).
Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to
ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName +
TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in
this regard

“Maxim S. Shatskih” wrote:

ClientEventReceive is called with BytesAvailable == total amount of the
data available in the transport. Some (or even all) of this data is
accessible in a single memory chunk by pointer, and the size of this data is
BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form
the TDI_RECEIVE IRP which will describe the rest of client’s buffer after
copying the directly indicated data (BytesIndicated), call
IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP
via parameter together with some particular return status value (forgot
which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>

----- Original Message -----
From: Amlan mailto:xxxxx Mandal
To: Windows System Software Devs mailto:xxxxx Interest List

Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say
ClientEventReceive.

Now I suppose I have to implement the function with the function
specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference
between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?



Yahoo!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/ http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@storagecraft.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!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/
http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@storagecraft.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!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/ http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
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!
http:kEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw–/SIG=110oav78o/
http%3a//farechas
e.yahoo.com/> FareChase - Search multiple travel sites in one click. —
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</http:></http:></http:></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

I am writing TDI client event receive handler. I have read archived mails on this topic.
I got some invaluable suggestions from David Cattley, Maxim & other ppl in this grp.
From my understanding ClientEventReceive should be like this. My underlying TDI driver is TCP/IP.

ClientEventReceive(
IN PVOID TdiEventContext,
IN CONNECTION_CONTEXT ConnectionContext,
IN ULONG ReceiveFlags,
IN ULONG BytesIndicated,
IN ULONG BytesAvailable,
OUT ULONG *BytesTaken,
IN PVOID Tsdu,
OUT PIRP *IoRequestPacket
);
{
/* I understand EventContext is the copy of memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection */

First I have to chect whether BytesAvailable == BytesIndicated

Case 1: They are same

  1. I do NOT have to allocate IRP
  2. I have to check ReceiveFlags to see which bits are on. Can I assume only those bits to be
    on which I turned on in my sender side??? (I have turned on ONLY TDI_RECEIVE_NORMAL bit)
  3. I will copy the data fro Tsdu. //PROCESSING
  4. return STATUS_SUCCESS

Case 2: BytesAvailable is NOT same as BytesIndicated

  1. Create IRP with TdiInterbalDeviceControlIrp
  2. Pass the Irp to TdiBuildReceive . Do I have to call IOSetnestStackLocation as well ???
  3. IoRequestPacket = Pointer to this IRP
  4. return STATUS_MORE_PROCESSING_REQUIRED

}
Now my question is where can I PROCESS left over data(i.e. for which I sent IRP to TDI driver) …Is it in Completion routine???
If some one please help me pointing my misunderstanding & clearing my doubts I will be grateful.

“David R. Cattley” wrote:
Amlan,

Setting the CompletionRoutine and CompletionContext to NULL is fine if you intend to wait on an event specified in TdiBuildInternalDeviceControlIrp() and you are willing to let the I/O manager free the IRP. Essentially this requires you to be runing at PASSIVE_LEVEL (you must have been to call TdiBuildInternalDeviceControlIrp()).

TdiBuildInternalDeviceControl() is really just a call to IoBuildDeviceIoControlRequest() and nothing more. I recommend you read the DDK documentation for IoBuildDeviceIoControlRequest() and pay careful attention to the section on how the IRP completes (and must complete). If you are not trying to reuse that IRP for another subsequent request and you can ‘wait’ on the event, the completion routine is typically not necessary. If you wish to reuse the IRP or wish to process the completion asyncronously, then you will need a CRTN and should set the CRTN and Context to something relevant.

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 26, 2005 11:29 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] TDI Client

David, Thanks you a lot for your detailed explanation.
Can you clear my doubt below as well. What will be the arguements to TdiBuildSetEventHandler fir setting ClientEventReceive i.e.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, // IS IT CORRECT???
NULL, // IS IT CORRECT???(Suppose I dont want any completion routine)
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext // Arguement to ClientEventReceive
)

“David R. Cattley” wrote:
Amlan,

The difference is based on the type of Transport and the semantics of the underlying protocol. TCP is a ‘stream’ mode transport. That means that receive indications do not necessarily correspond ‘one-for-one’ with send requests (at the other end). Contrast that with message mode Transports like SPX (a Novell/Xerox protocol on IPX) which transfers ‘messages’ reliably, in order. On SPX the unit of transfer is the ‘message’. On TCP the unit of transfer is the octet.

The bottom line is that you don’t get to choose. TCP is a stream mode Transport.

The flags are very well defined in the DDK documentation for ClientEventReceive(). You need to be prepaired to deal with whatever the Transport chooses to set in them.

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 26, 2005 6:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] TDI Client

Maxim, I still don’t understand the difference between stream mode transfer & message transfer mode transfer in TDI client respect.
Secondly, if my underlying TDI driver is TCP then when it calls ClientEvenReceive whiich flags will be on???( I mean TDI_RECEIVE_NORMAL, TDI_RECEIVE_PEEK etc…)

“Maxim S. Shatskih” wrote:
Yes, this should work.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Wednesday, October 26, 2005 10:04 AM
Subject: Re: [ntdev] TDI Client

Maxim, thanks a lot for ur explanation.

I have few more questions as well.

Suppose I want to my TDI client want to receive data from its remote node peer as an event notification from underlying TDI transport driver(TCP). Then I have to set event handler.

TdiBuildSetEventHandler(
Irp, // Created by TdiInternalDeviceControlIrp
DevObj,
FileObj, // File Object created by ZwCreateFile to open connection
NULL, //I dont want any completion routine
NULL,
TDI_EVENT_RECEIVE,
ClientEventReceive,
EventContext
)

Is this correct??

s EventContext(arguement to TdiBuildSetEventHandler) the first arguement to ClientEventReceive???

What is the Second arguement to ClientEventReceive i.e. connectionContext
What I understand memory starts at pExtendedAttributes->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1 where pExtendedAttributes
is the arguement to ZwCreateFile while opening connection

What is difference between stream mode transfer & message mode transfer in this regard

“Maxim S. Shatskih” wrote:
ClientEventReceive is called with BytesAvailable == total amount of the data available in the transport. Some (or even all) of this data is accessible in a single memory chunk by pointer, and the size of this data is BytesIndicated.

If BytesIndicated < BytesAvailable, then ClientEventReceive must form the TDI_RECEIVE IRP which will describe the rest of client’s buffer after copying the directly indicated data (BytesIndicated), call IoSetNextIrpStackLocation on it (do not forget this!), and return the IRP via parameter together with some particular return status value (forgot which one, see the docs).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Amlan Mandal
To: Windows System Software Devs Interest List
Sent: Tuesday, October 25, 2005 2:10 PM
Subject: [ntdev] TDI Client

I am writing TDI client functions. Now for receiving data I have two option

1. Creating an IRP with TdiBuildReceive and Then calling IoCallDriver

2. I have set the event handler. TDI driver will call my event handler say ClientEventReceive.

Now I suppose I have to implement the function with the function specification given in MSDN. Is it correct?

In the function specification of ClientEventReceive what is the difference between message mode & stream mode data tranasfer?

Can any one explain the difference between BytesIndicated & BytesAvailable?

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.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! FareChase - Search multiple travel sites in one click. — 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! FareChase - Search multiple travel sites in one click. — 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! FareChase - Search multiple travel sites in one click.