Hi all,
I need help with getting the subnet mask from bound interfaces protocol
date.
I can get the ip address by intercepting OID_GEN_NETWORK_LAYER_ADDRESS
coming from my protocol driver, but it eventually me something like
this struct:

typedef struct _NETWORK_ADDRESS_IP
{
USHORT sin_port;
ULONG in_addr;
UCHAR sin_zero[8];
} NETWORK_ADDRESS_IP, *PNETWORK_ADDRESS_IP;

Which is similar to something you can get through TDI:

typedef struct _TDI_ADDRESS_IP {
USHORT sin_port;
ULONG in_addr;
UCHAR sin_zero[8];
} TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;

Which does not include mask info.

Any advice?

RE: Getting the subnet mask from an intermediate driver by pavel_a

pavel_a
Wed Jan 04 13:04:04 CST 2006

After you get the IP, you're up to a little registry hacking...

HKLM\System\CurrentControlSet\Services\{guid}\Parameters\Tcpip\
SubnetMask or DhcpSubnetMask

No idea why the subnet is not indicated with IP :(

--PA

"Hillel" wrote:
> Hi all,
> I need help with getting the subnet mask from bound interfaces protocol
> date.
> I can get the ip address by intercepting OID_GEN_NETWORK_LAYER_ADDRESS
> coming from my protocol driver, but it eventually me something like
> this struct:
>
> typedef struct _NETWORK_ADDRESS_IP
> {
> USHORT sin_port;
> ULONG in_addr;
> UCHAR sin_zero[8];
> } NETWORK_ADDRESS_IP, *PNETWORK_ADDRESS_IP;
>
> Which is similar to something you can get through TDI:
>
> typedef struct _TDI_ADDRESS_IP {
> USHORT sin_port;
> ULONG in_addr;
> UCHAR sin_zero[8];
> } TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;
>
> Which does not include mask info.
>
> Any advice?
>
>

Re: Getting the subnet mask from an intermediate driver by Thomas

Thomas
Wed Jan 04 13:06:26 CST 2006


"Hillel" <hillel.t@gmail.com> wrote in message
news:1136379698.254414.54060@g44g2000cwa.googlegroups.com...
> Hi all,
> I need help with getting the subnet mask from bound interfaces protocol
> date.
> I can get the ip address by intercepting OID_GEN_NETWORK_LAYER_ADDRESS
> coming from my protocol driver, but it eventually me something like
> this struct:
>
> typedef struct _NETWORK_ADDRESS_IP
> {
> USHORT sin_port;
> ULONG in_addr;
> UCHAR sin_zero[8];
> } NETWORK_ADDRESS_IP, *PNETWORK_ADDRESS_IP;
>
> Which is similar to something you can get through TDI:
>
> typedef struct _TDI_ADDRESS_IP {
> USHORT sin_port;
> ULONG in_addr;
> UCHAR sin_zero[8];
> } TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;
>
> Which does not include mask info.
>
> Any advice?
>

The easiest way is to have a companion user-mode service fetch the
information (using the IP Helper API) and pass it to your driver.

Although tedious and poorly documented (sorry, don't ask...), your NDIS
driver can call TDI to fetch the information about interfaces bound to the
TCP/IP driver.

Good luck,

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com


Re: Getting the subnet mask from an intermediate driver by Maxim

Maxim
Fri Jan 06 07:21:26 CST 2006

> The easiest way is to have a companion user-mode service fetch the
> information (using the IP Helper API) and pass it to your driver.

IPHlp uses IOCTL_TCP_QUERY_INFORMATION_EX internally, which is - sadly, but
undocumented (only partially documented in wshsmple).

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


Re: Getting the subnet mask from an intermediate driver by Hillel

Hillel
Fri Jan 06 12:40:06 CST 2006

Thanks for all the insightful answers. I will probably go with the user
mode service idea, seems handy to have this for other purposes too.

Thanks again.