ReactOS 0.4.15-dev-7788-g1ad9096
shutdown.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS msgina.dll
4 * FILE: lib/msgina/shutdown.c
5 * PURPOSE: Shutdown Dialog Box (GUI only)
6 * PROGRAMMERS: Lee Schroeder (spaceseel at gmail dot com)
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 * Arnav Bhatt (arnavbhatt288 at gmail dot com)
9 */
10
11#include "msgina.h"
12#include <powrprof.h>
13#include <wingdi.h>
14#include <windowsx.h>
15#include <commctrl.h>
16
17/* Shutdown state flags */
18#define WLX_SHUTDOWN_STATE_LOGOFF 0x01
19#define WLX_SHUTDOWN_STATE_POWER_OFF 0x02
20#define WLX_SHUTDOWN_STATE_REBOOT 0x04
21// 0x08
22#define WLX_SHUTDOWN_STATE_SLEEP 0x10
23// 0x20
24#define WLX_SHUTDOWN_STATE_HIBERNATE 0x40
25// 0x80
26
27/* Macros for fancy shut down dialog */
28#define FONT_POINT_SIZE 13
29
30#define DARK_GREY_COLOR RGB(244, 244, 244)
31#define LIGHT_GREY_COLOR RGB(38, 38, 38)
32
33/* Bitmap's size for buttons */
34#define CX_BITMAP 33
35#define CY_BITMAP 33
36
37#define NUMBER_OF_BUTTONS 4
38
39/* After determining the button as well as its state paint the image strip bitmap using these predefined positions */
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)
50
51/* For bIsButtonHot */
52#define SHUTDOWN_BUTTON_HOT 0
53#define REBOOT_BUTTON_HOT 1
54#define SLEEP_BUTTON_HOT 2
55#define HIBERNATE_BUTTON_HOT 3
56
58{
64 HBRUSH hBrush;
75
76static
77BOOL
79{
81 DWORD dwValue, dwSize;
82 HKEY hKey;
83 LONG lRet;
84
85 /* Query the policy value */
87 L"Software\\Policies\\Microsoft\\Windows NT\\Reliability",
88 0,
90 &hKey);
91 if (lRet == ERROR_SUCCESS)
92 {
93 dwValue = 0;
94 dwSize = sizeof(dwValue);
96 L"ShutdownReasonUI",
97 NULL,
98 NULL,
99 (LPBYTE)&dwValue,
100 &dwSize);
102
103 return (dwValue != 0) ? TRUE : FALSE;
104 }
105
106 /* Query the machine value */
108 L"Software\\Microsoft\\Windows\\CurrentVersion\\Reliability",
109 0,
111 &hKey);
112 if (lRet == ERROR_SUCCESS)
113 {
114 dwValue = 0;
115 dwSize = sizeof(dwValue);
117 L"ShutdownReasonUI",
118 NULL,
119 NULL,
120 (LPBYTE)&dwValue,
121 &dwSize);
123
124 return (dwValue != 0) ? TRUE : FALSE;
125 }
126
127 /* Return the default value */
130 return FALSE;
131
132 return FALSE;
133// return (VersionInfo.wProductType == VER_NT_WORKSTATION) ? FALSE : TRUE;
134}
135
136static
137BOOL
139{
140 DWORD dwType, dwValue, dwSize;
141 HKEY hKey;
142 LONG lRet;
143
145 L"SYSTEM\\CurrentControlSet\\Control\\Windows",
146 0,
148 &hKey);
149 if (lRet != ERROR_SUCCESS)
150 return FALSE;
151
152 /* CORE-17282 First check an optional ReactOS specific override, that Windows does not check.
153 We use this to allow users pairing 'Server'-configuration with FriendlyShutdown.
154 Otherwise users would have to change CSDVersion or LogonType (side-effects AppCompat) */
155 dwValue = 0;
156 dwSize = sizeof(dwValue);
157 lRet = RegQueryValueExW(hKey,
158 L"EnforceFriendlyShutdown",
159 NULL,
160 &dwType,
161 (LPBYTE)&dwValue,
162 &dwSize);
163
164 if (lRet == ERROR_SUCCESS && dwType == REG_DWORD && dwValue == 0x1)
165 {
167 return TRUE;
168 }
169
170 /* Check product version number */
171 dwValue = 0;
172 dwSize = sizeof(dwValue);
173 lRet = RegQueryValueExW(hKey,
174 L"CSDVersion",
175 NULL,
176 &dwType,
177 (LPBYTE)&dwValue,
178 &dwSize);
180
181 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD || dwValue != 0x300)
182 {
183 /* Allow Friendly UI only on Workstation */
184 return FALSE;
185 }
186
187 /* Check LogonType value */
189 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
190 0,
192 &hKey);
193 if (lRet != ERROR_SUCCESS)
194 return FALSE;
195
196 dwValue = 0;
197 dwSize = sizeof(dwValue);
198 lRet = RegQueryValueExW(hKey,
199 L"LogonType",
200 NULL,
201 &dwType,
202 (LPBYTE)&dwValue,
203 &dwSize);
205
206 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
207 return FALSE;
208
209 return (dwValue != 0);
210}
211
212static
213BOOL
215{
217 return FALSE;
218}
219
220static
221BOOL
223{
225 return FALSE;
226}
227
228static
229BOOL
231{
232 INT_PTR lRet;
233 HKEY hKey;
234 DWORD dwValue, dwSize;
235
237 L"SOFTWARE\\Policies\\Microsoft\\Windows\\System\\Shutdown",
238 0, KEY_QUERY_VALUE, &hKey);
239 if (lRet == ERROR_SUCCESS)
240 {
241 dwValue = 0;
242 dwSize = sizeof(dwValue);
243
244 lRet = RegQueryValueExW(hKey,
245 L"ShowHibernateButton",
246 NULL, NULL,
247 (LPBYTE)&dwValue, &dwSize);
249 if (lRet != ERROR_SUCCESS)
250 {
251 return FALSE;
252 }
253 return (dwValue != 0);
254 }
255 return FALSE;
256}
257
258static
259BOOL
261{
262 DWORD dwType, dwValue, dwSize;
263 HKEY hKey;
264 LONG lRet;
265
267 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
268 0,
270 &hKey);
271 if (lRet == ERROR_SUCCESS)
272 {
273 dwValue = 0;
274 dwSize = sizeof(dwValue);
275 lRet = RegQueryValueExW(hKey,
276 L"ForceFriendlyUI",
277 NULL,
278 &dwType,
279 (LPBYTE)&dwValue,
280 &dwSize);
282
283 if (lRet == ERROR_SUCCESS && dwType == REG_DWORD)
284 return (dwValue != 0);
285 }
286
288 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
289 0,
291 &hKey);
292 if (lRet == ERROR_SUCCESS)
293 {
294 dwValue = 0;
295 dwSize = sizeof(dwValue);
296 lRet = RegQueryValueExW(hKey,
297 L"ForceFriendlyUI",
298 NULL,
299 &dwType,
300 (LPBYTE)&dwValue,
301 &dwSize);
302
304
305 if (lRet == ERROR_SUCCESS && dwType == REG_DWORD)
306 return (dwValue != 0);
307 }
308
309 return FALSE;
310}
311
312static
313BOOL
315 DRAWITEMSTRUCT* pdis,
316 PSHUTDOWN_DLG_CONTEXT pContext)
317{
318 BOOL bRet;
319 HDC hdcMem;
320 HBITMAP hbmOld;
321 int y;
322 RECT rect;
323
325 hbmOld = SelectObject(hdcMem, pContext->hImageStrip);
326 rect = pdis->rcItem;
327
328 /* Check the button ID for revelant bitmap to be used */
329 switch (pdis->CtlID)
330 {
332 {
333 switch (pdis->itemAction)
334 {
335 case ODA_DRAWENTIRE:
336 case ODA_FOCUS:
337 case ODA_SELECT:
338 {
340 if (pdis->itemState & ODS_SELECTED)
341 {
343 }
344 else if (pContext->bIsButtonHot[SHUTDOWN_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
345 {
347 }
348 break;
349 }
350 }
351 break;
352 }
353
355 {
356 switch (pdis->itemAction)
357 {
358 case ODA_DRAWENTIRE:
359 case ODA_FOCUS:
360 case ODA_SELECT:
361 {
363 if (pdis->itemState & ODS_SELECTED)
364 {
366 }
367 else if (pContext->bIsButtonHot[REBOOT_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
368 {
370 }
371 break;
372 }
373 }
374 break;
375 }
376
378 case IDC_BUTTON_SLEEP:
379 {
380 switch (pdis->itemAction)
381 {
382 case ODA_DRAWENTIRE:
383 case ODA_FOCUS:
384 case ODA_SELECT:
385 {
386 y = BUTTON_SLEEP;
387 if (pdis->itemState & ODS_DISABLED)
388 {
390 }
391 else if (pdis->itemState & ODS_SELECTED)
392 {
394 }
395 else if ((pdis->CtlID == IDC_BUTTON_SLEEP && pContext->bIsButtonHot[SLEEP_BUTTON_HOT]) ||
397 (pdis->itemState & ODS_FOCUS))
398 {
400 }
401 break;
402 }
403 }
404 break;
405 }
406 }
407
408 /* Draw it on the required button */
409 bRet = BitBlt(pdis->hDC,
410 (rect.right - rect.left - CX_BITMAP) / 2,
411 (rect.bottom - rect.top - CY_BITMAP) / 2,
413
414 SelectObject(hdcMem, hbmOld);
416
417 return bRet;
418}
419
420BOOL
421WINAPI
423{
424 BOOL bActive;
425
426 bActive = IsFriendlyUIActive();
427
429 return FALSE;
430
431 return bActive;
432}
433
434DWORD
436{
438}
439
440DWORD
442{
443 LONG lRet;
444 HKEY hKeyCurrentUser, hKey;
445 DWORD dwValue, dwTemp, dwSize;
446
447 /* Default to shutdown */
449
450 /* Open the current user HKCU key */
451 lRet = RegOpenCurrentUser(MAXIMUM_ALLOWED, &hKeyCurrentUser);
452 if (lRet == ERROR_SUCCESS)
453 {
454 /* Open the subkey */
455 lRet = RegOpenKeyExW(hKeyCurrentUser,
456 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
457 0, KEY_QUERY_VALUE, &hKey);
458 RegCloseKey(hKeyCurrentUser);
459 }
460 if (lRet != ERROR_SUCCESS)
461 return dwValue;
462
463 /* Read the value */
464 dwSize = sizeof(dwTemp);
465 lRet = RegQueryValueExW(hKey,
466 L"Shutdown Setting",
467 NULL, NULL,
468 (LPBYTE)&dwTemp, &dwSize);
470
471 if (lRet == ERROR_SUCCESS)
472 {
473 switch (dwTemp)
474 {
476 dwValue = WLX_SAS_ACTION_LOGOFF;
477 break;
478
481 break;
482
485 break;
486
487 // 0x08
488
491 break;
492
493 // 0x20
494
497 break;
498
499 // 0x80
500 }
501 }
502
503 return dwValue;
504}
505
506static INT_PTR
509 HWND hButton,
510 UINT uMsg,
513{
514 PSHUTDOWN_DLG_CONTEXT pContext;
516 int buttonID = GetDlgCtrlID(hButton);
517
518 switch (uMsg)
519 {
520 case WM_MOUSEMOVE:
521 {
522 HWND hwndTarget;
524
525 if (GetCapture() != hButton)
526 {
527 SetCapture(hButton);
528 if (buttonID == IDC_BUTTON_SHUTDOWN)
529 {
531 }
532 else if (buttonID == IDC_BUTTON_REBOOT)
533 {
535 }
536 else if (buttonID == IDC_BUTTON_SLEEP)
537 {
539 }
540 else if (buttonID == IDC_BUTTON_HIBERNATE)
541 {
543 }
545 }
546
547 ClientToScreen(hButton, &pt);
548 hwndTarget = WindowFromPoint(pt);
549
550 if (hwndTarget != hButton)
551 {
553 if (buttonID == IDC_BUTTON_SHUTDOWN)
554 {
556 }
557 else if (buttonID == IDC_BUTTON_REBOOT)
558 {
560 }
561 else if (buttonID == IDC_BUTTON_SLEEP)
562 {
564 }
565 else if (buttonID == IDC_BUTTON_HIBERNATE)
566 {
568 }
569 }
570 InvalidateRect(hButton, NULL, FALSE);
571 break;
572 }
573
574 /* Whenever one of the buttons gets the keyboard focus, set it as default button */
575 case WM_SETFOCUS:
576 {
577 SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
578 break;
579 }
580
581 /* Otherwise, set IDCANCEL as default button */
582 case WM_KILLFOCUS:
583 {
585 break;
586 }
587 }
588 return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
589}
590
591VOID
593 int controlID,
594 int detailID,
595 HWND hDlg,
596 int titleID,
598{
599 HWND hwndTool, hwndTip;
600 WCHAR szBuffer[256];
601 TTTOOLINFOW tool;
602
603 hwndTool = GetDlgItem(hDlg, controlID);
604
605 tool.cbSize = sizeof(tool);
606 tool.hwnd = hDlg;
608 tool.uId = (UINT_PTR)hwndTool;
609
610 /* Create the tooltip */
615 hDlg, NULL, hInst, NULL);
616
617 /* Associate the tooltip with the tool. */
618 LoadStringW(hInst, detailID, szBuffer, _countof(szBuffer));
619 tool.lpszText = szBuffer;
620 SendMessageW(hwndTip, TTM_ADDTOOLW, 0, (LPARAM)&tool);
621 LoadStringW(hInst, titleID, szBuffer, _countof(szBuffer));
622 SendMessageW(hwndTip, TTM_SETTITLEW, TTI_NONE, (LPARAM)szBuffer);
623 SendMessageW(hwndTip, TTM_SETMAXTIPWIDTH, 0, 250);
624}
625
626VOID
628 HWND hDlg,
629 PSHUTDOWN_DLG_CONTEXT pContext)
630{
631 if (pContext->bTimer)
632 {
633 KillTimer(hDlg, pContext->iTimer);
634 }
635
636 DeleteObject(pContext->hBitmap);
637 DeleteObject(pContext->hBrush);
638 DeleteObject(pContext->hImageStrip);
639 DeleteObject(pContext->hfFont);
640
641 /* Remove the subclass from the buttons */
642 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
643 {
646 (LONG_PTR)pContext->OldButtonProc);
647 }
648}
649
650VOID
652 HWND hDlg,
653 PSHUTDOWN_DLG_CONTEXT pContext)
654{
655 int destID = IDC_BUTTON_SLEEP;
656 int targetedID = IDC_BUTTON_HIBERNATE;
657 HWND hwndDest, hwndTarget;
658 RECT rect;
659 WCHAR szBuffer[30];
660
661 /* If the sleep button has been already replaced earlier, bring sleep button back to its original position */
662 if (pContext->bIsSleepButtonReplaced)
663 {
664 destID = IDC_BUTTON_HIBERNATE;
665 targetedID = IDC_BUTTON_SLEEP;
666 }
667
668 hwndDest = GetDlgItem(hDlg, destID);
669 hwndTarget = GetDlgItem(hDlg, targetedID);
670
671 /* Get the position of the destination button */
672 GetWindowRect(hwndDest, &rect);
673
674 /* Get the corrected translated coordinates which is relative to the client window */
675 MapWindowPoints(HWND_DESKTOP, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
676
677 /* Set the position of targeted button and hide the destination button */
678 SetWindowPos(hwndTarget,
679 HWND_TOP,
680 rect.left, rect.top,
681 0, 0,
683
684 EnableWindow(hwndDest, FALSE);
685 ShowWindow(hwndDest, SW_HIDE);
686 EnableWindow(hwndTarget, TRUE);
687 ShowWindow(hwndTarget, SW_SHOW);
688 SetFocus(hwndTarget);
689
690 if (!pContext->bIsSleepButtonReplaced)
691 {
692 LoadStringW(pContext->pgContext->hDllInstance, IDS_SHUTDOWN_HIBERNATE, szBuffer, _countof(szBuffer));
693 SetDlgItemTextW(hDlg, IDC_SLEEP_STATIC, szBuffer);
694 }
695 else
696 {
697 LoadStringW(pContext->pgContext->hDllInstance, IDS_SHUTDOWN_SLEEP, szBuffer, _countof(szBuffer));
698 SetDlgItemTextW(hDlg, IDC_SLEEP_STATIC, szBuffer);
699 }
700
701 InvalidateRect(hDlg, NULL, FALSE);
702}
703
705 HWND hDlg,
706 PSHUTDOWN_DLG_CONTEXT pContext)
707{
708 BOOL ReplaceButton = !!(GetKeyState(VK_SHIFT) & 0x8000);
709
710 if (ReplaceButton && !pContext->bIsSleepButtonReplaced)
711 {
712 ChangeRequiredButton(hDlg, pContext);
713 pContext->bIsSleepButtonReplaced = TRUE;
714 }
715 else if (!ReplaceButton && pContext->bIsSleepButtonReplaced)
716 {
717 ChangeRequiredButton(hDlg, pContext);
718 pContext->bIsSleepButtonReplaced = FALSE;
719 }
720}
721
722VOID
724 IN DWORD ShutdownCode)
725{
726 LONG lRet;
727 HKEY hKeyCurrentUser, hKey;
728 DWORD dwValue = 0;
729
730 /* Open the current user HKCU key */
731 lRet = RegOpenCurrentUser(MAXIMUM_ALLOWED, &hKeyCurrentUser);
732 if (lRet == ERROR_SUCCESS)
733 {
734 /* Create the subkey */
735 lRet = RegCreateKeyExW(hKeyCurrentUser,
736 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
737 0, NULL,
740 NULL, &hKey, NULL);
741 RegCloseKey(hKeyCurrentUser);
742 }
743 if (lRet != ERROR_SUCCESS)
744 return;
745
746 switch (ShutdownCode)
747 {
750 break;
751
754 break;
755
758 break;
759
761 dwValue = WLX_SHUTDOWN_STATE_SLEEP;
762 break;
763
766 break;
767 }
768
770 L"Shutdown Setting",
771 0, REG_DWORD,
772 (LPBYTE)&dwValue, sizeof(dwValue));
774}
775
776DWORD
778{
780}
781
782DWORD
784{
785 DWORD Options = 0;
786
787 // FIXME: Compute those options accordings to current user's rights!
789
792
795
796 return Options;
797}
798
799static VOID
801 IN HWND hDlg,
802 IN PSHUTDOWN_DLG_CONTEXT pContext) // HINSTANCE hInstance
803{
804 UINT DescId = 0;
805 DWORD ShutdownCode;
806 WCHAR szBuffer[256];
807
808 ShutdownCode = SendDlgItemMessageW(hDlg, IDC_SHUTDOWN_ACTION, CB_GETCURSEL, 0, 0);
809 if (ShutdownCode == CB_ERR) // Invalid selection
810 return;
811
812 ShutdownCode = SendDlgItemMessageW(hDlg, IDC_SHUTDOWN_ACTION, CB_GETITEMDATA, ShutdownCode, 0);
813
814 switch (ShutdownCode)
815 {
818 break;
819
822 break;
823
826 break;
827
830 break;
831
834 break;
835
836 default:
837 break;
838 }
839
840 LoadStringW(pContext->pgContext->hDllInstance, DescId, szBuffer, _countof(szBuffer));
842
843 if (pContext->bReasonUI)
844 {
848 }
849}
850
851static VOID
853 IN HWND hDlg,
854 IN PSHUTDOWN_DLG_CONTEXT pContext)
855{
856 PGINA_CONTEXT pgContext = pContext->pgContext;
857 HDC hdc;
858 LONG lfHeight;
859
860 /* Create font for the IDC_TURN_OFF_STATIC static control */
861 hdc = GetDC(hDlg);
863 ReleaseDC(hDlg, hdc);
864 pContext->hfFont = CreateFontW(lfHeight, 0, 0, 0, FW_MEDIUM, FALSE, 0, 0, 0, 0, 0, 0, 0, L"MS Shell Dlg");
866
867 /* Create a brush for static controls for fancy shut down dialog */
868 pContext->hBrush = CreateSolidBrush(DARK_GREY_COLOR);
869
870 /* Gather image strip */
871 pContext->hImageStrip = LoadBitmapW(pgContext->hDllInstance, MAKEINTRESOURCEW(IDB_IMAGE_STRIP));
872
873 /* Set the boolean flags to false */
874 pContext->bIsSleepButtonReplaced = FALSE;
875 pContext->bTimer = FALSE;
876
879
880 /* Gather old button func */
881 pContext->OldButtonProc = (WNDPROC)GetWindowLongPtrW(GetDlgItem(hDlg, IDC_BUTTON_HIBERNATE), GWLP_WNDPROC);
882
883 /* Set bIsButtonHot to false, create tooltips for each buttons, make buttons to remember pContext and subclass the buttons */
884 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
885 {
886 pContext->bIsButtonHot[i] = FALSE;
892 hDlg, IDS_SHUTDOWN_SHUTDOWN + i,
893 pContext->pgContext->hDllInstance);
894 }
895
896 if (pContext->ShutdownDialogId == IDD_SHUTDOWN_FANCY && IsPwrSuspendAllowed())
897 {
898 pContext->iTimer = SetTimer(hDlg, 0, 50, NULL);
899 pContext->bTimer = TRUE;
900 }
901}
902
903static VOID
905 IN HWND hDlg,
906 IN PSHUTDOWN_DLG_CONTEXT pContext)
907{
908 PGINA_CONTEXT pgContext = pContext->pgContext;
909 HWND hwndList;
910 INT idx, count, i;
911 WCHAR szBuffer[256];
912 WCHAR szBuffer2[256];
913
914 if (pContext->bFriendlyUI)
915 {
916 ShutdownOnFriendlyInit(hDlg, pContext);
917 return;
918 }
919
920 hwndList = GetDlgItem(hDlg, IDC_SHUTDOWN_ACTION);
921
922 /* Clear the content before it's used */
923 SendMessageW(hwndList, CB_RESETCONTENT, 0, 0);
924
925 /* Log off */
926 if (pContext->ShutdownOptions & WLX_SHUTDOWN_STATE_LOGOFF)
927 {
928 LoadStringW(pgContext->hDllInstance, IDS_SHUTDOWN_LOGOFF, szBuffer, _countof(szBuffer));
929 StringCchPrintfW(szBuffer2, _countof(szBuffer2), szBuffer, pgContext->UserName);
930 idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer2);
931 if (idx != CB_ERR)
933 }
934
935 /* Shut down - DEFAULT */
936 if (pContext->ShutdownOptions & WLX_SHUTDOWN_STATE_POWER_OFF)
937 {
938 LoadStringW(pgContext->hDllInstance, IDS_SHUTDOWN_SHUTDOWN, szBuffer, _countof(szBuffer));
939 idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer);
940 if (idx != CB_ERR)
942 }
943
944 /* Restart */
945 if (pContext->ShutdownOptions & WLX_SHUTDOWN_STATE_REBOOT)
946 {
947 LoadStringW(pgContext->hDllInstance, IDS_SHUTDOWN_RESTART, szBuffer, _countof(szBuffer));
948 idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer);
949 if (idx != CB_ERR)
951 }
952
953 // if (pContext->ShutdownOptions & 0x08) {}
954
955 /* Sleep */
956 if (pContext->ShutdownOptions & WLX_SHUTDOWN_STATE_SLEEP)
957 {
958 LoadStringW(pgContext->hDllInstance, IDS_SHUTDOWN_SLEEP, szBuffer, _countof(szBuffer));
959 idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer);
960 if (idx != CB_ERR)
962 }
963
964 // if (pContext->ShutdownOptions & 0x20) {}
965
966 /* Hibernate */
967 if (pContext->ShutdownOptions & WLX_SHUTDOWN_STATE_HIBERNATE)
968 {
969 LoadStringW(pgContext->hDllInstance, IDS_SHUTDOWN_HIBERNATE, szBuffer, _countof(szBuffer));
970 idx = SendMessageW(hwndList, CB_ADDSTRING, 0, (LPARAM)szBuffer);
971 if (idx != CB_ERR)
973 }
974
975 // if (pContext->ShutdownOptions & 0x80) {}
976
977 /* Set the default shut down selection */
978 count = SendMessageW(hwndList, CB_GETCOUNT, 0, 0);
979 for (i = 0; i < count; i++)
980 {
981 if (SendMessageW(hwndList, CB_GETITEMDATA, i, 0) == pgContext->nShutdownAction)
982 {
983 SendMessageW(hwndList, CB_SETCURSEL, i, 0);
984 break;
985 }
986 }
987
988 /* Update the choice description based on the current selection */
989 UpdateShutdownDesc(hDlg, pContext);
990}
991
992static VOID
994 IN HWND hDlg,
995 IN PGINA_CONTEXT pgContext)
996{
997 INT idx;
998
1002 0,
1003 0);
1004 if (idx != CB_ERR)
1005 {
1006 pgContext->nShutdownAction =
1010 idx,
1011 0);
1012 }
1013}
1014
1015static INT_PTR
1018 HWND hDlg,
1019 UINT uMsg,
1020 WPARAM wParam,
1021 LPARAM lParam)
1022{
1023 PSHUTDOWN_DLG_CONTEXT pContext;
1024
1026
1027 switch (uMsg)
1028 {
1029 case WM_INITDIALOG:
1030 {
1031 pContext = (PSHUTDOWN_DLG_CONTEXT)lParam;
1032 SetWindowLongPtrW(hDlg, GWLP_USERDATA, (LONG_PTR)pContext);
1033
1034 ShutdownOnInit(hDlg, pContext);
1035 return TRUE;
1036 }
1037
1038 case WM_DESTROY:
1039 if (pContext->bFriendlyUI)
1040 {
1041 EndFriendlyDialog(hDlg, pContext);
1042 }
1043 return TRUE;
1044
1045 case WM_ACTIVATE:
1046 {
1047 /*
1048 * If the user deactivates the shutdown dialog (it loses its focus
1049 * while the dialog is not being closed), then destroy the dialog
1050 * and cancel shutdown.
1051 */
1052 if (LOWORD(wParam) == WA_INACTIVE)
1053 {
1054 if (!pContext->bCloseDlg)
1055 {
1056 pContext->bCloseDlg = TRUE;
1057 EndDialog(hDlg, IDCANCEL);
1058 }
1059 }
1060 return FALSE;
1061 }
1062
1063 case WM_CLOSE:
1064 pContext->bCloseDlg = TRUE;
1065 EndDialog(hDlg, IDCANCEL);
1066 break;
1067
1068 case WM_COMMAND:
1069 switch (LOWORD(wParam))
1070 {
1072 ExitWindowsEx(EWX_SHUTDOWN, SHTDN_REASON_MAJOR_OTHER);
1073 break;
1074
1075 case IDC_BUTTON_REBOOT:
1076 ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_OTHER);
1077 break;
1078
1079 case IDC_BUTTON_SLEEP:
1081 break;
1082
1083 case IDOK:
1084 ShutdownOnOk(hDlg, pContext->pgContext);
1085
1086 /* Fall back */
1087 case IDCANCEL:
1088 case IDHELP:
1089 pContext->bCloseDlg = TRUE;
1090 EndDialog(hDlg, LOWORD(wParam));
1091 break;
1092
1094 UpdateShutdownDesc(hDlg, pContext);
1095 break;
1096 }
1097 break;
1098
1099 case WM_CTLCOLORSTATIC:
1100 {
1101 /* Either make background transparent or fill it with color for required static controls */
1102 HDC hdcStatic = (HDC)wParam;
1104
1105 switch (StaticID)
1106 {
1108 SetTextColor(hdcStatic, DARK_GREY_COLOR);
1109 SetBkMode(hdcStatic, TRANSPARENT);
1111
1114 case IDC_SLEEP_STATIC:
1115 case IDC_RESTART_STATIC:
1116 SetTextColor(hdcStatic, LIGHT_GREY_COLOR);
1117 SetBkMode(hdcStatic, TRANSPARENT);
1118 return (LONG_PTR)pContext->hBrush;
1119 }
1120 return FALSE;
1121 }
1122
1123 case WM_DRAWITEM:
1124 {
1125 /* Draw bitmaps on required buttons */
1127 switch (pdis->CtlID)
1128 {
1130 case IDC_BUTTON_REBOOT:
1131 case IDC_BUTTON_SLEEP:
1133 return DrawIconOnOwnerDrawnButtons(pdis, pContext);
1134 }
1135 break;
1136 }
1137
1138 case WM_TIMER:
1139 OnTimer(hDlg, pContext);
1140 return TRUE;
1141
1142 default:
1143 return FALSE;
1144 }
1145 return TRUE;
1146}
1147
1148INT_PTR
1150 IN HWND hwndDlg,
1151 IN DWORD ShutdownOptions,
1152 IN PGINA_CONTEXT pgContext)
1153{
1154 INT_PTR ret;
1156
1157#if 0
1158 DWORD ShutdownOptions;
1159
1160 // FIXME: User impersonation!!
1161 pgContext->nShutdownAction = LoadShutdownSelState();
1162 ShutdownOptions = GetAllowedShutdownOptions();
1163#endif
1164
1165 Context.pgContext = pgContext;
1166 Context.ShutdownOptions = ShutdownOptions;
1167 Context.ShutdownDialogId = IDD_SHUTDOWN;
1168 Context.bCloseDlg = FALSE;
1169 Context.bReasonUI = GetShutdownReasonUI();
1170 Context.bFriendlyUI = ShellIsFriendlyUIActive();
1171
1172 if (pgContext->hWlx && pgContext->pWlxFuncs && !Context.bFriendlyUI)
1173 {
1174 ret = pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1175 pgContext->hDllInstance,
1177 hwndDlg,
1179 (LPARAM)&Context);
1180 }
1181 else
1182 {
1183 if (Context.bFriendlyUI)
1184 {
1186 {
1187 Context.ShutdownDialogId = IDD_SHUTDOWN_FANCY_LONG;
1188 }
1189 else
1190 {
1191 Context.ShutdownDialogId = IDD_SHUTDOWN_FANCY;
1192 }
1193 }
1194
1195 ret = DialogBoxParamW(pgContext->hDllInstance,
1196 MAKEINTRESOURCEW(Context.bReasonUI ? IDD_SHUTDOWN_REASON : Context.ShutdownDialogId),
1197 hwndDlg,
1199 (LPARAM)&Context);
1200 }
1201
1202#if 0
1203 // FIXME: User impersonation!!
1204 if (ret == IDOK)
1205 SaveShutdownSelState(pgContext->nShutdownAction);
1206#endif
1207
1208 return ret;
1209}
1210
1211
1212/*
1213 * NOTES:
1214 * - Based upon observations on the ShellShutdownDialog() function, the function doesn't actually
1215 * do anything except show a dialog box and returning a value based upon the value chosen. That
1216 * means that any code that calls the function has to execute the chosen action (shut down,
1217 * restart, etc.).
1218 * - When this function is called in Windows XP, it shows the classic dialog box regardless if
1219 * SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType is enabled or not.
1220 * - When the Help button is pushed, it sends the same return value as IDCANCEL (0x00), but
1221 * at the same time, it calls the help file directly from the dialog box.
1222 * - When the dialog is created, it doesn't disable all other input from the other windows.
1223 * This is done elsewhere. When running the function ShellShutdownDialog() from XP/2K3, if the user clicks
1224 * out of the window, it automatically closes itself.
1225 * - The parameter, lpUsername never seems to be used when calling the function from Windows XP. Either
1226 * it was a parameter that was never used in the final version before release, or it has a use that
1227 * is currently not known.
1228 */
1231 HWND hParent,
1232 LPWSTR lpUsername,
1233 BOOL bHideLogoff)
1234{
1235 INT_PTR dlgValue;
1236 DWORD ShutdownOptions;
1237
1238 /*
1239 * As we are called by the shell itself, don't use
1240 * the cached GINA context but use a local copy here.
1241 */
1242 GINA_CONTEXT gContext = { 0 };
1244
1245 UNREFERENCED_PARAMETER(lpUsername);
1246
1247 ShutdownOptions = GetAllowedShutdownOptions();
1248 if (bHideLogoff)
1249 ShutdownOptions &= ~WLX_SHUTDOWN_STATE_LOGOFF;
1250
1251 /* Initialize our local GINA context */
1252 gContext.hDllInstance = hDllInstance;
1253 BufferSize = _countof(gContext.UserName);
1254 // NOTE: Only when this function is called, Win checks inside
1255 // HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
1256 // value "Logon User Name", and determines whether it will display
1257 // the user name.
1258 GetUserNameW(gContext.UserName, &BufferSize);
1260
1261 /* Load the shutdown dialog box */
1262 dlgValue = ShutdownDialog(hParent, ShutdownOptions, &gContext);
1263
1264 /* Determine what to do based on user selection */
1265 if (dlgValue == IDOK)
1266 {
1268
1269 switch (gContext.nShutdownAction)
1270 {
1273
1276
1279
1280 // 0x08
1281
1284
1285 // 0x20
1286
1289
1290 // 0x80
1291 }
1292 }
1293 /* Help file is called directly here */
1294 else if (dlgValue == IDHELP)
1295 {
1296 FIXME("Help is not implemented yet.\n");
1297 MessageBoxW(hParent, L"Help is not implemented yet.", L"Message", MB_OK | MB_ICONEXCLAMATION);
1298 }
1299 else if (dlgValue == -1)
1300 {
1301 ERR("Failed to create dialog\n");
1302 }
1303
1304 return 0;
1305}
1306
1307/*
1308 * NOTES:
1309 * - Undocumented, called from MS shell32.dll to show the turn off dialog.
1310 * - Seems to have the same purpose as ShellShutdownDialog.
1311 */
1314{
1316}
HWND hWnd
Definition: settings.c:17
OSVERSIONINFOW VersionInfo
Definition: wkssvc.c:40
static VOID OnTimer(IN HWND hwndDlg, IN PSYS_SHUTDOWN_PARAMS pShutdownParams)
Definition: shutdown.c:72
static INT_PTR CALLBACK ShutdownDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:171
#define FIXME(fmt,...)
Definition: debug.h:111
#define UNIMPLEMENTED
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:110
#define RegCloseKey(hKey)
Definition: registry.h:49
static HINSTANCE hDllInstance
Definition: clb.c:30
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define BufferSize
Definition: mmc.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
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)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3238
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4911
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4132
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define CALLBACK
Definition: compat.h:35
#define IDC_BUTTON_HIBERNATE
Definition: resource.h:64
#define IDS_SHUTDOWN_LOGOFF_DESC
Definition: resource.h:120
#define IDC_TURN_OFF_STATIC
Definition: resource.h:55
#define IDS_SHUTDOWN_RESTART_DESC
Definition: resource.h:122
#define IDD_SHUTDOWN_FANCY
Definition: resource.h:44
#define IDS_SHUTDOWN_LOGOFF
Definition: resource.h:114
#define IDS_SHUTDOWN_SHUTDOWN_DESC
Definition: resource.h:121
#define IDC_SHUTDOWN_STATIC
Definition: resource.h:58
#define IDS_SHUTDOWN_SLEEP_DESC
Definition: resource.h:123
#define IDS_SHUTDOWN_SHUTDOWN
Definition: resource.h:115
#define IDS_SHUTDOWN_HIBERNATE_DESC
Definition: resource.h:124
#define IDC_REASON_COMMENT
Definition: resource.h:53
#define IDS_SHUTDOWN_SLEEP
Definition: resource.h:117
#define IDS_SHUTDOWN_RESTART
Definition: resource.h:116
#define IDC_BUTTON_REBOOT
Definition: resource.h:62
#define IDB_IMAGE_STRIP
Definition: resource.h:79
#define IDC_REASON_PLANNED
Definition: resource.h:50
#define IDD_SHUTDOWN
Definition: resource.h:43
#define IDC_SLEEP_STATIC
Definition: resource.h:57
#define IDC_HIBERNATE_STATIC
Definition: resource.h:56
#define IDC_SHUTDOWN_ACTION
Definition: resource.h:48
#define IDC_REASON_LIST
Definition: resource.h:51
#define IDC_BUTTON_SLEEP
Definition: resource.h:63
#define IDD_SHUTDOWN_REASON
Definition: resource.h:46
#define IDC_BUTTON_SHUTDOWN
Definition: resource.h:61
#define IDC_RESTART_STATIC
Definition: resource.h:59
#define IDS_SHUTDOWN_HIBERNATE
Definition: resource.h:118
#define IDC_SHUTDOWN_DESCRIPTION
Definition: resource.h:49
#define IDD_SHUTDOWN_FANCY_LONG
Definition: resource.h:45
#define BUTTON_SLEEP_DISABLED
Definition: shutdown.c:49
static VOID ShutdownOnOk(IN HWND hDlg, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:993
DWORD GetAllowedShutdownOptions(VOID)
Definition: shutdown.c:783
#define WLX_SHUTDOWN_STATE_REBOOT
Definition: shutdown.c:20
DWORD WINAPI ShellTurnOffDialog(HWND hWnd)
Definition: shutdown.c:1313
DWORD LoadShutdownSelState(VOID)
Definition: shutdown.c:441
#define DARK_GREY_COLOR
Definition: shutdown.c:30
#define SLEEP_BUTTON_HOT
Definition: shutdown.c:54
static BOOL GetShutdownReasonUI(VOID)
Definition: shutdown.c:78
#define BUTTON_REBOOT_PRESSED
Definition: shutdown.c:44
#define REBOOT_BUTTON_HOT
Definition: shutdown.c:53
static BOOL ForceFriendlyUI(VOID)
Definition: shutdown.c:260
#define BUTTON_SLEEP_FOCUSED
Definition: shutdown.c:48
#define WLX_SHUTDOWN_STATE_LOGOFF
Definition: shutdown.c:18
#define WLX_SHUTDOWN_STATE_SLEEP
Definition: shutdown.c:22
static BOOL IsFriendlyUIActive(VOID)
Definition: shutdown.c:138
VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID, HINSTANCE hInst)
Definition: shutdown.c:592
static BOOL IsShowHibernateButtonActive(VOID)
Definition: shutdown.c:230
static VOID ShutdownOnInit(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:904
#define CX_BITMAP
Definition: shutdown.c:34
static INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shutdown.c:508
struct _SHUTDOWN_DLG_CONTEXT * PSHUTDOWN_DLG_CONTEXT
static BOOL IsDomainMember(VOID)
Definition: shutdown.c:214
static BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT *pdis, PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:314
#define BUTTON_SHUTDOWN_PRESSED
Definition: shutdown.c:41
DWORD WINAPI ShellShutdownDialog(HWND hParent, LPWSTR lpUsername, BOOL bHideLogoff)
Definition: shutdown.c:1230
VOID ChangeRequiredButton(HWND hDlg, PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:651
#define SHUTDOWN_BUTTON_HOT
Definition: shutdown.c:52
BOOL WINAPI ShellIsFriendlyUIActive(VOID)
Definition: shutdown.c:422
DWORD GetDefaultShutdownSelState(VOID)
Definition: shutdown.c:435
#define NUMBER_OF_BUTTONS
Definition: shutdown.c:37
#define FONT_POINT_SIZE
Definition: shutdown.c:28
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:1149
static VOID ShutdownOnFriendlyInit(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:852
#define BUTTON_SHUTDOWN
Definition: shutdown.c:40
static VOID UpdateShutdownDesc(IN HWND hDlg, IN PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:800
#define BUTTON_SLEEP_PRESSED
Definition: shutdown.c:47
#define BUTTON_REBOOT
Definition: shutdown.c:43
#define WLX_SHUTDOWN_STATE_POWER_OFF
Definition: shutdown.c:19
#define CY_BITMAP
Definition: shutdown.c:35
#define BUTTON_REBOOT_FOCUSED
Definition: shutdown.c:45
VOID EndFriendlyDialog(HWND hDlg, PSHUTDOWN_DLG_CONTEXT pContext)
Definition: shutdown.c:627
#define HIBERNATE_BUTTON_HOT
Definition: shutdown.c:55
#define LIGHT_GREY_COLOR
Definition: shutdown.c:31
#define WLX_SHUTDOWN_STATE_HIBERNATE
Definition: shutdown.c:24
DWORD GetDefaultShutdownOptions(VOID)
Definition: shutdown.c:777
#define BUTTON_SLEEP
Definition: shutdown.c:46
#define BUTTON_SHUTDOWN_FOCUSED
Definition: shutdown.c:42
VOID SaveShutdownSelState(IN DWORD ShutdownCode)
Definition: shutdown.c:723
static BOOL IsNetwareActive(VOID)
Definition: shutdown.c:222
struct _SHUTDOWN_DLG_CONTEXT SHUTDOWN_DLG_CONTEXT
#define pt(x, y)
Definition: drawing.c:79
static VOID NTAPI 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)
Definition: common.c:49
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
pKey DeleteObject()
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
Definition: glfuncs.h:248
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
unsigned int UINT
Definition: ndis.h:50
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_POPUP
Definition: pedump.c:616
long LONG
Definition: pedump.c:60
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
Definition: powrprof.c:681
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
Definition: powrprof.c:488
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1707
#define TTI_NONE
Definition: commctrl.h:1779
#define TTM_SETTITLEW
Definition: commctrl.h:1828
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define TTF_SUBCLASS
Definition: commctrl.h:1767
#define TTM_ADDTOOLW
Definition: commctrl.h:1787
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1819
#define TTS_BALLOON
Definition: commctrl.h:1761
#define IDHELP
Definition: resource_2.h:8
#define REG_DWORD
Definition: sdbapi.c:596
#define _countof(array)
Definition: sndvol32.h:68
& rect
Definition: startmenu.cpp:1413
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
WCHAR UserName[256]
Definition: msgina.h:50
ULONG nShutdownAction
Definition: msgina.h:47
HANDLE hDllInstance
Definition: msgina.h:37
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:246
PGINA_CONTEXT pgContext
Definition: shutdown.c:59
BOOL bIsButtonHot[NUMBER_OF_BUTTONS]
Definition: shutdown.c:70
WNDPROC OldButtonProc
Definition: shutdown.c:73
BOOL bIsSleepButtonReplaced
Definition: shutdown.c:67
UINT_PTR uId
Definition: commctrl.h:1743
LPWSTR lpszText
Definition: commctrl.h:1746
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
int ret
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
HDC hdcMem
Definition: welcome.c:104
#define GetVersionEx
Definition: winbase.h:3787
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define TRANSPARENT
Definition: wingdi.h:950
#define HOLLOW_BRUSH
Definition: wingdi.h:899
#define SRCCOPY
Definition: wingdi.h:333
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)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define FW_MEDIUM
Definition: wingdi.h:375
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ODS_DISABLED
Definition: winuser.h:2547
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CB_SETITEMDATA
Definition: winuser.h:1966
#define EWX_SHUTDOWN
Definition: winuser.h:639
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1772
#define ODS_SELECTED
Definition: winuser.h:2545
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define DM_SETDEFID
Definition: winuser.h:2099
#define GetWindowLongPtrW
Definition: winuser.h:4829
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2542
#define IDCANCEL
Definition: winuser.h:831
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define GWL_ID
Definition: winuser.h:859
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)
#define WM_COMMAND
Definition: winuser.h:1740
#define ODA_FOCUS
Definition: winuser.h:2544
#define CB_ERR
Definition: winuser.h:2435
#define CB_SETCURSEL
Definition: winuser.h:1961
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_SETFOCUS
Definition: winuser.h:1613
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_MOUSEMOVE
Definition: winuser.h:1775
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WA_INACTIVE
Definition: winuser.h:2622
#define CB_RESETCONTENT
Definition: winuser.h:1959
#define WM_INITDIALOG
Definition: winuser.h:1739
#define CB_GETCOUNT
Definition: winuser.h:1942
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
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)
#define IDOK
Definition: winuser.h:830
#define WM_DRAWITEM
Definition: winuser.h:1645
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define HWND_DESKTOP
Definition: winuser.h:1209
#define WM_ACTIVATE
Definition: winuser.h:1612
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EWX_REBOOT
Definition: winuser.h:638
#define HWND_TOP
Definition: winuser.h:1207
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_SETFONT
Definition: winuser.h:1650
#define WM_TIMER
Definition: winuser.h:1742
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)
#define CB_ADDSTRING
Definition: winuser.h:1936
#define CB_GETITEMDATA
Definition: winuser.h:1950
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
#define MB_ICONEXCLAMATION
Definition: winuser.h:785
#define MB_OK
Definition: winuser.h:790
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
#define ODA_SELECT
Definition: winuser.h:2543
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
HWND WINAPI WindowFromPoint(_In_ POINT)
int WINAPI GetDlgCtrlID(_In_ HWND)
#define VK_SHIFT
Definition: winuser.h:2202
#define IDC_HAND
Definition: winuser.h:698
#define SW_SHOW
Definition: winuser.h:775
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2163
#define SWP_NOZORDER
Definition: winuser.h:1247
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define CB_GETCURSEL
Definition: winuser.h:1943
#define SetWindowLongPtrW
Definition: winuser.h:5346
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_KILLFOCUS
Definition: winuser.h:1614
#define ODS_FOCUS
Definition: winuser.h:2549
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
Definition: winwlx.h:62
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP
Definition: winwlx.h:64
#define WLX_SAS_ACTION_SHUTDOWN_HIBERNATE
Definition: winwlx.h:66
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184