Original answer: Oct. 2008
You also got all the "rundll32.exe shell32.dll
" serie:
(see update below)
rundll32.exe user.exe,**ExitWindows**
[Fast Shutdown of Windows]
rundll32.exe user.exe,**ExitWindowsExec**
[Restart Windows]
rundll32.exe shell32.dll,SHExitWindowsEx n
where n
stands for:
- 0 -
LOGOFF
- 1 -
SHUTDOWN
- 2 -
REBOOT
- 4 -
FORCE
- 8 -
POWEROFF
(can be combined -> 6 = 2+4 FORCE REBOOT
)
Update April 2015 (6+ years later):
1800 INFORMATION kindly points out in the comments:
Don't use rundll32.exe
for this purpose. It expects that the function you passed on the command line has a very specific method signature - it doesn't match the method signature of ExitWindows
.
Raymond CHEN wrote:
The function signature required for functions called by rundll32.exe
is:
void CALLBACK ExitWindowsEx(HWND hwnd, HINSTANCE hinst,
LPSTR pszCmdLine, int nCmdShow);
That hasn't stopped people from using rundll32
to call random functions that weren't designed to be called by rundll32
, like user32 LockWorkStation
or user32 ExitWindowsEx
.
(oops)
The actual function signature for ExitWindowsEx is:
BOOL WINAPI ExitWindowsEx(UINT uFlags, DWORD dwReserved);
And to make it crystal-clear:
Rundll32
is a leftover from Windows 95, and it has been deprecated since at least Windows Vista because it violates a lot of modern engineering guidelines.