Wince獲取Wifi的裝置名 連線狀態和訊號強度

2021-06-07 22:40:56 字數 1965 閱讀 3435

一、加入標頭檔案
#include #include #include
二、attach to ndisuio
handle hndis = ::createfile( ndisuio_device_name, generic_all, 0, null, open_existing,

(handle)invalid_handle_value );

三、獲取裝置名稱

uchar                  cbquerybuffer[ 1024 ];

pndisuio_query_binding pquerybinding;

dword dwbytesreturned = 0;

pquerybinding = (pndisuio_query_binding)&cbquerybuffer[ 0 ];

pquerybinding->bindingindex = 0;

if ( ::deviceiocontrol( hndis,

ioctl_ndisuio_query_binding,

(lpvoid)&cbquerybuffer[ 0 ],

sizeof(ndisuio_query_binding),

(lpvoid)&cbquerybuffer[ 0 ],

sizeof(cbquerybuffer),

&dwbytesreturned,

null ) == true )

四、檢測連線狀態

nic_statistics nicstatistics = ;

dword dwbytesreturned = 0;

bool bconnected = false;

nicstatistics.ptcdevicename = pdevicename;

if ( ::deviceiocontrol( hndis,

ioctl_ndisuio_nic_statistics,

null,

0,&nicstatistics,

sizeof(nic_statistics),

&dwbytesreturned,

null ) == true )

五、獲取訊號強度

// example.

// < -90 : no signal

// < -81 : very low

// < -71 : low

// < -67 : good

// < -57 : very good

// ... : excellent

ndisuio_query_oid ndisqueryoid = ;

dword dwbytesreturned = 0;

int ndb = 0;

ndisqueryoid.oid = oid_802_11_rssi;

ndisqueryoid.ptcdevicename = pdevicename;

if ( ::deviceiocontrol( hndis,

ioctl_ndisuio_query_oid_value,

(lpvoid)&ndisqueryoid,

sizeof(ndisqueryoid),

(lpvoid)&ndisqueryoid,

sizeof(ndisqueryoid),

&dwbytesreturned,

null ) == true )

Wince獲取Wifi的裝置名 連線狀態和訊號強度

ote 需ce4.0或更高版本 相容ndis5.1 支援 一 加入標頭檔案 include include include二 attach to ndisuiohandle hndis createfile ndisuio device name,generic all,0,null,open ex...

Wince獲取Wifi的裝置名 連線狀態和訊號強度

需ce4.0或更高版本 相容ndis5.1 支援 一 加入標頭檔案 include include include二 attach to ndisuiohandle hndis createfile ndisuio device name,generic all,0,null,open existi...

Linux C獲取PCI裝置名和廠商名

一 介面 char pci lookup name struct pci access a,char buf,intsize,int flags,pci abi usr include pci pci.h 二 描述 在 sys bus pci devices 目錄下面可以讀取pci裝置的vendor...