The short answer is you do not want to do this. If you are using C++
you cannot be sure where code the compiler generates such as
constructors and destructors will be placed so using any page able
sections is a bad idea. This is one of the down sides of using C++ in
the kernel, you are wasting non-paged memory.
Now that I have warned you off, the actual effort is:
#pragma alloc_text( INIT, DriverEntry )
Where INIT could be replaced by PAGED and DriverEntry by any function
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
> -----Original Message-----
> From: Robert Randall [mailto:firstname.lastname@example.org]
> Posted At: Tuesday, June 29, 2010 10:45 AM
> Posted To: ntfsd
> Conversation: [ntdev] C++ functions, init and paged code...
> Subject: [ntdev] C++ functions, init and paged code...
> I'm sure this question has been answered many times but my search
> skills appear to be a bit less than adequate...
> How do I get the linker to put a C++ function into the INIT section or
> PAGED code section?
> Robert Randall | email@example.com
> __________ Information from ESET Smart Security, version of virus
> database 5237 (20100629) __________
> The message was checked by ESET Smart Security.