ReactOS  0.4.13-dev-52-g0efcfec
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  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include "precomp.h"
23 
24 typedef struct
25 {
33 
34 typedef BOOL (WINAPI * LPFNOFN) (OPENFILENAMEW *);
35 
38 static void FillList(HWND, LPWSTR, UINT, BOOL);
39 
40 
41 /*************************************************************************
42  * PickIconDlg [SHELL32.62]
43  *
44  */
45 
46 typedef struct
47 {
55 
57  LPCWSTR lpszType,
58  LPWSTR lpszName,
60 {
62  HWND hDlgCtrl = pIconContext->hDlgCtrl;
63 
64  if (IS_INTRESOURCE(lpszName))
65  lParam = LOWORD(lpszName);
66  else
67  lParam = -1;
68 
69  SendMessageW(hDlgCtrl, LB_ADDSTRING, 0, lParam);
70 
71  return TRUE;
72 }
73 
74 static void
75 DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
76 {
77  int count;
78  int index;
79 
80  count = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
81  if (count == LB_ERR)
82  return;
83 
84  for(index = 0; index < count; index++)
85  {
86  DestroyIcon(pIconContext->phIcons[index]);
87  pIconContext->phIcons[index] = NULL;
88  }
89 }
90 
91 static BOOL
92 DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
93 {
94  WCHAR szExpandedPath[MAX_PATH];
95 
96  // Destroy previous icons
97  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
98  SendMessageW(pIconContext->hDlgCtrl, LB_RESETCONTENT, 0, 0);
99  delete[] pIconContext->phIcons;
100 
101  // Store the path
102  StringCchCopyW(pIconContext->szPath, _countof(pIconContext->szPath), pszFile);
103  ExpandEnvironmentStringsW(pszFile, szExpandedPath, _countof(szExpandedPath));
104 
105  // Load the module if possible
107  if (pIconContext->hLibrary)
108  FreeLibrary(pIconContext->hLibrary);
109  pIconContext->hLibrary = hLibrary;
110 
111  if (pIconContext->hLibrary)
112  {
113  // Load the icons from the module
114  pIconContext->nIcons = ExtractIconExW(szExpandedPath, -1, NULL, NULL, 0);
115  pIconContext->phIcons = new HICON[pIconContext->nIcons];
116 
117  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
118  {
120  }
121  else
122  {
123  pIconContext->nIcons = 0;
124  }
125  }
126  else
127  {
128  // .ico file
129  pIconContext->nIcons = 1;
130  pIconContext->phIcons = new HICON[1];
131 
132  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
133  {
134  SendMessageW(pIconContext->hDlgCtrl, LB_ADDSTRING, 0, 0);
135  }
136  else
137  {
138  pIconContext->nIcons = 0;
139  }
140  }
141 
142  // Set the text and reset the edit control's modification flag
143  SetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath);
145 
146  if (pIconContext->nIcons == 0)
147  {
148  delete[] pIconContext->phIcons;
149  pIconContext->phIcons = NULL;
150  }
151 
152  return (pIconContext->nIcons > 0);
153 }
154 
155 static const LPCWSTR s_pszDefaultPath = L"%SystemRoot%\\system32\\shell32.dll";
156 
157 static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
158 {
159  // Show an error message
160  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
161  strText.Format(IDS_NO_ICONS, pIconContext->szPath);
162  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING);
163 
164  // Load the default icons
165  DoLoadIcons(hwndDlg, pIconContext, s_pszDefaultPath);
166 }
167 
168 // Icon size
169 #define CX_ICON GetSystemMetrics(SM_CXICON)
170 #define CY_ICON GetSystemMetrics(SM_CYICON)
171 
172 // Item size
173 #define CX_ITEM (CX_ICON + 4)
174 #define CY_ITEM (CY_ICON + 12)
175 
177  HWND hwndDlg,
178  UINT uMsg,
179  WPARAM wParam,
180  LPARAM lParam)
181 {
182  LPMEASUREITEMSTRUCT lpmis;
183  LPDRAWITEMSTRUCT lpdis;
184  HICON hIcon;
185  INT index, count;
186  WCHAR szText[MAX_PATH], szFilter[100];
187  CStringW strTitle;
189 
191 
192  switch(uMsg)
193  {
194  case WM_INITDIALOG:
195  {
196  pIconContext = (PPICK_ICON_CONTEXT)lParam;
197  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pIconContext);
198  pIconContext->hDlgCtrl = GetDlgItem(hwndDlg, IDC_PICKICON_LIST);
199 
200  SendMessageW(pIconContext->hDlgCtrl, LB_SETCOLUMNWIDTH, CX_ITEM, 0);
201 
202  // Load the icons
203  if (!DoLoadIcons(hwndDlg, pIconContext, pIconContext->szPath))
204  NoIconsInFile(hwndDlg, pIconContext);
205 
206  // Set the selection
207  count = SendMessageW(pIconContext->hDlgCtrl, LB_GETCOUNT, 0, 0);
208  if (count != LB_ERR)
209  {
210  if (pIconContext->Index < 0)
211  {
212  // A negative value will be interpreted as a negated resource ID.
213  LPARAM lParam = -pIconContext->Index;
214  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_FINDSTRINGEXACT, -1, lParam);
215  }
216 
217  if (pIconContext->Index < 0 || count <= pIconContext->Index)
218  pIconContext->Index = 0;
219 
220  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, pIconContext->Index, 0);
221  SendMessageW(pIconContext->hDlgCtrl, LB_SETTOPINDEX, pIconContext->Index, 0);
222  }
223  return TRUE;
224  }
225 
226  case WM_DESTROY:
227  {
228  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
229  delete[] pIconContext->phIcons;
230 
231  if (pIconContext->hLibrary)
232  FreeLibrary(pIconContext->hLibrary);
233  break;
234  }
235 
236  case WM_COMMAND:
237  switch(LOWORD(wParam))
238  {
239  case IDOK:
240  {
241  /* Check whether the path edit control has been modified; if so load the icons instead of validating */
242  if (SendDlgItemMessage(hwndDlg, IDC_EDIT_PATH, EM_GETMODIFY, 0, 0))
243  {
244  /* Reset the edit control's modification flag and retrieve the text */
247 
248  // Load the icons
249  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
250  NoIconsInFile(hwndDlg, pIconContext);
251 
252  // Set the selection
253  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
254  break;
255  }
256 
257  /* The path edit control has not been modified, return the selection */
258  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
259  GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath, _countof(pIconContext->szPath));
260  EndDialog(hwndDlg, 1);
261  break;
262  }
263 
264  case IDCANCEL:
265  EndDialog(hwndDlg, 0);
266  break;
267 
268  case IDC_PICKICON_LIST:
269  switch (HIWORD(wParam))
270  {
271  case LBN_SELCHANGE:
273  break;
274 
275  case LBN_DBLCLK:
276  SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
277  break;
278  }
279  break;
280 
281  case IDC_BUTTON_PATH:
282  {
283  // Choose the module path
284  szText[0] = 0;
285  szFilter[0] = 0;
286  ZeroMemory(&ofn, sizeof(ofn));
287  ofn.lStructSize = sizeof(ofn);
288  ofn.hwndOwner = hwndDlg;
289  ofn.lpstrFile = szText;
291  strTitle.LoadString(IDS_PICK_ICON_TITLE);
292  ofn.lpstrTitle = strTitle;
295  if (!GetOpenFileNameW(&ofn))
296  break;
297 
298  // Load the icons
299  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
300  NoIconsInFile(hwndDlg, pIconContext);
301 
302  // Set the selection
303  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
304  break;
305  }
306 
307  default:
308  break;
309  }
310  break;
311 
312  case WM_MEASUREITEM:
313  lpmis = (LPMEASUREITEMSTRUCT)lParam;
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)
323  {
324  case ODA_SELECT:
325  case ODA_DRAWENTIRE:
326  {
327  index = SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
328  hIcon = pIconContext->phIcons[lpdis->itemID];
329 
330  if (lpdis->itemID == (UINT)index)
331  FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
332  else
333  FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_WINDOW + 1));
334 
335  // Centering
336  INT x = lpdis->rcItem.left + (CX_ITEM - CX_ICON) / 2;
337  INT y = lpdis->rcItem.top + (CY_ITEM - CY_ICON) / 2;
338 
339  DrawIconEx(lpdis->hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL);
340  break;
341  }
342  }
343  return TRUE;
344  }
345  }
346 
347  return FALSE;
348 }
349 
351  HWND hWndOwner,
352  LPWSTR lpstrFile,
353  UINT nMaxFile,
354  INT* lpdwIconIndex)
355 {
356  int res;
357  WCHAR szExpandedPath[MAX_PATH];
358 
359  // Initialize the dialog
360  PICK_ICON_CONTEXT IconContext = { NULL };
361  IconContext.Index = *lpdwIconIndex;
362  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), lpstrFile);
363  ExpandEnvironmentStringsW(lpstrFile, szExpandedPath, _countof(szExpandedPath));
364 
365  if (!szExpandedPath[0] ||
366  GetFileAttributesW(szExpandedPath) == INVALID_FILE_ATTRIBUTES)
367  {
368  if (szExpandedPath[0])
369  {
370  // No such file
371  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
372  strText.Format(IDS_FILE_NOT_FOUND, lpstrFile);
373  MessageBoxW(hWndOwner, strText, strTitle, MB_ICONWARNING);
374  }
375 
376  // Set the default value
377  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), s_pszDefaultPath);
378  }
379 
380  // Show the dialog
382  if (res)
383  {
384  // Store the selected icon
385  StringCchCopyW(lpstrFile, nMaxFile, IconContext.szPath);
386  *lpdwIconIndex = IconContext.Index;
387  }
388 
389  return res;
390 }
391 
392 /*************************************************************************
393  * RunFileDlg [internal]
394  *
395  * The Unicode function that is available as ordinal 61 on Windows NT/2000/XP/...
396  */
398  HWND hWndOwner,
399  HICON hIcon,
400  LPCWSTR lpstrDirectory,
401  LPCWSTR lpstrTitle,
402  LPCWSTR lpstrDescription,
403  UINT uFlags)
404 {
405  TRACE("\n");
406 
407  RUNFILEDLGPARAMS rfdp;
408  rfdp.hwndOwner = hWndOwner;
409  rfdp.hIcon = hIcon;
410  rfdp.lpstrDirectory = lpstrDirectory;
411  rfdp.lpstrTitle = lpstrTitle;
412  rfdp.lpstrDescription = lpstrDescription;
413  rfdp.uFlags = uFlags;
414 
416 }
417 
418 
419 /* find the directory that contains the file being run */
421 {
422  const WCHAR *src;
423  WCHAR *dest, *result, *result_end=NULL;
424  static const WCHAR dotexeW[] = L".exe";
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, dotexeW);
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 
504  switch (message)
505  {
506  case WM_INITDIALOG:
507  prfdp = (RUNFILEDLGPARAMS *)lParam;
509 
510  if (prfdp->lpstrTitle)
511  SetWindowTextW(hwnd, prfdp->lpstrTitle);
512  if (prfdp->lpstrDescription)
513  SetWindowTextW(GetDlgItem(hwnd, IDC_RUNDLG_DESCRIPTION), prfdp->lpstrDescription);
514  if (prfdp->uFlags & RFF_NOBROWSE)
515  {
517  ShowWindow(browse, SW_HIDE);
518  EnableWindow(browse, FALSE);
519  }
520  if (prfdp->uFlags & RFF_NOLABEL)
522  if (prfdp->uFlags & RFF_NOSEPARATEMEM)
523  {
524  FIXME("RFF_NOSEPARATEMEM not supported\n");
525  }
526 
527  /* Use the default Shell Run icon if no one is specified */
528  if (prfdp->hIcon == NULL)
530  /*
531  * NOTE: Starting Windows Vista, the "Run File" dialog gets a
532  * title icon that remains the same as the default one, even if
533  * the user specifies a custom icon.
534  * Since we currently imitate Windows 2003, therefore do not show
535  * any title icon.
536  */
537  // SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)prfdp->hIcon);
538  // SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon);
540 
541  FillList(GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH), NULL, 0, (prfdp->uFlags & RFF_NODEFAULT) == 0);
544  return TRUE;
545 
546  case WM_COMMAND:
547  switch (LOWORD(wParam))
548  {
549  case IDOK:
550  {
551  LRESULT lRet;
553  INT ic;
554  WCHAR *psz, *pszExpanded, *parent = NULL;
555  DWORD cchExpand;
556  NMRUNFILEDLGW nmrfd;
557 
558  ic = GetWindowTextLengthW(htxt);
559  if (ic == 0)
560  {
562  return TRUE;
563  }
564 
565  /*
566  * Allocate a new MRU entry, we need to add two characters
567  * for the terminating "\\1" part, then the NULL character.
568  */
569  psz = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (ic + 2 + 1)*sizeof(WCHAR));
570  if (!psz)
571  {
573  return TRUE;
574  }
575 
576  GetWindowTextW(htxt, psz, ic + 1);
577  StrTrimW(psz, L" \t");
578 
579  if (wcschr(psz, L'%') != NULL)
580  {
581  cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
582  pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
583  if (!pszExpanded)
584  {
585  HeapFree(GetProcessHeap(), 0, psz);
587  return TRUE;
588  }
589  ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
590  StrTrimW(pszExpanded, L" \t");
591  }
592  else
593  {
594  pszExpanded = psz;
595  }
596 
597  /*
598  * The precedence is the following: first the user-given
599  * current directory is used; if there is none, a current
600  * directory is computed if the RFF_CALCDIRECTORY is set,
601  * otherwise no current directory is defined.
602  */
603  LPCWSTR pszStartDir;
604  if (prfdp->lpstrDirectory)
605  pszStartDir = prfdp->lpstrDirectory;
606  else if (prfdp->uFlags & RFF_CALCDIRECTORY)
607  pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
608  else
609  pszStartDir = NULL;
610 
611  /* Hide the dialog for now on, we will show it up in case of retry */
613 
614  /*
615  * As shown by manual tests on Windows, modifying the contents
616  * of the notification structure will not modify what the
617  * Run-Dialog will use for the nShow parameter. However the
618  * lpFile and lpDirectory pointers are set to the buffers used
619  * by the Run-Dialog, as a consequence they can be modified by
620  * the notification receiver, as long as it respects the lengths
621  * of the buffers (to avoid buffer overflows).
622  */
623  nmrfd.hdr.code = RFN_VALIDATE;
624  nmrfd.hdr.hwndFrom = hwnd;
625  nmrfd.hdr.idFrom = 0;
626  nmrfd.lpFile = pszExpanded;
627  nmrfd.lpDirectory = pszStartDir;
628  nmrfd.nShow = SW_SHOWNORMAL;
629 
630  lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
631 
632  switch (lRet)
633  {
634  case RF_CANCEL:
636  break;
637 
638  case RF_OK:
639  if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
641  {
642  /* Call again GetWindowText in case the contents of the edit box has changed? */
643  GetWindowTextW(htxt, psz, ic + 1);
644  FillList(htxt, psz, ic + 2 + 1, FALSE);
645  EndDialog(hwnd, IDOK);
646  break;
647  }
648 
649  /* Fall-back */
650  case RF_RETRY:
651  default:
652  SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
653  /* Show back the dialog */
655  break;
656  }
657 
659  HeapFree(GetProcessHeap(), 0, psz);
660  if (psz != pszExpanded)
661  HeapFree(GetProcessHeap(), 0, pszExpanded);
662  return TRUE;
663  }
664 
665  case IDCANCEL:
667  return TRUE;
668 
669  case IDC_RUNDLG_BROWSE:
670  {
671  HMODULE hComdlg = NULL;
672  LPFNOFN ofnProc = NULL;
673  WCHAR szFName[1024] = {0};
674  WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
676 
679 
680  ZeroMemory(&ofn, sizeof(ofn));
681  ofn.lStructSize = sizeof(ofn);
682  ofn.hwndOwner = hwnd;
684  ofn.lpstrFile = szFName;
685  ofn.nMaxFile = _countof(szFName) - 1;
686  ofn.lpstrTitle = szCaption;
688  ofn.lpstrInitialDir = prfdp->lpstrDirectory;
689 
690  if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)) ||
691  NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
692  {
693  ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
695  return TRUE;
696  }
697 
698  if (ofnProc(&ofn))
699  {
705  }
706 
707  FreeLibrary(hComdlg);
708 
709  return TRUE;
710  }
711  case IDC_RUNDLG_EDITPATH:
712  {
713  if (HIWORD(wParam) == CBN_EDITCHANGE)
714  {
716  }
717  return TRUE;
718  }
719  }
720  return TRUE;
721  }
722  return FALSE;
723 }
724 
725 /*
726  * This function grabs the MRU list from the registry and fills the combo-list
727  * for the "Run" dialog above. fShowDefault is ignored if pszLatest != NULL.
728  */
729 // FIXME: Part of this code should be part of some MRUList API,
730 // that is scattered amongst shell32, comctl32 (?!) and comdlg32.
731 static void FillList(HWND hCb, LPWSTR pszLatest, UINT cchStr, BOOL fShowDefault)
732 {
733  HKEY hkey;
734  WCHAR *pszList = NULL, *pszCmd = NULL, *pszTmp = NULL, cMatch = 0, cMax = 0x60;
735  WCHAR szIndex[2] = L"-";
736  UINT cchLatest;
737  DWORD dwType, icList = 0, icCmd = 0;
738  LRESULT lRet;
739  UINT Nix;
740 
741  /*
742  * Retrieve the string length of pszLatest and check whether its buffer size
743  * (cchStr in number of characters) is large enough to add the terminating "\\1"
744  * (and the NULL character).
745  */
746  if (pszLatest)
747  {
748  cchLatest = wcslen(pszLatest);
749  if (cchStr < cchLatest + 2 + 1)
750  {
751  TRACE("pszLatest buffer is not large enough (%d) to hold the MRU terminator.\n", cchStr);
752  return;
753  }
754  }
755  else
756  {
757  cchStr = 0;
758  }
759 
760  SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
761 
763  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
765  if (lRet != ERROR_SUCCESS)
766  {
767  TRACE("Unable to open or create the RunMRU key, error %d\n", GetLastError());
768  return;
769  }
770 
771  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, &dwType, NULL, &icList);
772  if (lRet == ERROR_SUCCESS && dwType == REG_SZ && icList > sizeof(WCHAR))
773  {
774  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
775  if (!pszList)
776  {
777  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
778  goto Continue;
779  }
780  pszList[0] = L'\0';
781 
782  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList);
783  if (lRet != ERROR_SUCCESS)
784  {
785  TRACE("Unable to grab MRUList, error %d\n", GetLastError());
786  pszList[0] = L'\0';
787  }
788  }
789  else
790  {
791 Continue:
792  icList = sizeof(WCHAR);
793  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
794  if (!pszList)
795  {
796  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
797  RegCloseKey(hkey);
798  return;
799  }
800  pszList[0] = L'\0';
801  }
802 
803  /* Convert the number of bytes from MRUList into number of characters (== number of indices) */
804  icList /= sizeof(WCHAR);
805 
806  for (Nix = 0; Nix < icList - 1; Nix++)
807  {
808  if (pszList[Nix] > cMax)
809  cMax = pszList[Nix];
810 
811  szIndex[0] = pszList[Nix];
812 
813  lRet = RegQueryValueExW(hkey, szIndex, NULL, &dwType, NULL, &icCmd);
814  if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
815  {
816  TRACE("Unable to grab size of index, error %d\n", GetLastError());
817  continue;
818  }
819 
820  if (pszCmd)
821  {
822  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
823  if (!pszTmp)
824  {
825  TRACE("HeapReAlloc failed to reallocate %d bytes\n", icCmd);
826  continue;
827  }
828  pszCmd = pszTmp;
829  }
830  else
831  {
832  pszCmd = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icCmd);
833  if (!pszCmd)
834  {
835  TRACE("HeapAlloc failed to allocate %d bytes\n", icCmd);
836  continue;
837  }
838  }
839 
840  lRet = RegQueryValueExW(hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd);
841  if (lRet != ERROR_SUCCESS)
842  {
843  TRACE("Unable to grab index, error %d\n", GetLastError());
844  continue;
845  }
846 
847  /*
848  * Generally the command string will end up with "\\1".
849  * Find the last backslash in the string and NULL-terminate.
850  * Windows does not seem to check for what comes next, so that
851  * a command of the form:
852  * c:\\my_dir\\myfile.exe
853  * will be cut just after "my_dir", whereas a command of the form:
854  * c:\\my_dir\\myfile.exe\\1
855  * will be cut just after "myfile.exe".
856  */
857  pszTmp = wcsrchr(pszCmd, L'\\');
858  if (pszTmp)
859  *pszTmp = L'\0';
860 
861  /*
862  * In the following we try to add pszLatest to the MRU list.
863  * We suppose that our caller has already correctly allocated
864  * the string with enough space for us to append a "\\1".
865  *
866  * FIXME: TODO! (At the moment we don't append it!)
867  */
868 
869  if (pszLatest)
870  {
871  if (wcsicmp(pszCmd, pszLatest) == 0)
872  {
873  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
874  SetWindowTextW(hCb, pszCmd);
875  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
876 
877  cMatch = pszList[Nix];
878  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
879  pszList[0] = cMatch;
880  continue;
881  }
882  }
883 
884  if (icList - 1 != 26 || icList - 2 != Nix || cMatch || pszLatest == NULL)
885  {
886  SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
887  if (!Nix && fShowDefault)
888  {
889  SetWindowTextW(hCb, pszCmd);
890  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
891  }
892  }
893  else
894  {
895  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
896  SetWindowTextW(hCb, pszLatest);
897  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
898 
899  cMatch = pszList[Nix];
900  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
901  pszList[0] = cMatch;
902  szIndex[0] = cMatch;
903 
904  wcscpy(&pszLatest[cchLatest], L"\\1");
905  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
906  pszLatest[cchLatest] = L'\0';
907  }
908  }
909 
910  if (!cMatch && pszLatest != NULL)
911  {
912  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
913  SetWindowTextW(hCb, pszLatest);
914  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
915 
916  cMatch = ++cMax;
917 
918  if (pszList)
919  {
920  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszList, (++icList) * sizeof(WCHAR));
921  if (!pszTmp)
922  {
923  TRACE("HeapReAlloc failed to reallocate enough bytes\n");
924  goto Cleanup;
925  }
926  pszList = pszTmp;
927  }
928  else
929  {
930  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (++icList) * sizeof(WCHAR));
931  if (!pszList)
932  {
933  TRACE("HeapAlloc failed to allocate enough bytes\n");
934  goto Cleanup;
935  }
936  }
937 
938  memmove(&pszList[1], pszList, (icList - 1) * sizeof(WCHAR));
939  pszList[0] = cMatch;
940  szIndex[0] = cMatch;
941 
942  wcscpy(&pszLatest[cchLatest], L"\\1");
943  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
944  pszLatest[cchLatest] = L'\0';
945  }
946 
947 Cleanup:
948  RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (wcslen(pszList) + 1) * sizeof(WCHAR));
949 
950  HeapFree(GetProcessHeap(), 0, pszCmd);
951  HeapFree(GetProcessHeap(), 0, pszList);
952 
953  RegCloseKey(hkey);
954 }
955 
956 
957 /*************************************************************************
958  * ConfirmDialog [internal]
959  *
960  * Put up a confirm box, return TRUE if the user confirmed
961  */
962 static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
963 {
964  WCHAR Prompt[256];
965  WCHAR Title[256];
966 
967  LoadStringW(shell32_hInstance, PromptId, Prompt, _countof(Prompt));
969  return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO | MB_ICONQUESTION) == IDYES;
970 }
971 
973 
974 BOOL
976 {
978  static BOOL Initialized = FALSE;
979  if (!Initialized)
980  {
981  HMODULE mod = LoadLibraryW(L"msgina.dll");
983  Initialized = TRUE;
984  }
985 
986  HRESULT hr = E_FAIL;
987  if (ShellDimScreen)
988  hr = ShellDimScreen(pUnknown, hWindow);
989  return SUCCEEDED(hr);
990 }
991 
992 
993 /* Used to get the shutdown privilege */
994 static BOOL
995 EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
996 {
997  BOOL Success;
998  HANDLE hToken;
1000 
1003  &hToken);
1004  if (!Success) return Success;
1005 
1007  lpszPrivilegeName,
1008  &tp.Privileges[0].Luid);
1009  if (!Success) goto Quit;
1010 
1011  tp.PrivilegeCount = 1;
1012  tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1013 
1014  Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1015 
1016 Quit:
1017  CloseHandle(hToken);
1018  return Success;
1019 }
1020 
1021 /*************************************************************************
1022  * RestartDialogEx [SHELL32.730]
1023  */
1024 
1025 int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
1026 {
1027  TRACE("(%p)\n", hWndOwner);
1028 
1029  CComPtr<IUnknown> fadeHandler;
1030  HWND parent;
1031 
1032  if (!CallShellDimScreen(&fadeHandler, &parent))
1033  parent = hWndOwner;
1034 
1035  /* FIXME: use lpwstrReason */
1037  {
1038  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1039  ExitWindowsEx(EWX_REBOOT, uReason);
1040  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1041  }
1042 
1043  return 0;
1044 }
1045 
1046 /*************************************************************************
1047  * LogOffDialogProc
1048  *
1049  * NOTES: Used to make the Log Off dialog work
1050  */
1052 {
1053  switch (uMsg)
1054  {
1055  case WM_INITDIALOG:
1056  return TRUE;
1057 
1058  case WM_CLOSE:
1060  break;
1061 
1062 #if 0
1063  case WM_ACTIVATE:
1064  {
1065  if (LOWORD(wParam) == WA_INACTIVE)
1066  EndDialog(hwnd, 0);
1067  return FALSE;
1068  }
1069 #endif
1070 
1071  case WM_COMMAND:
1072  switch (LOWORD(wParam))
1073  {
1074  case IDOK:
1076  break;
1077 
1078  case IDCANCEL:
1080  break;
1081  }
1082  break;
1083 
1084  default:
1085  break;
1086  }
1087  return FALSE;
1088 }
1089 
1090 /*************************************************************************
1091  * LogoffWindowsDialog [SHELL32.54]
1092  */
1093 
1095 {
1096  CComPtr<IUnknown> fadeHandler;
1097  HWND parent;
1098 
1099  if (!CallShellDimScreen(&fadeHandler, &parent))
1100  parent = hWndOwner;
1101 
1103  return 0;
1104 }
1105 
1106 /*************************************************************************
1107  * RestartDialog [SHELL32.59]
1108  */
1109 
1110 int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
1111 {
1112  return RestartDialogEx(hWndOwner, lpstrReason, uFlags, 0);
1113 }
1114 
1115 /*************************************************************************
1116  * ExitWindowsDialog_backup
1117  *
1118  * NOTES
1119  * Used as a backup solution to shutdown the OS in case msgina.dll
1120  * somehow cannot be found.
1121  */
1123 {
1124  TRACE("(%p)\n", hWndOwner);
1125 
1127  {
1128  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1130  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1131  }
1132 }
1133 
1134 /*************************************************************************
1135  * ExitWindowsDialog [SHELL32.60]
1136  *
1137  * NOTES
1138  * exported by ordinal
1139  */
1140 /*
1141  * TODO:
1142  * - Implement the ability to show either the Welcome Screen or the classic dialog boxes based upon the
1143  * registry value: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType.
1144  */
1146 {
1147  typedef DWORD (WINAPI *ShellShFunc)(HWND hParent, WCHAR *Username, BOOL bHideLogoff);
1148  HINSTANCE msginaDll = LoadLibraryW(L"msgina.dll");
1149 
1150  TRACE("(%p)\n", hWndOwner);
1151 
1152  CComPtr<IUnknown> fadeHandler;
1153  HWND parent;
1154  if (!CallShellDimScreen(&fadeHandler, &parent))
1155  parent = hWndOwner;
1156 
1157  /* If the DLL cannot be found for any reason, then it simply uses a
1158  dialog box to ask if the user wants to shut down the computer. */
1159  if (!msginaDll)
1160  {
1161  TRACE("Unable to load msgina.dll.\n");
1163  return;
1164  }
1165 
1166  ShellShFunc pShellShutdownDialog = (ShellShFunc)GetProcAddress(msginaDll, "ShellShutdownDialog");
1167 
1168  if (pShellShutdownDialog)
1169  {
1170  /* Actually call the function */
1171  DWORD returnValue = pShellShutdownDialog(parent, NULL, FALSE);
1172 
1173  switch (returnValue)
1174  {
1175  case 0x01: /* Log off user */
1176  {
1178  break;
1179  }
1180  case 0x02: /* Shut down */
1181  {
1182  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1184  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1185  break;
1186  }
1187  case 0x03: /* Install Updates/Shutdown (?) */
1188  {
1189  break;
1190  }
1191  case 0x04: /* Reboot */
1192  {
1193  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1195  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1196  break;
1197  }
1198  case 0x10: /* Sleep */
1199  {
1200  if (IsPwrSuspendAllowed())
1201  {
1202  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1204  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1205  }
1206  break;
1207  }
1208  case 0x40: /* Hibernate */
1209  {
1210  if (IsPwrHibernateAllowed())
1211  {
1212  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1214  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1215  }
1216  break;
1217  }
1218  /* If the option is any other value */
1219  default:
1220  break;
1221  }
1222  }
1223  else
1224  {
1225  /* If the function cannot be found, then revert to using the backup solution */
1226  TRACE("Unable to find the 'ShellShutdownDialog' function");
1228  }
1229 
1230  FreeLibrary(msginaDll);
1231 }
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
Definition: powrprof.c:681
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define LB_SETCURSEL
Definition: winuser.h:2024
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:316
#define HRESULT
Definition: msvc.h:9
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define STM_SETICON
Definition: winuser.h:2053
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:294
WINE_DEFAULT_DEBUG_CHANNEL(shell)
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
Definition: tftpd.h:59
#define RT_GROUP_ICON
Definition: pedump.c:375
static HICON
Definition: imagelist.c:84
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
static void FillList(HWND, LPWSTR, UINT, BOOL)
Definition: dialogs.cpp:731
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:398
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
Definition: powrprof.c:488
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define LB_FINDSTRINGEXACT
Definition: winuser.h:1996
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2022
#define IDC_RUNDLG_ICON
Definition: shresdef.h:293
HRESULT hr
Definition: shlfolder.c:183
#define IDYES
Definition: winuser.h:829
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LB_ADDSTRING
Definition: winuser.h:1992
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND hwndOwner
Definition: commdlg.h:330
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define SW_HIDE
Definition: winuser.h:762
#define _countof(array)
Definition: fontsub.cpp:30
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:286
static BOOL DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
Definition: dialogs.cpp:92
#define IDS_SHUTDOWN_PROMPT
Definition: shresdef.h:77
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
tShellDimScreen ShellDimScreen
#define INT
Definition: polytest.cpp:20
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
#define CALLBACK
Definition: compat.h:27
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
Definition: dialogs.cpp:1025
GLdouble n
Definition: glext.h:7729
LONG top
Definition: windef.h:292
OPENFILENAME ofn
Definition: main.cpp:37
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LPCWSTR lpDirectory
Definition: undocshell.h:135
HWND WINAPI SetFocus(_In_opt_ HWND)
#define RF_OK
Definition: undocshell.h:144
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2645
HICON * phIcons
Definition: dialogs.cpp:53
#define SendDlgItemMessage
Definition: winuser.h:5708
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define GetWindowLongPtrW
Definition: winuser.h:4698
uint16_t * PWCHAR
Definition: typedefs.h:54
LONG left
Definition: windef.h:291
UINT uFlags
Definition: api.c:60
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_RUNDLG_BROWSE_ERROR
Definition: shresdef.h:184
int32_t INT_PTR
Definition: typedefs.h:62
#define EWX_REBOOT
Definition: winuser.h:633
#define IDS_RESTART_TITLE
Definition: shresdef.h:74
#define E_FAIL
Definition: ddrawi.h:102
#define BOOL
Definition: nt_native.h:43
#define RF_CANCEL
Definition: undocshell.h:145
#define LBN_SELCHANGE
Definition: winuser.h:2036
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_WINDOW
Definition: winuser.h:908
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static void EnableOkButtonFromEditContents(HWND hwnd)
Definition: dialogs.cpp:477
#define EWX_LOGOFF
Definition: winuser.h:631
static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
Definition: dialogs.cpp:420
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:1094
#define MB_ICONWARNING
Definition: winuser.h:780
DWORD nMaxFile
Definition: commdlg.h:337
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
UINT code
Definition: winuser.h:3112
LPCWSTR lpstrDescription
Definition: dialogs.cpp:30
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
#define IDC_PICKICON_LIST
Definition: shresdef.h:313
HMODULE hLibrary
Definition: dialogs.cpp:48
#define LB_RESETCONTENT
Definition: winuser.h:2016
#define IDC_RUNDLG_DESCRIPTION
Definition: shresdef.h:291
struct PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define MB_YESNO
Definition: winuser.h:811
#define EWX_SHUTDOWN
Definition: winuser.h:634
static const WCHAR szText[]
Definition: dialog.c:139
#define LB_ERR
Definition: winuser.h:2386
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:350
static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:157
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:873
UINT_PTR idFrom
Definition: winuser.h:3111
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IDS_RUNDLG_BROWSE_FILTER
Definition: shresdef.h:186
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4221
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
Definition: dialogs.cpp:56
#define CB_ADDSTRING
Definition: winuser.h:1897
#define IDS_PICK_ICON_FILTER
Definition: shresdef.h:317
#define CB_INSERTSTRING
Definition: winuser.h:1918
#define IDC_RUNDLG_LABEL
Definition: shresdef.h:295
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
#define RFN_VALIDATE
Definition: undocshell.h:121
#define MB_ICONQUESTION
Definition: winuser.h:783
LONG_PTR LPARAM
Definition: windef.h:208
LPTSTR szFilter
Definition: mplay32.c:30
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define SECL_ALLOW_NONEXE
#define IDD_PICK_ICON
Definition: shresdef.h:312
#define CX_ITEM
Definition: dialogs.cpp:173
GLuint index
Definition: glext.h:6031
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
void WINAPI RunFileDlg(HWND hWndOwner, HICON hIcon, LPCWSTR lpstrDirectory, LPCWSTR lpstrTitle, LPCWSTR lpstrDescription, UINT uFlags)
Definition: dialogs.cpp:397
#define LB_GETCOUNT
Definition: winuser.h:1999
#define CB_RESETCONTENT
Definition: winuser.h:1920
#define CY_ICON
Definition: dialogs.cpp:170
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
#define WM_DESTROY
Definition: winuser.h:1591
static INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM)
Definition: dialogs.cpp:500
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
Definition: dialogs.cpp:1110
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
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:4917
#define IDC_BUTTON_PATH
Definition: shresdef.h:314
#define ODA_DRAWENTIRE
Definition: winuser.h:2496
#define RFF_NOSEPARATEMEM
Definition: run.h:50
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
static const WCHAR Title[]
Definition: oid.c:1259
#define GetProcessHeap()
Definition: compat.h:395
#define CBN_EDITCHANGE
Definition: winuser.h:1936
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
Definition: dialogs.cpp:962
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define IDS_SHUTDOWN_TITLE
Definition: shresdef.h:76
#define LB_SETTOPINDEX
Definition: winuser.h:2031
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
r parent
Definition: btrfs.c:2659
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPI ExitWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1145
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:1997
LONG HRESULT
Definition: typedefs.h:77
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define WM_CLOSE
Definition: winuser.h:1603
LPCWSTR lpFile
Definition: undocshell.h:134
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
#define EM_GETMODIFY
Definition: winuser.h:1955
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define WINAPI
Definition: msvc.h:8
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static const UCHAR Index[8]
Definition: usbohci.c:18
int ShellMessageBoxW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,...)
Definition: shellord.c:337
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_MEASUREITEM
Definition: winuser.h:1628
HRESULT WINAPI ShellExecCmdLine(HWND hwnd, LPCWSTR pwszCommand, LPCWSTR pwszStartDir, int nShow, LPVOID pUnused, DWORD dwSeclFlags)
Definition: shlexec.cpp:2377
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define RFF_NODEFAULT
Definition: run.h:47
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define IDC_EDIT_PATH
Definition: shresdef.h:315
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:995
#define LBN_DBLCLK
Definition: winuser.h:2032
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:75
#define IDS_NO_ICONS
Definition: shresdef.h:284
WCHAR szPath[MAX_PATH]
Definition: dialogs.cpp:50
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
volatile int Continue
Definition: gdblib.c:102
#define IDD_RUN
Definition: shresdef.h:290
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
struct _PICK_ICON_CONTEXT PICK_ICON_CONTEXT
INT_PTR CALLBACK LogOffDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1051
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define RFF_NOLABEL
Definition: run.h:49
HMODULE hLibrary
Definition: odbccp32.c:12
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:285
#define DI_NORMAL
Definition: wingdi.h:72
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define EM_SETMODIFY
Definition: winuser.h:1974
GLenum src
Definition: glext.h:6340
#define WM_COMMAND
Definition: winuser.h:1716
static const WCHAR Cleanup[]
Definition: register.c:80
#define IDS_RESTART_PROMPT
Definition: shresdef.h:75
HWND hwndFrom
Definition: winuser.h:3110
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define wcsicmp
Definition: string.h:1152
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define CX_ICON
Definition: dialogs.cpp:169
#define ERR(fmt,...)
Definition: debug.h:109
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
HRESULT(WINAPI * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
Definition: dialogs.cpp:972
#define RFF_CALCDIRECTORY
Definition: run.h:48
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define WM_ACTIVATE
Definition: winuser.h:1594
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
LPSTR lpstrFile
Definition: commdlg.h:336
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
HICON hIcon
Definition: msconfig.c:44
#define CB_SETEDITSEL
Definition: winuser.h:1924
LPCWSTR szPath
Definition: env.c:35
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:393
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define LB_GETCURSEL
Definition: winuser.h:2000
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define MB_OK
Definition: winuser.h:784
BOOL(WINAPI * LPFNOFN)(OPENFILENAMEW *)
Definition: dialogs.cpp:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
LPCWSTR lpstrTitle
Definition: dialogs.cpp:29
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static const LPCWSTR s_pszDefaultPath
Definition: dialogs.cpp:155
INT_PTR CALLBACK PickIconProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:176
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
#define WM_DRAWITEM
Definition: winuser.h:1627
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define SendMessage
Definition: winuser.h:5709
HMODULE hLibrary
Definition: dialog.c:549
GLuint res
Definition: glext.h:9613
#define IDC_RUNDLG_BROWSE
Definition: resource.h:7
#define IDS_RUNDLG_BROWSE_CAPTION
Definition: shresdef.h:185
#define HIWORD(l)
Definition: typedefs.h:246
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define RFF_NOBROWSE
Definition: run.h:46
CAtlStringW CStringW
Definition: atlstr.h:130
LPCWSTR lpstrDirectory
Definition: dialogs.cpp:28
#define GetProcAddress(x, y)
Definition: compat.h:410
static char * dest
Definition: rtl.c:135
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define WA_INACTIVE
Definition: winuser.h:2576
EXTERN_C int WINAPI LogoffWindowsDialog(HWND hWndOwner)
Definition: dialogs.cpp:1094
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID ExitWindowsDialog_backup(HWND hWndOwner)
Definition: dialogs.cpp:1122
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define EXTERN_C
Definition: basetyps.h:12
#define IDD_LOG_OFF
Definition: shresdef.h:456
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define OFN_ENABLESIZING
Definition: commdlg.h:101
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:975
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450
GLuint64EXT * result
Definition: glext.h:11304
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
#define CY_ITEM
Definition: dialogs.cpp:174
#define ODA_SELECT
Definition: winuser.h:2497
#define WM_NOTIFY
Definition: richedit.h:61
#define IDI_SHELL_RUN
Definition: shresdef.h:488
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HMODULE hModule
Definition: animate.c:44
static int mod
Definition: i386-dis.c:1273
DWORD Flags
Definition: commdlg.h:342
#define REG_SZ
Definition: layer.c:22
#define RF_RETRY
Definition: undocshell.h:146