if ( !mdl )
{
DbgPrint(“MmAllocatePagesForMdl() failed\n”);
return STATUS_INSUFFICIENT_RESOURCES;
}
c:\testdrv\test.c(19) : error C2275: ‘PMDL’ : illegal use of this type as an e
pression
c:\testdrv\test.c(19) : error C2146: syntax error : missing ‘;’ before identifier
r ‘mdl’
if ( !mdl )
{
DbgPrint(“MmAllocatePagesForMdl() failed\n”);
return STATUS_INSUFFICIENT_RESOURCES;
}
c:\testdrv\test.c(19) : error C2275: ‘PMDL’ : illegal use of this type
as an e
pression
c:\testdrv\test.c(19) : error C2146: syntax error : missing ‘;’ before
identifier
r ‘mdl’
Is there code before the declaration of mdl? The Microsoft compiler
doesn’t allow you to declare variables anywhere but at the start of a {}
block. Failing that, sounds like you aren’t including something.
Please post the whole file, or create a new file with the smallest
amount of code that reproduces the problem.
References (type&) are not supported in straight C.
S
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, November 09, 2010 4:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] problem with basic memory allocation.
I assume that this is C. The & before each parameter is incorrect.
Bill Wandel
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, November 09, 2010 7:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] problem with basic memory allocation.
It looks like this thread should be named “Problem with telling C from C++”, rather than “Problem with basic memory allocation”…
Judging from what you have said and shown us in so far, your code is mostly C++, but file extension is .c, rather than .cpp . In order to compile your code you have either to:
A. Change file extension to .cpp, and at this point, you will be able to declare local variables wherever you like, use reference variables, etc,etc,etc.
B. Write your code in C (preferably C89) .
I am not going to tell you which option is better, because otherwise we may end up with yet another “long rambling thread”…