Pageable Device Drivers
During the Windows Mobile 5.0 timeframe, we changed most of the networking components to be pageable device drivers. This caused boot times to decrease by a significant amount since there was now more than 2MB extra free RAM.
A device driver can safely be made pageable if:
1. it does not need to do any processing during the critical power down and power up phase (xxx_PowerDown and xxx_PowerUp)
2. it is not involved in the paging process
All that needs to be done to make a device driver pageable is:
- remove the xxx_PowerDown and xxx_PowerUp entries from the driver’s .def file
- add the value, “Flags”=dword:2, to the device driver’s device key (2 == DEVFLAGS_LOADLIBRARY). By default, a device driver’s DLL is loaded with LoadDriver() which loads it as non-pageable.
In some device drivers the only processing during xxx_PowerDown/Up is to note that the system power mode has changed. Such processing can be replaced with a thread that uses a Message Queue (CreateMsgQueue) which it has passed to the RequestPowerNotifications function, specifying PBT_RESUME. Then it can loop calling ReadMsgQueue.
The PBT_RESUME messages get posted in a timely enough manner that this method is in most cases an adequate replacement for xxx_PowerDown/Up.
Author: David Kanz