Networking Forums

Networking Forums > Wireless Networking > Wireless Networks > Problems using "IOCTL_NDISUIO_OPEN_DEVICE" on WinCE

Reply
Thread Tools Display Modes

Problems using "IOCTL_NDISUIO_OPEN_DEVICE" on WinCE

 
 
Vijay Kumar P
Guest
Posts: n/a

 
      06-26-2007, 01:37 PM
Hi,
I am writing an application that scans for the available access points using the NDISUIO calls to the WiFi adapter
on a Windows Mobile 5.0.
The IOCTL for Open Device "IOCTL_NDISUIO_OPEN_DEVICE" failed with the error "0x00000057".

I am not sure what that the Error Code stands for. Which header file are the error codes defined for the NDIS API.

Is it true that NDISUIO allows only one application to access to the Adapter at a time. Since the WZC is active the Native Supplicant gets the access first, leaving my app no access to the adapter.
If the above is true. How do we disable the Native Supplicant on WINCE. Are there any calls that allow to disable the other app using the adapter and get the access to my app.
I have posted my code can anyone point if there is anything missing in it.


================================================== ===========
LPCTSTR pszAdapter = L"HPWIFIDVR1";

HANDLE hDevice = CreateFile(
NDISUIO_DEVICE_NAME, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL);

if (hDevice == INVALID_HANDLE_VALUE)
{
DWORD dwError = GetLastError();

printf("Function \"CreateFile\" failed (0x%08x).\n", dwError);
return -2;
}

DWORD dwBytesReturned = 0;

NDISUIO_QUERY_OID NDISUIOQueryOid = {0};
NDISUIOQueryOid.ptcDeviceName = (PTCHAR) pszAdapter;
NDISUIOQueryOid.Oid = OID_GEN_PHYSICAL_MEDIUM;

if (!DeviceIoControl(
hDevice, IOCTL_NDISUIO_QUERY_OID_VALUE,
&NDISUIOQueryOid, sizeof(NDISUIOQueryOid),
&NDISUIOQueryOid, sizeof(NDISUIOQueryOid),
&dwBytesReturned, NULL))
{
DWORD dwError = GetLastError();

CloseHandle(hDevice);
printf("Function \"DeviceIoControl\" (OID_GEN_PHYSICAL_MEDIUM) failed (0x%08x).\n",
dwError);
return -3;
}

if (*((PNDIS_PHYSICAL_MEDIUM) NDISUIOQueryOid.Data) != NdisPhysicalMediumWirelessLan)
{
CloseHandle(hDevice);
printf("Device \"%ls\" is no wireless adapter.\n", pszAdapter );
return -4;
}

if (!DeviceIoControl(
hDevice, IOCTL_NDISUIO_OPEN_DEVICE,
(LPVOID) pszAdapter,
wcslen(pszAdapter),
NULL, 0, &dwBytesReturned, NULL))
{
DWORD dwError = GetLastError();

CloseHandle(hDevice);
printf("Function \"DeviceIoControl\" (IOCTL_NDISUIO_OPEN_DEVICE) failed (0x%08x).\n",
dwError);
return -5;
}

================================================== ===========


EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Fwd: SPEWS DOLTS "SneakyP", "Kevin!:?)", "WindsorFox" SPAM braodbandnewsgroup] !:?) Broadband 0 11-30-2005 01:04 AM
Re: SPEWS SLIMES "WindsorFox", "Kevin-!:?)", "Spin Dryer" get the cold shoulder at broadband ng! SneakyP Broadband 0 11-29-2005 10:46 PM
Attention Plus.net Re: SPEWS DOLTS "WindsorFox", "Kevin-!:?)", "SpinDryer" SPAM broadband newsgroup !:?) Broadband 0 11-28-2005 04:28 AM
Attention Plus.Net Re: SPEWS DOLTS "WindsorFox", "Kevin-!:?)", "SpinDryer" SPAM braodband newsgroup !:?) Broadband 0 11-28-2005 03:03 AM
"hotspot" or "hot spot", "wireless" or "wi-fi" or "wi fi" ? Nic O`Neill Wireless Internet 3 02-12-2004 07:42 AM



1 2 3 4 5 6 7 8 9 10 11