ReactOS 0.4.16-dev-819-g75c0dc0
dialogs.cpp
Go to the documentation of this file.
1/*
2 * common shell dialogs
3 *
4 * Copyright 2000 Juergen Schmied
5 * Copyright 2018 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 * Copyright 2021 Arnav Bhatt <arnavbhatt288@gmail.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include "precomp.h"
24
25typedef struct
26{
35
36typedef struct
37{
39 BOOL bIsButtonHot[2];
41 HBRUSH hBrush;
45
47
50static void FillList(HWND, LPWSTR, UINT, BOOL);
51
52
53/*************************************************************************
54 * PickIconDlg [SHELL32.62]
55 *
56 */
57
58typedef struct
59{
67
69 LPCWSTR lpszType,
70 LPWSTR lpszName,
72{
74 HWND hDlgCtrl = pIconContext->hDlgCtrl;
75
76 if (IS_INTRESOURCE(lpszName))
77 lParam = LOWORD(lpszName);
78 else
79 lParam = -1;
80
81 SendMessageW(hDlgCtrl, LB_ADDSTRING, 0, lParam);
82
83 return TRUE;
84}
85
86static void
88{
89 int count;
90 int index;
91
92 count = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
93 if (count == LB_ERR)
94 return;
95
96 for(index = 0; index < count; index++)
97 {
98 DestroyIcon(pIconContext->phIcons[index]);
99 pIconContext->phIcons[index] = NULL;
100 }
101}
102
103static BOOL
104DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
105{
106 WCHAR szExpandedPath[MAX_PATH];
107
108 // Destroy previous icons
109 DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
110 SendMessageW(pIconContext->hDlgCtrl, LB_RESETCONTENT, 0, 0);
111 delete[] pIconContext->phIcons;
112
113 // Store the path
114 StringCchCopyW(pIconContext->szPath, _countof(pIconContext->szPath), pszFile);
115 ExpandEnvironmentStringsW(pszFile, szExpandedPath, _countof(szExpandedPath));
116
117 // Load the module if possible
119 if (pIconContext->hLibrary)
120 FreeLibrary(pIconContext->hLibrary);
121 pIconContext->hLibrary = hLibrary;
122
123 if (pIconContext->hLibrary)
124 {
125 // Load the icons from the module
126 pIconContext->nIcons = ExtractIconExW(szExpandedPath, -1, NULL, NULL, 0);
127 pIconContext->phIcons = new HICON[pIconContext->nIcons];
128
129 if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
130 {
132 }
133 else
134 {
135 pIconContext->nIcons = 0;
136 }
137 }
138 else
139 {
140 // .ico file
141 pIconContext->nIcons = 1;
142 pIconContext->phIcons = new HICON[1];
143
144 if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
145 {
146 SendMessageW(pIconContext->hDlgCtrl, LB_ADDSTRING, 0, 0);
147 }
148 else
149 {
150 pIconContext->nIcons = 0;
151 }
152 }
153
154 SetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath);
155 SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
156
157 if (pIconContext->nIcons == 0)
158 {
159 delete[] pIconContext->phIcons;
160 pIconContext->phIcons = NULL;
161 }
162
163 return (pIconContext->nIcons > 0);
164}
165
166static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
167{
168 // Show an error message
169 CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
170 strText.Format(IDS_NO_ICONS, pIconContext->szPath);
171 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING);
172
173 // Load the default icons
174 DoLoadIcons(hwndDlg, pIconContext, g_pszShell32);
175}
176
177// Icon size
178#define CX_ICON GetSystemMetrics(SM_CXICON)
179#define CY_ICON GetSystemMetrics(SM_CYICON)
180
181// Item size
182#define CX_ITEM (CX_ICON + 4)
183#define CY_ITEM (CY_ICON + 12)
184
186 HWND hwndDlg,
187 UINT uMsg,
190{
192 LPDRAWITEMSTRUCT lpdis;
193 HICON hIcon;
194 INT index, count;
195 WCHAR szText[MAX_PATH], szFilter[100];
198
199 switch(uMsg)
200 {
201 case WM_INITDIALOG:
202 {
203 pIconContext = (PPICK_ICON_CONTEXT)lParam;
204 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pIconContext);
205 pIconContext->hDlgCtrl = GetDlgItem(hwndDlg, IDC_PICKICON_LIST);
206
207 SendMessageW(pIconContext->hDlgCtrl, LB_SETCOLUMNWIDTH, CX_ITEM, 0);
208
209 // Load the icons
210 if (!DoLoadIcons(hwndDlg, pIconContext, pIconContext->szPath))
211 NoIconsInFile(hwndDlg, pIconContext);
212
213 // Set the selection
214 count = SendMessageW(pIconContext->hDlgCtrl, LB_GETCOUNT, 0, 0);
215 if (count != LB_ERR)
216 {
217 if (pIconContext->Index < 0)
218 {
219 // A negative value will be interpreted as a negated resource ID.
220 LPARAM lParam = -pIconContext->Index;
221 pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_FINDSTRINGEXACT, -1, lParam);
222 }
223
224 if (pIconContext->Index < 0 || count <= pIconContext->Index)
225 pIconContext->Index = 0;
226
227 SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, pIconContext->Index, 0);
228 SendMessageW(pIconContext->hDlgCtrl, LB_SETTOPINDEX, pIconContext->Index, 0);
229 }
230
232 return TRUE;
233 }
234
235 case WM_DESTROY:
236 {
237 DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
238 delete[] pIconContext->phIcons;
239
240 if (pIconContext->hLibrary)
241 FreeLibrary(pIconContext->hLibrary);
242 break;
243 }
244
245 case WM_COMMAND:
246 switch(LOWORD(wParam))
247 {
248 case IDOK:
249 {
250 /* Check whether the path edit control has been modified; if so load the icons instead of validating */
251 GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, szText, _countof(szText));
252 if (lstrcmpiW(szText, pIconContext->szPath))
253 {
254 if (!DoLoadIcons(hwndDlg, pIconContext, szText))
255 NoIconsInFile(hwndDlg, pIconContext);
256 break;
257 }
258
259 /* The path edit control has not been modified, return the selection */
260 pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
261 GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath, _countof(pIconContext->szPath));
262 EndDialog(hwndDlg, 1);
263 break;
264 }
265
266 case IDCANCEL:
267 EndDialog(hwndDlg, 0);
268 break;
269
271 switch (HIWORD(wParam))
272 {
273 case LBN_SELCHANGE:
275 break;
276
277 case LBN_DBLCLK:
278 SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
279 break;
280 }
281 break;
282
283 case IDC_BUTTON_PATH:
284 {
285 // Choose the module path
286 CStringW strTitle;
287 szText[0] = 0;
288 szFilter[0] = 0;
289 ZeroMemory(&ofn, sizeof(ofn));
290 ofn.lStructSize = sizeof(ofn);
291 ofn.hwndOwner = hwndDlg;
292 ofn.lpstrFile = szText;
293 ofn.nMaxFile = _countof(szText);
294 strTitle.LoadString(IDS_PICK_ICON_TITLE);
295 ofn.lpstrTitle = strTitle;
298 if (!GetOpenFileNameW(&ofn))
299 break;
300
301 // Load the icons
302 if (!DoLoadIcons(hwndDlg, pIconContext, szText))
303 NoIconsInFile(hwndDlg, pIconContext);
304 break;
305 }
306
307 default:
308 break;
309 }
310 break;
311
312 case WM_MEASUREITEM:
314 lpmis->itemHeight = CY_ITEM;
315 return TRUE;
316
317 case WM_DRAWITEM:
318 {
319 lpdis = (LPDRAWITEMSTRUCT)lParam;
320 if (lpdis->itemID == (UINT)-1)
321 break;
322 switch (lpdis->itemAction) // FIXME: MSDN says that more than one of these can be set
323 {
324 // FIXME: ODA_FOCUS
325 case ODA_SELECT:
326 case ODA_DRAWENTIRE:
327 {
328 index = SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
329 hIcon = pIconContext->phIcons[lpdis->itemID];
330
331 if (lpdis->itemID == (UINT)index)
332 FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
333 else
334 FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_WINDOW + 1));
335
336 // Centering
337 INT x = lpdis->rcItem.left + (CX_ITEM - CX_ICON) / 2;
338 INT y = lpdis->rcItem.top + (CY_ITEM - CY_ICON) / 2;
339
340 DrawIconEx(lpdis->hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL);
341 break;
342 }
343 }
344 return TRUE;
345 }
346 }
347
348 return FALSE;
349}
350
352 HWND hWndOwner,
353 LPWSTR lpstrFile,
354 UINT nMaxFile,
355 INT* lpdwIconIndex)
356{
357 int res;
358 WCHAR szExpandedPath[MAX_PATH];
359
360 // Initialize the dialog
361 PICK_ICON_CONTEXT IconContext = { NULL };
362 IconContext.Index = *lpdwIconIndex;
363 StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), lpstrFile);
364 ExpandEnvironmentStringsW(lpstrFile, szExpandedPath, _countof(szExpandedPath));
365
366 if (!szExpandedPath[0] ||
368 {
369 if (szExpandedPath[0])
370 {
371 // No such file
372 CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
373 strText.Format(IDS_FILE_NOT_FOUND, lpstrFile);
374 MessageBoxW(hWndOwner, strText, strTitle, MB_ICONWARNING);
375 }
376
377 // Set the default value
378 StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), g_pszShell32);
379 }
380
381 // Show the dialog
383 if (res)
384 {
385 // Store the selected icon
386 StringCchCopyW(lpstrFile, nMaxFile, IconContext.szPath);
387 *lpdwIconIndex = IconContext.Index;
388 }
389
390 return res;
391}
392
393/*************************************************************************
394 * RunFileDlg [internal]
395 *
396 * The Unicode function that is available as ordinal 61 on Windows NT/2000/XP/...
397 */
399 HWND hWndOwner,
400 HICON hIcon,
401 LPCWSTR lpstrDirectory,
402 LPCWSTR lpstrTitle,
403 LPCWSTR lpstrDescription,
404 UINT uFlags)
405{
406 TRACE("\n");
407
408 RUNFILEDLGPARAMS rfdp;
409 rfdp.hwndOwner = hWndOwner;
410 rfdp.hIcon = hIcon;
411 rfdp.lpstrDirectory = lpstrDirectory;
412 rfdp.lpstrTitle = lpstrTitle;
413 rfdp.lpstrDescription = lpstrDescription;
414 rfdp.uFlags = uFlags;
415
417}
418
419
420/* find the directory that contains the file being run */
422{
423 const WCHAR *src;
424 WCHAR *dest, *result, *result_end=NULL;
425
426 result = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(strlenW(cmdline)+5));
427
428 if (NULL == result)
429 {
430 TRACE("HeapAlloc couldn't allocate %d bytes\n", sizeof(WCHAR)*(strlenW(cmdline)+5));
431 return NULL;
432 }
433
434 src = cmdline;
435 dest = result;
436
437 if (*src == '"')
438 {
439 src++;
440 while (*src && *src != '"')
441 {
442 if (*src == '\\')
443 result_end = dest;
444 *dest++ = *src++;
445 }
446 }
447 else {
448 while (*src)
449 {
450 if (isspaceW(*src))
451 {
452 *dest = 0;
454 break;
455 strcatW(dest, L".exe");
457 break;
458 }
459 else if (*src == '\\')
460 result_end = dest;
461 *dest++ = *src++;
462 }
463 }
464
465 if (result_end)
466 {
467 *result_end = 0;
468 return result;
469 }
470 else
471 {
473 return NULL;
474 }
475}
476
478{
479 BOOL Enable = FALSE;
480 INT Length, n;
483 if (Length > 0)
484 {
485 PWCHAR psz = (PWCHAR)HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
486 if (psz)
487 {
488 GetWindowTextW(Edit, psz, Length + 1);
489 for (n = 0; n < Length && !Enable; ++n)
490 Enable = psz[n] != ' ';
491 HeapFree(GetProcessHeap(), 0, psz);
492 }
493 else
494 Enable = TRUE;
495 }
497}
498
499/* Dialog procedure for RunFileDlg */
501{
503 HWND hwndCombo, hwndEdit;
504 COMBOBOXINFO ComboInfo;
505
506 switch (message)
507 {
508 case WM_INITDIALOG:
509 prfdp = (RUNFILEDLGPARAMS *)lParam;
511
512 if (prfdp->lpstrTitle)
513 SetWindowTextW(hwnd, prfdp->lpstrTitle);
514 if (prfdp->lpstrDescription)
515 SetWindowTextW(GetDlgItem(hwnd, IDC_RUNDLG_DESCRIPTION), prfdp->lpstrDescription);
516 if (prfdp->uFlags & RFF_NOBROWSE)
517 {
519 ShowWindow(browse, SW_HIDE);
520 EnableWindow(browse, FALSE);
521 }
522 if (prfdp->uFlags & RFF_NOLABEL)
524 if (prfdp->uFlags & RFF_NOSEPARATEMEM)
525 {
526 FIXME("RFF_NOSEPARATEMEM not supported\n");
527 }
528
529 /* Use the default Shell Run icon if no one is specified */
530 if (prfdp->hIcon == NULL)
532 /*
533 * NOTE: Starting Windows Vista, the "Run File" dialog gets a
534 * title icon that remains the same as the default one, even if
535 * the user specifies a custom icon.
536 * Since we currently imitate Windows 2003, therefore do not show
537 * any title icon.
538 */
539 // SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)prfdp->hIcon);
540 // SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon);
542
543 hwndCombo = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH);
544 FillList(hwndCombo, NULL, 0, (prfdp->uFlags & RFF_NODEFAULT) == 0);
546
547 ComboInfo.cbSize = sizeof(ComboInfo);
548 GetComboBoxInfo(hwndCombo, &ComboInfo);
549 hwndEdit = ComboInfo.hwndItem;
551
552 // SHAutoComplete needs co init
554
556
557 SetFocus(hwndCombo);
558 return TRUE;
559
560 case WM_DESTROY:
561 if (prfdp->bCoInited)
563 break;
564
565 case WM_COMMAND:
566 switch (LOWORD(wParam))
567 {
568 case IDOK:
569 {
570 LRESULT lRet;
572 INT ic;
573 WCHAR *psz, *pszExpanded, *parent = NULL;
574 DWORD cchExpand;
575 SHELLEXECUTEINFOW sei = { sizeof(sei) };
576 NMRUNFILEDLGW nmrfd;
577
578 ic = GetWindowTextLengthW(htxt);
579 if (ic == 0)
580 {
582 return TRUE;
583 }
584
585 /*
586 * Allocate a new MRU entry, we need to add two characters
587 * for the terminating "\\1" part, then the NULL character.
588 */
589 psz = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (ic + 2 + 1)*sizeof(WCHAR));
590 if (!psz)
591 {
593 return TRUE;
594 }
595
596 GetWindowTextW(htxt, psz, ic + 1);
597 sei.hwnd = hwnd;
598 sei.nShow = SW_SHOWNORMAL;
599 sei.lpFile = psz;
600 StrTrimW(psz, L" \t");
601
602 if (wcschr(psz, L'%') != NULL)
603 {
604 cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
605 pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
606 if (!pszExpanded)
607 {
608 HeapFree(GetProcessHeap(), 0, psz);
610 return TRUE;
611 }
612 ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
613 StrTrimW(pszExpanded, L" \t");
614 }
615 else
616 {
617 pszExpanded = psz;
618 }
619
620 /*
621 * The precedence is the following: first the user-given
622 * current directory is used; if there is none, a current
623 * directory is computed if the RFF_CALCDIRECTORY is set,
624 * otherwise no current directory is defined.
625 */
626 LPCWSTR pszStartDir;
627 if (prfdp->lpstrDirectory)
628 {
629 sei.lpDirectory = prfdp->lpstrDirectory;
630 pszStartDir = prfdp->lpstrDirectory;
631 }
632 else if (prfdp->uFlags & RFF_CALCDIRECTORY)
633 {
635 pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
636 }
637 else
638 {
639 sei.lpDirectory = NULL;
640 pszStartDir = NULL;
641 }
642
643 /* Hide the dialog for now on, we will show it up in case of retry */
645
646 /*
647 * As shown by manual tests on Windows, modifying the contents
648 * of the notification structure will not modify what the
649 * Run-Dialog will use for the nShow parameter. However the
650 * lpFile and lpDirectory pointers are set to the buffers used
651 * by the Run-Dialog, as a consequence they can be modified by
652 * the notification receiver, as long as it respects the lengths
653 * of the buffers (to avoid buffer overflows).
654 */
655 nmrfd.hdr.code = RFN_VALIDATE;
656 nmrfd.hdr.hwndFrom = hwnd;
657 nmrfd.hdr.idFrom = 0;
658 nmrfd.lpFile = pszExpanded;
659 nmrfd.lpDirectory = pszStartDir;
660 nmrfd.nShow = SW_SHOWNORMAL;
661
662 lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
663
664 switch (lRet)
665 {
666 case RF_CANCEL:
668 break;
669
670 case RF_OK:
671 /* We use SECL_NO_UI because we don't want to see
672 * errors here, but we will try again below and
673 * there we will output our errors. */
674 if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
676 {
677 /* Call GetWindowText again in case the contents of the edit box have changed. */
678 GetWindowTextW(htxt, psz, ic + 1);
679 FillList(htxt, psz, ic + 2 + 1, FALSE);
681 break;
682 }
683 else if (ShellExecuteExW(&sei))
684 {
685 /* Call GetWindowText again in case the contents of the edit box have changed. */
686 GetWindowTextW(htxt, psz, ic + 1);
687 FillList(htxt, psz, ic + 2 + 1, FALSE);
689 break;
690 }
691
692 /* Fall-back */
693 case RF_RETRY:
694 default:
695 SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
696 /* Show back the dialog */
698 break;
699 }
700
702 HeapFree(GetProcessHeap(), 0, psz);
703 if (psz != pszExpanded)
704 HeapFree(GetProcessHeap(), 0, pszExpanded);
705 return TRUE;
706 }
707
708 case IDCANCEL:
710 return TRUE;
711
713 {
714 HMODULE hComdlg = NULL;
715 LPFNOFN ofnProc = NULL;
716 WCHAR szFName[1024] = {0};
717 WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
719
722
723 ZeroMemory(&ofn, sizeof(ofn));
724 ofn.lStructSize = sizeof(ofn);
727 ofn.lpstrFile = szFName;
728 ofn.nMaxFile = _countof(szFName) - 1;
729 ofn.lpstrTitle = szCaption;
731 ofn.lpstrInitialDir = prfdp->lpstrDirectory;
732
733 if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)) ||
734 NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
735 {
736 ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
738 return TRUE;
739 }
740
741 if (ofnProc(&ofn))
742 {
748 }
749
750 FreeLibrary(hComdlg);
751
752 return TRUE;
753 }
755 {
757 {
759 }
760 return TRUE;
761 }
762 }
763 return TRUE;
764 }
765 return FALSE;
766}
767
768/*
769 * This function grabs the MRU list from the registry and fills the combo-list
770 * for the "Run" dialog above. fShowDefault is ignored if pszLatest != NULL.
771 */
772// FIXME: Part of this code should be part of some MRUList API,
773// that is scattered amongst shell32, comctl32 (?!) and comdlg32.
774static void FillList(HWND hCb, LPWSTR pszLatest, UINT cchStr, BOOL fShowDefault)
775{
776 HKEY hkey;
777 WCHAR *pszList = NULL, *pszCmd = NULL, *pszTmp = NULL, cMatch = 0, cMax = 0x60;
778 WCHAR szIndex[2] = L"-";
779 UINT cchLatest;
780 DWORD dwType, icList = 0, icCmd = 0;
781 LRESULT lRet;
782 UINT Nix;
783
784 /*
785 * Retrieve the string length of pszLatest and check whether its buffer size
786 * (cchStr in number of characters) is large enough to add the terminating "\\1"
787 * (and the NULL character).
788 */
789 if (pszLatest)
790 {
791 cchLatest = wcslen(pszLatest);
792 if (cchStr < cchLatest + 2 + 1)
793 {
794 TRACE("pszLatest buffer is not large enough (%d) to hold the MRU terminator.\n", cchStr);
795 return;
796 }
797 }
798 else
799 {
800 cchStr = 0;
801 }
802
803 SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
804
806 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
808 if (lRet != ERROR_SUCCESS)
809 {
810 TRACE("Unable to open or create the RunMRU key, error %d\n", GetLastError());
811 return;
812 }
813
814 lRet = RegQueryValueExW(hkey, L"MRUList", NULL, &dwType, NULL, &icList);
815 if (lRet == ERROR_SUCCESS && dwType == REG_SZ && icList > sizeof(WCHAR))
816 {
817 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
818 if (!pszList)
819 {
820 TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
821 goto Continue;
822 }
823 pszList[0] = L'\0';
824
825 lRet = RegQueryValueExW(hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList);
826 if (lRet != ERROR_SUCCESS)
827 {
828 TRACE("Unable to grab MRUList, error %d\n", GetLastError());
829 pszList[0] = L'\0';
830 }
831 }
832 else
833 {
834Continue:
835 icList = sizeof(WCHAR);
836 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
837 if (!pszList)
838 {
839 TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
840 RegCloseKey(hkey);
841 return;
842 }
843 pszList[0] = L'\0';
844 }
845
846 /* Convert the number of bytes from MRUList into number of characters (== number of indices) */
847 icList /= sizeof(WCHAR);
848
849 for (Nix = 0; Nix < icList - 1; Nix++)
850 {
851 if (pszList[Nix] > cMax)
852 cMax = pszList[Nix];
853
854 szIndex[0] = pszList[Nix];
855
856 lRet = RegQueryValueExW(hkey, szIndex, NULL, &dwType, NULL, &icCmd);
857 if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
858 {
859 TRACE("Unable to grab size of index, error %d\n", GetLastError());
860 continue;
861 }
862
863 if (pszCmd)
864 {
865 pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
866 if (!pszTmp)
867 {
868 TRACE("HeapReAlloc failed to reallocate %d bytes\n", icCmd);
869 continue;
870 }
871 pszCmd = pszTmp;
872 }
873 else
874 {
875 pszCmd = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icCmd);
876 if (!pszCmd)
877 {
878 TRACE("HeapAlloc failed to allocate %d bytes\n", icCmd);
879 continue;
880 }
881 }
882
883 lRet = RegQueryValueExW(hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd);
884 if (lRet != ERROR_SUCCESS)
885 {
886 TRACE("Unable to grab index, error %d\n", GetLastError());
887 continue;
888 }
889
890 /*
891 * Generally the command string will end up with "\\1".
892 * Find the last backslash in the string and NULL-terminate.
893 * Windows does not seem to check for what comes next, so that
894 * a command of the form:
895 * c:\\my_dir\\myfile.exe
896 * will be cut just after "my_dir", whereas a command of the form:
897 * c:\\my_dir\\myfile.exe\\1
898 * will be cut just after "myfile.exe".
899 */
900 pszTmp = wcsrchr(pszCmd, L'\\');
901 if (pszTmp)
902 *pszTmp = L'\0';
903
904 /*
905 * In the following we try to add pszLatest to the MRU list.
906 * We suppose that our caller has already correctly allocated
907 * the string with enough space for us to append a "\\1".
908 *
909 * FIXME: TODO! (At the moment we don't append it!)
910 */
911
912 if (pszLatest)
913 {
914 if (_wcsicmp(pszCmd, pszLatest) == 0)
915 {
916 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
917 SetWindowTextW(hCb, pszCmd);
918 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
919
920 cMatch = pszList[Nix];
921 memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
922 pszList[0] = cMatch;
923 continue;
924 }
925 }
926
927 if (icList - 1 != 26 || icList - 2 != Nix || cMatch || pszLatest == NULL)
928 {
929 SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
930 if (!Nix && fShowDefault)
931 {
932 SetWindowTextW(hCb, pszCmd);
933 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
934 }
935 }
936 else
937 {
938 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
939 SetWindowTextW(hCb, pszLatest);
940 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
941
942 cMatch = pszList[Nix];
943 memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
944 pszList[0] = cMatch;
945 szIndex[0] = cMatch;
946
947 wcscpy(&pszLatest[cchLatest], L"\\1");
948 RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
949 pszLatest[cchLatest] = L'\0';
950 }
951 }
952
953 if (!cMatch && pszLatest != NULL)
954 {
955 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
956 SetWindowTextW(hCb, pszLatest);
957 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
958
959 cMatch = ++cMax;
960
961 if (pszList)
962 {
963 pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszList, (++icList) * sizeof(WCHAR));
964 if (!pszTmp)
965 {
966 TRACE("HeapReAlloc failed to reallocate enough bytes\n");
967 goto Cleanup;
968 }
969 pszList = pszTmp;
970 }
971 else
972 {
973 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (++icList) * sizeof(WCHAR));
974 if (!pszList)
975 {
976 TRACE("HeapAlloc failed to allocate enough bytes\n");
977 goto Cleanup;
978 }
979 }
980
981 memmove(&pszList[1], pszList, (icList - 1) * sizeof(WCHAR));
982 pszList[0] = cMatch;
983 szIndex[0] = cMatch;
984
985 wcscpy(&pszLatest[cchLatest], L"\\1");
986 RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
987 pszLatest[cchLatest] = L'\0';
988 }
989
990Cleanup:
991 RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (wcslen(pszList) + 1) * sizeof(WCHAR));
992
993 HeapFree(GetProcessHeap(), 0, pszCmd);
994 HeapFree(GetProcessHeap(), 0, pszList);
995
996 RegCloseKey(hkey);
997}
998
999
1000/*************************************************************************
1001 * ConfirmDialog [internal]
1002 *
1003 * Put up a confirm box, return TRUE if the user confirmed
1004 */
1005static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
1006{
1007 WCHAR Prompt[256];
1008 WCHAR Title[256];
1009
1010 LoadStringW(shell32_hInstance, PromptId, Prompt, _countof(Prompt));
1012 return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO | MB_ICONQUESTION) == IDYES;
1013}
1014
1016
1017BOOL
1019{
1021 static BOOL Initialized = FALSE;
1022 if (!Initialized)
1023 {
1024 HMODULE mod = LoadLibraryW(L"msgina.dll");
1026 Initialized = TRUE;
1027 }
1028
1029 HRESULT hr = E_FAIL;
1030 if (ShellDimScreen)
1031 hr = ShellDimScreen(pUnknown, hWindow);
1032 return SUCCEEDED(hr);
1033}
1034
1035
1036/* Used to get the shutdown privilege */
1037static BOOL
1038EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
1039{
1040 BOOL Success;
1041 HANDLE hToken;
1043
1046 &hToken);
1047 if (!Success) return Success;
1048
1050 lpszPrivilegeName,
1051 &tp.Privileges[0].Luid);
1052 if (!Success) goto Quit;
1053
1054 tp.PrivilegeCount = 1;
1055 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1056
1057 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1058
1059Quit:
1060 CloseHandle(hToken);
1061 return Success;
1062}
1063
1064/*************************************************************************
1065 * RestartDialogEx [SHELL32.730]
1066 */
1067
1068int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
1069{
1070 TRACE("(%p)\n", hWndOwner);
1071
1072 CComPtr<IUnknown> fadeHandler;
1073 HWND parent;
1074
1075 if (!CallShellDimScreen(&fadeHandler, &parent))
1076 parent = hWndOwner;
1077
1078 /* FIXME: use lpwstrReason */
1080 {
1081 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1082 ExitWindowsEx(EWX_REBOOT, uReason);
1083 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1084 }
1085
1086 return 0;
1087}
1088
1089/* Functions and macros used for fancy log off dialog box */
1090#define IS_PRODUCT_VERSION_WORKSTATION 0x300
1091#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED 0x0
1092
1093#define FONT_POINT_SIZE 13
1094
1095#define DARK_GREY_COLOR RGB(244, 244, 244)
1096#define LIGHT_GREY_COLOR RGB(38, 38, 38)
1097
1098/* Bitmap's size for buttons */
1099#define CX_BITMAP 33
1100#define CY_BITMAP 33
1101
1102#define NUMBER_OF_BUTTONS 2
1103
1104/* After determining the button as well as its state paint the image strip bitmap using these predefined positions */
1105#define BUTTON_SWITCH_USER 0
1106#define BUTTON_SWITCH_USER_PRESSED (CY_BITMAP + BUTTON_SWITCH_USER)
1107#define BUTTON_SWITCH_USER_FOCUSED (CY_BITMAP + BUTTON_SWITCH_USER_PRESSED)
1108#define BUTTON_LOG_OFF (CY_BITMAP + BUTTON_SWITCH_USER_FOCUSED)
1109#define BUTTON_LOG_OFF_PRESSED (CY_BITMAP + BUTTON_LOG_OFF)
1110#define BUTTON_LOG_OFF_FOCUSED (CY_BITMAP + BUTTON_LOG_OFF_PRESSED)
1111#define BUTTON_SWITCH_USER_DISABLED (CY_BITMAP + BUTTON_LOG_OFF_FOCUSED) // Temporary
1112
1113/* For bIsButtonHot */
1114#define LOG_OFF_BUTTON_HOT 0
1115#define SWITCH_USER_BUTTON_HOT 1
1116
1118{
1119 BOOL bRet = FALSE;
1120 HDC hdcMem = NULL;
1121 HBITMAP hbmOld = NULL;
1122 int y = 0;
1123 RECT rect;
1124
1125 hdcMem = CreateCompatibleDC(pdis->hDC);
1126 hbmOld = (HBITMAP)SelectObject(hdcMem, pContext->hImageStrip);
1127 rect = pdis->rcItem;
1128
1129 /* Check the button ID for revelant bitmap to be used */
1130 switch (pdis->CtlID)
1131 {
1132 case IDC_LOG_OFF_BUTTON:
1133 {
1134 switch (pdis->itemAction)
1135 {
1136 case ODA_DRAWENTIRE:
1137 case ODA_FOCUS:
1138 case ODA_SELECT:
1139 {
1140 y = BUTTON_LOG_OFF;
1141 if (pdis->itemState & ODS_SELECTED)
1142 {
1144 }
1145 else if (pContext->bIsButtonHot[LOG_OFF_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
1146 {
1148 }
1149 break;
1150 }
1151 }
1152 break;
1153 }
1154
1156 {
1157 switch (pdis->itemAction)
1158 {
1159 case ODA_DRAWENTIRE:
1160 case ODA_FOCUS:
1161 case ODA_SELECT:
1162 {
1164 if (pdis->itemState & ODS_SELECTED)
1165 {
1167 }
1168 else if (pContext->bIsButtonHot[SWITCH_USER_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
1169 {
1171 }
1172
1173 /*
1174 * Since switch user functionality isn't implemented yet therefore the button has been disabled
1175 * temporarily hence show the disabled state
1176 */
1177 else if (pdis->itemState & ODS_DISABLED)
1178 {
1180 }
1181 break;
1182 }
1183 }
1184 break;
1185 }
1186 }
1187
1188 /* Draw it on the required button */
1189 bRet = BitBlt(pdis->hDC,
1190 (rect.right - rect.left - CX_BITMAP) / 2,
1191 (rect.bottom - rect.top - CY_BITMAP) / 2,
1193
1194 SelectObject(hdcMem, hbmOld);
1196
1197 return bRet;
1198}
1199
1201{
1202 PLOGOFF_DLG_CONTEXT pContext;
1204
1205 int buttonID = GetDlgCtrlID(hButton);
1206
1207 switch (uMsg)
1208 {
1209 case WM_MOUSEMOVE:
1210 {
1211 HWND hwndTarget = NULL;
1213
1214 if (GetCapture() != hButton)
1215 {
1216 SetCapture(hButton);
1217
1218 switch (buttonID)
1219 {
1220 case IDC_LOG_OFF_BUTTON:
1221 {
1223 break;
1224 }
1226 {
1228 break;
1229 }
1230 }
1232 }
1233
1234 ClientToScreen(hButton, &pt);
1235 hwndTarget = WindowFromPoint(pt);
1236
1237 if (hwndTarget != hButton)
1238 {
1240
1241 switch (buttonID)
1242 {
1243 case IDC_LOG_OFF_BUTTON:
1244 {
1246 break;
1247 }
1249 {
1251 break;
1252 }
1253 }
1254 }
1255 InvalidateRect(hButton, NULL, FALSE);
1256 break;
1257 }
1258
1259 /* Whenever one of the buttons gets the keyboard focus, set it as default button */
1260 case WM_SETFOCUS:
1261 {
1262 SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
1263 break;
1264 }
1265
1266 /* Otherwise, set IDCANCEL as default button */
1267 case WM_KILLFOCUS:
1268 {
1270 break;
1271 }
1272 }
1273 return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
1274}
1275
1276VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID)
1277{
1278 HWND hwndTool = NULL, hwndTip = NULL;
1279 WCHAR szBuffer[256];
1280 TTTOOLINFOW tool;
1281
1282 hwndTool = GetDlgItem(hDlg, controlID);
1283
1284 tool.cbSize = sizeof(tool);
1285 tool.hwnd = hDlg;
1287 tool.uId = (UINT_PTR)hwndTool;
1288
1289 /* Create the tooltip */
1290 hwndTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL,
1294 hDlg, NULL, shell32_hInstance, NULL);
1295
1296 /* Associate the tooltip with the tool. */
1297 LoadStringW(shell32_hInstance, detailID, szBuffer, _countof(szBuffer));
1298 tool.lpszText = szBuffer;
1299 SendMessageW(hwndTip, TTM_ADDTOOLW, 0, (LPARAM)&tool);
1300 LoadStringW(shell32_hInstance, titleID, szBuffer, _countof(szBuffer));
1301 SendMessageW(hwndTip, TTM_SETTITLEW, TTI_NONE, (LPARAM)szBuffer);
1302 SendMessageW(hwndTip, TTM_SETMAXTIPWIDTH, 0, 250);
1303}
1304
1306{
1307 DeleteObject(pContext->hBrush);
1308 DeleteObject(pContext->hImageStrip);
1309 DeleteObject(pContext->hfFont);
1310
1311 /* Remove the subclass from the buttons */
1312 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1313 {
1316 (LONG_PTR)pContext->OldButtonProc);
1317 }
1318}
1319
1321{
1322 DWORD dwType = 0, dwValue = 0, dwSize = 0;
1323 HKEY hKey = NULL;
1324 LONG lRet = 0;
1325
1327 L"SYSTEM\\CurrentControlSet\\Control\\Windows",
1328 0,
1330 &hKey);
1331 if (lRet != ERROR_SUCCESS)
1332 return FALSE;
1333
1334 /* First check an optional ReactOS specific override, that Windows does not check.
1335 We use this to allow users pairing 'Server'-configuration with FriendlyLogoff.
1336 Otherwise users would have to change CSDVersion or LogonType (side-effects AppCompat) */
1337 dwValue = 0;
1338 dwSize = sizeof(dwValue);
1339 lRet = RegQueryValueExW(hKey,
1340 L"EnforceFriendlyLogoff",
1341 NULL,
1342 &dwType,
1343 (LPBYTE)&dwValue,
1344 &dwSize);
1345
1346 if (lRet == ERROR_SUCCESS && dwType == REG_DWORD && dwValue != FRIENDLY_LOGOFF_IS_NOT_ENFORCED)
1347 {
1349 return TRUE;
1350 }
1351
1352 /* Check product version number */
1353 dwValue = 0;
1354 dwSize = sizeof(dwValue);
1355 lRet = RegQueryValueExW(hKey,
1356 L"CSDVersion",
1357 NULL,
1358 &dwType,
1359 (LPBYTE)&dwValue,
1360 &dwSize);
1362
1363 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD || dwValue != IS_PRODUCT_VERSION_WORKSTATION)
1364 {
1365 /* Allow Friendly UI only on Workstation */
1366 return FALSE;
1367 }
1368
1369 /* Check LogonType value */
1371 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1372 0,
1374 &hKey);
1375 if (lRet != ERROR_SUCCESS)
1376 return FALSE;
1377
1378 dwValue = 0;
1379 dwSize = sizeof(dwValue);
1380 lRet = RegQueryValueExW(hKey,
1381 L"LogonType",
1382 NULL,
1383 &dwType,
1384 (LPBYTE)&dwValue,
1385 &dwSize);
1387
1388 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
1389 return FALSE;
1390
1391 return (dwValue != 0);
1392}
1393
1395{
1396 HDC hdc = NULL;
1397 LONG lfHeight = NULL;
1398
1399 hdc = GetDC(NULL);
1401 ReleaseDC(NULL, hdc);
1402 pContext->hfFont = CreateFontW(lfHeight, 0, 0, 0, FW_MEDIUM, FALSE, 0, 0, 0, 0, 0, 0, 0, L"MS Shell Dlg");
1404
1406
1408
1409 /* Gather old button func */
1411
1412 /* Set bIsButtonHot to false, create tooltips for each buttons and subclass the buttons */
1413 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1414 {
1415 pContext->bIsButtonHot[i] = FALSE;
1421 hwnd,
1423 }
1424}
1425
1426/*************************************************************************
1427 * LogOffDialogProc
1428 *
1429 * NOTES: Used to make the Log Off dialog work
1430 */
1432{
1434 PLOGOFF_DLG_CONTEXT pContext;
1436
1437 switch (uMsg)
1438 {
1439 case WM_INITDIALOG:
1440 {
1441 pContext = (PLOGOFF_DLG_CONTEXT)lParam;
1443
1444 if (pContext->bFriendlyUI)
1445 FancyLogoffOnInit(hwnd, pContext);
1446 return TRUE;
1447 }
1448
1449 case WM_CLOSE:
1451 break;
1452
1453 /*
1454 * If the user deactivates the log off dialog (it loses its focus
1455 * while the dialog is not being closed), then destroy the dialog
1456 * box.
1457 */
1458 case WM_ACTIVATE:
1459 {
1460 if (LOWORD(wParam) == WA_INACTIVE)
1461 {
1463 }
1464 return FALSE;
1465 }
1466
1467 case WM_COMMAND:
1468 switch (LOWORD(wParam))
1469 {
1470 case IDC_LOG_OFF_BUTTON:
1471 case IDOK:
1473 break;
1474
1475 case IDCANCEL:
1477 break;
1478 }
1479 break;
1480
1481 case WM_DESTROY:
1482 if (pContext->bFriendlyUI)
1483 EndFriendlyDialog(hwnd, pContext);
1484 return TRUE;
1485
1486 case WM_CTLCOLORSTATIC:
1487 {
1488 /* Either make background transparent or fill it with color for required static controls */
1489 HDC hdcStatic = (HDC)wParam;
1491
1492 switch (StaticID)
1493 {
1495 SetTextColor(hdcStatic, DARK_GREY_COLOR);
1496 SetBkMode(hdcStatic, TRANSPARENT);
1498
1499 case IDC_LOG_OFF_STATIC:
1501 SetTextColor(hdcStatic, LIGHT_GREY_COLOR);
1502 SetBkMode(hdcStatic, TRANSPARENT);
1503 return (LONG_PTR)pContext->hBrush;
1504 }
1505 return FALSE;
1506 }
1507 break;
1508
1509 case WM_DRAWITEM:
1510 {
1511 /* Draw bitmaps on required buttons */
1512 switch (pdis->CtlID)
1513 {
1514 case IDC_LOG_OFF_BUTTON:
1516 return DrawIconOnOwnerDrawnButtons(pdis, pContext);
1517 }
1518 }
1519 break;
1520
1521 default:
1522 break;
1523 }
1524 return FALSE;
1525}
1526
1527/*************************************************************************
1528 * LogoffWindowsDialog [SHELL32.54]
1529 */
1530
1532{
1533 CComPtr<IUnknown> fadeHandler;
1534 HWND parent = NULL;
1535 DWORD LogoffDialogID = IDD_LOG_OFF;
1537
1538 if (!CallShellDimScreen(&fadeHandler, &parent))
1539 parent = hWndOwner;
1540
1541 Context.bFriendlyUI = IsFriendlyUIActive();
1542 if (Context.bFriendlyUI)
1543 {
1544 LogoffDialogID = IDD_LOG_OFF_FANCY;
1545 }
1546
1548 MAKEINTRESOURCEW(LogoffDialogID),
1549 parent,
1551 (LPARAM)&Context);
1552 return 0;
1553}
1554
1555/*************************************************************************
1556 * RestartDialog [SHELL32.59]
1557 */
1558
1559int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
1560{
1561 return RestartDialogEx(hWndOwner, lpstrReason, uFlags, 0);
1562}
1563
1564/*************************************************************************
1565 * ExitWindowsDialog_backup
1566 *
1567 * NOTES
1568 * Used as a backup solution to shutdown the OS in case msgina.dll
1569 * somehow cannot be found.
1570 */
1572{
1573 TRACE("(%p)\n", hWndOwner);
1574
1576 {
1577 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1579 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1580 }
1581}
1582
1583/*************************************************************************
1584 * ExitWindowsDialog [SHELL32.60]
1585 *
1586 * NOTES
1587 * exported by ordinal
1588 */
1589/*
1590 * TODO:
1591 * - Implement the ability to show either the Welcome Screen or the classic dialog boxes based upon the
1592 * registry value: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType.
1593 */
1595{
1596 typedef DWORD (WINAPI *ShellShFunc)(HWND hParent, WCHAR *Username, BOOL bHideLogoff);
1597 HINSTANCE msginaDll = LoadLibraryW(L"msgina.dll");
1598
1599 TRACE("(%p)\n", hWndOwner);
1600
1601 CComPtr<IUnknown> fadeHandler;
1602 HWND parent;
1603 if (!CallShellDimScreen(&fadeHandler, &parent))
1604 parent = hWndOwner;
1605
1606 /* If the DLL cannot be found for any reason, then it simply uses a
1607 dialog box to ask if the user wants to shut down the computer. */
1608 if (!msginaDll)
1609 {
1610 TRACE("Unable to load msgina.dll.\n");
1612 return;
1613 }
1614
1615 ShellShFunc pShellShutdownDialog = (ShellShFunc)GetProcAddress(msginaDll, "ShellShutdownDialog");
1616
1617 if (pShellShutdownDialog)
1618 {
1619 /* Actually call the function */
1620 DWORD returnValue = pShellShutdownDialog(parent, NULL, FALSE);
1621
1622 switch (returnValue)
1623 {
1624 case 0x01: /* Log off user */
1625 {
1627 break;
1628 }
1629 case 0x02: /* Shut down */
1630 {
1631 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1633 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1634 break;
1635 }
1636 case 0x03: /* Install Updates/Shutdown (?) */
1637 {
1638 break;
1639 }
1640 case 0x04: /* Reboot */
1641 {
1642 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1644 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1645 break;
1646 }
1647 case 0x10: /* Sleep */
1648 {
1649 if (IsPwrSuspendAllowed())
1650 {
1651 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1653 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1654 }
1655 break;
1656 }
1657 case 0x40: /* Hibernate */
1658 {
1660 {
1661 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1663 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1664 }
1665 break;
1666 }
1667 /* If the option is any other value */
1668 default:
1669 break;
1670 }
1671 }
1672 else
1673 {
1674 /* If the function cannot be found, then revert to using the backup solution */
1675 TRACE("Unable to find the 'ShellShutdownDialog' function");
1677 }
1678
1679 FreeLibrary(msginaDll);
1680}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
tShellDimScreen ShellDimScreen
#define shell32_hInstance
#define SECL_ALLOW_NONEXE
#define ShellExecCmdLine
#define SECL_NO_UI
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
#define EXTERN_C
Definition: basetyps.h:12
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
HWND hwndEdit
Definition: combotst.c:65
LPARAM lParam
Definition: combotst.c:139
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
wcscpy
HMODULE hLibrary
Definition: odbccp32.c:12
#define E_FAIL
Definition: ddrawi.h:102
#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
UINT TitleId
Definition: desktop.c:52
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:3333
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
UINT uFlags
Definition: api.c:59
HMODULE hModule
Definition: animate.c:44
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
static const WCHAR Title[]
Definition: oid.c:1259
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define wcsrchr
Definition: compat.h:16
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define FreeLibrary(x)
Definition: compat.h:748
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
#define IDB_IMAGE_STRIP
Definition: resource.h:79
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define IDC_RUNDLG_BROWSE
Definition: resource.h:7
EXTERN_C int WINAPI LogoffWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1531
#define BUTTON_SWITCH_USER_DISABLED
Definition: dialogs.cpp:1111
VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID)
Definition: dialogs.cpp:1276
#define DARK_GREY_COLOR
Definition: dialogs.cpp:1095
BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
Definition: dialogs.cpp:68
static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
Definition: dialogs.cpp:421
BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT *pdis, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1117
static void FillList(HWND, LPWSTR, UINT, BOOL)
Definition: dialogs.cpp:774
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
Definition: dialogs.cpp:1068
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:87
INT_PTR CALLBACK PickIconProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:185
static BOOL IsFriendlyUIActive(VOID)
Definition: dialogs.cpp:1320
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1038
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
#define CX_BITMAP
Definition: dialogs.cpp:1099
void WINAPI ExitWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1594
#define LOG_OFF_BUTTON_HOT
Definition: dialogs.cpp:1114
#define CX_ITEM
Definition: dialogs.cpp:182
VOID ExitWindowsDialog_backup(HWND hWndOwner)
Definition: dialogs.cpp:1571
#define BUTTON_SWITCH_USER
Definition: dialogs.cpp:1105
#define BUTTON_LOG_OFF_FOCUSED
Definition: dialogs.cpp:1110
static BOOL DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
Definition: dialogs.cpp:104
BOOL(WINAPI * LPFNOFN)(OPENFILENAMEW *)
Definition: dialogs.cpp:46
struct LOGOFF_DLG_CONTEXT * PLOGOFF_DLG_CONTEXT
VOID EndFriendlyDialog(HWND hwnd, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1305
#define BUTTON_LOG_OFF
Definition: dialogs.cpp:1108
INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1200
#define IS_PRODUCT_VERSION_WORKSTATION
Definition: dialogs.cpp:1090
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:1018
#define NUMBER_OF_BUTTONS
Definition: dialogs.cpp:1102
static void EnableOkButtonFromEditContents(HWND hwnd)
Definition: dialogs.cpp:477
#define FONT_POINT_SIZE
Definition: dialogs.cpp:1093
static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:166
#define CY_BITMAP
Definition: dialogs.cpp:1100
INT_PTR CALLBACK LogOffDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1431
struct PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
#define CY_ITEM
Definition: dialogs.cpp:183
static VOID FancyLogoffOnInit(HWND hwnd, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1394
#define CX_ICON
Definition: dialogs.cpp:178
#define SWITCH_USER_BUTTON_HOT
Definition: dialogs.cpp:1115
static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
Definition: dialogs.cpp:1005
#define LIGHT_GREY_COLOR
Definition: dialogs.cpp:1096
#define BUTTON_SWITCH_USER_PRESSED
Definition: dialogs.cpp:1106
#define BUTTON_LOG_OFF_PRESSED
Definition: dialogs.cpp:1109
#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED
Definition: dialogs.cpp:1091
HRESULT(WINAPI * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
Definition: dialogs.cpp:1015
#define BUTTON_SWITCH_USER_FOCUSED
Definition: dialogs.cpp:1107
static INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM)
Definition: dialogs.cpp:500
#define CY_ICON
Definition: dialogs.cpp:179
void WINAPI RunFileDlg(HWND hWndOwner, HICON hIcon, LPCWSTR lpstrDirectory, LPCWSTR lpstrTitle, LPCWSTR lpstrDescription, UINT uFlags)
Definition: dialogs.cpp:398
int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
Definition: dialogs.cpp:1559
#define ShellMessageBoxW
Definition: precomp.h:62
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1883
static const WCHAR Cleanup[]
Definition: register.c:80
#define pt(x, y)
Definition: drawing.c:79
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)
Definition: common.c:57
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
r parent
Definition: btrfs.c:3010
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
LPCWSTR g_pszShell32
FxAutoRegKey hKey
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLuint index
Definition: glext.h:6031
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLuint64EXT * result
Definition: glext.h:11304
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
@ Unknown
Definition: i8042prt.h:114
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define REG_SZ
Definition: layer.c:22
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ASSERT(a)
Definition: mode.c:44
LPCWSTR szPath
Definition: env.c:37
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:88
static HICON
Definition: imagelist.c:80
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static char * dest
Definition: rtl.c:135
LPTSTR szFilter
Definition: mplay32.c:30
HICON hIcon
Definition: msconfig.c:44
__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
@ Initialized
Definition: ketypes.h:388
#define BOOL
Definition: nt_native.h:43
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DWORD
Definition: nt_native.h:44
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define L(x)
Definition: ntvdm.h:50
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define LOWORD(l)
Definition: pedump.c:82
#define WS_POPUP
Definition: pedump.c:616
long LONG
Definition: pedump.c:60
#define RT_GROUP_ICON
Definition: pedump.c:375
#define INT
Definition: polytest.cpp:20
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
Definition: powrprof.c:792
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:1833
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define TTF_SUBCLASS
Definition: commctrl.h:1767
#define TTM_ADDTOOLW
Definition: commctrl.h:1792
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1824
#define TTS_BALLOON
Definition: commctrl.h:1761
#define strlenW(s)
Definition: unicode.h:34
#define strcatW(d, s)
Definition: unicode.h:36
#define isspaceW(n)
Definition: unicode.h:58
#define WM_NOTIFY
Definition: richedit.h:61
#define RFF_NOBROWSE
Definition: run.h:33
#define RFF_NODEFAULT
Definition: run.h:34
#define RFF_CALCDIRECTORY
Definition: run.h:35
#define RFF_NOSEPARATEMEM
Definition: run.h:37
#define RFF_NOLABEL
Definition: run.h:36
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2452
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1940
#define SHACF_DEFAULT
Definition: shlwapi.h:1939
#define SHACF_FILESYS_ONLY
Definition: shlwapi.h:1945
#define SHACF_URLALL
Definition: shlwapi.h:1943
#define IDS_SHUTDOWN_TITLE
Definition: shresdef.h:82
#define IDI_SHELL_RUN
Definition: shresdef.h:581
#define IDS_LOG_OFF_TITLE
Definition: shresdef.h:360
#define IDS_NO_ICONS
Definition: shresdef.h:344
#define IDS_RESTART_TITLE
Definition: shresdef.h:80
#define IDD_PICK_ICON
Definition: shresdef.h:391
#define IDC_RUNDLG_LABEL
Definition: shresdef.h:371
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:514
#define IDS_SHUTDOWN_PROMPT
Definition: shresdef.h:83
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:345
#define IDS_RUNDLG_BROWSE_FILTER
Definition: shresdef.h:198
#define IDC_LOG_OFF_TEXT_STATIC
Definition: shresdef.h:518
#define IDD_RUN
Definition: shresdef.h:366
#define IDC_EDIT_PATH
Definition: shresdef.h:394
#define IDC_LOG_OFF_STATIC
Definition: shresdef.h:516
#define IDC_PICKICON_LIST
Definition: shresdef.h:392
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:370
#define IDC_RUNDLG_ICON
Definition: shresdef.h:369
#define IDS_RUNDLG_BROWSE_CAPTION
Definition: shresdef.h:197
#define IDD_LOG_OFF
Definition: shresdef.h:548
#define IDS_LOG_OFF_DESC
Definition: shresdef.h:358
#define IDC_BUTTON_PATH
Definition: shresdef.h:393
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:395
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:515
#define IDS_RUNDLG_BROWSE_ERROR
Definition: shresdef.h:196
#define IDC_RUNDLG_DESCRIPTION
Definition: shresdef.h:367
#define IDS_PICK_ICON_FILTER
Definition: shresdef.h:396
#define IDC_SWITCH_USER_STATIC
Definition: shresdef.h:517
#define IDD_LOG_OFF_FANCY
Definition: shresdef.h:554
#define IDS_RESTART_PROMPT
Definition: shresdef.h:81
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
TCHAR * cmdline
Definition: stretchblt.cpp:32
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
WNDPROC OldButtonProc
Definition: dialogs.cpp:43
BOOL bIsButtonHot[2]
Definition: dialogs.cpp:39
HBITMAP hImageStrip
Definition: dialogs.cpp:40
HMODULE hLibrary
Definition: dialogs.cpp:60
WCHAR szPath[MAX_PATH]
Definition: dialogs.cpp:62
HICON * phIcons
Definition: dialogs.cpp:65
LPCWSTR lpstrDirectory
Definition: dialogs.cpp:29
LPCWSTR lpstrTitle
Definition: dialogs.cpp:30
LPCWSTR lpstrDescription
Definition: dialogs.cpp:31
LPCWSTR lpFile
Definition: undocshell.h:170
LPCWSTR lpDirectory
Definition: undocshell.h:171
HMODULE hLibrary
Definition: dialog.c:549
LPCWSTR lpDirectory
Definition: shellapi.h:335
Definition: tftpd.h:60
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
UINT_PTR uId
Definition: commctrl.h:1743
LPWSTR lpszText
Definition: commctrl.h:1746
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#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
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
#define RF_OK
Definition: undocshell.h:180
#define RFN_VALIDATE
Definition: undocshell.h:157
#define RF_RETRY
Definition: undocshell.h:182
#define RF_CANCEL
Definition: undocshell.h:181
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_In_ WDFCOLLECTION _In_ ULONG Index
HDC hdcMem
Definition: welcome.c:104
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1394
#define ZeroMemory
Definition: winbase.h:1737
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:368
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define HRESULT
Definition: msvc.h:7
#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:1546
#define DI_NORMAL
Definition: wingdi.h:72
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 FillRect(HDC, LPCRECT, HBRUSH)
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 HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define ODS_DISABLED
Definition: winuser.h:2550
#define LB_ERR
Definition: winuser.h:2435
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define EWX_SHUTDOWN
Definition: winuser.h:639
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
#define LB_GETCOUNT
Definition: winuser.h:2041
#define ODS_SELECTED
Definition: winuser.h:2548
#define SW_HIDE
Definition: winuser.h:771
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2038
#define WM_CLOSE
Definition: winuser.h:1624
#define DM_SETDEFID
Definition: winuser.h:2102
#define DWLP_USER
Definition: winuser.h:875
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
#define STM_SETICON
Definition: winuser.h:2095
#define IDCANCEL
Definition: winuser.h:834
#define LB_SETTOPINDEX
Definition: winuser.h:2073
#define LBN_DBLCLK
Definition: winuser.h:2074
#define GWL_ID
Definition: winuser.h:862
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
#define WM_COMMAND
Definition: winuser.h:1743
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define ODA_FOCUS
Definition: winuser.h:2547
#define EWX_LOGOFF
Definition: winuser.h:636
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_SETFOCUS
Definition: winuser.h:1616
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1778
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WA_INACTIVE
Definition: winuser.h:2625
#define CB_RESETCONTENT
Definition: winuser.h:1962
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
#define LB_ADDSTRING
Definition: winuser.h:2034
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2191
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2064
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:833
#define WM_DRAWITEM
Definition: winuser.h:1648
#define WM_ACTIVATE
Definition: winuser.h:1615
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:790
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define EWX_REBOOT
Definition: winuser.h:638
#define LB_RESETCONTENT
Definition: winuser.h:2058
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
#define WM_SETFONT
Definition: winuser.h:1653
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 DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2114
#define CB_ADDSTRING
Definition: winuser.h:1939
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define MB_OK
Definition: winuser.h:793
#define WM_MEASUREITEM
Definition: winuser.h:1649
#define CB_SETEDITSEL
Definition: winuser.h:1966
#define MB_ICONWARNING
Definition: winuser.h:789
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
#define LBN_SELCHANGE
Definition: winuser.h:2078
#define ODA_SELECT
Definition: winuser.h:2546
#define MB_ICONQUESTION
Definition: winuser.h:792
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
HWND WINAPI WindowFromPoint(_In_ POINT)
int WINAPI GetDlgCtrlID(_In_ HWND)
#define IDC_HAND
Definition: winuser.h:698
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define LB_SETCURSEL
Definition: winuser.h:2066
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1960
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2249
#define IDYES
Definition: winuser.h:838
#define LB_GETCURSEL
Definition: winuser.h:2042
#define SetWindowLongPtrW
Definition: winuser.h:5358
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define ODS_FOCUS
Definition: winuser.h:2552
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2161
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_EDITCHANGE
Definition: winuser.h:1978
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)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2139
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:930
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185