CE6 MSDN Article: Delay load drivers for faster boot times

Yuqun Cao, a Software Development Engineer on the Windows CE JDP team has written and published an article to MSDN called “BusEnum: Enabling Finer Control of Device Driver Loading”.

The title of the paper, while correct, doesn’t go far enough to describe what the paper is describing – the paper really discusses delay loading of drivers to improve boot times of devices.

Here’s the summary of the paper from Yugun: In this white paper, we present an enhanced version of the bus enumerator driver, also known as BusEnum, which gives better control over when a device driver will be loaded. Traditionally, the built-in drivers are loaded by BusEnum in a single thread. The enhanced BusEnum driver allows for deferred loading of some nonessential drivers by using a simple registry configuration. With this enhanced capability, the device can be up-and-ready for user interaction sooner, while the remaining drivers are being loaded in the background. This deferred loading feature can be used to speed up device boot time. It is especially effective if some drivers spend a long time in the driver Init() function. The enhanced BusEnum driver presented in this white paper has already been used on a production device to improve the device boot time.

- Mike

Comments (5)

  1. ardarim says:

    Although it will work well, there may be a small amount of memory leak.

    2 handles (m_hAsyncLoadStartEvent and m_hAsyncLoadThread) seem not to be CloseHandled at anywhere.

  2. yuqun says:

    Hello Ardarim,

    Thank you for your comment. Your feedback is important to us.

    Not all the modifications are included in the whitepaper article. The code snippet in the article is to show some key modifications. The readers are referred to the full sample source code.

    The thread handle is closed in DeviceFolder::UnloadDevice() function already if you look at the sample code.

    You do point out a memory leak for the event handle m_hAsyncLoadStartEvent. After seeing your comment, I check the sample source code and added the following to DeviceFolder::UnloadDevice() function, after closing the thread handle:





    The BusEnum2.zip has been updated with this fix.

    Thank you and we appreciate your feedback.


  3. ardarim says:

    Hi Yuqun,

    I think thread/event handles should be freed just after LoadDeviceAsync thread has been done. Because they are no longer needed after a driver has been loaded asynchronously.

    Commonly, most drivers are resident permanently and UnloadDevice may rarely be called. In that case these handles are wasted in memory.

    I’m glad if this helps you.

  4. RS says:

    Hi Yuqun,

    Thanks for the article. This was something that I was looking to enhance on the BusEnum and I’m glad that I found it. Some comments :

    1.The registry code doesn’t work as stated:

    ; Second instance of BusEnum.dll, for drivers under "BuiltInAsyncBus" subkey.

    ; Start in a separate thread. Waiting for "Start" event to continue.






    "LoadAsyncEvent"="Start" ; waiting for the "Start" event

    "LoadAsyncDelay"=dword:2710 ; event time out after 10 seconds

    You will have to add the "IOCTL" flag to it. w/o that flag I don’t see the ActivateChilddriver() getting called.

    2.I moved about 8 builtin drivers to the AsyncDriver and I timed the Boot-up time. But I did not find any improvement. This change was done on WM platform.

    Any ideas why I dont see any change in the boot-up time. Note I did verify by adding the debug messages that those 8 built-in drivers are being loaded under "Asyncbus"

  5. RS says:

    Hi Yuqun,,

    Any update on my previous post?

Skip to main content