hi everyone,
i am doing a school project to obtain network adaptor
information, and i am TOTALLY new with ndisuio. after reading so many
articles here, i managed to use the CreatFile and
NDISUIO_BINDING_DEVICES model to get a list network adaptors in my
laptop... but the returned list is something like
/device/xxxxxxxxxxxxxxxxxxxxxx, a serial strange number so called
adaptor name, i dont understand what is that?
and i am looking for something more specific, like wether it
is a wireless or ethernet card...really dont have a clue on how to do
that..T_T
i am seeking you guys help, seems you all quite pro on this...
Millions of thanks!!!!

Michael
Singapore...

Re: Help on NDISUIO by Thomas

Thomas
Tue Jan 31 21:53:18 CST 2006


<liqing.michael@gmail.com> wrote in message
news:1138763817.789290.93800@g14g2000cwa.googlegroups.com...
> hi everyone,
> i am doing a school project to obtain network adaptor
> information, and i am TOTALLY new with ndisuio. after reading so many
> articles here, i managed to use the CreatFile and
> NDISUIO_BINDING_DEVICES model to get a list network adaptors in my
> laptop... but the returned list is something like
> /device/xxxxxxxxxxxxxxxxxxxxxx, a serial strange number so called
> adaptor name, i dont understand what is that?
> and i am looking for something more specific, like wether it
> is a wireless or ethernet card...really dont have a clue on how to do
> that..T_T
> i am seeking you guys help, seems you all quite pro on this...
> Millions of thanks!!!!
>
> Michael
> Singapore...
>

The name returned by NDISUIO is really an opaque token used internally by
NDIS. The Globally Unique Identifier (GUID) inthe curly braces uniquely
identifies one adapter instance. You can call this token the "NDIS Adapter
Name".

If you study the user-mode IP Helper functions you will find one named
GetAdaptersInfo. The AdapterName field in the IP_ADAPTER_INFO structure can
be compared to the GUID portion of the NDIS Adapter Name.

The code below illustrates how to iterate over the information returned by
GetAdaptersInfo to find an entry that matches a NDIS Adapter Name.

Sorry that the code isn't formated pretty.

Hope this helps.

Thomas F. Divine



ULONG

DisplayAdaptersInfo( LPWSTR NdisAdapterName )

{

PIP_ADAPTER_INFO pAdapterInfo;

PIP_ADAPTER_INFO pAdapter = NULL;

DWORD IPAddress = INADDR_ANY, dwRetVal = 0;

pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );

ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);

// Make an initial call to GetAdaptersInfo to get

// the necessary size into the ulOutBufLen variable

if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)

{

free(pAdapterInfo);

pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);

}

if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR)

{

pAdapter = pAdapterInfo;

while (pAdapter)

{

char NdisAdapterName_A[ _MAX_PATH ];

int nBytesWritten;

//

// Convert Wide-Character NDIS Name To Multi-Byte (ANSI)

//

nBytesWritten = WideCharToMultiByte(

CP_ACP,

0,

NdisAdapterName,

-1,

NdisAdapterName_A,

sizeof( NdisAdapterName_A ),

NULL,

NULL

);

if( !nBytesWritten )

{

break;

}

if( strcmpi( pAdapter->AdapterName, &NdisAdapterName_A[ 8 ] ) == 0 )

{

// Found The Correct Adapter

_tprintf( _T(" Adapter Name.....: %s\n"), pAdapter->AdapterName );

_tprintf( _T(" Description......: %s\n"), pAdapter->Description );

// ATTENTION!!! We just display the first. Could be more...

_tprintf( _T(" IP Address.......: %s\n"),
pAdapter->IpAddressList.IpAddress.String );

_tprintf( _T(" Subnet Mask......: %s\n"),
pAdapter->IpAddressList.IpMask.String );

_tprintf( _T(" Dhcp Enabled.....: %s\n"), pAdapter->DhcpEnabled ? _T("Yes")
: _T("No") );

_tprintf( _T(" Default Gateway..: %s\n"),
pAdapter->GatewayList.IpAddress.String );

if( pAdapter->DhcpEnabled )

{

_tprintf( _T(" DHCP Server......: %s\n"),
pAdapter->DhcpServer.IpAddress.String ); // CS IP Address!!!

}

break;

}

pAdapter = pAdapter->Next;

}

}

free( pAdapterInfo );

return IPAddress;

}


Re: Help on NDISUIO by Maxim

Maxim
Wed Feb 01 07:33:12 CST 2006

> and i am looking for something more specific, like wether it
> is a wireless or ethernet card...

Send OID_GEN_PHYSICAL_MEDIUM.

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


Re: Help on NDISUIO by Maxim

Maxim
Wed Feb 01 07:36:02 CST 2006

Is NetCfgInstanceID the same GUID?

This GUID is also in the PnP device registry key
(CurrentControlSet\Control\Class\{network class GUID}\%d), under subkey
Linkage, the value name is RootDevice.

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

"Thomas F. Divine [DDK MVP]" <tdivine@NOpcausaSPAM.com> wrote in message
news:e02BOMuJGHA.3960@TK2MSFTNGP09.phx.gbl...
>
> <liqing.michael@gmail.com> wrote in message
> news:1138763817.789290.93800@g14g2000cwa.googlegroups.com...
> > hi everyone,
> > i am doing a school project to obtain network adaptor
> > information, and i am TOTALLY new with ndisuio. after reading so many
> > articles here, i managed to use the CreatFile and
> > NDISUIO_BINDING_DEVICES model to get a list network adaptors in my
> > laptop... but the returned list is something like
> > /device/xxxxxxxxxxxxxxxxxxxxxx, a serial strange number so called
> > adaptor name, i dont understand what is that?
> > and i am looking for something more specific, like wether it
> > is a wireless or ethernet card...really dont have a clue on how to do
> > that..T_T
> > i am seeking you guys help, seems you all quite pro on this...
> > Millions of thanks!!!!
> >
> > Michael
> > Singapore...
> >
>
> The name returned by NDISUIO is really an opaque token used internally by
> NDIS. The Globally Unique Identifier (GUID) inthe curly braces uniquely
> identifies one adapter instance. You can call this token the "NDIS Adapter
> Name".
>
> If you study the user-mode IP Helper functions you will find one named
> GetAdaptersInfo. The AdapterName field in the IP_ADAPTER_INFO structure can
> be compared to the GUID portion of the NDIS Adapter Name.
>
> The code below illustrates how to iterate over the information returned by
> GetAdaptersInfo to find an entry that matches a NDIS Adapter Name.
>
> Sorry that the code isn't formated pretty.
>
> Hope this helps.
>
> Thomas F. Divine
>
>
>
> ULONG
>
> DisplayAdaptersInfo( LPWSTR NdisAdapterName )
>
> {
>
> PIP_ADAPTER_INFO pAdapterInfo;
>
> PIP_ADAPTER_INFO pAdapter = NULL;
>
> DWORD IPAddress = INADDR_ANY, dwRetVal = 0;
>
> pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );
>
> ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
>
> // Make an initial call to GetAdaptersInfo to get
>
> // the necessary size into the ulOutBufLen variable
>
> if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
>
> {
>
> free(pAdapterInfo);
>
> pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
>
> }
>
> if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR)
>
> {
>
> pAdapter = pAdapterInfo;
>
> while (pAdapter)
>
> {
>
> char NdisAdapterName_A[ _MAX_PATH ];
>
> int nBytesWritten;
>
> //
>
> // Convert Wide-Character NDIS Name To Multi-Byte (ANSI)
>
> //
>
> nBytesWritten = WideCharToMultiByte(
>
> CP_ACP,
>
> 0,
>
> NdisAdapterName,
>
> -1,
>
> NdisAdapterName_A,
>
> sizeof( NdisAdapterName_A ),
>
> NULL,
>
> NULL
>
> );
>
> if( !nBytesWritten )
>
> {
>
> break;
>
> }
>
> if( strcmpi( pAdapter->AdapterName, &NdisAdapterName_A[ 8 ] ) == 0 )
>
> {
>
> // Found The Correct Adapter
>
> _tprintf( _T(" Adapter Name.....: %s\n"), pAdapter->AdapterName );
>
> _tprintf( _T(" Description......: %s\n"), pAdapter->Description );
>
> // ATTENTION!!! We just display the first. Could be more...
>
> _tprintf( _T(" IP Address.......: %s\n"),
> pAdapter->IpAddressList.IpAddress.String );
>
> _tprintf( _T(" Subnet Mask......: %s\n"),
> pAdapter->IpAddressList.IpMask.String );
>
> _tprintf( _T(" Dhcp Enabled.....: %s\n"), pAdapter->DhcpEnabled ? _T("Yes")
> : _T("No") );
>
> _tprintf( _T(" Default Gateway..: %s\n"),
> pAdapter->GatewayList.IpAddress.String );
>
> if( pAdapter->DhcpEnabled )
>
> {
>
> _tprintf( _T(" DHCP Server......: %s\n"),
> pAdapter->DhcpServer.IpAddress.String ); // CS IP Address!!!
>
> }
>
> break;
>
> }
>
> pAdapter = pAdapter->Next;
>
> }
>
> }
>
> free( pAdapterInfo );
>
> return IPAddress;
>
> }
>


Re: Help on NDISUIO by Thomas

Thomas
Wed Feb 01 12:21:34 CST 2006


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:uA5nnPzJGHA.2064@TK2MSFTNGP11.phx.gbl...
> Is NetCfgInstanceID the same GUID?
>

Yes. That ties it all together.

Thos


> This GUID is also in the PnP device registry key
> (CurrentControlSet\Control\Class\{network class GUID}\%d), under subkey
> Linkage, the value name is RootDevice.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Thomas F. Divine [DDK MVP]" <tdivine@NOpcausaSPAM.com> wrote in message
> news:e02BOMuJGHA.3960@TK2MSFTNGP09.phx.gbl...
>>
>> <liqing.michael@gmail.com> wrote in message
>> news:1138763817.789290.93800@g14g2000cwa.googlegroups.com...
>> > hi everyone,
>> > i am doing a school project to obtain network adaptor
>> > information, and i am TOTALLY new with ndisuio. after reading so many
>> > articles here, i managed to use the CreatFile and
>> > NDISUIO_BINDING_DEVICES model to get a list network adaptors in my
>> > laptop... but the returned list is something like
>> > /device/xxxxxxxxxxxxxxxxxxxxxx, a serial strange number so called
>> > adaptor name, i dont understand what is that?
>> > and i am looking for something more specific, like wether it
>> > is a wireless or ethernet card...really dont have a clue on how to do
>> > that..T_T
>> > i am seeking you guys help, seems you all quite pro on this...
>> > Millions of thanks!!!!
>> >
>> > Michael
>> > Singapore...
>> >
>>
>> The name returned by NDISUIO is really an opaque token used internally by
>> NDIS. The Globally Unique Identifier (GUID) inthe curly braces uniquely
>> identifies one adapter instance. You can call this token the "NDIS
>> Adapter
>> Name".
>>
>> If you study the user-mode IP Helper functions you will find one named
>> GetAdaptersInfo. The AdapterName field in the IP_ADAPTER_INFO structure
>> can
>> be compared to the GUID portion of the NDIS Adapter Name.
>>
>> The code below illustrates how to iterate over the information returned
>> by
>> GetAdaptersInfo to find an entry that matches a NDIS Adapter Name.
>>
>> Sorry that the code isn't formated pretty.
>>
>> Hope this helps.
>>
>> Thomas F. Divine
>>
>>
>>
>> ULONG
>>
>> DisplayAdaptersInfo( LPWSTR NdisAdapterName )
>>
>> {
>>
>> PIP_ADAPTER_INFO pAdapterInfo;
>>
>> PIP_ADAPTER_INFO pAdapter = NULL;
>>
>> DWORD IPAddress = INADDR_ANY, dwRetVal = 0;
>>
>> pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );
>>
>> ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
>>
>> // Make an initial call to GetAdaptersInfo to get
>>
>> // the necessary size into the ulOutBufLen variable
>>
>> if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) ==
>> ERROR_BUFFER_OVERFLOW)
>>
>> {
>>
>> free(pAdapterInfo);
>>
>> pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
>>
>> }
>>
>> if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) ==
>> NO_ERROR)
>>
>> {
>>
>> pAdapter = pAdapterInfo;
>>
>> while (pAdapter)
>>
>> {
>>
>> char NdisAdapterName_A[ _MAX_PATH ];
>>
>> int nBytesWritten;
>>
>> //
>>
>> // Convert Wide-Character NDIS Name To Multi-Byte (ANSI)
>>
>> //
>>
>> nBytesWritten = WideCharToMultiByte(
>>
>> CP_ACP,
>>
>> 0,
>>
>> NdisAdapterName,
>>
>> -1,
>>
>> NdisAdapterName_A,
>>
>> sizeof( NdisAdapterName_A ),
>>
>> NULL,
>>
>> NULL
>>
>> );
>>
>> if( !nBytesWritten )
>>
>> {
>>
>> break;
>>
>> }
>>
>> if( strcmpi( pAdapter->AdapterName, &NdisAdapterName_A[ 8 ] ) == 0 )
>>
>> {
>>
>> // Found The Correct Adapter
>>
>> _tprintf( _T(" Adapter Name.....: %s\n"), pAdapter->AdapterName );
>>
>> _tprintf( _T(" Description......: %s\n"), pAdapter->Description );
>>
>> // ATTENTION!!! We just display the first. Could be more...
>>
>> _tprintf( _T(" IP Address.......: %s\n"),
>> pAdapter->IpAddressList.IpAddress.String );
>>
>> _tprintf( _T(" Subnet Mask......: %s\n"),
>> pAdapter->IpAddressList.IpMask.String );
>>
>> _tprintf( _T(" Dhcp Enabled.....: %s\n"), pAdapter->DhcpEnabled ?
>> _T("Yes")
>> : _T("No") );
>>
>> _tprintf( _T(" Default Gateway..: %s\n"),
>> pAdapter->GatewayList.IpAddress.String );
>>
>> if( pAdapter->DhcpEnabled )
>>
>> {
>>
>> _tprintf( _T(" DHCP Server......: %s\n"),
>> pAdapter->DhcpServer.IpAddress.String ); // CS IP Address!!!
>>
>> }
>>
>> break;
>>
>> }
>>
>> pAdapter = pAdapter->Next;
>>
>> }
>>
>> }
>>
>> free( pAdapterInfo );
>>
>> return IPAddress;
>>
>> }
>>
>


Re: Help on NDISUIO by liqing

liqing
Wed Feb 01 19:06:08 CST 2006

Hi, great thanks to Thomas and Maxim!!
Both are great ideas... as Maxim memtioned, use
OID_GEN_PHYSICAL_MEDIUM, i am about to ask about that...the problem is
that i dont have any tutorial or sample on tat, how do i put it in
program? to display the return value? dont laugh me...q|^.^||p

Michael