Waiting for the system to be available

  • Thread starter Thread starter Damon Gautama
  • Start date Start date
D

Damon Gautama

Hello,
I sent a note a while back about giving the system time to initialize before
trying to do some work. Slobodan suggested using
CMP_WaitNoPendingInstallEvents. We added this, and the system does wait for
a while. One of the first things we do is open and display a bitmap. This
bitmap handle comes up bad. The scenarios we've tried are:

1) Explorer is the shell and launches our app. No problems.
2) Our app is the shell. Calls CMP_WaitNoPendingInstallEvents, then sleeps
for 20 seconds. No problems
3) Our app is the shell. Calls CMP_WaitNoPendingInstallEvents. Bitmap handle
is bad.

We don't want to launch explorer, so #2 above is currently the best
approach. I would like to find something more elegant than sleep, though. Is
there something akin to WaitUntilSystemIsFullyUp? The other option is to
loop on reading the bitmap, and keep trying until the handle is good or
until we time out. If we wait for the good handle, is there still a
possibility that parts of the system are still not up, and we could face
problems down the line? These timing things give me the willies, as it is
often the client that finds the bugs first.

Thanks!
damon
 
Yes this can be the problem.

CMP_WaitNoPendingInstallEvents will wait while drivers are loading and
initializing.
But there can be some small gap between some driver starts, so this call
could actually finish before all drivers or services are fully operational.

Try modifying step 2.
Like:
CMP_WaitNoPendingInstallEvents(..)
Sleep(2000);
CMP_WaitNoPendingInstallEvents(..)


Or try something like:
for(int x=0;x<100;x++)
{
CMP_WaitNoPendingInstallEvents(..);
Sleep(20);
}

BTW:
If you find something like WaitUntilSystemIsFullyUp let me know.

Regards,
Slobodan
 
Thanks a lot! I'll give that a try. I will let you know if I find a catchall
function.

damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top