ReactOS 0.4.16-dev-981-g80eb313
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 CCoInit ComInit; // For SHAutoComplete (CORE-20030)
358 int res;
359 WCHAR szExpandedPath[MAX_PATH];
360
361 // Initialize the dialog
362 PICK_ICON_CONTEXT IconContext = { NULL };
363 IconContext.Index = *lpdwIconIndex;
364 StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), lpstrFile);
365 ExpandEnvironmentStringsW(lpstrFile, szExpandedPath, _countof(szExpandedPath));
366
367 if (!szExpandedPath[0] ||
369 {
370 if (szExpandedPath[0])
371 {
372 // No such file
373 CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
374 strText.Format(IDS_FILE_NOT_FOUND, lpstrFile);
375 MessageBoxW(hWndOwner, strText, strTitle, MB_ICONWARNING);
376 }
377
378 // Set the default value
379 StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), g_pszShell32);
380 }
381
382 // Show the dialog
384 if (res)
385 {
386 // Store the selected icon
387 StringCchCopyW(lpstrFile, nMaxFile, IconContext.szPath);
388 *lpdwIconIndex = IconContext.Index;
389 }
390
391 return res;
392}
393
394/*************************************************************************
395 * RunFileDlg [internal]
396 *
397 * The Unicode function that is available as ordinal 61 on Windows NT/2000/XP/...
398 */
400 HWND hWndOwner,
401 HICON hIcon,
402 LPCWSTR lpstrDirectory,
403 LPCWSTR lpstrTitle,
404 LPCWSTR lpstrDescription,
405 UINT uFlags)
406{
407 TRACE("\n");
408
409 RUNFILEDLGPARAMS rfdp;
410 rfdp.hwndOwner = hWndOwner;
411 rfdp.hIcon = hIcon;
412 rfdp.lpstrDirectory = lpstrDirectory;
413 rfdp.lpstrTitle = lpstrTitle;
414 rfdp.lpstrDescription = lpstrDescription;
415 rfdp.uFlags = uFlags;
416
418}
419
420
421/* find the directory that contains the file being run */
423{
424 const WCHAR *src;
425 WCHAR *dest, *result, *result_end=NULL;
426
427 result = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(strlenW(cmdline)+5));
428
429 if (NULL == result)
430 {
431 TRACE("HeapAlloc couldn't allocate %d bytes\n", sizeof(WCHAR)*(strlenW(cmdline)+5));
432 return NULL;
433 }
434
435 src = cmdline;
436 dest = result;
437
438 if (*src == '"')
439 {
440 src++;
441 while (*src && *src != '"')
442 {
443 if (*src == '\\')
444 result_end = dest;
445 *dest++ = *src++;
446 }
447 }
448 else {
449 while (*src)
450 {
451 if (isspaceW(*src))
452 {
453 *dest = 0;
455 break;
456 strcatW(dest, L".exe");
458 break;
459 }
460 else if (*src == '\\')
461 result_end = dest;
462 *dest++ = *src++;
463 }
464 }
465
466 if (result_end)
467 {
468 *result_end = 0;
469 return result;
470 }
471 else
472 {
474 return NULL;
475 }
476}
477
479{
480 BOOL Enable = FALSE;
481 INT Length, n;
484 if (Length > 0)
485 {
486 PWCHAR psz = (PWCHAR)HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
487 if (psz)
488 {
489 GetWindowTextW(Edit, psz, Length + 1);
490 for (n = 0; n < Length && !Enable; ++n)
491 Enable = psz[n] != ' ';
492 HeapFree(GetProcessHeap(), 0, psz);
493 }
494 else
495 Enable = TRUE;
496 }
498}
499
500/* Dialog procedure for RunFileDlg */
502{
504 HWND hwndCombo, hwndEdit;
505 COMBOBOXINFO ComboInfo;
506
507 switch (message)
508 {
509 case WM_INITDIALOG:
510 prfdp = (RUNFILEDLGPARAMS *)lParam;
512
513 if (prfdp->lpstrTitle)
514 SetWindowTextW(hwnd, prfdp->lpstrTitle);
515 if (prfdp->lpstrDescription)
516 SetWindowTextW(GetDlgItem(hwnd, IDC_RUNDLG_DESCRIPTION), prfdp->lpstrDescription);
517 if (prfdp->uFlags & RFF_NOBROWSE)
518 {
520 ShowWindow(browse, SW_HIDE);
521 EnableWindow(browse, FALSE);
522 }
523 if (prfdp->uFlags & RFF_NOLABEL)
525 if (prfdp->uFlags & RFF_NOSEPARATEMEM)
526 {
527 FIXME("RFF_NOSEPARATEMEM not supported\n");
528 }
529
530 /* Use the default Shell Run icon if no one is specified */
531 if (prfdp->hIcon == NULL)
533 /*
534 * NOTE: Starting Windows Vista, the "Run File" dialog gets a
535 * title icon that remains the same as the default one, even if
536 * the user specifies a custom icon.
537 * Since we currently imitate Windows 2003, therefore do not show
538 * any title icon.
539 */
540 // SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)prfdp->hIcon);
541 // SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon);
543
544 hwndCombo = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH);
545 FillList(hwndCombo, NULL, 0, (prfdp->uFlags & RFF_NODEFAULT) == 0);
547
548 ComboInfo.cbSize = sizeof(ComboInfo);
549 GetComboBoxInfo(hwndCombo, &ComboInfo);
550 hwndEdit = ComboInfo.hwndItem;
552
553 // SHAutoComplete needs co init
555
557
558 SetFocus(hwndCombo);
559 return TRUE;
560
561 case WM_DESTROY:
562 if (prfdp->bCoInited)
564 break;
565
566 case WM_COMMAND:
567 switch (LOWORD(wParam))
568 {
569 case IDOK:
570 {
571 LRESULT lRet;
573 INT ic;
574 WCHAR *psz, *pszExpanded, *parent = NULL;
575 DWORD cchExpand;
576 SHELLEXECUTEINFOW sei = { sizeof(sei) };
577 NMRUNFILEDLGW nmrfd;
578
579 ic = GetWindowTextLengthW(htxt);
580 if (ic == 0)
581 {
583 return TRUE;
584 }
585
586 /*
587 * Allocate a new MRU entry, we need to add two characters
588 * for the terminating "\\1" part, then the NULL character.
589 */
590 psz = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (ic + 2 + 1)*sizeof(WCHAR));
591 if (!psz)
592 {
594 return TRUE;
595 }
596
597 GetWindowTextW(htxt, psz, ic + 1);
598 sei.hwnd = hwnd;
599 sei.nShow = SW_SHOWNORMAL;
600 sei.lpFile = psz;
601 StrTrimW(psz, L" \t");
602
603 if (wcschr(psz, L'%') != NULL)
604 {
605 cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
606 pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
607 if (!pszExpanded)
608 {
609 HeapFree(GetProcessHeap(), 0, psz);
611 return TRUE;
612 }
613 ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
614 StrTrimW(pszExpanded, L" \t");
615 }
616 else
617 {
618 pszExpanded = psz;
619 }
620
621 /*
622 * The precedence is the following: first the user-given
623 * current directory is used; if there is none, a current
624 * directory is computed if the RFF_CALCDIRECTORY is set,
625 * otherwise no current directory is defined.
626 */
627 LPCWSTR pszStartDir;
628 if (prfdp->lpstrDirectory)
629 {
630 sei.lpDirectory = prfdp->lpstrDirectory;
631 pszStartDir = prfdp->lpstrDirectory;
632 }
633 else if (prfdp->uFlags & RFF_CALCDIRECTORY)
634 {
636 pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
637 }
638 else
639 {
640 sei.lpDirectory = NULL;
641 pszStartDir = NULL;
642 }
643
644 /* Hide the dialog for now on, we will show it up in case of retry */
646
647 /*
648 * As shown by manual tests on Windows, modifying the contents
649 * of the notification structure will not modify what the
650 * Run-Dialog will use for the nShow parameter. However the
651 * lpFile and lpDirectory pointers are set to the buffers used
652 * by the Run-Dialog, as a consequence they can be modified by
653 * the notification receiver, as long as it respects the lengths
654 * of the buffers (to avoid buffer overflows).
655 */
656 nmrfd.hdr.code = RFN_VALIDATE;
657 nmrfd.hdr.hwndFrom = hwnd;
658 nmrfd.hdr.idFrom = 0;
659 nmrfd.lpFile = pszExpanded;
660 nmrfd.lpDirectory = pszStartDir;
661 nmrfd.nShow = SW_SHOWNORMAL;
662
663 lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
664
665 switch (lRet)
666 {
667 case RF_CANCEL:
669 break;
670
671 case RF_OK:
672 /* We use SECL_NO_UI because we don't want to see
673 * errors here, but we will try again below and
674 * there we will output our errors. */
675 if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
677 {
678 /* Call GetWindowText again in case the contents of the edit box have changed. */
679 GetWindowTextW(htxt, psz, ic + 1);
680 FillList(htxt, psz, ic + 2 + 1, FALSE);
682 break;
683 }
684 else if (ShellExecuteExW(&sei))
685 {
686 /* Call GetWindowText again in case the contents of the edit box have changed. */
687 GetWindowTextW(htxt, psz, ic + 1);
688 FillList(htxt, psz, ic + 2 + 1, FALSE);
690 break;
691 }
692
693 /* Fall-back */
694 case RF_RETRY:
695 default:
696 SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
697 /* Show back the dialog */
699 break;
700 }
701
703 HeapFree(GetProcessHeap(), 0, psz);
704 if (psz != pszExpanded)
705 HeapFree(GetProcessHeap(), 0, pszExpanded);
706 return TRUE;
707 }
708
709 case IDCANCEL:
711 return TRUE;
712
714 {
715 HMODULE hComdlg = NULL;
716 LPFNOFN ofnProc = NULL;
717 WCHAR szFName[1024] = {0};
718 WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
720
723
724 ZeroMemory(&ofn, sizeof(ofn));
725 ofn.lStructSize = sizeof(ofn);
728 ofn.lpstrFile = szFName;
729 ofn.nMaxFile = _countof(szFName) - 1;
730 ofn.lpstrTitle = szCaption;
732 ofn.lpstrInitialDir = prfdp->lpstrDirectory;
733
734 if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)) ||
735 NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
736 {
737 ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
739 return TRUE;
740 }
741
742 if (ofnProc(&ofn))
743 {
749 }
750
751 FreeLibrary(hComdlg);
752
753 return TRUE;
754 }
756 {
758 {
760 }
761 return TRUE;
762 }
763 }
764 return TRUE;
765 }
766 return FALSE;
767}
768
769/*
770 * This function grabs the MRU list from the registry and fills the combo-list
771 * for the "Run" dialog above. fShowDefault is ignored if pszLatest != NULL.
772 */
773// FIXME: Part of this code should be part of some MRUList API,
774// that is scattered amongst shell32, comctl32 (?!) and comdlg32.
775static void FillList(HWND hCb, LPWSTR pszLatest, UINT cchStr, BOOL fShowDefault)
776{
777 HKEY hkey;
778 WCHAR *pszList = NULL, *pszCmd = NULL, *pszTmp = NULL, cMatch = 0, cMax = 0x60;
779 WCHAR szIndex[2] = L"-";
780 UINT cchLatest;
781 DWORD dwType, icList = 0, icCmd = 0;
782 LRESULT lRet;
783 UINT Nix;
784
785 /*
786 * Retrieve the string length of pszLatest and check whether its buffer size
787 * (cchStr in number of characters) is large enough to add the terminating "\\1"
788 * (and the NULL character).
789 */
790 if (pszLatest)
791 {
792 cchLatest = wcslen(pszLatest);
793 if (cchStr < cchLatest + 2 + 1)
794 {
795 TRACE("pszLatest buffer is not large enough (%d) to hold the MRU terminator.\n", cchStr);
796 return;
797 }
798 }
799 else
800 {
801 cchStr = 0;
802 }
803
804 SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
805
807 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
809 if (lRet != ERROR_SUCCESS)
810 {
811 TRACE("Unable to open or create the RunMRU key, error %d\n", GetLastError());
812 return;
813 }
814
815 lRet = RegQueryValueExW(hkey, L"MRUList", NULL, &dwType, NULL, &icList);
816 if (lRet == ERROR_SUCCESS && dwType == REG_SZ && icList > sizeof(WCHAR))
817 {
818 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
819 if (!pszList)
820 {
821 TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
822 goto Continue;
823 }
824 pszList[0] = L'\0';
825
826 lRet = RegQueryValueExW(hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList);
827 if (lRet != ERROR_SUCCESS)
828 {
829 TRACE("Unable to grab MRUList, error %d\n", GetLastError());
830 pszList[0] = L'\0';
831 }
832 }
833 else
834 {
835Continue:
836 icList = sizeof(WCHAR);
837 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
838 if (!pszList)
839 {
840 TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
841 RegCloseKey(hkey);
842 return;
843 }
844 pszList[0] = L'\0';
845 }
846
847 /* Convert the number of bytes from MRUList into number of characters (== number of indices) */
848 icList /= sizeof(WCHAR);
849
850 for (Nix = 0; Nix < icList - 1; Nix++)
851 {
852 if (pszList[Nix] > cMax)
853 cMax = pszList[Nix];
854
855 szIndex[0] = pszList[Nix];
856
857 lRet = RegQueryValueExW(hkey, szIndex, NULL, &dwType, NULL, &icCmd);
858 if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
859 {
860 TRACE("Unable to grab size of index, error %d\n", GetLastError());
861 continue;
862 }
863
864 if (pszCmd)
865 {
866 pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
867 if (!pszTmp)
868 {
869 TRACE("HeapReAlloc failed to reallocate %d bytes\n", icCmd);
870 continue;
871 }
872 pszCmd = pszTmp;
873 }
874 else
875 {
876 pszCmd = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icCmd);
877 if (!pszCmd)
878 {
879 TRACE("HeapAlloc failed to allocate %d bytes\n", icCmd);
880 continue;
881 }
882 }
883
884 lRet = RegQueryValueExW(hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd);
885 if (lRet != ERROR_SUCCESS)
886 {
887 TRACE("Unable to grab index, error %d\n", GetLastError());
888 continue;
889 }
890
891 /*
892 * Generally the command string will end up with "\\1".
893 * Find the last backslash in the string and NULL-terminate.
894 * Windows does not seem to check for what comes next, so that
895 * a command of the form:
896 * c:\\my_dir\\myfile.exe
897 * will be cut just after "my_dir", whereas a command of the form:
898 * c:\\my_dir\\myfile.exe\\1
899 * will be cut just after "myfile.exe".
900 */
901 pszTmp = wcsrchr(pszCmd, L'\\');
902 if (pszTmp)
903 *pszTmp = L'\0';
904
905 /*
906 * In the following we try to add pszLatest to the MRU list.
907 * We suppose that our caller has already correctly allocated
908 * the string with enough space for us to append a "\\1".
909 *
910 * FIXME: TODO! (At the moment we don't append it!)
911 */
912
913 if (pszLatest)
914 {
915 if (_wcsicmp(pszCmd, pszLatest) == 0)
916 {
917 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
918 SetWindowTextW(hCb, pszCmd);
919 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
920
921 cMatch = pszList[Nix];
922 memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
923 pszList[0] = cMatch;
924 continue;
925 }
926 }
927
928 if (icList - 1 != 26 || icList - 2 != Nix || cMatch || pszLatest == NULL)
929 {
930 SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
931 if (!Nix && fShowDefault)
932 {
933 SetWindowTextW(hCb, pszCmd);
934 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
935 }
936 }
937 else
938 {
939 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
940 SetWindowTextW(hCb, pszLatest);
941 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
942
943 cMatch = pszList[Nix];
944 memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
945 pszList[0] = cMatch;
946 szIndex[0] = cMatch;
947
948 wcscpy(&pszLatest[cchLatest], L"\\1");
949 RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
950 pszLatest[cchLatest] = L'\0';
951 }
952 }
953
954 if (!cMatch && pszLatest != NULL)
955 {
956 SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
957 SetWindowTextW(hCb, pszLatest);
958 SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
959
960 cMatch = ++cMax;
961
962 if (pszList)
963 {
964 pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszList, (++icList) * sizeof(WCHAR));
965 if (!pszTmp)
966 {
967 TRACE("HeapReAlloc failed to reallocate enough bytes\n");
968 goto Cleanup;
969 }
970 pszList = pszTmp;
971 }
972 else
973 {
974 pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (++icList) * sizeof(WCHAR));
975 if (!pszList)
976 {
977 TRACE("HeapAlloc failed to allocate enough bytes\n");
978 goto Cleanup;
979 }
980 }
981
982 memmove(&pszList[1], pszList, (icList - 1) * sizeof(WCHAR));
983 pszList[0] = cMatch;
984 szIndex[0] = cMatch;
985
986 wcscpy(&pszLatest[cchLatest], L"\\1");
987 RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
988 pszLatest[cchLatest] = L'\0';
989 }
990
991Cleanup:
992 RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (wcslen(pszList) + 1) * sizeof(WCHAR));
993
994 HeapFree(GetProcessHeap(), 0, pszCmd);
995 HeapFree(GetProcessHeap(), 0, pszList);
996
997 RegCloseKey(hkey);
998}
999
1000
1001/*************************************************************************
1002 * ConfirmDialog [internal]
1003 *
1004 * Put up a confirm box, return TRUE if the user confirmed
1005 */
1006static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
1007{
1008 WCHAR Prompt[256];
1009 WCHAR Title[256];
1010
1011 LoadStringW(shell32_hInstance, PromptId, Prompt, _countof(Prompt));
1013 return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO | MB_ICONQUESTION) == IDYES;
1014}
1015
1017
1018BOOL
1020{
1022 static BOOL Initialized = FALSE;
1023 if (!Initialized)
1024 {
1025 HMODULE mod = LoadLibraryW(L"msgina.dll");
1027 Initialized = TRUE;
1028 }
1029
1030 HRESULT hr = E_FAIL;
1031 if (ShellDimScreen)
1032 hr = ShellDimScreen(pUnknown, hWindow);
1033 return SUCCEEDED(hr);
1034}
1035
1036
1037/* Used to get the shutdown privilege */
1038static BOOL
1039EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
1040{
1041 BOOL Success;
1042 HANDLE hToken;
1044
1047 &hToken);
1048 if (!Success) return Success;
1049
1051 lpszPrivilegeName,
1052 &tp.Privileges[0].Luid);
1053 if (!Success) goto Quit;
1054
1055 tp.PrivilegeCount = 1;
1056 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1057
1058 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1059
1060Quit:
1061 CloseHandle(hToken);
1062 return Success;
1063}
1064
1065/*************************************************************************
1066 * RestartDialogEx [SHELL32.730]
1067 */
1068
1069int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
1070{
1071 TRACE("(%p)\n", hWndOwner);
1072
1073 CComPtr<IUnknown> fadeHandler;
1074 HWND parent;
1075
1076 if (!CallShellDimScreen(&fadeHandler, &parent))
1077 parent = hWndOwner;
1078
1079 /* FIXME: use lpwstrReason */
1081 {
1082 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1083 ExitWindowsEx(EWX_REBOOT, uReason);
1084 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1085 }
1086
1087 return 0;
1088}
1089
1090/* Functions and macros used for fancy log off dialog box */
1091#define IS_PRODUCT_VERSION_WORKSTATION 0x300
1092#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED 0x0
1093
1094#define FONT_POINT_SIZE 13
1095
1096#define DARK_GREY_COLOR RGB(244, 244, 244)
1097#define LIGHT_GREY_COLOR RGB(38, 38, 38)
1098
1099/* Bitmap's size for buttons */
1100#define CX_BITMAP 33
1101#define CY_BITMAP 33
1102
1103#define NUMBER_OF_BUTTONS 2
1104
1105/* After determining the button as well as its state paint the image strip bitmap using these predefined positions */
1106#define BUTTON_SWITCH_USER 0
1107#define BUTTON_SWITCH_USER_PRESSED (CY_BITMAP + BUTTON_SWITCH_USER)
1108#define BUTTON_SWITCH_USER_FOCUSED (CY_BITMAP + BUTTON_SWITCH_USER_PRESSED)
1109#define BUTTON_LOG_OFF (CY_BITMAP + BUTTON_SWITCH_USER_FOCUSED)
1110#define BUTTON_LOG_OFF_PRESSED (CY_BITMAP + BUTTON_LOG_OFF)
1111#define BUTTON_LOG_OFF_FOCUSED (CY_BITMAP + BUTTON_LOG_OFF_PRESSED)
1112#define BUTTON_SWITCH_USER_DISABLED (CY_BITMAP + BUTTON_LOG_OFF_FOCUSED) // Temporary
1113
1114/* For bIsButtonHot */
1115#define LOG_OFF_BUTTON_HOT 0
1116#define SWITCH_USER_BUTTON_HOT 1
1117
1119{
1120 BOOL bRet = FALSE;
1121 HDC hdcMem = NULL;
1122 HBITMAP hbmOld = NULL;
1123 int y = 0;
1124 RECT rect;
1125
1126 hdcMem = CreateCompatibleDC(pdis->hDC);
1127 hbmOld = (HBITMAP)SelectObject(hdcMem, pContext->hImageStrip);
1128 rect = pdis->rcItem;
1129
1130 /* Check the button ID for revelant bitmap to be used */
1131 switch (pdis->CtlID)
1132 {
1133 case IDC_LOG_OFF_BUTTON:
1134 {
1135 switch (pdis->itemAction)
1136 {
1137 case ODA_DRAWENTIRE:
1138 case ODA_FOCUS:
1139 case ODA_SELECT:
1140 {
1141 y = BUTTON_LOG_OFF;
1142 if (pdis->itemState & ODS_SELECTED)
1143 {
1145 }
1146 else if (pContext->bIsButtonHot[LOG_OFF_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
1147 {
1149 }
1150 break;
1151 }
1152 }
1153 break;
1154 }
1155
1157 {
1158 switch (pdis->itemAction)
1159 {
1160 case ODA_DRAWENTIRE:
1161 case ODA_FOCUS:
1162 case ODA_SELECT:
1163 {
1165 if (pdis->itemState & ODS_SELECTED)
1166 {
1168 }
1169 else if (pContext->bIsButtonHot[SWITCH_USER_BUTTON_HOT] || (pdis->itemState & ODS_FOCUS))
1170 {
1172 }
1173
1174 /*
1175 * Since switch user functionality isn't implemented yet therefore the button has been disabled
1176 * temporarily hence show the disabled state
1177 */
1178 else if (pdis->itemState & ODS_DISABLED)
1179 {
1181 }
1182 break;
1183 }
1184 }
1185 break;
1186 }
1187 }
1188
1189 /* Draw it on the required button */
1190 bRet = BitBlt(pdis->hDC,
1191 (rect.right - rect.left - CX_BITMAP) / 2,
1192 (rect.bottom - rect.top - CY_BITMAP) / 2,
1194
1195 SelectObject(hdcMem, hbmOld);
1197
1198 return bRet;
1199}
1200
1202{
1203 PLOGOFF_DLG_CONTEXT pContext;
1205
1206 int buttonID = GetDlgCtrlID(hButton);
1207
1208 switch (uMsg)
1209 {
1210 case WM_MOUSEMOVE:
1211 {
1212 HWND hwndTarget = NULL;
1214
1215 if (GetCapture() != hButton)
1216 {
1217 SetCapture(hButton);
1218
1219 switch (buttonID)
1220 {
1221 case IDC_LOG_OFF_BUTTON:
1222 {
1224 break;
1225 }
1227 {
1229 break;
1230 }
1231 }
1233 }
1234
1235 ClientToScreen(hButton, &pt);
1236 hwndTarget = WindowFromPoint(pt);
1237
1238 if (hwndTarget != hButton)
1239 {
1241
1242 switch (buttonID)
1243 {
1244 case IDC_LOG_OFF_BUTTON:
1245 {
1247 break;
1248 }
1250 {
1252 break;
1253 }
1254 }
1255 }
1256 InvalidateRect(hButton, NULL, FALSE);
1257 break;
1258 }
1259
1260 /* Whenever one of the buttons gets the keyboard focus, set it as default button */
1261 case WM_SETFOCUS:
1262 {
1263 SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
1264 break;
1265 }
1266
1267 /* Otherwise, set IDCANCEL as default button */
1268 case WM_KILLFOCUS:
1269 {
1271 break;
1272 }
1273 }
1274 return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
1275}
1276
1277VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID)
1278{
1279 HWND hwndTool = NULL, hwndTip = NULL;
1280 WCHAR szBuffer[256];
1281 TTTOOLINFOW tool;
1282
1283 hwndTool = GetDlgItem(hDlg, controlID);
1284
1285 tool.cbSize = sizeof(tool);
1286 tool.hwnd = hDlg;
1288 tool.uId = (UINT_PTR)hwndTool;
1289
1290 /* Create the tooltip */
1291 hwndTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL,
1295 hDlg, NULL, shell32_hInstance, NULL);
1296
1297 /* Associate the tooltip with the tool. */
1298 LoadStringW(shell32_hInstance, detailID, szBuffer, _countof(szBuffer));
1299 tool.lpszText = szBuffer;
1300 SendMessageW(hwndTip, TTM_ADDTOOLW, 0, (LPARAM)&tool);
1301 LoadStringW(shell32_hInstance, titleID, szBuffer, _countof(szBuffer));
1302 SendMessageW(hwndTip, TTM_SETTITLEW, TTI_NONE, (LPARAM)szBuffer);
1303 SendMessageW(hwndTip, TTM_SETMAXTIPWIDTH, 0, 250);
1304}
1305
1307{
1308 DeleteObject(pContext->hBrush);
1309 DeleteObject(pContext->hImageStrip);
1310 DeleteObject(pContext->hfFont);
1311
1312 /* Remove the subclass from the buttons */
1313 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1314 {
1317 (LONG_PTR)pContext->OldButtonProc);
1318 }
1319}
1320
1322{
1323 DWORD dwType = 0, dwValue = 0, dwSize = 0;
1324 HKEY hKey = NULL;
1325 LONG lRet = 0;
1326
1328 L"SYSTEM\\CurrentControlSet\\Control\\Windows",
1329 0,
1331 &hKey);
1332 if (lRet != ERROR_SUCCESS)
1333 return FALSE;
1334
1335 /* First check an optional ReactOS specific override, that Windows does not check.
1336 We use this to allow users pairing 'Server'-configuration with FriendlyLogoff.
1337 Otherwise users would have to change CSDVersion or LogonType (side-effects AppCompat) */
1338 dwValue = 0;
1339 dwSize = sizeof(dwValue);
1340 lRet = RegQueryValueExW(hKey,
1341 L"EnforceFriendlyLogoff",
1342 NULL,
1343 &dwType,
1344 (LPBYTE)&dwValue,
1345 &dwSize);
1346
1347 if (lRet == ERROR_SUCCESS && dwType == REG_DWORD && dwValue != FRIENDLY_LOGOFF_IS_NOT_ENFORCED)
1348 {
1350 return TRUE;
1351 }
1352
1353 /* Check product version number */
1354 dwValue = 0;
1355 dwSize = sizeof(dwValue);
1356 lRet = RegQueryValueExW(hKey,
1357 L"CSDVersion",
1358 NULL,
1359 &dwType,
1360 (LPBYTE)&dwValue,
1361 &dwSize);
1363
1364 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD || dwValue != IS_PRODUCT_VERSION_WORKSTATION)
1365 {
1366 /* Allow Friendly UI only on Workstation */
1367 return FALSE;
1368 }
1369
1370 /* Check LogonType value */
1372 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1373 0,
1375 &hKey);
1376 if (lRet != ERROR_SUCCESS)
1377 return FALSE;
1378
1379 dwValue = 0;
1380 dwSize = sizeof(dwValue);
1381 lRet = RegQueryValueExW(hKey,
1382 L"LogonType",
1383 NULL,
1384 &dwType,
1385 (LPBYTE)&dwValue,
1386 &dwSize);
1388
1389 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
1390 return FALSE;
1391
1392 return (dwValue != 0);
1393}
1394
1396{
1397 HDC hdc = NULL;
1398 LONG lfHeight = NULL;
1399
1400 hdc = GetDC(NULL);
1402 ReleaseDC(NULL, hdc);
1403 pContext->hfFont = CreateFontW(lfHeight, 0, 0, 0, FW_MEDIUM, FALSE, 0, 0, 0, 0, 0, 0, 0, L"MS Shell Dlg");
1405
1407
1409
1410 /* Gather old button func */
1412
1413 /* Set bIsButtonHot to false, create tooltips for each buttons and subclass the buttons */
1414 for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1415 {
1416 pContext->bIsButtonHot[i] = FALSE;
1422 hwnd,
1424 }
1425}
1426
1427/*************************************************************************
1428 * LogOffDialogProc
1429 *
1430 * NOTES: Used to make the Log Off dialog work
1431 */
1433{
1435 PLOGOFF_DLG_CONTEXT pContext;
1437
1438 switch (uMsg)
1439 {
1440 case WM_INITDIALOG:
1441 {
1442 pContext = (PLOGOFF_DLG_CONTEXT)lParam;
1444
1445 if (pContext->bFriendlyUI)
1446 FancyLogoffOnInit(hwnd, pContext);
1447 return TRUE;
1448 }
1449
1450 case WM_CLOSE:
1452 break;
1453
1454 /*
1455 * If the user deactivates the log off dialog (it loses its focus
1456 * while the dialog is not being closed), then destroy the dialog
1457 * box.
1458 */
1459 case WM_ACTIVATE:
1460 {
1461 if (LOWORD(wParam) == WA_INACTIVE)
1462 {
1464 }
1465 return FALSE;
1466 }
1467
1468 case WM_COMMAND:
1469 switch (LOWORD(wParam))
1470 {
1471 case IDC_LOG_OFF_BUTTON:
1472 case IDOK:
1474 break;
1475
1476 case IDCANCEL:
1478 break;
1479 }
1480 break;
1481
1482 case WM_DESTROY:
1483 if (pContext->bFriendlyUI)
1484 EndFriendlyDialog(hwnd, pContext);
1485 return TRUE;
1486
1487 case WM_CTLCOLORSTATIC:
1488 {
1489 /* Either make background transparent or fill it with color for required static controls */
1490 HDC hdcStatic = (HDC)wParam;
1492
1493 switch (StaticID)
1494 {
1496 SetTextColor(hdcStatic, DARK_GREY_COLOR);
1497 SetBkMode(hdcStatic, TRANSPARENT);
1499
1500 case IDC_LOG_OFF_STATIC:
1502 SetTextColor(hdcStatic, LIGHT_GREY_COLOR);
1503 SetBkMode(hdcStatic, TRANSPARENT);
1504 return (LONG_PTR)pContext->hBrush;
1505 }
1506 return FALSE;
1507 }
1508 break;
1509
1510 case WM_DRAWITEM:
1511 {
1512 /* Draw bitmaps on required buttons */
1513 switch (pdis->CtlID)
1514 {
1515 case IDC_LOG_OFF_BUTTON:
1517 return DrawIconOnOwnerDrawnButtons(pdis, pContext);
1518 }
1519 }
1520 break;
1521
1522 default:
1523 break;
1524 }
1525 return FALSE;
1526}
1527
1528/*************************************************************************
1529 * LogoffWindowsDialog [SHELL32.54]
1530 */
1531
1533{
1534 CComPtr<IUnknown> fadeHandler;
1535 HWND parent = NULL;
1536 DWORD LogoffDialogID = IDD_LOG_OFF;
1538
1539 if (!CallShellDimScreen(&fadeHandler, &parent))
1540 parent = hWndOwner;
1541
1542 Context.bFriendlyUI = IsFriendlyUIActive();
1543 if (Context.bFriendlyUI)
1544 {
1545 LogoffDialogID = IDD_LOG_OFF_FANCY;
1546 }
1547
1549 MAKEINTRESOURCEW(LogoffDialogID),
1550 parent,
1552 (LPARAM)&Context);
1553 return 0;
1554}
1555
1556/*************************************************************************
1557 * RestartDialog [SHELL32.59]
1558 */
1559
1560int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
1561{
1562 return RestartDialogEx(hWndOwner, lpstrReason, uFlags, 0);
1563}
1564
1565/*************************************************************************
1566 * ExitWindowsDialog_backup
1567 *
1568 * NOTES
1569 * Used as a backup solution to shutdown the OS in case msgina.dll
1570 * somehow cannot be found.
1571 */
1573{
1574 TRACE("(%p)\n", hWndOwner);
1575
1577 {
1578 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1580 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1581 }
1582}
1583
1584/*************************************************************************
1585 * ExitWindowsDialog [SHELL32.60]
1586 *
1587 * NOTES
1588 * exported by ordinal
1589 */
1590/*
1591 * TODO:
1592 * - Implement the ability to show either the Welcome Screen or the classic dialog boxes based upon the
1593 * registry value: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType.
1594 */
1596{
1597 typedef DWORD (WINAPI *ShellShFunc)(HWND hParent, WCHAR *Username, BOOL bHideLogoff);
1598 HINSTANCE msginaDll = LoadLibraryW(L"msgina.dll");
1599
1600 TRACE("(%p)\n", hWndOwner);
1601
1602 CComPtr<IUnknown> fadeHandler;
1603 HWND parent;
1604 if (!CallShellDimScreen(&fadeHandler, &parent))
1605 parent = hWndOwner;
1606
1607 /* If the DLL cannot be found for any reason, then it simply uses a
1608 dialog box to ask if the user wants to shut down the computer. */
1609 if (!msginaDll)
1610 {
1611 TRACE("Unable to load msgina.dll.\n");
1613 return;
1614 }
1615
1616 ShellShFunc pShellShutdownDialog = (ShellShFunc)GetProcAddress(msginaDll, "ShellShutdownDialog");
1617
1618 if (pShellShutdownDialog)
1619 {
1620 /* Actually call the function */
1621 DWORD returnValue = pShellShutdownDialog(parent, NULL, FALSE);
1622
1623 switch (returnValue)
1624 {
1625 case 0x01: /* Log off user */
1626 {
1628 break;
1629 }
1630 case 0x02: /* Shut down */
1631 {
1632 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1634 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1635 break;
1636 }
1637 case 0x03: /* Install Updates/Shutdown (?) */
1638 {
1639 break;
1640 }
1641 case 0x04: /* Reboot */
1642 {
1643 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1645 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1646 break;
1647 }
1648 case 0x10: /* Sleep */
1649 {
1650 if (IsPwrSuspendAllowed())
1651 {
1652 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1654 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1655 }
1656 break;
1657 }
1658 case 0x40: /* Hibernate */
1659 {
1661 {
1662 EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1664 EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1665 }
1666 break;
1667 }
1668 /* If the option is any other value */
1669 default:
1670 break;
1671 }
1672 }
1673 else
1674 {
1675 /* If the function cannot be found, then revert to using the backup solution */
1676 TRACE("Unable to find the 'ShellShutdownDialog' function");
1678 }
1679
1680 FreeLibrary(msginaDll);
1681}
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:1532
#define BUTTON_SWITCH_USER_DISABLED
Definition: dialogs.cpp:1112
VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID)
Definition: dialogs.cpp:1277
#define DARK_GREY_COLOR
Definition: dialogs.cpp:1096
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:422
BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT *pdis, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1118
static void FillList(HWND, LPWSTR, UINT, BOOL)
Definition: dialogs.cpp:775
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
Definition: dialogs.cpp:1069
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:1321
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1039
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
#define CX_BITMAP
Definition: dialogs.cpp:1100
void WINAPI ExitWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1595
#define LOG_OFF_BUTTON_HOT
Definition: dialogs.cpp:1115
#define CX_ITEM
Definition: dialogs.cpp:182
VOID ExitWindowsDialog_backup(HWND hWndOwner)
Definition: dialogs.cpp:1572
#define BUTTON_SWITCH_USER
Definition: dialogs.cpp:1106
#define BUTTON_LOG_OFF_FOCUSED
Definition: dialogs.cpp:1111
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:1306
#define BUTTON_LOG_OFF
Definition: dialogs.cpp:1109
INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1201
#define IS_PRODUCT_VERSION_WORKSTATION
Definition: dialogs.cpp:1091
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:1019
#define NUMBER_OF_BUTTONS
Definition: dialogs.cpp:1103
static void EnableOkButtonFromEditContents(HWND hwnd)
Definition: dialogs.cpp:478
#define FONT_POINT_SIZE
Definition: dialogs.cpp:1094
static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:166
#define CY_BITMAP
Definition: dialogs.cpp:1101
INT_PTR CALLBACK LogOffDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1432
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:1395
#define CX_ICON
Definition: dialogs.cpp:178
#define SWITCH_USER_BUTTON_HOT
Definition: dialogs.cpp:1116
static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
Definition: dialogs.cpp:1006
#define LIGHT_GREY_COLOR
Definition: dialogs.cpp:1097
#define BUTTON_SWITCH_USER_PRESSED
Definition: dialogs.cpp:1107
#define BUTTON_LOG_OFF_PRESSED
Definition: dialogs.cpp:1110
#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED
Definition: dialogs.cpp:1092
HRESULT(WINAPI * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
Definition: dialogs.cpp:1016
#define BUTTON_SWITCH_USER_FOCUSED
Definition: dialogs.cpp:1108
static INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM)
Definition: dialogs.cpp:501
#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:399
int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
Definition: dialogs.cpp:1560
#define ShellMessageBoxW
Definition: precomp.h:63
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:1957
#define SHACF_DEFAULT
Definition: shlwapi.h:1956
#define SHACF_FILESYS_ONLY
Definition: shlwapi.h:1962
#define SHACF_URLALL
Definition: shlwapi.h:1960
#define IDS_SHUTDOWN_TITLE
Definition: shresdef.h:82
#define IDI_SHELL_RUN
Definition: shresdef.h:603
#define IDS_LOG_OFF_TITLE
Definition: shresdef.h:382
#define IDS_NO_ICONS
Definition: shresdef.h:364
#define IDS_RESTART_TITLE
Definition: shresdef.h:80
#define IDD_PICK_ICON
Definition: shresdef.h:413
#define IDC_RUNDLG_LABEL
Definition: shresdef.h:393
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:536
#define IDS_SHUTDOWN_PROMPT
Definition: shresdef.h:83
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:365
#define IDS_RUNDLG_BROWSE_FILTER
Definition: shresdef.h:198
#define IDC_LOG_OFF_TEXT_STATIC
Definition: shresdef.h:540
#define IDD_RUN
Definition: shresdef.h:388
#define IDC_EDIT_PATH
Definition: shresdef.h:416
#define IDC_LOG_OFF_STATIC
Definition: shresdef.h:538
#define IDC_PICKICON_LIST
Definition: shresdef.h:414
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:392
#define IDC_RUNDLG_ICON
Definition: shresdef.h:391
#define IDS_RUNDLG_BROWSE_CAPTION
Definition: shresdef.h:197
#define IDD_LOG_OFF
Definition: shresdef.h:570
#define IDS_LOG_OFF_DESC
Definition: shresdef.h:380
#define IDC_BUTTON_PATH
Definition: shresdef.h:415
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:417
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:537
#define IDS_RUNDLG_BROWSE_ERROR
Definition: shresdef.h:196
#define IDC_RUNDLG_DESCRIPTION
Definition: shresdef.h:389
#define IDS_PICK_ICON_FILTER
Definition: shresdef.h:418
#define IDC_SWITCH_USER_STATIC
Definition: shresdef.h:539
#define IDD_LOG_OFF_FANCY
Definition: shresdef.h:576
#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
COM Initialisation.
Definition: shellclasses.h:179
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:188
LPCWSTR lpDirectory
Definition: undocshell.h:189
HMODULE hLibrary
Definition: dialog.c:549
LPCWSTR lpDirectory
Definition: shellapi.h:335
Definition: tftpd.h:60
UINT_PTR idFrom
Definition: winuser.h:3169
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168
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:198
#define RFN_VALIDATE
Definition: undocshell.h:175
#define RF_RETRY
Definition: undocshell.h:200
#define RF_CANCEL
Definition: undocshell.h:199
#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:1743
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:781
#define ODS_DISABLED
Definition: winuser.h:2558
#define LB_ERR
Definition: winuser.h:2443
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4020
#define EWX_SHUTDOWN
Definition: winuser.h:647
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1783
#define LB_GETCOUNT
Definition: winuser.h:2049
#define ODS_SELECTED
Definition: winuser.h:2556
#define SW_HIDE
Definition: winuser.h:779
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2046
#define WM_CLOSE
Definition: winuser.h:1632
#define DM_SETDEFID
Definition: winuser.h:2110
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4840
#define MAKELPARAM(l, h)
Definition: winuser.h:4019
#define COLOR_WINDOW
Definition: winuser.h:929
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2553
#define STM_SETICON
Definition: winuser.h:2103
#define IDCANCEL
Definition: winuser.h:842
#define LB_SETTOPINDEX
Definition: winuser.h:2081
#define LBN_DBLCLK
Definition: winuser.h:2082
#define GWL_ID
Definition: winuser.h:870
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:937
#define WM_COMMAND
Definition: winuser.h:1751
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define ODA_FOCUS
Definition: winuser.h:2555
#define EWX_LOGOFF
Definition: winuser.h:644
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_SETFOCUS
Definition: winuser.h:1624
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1786
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WA_INACTIVE
Definition: winuser.h:2633
#define CB_RESETCONTENT
Definition: winuser.h:1970
#define WM_INITDIALOG
Definition: winuser.h:1750
#define MB_YESNO
Definition: winuser.h:828
#define LB_ADDSTRING
Definition: winuser.h:2042
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2442
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2072
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:841
#define WM_DRAWITEM
Definition: winuser.h:1656
#define WM_ACTIVATE
Definition: winuser.h:1623
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:798
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define EWX_REBOOT
Definition: winuser.h:646
#define LB_RESETCONTENT
Definition: winuser.h:2066
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
#define WM_SETFONT
Definition: winuser.h:1661
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:2365
#define CB_ADDSTRING
Definition: winuser.h:1947
#define SendMessage
Definition: winuser.h:5863
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define MB_OK
Definition: winuser.h:801
#define WM_MEASUREITEM
Definition: winuser.h:1657
#define CB_SETEDITSEL
Definition: winuser.h:1974
#define MB_ICONWARNING
Definition: winuser.h:797
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
#define LBN_SELCHANGE
Definition: winuser.h:2086
#define ODA_SELECT
Definition: winuser.h:2554
#define MB_ICONQUESTION
Definition: winuser.h:800
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
HWND WINAPI WindowFromPoint(_In_ POINT)
int WINAPI GetDlgCtrlID(_In_ HWND)
#define IDC_HAND
Definition: winuser.h:706
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1620
#define LB_SETCURSEL
Definition: winuser.h:2074
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1968
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2917
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2500
#define IDYES
Definition: winuser.h:846
#define LB_GETCURSEL
Definition: winuser.h:2050
#define SetWindowLongPtrW
Definition: winuser.h:5366
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_KILLFOCUS
Definition: winuser.h:1625
#define ODS_FOCUS
Definition: winuser.h:2560
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2412
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_EDITCHANGE
Definition: winuser.h:1986
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:2390
#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