Hi all,
I'm not sure in following question ...
If I don't explicitly tell to compiler where it should place my code, it
will place it into pageable or non-pageable section?

I saw something like this in Oney's book:
#pragma alloc_text( PAGE, DispatchPnp)

So, If I add my own function, will I have to somehow mark its placement or
it is done automaticaly in some predictable way (e.g. if I don't say
anything else, it will be placed into nonpaged memory)?

Thank's for answers
Michal

Re: driver code placement by Maxim

Maxim
Tue May 31 07:25:22 CDT 2005

All code and globals are nonpaged by default.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Michal Filka" <michal.filka@atlas.cz> wrote in message
news:uYqHMMdZFHA.3400@tk2msftngp13.phx.gbl...
> Hi all,
> I'm not sure in following question ...
> If I don't explicitly tell to compiler where it should place my code, it
> will place it into pageable or non-pageable section?
>
> I saw something like this in Oney's book:
> #pragma alloc_text( PAGE, DispatchPnp)
>
> So, If I add my own function, will I have to somehow mark its placement or
> it is done automaticaly in some predictable way (e.g. if I don't say
> anything else, it will be placed into nonpaged memory)?
>
> Thank's for answers
> Michal
>
>



Re: NDIS: driver code placement by Stephan

Stephan
Wed Jun 01 03:31:04 CDT 2005

Michal Filka wrote:
> I saw something like this in Oney's book:
> #pragma alloc_text( PAGE, DispatchPnp)

For NDIS drivers, there exist platform-independent NDIS-style variants
of these pragmas, see the description of

NDIS_INIT_FUNCTION()
NDIS_PAGEABLE_FUNCTION()

in the DDK docs.

Note, however, that NDIS_INIT_FUNCTION() is kind of obsolete and must
*not* be used by NDIS drivers anymore. This is because initialization
code can run several times in a Plug and Play environment, i.e. Windows
2000 and later, e.g. when you disable and re-enable one of two or more
NICs of the same kind (i.e. when several NICs use the same driver).

There is also not much benefit from saving maybe a few hundred
kilobytes compared to the risk of discarding code that will actually
still be used.

Similarly, I discourage the use of NDIS_PAGEABLE_FUNCTION(). The risk
of running pageable code at >= DISPATCH_LEVEL is just too high.

And yes, all global (and static) code and data are non-pageable by
default.

Stephan