程序:
//打开文件
HANDLE hAdapter = CreateFile(
NDISUIO_DEVICE_NAME,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
INVALID_HANDLE_VALUE);
if(hAdapter==NULL)
{
::MessageBox(NULL,_T("Error"),_T("znq : CreateFile failed 1"),MB_OK);
}
else
{
::MessageBox(NULL,_T("Success"),_T("znq : Success 1"),MB_OK);
}
bRet = DeviceIoControl( hAdapter , IOCTL_NDIS_BIND_ADAPTER,
strAdapterName,wcslen((strAdapterName)) * sizeof(WCHAR),
NULL, 0,
&dwReturnedBytes,
NULL
);
if(bRet==TRUE)
{
::MessageBox(NULL,_T("Success"),_T("znq : Success 2"),MB_OK);
}
else
{
int nError=GetLastError();
CString strErr;
strErr.Format(_T("IOCTL_NDIS_BIND_ADAPTER Failed Code=%d"),nError);
::MessageBox(NULL,strErr,_T("Error"),MB_OK);
}
但在使用IOCTL_NDIS_BIND_ADAPTER时出错,错误代码=50 =网络不支持错误
这是为何呢?
在线等待!!