Configure asynchronous driver loading for WEC2013 / BSP1.4

Hello,

we have to make some changes in our initialization for the asynchronous driver loading in BSP 1.4.
Waiting until all required drivers are loaded should be easy to implement, this is described here.

But i have 2 questions to solve:

1: Wait for flashdisk

How do i know when the flashdisk is ready to use? I could do a “GetFileAttributes” in a loop, but that seems rather ugly. Is there a named event too on which i can wait with “WaitForSingleObject”?

2: Telnet login

We have activated FTP & Telnet in our internal developer build. A small helper application is launched at startup via HKEY_LOCAL_MACHINE\Init to create a windows user by calling NTLMSetUserInfo. This user is needed for FTP and Telnet.
Login to FTP is still working, but login over telnet is failing. How do I make sure that this helper application is launched before the telnet service is started?

  1. with asynchronous driver loading you can wait until a driver has completed its initialization using a named event.
    Something like this:

    initevent=OpenEvent(EVENT_ALL_ACCESS,FALSE,TEXT(“LOAD_EVENT_DRIVERS\BUILTIN\”));

    WaitForSingleObject(initevent,5000)
    If you can’t open the event the driver was not configured (system didn’t even try to load it), if event is set then the system called the driver Init function and waited until it returned. Of course Init may have failed, you’ll need to check if the driver is actually available or, for Wait4flashdisk, if the folder is actually there (but at this point you’ll know that if it’s there it has been mounted correctly, no need for a loop)

  2. Starting the application before telnet does should not be an issue, users are validated at login, so creating them before the service start will work.

1.) Waiting for the drivers (SPI, CAN, …) that we are using is no problem.
But how do i know when the flashdisk is mounted and ready to use?
There is no named event “LOAD_EVENT_DRIVERS\BUILTIN\Wait4FlashDisk” on which i can wait.

2.) It seem that our “userconfig.exe” was launched too early. I added a dependency on “gwes.dll” in HKEY_LOCAL_MACHINE\Init\DependXX and telnet login is working now.

  1. You should have that event, the driver is loaded from:

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Wait4FlashDisk]
    and if it’s configured to be loaded asynchronously it will create an event named LOAD_EVENT_Drivers\Builtin\Wait4FlashDisk that you can use to wait until it has completed initialization.
    Initialization completes in those 2 cases:

  • the folder is mounted and accessible
  • timeout has expired and the folder is still not mounted
  1. Does the application has a UI or calls printf or other functions that can trigger the creation of a console window? That would explain the issue.

1.) I’ve found the problem, the event name must be all uppercase LOAD_EVENT_DRIVERS\\BUILTIN\\WAIT4FLASHDISK

2.) Our userconfig.exe is just using REATILMSG for debug output