WLAN API?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

Any1 ever tried to access WLAN configuration parameters within compact framework? Are there any examples

Regard
Heiner
 
"Configuration parameters" like what, exactly? IP, subnet, and gateway or
WEP keys and that sort of thing?

Paul T.

Heiner Amthauer said:
Hi there!

Any1 ever tried to access WLAN configuration parameters within compact
framework? Are there any examples?
 
Hi

Timely question. I would at some stage in my app want to Change the IP address Ive set for my handheld device. Any way of retrieving and/or changing this value?

Thanks.
 
You can do it via the registry and then either reboot the device or P/Invoke
DeviceIoControl to send a IOCTL_NDIS_REBIND_ADAPTER message to the NDS0:
device. The registry entries are found in HKLM\Comm\<name of network
adapter><index>\Parms\TCPIP. The IP address is in a value called IpAddress.
You have to make sure that DHCP is not on to use this static IP address, but
that's already done, if you have a static address assigned already.

Paul T.

Gavin Gonsal said:
Hi,

Timely question. I would at some stage in my app want to Change the IP
address Ive set for my handheld device. Any way of retrieving and/or
changing this value?
 
Paul

Thank you for your quick answer. Im relatively new to VB.NEt and not dont any P/Invoking (only used examples by others). Could you give me a sample code? Im using VB.Net. Also, any good websites/material where I can learn registry programming with WinCE ?

This problem of wireless connectivity and IP addresses is critical to my application as it relies heavily on wireless connectivity

Thanks.
 
I've never done this from any of the managed code languages. I've shown the
code in C++ below. Note that buf is the Unicode string with the adapter
name in it. This is the same string that you found in the registry: the
name of the adapter plus the index number (usually "1").

Paul T.

-----

// Open the NDIS driver.
HANDLE hNdis = CreateFile( _T( "NDS0:" ),
GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL );

// Send the device command.
TCHAR errs[ 512 ];
DWORD xcount;
if ( DeviceIoControl( hNdis, IOCTL_NDIS_REBIND_ADAPTER,
buf, _tcslen( buf ) + sizeof( TCHAR ),
NULL, 0, &xcount, NULL ) )
{
OutputDebugString( _T( "Adapter rebound\r\n" ) );
}
else
{
_stprintf( errs, _T( "DeviceIoControl failed. error = %d\r\n" ),
GetLastError() );
OutputDebugString( errs );
}

CloseHandle( hNdis );

-----


Gavin Gonsal said:
Paul,

Thank you for your quick answer. Im relatively new to VB.NEt and not dont
any P/Invoking (only used examples by others). Could you give me a sample
code? Im using VB.Net. Also, any good websites/material where I can learn
registry programming with WinCE ?
This problem of wireless connectivity and IP addresses is critical to my
application as it relies heavily on wireless connectivity.
 
Hi

this is what I'd like to do in C# / compact framework

- ask the wlan-device about available network
- display them to the user for choic
- connect to the selected networ
an
- continously check communication qualit

Heiner
 
Thanks Paul

Can I compile the C++ code and include and reference it with my VB.NET CF application ? Can it be compiled from VS.NET 2003? Sorry but these technologies are mostly new to me

Gavin.
 
No, you can't compile it with VS.NET 2003 or include a 'reference' to it
directly from VB.NET. You have to use the appropriate version of eVC to
build it and target the device of interest. You could then make it into a
DLL and P/Invoke it from your VB.NET code, maybe...

Paul T.

Gavin Gonsal said:
Thanks Paul,

Can I compile the C++ code and include and reference it with my VB.NET CF
application ? Can it be compiled from VS.NET 2003? Sorry but these
technologies are mostly new to me.
 
OK, but let me point out that Windows Zero Config *already does all of
that*! You'd just be doing what there's already a component to do. That
doesn't seem like a good use of your time...

Paul T.
 
well, fact is that i'll have to include such things in my application. Which brings us back to the original question: is there an api to use such things?

----- Paul G. Tobey [eMVP] wrote: -----

OK, but let me point out that Windows Zero Config *already does all of
that*! You'd just be doing what there's already a component to do. That
doesn't seem like a good use of your time...

Paul T.
 
Well, I suppose that you could try to write WZC yourself, but, having read
the code, it's not going to happen in less than a couple of months. There
are just too many things that you can set as options for those cards (shared
keys, open keys, key values, various types of encryption, etc.)

Your best bet is going to be to get the evaluation version of Platform
Builder and actually read the WZC code.

Are you sure that you have to do this in your application? What scenario
requires that?

Paul T.

Heiner Amthauer said:
well, fact is that i'll have to include such things in my application.
Which brings us back to the original question: is there an api to use such
things?
----- Paul G. Tobey [eMVP] wrote: -----

OK, but let me point out that Windows Zero Config *already does all of
that*! You'd just be doing what there's already a component to do. That
doesn't seem like a good use of your time...

Paul T.

- display them to the user for choice
- connect to the selected network
and
- continously check communication quality
 
Hi,
I also need to implement the same in my application...... The scenario is when there are one or more Access points or networks identified, from my applicaion I need to find the associated Access points and connect the user to the respective network.

Thanks....
 
Sweet! Let me know when it's done! ;-) My guess is that you'll be sending
the following OID messages to the driver to accomplish this:

-----

set: OID_802_11_DISASSOCIATE
set: OID_802_11_SSID

-----

but I haven't tried it...

Paul T.

sattex said:
Hi,
I also need to implement the same in my application...... The scenario
is when there are one or more Access points or networks identified, from my
applicaion I need to find the associated Access points and connect the user
to the respective network.
 
Hi all,
Getting NDS0: handle using CreateFile Function
fails and it is returning an invalid handle and the Error code returning is 37.

The piece of code where we are facing the issue is added below.
//Here DD_NDIS_DEVICE_NAME is 'NDS0:'
code:
HANDLE hNdis = INVALID_HANDLE_VALUE;
hNdis=CreateFile(DD_NDIS_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, 0, NULL);

if (hNdis == INVALID_HANDLE_VALUE)
{
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
RETAILMSG(1,(TEXT(" ERROR_FILE_NOT_FOUND\n")));
}
else if(GetLastError() == ERROR_INVALID_NAME)
{
RETAILMSG(1,(TEXT(" ERROR_INVALID_NAME\n")));
}
else
{
RETAILMSG(1,(TEXT("Handle creation error code: %x hNdis:0x%x\n"),GetLastError(),hNdis));
}
}

Output we are getting is "Handle creation error code: 37 hNdis:0xFFFFFFFF"

Thanks for any kind of help.
 
Last edited:
Back
Top