hsteo
August 3rd, 2007, 03:52 AM
Hi,
Currently I am trying to extract the value of the signal strength received from all the APs detected by the USB connected network adapter. I have searched from lots of websites and found some hints on how to proceed but have been stopped at a specific method: CreateFile
The website http://www.osronline.com/DDKx/network/107ioctl_24fm.htm stated that for Windows NT based OS, the application can retrieve the name from the ServiceName value... I tried using the servicename as mentioned but it still couldnt return the handle. The previous codes used NDISUIO_DEVICE_NAME but the nuiouser.h was not available for my Visual C++ studio.
Below is my code:
#include <windows.h>
#include <ntddndis.h>
#include <iostream>
using namespace std;
int main(){
/* HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
*/
HANDLE hr;
hr = CreateFile(L"\\.\\76B4AA77-B7F8-4484-9699-1DA59F72F96E",
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_READONLY,
NULL);
if ( hr == INVALID_HANDLE_VALUE )
cout << "Error reading hdevice\t" << GetLastError()<< endl; // Error message
CloseHandle(hr);
Thank you.
Regards,
Hengshi
Currently I am trying to extract the value of the signal strength received from all the APs detected by the USB connected network adapter. I have searched from lots of websites and found some hints on how to proceed but have been stopped at a specific method: CreateFile
The website http://www.osronline.com/DDKx/network/107ioctl_24fm.htm stated that for Windows NT based OS, the application can retrieve the name from the ServiceName value... I tried using the servicename as mentioned but it still couldnt return the handle. The previous codes used NDISUIO_DEVICE_NAME but the nuiouser.h was not available for my Visual C++ studio.
Below is my code:
#include <windows.h>
#include <ntddndis.h>
#include <iostream>
using namespace std;
int main(){
/* HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
*/
HANDLE hr;
hr = CreateFile(L"\\.\\76B4AA77-B7F8-4484-9699-1DA59F72F96E",
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_READONLY,
NULL);
if ( hr == INVALID_HANDLE_VALUE )
cout << "Error reading hdevice\t" << GetLastError()<< endl; // Error message
CloseHandle(hr);
Thank you.
Regards,
Hengshi