Determines if explorer.exe is running as a Windows shell?

I need to make sure it explorer.exe

works like a system shell. I need to do the following:

  • Overwrite current shell ( Winlogon\Shell

    ) withexplorer.exe

  • Run explorer.exe

    (as a shell)
  • Overwrite the current shell with my own shell.

There is a race between the last two steps:

  • If I overwrite the current shell too quickly with my own shell, the My Documents window opens.

So the question is, are there any events / mutexes / callbacks that I can call to make sure the explorer is initialized as a shell?

The best I have been able to do is wait for the tray window, for example:

while(!FindWindow("Shell_TrayWnd", NULL)) { 
     sleep(250);
}

      

Which seems kind of sloppy, is there a better way?

0


a source to share


4 answers


I wouldn't even try to do it. You have to create a new winsta0 desktop (Win32 API CreateDesktop), start the Kiosk application on that desktop and switch to it. This way, you leave the default desktop alone, start explorer and you can switch back to it if you need to. We had great success with this kiosk project we built.



+6


a source


The best way (as actually documented) would be to create a top-level window and wait for the "TaskbarCreated" broadcast. This way, you also get rid of the Sleep () call.



The broadcast is documented here .

+3


a source


You haven't explained why you need 3 steps, "kiosk software" is not an explanation.

Have you tried just setting the shell in system.ini, for example as background and other desktop replacement software? If you need to switch back and forth, consider a shell switch like ShellOn or LiteSpawn that were written for the task.

0


a source


Why aren't you looking at running processes? Explorer.exe should not be listed prior to phase 1 because it is not the default shell. Step 2 you start it and look at the process, which after that you change.

I'm not sure if you are working on the .NET platform or not, but if you are events in the StartInfo classes should be enough for your needs.

-1


a source







All Articles