reactos/reactos/base/applications/shutdown/gui.c
Hermès Bélusca-Maïto 45d0b41d19 [SHUTDOWN]
Improve functionnality of the shutdown utility :

* Added extra arguments based upon Windows 7.
* Added options to CommandLineOptions function.
* Simplify the PrintResourceString() function.
* Removed PrintUsage() since PrintResourceString() does a more flexible job at printing strings out.
* Added clear error messages when there is a problem. This makes it a bit easier to determine if there is a problem.
* Convert all the C++ comments to C.
* Since each version of Windows has a different upper limit for the length of the comment, a work around solution is used that first checks the length of the comment based upon the version of Windows that the user is currently using.
* Added support for hibernation mode, but the function SetSuspendState() is only a stub right now.
* In cases where the shutdown/restart operation is done remotely, now the proper permission is granted if the user has the proper permission.
* Added the REASON structure, which contains all the reason code combinations required for giving the proper reason code to the computer.
* Added bare bones basic support for the GUI option (/i). However, until the required features are added to ReactOS, the GUI won't do anything.
* Convert the program to full UNICODE support.

CORE-6613 #resolve #comment Committed in r57916. Thanks :)

svn path=/trunk/; revision=57916
2012-12-14 23:29:22 +00:00

71 lines
1.7 KiB
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS shutdown/logoff utility
* FILE: base/applications/shutdown/gui.c
* PURPOSE: Shows a GUI used for managing multiple remote shutdown/restarts
* PROGRAMMERS: Lee Schroeder
*/
#include "precomp.h"
BOOL CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch(LOWORD(wparam))
{
case IDC_OK:
EndDialog(hwnd, IDC_OK);
break;
case IDC_CANCEL:
EndDialog(hwnd, IDC_CANCEL);
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
default:
return FALSE;
}
return TRUE;
}
/*
* NOTE: Until the ability to shutdown computers remotely, the GUI feature
* can't be fully implemented.
*/
BOOL ShutdownGuiMain(struct CommandLineOptions opts)
{
INT_PTR result = DialogBoxW(GetModuleHandle(NULL),
MAKEINTRESOURCEW(IDD_GUI),
NULL,
ShutdownGuiProc);
switch (result)
{
case IDC_OK:
MessageBoxW(NULL, L"This function is unimplemented.", L"Unimplemented", MB_OK);
break;
case IDC_CANCEL:
/* Exits the program */
break;
default:
MessageBoxW(NULL, L"Dialog Error!", L"Message", MB_OK);
return FALSE;
}
return TRUE;
}
/* EOF */