in the user mode when you call socket function you got a handle

SOCKET hSocket = socket(AF_INET, SOCK_STREAM, 0);

how can i get this handle from TDI_CONNECT ?? ( as i want to send it back
to monitoring application )

thanks in advance

Re: getting user-mode Socket handle from TDI_CONNECT by Ali

Ali
Fri Dec 29 12:04:07 CST 2006


Arnool wrote:
> in the user mode when you call socket function you got a handle
>
> SOCKET hSocket = socket(AF_INET, SOCK_STREAM, 0);
>
> how can i get this handle from TDI_CONNECT ?? ( as i want to send it back
> to monitoring application )
>
> thanks in advance

Don't know how you are gonna parse those Parameters ;-)

ddk says:

Pointer to a TDI_REQUEST_KERNEL_CONNECT structure, equivalent to the
TDI_REQUEST_KERNEL structure.
The RequestFlags member is irrelevant for connect requests. The
transport uses the client-supplied information, such as the remote-node
address to which the connection should be offered, in the buffer at
RequestConnectionInformation. The transport returns information to the
client-supplied buffer at ReturnConnectionInformation. Each of these
buffers is formatted as a TDI_CONNECTION_INFORMATION structure.



ali


Re: getting user-mode Socket handle from TDI_CONNECT by Ivan

Ivan
Fri Dec 29 12:25:49 CST 2006

That handle could be a reference to a kernel-object owned by AFD.sys,
that is the TDI client for winsock.
That handle could be created after the TDI_CONNECT gets completed.
At the end of the day it is not the business of TDI to know
how it's own clients represent the information they encapsulate,
and, time-wise, the user-mode handle can be created after TDI
has exited the picture.
What are you trying to accomplish ?
Write some kind of per-application firewall ?

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Arnool" <mr_sekoseko@yahoo.com> wrote in message
news:O%23GV9h2KHHA.4848@TK2MSFTNGP04.phx.gbl...
> in the user mode when you call socket function you got a handle
>
> SOCKET hSocket = socket(AF_INET, SOCK_STREAM, 0);
>
> how can i get this handle from TDI_CONNECT ?? ( as i want to send it back
> to monitoring application )
>
> thanks in advance
>
>



Re: getting user-mode Socket handle from TDI_CONNECT by Maxim

Maxim
Fri Dec 29 15:18:36 CST 2006

You cannot. The socket handle is a Win32 file handle which references the
file object belonging to AFD.SYS, above the TDI layer.

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

"Arnool" <mr_sekoseko@yahoo.com> wrote in message
news:O%23GV9h2KHHA.4848@TK2MSFTNGP04.phx.gbl...
> in the user mode when you call socket function you got a handle
>
> SOCKET hSocket = socket(AF_INET, SOCK_STREAM, 0);
>
> how can i get this handle from TDI_CONNECT ?? ( as i want to send it back
> to monitoring application )
>
> thanks in advance
>
>