阅读:1766回复:8
如何用OID来控制网卡的流程?
我在网上看到可以用DeviceIoControl来进行控制,可是不知道如何获得特定网卡的HANDLE,谢谢!
|
|
沙发#
发布于:2003-06-06 09:40
你要控制别人的网卡?
|
|
|
板凳#
发布于:2003-06-06 09:45
我的机器上有两块网卡一个有线,另一个是无线,
我想控制无线网卡 |
|
地板#
发布于:2003-06-06 09:46
是你自己做的驱动么?
我觉得用passthru还有可能。 |
|
|
地下室#
发布于:2003-06-06 09:57
我在网上看到了一个帖子,他首先获得网卡的Handle然后用DeviceIoControl就可以了,但是我现在无法获得这个Handle
|
|
5楼#
发布于:2003-06-06 10:04
createfile,
那个帖子?我也看看 |
|
|
6楼#
发布于:2003-06-06 10:19
http://www.laurentconstantin.com/common/lcrzo/preview/lcrzo_priv_conf_etha_init_cardnumberdevice.c.html
没看太懂,但是觉得首先要获得Handle |
|
7楼#
发布于:2003-06-06 10:24
这段代码也有参考意义:
HANDLE hAdapter = W32N_OpenAdapter( <Adapter Path Name> ); if (INVALID_HANDLE_VALUE != hAdapter) { BYTE curMACAddress[6]; W32N_REQUEST w32nRequest = {0}; w32nRequest.NdisRequest.RequestType = NdisRequestQueryInformation; w32nRequest.NdisRequest.DATA.QUERY_INFORMATION.Oid = OID_802_3_CURRENT_ADDRESS; w32nRequest.NdisRequest.DATA.QUERY_INFORMATION.InformationBuffer = curMACAddress; w32nRequest.NdisRequest.DATA.QUERY_INFORMATION.InformationBufferLengt h = sizeof( curMACAddress ); w32nRequest.NdisRequest.DATA.QUERY_INFORMATION.BytesWritten = 0; w32nRequest.NdisRequest.DATA.QUERY_INFORMATION.BytesNeeded = 0; OVERLAPPED overlapped = {0}; overlapped.hEvent = CreateEvent( 0, TRUE, 0, NULL ); NDIS_STATUS status = W32N_MakeNdisRequest( hAdapter, &w32nRequest, &overlapped, TRUE ); CloseHandle( overlapped.hEvent ); W32N_CloseAdapter( hAdapter ); CString MACAddress; MACAddress.Format( \"%02x:%02x:%02x:%02x:%02x:%02x\", curMACAddress[0], curMACAddress[1], curMACAddress[2], curMACAddress[3], curMACAddress[4], curMACAddress[5] ); m_mac_source_address.SetWindowText( MACAddress ); } |
|
8楼#
发布于:2003-06-06 10:40
他不是先createfile了么?
|
|
|