开发者

error C2065: 'IOCTL_NDISUIO_OPEN_DEVICE' : undeclared identifier

I am facing "error C2065: 'IOCTL_NDISUIO_OPEN_DEVICE' : undeclared identifier error in beneath code. Where i am wrong, please help me out.


#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;
}

thanx in advance,


The definition of IOCTL_NDISUIO_OPEN_DEVICE is in the "Nuiouser.h". Look for the definition in Nuiouser.h and observe preprocessor variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜