Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC7 Vista Windows
Hello,
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,
 
TR Edit : Fixed PRE tags and disabled Ignore HTML.
Posted 29-Mar-10 6:41am
Edited 29-Mar-10 6:44am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

First, please confirm you are working with a Windows CE program, as I can't find anything referencing Windows Vista directly.
 
If this is the case, make sure you aren't getting any errors or warnings about missing include files. You have the correct #include directives, so check the files are present.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 386
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 215
3 /\jmot 189
4 Praneet Nadkar 173
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 29 Mar 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100