18#define WLX_SHUTDOWN_STATE_LOGOFF 0x01
19#define WLX_SHUTDOWN_STATE_POWER_OFF 0x02
20#define WLX_SHUTDOWN_STATE_REBOOT 0x04
22#define WLX_SHUTDOWN_STATE_SLEEP 0x10
24#define WLX_SHUTDOWN_STATE_HIBERNATE 0x40
28#define FONT_POINT_SIZE 13
30#define DARK_GREY_COLOR RGB(244, 244, 244)
31#define LIGHT_GREY_COLOR RGB(38, 38, 38)
37#define NUMBER_OF_BUTTONS 4
40#define BUTTON_SHUTDOWN 0
41#define BUTTON_SHUTDOWN_PRESSED (CY_BITMAP + BUTTON_SHUTDOWN)
42#define BUTTON_SHUTDOWN_FOCUSED (CY_BITMAP + BUTTON_SHUTDOWN_PRESSED)
43#define BUTTON_REBOOT (CY_BITMAP + BUTTON_SHUTDOWN_FOCUSED)
44#define BUTTON_REBOOT_PRESSED (CY_BITMAP + BUTTON_REBOOT)
45#define BUTTON_REBOOT_FOCUSED (CY_BITMAP + BUTTON_REBOOT_PRESSED)
46#define BUTTON_SLEEP (CY_BITMAP + BUTTON_REBOOT_FOCUSED)
47#define BUTTON_SLEEP_PRESSED (CY_BITMAP + BUTTON_SLEEP)
48#define BUTTON_SLEEP_FOCUSED (CY_BITMAP + BUTTON_SLEEP_PRESSED)
49#define BUTTON_SLEEP_DISABLED (CY_BITMAP + BUTTON_SLEEP_FOCUSED)
52#define SHUTDOWN_BUTTON_HOT 0
53#define REBOOT_BUTTON_HOT 1
54#define SLEEP_BUTTON_HOT 2
55#define HIBERNATE_BUTTON_HOT 3
87 L"Software\\Policies\\Microsoft\\Windows NT\\Reliability",
108 L"Software\\Microsoft\\Windows\\CurrentVersion\\Reliability",
145 L"SYSTEM\\CurrentControlSet\\Control\\Windows",
158 L"EnforceFriendlyShutdown",
189 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
209 return (dwValue != 0);
237 L"SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Shutdown",
245 L"ShowHibernateButton",
253 return (dwValue != 0);
267 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
284 return (dwValue != 0);
288 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
306 return (dwValue != 0);
456 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
550 if (hwndTarget != hButton)
599 HWND hwndTool, hwndTip;
605 tool.
cbSize =
sizeof(tool);
657 HWND hwndDest, hwndTarget;
736 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
746 switch (ShutdownCode)
772 (
LPBYTE)&dwValue,
sizeof(dwValue));
809 if (ShutdownCode ==
CB_ERR)
814 switch (ShutdownCode)
843 if (pContext->bReasonUI)
864 pContext->hfFont =
CreateFontW(lfHeight, 0, 0, 0,
FW_MEDIUM,
FALSE, 0, 0, 0, 0, 0, 0, 0,
L"MS Shell Dlg");
874 pContext->bIsSleepButtonReplaced =
FALSE;
875 pContext->bTimer =
FALSE;
886 pContext->bIsButtonHot[
i] =
FALSE;
893 pContext->pgContext->hDllInstance);
899 pContext->bTimer =
TRUE;
912 WCHAR szBuffer2[256];
914 if (pContext->bFriendlyUI)
1006 pgContext->nShutdownAction =
1127 switch (pdis->
CtlID)
1158 DWORD ShutdownOptions;
1165 Context.pgContext = pgContext;
1166 Context.ShutdownOptions = ShutdownOptions;
1172 if (pgContext->hWlx && pgContext->pWlxFuncs && !
Context.bFriendlyUI)
1174 ret = pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1175 pgContext->hDllInstance,
1236 DWORD ShutdownOptions;
1249 ShutdownOptions &= ~WLX_SHUTDOWN_STATE_LOGOFF;
1265 if (dlgValue ==
IDOK)
1294 else if (dlgValue ==
IDHELP)
1296 FIXME(
"Help is not implemented yet.\n");
1299 else if (dlgValue == -1)
1301 ERR(
"Failed to create dialog\n");
OSVERSIONINFOW VersionInfo
static VOID OnTimer(IN HWND hwndDlg, IN PSYS_SHUTDOWN_PARAMS pShutdownParams)
static INT_PTR CALLBACK ShutdownDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
#define RegCloseKey(hKey)
static HINSTANCE hDllInstance
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
#define IDC_BUTTON_HIBERNATE
#define IDS_SHUTDOWN_LOGOFF_DESC
#define IDC_TURN_OFF_STATIC
#define IDS_SHUTDOWN_RESTART_DESC
#define IDD_SHUTDOWN_FANCY
#define IDS_SHUTDOWN_LOGOFF
#define IDS_SHUTDOWN_SHUTDOWN_DESC
#define IDC_SHUTDOWN_STATIC
#define IDS_SHUTDOWN_SLEEP_DESC
#define IDS_SHUTDOWN_SHUTDOWN
#define IDS_SHUTDOWN_HIBERNATE_DESC
#define IDC_REASON_COMMENT
#define IDS_SHUTDOWN_SLEEP
#define IDS_SHUTDOWN_RESTART
#define IDC_BUTTON_REBOOT
#define IDC_REASON_PLANNED
#define IDC_HIBERNATE_STATIC
#define IDC_SHUTDOWN_ACTION
#define IDD_SHUTDOWN_REASON
#define IDC_BUTTON_SHUTDOWN
#define IDC_RESTART_STATIC
#define IDS_SHUTDOWN_HIBERNATE
#define IDC_SHUTDOWN_DESCRIPTION
#define IDD_SHUTDOWN_FANCY_LONG
#define BUTTON_SLEEP_DISABLED
static VOID ShutdownOnOk(IN HWND hDlg, IN PGINA_CONTEXT pgContext)
DWORD GetAllowedShutdownOptions(VOID)
#define WLX_SHUTDOWN_STATE_REBOOT
DWORD WINAPI ShellTurnOffDialog(HWND hWnd)
DWORD LoadShutdownSelState(VOID)
static BOOL GetShutdownReasonUI(VOID)
#define BUTTON_REBOOT_PRESSED
#define REBOOT_BUTTON_HOT
static BOOL ForceFriendlyUI(VOID)
#define BUTTON_SLEEP_FOCUSED
#define WLX_SHUTDOWN_STATE_LOGOFF
#define WLX_SHUTDOWN_STATE_SLEEP
static BOOL IsFriendlyUIActive(VOID)
VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID, HINSTANCE hInst)
static BOOL IsShowHibernateButtonActive(VOID)
static VOID ShutdownOnInit(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
static INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct _SHUTDOWN_DLG_CONTEXT * PSHUTDOWN_DLG_CONTEXT
static BOOL IsDomainMember(VOID)
static BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT *pdis, PSHUTDOWN_DLG_CONTEXT pContext)
#define BUTTON_SHUTDOWN_PRESSED
DWORD WINAPI ShellShutdownDialog(HWND hParent, LPWSTR lpUsername, BOOL bHideLogoff)
VOID ChangeRequiredButton(HWND hDlg, PSHUTDOWN_DLG_CONTEXT pContext)
#define SHUTDOWN_BUTTON_HOT
BOOL WINAPI ShellIsFriendlyUIActive(VOID)
DWORD GetDefaultShutdownSelState(VOID)
#define NUMBER_OF_BUTTONS
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
static VOID ShutdownOnFriendlyInit(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
static VOID UpdateShutdownDesc(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
#define BUTTON_SLEEP_PRESSED
#define WLX_SHUTDOWN_STATE_POWER_OFF
#define BUTTON_REBOOT_FOCUSED
VOID EndFriendlyDialog(HWND hDlg, PSHUTDOWN_DLG_CONTEXT pContext)
#define HIBERNATE_BUTTON_HOT
#define WLX_SHUTDOWN_STATE_HIBERNATE
DWORD GetDefaultShutdownOptions(VOID)
#define BUTTON_SHUTDOWN_FOCUSED
VOID SaveShutdownSelState(IN DWORD ShutdownCode)
static BOOL IsNetwareActive(VOID)
struct _SHUTDOWN_DLG_CONTEXT SHUTDOWN_DLG_CONTEXT
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned __int3264 UINT_PTR
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
#define REG_OPTION_NON_VOLATILE
#define UNREFERENCED_PARAMETER(P)
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
#define TTM_SETMAXTIPWIDTH
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
ULONG dwOSVersionInfoSize
BOOL bIsButtonHot[NUMBER_OF_BUTTONS]
BOOL bIsSleepButtonReplaced
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_LOCAL_MACHINE
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_CTLCOLORSTATIC
#define GetWindowLongPtrW
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HWND WINAPI GetCapture(void)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
#define MB_ICONEXCLAMATION
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
HWND WINAPI WindowFromPoint(_In_ POINT)
int WINAPI GetDlgCtrlID(_In_ HWND)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP
#define WLX_SAS_ACTION_SHUTDOWN_HIBERNATE
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
#define WLX_SAS_ACTION_LOGOFF