我正面临“错误C2065:'IOCTL_NDISUIO_OPEN_DEVICE':代码下方未声明的标识符错误。 如果我错了,请帮助我。
#include "Ntddndis.h" #include "Nuiouser.h" HRESULT OpenInterfaceHandle( LPWSTR adapterGuid, HANDLE *pHandle) { WCHAR deviceGuid[128]; HANDLE intfHandle; HRESULT hr = S_OK; DWORD dwDummy; DWORD dwErr = ERROR_SUCCESS; wcscpy( deviceGuid, L"\\DEVICE\\" ); wcscat( deviceGuid, adapterGuid ); intfHandle = CreateFileA( "\\\\.\\\\Ndisuio", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, INVALID_HANDLE_VALUE); if ( intfHandle == INVALID_HANDLE_VALUE ) { hr = E_FAIL; TraceMsg(L"CreateFile failed\n"); } if (hr = S_OK) TraceMsg(L"CreateFile successful\n"); if ( hr == S_OK ) { if ( !DeviceIoControl( intfHandle, IOCTL_NDISUIO_OPEN_DEVICE, (LPVOID)deviceGuid, wcslen(deviceGuid)*sizeof(WCHAR), NULL, 0, &dwDummy, NULL) ) { dwErr = GetLastError(); hr = E_FAIL; TraceMsg(L"Open Device failed with Error %d\n", dwErr); } else { *pHandle = intfHandle; hr = S_OK; TraceMsg(L"Open Device successful\n"); } } return hr; }
提前,
答案 0 :(得分:1)
IOCTL_NDISUIO_OPEN_DEVICE的定义在“Nuiouser.h”中。在Nuiouser.h中查找定义并观察预处理器变量。