![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
DeviceIoControl returns 87 error code : Invalid parameterHi,
I am trying to get SSID of the accesspoint my handheld is connected to using NDIS. The code is as below:: CPP / C++ / C Code:
But DeviceIoControl always returns 0 and GetLastError() shows the error code as 87...Invalid Parameter..I searched for this on the net, but did not find a solution. Can anybody tell me the solution for this. Thanks Triveni Last edited by LuciWiz : 04-Jan-2008 at 21:40.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#2
|
|||
|
|||
Re: DeviceIoControl returns 87 error code : Invalid parameterHi,
Solved the problem.. regards, Triveni Prabhu |
|
#3
|
|||
|
|||
Re: DeviceIoControl returns 87 error code : Invalid parameterWhat was the solution? I am trying to do something similar but I always get Return value 0 with Error code 87. can you post your solution or source code that worked? Thank you
|
|
#4
|
|||
|
|||
Re: DeviceIoControl returns 87 error code : Invalid parameterHi,
I was getting this error because I had passed wrong parameters to DeviceIoControl. Here is the code which worked static bool GetSsid(LPCTSTR pszAdapter, NDIS_802_11_SSID* pSsid) { 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) return false; BYTE pBuffer[sizeof(NDISUIO_QUERY_OID) + sizeof(NDIS_802_11_SSID)]; PNDISUIO_QUERY_OID pNDISUIOQueryOid = (PNDISUIO_QUERY_OID) pBuffer; pNDISUIOQueryOid->ptcDeviceName = (PTCHAR) pszAdapter; pNDISUIOQueryOid->Oid = OID_802_11_SSID; DWORD dwBytesReturned = 0; if (!DeviceIoControl( hDevice, IOCTL_NDISUIO_QUERY_OID_VALUE, pBuffer, sizeof(pBuffer), pBuffer, sizeof(pBuffer), &dwBytesReturned, NULL)) { CloseHandle(hDevice); return false; } CloseHandle(hDevice); memcpy(pSsid, pNDISUIOQueryOid->Data, sizeof(NDIS_802_11_SSID)); return true; } Parameter "LPCTSTR pszAdapter" can be obtained using GetAdaptersInfo(). Refer "http://geekswithblogs.net/dastblog/category/5236.aspx/rss" Hope this helps you too. Contact me in case you need more clarifications. Cheers, Triveni Prabhu |
Recent GIDBlog
More photos on Flickr by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Smart Array problem | crazy_ivan | C++ Forum | 5 | 27-Sep-2007 01:01 |
| Help with syntax errors | PeteGallo | C Programming Language | 7 | 08-Aug-2005 20:30 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 09-Mar-2004 23:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The