Question about IRQL level, paging, and logging

I have some newbie questions regarding IRQL and paging so please bear with me.

Are DriverUnload, AddDevice, and all of the MajorFunction IRPs going to be at
a fixed IRQL (DISPATCH level)? Is there any way they would ever be invoked at
higher (or lower) IRQL levels?

I have seen code that uses #pragmas to designate functions as INIT or PAGE.
I presume that one could also use this mechanism to make unpagable code, true?
Does the kernel set limits on how many pages of non-pagable memory a driver can have?

If a function spans many pages and the function is also marked pageable, are you
always guaranteed that when you enter the function the entire function will be paged in?

Thanks,

Trey

Comments inline:

<trey.taylor> wrote in message news:xxxxx@ntdev…
>I have some newbie questions regarding IRQL and paging so please bear with
>me.
>
> Are DriverUnload, AddDevice, and all of the MajorFunction IRPs going to be
> at
> a fixed IRQL (DISPATCH level)? Is there any way they would ever be invoked
> at
> higher (or lower) IRQL levels?

For a detailed look at IRQL levels for functions see
http://www.microsoft.com/whdc/driver/kernel/IRQL.mspx

> I have seen code that uses #pragmas to designate functions as INIT or
> PAGE.
> I presume that one could also use this mechanism to make unpagable code,
> true?
> Does the kernel set limits on how many pages of non-pagable memory a
> driver can have?

The default is non-pageable so the #pragma need not be explicit. There is
no limit, though obviously system address space and other things come into
play.

> If a function spans many pages and the function is also marked pageable,
> are you
> always guaranteed that when you enter the function the entire function
> will be paged in?
>
No, there is no such guarantee, the pages will come in as touched.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply</trey.taylor>