ReactOS  0.4.15-dev-1200-gc3b3fcd
dialogs.cpp File Reference
#include "precomp.h"
Include dependency graph for dialogs.cpp:

Go to the source code of this file.

Classes

struct  RUNFILEDLGPARAMS
 
struct  PICK_ICON_CONTEXT
 

Macros

#define CX_ICON   GetSystemMetrics(SM_CXICON)
 
#define CY_ICON   GetSystemMetrics(SM_CYICON)
 
#define CX_ITEM   (CX_ICON + 4)
 
#define CY_ITEM   (CY_ICON + 12)
 

Typedefs

typedef BOOL(WINAPILPFNOFN) (OPENFILENAMEW *)
 
typedef struct PICK_ICON_CONTEXTPPICK_ICON_CONTEXT
 
typedef HRESULT(WINAPItShellDimScreen) (IUnknown **Unknown, HWND *hWindow)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static INT_PTR CALLBACK RunDlgProc (HWND, UINT, WPARAM, LPARAM)
 
static void FillList (HWND, LPWSTR, UINT, BOOL)
 
BOOL CALLBACK EnumPickIconResourceProc (HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
 
static void DestroyIconList (HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
 
static BOOL DoLoadIcons (HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
 
static void NoIconsInFile (HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
 
INT_PTR CALLBACK PickIconProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI PickIconDlg (HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
 
void WINAPI RunFileDlg (HWND hWndOwner, HICON hIcon, LPCWSTR lpstrDirectory, LPCWSTR lpstrTitle, LPCWSTR lpstrDescription, UINT uFlags)
 
static LPWSTR RunDlg_GetParentDir (LPCWSTR cmdline)
 
static void EnableOkButtonFromEditContents (HWND hwnd)
 
static BOOL ConfirmDialog (HWND hWndOwner, UINT PromptId, UINT TitleId)
 
BOOL CallShellDimScreen (IUnknown **pUnknown, HWND *hWindow)
 
static BOOL EnablePrivilege (LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
 
int WINAPI RestartDialogEx (HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
 
INT_PTR CALLBACK LogOffDialogProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
EXTERN_C int WINAPI LogoffWindowsDialog (HWND hWndOwner)
 
int WINAPI RestartDialog (HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
 
VOID ExitWindowsDialog_backup (HWND hWndOwner)
 
void WINAPI ExitWindowsDialog (HWND hWndOwner)
 

Variables

static const LPCWSTR s_pszDefaultPath = L"%SystemRoot%\\system32\\shell32.dll"
 

Macro Definition Documentation

◆ CX_ICON

Definition at line 170 of file dialogs.cpp.

◆ CX_ITEM

#define CX_ITEM   (CX_ICON + 4)

Definition at line 174 of file dialogs.cpp.

◆ CY_ICON

Definition at line 171 of file dialogs.cpp.

◆ CY_ITEM

#define CY_ITEM   (CY_ICON + 12)

Definition at line 175 of file dialogs.cpp.

Typedef Documentation

◆ LPFNOFN

typedef BOOL(WINAPI * LPFNOFN) (OPENFILENAMEW *)

Definition at line 35 of file dialogs.cpp.

◆ PPICK_ICON_CONTEXT

◆ tShellDimScreen

typedef HRESULT(WINAPI * tShellDimScreen) (IUnknown **Unknown, HWND *hWindow)

Definition at line 992 of file dialogs.cpp.

Function Documentation

◆ CallShellDimScreen()

BOOL CallShellDimScreen ( IUnknown **  pUnknown,
HWND hWindow 
)

Definition at line 995 of file dialogs.cpp.

996 {
998  static BOOL Initialized = FALSE;
999  if (!Initialized)
1000  {
1001  HMODULE mod = LoadLibraryW(L"msgina.dll");
1003  Initialized = TRUE;
1004  }
1005 
1006  HRESULT hr = E_FAIL;
1007  if (ShellDimScreen)
1008  hr = ShellDimScreen(pUnknown, hWindow);
1009  return SUCCEEDED(hr);
1010 }
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
tShellDimScreen ShellDimScreen
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:606
const char * LPCSTR
Definition: xmlstorage.h:183
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR L[]
Definition: oid.c:1250
HRESULT(WINAPI * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
Definition: dialogs.cpp:992
#define GetProcAddress(x, y)
Definition: compat.h:612
#define SUCCEEDED(hr)
Definition: intsafe.h:49
static int mod
Definition: i386-dis.c:1273

Referenced by ExitWindowsDialog(), LogoffWindowsDialog(), and RestartDialogEx().

◆ ConfirmDialog()

static BOOL ConfirmDialog ( HWND  hWndOwner,
UINT  PromptId,
UINT  TitleId 
)
static

Definition at line 982 of file dialogs.cpp.

983 {
984  WCHAR Prompt[256];
985  WCHAR Title[256];
986 
987  LoadStringW(shell32_hInstance, PromptId, Prompt, _countof(Prompt));
989  return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO | MB_ICONQUESTION) == IDYES;
990 }
#define IDYES
Definition: winuser.h:829
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_YESNO
Definition: winuser.h:811
#define MB_ICONQUESTION
Definition: winuser.h:783
static const WCHAR Title[]
Definition: oid.c:1259
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define shell32_hInstance

Referenced by ExitWindowsDialog_backup(), and RestartDialogEx().

◆ DestroyIconList()

static void DestroyIconList ( HWND  hDlgCtrl,
PPICK_ICON_CONTEXT  pIconContext 
)
static

Definition at line 76 of file dialogs.cpp.

77 {
78  int count;
79  int index;
80 
81  count = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
82  if (count == LB_ERR)
83  return;
84 
85  for(index = 0; index < count; index++)
86  {
87  DestroyIcon(pIconContext->phIcons[index]);
88  pIconContext->phIcons[index] = NULL;
89  }
90 }
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define LB_ERR
Definition: winuser.h:2407
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define LB_GETCOUNT
Definition: winuser.h:2020
#define index(s, c)
Definition: various.h:29
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DoLoadIcons(), and PickIconProc().

◆ DoLoadIcons()

static BOOL DoLoadIcons ( HWND  hwndDlg,
PPICK_ICON_CONTEXT  pIconContext,
LPCWSTR  pszFile 
)
static

Definition at line 93 of file dialogs.cpp.

94 {
95  WCHAR szExpandedPath[MAX_PATH];
96 
97  // Destroy previous icons
98  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
99  SendMessageW(pIconContext->hDlgCtrl, LB_RESETCONTENT, 0, 0);
100  delete[] pIconContext->phIcons;
101 
102  // Store the path
103  StringCchCopyW(pIconContext->szPath, _countof(pIconContext->szPath), pszFile);
104  ExpandEnvironmentStringsW(pszFile, szExpandedPath, _countof(szExpandedPath));
105 
106  // Load the module if possible
108  if (pIconContext->hLibrary)
109  FreeLibrary(pIconContext->hLibrary);
110  pIconContext->hLibrary = hLibrary;
111 
112  if (pIconContext->hLibrary)
113  {
114  // Load the icons from the module
115  pIconContext->nIcons = ExtractIconExW(szExpandedPath, -1, NULL, NULL, 0);
116  pIconContext->phIcons = new HICON[pIconContext->nIcons];
117 
118  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
119  {
121  }
122  else
123  {
124  pIconContext->nIcons = 0;
125  }
126  }
127  else
128  {
129  // .ico file
130  pIconContext->nIcons = 1;
131  pIconContext->phIcons = new HICON[1];
132 
133  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
134  {
135  SendMessageW(pIconContext->hDlgCtrl, LB_ADDSTRING, 0, 0);
136  }
137  else
138  {
139  pIconContext->nIcons = 0;
140  }
141  }
142 
143  // Set the text and reset the edit control's modification flag
144  SetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath);
146 
147  if (pIconContext->nIcons == 0)
148  {
149  delete[] pIconContext->phIcons;
150  pIconContext->phIcons = NULL;
151  }
152 
153  return (pIconContext->nIcons > 0);
154 }
#define RT_GROUP_ICON
Definition: pedump.c:375
static HICON
Definition: imagelist.c:84
#define LB_ADDSTRING
Definition: winuser.h:2013
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define SendDlgItemMessage
Definition: winuser.h:5817
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define LB_RESETCONTENT
Definition: winuser.h:2037
#define FALSE
Definition: types.h:117
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:872
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
Definition: dialogs.cpp:57
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define IDC_EDIT_PATH
Definition: shresdef.h:341
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:76
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
HMODULE hLibrary
Definition: odbccp32.c:12
#define EM_SETMODIFY
Definition: winuser.h:1995
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HMODULE hLibrary
Definition: dialog.c:549

Referenced by NoIconsInFile(), and PickIconProc().

◆ EnableOkButtonFromEditContents()

static void EnableOkButtonFromEditContents ( HWND  hwnd)
static

Definition at line 478 of file dialogs.cpp.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:318
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
GLdouble n
Definition: glext.h:7729
uint16_t * PWCHAR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by RunDlgProc().

◆ EnablePrivilege()

static BOOL EnablePrivilege ( LPCWSTR  lpszPrivilegeName,
BOOL  bEnablePrivilege 
)
static

Definition at line 1015 of file dialogs.cpp.

1016 {
1017  BOOL Success;
1018  HANDLE hToken;
1020 
1023  &hToken);
1024  if (!Success) return Success;
1025 
1027  lpszPrivilegeName,
1028  &tp.Privileges[0].Luid);
1029  if (!Success) goto Quit;
1030 
1031  tp.PrivilegeCount = 1;
1032  tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1033 
1034  Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1035 
1036 Quit:
1037  CloseHandle(hToken);
1038  return Success;
1039 }
#define CloseHandle
Definition: compat.h:598
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2930
#define GetCurrentProcess()
Definition: compat.h:618
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

Referenced by ExitWindowsDialog(), ExitWindowsDialog_backup(), and RestartDialogEx().

◆ EnumPickIconResourceProc()

BOOL CALLBACK EnumPickIconResourceProc ( HMODULE  hModule,
LPCWSTR  lpszType,
LPWSTR  lpszName,
LONG_PTR  lParam 
)

Definition at line 57 of file dialogs.cpp.

61 {
63  HWND hDlgCtrl = pIconContext->hDlgCtrl;
64 
65  if (IS_INTRESOURCE(lpszName))
66  lParam = LOWORD(lpszName);
67  else
68  lParam = -1;
69 
70  SendMessageW(hDlgCtrl, LB_ADDSTRING, 0, lParam);
71 
72  return TRUE;
73 }
#define LB_ADDSTRING
Definition: winuser.h:2013
#define TRUE
Definition: types.h:120
struct PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DoLoadIcons().

◆ ExitWindowsDialog()

void WINAPI ExitWindowsDialog ( HWND  hWndOwner)

Definition at line 1165 of file dialogs.cpp.

1166 {
1167  typedef DWORD (WINAPI *ShellShFunc)(HWND hParent, WCHAR *Username, BOOL bHideLogoff);
1168  HINSTANCE msginaDll = LoadLibraryW(L"msgina.dll");
1169 
1170  TRACE("(%p)\n", hWndOwner);
1171 
1172  CComPtr<IUnknown> fadeHandler;
1173  HWND parent;
1174  if (!CallShellDimScreen(&fadeHandler, &parent))
1175  parent = hWndOwner;
1176 
1177  /* If the DLL cannot be found for any reason, then it simply uses a
1178  dialog box to ask if the user wants to shut down the computer. */
1179  if (!msginaDll)
1180  {
1181  TRACE("Unable to load msgina.dll.\n");
1183  return;
1184  }
1185 
1186  ShellShFunc pShellShutdownDialog = (ShellShFunc)GetProcAddress(msginaDll, "ShellShutdownDialog");
1187 
1188  if (pShellShutdownDialog)
1189  {
1190  /* Actually call the function */
1191  DWORD returnValue = pShellShutdownDialog(parent, NULL, FALSE);
1192 
1193  switch (returnValue)
1194  {
1195  case 0x01: /* Log off user */
1196  {
1198  break;
1199  }
1200  case 0x02: /* Shut down */
1201  {
1202  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1204  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1205  break;
1206  }
1207  case 0x03: /* Install Updates/Shutdown (?) */
1208  {
1209  break;
1210  }
1211  case 0x04: /* Reboot */
1212  {
1213  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1215  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1216  break;
1217  }
1218  case 0x10: /* Sleep */
1219  {
1220  if (IsPwrSuspendAllowed())
1221  {
1222  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1224  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1225  }
1226  break;
1227  }
1228  case 0x40: /* Hibernate */
1229  {
1230  if (IsPwrHibernateAllowed())
1231  {
1232  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1234  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1235  }
1236  break;
1237  }
1238  /* If the option is any other value */
1239  default:
1240  break;
1241  }
1242  }
1243  else
1244  {
1245  /* If the function cannot be found, then revert to using the backup solution */
1246  TRACE("Unable to find the 'ShellShutdownDialog' function");
1248  }
1249 
1250  FreeLibrary(msginaDll);
1251 }
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
Definition: powrprof.c:681
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
Definition: powrprof.c:488
#define TRUE
Definition: types.h:120
#define EWX_REBOOT
Definition: winuser.h:633
#define DWORD
Definition: nt_native.h:44
#define EWX_LOGOFF
Definition: winuser.h:631
#define FALSE
Definition: types.h:117
#define EWX_SHUTDOWN
Definition: winuser.h:634
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:606
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:607
r parent
Definition: btrfs.c:2944
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1015
static const WCHAR L[]
Definition: oid.c:1250
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define GetProcAddress(x, y)
Definition: compat.h:612
VOID ExitWindowsDialog_backup(HWND hWndOwner)
Definition: dialogs.cpp:1142
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:995
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450

Referenced by CTrayWindow::DoExitWindows(), ShowExitWindowsDialog(), and CShellDispatch::ShutdownWindows().

◆ ExitWindowsDialog_backup()

VOID ExitWindowsDialog_backup ( HWND  hWndOwner)

Definition at line 1142 of file dialogs.cpp.

1143 {
1144  TRACE("(%p)\n", hWndOwner);
1145 
1147  {
1148  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1150  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1151  }
1152 }
#define TRUE
Definition: types.h:120
#define IDS_SHUTDOWN_PROMPT
Definition: shresdef.h:77
#define FALSE
Definition: types.h:117
#define EWX_SHUTDOWN
Definition: winuser.h:634
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
Definition: dialogs.cpp:982
#define IDS_SHUTDOWN_TITLE
Definition: shresdef.h:76
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1015
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)

Referenced by ExitWindowsDialog().

◆ FillList()

static void FillList ( HWND  hCb,
LPWSTR  pszLatest,
UINT  cchStr,
BOOL  fShowDefault 
)
static

Definition at line 751 of file dialogs.cpp.

752 {
753  HKEY hkey;
754  WCHAR *pszList = NULL, *pszCmd = NULL, *pszTmp = NULL, cMatch = 0, cMax = 0x60;
755  WCHAR szIndex[2] = L"-";
756  UINT cchLatest;
757  DWORD dwType, icList = 0, icCmd = 0;
758  LRESULT lRet;
759  UINT Nix;
760 
761  /*
762  * Retrieve the string length of pszLatest and check whether its buffer size
763  * (cchStr in number of characters) is large enough to add the terminating "\\1"
764  * (and the NULL character).
765  */
766  if (pszLatest)
767  {
768  cchLatest = wcslen(pszLatest);
769  if (cchStr < cchLatest + 2 + 1)
770  {
771  TRACE("pszLatest buffer is not large enough (%d) to hold the MRU terminator.\n", cchStr);
772  return;
773  }
774  }
775  else
776  {
777  cchStr = 0;
778  }
779 
780  SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
781 
783  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
785  if (lRet != ERROR_SUCCESS)
786  {
787  TRACE("Unable to open or create the RunMRU key, error %d\n", GetLastError());
788  return;
789  }
790 
791  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, &dwType, NULL, &icList);
792  if (lRet == ERROR_SUCCESS && dwType == REG_SZ && icList > sizeof(WCHAR))
793  {
794  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
795  if (!pszList)
796  {
797  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
798  goto Continue;
799  }
800  pszList[0] = L'\0';
801 
802  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList);
803  if (lRet != ERROR_SUCCESS)
804  {
805  TRACE("Unable to grab MRUList, error %d\n", GetLastError());
806  pszList[0] = L'\0';
807  }
808  }
809  else
810  {
811 Continue:
812  icList = sizeof(WCHAR);
813  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
814  if (!pszList)
815  {
816  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
817  RegCloseKey(hkey);
818  return;
819  }
820  pszList[0] = L'\0';
821  }
822 
823  /* Convert the number of bytes from MRUList into number of characters (== number of indices) */
824  icList /= sizeof(WCHAR);
825 
826  for (Nix = 0; Nix < icList - 1; Nix++)
827  {
828  if (pszList[Nix] > cMax)
829  cMax = pszList[Nix];
830 
831  szIndex[0] = pszList[Nix];
832 
833  lRet = RegQueryValueExW(hkey, szIndex, NULL, &dwType, NULL, &icCmd);
834  if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
835  {
836  TRACE("Unable to grab size of index, error %d\n", GetLastError());
837  continue;
838  }
839 
840  if (pszCmd)
841  {
842  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
843  if (!pszTmp)
844  {
845  TRACE("HeapReAlloc failed to reallocate %d bytes\n", icCmd);
846  continue;
847  }
848  pszCmd = pszTmp;
849  }
850  else
851  {
852  pszCmd = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icCmd);
853  if (!pszCmd)
854  {
855  TRACE("HeapAlloc failed to allocate %d bytes\n", icCmd);
856  continue;
857  }
858  }
859 
860  lRet = RegQueryValueExW(hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd);
861  if (lRet != ERROR_SUCCESS)
862  {
863  TRACE("Unable to grab index, error %d\n", GetLastError());
864  continue;
865  }
866 
867  /*
868  * Generally the command string will end up with "\\1".
869  * Find the last backslash in the string and NULL-terminate.
870  * Windows does not seem to check for what comes next, so that
871  * a command of the form:
872  * c:\\my_dir\\myfile.exe
873  * will be cut just after "my_dir", whereas a command of the form:
874  * c:\\my_dir\\myfile.exe\\1
875  * will be cut just after "myfile.exe".
876  */
877  pszTmp = wcsrchr(pszCmd, L'\\');
878  if (pszTmp)
879  *pszTmp = L'\0';
880 
881  /*
882  * In the following we try to add pszLatest to the MRU list.
883  * We suppose that our caller has already correctly allocated
884  * the string with enough space for us to append a "\\1".
885  *
886  * FIXME: TODO! (At the moment we don't append it!)
887  */
888 
889  if (pszLatest)
890  {
891  if (wcsicmp(pszCmd, pszLatest) == 0)
892  {
893  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
894  SetWindowTextW(hCb, pszCmd);
895  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
896 
897  cMatch = pszList[Nix];
898  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
899  pszList[0] = cMatch;
900  continue;
901  }
902  }
903 
904  if (icList - 1 != 26 || icList - 2 != Nix || cMatch || pszLatest == NULL)
905  {
906  SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
907  if (!Nix && fShowDefault)
908  {
909  SetWindowTextW(hCb, pszCmd);
910  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
911  }
912  }
913  else
914  {
915  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
916  SetWindowTextW(hCb, pszLatest);
917  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
918 
919  cMatch = pszList[Nix];
920  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
921  pszList[0] = cMatch;
922  szIndex[0] = cMatch;
923 
924  wcscpy(&pszLatest[cchLatest], L"\\1");
925  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
926  pszLatest[cchLatest] = L'\0';
927  }
928  }
929 
930  if (!cMatch && pszLatest != NULL)
931  {
932  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
933  SetWindowTextW(hCb, pszLatest);
934  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
935 
936  cMatch = ++cMax;
937 
938  if (pszList)
939  {
940  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszList, (++icList) * sizeof(WCHAR));
941  if (!pszTmp)
942  {
943  TRACE("HeapReAlloc failed to reallocate enough bytes\n");
944  goto Cleanup;
945  }
946  pszList = pszTmp;
947  }
948  else
949  {
950  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (++icList) * sizeof(WCHAR));
951  if (!pszList)
952  {
953  TRACE("HeapAlloc failed to allocate enough bytes\n");
954  goto Cleanup;
955  }
956  }
957 
958  memmove(&pszList[1], pszList, (icList - 1) * sizeof(WCHAR));
959  pszList[0] = cMatch;
960  szIndex[0] = cMatch;
961 
962  wcscpy(&pszLatest[cchLatest], L"\\1");
963  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
964  pszLatest[cchLatest] = L'\0';
965  }
966 
967 Cleanup:
968  RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (wcslen(pszList) + 1) * sizeof(WCHAR));
969 
970  HeapFree(GetProcessHeap(), 0, pszCmd);
971  HeapFree(GetProcessHeap(), 0, pszList);
972 
973  RegCloseKey(hkey);
974 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
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:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#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:4895
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wcsicmp
Definition: compat.h:15
volatile int Continue
Definition: gdblib.c:102
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define wcsrchr
Definition: compat.h:16
static const WCHAR Cleanup[]
Definition: register.c:80
#define CB_SETEDITSEL
Definition: winuser.h:1945
#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:593
unsigned int UINT
Definition: ndis.h:50
LONG_PTR LRESULT
Definition: windef.h:209
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

Referenced by RunDlgProc().

◆ LogOffDialogProc()

INT_PTR CALLBACK LogOffDialogProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1071 of file dialogs.cpp.

1072 {
1073  switch (uMsg)
1074  {
1075  case WM_INITDIALOG:
1076  return TRUE;
1077 
1078  case WM_CLOSE:
1080  break;
1081 
1082 #if 0
1083  case WM_ACTIVATE:
1084  {
1085  if (LOWORD(wParam) == WA_INACTIVE)
1086  EndDialog(hwnd, 0);
1087  return FALSE;
1088  }
1089 #endif
1090 
1091  case WM_COMMAND:
1092  switch (LOWORD(wParam))
1093  {
1094  case IDOK:
1096  break;
1097 
1098  case IDCANCEL:
1100  break;
1101  }
1102  break;
1103 
1104  default:
1105  break;
1106  }
1107  return FALSE;
1108 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EWX_LOGOFF
Definition: winuser.h:631
#define FALSE
Definition: types.h:117
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define WM_ACTIVATE
Definition: winuser.h:1594
#define WA_INACTIVE
Definition: winuser.h:2597
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82

Referenced by LogoffWindowsDialog().

◆ LogoffWindowsDialog()

EXTERN_C int WINAPI LogoffWindowsDialog ( HWND  hWndOwner)

Definition at line 1114 of file dialogs.cpp.

1115 {
1116  CComPtr<IUnknown> fadeHandler;
1117  HWND parent;
1118 
1119  if (!CallShellDimScreen(&fadeHandler, &parent))
1120  parent = hWndOwner;
1121 
1123  return 0;
1124 }
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4374
r parent
Definition: btrfs.c:2944
INT_PTR CALLBACK LogOffDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1071
#define shell32_hInstance
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDD_LOG_OFF
Definition: shresdef.h:488
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:995

Referenced by CTrayWindow::HandleCommand(), and StartMenuHandler::ShowLogoffDialog().

◆ NoIconsInFile()

static void NoIconsInFile ( HWND  hwndDlg,
PPICK_ICON_CONTEXT  pIconContext 
)
static

Definition at line 158 of file dialogs.cpp.

159 {
160  // Show an error message
161  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
162  strText.Format(IDS_NO_ICONS, pIconContext->szPath);
163  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING);
164 
165  // Load the default icons
166  DoLoadIcons(hwndDlg, pIconContext, s_pszDefaultPath);
167 }
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:342
static BOOL DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
Definition: dialogs.cpp:93
#define MB_ICONWARNING
Definition: winuser.h:780
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDS_NO_ICONS
Definition: shresdef.h:297
static const LPCWSTR s_pszDefaultPath
Definition: dialogs.cpp:156
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by PickIconProc().

◆ PickIconDlg()

BOOL WINAPI PickIconDlg ( HWND  hWndOwner,
LPWSTR  lpstrFile,
UINT  nMaxFile,
INT lpdwIconIndex 
)

Definition at line 351 of file dialogs.cpp.

356 {
357  int res;
358  WCHAR szExpandedPath[MAX_PATH];
359 
360  // Initialize the dialog
361  PICK_ICON_CONTEXT IconContext = { NULL };
362  IconContext.Index = *lpdwIconIndex;
363  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), lpstrFile);
364  ExpandEnvironmentStringsW(lpstrFile, szExpandedPath, _countof(szExpandedPath));
365 
366  if (!szExpandedPath[0] ||
367  GetFileAttributesW(szExpandedPath) == INVALID_FILE_ATTRIBUTES)
368  {
369  if (szExpandedPath[0])
370  {
371  // No such file
372  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
373  strText.Format(IDS_FILE_NOT_FOUND, lpstrFile);
374  MessageBoxW(hWndOwner, strText, strTitle, MB_ICONWARNING);
375  }
376 
377  // Set the default value
378  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), s_pszDefaultPath);
379  }
380 
381  // Show the dialog
383  if (res)
384  {
385  // Store the selected icon
386  StringCchCopyW(lpstrFile, nMaxFile, IconContext.szPath);
387  *lpdwIconIndex = IconContext.Index;
388  }
389 
390  return res;
391 }
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:342
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MB_ICONWARNING
Definition: winuser.h:780
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_PICK_ICON
Definition: shresdef.h:338
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
WCHAR szPath[MAX_PATH]
Definition: dialogs.cpp:51
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:298
#define shell32_hInstance
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
static const LPCWSTR s_pszDefaultPath
Definition: dialogs.cpp:156
INT_PTR CALLBACK PickIconProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:177
GLuint res
Definition: glext.h:9613
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by EditTypeDlg_OnChangeIcon(), CShellLink::OnCommand(), and CFileDefExt::OnFolderCustChangeIcon().

◆ PickIconProc()

INT_PTR CALLBACK PickIconProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 177 of file dialogs.cpp.

182 {
183  LPMEASUREITEMSTRUCT lpmis;
184  LPDRAWITEMSTRUCT lpdis;
185  HICON hIcon;
186  INT index, count;
187  WCHAR szText[MAX_PATH], szFilter[100];
188  CStringW strTitle;
190 
192 
193  switch(uMsg)
194  {
195  case WM_INITDIALOG:
196  {
197  pIconContext = (PPICK_ICON_CONTEXT)lParam;
198  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pIconContext);
199  pIconContext->hDlgCtrl = GetDlgItem(hwndDlg, IDC_PICKICON_LIST);
200 
201  SendMessageW(pIconContext->hDlgCtrl, LB_SETCOLUMNWIDTH, CX_ITEM, 0);
202 
203  // Load the icons
204  if (!DoLoadIcons(hwndDlg, pIconContext, pIconContext->szPath))
205  NoIconsInFile(hwndDlg, pIconContext);
206 
207  // Set the selection
208  count = SendMessageW(pIconContext->hDlgCtrl, LB_GETCOUNT, 0, 0);
209  if (count != LB_ERR)
210  {
211  if (pIconContext->Index < 0)
212  {
213  // A negative value will be interpreted as a negated resource ID.
214  LPARAM lParam = -pIconContext->Index;
215  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_FINDSTRINGEXACT, -1, lParam);
216  }
217 
218  if (pIconContext->Index < 0 || count <= pIconContext->Index)
219  pIconContext->Index = 0;
220 
221  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, pIconContext->Index, 0);
222  SendMessageW(pIconContext->hDlgCtrl, LB_SETTOPINDEX, pIconContext->Index, 0);
223  }
224  return TRUE;
225  }
226 
227  case WM_DESTROY:
228  {
229  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
230  delete[] pIconContext->phIcons;
231 
232  if (pIconContext->hLibrary)
233  FreeLibrary(pIconContext->hLibrary);
234  break;
235  }
236 
237  case WM_COMMAND:
238  switch(LOWORD(wParam))
239  {
240  case IDOK:
241  {
242  /* Check whether the path edit control has been modified; if so load the icons instead of validating */
243  if (SendDlgItemMessage(hwndDlg, IDC_EDIT_PATH, EM_GETMODIFY, 0, 0))
244  {
245  /* Reset the edit control's modification flag and retrieve the text */
248 
249  // Load the icons
250  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
251  NoIconsInFile(hwndDlg, pIconContext);
252 
253  // Set the selection
254  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
255  break;
256  }
257 
258  /* The path edit control has not been modified, return the selection */
259  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
260  GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath, _countof(pIconContext->szPath));
261  EndDialog(hwndDlg, 1);
262  break;
263  }
264 
265  case IDCANCEL:
266  EndDialog(hwndDlg, 0);
267  break;
268 
269  case IDC_PICKICON_LIST:
270  switch (HIWORD(wParam))
271  {
272  case LBN_SELCHANGE:
274  break;
275 
276  case LBN_DBLCLK:
277  SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
278  break;
279  }
280  break;
281 
282  case IDC_BUTTON_PATH:
283  {
284  // Choose the module path
285  szText[0] = 0;
286  szFilter[0] = 0;
287  ZeroMemory(&ofn, sizeof(ofn));
288  ofn.lStructSize = sizeof(ofn);
289  ofn.hwndOwner = hwndDlg;
290  ofn.lpstrFile = szText;
292  strTitle.LoadString(IDS_PICK_ICON_TITLE);
293  ofn.lpstrTitle = strTitle;
296  if (!GetOpenFileNameW(&ofn))
297  break;
298 
299  // Load the icons
300  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
301  NoIconsInFile(hwndDlg, pIconContext);
302 
303  // Set the selection
304  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
305  break;
306  }
307 
308  default:
309  break;
310  }
311  break;
312 
313  case WM_MEASUREITEM:
314  lpmis = (LPMEASUREITEMSTRUCT)lParam;
315  lpmis->itemHeight = CY_ITEM;
316  return TRUE;
317 
318  case WM_DRAWITEM:
319  {
320  lpdis = (LPDRAWITEMSTRUCT)lParam;
321  if (lpdis->itemID == (UINT)-1)
322  break;
323  switch (lpdis->itemAction)
324  {
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 }
#define LB_SETCURSEL
Definition: winuser.h:2045
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:342
static HICON
Definition: imagelist.c:84
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
#define IDOK
Definition: winuser.h:824
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2043
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND hwndOwner
Definition: commdlg.h:330
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
static BOOL DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
Definition: dialogs.cpp:93
#define INT
Definition: polytest.cpp:20
LONG top
Definition: windef.h:307
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1648
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SendDlgItemMessage
Definition: winuser.h:5817
LONG left
Definition: windef.h:306
#define LBN_SELCHANGE
Definition: winuser.h:2057
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
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
DWORD nMaxFile
Definition: commdlg.h:337
#define IDC_PICKICON_LIST
Definition: shresdef.h:339
struct PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
#define FALSE
Definition: types.h:117
static const WCHAR szText[]
Definition: dialog.c:139
#define LB_ERR
Definition: winuser.h:2407
static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:158
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4671
#define IDS_PICK_ICON_FILTER
Definition: shresdef.h:343
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPTSTR szFilter
Definition: mplay32.c:30
#define CX_ITEM
Definition: dialogs.cpp:174
GLuint index
Definition: glext.h:6031
#define LB_GETCOUNT
Definition: winuser.h:2020
#define CY_ICON
Definition: dialogs.cpp:171
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_BUTTON_PATH
Definition: shresdef.h:340
#define ODA_DRAWENTIRE
Definition: winuser.h:2517
#define FreeLibrary(x)
Definition: compat.h:607
#define LB_SETTOPINDEX
Definition: winuser.h:2052
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
#define EM_GETMODIFY
Definition: winuser.h:1976
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static const UCHAR Index[8]
Definition: usbohci.c:18
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define IDC_EDIT_PATH
Definition: shresdef.h:341
#define LBN_DBLCLK
Definition: winuser.h:2053
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:76
#define index(s, c)
Definition: various.h:29
#define DWLP_USER
Definition: winuser.h:866
#define DI_NORMAL
Definition: wingdi.h:72
#define EM_SETMODIFY
Definition: winuser.h:1995
#define WM_COMMAND
Definition: winuser.h:1722
#define CX_ICON
Definition: dialogs.cpp:170
#define shell32_hInstance
LPSTR lpstrFile
Definition: commdlg.h:336
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define LB_GETCURSEL
Definition: winuser.h:2021
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WM_DRAWITEM
Definition: winuser.h:1627
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define SendMessage
Definition: winuser.h:5818
HMODULE hLibrary
Definition: dialog.c:549
#define HIWORD(l)
Definition: typedefs.h:247
CAtlStringW CStringW
Definition: atlstr.h:130
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define CY_ITEM
Definition: dialogs.cpp:175
#define ODA_SELECT
Definition: winuser.h:2518

Referenced by PickIconDlg().

◆ RestartDialog()

int WINAPI RestartDialog ( HWND  hWndOwner,
LPCWSTR  lpstrReason,
DWORD  uFlags 
)

Definition at line 1130 of file dialogs.cpp.

1131 {
1132  return RestartDialogEx(hWndOwner, lpstrReason, uFlags, 0);
1133 }
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
Definition: dialogs.cpp:1045
UINT uFlags
Definition: api.c:59

◆ RestartDialogEx()

int WINAPI RestartDialogEx ( HWND  hWndOwner,
LPCWSTR  lpwstrReason,
DWORD  uFlags,
DWORD  uReason 
)

Definition at line 1045 of file dialogs.cpp.

1046 {
1047  TRACE("(%p)\n", hWndOwner);
1048 
1049  CComPtr<IUnknown> fadeHandler;
1050  HWND parent;
1051 
1052  if (!CallShellDimScreen(&fadeHandler, &parent))
1053  parent = hWndOwner;
1054 
1055  /* FIXME: use lpwstrReason */
1057  {
1058  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1059  ExitWindowsEx(EWX_REBOOT, uReason);
1060  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1061  }
1062 
1063  return 0;
1064 }
#define TRUE
Definition: types.h:120
#define EWX_REBOOT
Definition: winuser.h:633
#define IDS_RESTART_TITLE
Definition: shresdef.h:74
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
Definition: dialogs.cpp:982
r parent
Definition: btrfs.c:2944
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1015
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_RESTART_PROMPT
Definition: shresdef.h:75
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:995

Referenced by RestartDialog().

◆ RunDlg_GetParentDir()

static LPWSTR RunDlg_GetParentDir ( LPCWSTR  cmdline)
static

Definition at line 421 of file dialogs.cpp.

422 {
423  const WCHAR *src;
424  WCHAR *dest, *result, *result_end=NULL;
425  static const WCHAR dotexeW[] = L".exe";
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, dotexeW);
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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static const WCHAR L[]
Definition: oid.c:1250
GLenum src
Definition: glext.h:6340
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
static char * dest
Definition: rtl.c:135
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by RunDlgProc().

◆ RunDlgProc()

static INT_PTR CALLBACK RunDlgProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 501 of file dialogs.cpp.

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)
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)
563  CoUninitialize();
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  NMRUNFILEDLGW nmrfd;
577 
578  ic = GetWindowTextLengthW(htxt);
579  if (ic == 0)
580  {
582  return TRUE;
583  }
584 
585  /*
586  * Allocate a new MRU entry, we need to add two characters
587  * for the terminating "\\1" part, then the NULL character.
588  */
589  psz = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (ic + 2 + 1)*sizeof(WCHAR));
590  if (!psz)
591  {
593  return TRUE;
594  }
595 
596  GetWindowTextW(htxt, psz, ic + 1);
597  StrTrimW(psz, L" \t");
598 
599  if (wcschr(psz, L'%') != NULL)
600  {
601  cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
602  pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
603  if (!pszExpanded)
604  {
605  HeapFree(GetProcessHeap(), 0, psz);
607  return TRUE;
608  }
609  ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
610  StrTrimW(pszExpanded, L" \t");
611  }
612  else
613  {
614  pszExpanded = psz;
615  }
616 
617  /*
618  * The precedence is the following: first the user-given
619  * current directory is used; if there is none, a current
620  * directory is computed if the RFF_CALCDIRECTORY is set,
621  * otherwise no current directory is defined.
622  */
623  LPCWSTR pszStartDir;
624  if (prfdp->lpstrDirectory)
625  pszStartDir = prfdp->lpstrDirectory;
626  else if (prfdp->uFlags & RFF_CALCDIRECTORY)
627  pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
628  else
629  pszStartDir = NULL;
630 
631  /* Hide the dialog for now on, we will show it up in case of retry */
633 
634  /*
635  * As shown by manual tests on Windows, modifying the contents
636  * of the notification structure will not modify what the
637  * Run-Dialog will use for the nShow parameter. However the
638  * lpFile and lpDirectory pointers are set to the buffers used
639  * by the Run-Dialog, as a consequence they can be modified by
640  * the notification receiver, as long as it respects the lengths
641  * of the buffers (to avoid buffer overflows).
642  */
643  nmrfd.hdr.code = RFN_VALIDATE;
644  nmrfd.hdr.hwndFrom = hwnd;
645  nmrfd.hdr.idFrom = 0;
646  nmrfd.lpFile = pszExpanded;
647  nmrfd.lpDirectory = pszStartDir;
648  nmrfd.nShow = SW_SHOWNORMAL;
649 
650  lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
651 
652  switch (lRet)
653  {
654  case RF_CANCEL:
656  break;
657 
658  case RF_OK:
659  if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
661  {
662  /* Call again GetWindowText in case the contents of the edit box has changed? */
663  GetWindowTextW(htxt, psz, ic + 1);
664  FillList(htxt, psz, ic + 2 + 1, FALSE);
665  EndDialog(hwnd, IDOK);
666  break;
667  }
668 
669  /* Fall-back */
670  case RF_RETRY:
671  default:
672  SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
673  /* Show back the dialog */
675  break;
676  }
677 
679  HeapFree(GetProcessHeap(), 0, psz);
680  if (psz != pszExpanded)
681  HeapFree(GetProcessHeap(), 0, pszExpanded);
682  return TRUE;
683  }
684 
685  case IDCANCEL:
687  return TRUE;
688 
689  case IDC_RUNDLG_BROWSE:
690  {
691  HMODULE hComdlg = NULL;
692  LPFNOFN ofnProc = NULL;
693  WCHAR szFName[1024] = {0};
694  WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
696 
699 
700  ZeroMemory(&ofn, sizeof(ofn));
701  ofn.lStructSize = sizeof(ofn);
702  ofn.hwndOwner = hwnd;
704  ofn.lpstrFile = szFName;
705  ofn.nMaxFile = _countof(szFName) - 1;
706  ofn.lpstrTitle = szCaption;
709 
710  if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)) ||
711  NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
712  {
713  ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
715  return TRUE;
716  }
717 
718  if (ofnProc(&ofn))
719  {
725  }
726 
727  FreeLibrary(hComdlg);
728 
729  return TRUE;
730  }
731  case IDC_RUNDLG_EDITPATH:
732  {
733  if (HIWORD(wParam) == CBN_EDITCHANGE)
734  {
736  }
737  return TRUE;
738  }
739  }
740  return TRUE;
741  }
742  return FALSE;
743 }
#define SHACF_URLALL
Definition: shlwapi.h:1915
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define STM_SETICON
Definition: winuser.h:2074
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:318
Definition: tftpd.h:59
static void FillList(HWND, LPWSTR, UINT, BOOL)
Definition: dialogs.cpp:751
#define IDOK
Definition: winuser.h:824
#define IDC_RUNDLG_ICON
Definition: shresdef.h:317
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND hwndOwner
Definition: commdlg.h:330
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1648
LPCWSTR lpDirectory
Definition: undocshell.h:151
HWND WINAPI SetFocus(_In_opt_ HWND)
#define RF_OK
Definition: undocshell.h:160
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_RUNDLG_BROWSE_ERROR
Definition: shresdef.h:185
#define RF_CANCEL
Definition: undocshell.h:161
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static void EnableOkButtonFromEditContents(HWND hwnd)
Definition: dialogs.cpp:478
static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
Definition: dialogs.cpp:421
DWORD nMaxFile
Definition: commdlg.h:337
UINT code
Definition: winuser.h:3134
LPCWSTR lpstrDescription
Definition: dialogs.cpp:30
#define IDC_RUNDLG_DESCRIPTION
Definition: shresdef.h:315
#define FALSE
Definition: types.h:117
UINT_PTR idFrom
Definition: winuser.h:3133
#define IDS_RUNDLG_BROWSE_FILTER
Definition: shresdef.h:187
#define FIXME(fmt,...)
Definition: debug.h:111
#define IDC_RUNDLG_LABEL
Definition: shresdef.h:319
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1912
smooth NULL
Definition: ftsmooth.c:416
#define RFN_VALIDATE
Definition: undocshell.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define SECL_ALLOW_NONEXE
#define SW_SHOW
Definition: winuser.h:769
#define WM_DESTROY
Definition: winuser.h:1591
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define RFF_NOSEPARATEMEM
Definition: run.h:50
#define FreeLibrary(x)
Definition: compat.h:607
#define ShellExecCmdLine
#define GetProcessHeap()
Definition: compat.h:595
#define CBN_EDITCHANGE
Definition: winuser.h:1957
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
r parent
Definition: btrfs.c:2944
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define _countof(array)
Definition: sndvol32.h:68
LPCWSTR lpFile
Definition: undocshell.h:150
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
int WINAPI GetWindowTextLengthW(_In_ HWND)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RFF_NODEFAULT
Definition: run.h:47
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
#define RFF_NOLABEL
Definition: run.h:49
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3132
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:110
#define RFF_CALCDIRECTORY
Definition: run.h:48
HWND hwndEdit
Definition: combotst.c:65
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define shell32_hInstance
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
LPSTR lpstrFile
Definition: commdlg.h:336
#define CB_SETEDITSEL
Definition: winuser.h:1945
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define ShellMessageBoxW
Definition: precomp.h:58
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define MB_OK
Definition: winuser.h:784
BOOL(WINAPI * LPFNOFN)(OPENFILENAMEW *)
Definition: dialogs.cpp:35
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
LPCWSTR lpstrTitle
Definition: dialogs.cpp:29
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define IDC_RUNDLG_BROWSE
Definition: resource.h:7
#define IDS_RUNDLG_BROWSE_CAPTION
Definition: shresdef.h:186
#define HIWORD(l)
Definition: typedefs.h:247
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define RFF_NOBROWSE
Definition: run.h:46
LPCWSTR lpstrDirectory
Definition: dialogs.cpp:28
#define GetProcAddress(x, y)
Definition: compat.h:612
#define SHACF_FILESYS_ONLY
Definition: shlwapi.h:1917
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define WM_INITDIALOG
Definition: winuser.h:1721
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
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61
#define IDI_SHELL_RUN
Definition: shresdef.h:520
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define SUCCEEDED(hr)
Definition: intsafe.h:49
DWORD Flags
Definition: commdlg.h:342
#define RF_RETRY
Definition: undocshell.h:162

Referenced by RunFileDlg().

◆ RunFileDlg()

void WINAPI RunFileDlg ( HWND  hWndOwner,
HICON  hIcon,
LPCWSTR  lpstrDirectory,
LPCWSTR  lpstrTitle,
LPCWSTR  lpstrDescription,
UINT  uFlags 
)

Definition at line 398 of file dialogs.cpp.

405 {
406  TRACE("\n");
407 
408  RUNFILEDLGPARAMS rfdp;
409  rfdp.hwndOwner = hWndOwner;
410  rfdp.hIcon = hIcon;
411  rfdp.lpstrDirectory = lpstrDirectory;
412  rfdp.lpstrTitle = lpstrTitle;
413  rfdp.lpstrDescription = lpstrDescription;
414  rfdp.uFlags = uFlags;
415 
417 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
UINT uFlags
Definition: api.c:59
LPCWSTR lpstrDescription
Definition: dialogs.cpp:30
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM)
Definition: dialogs.cpp:501
#define TRACE(s)
Definition: solgame.cpp:4
#define IDD_RUN
Definition: shresdef.h:314
#define shell32_hInstance
HICON hIcon
Definition: msconfig.c:44
LPCWSTR lpstrTitle
Definition: dialogs.cpp:29
LPCWSTR lpstrDirectory
Definition: dialogs.cpp:28
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by RunDialogThread::Run(), CTrayWindow::RunFileDlgThread(), and TaskManager_OnFileNew().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ s_pszDefaultPath

const LPCWSTR s_pszDefaultPath = L"%SystemRoot%\\system32\\shell32.dll"
static

Definition at line 156 of file dialogs.cpp.

Referenced by NoIconsInFile(), and PickIconDlg().