About Shutdown

M

Merry.Win

Hello,everyone

I have an application that can work properly under window98.
But when I run it under windowsXPE,the applicaton by calling
windows API functions directly can not shutdown or reboot
system which needs privilege .

Anybody knows how to resolve the problem mentioned above
without modifying my application?


Best Regards


Merry.Win
2006-11-22
 
K

KM

It is always a bit scary to workaround a problem within an app without an ability to change the code. Especially when you "port" the
app from Win95/98 to NT/XP. Too many issues you may be creating this way.

Anyway, just an idea. Obviously you need SE_SHUTDOWN_NAME privilege granted to the process so that it can call ExitWindows[Ex] API,
InitSystemShutdown or etc.
You can create a simple small app that will launch your "win98 app" by calling to CreateProcess API, for instance. Then, before you
close the created process handle, you can open its token and adjust its privileges.
You can pretty much use the code from here: http://www.codeproject.com/system/ShutDownAlarm.asp
But instead of the GetCurrentProcess() you would want to use the handle you received from the CreateProcess API.
 

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

Top