ReactOS  0.4.15-dev-4914-g2220e56
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  LOGOFF_DLG_CONTEXT
 
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)
 
#define IS_PRODUCT_VERSION_WORKSTATION   0x300
 
#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED   0x0
 
#define FONT_POINT_SIZE   13
 
#define DARK_GREY_COLOR   RGB(244, 244, 244)
 
#define LIGHT_GREY_COLOR   RGB(38, 38, 38)
 
#define CX_BITMAP   33
 
#define CY_BITMAP   33
 
#define NUMBER_OF_BUTTONS   2
 
#define BUTTON_SWITCH_USER   0
 
#define BUTTON_SWITCH_USER_PRESSED   (CY_BITMAP + BUTTON_SWITCH_USER)
 
#define BUTTON_SWITCH_USER_FOCUSED   (CY_BITMAP + BUTTON_SWITCH_USER_PRESSED)
 
#define BUTTON_LOG_OFF   (CY_BITMAP + BUTTON_SWITCH_USER_FOCUSED)
 
#define BUTTON_LOG_OFF_PRESSED   (CY_BITMAP + BUTTON_LOG_OFF)
 
#define BUTTON_LOG_OFF_FOCUSED   (CY_BITMAP + BUTTON_LOG_OFF_PRESSED)
 
#define BUTTON_SWITCH_USER_DISABLED   (CY_BITMAP + BUTTON_LOG_OFF_FOCUSED)
 

Typedefs

typedef struct LOGOFF_DLG_CONTEXTPLOGOFF_DLG_CONTEXT
 
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)
 
BOOL DrawIconOnOwnerDrawnButtons (DRAWITEMSTRUCT *pdis, PLOGOFF_DLG_CONTEXT pContext)
 
INT_PTR CALLBACK OwnerDrawButtonSubclass (HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID CreateToolTipForButtons (int controlID, int detailID, HWND hDlg, int titleID)
 
static BOOL IsFriendlyUIActive (VOID)
 
static VOID FancyLogoffOnInit (HWND hwnd, PLOGOFF_DLG_CONTEXT pContext)
 
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)
 

Macro Definition Documentation

◆ BUTTON_LOG_OFF

#define BUTTON_LOG_OFF   (CY_BITMAP + BUTTON_SWITCH_USER_FOCUSED)

Definition at line 1122 of file dialogs.cpp.

◆ BUTTON_LOG_OFF_FOCUSED

#define BUTTON_LOG_OFF_FOCUSED   (CY_BITMAP + BUTTON_LOG_OFF_PRESSED)

Definition at line 1124 of file dialogs.cpp.

◆ BUTTON_LOG_OFF_PRESSED

#define BUTTON_LOG_OFF_PRESSED   (CY_BITMAP + BUTTON_LOG_OFF)

Definition at line 1123 of file dialogs.cpp.

◆ BUTTON_SWITCH_USER

#define BUTTON_SWITCH_USER   0

Definition at line 1119 of file dialogs.cpp.

◆ BUTTON_SWITCH_USER_DISABLED

#define BUTTON_SWITCH_USER_DISABLED   (CY_BITMAP + BUTTON_LOG_OFF_FOCUSED)

Definition at line 1125 of file dialogs.cpp.

◆ BUTTON_SWITCH_USER_FOCUSED

#define BUTTON_SWITCH_USER_FOCUSED   (CY_BITMAP + BUTTON_SWITCH_USER_PRESSED)

Definition at line 1121 of file dialogs.cpp.

◆ BUTTON_SWITCH_USER_PRESSED

#define BUTTON_SWITCH_USER_PRESSED   (CY_BITMAP + BUTTON_SWITCH_USER)

Definition at line 1120 of file dialogs.cpp.

◆ CX_BITMAP

#define CX_BITMAP   33

Definition at line 1113 of file dialogs.cpp.

◆ CX_ICON

Definition at line 179 of file dialogs.cpp.

◆ CX_ITEM

#define CX_ITEM   (CX_ICON + 4)

Definition at line 183 of file dialogs.cpp.

◆ CY_BITMAP

#define CY_BITMAP   33

Definition at line 1114 of file dialogs.cpp.

◆ CY_ICON

Definition at line 180 of file dialogs.cpp.

◆ CY_ITEM

#define CY_ITEM   (CY_ICON + 12)

Definition at line 184 of file dialogs.cpp.

◆ DARK_GREY_COLOR

#define DARK_GREY_COLOR   RGB(244, 244, 244)

Definition at line 1109 of file dialogs.cpp.

◆ FONT_POINT_SIZE

#define FONT_POINT_SIZE   13

Definition at line 1107 of file dialogs.cpp.

◆ FRIENDLY_LOGOFF_IS_NOT_ENFORCED

#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED   0x0

Definition at line 1105 of file dialogs.cpp.

◆ IS_PRODUCT_VERSION_WORKSTATION

#define IS_PRODUCT_VERSION_WORKSTATION   0x300

Definition at line 1104 of file dialogs.cpp.

◆ LIGHT_GREY_COLOR

#define LIGHT_GREY_COLOR   RGB(38, 38, 38)

Definition at line 1110 of file dialogs.cpp.

◆ NUMBER_OF_BUTTONS

#define NUMBER_OF_BUTTONS   2

Definition at line 1116 of file dialogs.cpp.

Typedef Documentation

◆ LPFNOFN

typedef BOOL(WINAPI * LPFNOFN) (OPENFILENAMEW *)

Definition at line 46 of file dialogs.cpp.

◆ PLOGOFF_DLG_CONTEXT

◆ PPICK_ICON_CONTEXT

◆ tShellDimScreen

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

Definition at line 1029 of file dialogs.cpp.

Function Documentation

◆ CallShellDimScreen()

BOOL CallShellDimScreen ( IUnknown **  pUnknown,
HWND hWindow 
)

Definition at line 1032 of file dialogs.cpp.

1033 {
1035  static BOOL Initialized = FALSE;
1036  if (!Initialized)
1037  {
1038  HMODULE mod = LoadLibraryW(L"msgina.dll");
1040  Initialized = TRUE;
1041  }
1042 
1043  HRESULT hr = E_FAIL;
1044  if (ShellDimScreen)
1045  hr = ShellDimScreen(pUnknown, hWindow);
1046  return SUCCEEDED(hr);
1047 }
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
tShellDimScreen ShellDimScreen
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#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
HRESULT(WINAPI * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
Definition: dialogs.cpp:1029
#define GetProcAddress(x, y)
Definition: compat.h:612
static int mod
Definition: i386-dis.c:1289

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

◆ ConfirmDialog()

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

Definition at line 1019 of file dialogs.cpp.

1020 {
1021  WCHAR Prompt[256];
1022  WCHAR Title[256];
1023 
1024  LoadStringW(shell32_hInstance, PromptId, Prompt, _countof(Prompt));
1026  return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO | MB_ICONQUESTION) == IDYES;
1027 }
#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().

◆ CreateToolTipForButtons()

VOID CreateToolTipForButtons ( int  controlID,
int  detailID,
HWND  hDlg,
int  titleID 
)

Definition at line 1274 of file dialogs.cpp.

1275 {
1276  HWND hwndTool = NULL, hwndTip = NULL;
1277  WCHAR szBuffer[256];
1278  TTTOOLINFOW tool;
1279 
1280  hwndTool = GetDlgItem(hDlg, controlID);
1281 
1282  tool.cbSize = sizeof(tool);
1283  tool.hwnd = hDlg;
1284  tool.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
1285  tool.uId = (UINT_PTR)hwndTool;
1286 
1287  /* Create the tooltip */
1288  hwndTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL,
1292  hDlg, NULL, shell32_hInstance, NULL);
1293 
1294  /* Associate the tooltip with the tool. */
1295  LoadStringW(shell32_hInstance, detailID, szBuffer, _countof(szBuffer));
1296  tool.lpszText = szBuffer;
1297  SendMessageW(hwndTip, TTM_ADDTOOLW, 0, (LPARAM)&tool);
1298  LoadStringW(shell32_hInstance, titleID, szBuffer, _countof(szBuffer));
1299  SendMessageW(hwndTip, TTM_SETTITLEW, TTI_NONE, (LPARAM)szBuffer);
1300  SendMessageW(hwndTip, TTM_SETMAXTIPWIDTH, 0, 250);
1301 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
#define TTS_BALLOON
Definition: commctrl.h:1761
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LPWSTR lpszText
Definition: commctrl.h:1746
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define CW_USEDEFAULT
Definition: winuser.h:225
LONG_PTR LPARAM
Definition: windef.h:208
#define TTM_SETTITLEW
Definition: commctrl.h:1828
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define TTI_NONE
Definition: commctrl.h:1779
UINT_PTR uId
Definition: commctrl.h:1743
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1819
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1707
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define shell32_hInstance
#define TTM_ADDTOOLW
Definition: commctrl.h:1787
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
#define TTF_SUBCLASS
Definition: commctrl.h:1767

Referenced by FancyLogoffOnInit().

◆ DestroyIconList()

static void DestroyIconList ( HWND  hDlgCtrl,
PPICK_ICON_CONTEXT  pIconContext 
)
static

Definition at line 87 of file dialogs.cpp.

88 {
89  int count;
90  int index;
91 
92  count = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
93  if (count == LB_ERR)
94  return;
95 
96  for(index = 0; index < count; index++)
97  {
98  DestroyIcon(pIconContext->phIcons[index]);
99  pIconContext->phIcons[index] = NULL;
100  }
101 }
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define LB_ERR
Definition: winuser.h:2412
GLuint index
Definition: glext.h:6031
#define LB_GETCOUNT
Definition: winuser.h:2025
#define index(s, c)
Definition: various.h:29
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112

Referenced by DoLoadIcons(), and PickIconProc().

◆ DoLoadIcons()

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

Definition at line 104 of file dialogs.cpp.

105 {
106  WCHAR szExpandedPath[MAX_PATH];
107 
108  // Destroy previous icons
109  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
110  SendMessageW(pIconContext->hDlgCtrl, LB_RESETCONTENT, 0, 0);
111  delete[] pIconContext->phIcons;
112 
113  // Store the path
114  StringCchCopyW(pIconContext->szPath, _countof(pIconContext->szPath), pszFile);
115  ExpandEnvironmentStringsW(pszFile, szExpandedPath, _countof(szExpandedPath));
116 
117  // Load the module if possible
119  if (pIconContext->hLibrary)
120  FreeLibrary(pIconContext->hLibrary);
121  pIconContext->hLibrary = hLibrary;
122 
123  if (pIconContext->hLibrary)
124  {
125  // Load the icons from the module
126  pIconContext->nIcons = ExtractIconExW(szExpandedPath, -1, NULL, NULL, 0);
127  pIconContext->phIcons = new HICON[pIconContext->nIcons];
128 
129  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
130  {
132  }
133  else
134  {
135  pIconContext->nIcons = 0;
136  }
137  }
138  else
139  {
140  // .ico file
141  pIconContext->nIcons = 1;
142  pIconContext->phIcons = new HICON[1];
143 
144  if (ExtractIconExW(szExpandedPath, 0, pIconContext->phIcons, NULL, pIconContext->nIcons))
145  {
146  SendMessageW(pIconContext->hDlgCtrl, LB_ADDSTRING, 0, 0);
147  }
148  else
149  {
150  pIconContext->nIcons = 0;
151  }
152  }
153 
154  // Set the text and reset the edit control's modification flag
155  SetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath);
157 
158  if (pIconContext->nIcons == 0)
159  {
160  delete[] pIconContext->phIcons;
161  pIconContext->phIcons = NULL;
162  }
163 
164  return (pIconContext->nIcons > 0);
165 }
#define RT_GROUP_ICON
Definition: pedump.c:375
static HICON
Definition: imagelist.c:84
#define LB_ADDSTRING
Definition: winuser.h:2018
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define SendDlgItemMessage
Definition: winuser.h:5822
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define LB_RESETCONTENT
Definition: winuser.h:2042
#define FALSE
Definition: types.h:117
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:866
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:68
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:361
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:87
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:2000
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:339
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
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().

◆ DrawIconOnOwnerDrawnButtons()

BOOL DrawIconOnOwnerDrawnButtons ( DRAWITEMSTRUCT pdis,
PLOGOFF_DLG_CONTEXT  pContext 
)

Definition at line 1127 of file dialogs.cpp.

1128 {
1129  BOOL bRet = FALSE;
1130  HDC hdcMem = NULL;
1131  HBITMAP hbmOld = NULL;
1132  int y = 0;
1133  RECT rect;
1134 
1135  hdcMem = CreateCompatibleDC(pdis->hDC);
1136  hbmOld = (HBITMAP)SelectObject(hdcMem, pContext->hImageStrip);
1137  rect = pdis->rcItem;
1138 
1139  /* Check the button ID for revelant bitmap to be used */
1140  switch (pdis->CtlID)
1141  {
1142  case IDC_LOG_OFF_BUTTON:
1143  {
1144  switch (pdis->itemAction)
1145  {
1146  case ODA_DRAWENTIRE:
1147  case ODA_FOCUS:
1148  case ODA_SELECT:
1149  {
1150  y = BUTTON_LOG_OFF;
1151  if (pdis->itemState & ODS_SELECTED)
1152  {
1154  }
1155  else if (pContext->bIsButtonHot[0] || (pdis->itemState & ODS_FOCUS))
1156  {
1158  }
1159  break;
1160  }
1161  }
1162  break;
1163  }
1164 
1166  {
1167  switch (pdis->itemAction)
1168  {
1169  case ODA_DRAWENTIRE:
1170  case ODA_FOCUS:
1171  case ODA_SELECT:
1172  {
1174  if (pdis->itemState & ODS_SELECTED)
1175  {
1177  }
1178  else if (pContext->bIsButtonHot[1] || (pdis->itemState & ODS_FOCUS))
1179  {
1181  }
1182 
1183  /*
1184  * Since switch user functionality isn't implemented yet therefore the button has been disabled
1185  * temporarily hence show the disabled state
1186  */
1187  else if (pdis->itemState & ODS_DISABLED)
1188  {
1190  }
1191  break;
1192  }
1193  }
1194  break;
1195  }
1196  }
1197 
1198  /* Draw it on the required button */
1199  bRet = BitBlt(pdis->hDC,
1200  (rect.right - rect.left - CX_BITMAP) / 2,
1201  (rect.bottom - rect.top - CY_BITMAP) / 2,
1203 
1204  SelectObject(hdcMem, hbmOld);
1205  DeleteDC(hdcMem);
1206 
1207  return bRet;
1208 }
#define CX_BITMAP
Definition: dialogs.cpp:1113
#define BUTTON_LOG_OFF_PRESSED
Definition: dialogs.cpp:1123
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define ODS_FOCUS
Definition: winuser.h:2529
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define ODA_FOCUS
Definition: winuser.h:2524
& rect
Definition: startmenu.cpp:1413
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:481
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:482
#define BUTTON_SWITCH_USER_DISABLED
Definition: dialogs.cpp:1125
#define ODA_DRAWENTIRE
Definition: winuser.h:2522
#define ODS_DISABLED
Definition: winuser.h:2527
HBITMAP hImageStrip
Definition: dialogs.cpp:40
#define BUTTON_SWITCH_USER
Definition: dialogs.cpp:1119
#define BUTTON_LOG_OFF_FOCUSED
Definition: dialogs.cpp:1124
BOOL WINAPI DeleteDC(_In_ HDC)
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define BUTTON_LOG_OFF
Definition: dialogs.cpp:1122
#define BUTTON_SWITCH_USER_PRESSED
Definition: dialogs.cpp:1120
#define ODS_SELECTED
Definition: winuser.h:2525
static HBITMAP
Definition: button.c:44
#define CY_BITMAP
Definition: dialogs.cpp:1114
#define SRCCOPY
Definition: wingdi.h:333
#define ODA_SELECT
Definition: winuser.h:2523
HDC hdcMem
Definition: welcome.c:104
#define BUTTON_SWITCH_USER_FOCUSED
Definition: dialogs.cpp:1121
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
BOOL bIsButtonHot[2]
Definition: dialogs.cpp:39

Referenced by LogOffDialogProc().

◆ EnableOkButtonFromEditContents()

static void EnableOkButtonFromEditContents ( HWND  hwnd)
static

Definition at line 488 of file dialogs.cpp.

489 {
490  BOOL Enable = FALSE;
491  INT Length, n;
494  if (Length > 0)
495  {
496  PWCHAR psz = (PWCHAR)HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
497  if (psz)
498  {
499  GetWindowTextW(Edit, psz, Length + 1);
500  for (n = 0; n < Length && !Enable; ++n)
501  Enable = psz[n] != ' ';
502  HeapFree(GetProcessHeap(), 0, psz);
503  }
504  else
505  Enable = TRUE;
506  }
508 }
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:337
#define IDOK
Definition: winuser.h:824
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#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)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by RunDlgProc().

◆ EnablePrivilege()

static BOOL EnablePrivilege ( LPCWSTR  lpszPrivilegeName,
BOOL  bEnablePrivilege 
)
static

Definition at line 1052 of file dialogs.cpp.

1053 {
1054  BOOL Success;
1055  HANDLE hToken;
1057 
1060  &hToken);
1061  if (!Success) return Success;
1062 
1064  lpszPrivilegeName,
1065  &tp.Privileges[0].Luid);
1066  if (!Success) goto Quit;
1067 
1068  tp.PrivilegeCount = 1;
1069  tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1070 
1071  Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1072 
1073 Quit:
1074  CloseHandle(hToken);
1075  return Success;
1076 }
#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
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2965
#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
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:926

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

◆ EnumPickIconResourceProc()

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

Definition at line 68 of file dialogs.cpp.

72 {
74  HWND hDlgCtrl = pIconContext->hDlgCtrl;
75 
76  if (IS_INTRESOURCE(lpszName))
77  lParam = LOWORD(lpszName);
78  else
79  lParam = -1;
80 
81  SendMessageW(hDlgCtrl, LB_ADDSTRING, 0, lParam);
82 
83  return TRUE;
84 }
#define LB_ADDSTRING
Definition: winuser.h:2018
#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 1614 of file dialogs.cpp.

1615 {
1616  typedef DWORD (WINAPI *ShellShFunc)(HWND hParent, WCHAR *Username, BOOL bHideLogoff);
1617  HINSTANCE msginaDll = LoadLibraryW(L"msgina.dll");
1618 
1619  TRACE("(%p)\n", hWndOwner);
1620 
1621  CComPtr<IUnknown> fadeHandler;
1622  HWND parent;
1623  if (!CallShellDimScreen(&fadeHandler, &parent))
1624  parent = hWndOwner;
1625 
1626  /* If the DLL cannot be found for any reason, then it simply uses a
1627  dialog box to ask if the user wants to shut down the computer. */
1628  if (!msginaDll)
1629  {
1630  TRACE("Unable to load msgina.dll.\n");
1632  return;
1633  }
1634 
1635  ShellShFunc pShellShutdownDialog = (ShellShFunc)GetProcAddress(msginaDll, "ShellShutdownDialog");
1636 
1637  if (pShellShutdownDialog)
1638  {
1639  /* Actually call the function */
1640  DWORD returnValue = pShellShutdownDialog(parent, NULL, FALSE);
1641 
1642  switch (returnValue)
1643  {
1644  case 0x01: /* Log off user */
1645  {
1647  break;
1648  }
1649  case 0x02: /* Shut down */
1650  {
1651  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1653  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1654  break;
1655  }
1656  case 0x03: /* Install Updates/Shutdown (?) */
1657  {
1658  break;
1659  }
1660  case 0x04: /* Reboot */
1661  {
1662  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1664  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1665  break;
1666  }
1667  case 0x10: /* Sleep */
1668  {
1669  if (IsPwrSuspendAllowed())
1670  {
1671  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1673  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1674  }
1675  break;
1676  }
1677  case 0x40: /* Hibernate */
1678  {
1679  if (IsPwrHibernateAllowed())
1680  {
1681  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1683  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1684  }
1685  break;
1686  }
1687  /* If the option is any other value */
1688  default:
1689  break;
1690  }
1691  }
1692  else
1693  {
1694  /* If the function cannot be found, then revert to using the backup solution */
1695  TRACE("Unable to find the 'ShellShutdownDialog' function");
1697  }
1698 
1699  FreeLibrary(msginaDll);
1700 }
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 L(x)
Definition: ntvdm.h:50
#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
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:607
r parent
Definition: btrfs.c:2979
__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:1052
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:612
VOID ExitWindowsDialog_backup(HWND hWndOwner)
Definition: dialogs.cpp:1591
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:1032
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 1591 of file dialogs.cpp.

1592 {
1593  TRACE("(%p)\n", hWndOwner);
1594 
1596  {
1597  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1599  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1600  }
1601 }
#define TRUE
Definition: types.h:120
#define IDS_SHUTDOWN_PROMPT
Definition: shresdef.h:85
#define L(x)
Definition: ntvdm.h:50
#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:1019
#define IDS_SHUTDOWN_TITLE
Definition: shresdef.h:84
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1052
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)

Referenced by ExitWindowsDialog().

◆ FancyLogoffOnInit()

static VOID FancyLogoffOnInit ( HWND  hwnd,
PLOGOFF_DLG_CONTEXT  pContext 
)
static

Definition at line 1377 of file dialogs.cpp.

1378 {
1379  HDC hdc = NULL;
1380  LONG lfHeight = NULL;
1381 
1382  hdc = GetDC(NULL);
1383  lfHeight = -MulDiv(FONT_POINT_SIZE, GetDeviceCaps(hdc, LOGPIXELSY), 72);
1384  ReleaseDC(NULL, hdc);
1385  pContext->hfFont = CreateFontW(lfHeight, 0, 0, 0, FW_MEDIUM, FALSE, 0, 0, 0, 0, 0, 0, 0, L"MS Shell Dlg");
1387 
1389 
1391 
1394 
1395  /* Gather old button func */
1397 
1398  /* Make buttons to remember pContext and subclass the buttons as well as set bIsButtonHot boolean flags to false */
1399  for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1400  {
1401  pContext->bIsButtonHot[i] = FALSE;
1404  }
1405 }
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
INT_PTR CALLBACK OwnerDrawButtonSubclass(HWND hButton, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1210
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
VOID CreateToolTipForButtons(int controlID, int detailID, HWND hDlg, int titleID)
Definition: dialogs.cpp:1274
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4809
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define IDS_LOG_OFF_TITLE
Definition: shresdef.h:327
#define IDS_SWITCH_USER_TITLE
Definition: shresdef.h:328
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:481
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
WNDPROC OldButtonProc
Definition: dialogs.cpp:43
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:482
#define DARK_GREY_COLOR
Definition: dialogs.cpp:1109
#define FW_MEDIUM
Definition: wingdi.h:375
#define FONT_POINT_SIZE
Definition: dialogs.cpp:1107
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HBITMAP hImageStrip
Definition: dialogs.cpp:40
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
#define NUMBER_OF_BUTTONS
Definition: dialogs.cpp:1116
#define shell32_hInstance
#define IDS_SWITCH_USER_DESC
Definition: shresdef.h:326
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define IDB_IMAGE_STRIP
Definition: resource.h:79
#define WM_SETFONT
Definition: winuser.h:1637
#define LOGPIXELSY
Definition: wingdi.h:719
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IDS_LOG_OFF_DESC
Definition: shresdef.h:325
BOOL bIsButtonHot[2]
Definition: dialogs.cpp:39
#define IDC_LOG_OFF_TEXT_STATIC
Definition: shresdef.h:485

Referenced by LogOffDialogProc().

◆ FillList()

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

Definition at line 788 of file dialogs.cpp.

789 {
790  HKEY hkey;
791  WCHAR *pszList = NULL, *pszCmd = NULL, *pszTmp = NULL, cMatch = 0, cMax = 0x60;
792  WCHAR szIndex[2] = L"-";
793  UINT cchLatest;
794  DWORD dwType, icList = 0, icCmd = 0;
795  LRESULT lRet;
796  UINT Nix;
797 
798  /*
799  * Retrieve the string length of pszLatest and check whether its buffer size
800  * (cchStr in number of characters) is large enough to add the terminating "\\1"
801  * (and the NULL character).
802  */
803  if (pszLatest)
804  {
805  cchLatest = wcslen(pszLatest);
806  if (cchStr < cchLatest + 2 + 1)
807  {
808  TRACE("pszLatest buffer is not large enough (%d) to hold the MRU terminator.\n", cchStr);
809  return;
810  }
811  }
812  else
813  {
814  cchStr = 0;
815  }
816 
817  SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
818 
820  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
822  if (lRet != ERROR_SUCCESS)
823  {
824  TRACE("Unable to open or create the RunMRU key, error %d\n", GetLastError());
825  return;
826  }
827 
828  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, &dwType, NULL, &icList);
829  if (lRet == ERROR_SUCCESS && dwType == REG_SZ && icList > sizeof(WCHAR))
830  {
831  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
832  if (!pszList)
833  {
834  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
835  goto Continue;
836  }
837  pszList[0] = L'\0';
838 
839  lRet = RegQueryValueExW(hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList);
840  if (lRet != ERROR_SUCCESS)
841  {
842  TRACE("Unable to grab MRUList, error %d\n", GetLastError());
843  pszList[0] = L'\0';
844  }
845  }
846  else
847  {
848 Continue:
849  icList = sizeof(WCHAR);
850  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icList);
851  if (!pszList)
852  {
853  TRACE("HeapAlloc failed to allocate %d bytes\n", icList);
854  RegCloseKey(hkey);
855  return;
856  }
857  pszList[0] = L'\0';
858  }
859 
860  /* Convert the number of bytes from MRUList into number of characters (== number of indices) */
861  icList /= sizeof(WCHAR);
862 
863  for (Nix = 0; Nix < icList - 1; Nix++)
864  {
865  if (pszList[Nix] > cMax)
866  cMax = pszList[Nix];
867 
868  szIndex[0] = pszList[Nix];
869 
870  lRet = RegQueryValueExW(hkey, szIndex, NULL, &dwType, NULL, &icCmd);
871  if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
872  {
873  TRACE("Unable to grab size of index, error %d\n", GetLastError());
874  continue;
875  }
876 
877  if (pszCmd)
878  {
879  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
880  if (!pszTmp)
881  {
882  TRACE("HeapReAlloc failed to reallocate %d bytes\n", icCmd);
883  continue;
884  }
885  pszCmd = pszTmp;
886  }
887  else
888  {
889  pszCmd = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, icCmd);
890  if (!pszCmd)
891  {
892  TRACE("HeapAlloc failed to allocate %d bytes\n", icCmd);
893  continue;
894  }
895  }
896 
897  lRet = RegQueryValueExW(hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd);
898  if (lRet != ERROR_SUCCESS)
899  {
900  TRACE("Unable to grab index, error %d\n", GetLastError());
901  continue;
902  }
903 
904  /*
905  * Generally the command string will end up with "\\1".
906  * Find the last backslash in the string and NULL-terminate.
907  * Windows does not seem to check for what comes next, so that
908  * a command of the form:
909  * c:\\my_dir\\myfile.exe
910  * will be cut just after "my_dir", whereas a command of the form:
911  * c:\\my_dir\\myfile.exe\\1
912  * will be cut just after "myfile.exe".
913  */
914  pszTmp = wcsrchr(pszCmd, L'\\');
915  if (pszTmp)
916  *pszTmp = L'\0';
917 
918  /*
919  * In the following we try to add pszLatest to the MRU list.
920  * We suppose that our caller has already correctly allocated
921  * the string with enough space for us to append a "\\1".
922  *
923  * FIXME: TODO! (At the moment we don't append it!)
924  */
925 
926  if (pszLatest)
927  {
928  if (wcsicmp(pszCmd, pszLatest) == 0)
929  {
930  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
931  SetWindowTextW(hCb, pszCmd);
932  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
933 
934  cMatch = pszList[Nix];
935  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
936  pszList[0] = cMatch;
937  continue;
938  }
939  }
940 
941  if (icList - 1 != 26 || icList - 2 != Nix || cMatch || pszLatest == NULL)
942  {
943  SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
944  if (!Nix && fShowDefault)
945  {
946  SetWindowTextW(hCb, pszCmd);
947  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
948  }
949  }
950  else
951  {
952  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
953  SetWindowTextW(hCb, pszLatest);
954  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
955 
956  cMatch = pszList[Nix];
957  memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
958  pszList[0] = cMatch;
959  szIndex[0] = cMatch;
960 
961  wcscpy(&pszLatest[cchLatest], L"\\1");
962  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
963  pszLatest[cchLatest] = L'\0';
964  }
965  }
966 
967  if (!cMatch && pszLatest != NULL)
968  {
969  SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
970  SetWindowTextW(hCb, pszLatest);
971  SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
972 
973  cMatch = ++cMax;
974 
975  if (pszList)
976  {
977  pszTmp = (WCHAR*)HeapReAlloc(GetProcessHeap(), 0, pszList, (++icList) * sizeof(WCHAR));
978  if (!pszTmp)
979  {
980  TRACE("HeapReAlloc failed to reallocate enough bytes\n");
981  goto Cleanup;
982  }
983  pszList = pszTmp;
984  }
985  else
986  {
987  pszList = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (++icList) * sizeof(WCHAR));
988  if (!pszList)
989  {
990  TRACE("HeapAlloc failed to allocate enough bytes\n");
991  goto Cleanup;
992  }
993  }
994 
995  memmove(&pszList[1], pszList, (icList - 1) * sizeof(WCHAR));
996  pszList[0] = cMatch;
997  szIndex[0] = cMatch;
998 
999  wcscpy(&pszLatest[cchLatest], L"\\1");
1000  RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (cchLatest + 2 + 1) * sizeof(WCHAR));
1001  pszLatest[cchLatest] = L'\0';
1002  }
1003 
1004 Cleanup:
1005  RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (wcslen(pszList) + 1) * sizeof(WCHAR));
1006 
1007  HeapFree(GetProcessHeap(), 0, pszCmd);
1008  HeapFree(GetProcessHeap(), 0, pszList);
1009 
1010  RegCloseKey(hkey);
1011 }
#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:3988
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
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
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CB_ADDSTRING
Definition: winuser.h:1923
#define CB_INSERTSTRING
Definition: winuser.h:1944
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1946
#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:4899
#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:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wcsicmp
Definition: compat.h:15
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define wcsrchr
Definition: compat.h:16
static const WCHAR Cleanup[]
Definition: register.c:80
#define CB_SETEDITSEL
Definition: winuser.h:1950
#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
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONG_PTR LRESULT
Definition: windef.h:209
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by RunDlgProc().

◆ IsFriendlyUIActive()

static BOOL IsFriendlyUIActive ( VOID  )
static

Definition at line 1303 of file dialogs.cpp.

1304 {
1305  DWORD dwType = 0, dwValue = 0, dwSize = 0;
1306  HKEY hKey = NULL;
1307  LONG lRet = 0;
1308 
1310  L"SYSTEM\\CurrentControlSet\\Control\\Windows",
1311  0,
1313  &hKey);
1314  if (lRet != ERROR_SUCCESS)
1315  return FALSE;
1316 
1317  /* First check an optional ReactOS specific override, that Windows does not check.
1318  We use this to allow users pairing 'Server'-configuration with FriendlyLogoff.
1319  Otherwise users would have to change CSDVersion or LogonType (side-effects AppCompat) */
1320  dwValue = 0;
1321  dwSize = sizeof(dwValue);
1322  lRet = RegQueryValueExW(hKey,
1323  L"EnforceFriendlyLogoff",
1324  NULL,
1325  &dwType,
1326  (LPBYTE)&dwValue,
1327  &dwSize);
1328 
1329  if (lRet == ERROR_SUCCESS && dwType == REG_DWORD && dwValue != FRIENDLY_LOGOFF_IS_NOT_ENFORCED)
1330  {
1331  RegCloseKey(hKey);
1332  return TRUE;
1333  }
1334 
1335  /* Check product version number */
1336  dwValue = 0;
1337  dwSize = sizeof(dwValue);
1338  lRet = RegQueryValueExW(hKey,
1339  L"CSDVersion",
1340  NULL,
1341  &dwType,
1342  (LPBYTE)&dwValue,
1343  &dwSize);
1344  RegCloseKey(hKey);
1345 
1346  if (lRet != ERROR_SUCCESS || dwType != REG_DWORD || dwValue != IS_PRODUCT_VERSION_WORKSTATION)
1347  {
1348  /* Allow Friendly UI only on Workstation */
1349  return FALSE;
1350  }
1351 
1352  /* Check LogonType value */
1354  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1355  0,
1357  &hKey);
1358  if (lRet != ERROR_SUCCESS)
1359  return FALSE;
1360 
1361  dwValue = 0;
1362  dwSize = sizeof(dwValue);
1363  lRet = RegQueryValueExW(hKey,
1364  L"LogonType",
1365  NULL,
1366  &dwType,
1367  (LPBYTE)&dwValue,
1368  &dwSize);
1369  RegCloseKey(hKey);
1370 
1371  if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
1372  return FALSE;
1373 
1374  return (dwValue != 0);
1375 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IS_PRODUCT_VERSION_WORKSTATION
Definition: dialogs.cpp:1104
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define FRIENDLY_LOGOFF_IS_NOT_ENFORCED
Definition: dialogs.cpp:1105
#define REG_DWORD
Definition: sdbapi.c:596
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by LogoffWindowsDialog().

◆ LogOffDialogProc()

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

Definition at line 1412 of file dialogs.cpp.

1413 {
1415  PLOGOFF_DLG_CONTEXT pContext;
1417 
1418  switch (uMsg)
1419  {
1420  case WM_INITDIALOG:
1421  {
1422  pContext = (PLOGOFF_DLG_CONTEXT)lParam;
1424 
1425  if (pContext->bFriendlyUI)
1426  FancyLogoffOnInit(hwnd, pContext);
1427  return TRUE;
1428  }
1429 
1430  case WM_CLOSE:
1433  break;
1434 
1435  /*
1436  * If the user deactivates the log off dialog (it loses its focus
1437  * while the dialog is not being closed), then destroy the dialog
1438  * box.
1439  */
1440  case WM_ACTIVATE:
1441  {
1442  if (LOWORD(wParam) == WA_INACTIVE)
1443  {
1445  PostQuitMessage(0);
1446  }
1447  return FALSE;
1448  }
1449 
1450  case WM_COMMAND:
1451  switch (LOWORD(wParam))
1452  {
1453  case IDC_LOG_OFF_BUTTON:
1454  case IDOK:
1456  break;
1457 
1458  case IDCANCEL:
1461  break;
1462  }
1463  break;
1464 
1465  case WM_DESTROY:
1466  DeleteObject(pContext->hBrush);
1467  DeleteObject(pContext->hImageStrip);
1468  DeleteObject(pContext->hfFont);
1469 
1470  /* Remove the subclass from the buttons */
1471  for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1472  {
1474  }
1475  return TRUE;
1476 
1477  case WM_CTLCOLORSTATIC:
1478  {
1479  /* Either make background transparent or fill it with color for required static controls */
1480  HDC hdcStatic = (HDC)wParam;
1481  UINT StaticID = (UINT)GetWindowLongPtrW((HWND)lParam, GWL_ID);
1482 
1483  switch (StaticID)
1484  {
1486  SetTextColor(hdcStatic, DARK_GREY_COLOR);
1487  SetBkMode(hdcStatic, TRANSPARENT);
1489 
1490  case IDC_LOG_OFF_STATIC:
1492  SetTextColor(hdcStatic, LIGHT_GREY_COLOR);
1493  SetBkMode(hdcStatic, TRANSPARENT);
1494  return (LONG_PTR)pContext->hBrush;
1495  }
1496  return FALSE;
1497  }
1498  break;
1499 
1500  case WM_DRAWITEM:
1501  {
1502  /* Draw bitmaps on required buttons */
1503  switch (pdis->CtlID)
1504  {
1505  case IDC_LOG_OFF_BUTTON:
1507  return DrawIconOnOwnerDrawnButtons(pdis, pContext);
1508  }
1509  }
1510  break;
1511 
1512  default:
1513  break;
1514  }
1515  return FALSE;
1516 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define IDC_LOG_OFF_STATIC
Definition: shresdef.h:483
#define IDOK
Definition: winuser.h:824
struct LOGOFF_DLG_CONTEXT * PLOGOFF_DLG_CONTEXT
#define TRUE
Definition: types.h:120
#define GWL_ID
Definition: winuser.h:853
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1759
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetWindowLongPtrW
Definition: winuser.h:4809
int32_t INT_PTR
Definition: typedefs.h:64
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
#define EWX_LOGOFF
Definition: winuser.h:631
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:481
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define FALSE
Definition: types.h:117
WNDPROC OldButtonProc
Definition: dialogs.cpp:43
static VOID FancyLogoffOnInit(HWND hwnd, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1377
#define TRANSPARENT
Definition: wingdi.h:950
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:482
#define DARK_GREY_COLOR
Definition: dialogs.cpp:1109
#define IDC_SWITCH_USER_STATIC
Definition: shresdef.h:484
#define WM_DESTROY
Definition: winuser.h:1596
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HBITMAP hImageStrip
Definition: dialogs.cpp:40
#define WM_CLOSE
Definition: winuser.h:1608
#define HOLLOW_BRUSH
Definition: wingdi.h:899
#define LIGHT_GREY_COLOR
Definition: dialogs.cpp:1110
#define WM_COMMAND
Definition: winuser.h:1727
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define GWLP_WNDPROC
Definition: treelist.c:66
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:911
BOOL DrawIconOnOwnerDrawnButtons(DRAWITEMSTRUCT *pdis, PLOGOFF_DLG_CONTEXT pContext)
Definition: dialogs.cpp:1127
#define NUMBER_OF_BUTTONS
Definition: dialogs.cpp:1116
#define WM_ACTIVATE
Definition: winuser.h:1599
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WM_DRAWITEM
Definition: winuser.h:1632
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define WA_INACTIVE
Definition: winuser.h:2602
#define IDCANCEL
Definition: winuser.h:825
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define IDC_LOG_OFF_TEXT_STATIC
Definition: shresdef.h:485

Referenced by LogoffWindowsDialog().

◆ LogoffWindowsDialog()

EXTERN_C int WINAPI LogoffWindowsDialog ( HWND  hWndOwner)

Definition at line 1522 of file dialogs.cpp.

1523 {
1524  CComPtr<IUnknown> fadeHandler;
1525  BOOL bIsAltKeyPressed = FALSE;
1526  MSG Msg;
1527  HWND parent = NULL;
1528  HWND hWndChild = NULL;
1529  WCHAR szBuffer[30];
1530  DWORD LogoffDialogID = IDD_LOG_OFF;
1532 
1533  if (!CallShellDimScreen(&fadeHandler, &parent))
1534  parent = hWndOwner;
1535 
1536  Context.bFriendlyUI = IsFriendlyUIActive();
1537  if (Context.bFriendlyUI)
1538  {
1539  LogoffDialogID = IDD_LOG_OFF_FANCY;
1540  }
1541 
1544 
1545  /* Detect either Alt key has been pressed */
1546  while (GetMessageW(&Msg, NULL, 0, 0))
1547  {
1549  {
1552  }
1553 
1554  switch (Msg.message)
1555  {
1556  case WM_SYSKEYDOWN:
1557  {
1558  /* If the Alt key has been pressed once, add prefix to static controls */
1559  if (Msg.wParam == VK_MENU && !bIsAltKeyPressed && Context.bFriendlyUI)
1560  {
1561  for (int i = 0; i < NUMBER_OF_BUTTONS; i++)
1562  {
1563  GetDlgItemTextW(hWndChild, IDC_LOG_OFF_BUTTON + i, szBuffer, _countof(szBuffer));
1565  }
1566  bIsAltKeyPressed = TRUE;
1567  }
1568  }
1569  break;
1570  }
1571  }
1572  return 0;
1573 }
#define IDC_LOG_OFF_STATIC
Definition: shresdef.h:483
#define IDD_LOG_OFF_FANCY
Definition: shresdef.h:521
BOOL WINAPI TranslateMessage(_In_ const MSG *)
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static BOOL IsFriendlyUIActive(VOID)
Definition: dialogs.cpp:1303
#define VK_MENU
Definition: winuser.h:2184
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:481
#define FALSE
Definition: types.h:117
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
r parent
Definition: btrfs.c:2979
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
INT_PTR CALLBACK LogOffDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:1412
#define NUMBER_OF_BUTTONS
Definition: dialogs.cpp:1116
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define shell32_hInstance
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
struct tagContext Context
Definition: acpixf.h:1034
#define WM_SYSKEYDOWN
Definition: winuser.h:1706
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
struct @1589 Msg[]
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDD_LOG_OFF
Definition: shresdef.h:515
HWND hWndChild[NUM_TABS]
Definition: main.h:75
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:1032
BOOL WINAPI IsDialogMessageW(_In_ HWND, _In_ LPMSG)

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

◆ NoIconsInFile()

static void NoIconsInFile ( HWND  hwndDlg,
PPICK_ICON_CONTEXT  pIconContext 
)
static

Definition at line 167 of file dialogs.cpp.

168 {
169  // Show an error message
170  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
171  strText.Format(IDS_NO_ICONS, pIconContext->szPath);
172  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING);
173 
174  // Load the default icons
175  DoLoadIcons(hwndDlg, pIconContext, g_pszShell32);
176 }
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:362
LPCWSTR g_pszShell32
static BOOL DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
Definition: dialogs.cpp:104
#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:311
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by PickIconProc().

◆ OwnerDrawButtonSubclass()

INT_PTR CALLBACK OwnerDrawButtonSubclass ( HWND  hButton,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1210 of file dialogs.cpp.

1211 {
1212  PLOGOFF_DLG_CONTEXT pContext;
1213  pContext = (PLOGOFF_DLG_CONTEXT)GetWindowLongPtrW(hButton, GWLP_USERDATA);
1214 
1215  int buttonID = GetDlgCtrlID(hButton);
1216 
1217  switch (uMsg)
1218  {
1219  case WM_MOUSEMOVE:
1220  {
1221  HWND hwndTarget = NULL;
1223 
1224  if (GetCapture() != hButton)
1225  {
1226  SetCapture(hButton);
1227  if (buttonID == IDC_LOG_OFF_BUTTON)
1228  {
1229  pContext->bIsButtonHot[0] = TRUE;
1230  }
1231  else if (buttonID == IDC_SWITCH_USER_BUTTON)
1232  {
1233  pContext->bIsButtonHot[1] = TRUE;
1234  }
1236  }
1237 
1238  ClientToScreen(hButton, &pt);
1239  hwndTarget = WindowFromPoint(pt);
1240 
1241  if (hwndTarget != hButton)
1242  {
1243  ReleaseCapture();
1244  if (buttonID == IDC_LOG_OFF_BUTTON)
1245  {
1246  pContext->bIsButtonHot[0] = FALSE;
1247  }
1248  else if (buttonID == IDC_SWITCH_USER_BUTTON)
1249  {
1250  pContext->bIsButtonHot[1] = FALSE;
1251  }
1252  }
1253  InvalidateRect(hButton, NULL, FALSE);
1254  break;
1255  }
1256 
1257  /* Whenever one of the buttons gets the keyboard focus, set it as default button */
1258  case WM_SETFOCUS:
1259  {
1260  SendMessageW(GetParent(hButton), DM_SETDEFID, buttonID, 0);
1261  break;
1262  }
1263 
1264  /* Otherwise, set IDCANCEL as default button */
1265  case WM_KILLFOCUS:
1266  {
1267  SendMessageW(GetParent(hButton), DM_SETDEFID, IDCANCEL, 0);
1268  break;
1269  }
1270  }
1271  return CallWindowProcW(pContext->OldButtonProc, hButton, uMsg, wParam, lParam);
1272 }
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
struct LOGOFF_DLG_CONTEXT * PLOGOFF_DLG_CONTEXT
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
#define DM_SETDEFID
Definition: winuser.h:2086
#define GetWindowLongPtrW
Definition: winuser.h:4809
WPARAM wParam
Definition: combotst.c:138
#define IDC_LOG_OFF_BUTTON
Definition: shresdef.h:481
int WINAPI GetDlgCtrlID(_In_ HWND)
#define FALSE
Definition: types.h:117
WNDPROC OldButtonProc
Definition: dialogs.cpp:43
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDC_SWITCH_USER_BUTTON
Definition: shresdef.h:482
#define IDC_HAND
Definition: winuser.h:693
#define WM_KILLFOCUS
Definition: winuser.h:1601
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HWND WINAPI GetParent(_In_ HWND)
HWND WINAPI SetCapture(_In_ HWND hWnd)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_MOUSEMOVE
Definition: winuser.h:1762
#define NULL
Definition: types.h:112
HWND WINAPI WindowFromPoint(_In_ POINT)
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WM_SETFOCUS
Definition: winuser.h:1600
#define IDCANCEL
Definition: winuser.h:825
LPARAM lParam
Definition: combotst.c:139
BOOL bIsButtonHot[2]
Definition: dialogs.cpp:39

Referenced by FancyLogoffOnInit().

◆ PickIconDlg()

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

Definition at line 362 of file dialogs.cpp.

367 {
368  int res;
369  WCHAR szExpandedPath[MAX_PATH];
370 
371  // Initialize the dialog
372  PICK_ICON_CONTEXT IconContext = { NULL };
373  IconContext.Index = *lpdwIconIndex;
374  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), lpstrFile);
375  ExpandEnvironmentStringsW(lpstrFile, szExpandedPath, _countof(szExpandedPath));
376 
377  if (!szExpandedPath[0] ||
378  GetFileAttributesW(szExpandedPath) == INVALID_FILE_ATTRIBUTES)
379  {
380  if (szExpandedPath[0])
381  {
382  // No such file
383  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_PICK_ICON_TITLE));
384  strText.Format(IDS_FILE_NOT_FOUND, lpstrFile);
385  MessageBoxW(hWndOwner, strText, strTitle, MB_ICONWARNING);
386  }
387 
388  // Set the default value
389  StringCchCopyW(IconContext.szPath, _countof(IconContext.szPath), g_pszShell32);
390  }
391 
392  // Show the dialog
394  if (res)
395  {
396  // Store the selected icon
397  StringCchCopyW(lpstrFile, nMaxFile, IconContext.szPath);
398  *lpdwIconIndex = IconContext.Index;
399  }
400 
401  return res;
402 }
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:362
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPCWSTR g_pszShell32
#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
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_PICK_ICON
Definition: shresdef.h:358
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:62
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:312
#define shell32_hInstance
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
INT_PTR CALLBACK PickIconProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.cpp:186
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 186 of file dialogs.cpp.

191 {
192  LPMEASUREITEMSTRUCT lpmis;
193  LPDRAWITEMSTRUCT lpdis;
194  HICON hIcon;
195  INT index, count;
196  WCHAR szText[MAX_PATH], szFilter[100];
197  CStringW strTitle;
199 
201 
202  switch(uMsg)
203  {
204  case WM_INITDIALOG:
205  {
206  pIconContext = (PPICK_ICON_CONTEXT)lParam;
207  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pIconContext);
208  pIconContext->hDlgCtrl = GetDlgItem(hwndDlg, IDC_PICKICON_LIST);
209 
210  SendMessageW(pIconContext->hDlgCtrl, LB_SETCOLUMNWIDTH, CX_ITEM, 0);
211 
212  // Load the icons
213  if (!DoLoadIcons(hwndDlg, pIconContext, pIconContext->szPath))
214  NoIconsInFile(hwndDlg, pIconContext);
215 
216  // Set the selection
217  count = SendMessageW(pIconContext->hDlgCtrl, LB_GETCOUNT, 0, 0);
218  if (count != LB_ERR)
219  {
220  if (pIconContext->Index < 0)
221  {
222  // A negative value will be interpreted as a negated resource ID.
223  LPARAM lParam = -pIconContext->Index;
224  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_FINDSTRINGEXACT, -1, lParam);
225  }
226 
227  if (pIconContext->Index < 0 || count <= pIconContext->Index)
228  pIconContext->Index = 0;
229 
230  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, pIconContext->Index, 0);
231  SendMessageW(pIconContext->hDlgCtrl, LB_SETTOPINDEX, pIconContext->Index, 0);
232  }
233 
235  return TRUE;
236  }
237 
238  case WM_DESTROY:
239  {
240  DestroyIconList(pIconContext->hDlgCtrl, pIconContext);
241  delete[] pIconContext->phIcons;
242 
243  if (pIconContext->hLibrary)
244  FreeLibrary(pIconContext->hLibrary);
245  break;
246  }
247 
248  case WM_COMMAND:
249  switch(LOWORD(wParam))
250  {
251  case IDOK:
252  {
253  /* Check whether the path edit control has been modified; if so load the icons instead of validating */
254  if (SendDlgItemMessage(hwndDlg, IDC_EDIT_PATH, EM_GETMODIFY, 0, 0))
255  {
256  /* Reset the edit control's modification flag and retrieve the text */
258  GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, szText, _countof(szText));
259 
260  // Load the icons
261  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
262  NoIconsInFile(hwndDlg, pIconContext);
263 
264  // Set the selection
265  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
266  break;
267  }
268 
269  /* The path edit control has not been modified, return the selection */
270  pIconContext->Index = (INT)SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
271  GetDlgItemTextW(hwndDlg, IDC_EDIT_PATH, pIconContext->szPath, _countof(pIconContext->szPath));
272  EndDialog(hwndDlg, 1);
273  break;
274  }
275 
276  case IDCANCEL:
277  EndDialog(hwndDlg, 0);
278  break;
279 
280  case IDC_PICKICON_LIST:
281  switch (HIWORD(wParam))
282  {
283  case LBN_SELCHANGE:
285  break;
286 
287  case LBN_DBLCLK:
288  SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
289  break;
290  }
291  break;
292 
293  case IDC_BUTTON_PATH:
294  {
295  // Choose the module path
296  szText[0] = 0;
297  szFilter[0] = 0;
298  ZeroMemory(&ofn, sizeof(ofn));
299  ofn.lStructSize = sizeof(ofn);
300  ofn.hwndOwner = hwndDlg;
301  ofn.lpstrFile = szText;
302  ofn.nMaxFile = _countof(szText);
303  strTitle.LoadString(IDS_PICK_ICON_TITLE);
304  ofn.lpstrTitle = strTitle;
307  if (!GetOpenFileNameW(&ofn))
308  break;
309 
310  // Load the icons
311  if (!DoLoadIcons(hwndDlg, pIconContext, szText))
312  NoIconsInFile(hwndDlg, pIconContext);
313 
314  // Set the selection
315  SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
316  break;
317  }
318 
319  default:
320  break;
321  }
322  break;
323 
324  case WM_MEASUREITEM:
325  lpmis = (LPMEASUREITEMSTRUCT)lParam;
326  lpmis->itemHeight = CY_ITEM;
327  return TRUE;
328 
329  case WM_DRAWITEM:
330  {
331  lpdis = (LPDRAWITEMSTRUCT)lParam;
332  if (lpdis->itemID == (UINT)-1)
333  break;
334  switch (lpdis->itemAction)
335  {
336  case ODA_SELECT:
337  case ODA_DRAWENTIRE:
338  {
339  index = SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
340  hIcon = pIconContext->phIcons[lpdis->itemID];
341 
342  if (lpdis->itemID == (UINT)index)
343  FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
344  else
345  FillRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)(COLOR_WINDOW + 1));
346 
347  // Centering
348  INT x = lpdis->rcItem.left + (CX_ITEM - CX_ICON) / 2;
349  INT y = lpdis->rcItem.top + (CY_ITEM - CY_ICON) / 2;
350 
351  DrawIconEx(lpdis->hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL);
352  break;
353  }
354  }
355  return TRUE;
356  }
357  }
358 
359  return FALSE;
360 }
#define LB_SETCURSEL
Definition: winuser.h:2050
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define IDS_PICK_ICON_TITLE
Definition: shresdef.h:362
static HICON
Definition: imagelist.c:84
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define MAKEWPARAM(l, h)
Definition: winuser.h:3989
#define IDOK
Definition: winuser.h:824
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2022
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2048
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:104
#define INT
Definition: polytest.cpp:20
LONG top
Definition: windef.h:307
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1667
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SendDlgItemMessage
Definition: winuser.h:5822
LONG left
Definition: windef.h:306
#define LBN_SELCHANGE
Definition: winuser.h:2062
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:912
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:359
struct PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
#define FALSE
Definition: types.h:117
#define LB_ERR
Definition: winuser.h:2412
static void NoIconsInFile(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:167
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4677
#define IDS_PICK_ICON_FILTER
Definition: shresdef.h:363
LONG_PTR LPARAM
Definition: windef.h:208
LPTSTR szFilter
Definition: mplay32.c:30
#define CX_ITEM
Definition: dialogs.cpp:183
GLuint index
Definition: glext.h:6031
#define LB_GETCOUNT
Definition: winuser.h:2025
#define CY_ICON
Definition: dialogs.cpp:180
#define WM_DESTROY
Definition: winuser.h:1596
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define IDC_BUTTON_PATH
Definition: shresdef.h:360
#define ODA_DRAWENTIRE
Definition: winuser.h:2522
#define FreeLibrary(x)
Definition: compat.h:607
#define LB_SETTOPINDEX
Definition: winuser.h:2057
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
_In_ WDFCOLLECTION _In_ ULONG Index
#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:1981
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define WM_MEASUREITEM
Definition: winuser.h:1633
#define IDC_EDIT_PATH
Definition: shresdef.h:361
#define LBN_DBLCLK
Definition: winuser.h:2058
static void DestroyIconList(HWND hDlgCtrl, PPICK_ICON_CONTEXT pIconContext)
Definition: dialogs.cpp:87
#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:2000
#define WM_COMMAND
Definition: winuser.h:1727
#define CX_ICON
Definition: dialogs.cpp:179
#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:2026
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WM_DRAWITEM
Definition: winuser.h:1632
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define SendMessage
Definition: winuser.h:5823
HMODULE hLibrary
Definition: dialog.c:549
#define SHACF_DEFAULT
Definition: shlwapi.h:1911
#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:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define CY_ITEM
Definition: dialogs.cpp:184
#define ODA_SELECT
Definition: winuser.h:2523

Referenced by PickIconDlg().

◆ RestartDialog()

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

Definition at line 1579 of file dialogs.cpp.

1580 {
1581  return RestartDialogEx(hWndOwner, lpstrReason, uFlags, 0);
1582 }
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason)
Definition: dialogs.cpp:1082
UINT uFlags
Definition: api.c:59

◆ RestartDialogEx()

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

Definition at line 1082 of file dialogs.cpp.

1083 {
1084  TRACE("(%p)\n", hWndOwner);
1085 
1086  CComPtr<IUnknown> fadeHandler;
1087  HWND parent;
1088 
1089  if (!CallShellDimScreen(&fadeHandler, &parent))
1090  parent = hWndOwner;
1091 
1092  /* FIXME: use lpwstrReason */
1094  {
1095  EnablePrivilege(L"SeShutdownPrivilege", TRUE);
1096  ExitWindowsEx(EWX_REBOOT, uReason);
1097  EnablePrivilege(L"SeShutdownPrivilege", FALSE);
1098  }
1099 
1100  return 0;
1101 }
#define TRUE
Definition: types.h:120
#define EWX_REBOOT
Definition: winuser.h:633
#define IDS_RESTART_TITLE
Definition: shresdef.h:82
#define L(x)
Definition: ntvdm.h:50
#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:1019
r parent
Definition: btrfs.c:2979
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: dialogs.cpp:1052
#define IDS_RESTART_PROMPT
Definition: shresdef.h:83
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL CallShellDimScreen(IUnknown **pUnknown, HWND *hWindow)
Definition: dialogs.cpp:1032

Referenced by RestartDialog().

◆ RunDlg_GetParentDir()

static LPWSTR RunDlg_GetParentDir ( LPCWSTR  cmdline)
static

Definition at line 432 of file dialogs.cpp.

433 {
434  const WCHAR *src;
435  WCHAR *dest, *result, *result_end=NULL;
436 
437  result = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(strlenW(cmdline)+5));
438 
439  if (NULL == result)
440  {
441  TRACE("HeapAlloc couldn't allocate %d bytes\n", sizeof(WCHAR)*(strlenW(cmdline)+5));
442  return NULL;
443  }
444 
445  src = cmdline;
446  dest = result;
447 
448  if (*src == '"')
449  {
450  src++;
451  while (*src && *src != '"')
452  {
453  if (*src == '\\')
454  result_end = dest;
455  *dest++ = *src++;
456  }
457  }
458  else {
459  while (*src)
460  {
461  if (isspaceW(*src))
462  {
463  *dest = 0;
465  break;
466  strcatW(dest, L".exe");
468  break;
469  }
470  else if (*src == '\\')
471  result_end = dest;
472  *dest++ = *src++;
473  }
474  }
475 
476  if (result_end)
477  {
478  *result_end = 0;
479  return result;
480  }
481  else
482  {
484  return NULL;
485  }
486 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLuint64EXT * result
Definition: glext.h:11304
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define L(x)
Definition: ntvdm.h:50
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#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
GLenum src
Definition: glext.h:6340
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define NULL
Definition: types.h:112
static char * dest
Definition: rtl.c:135
#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 511 of file dialogs.cpp.

512 {
514  HWND hwndCombo, hwndEdit;
515  COMBOBOXINFO ComboInfo;
516 
517  switch (message)
518  {
519  case WM_INITDIALOG:
520  prfdp = (RUNFILEDLGPARAMS *)lParam;
522 
523  if (prfdp->lpstrTitle)
524  SetWindowTextW(hwnd, prfdp->lpstrTitle);
525  if (prfdp->lpstrDescription)
527  if (prfdp->uFlags & RFF_NOBROWSE)
528  {
530  ShowWindow(browse, SW_HIDE);
531  EnableWindow(browse, FALSE);
532  }
533  if (prfdp->uFlags & RFF_NOLABEL)
535  if (prfdp->uFlags & RFF_NOSEPARATEMEM)
536  {
537  FIXME("RFF_NOSEPARATEMEM not supported\n");
538  }
539 
540  /* Use the default Shell Run icon if no one is specified */
541  if (prfdp->hIcon == NULL)
543  /*
544  * NOTE: Starting Windows Vista, the "Run File" dialog gets a
545  * title icon that remains the same as the default one, even if
546  * the user specifies a custom icon.
547  * Since we currently imitate Windows 2003, therefore do not show
548  * any title icon.
549  */
550  // SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)prfdp->hIcon);
551  // SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon);
553 
554  hwndCombo = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH);
555  FillList(hwndCombo, NULL, 0, (prfdp->uFlags & RFF_NODEFAULT) == 0);
557 
558  ComboInfo.cbSize = sizeof(ComboInfo);
559  GetComboBoxInfo(hwndCombo, &ComboInfo);
560  hwndEdit = ComboInfo.hwndItem;
562 
563  // SHAutoComplete needs co init
565 
567 
568  SetFocus(hwndCombo);
569  return TRUE;
570 
571  case WM_DESTROY:
572  if (prfdp->bCoInited)
573  CoUninitialize();
574  break;
575 
576  case WM_COMMAND:
577  switch (LOWORD(wParam))
578  {
579  case IDOK:
580  {
581  LRESULT lRet;
583  INT ic;
584  WCHAR *psz, *pszExpanded, *parent = NULL;
585  DWORD cchExpand;
586  SHELLEXECUTEINFOW sei;
587  NMRUNFILEDLGW nmrfd;
588 
589  ic = GetWindowTextLengthW(htxt);
590  if (ic == 0)
591  {
593  return TRUE;
594  }
595 
596  ZeroMemory(&sei, sizeof(sei));
597  sei.cbSize = sizeof(sei);
598 
599  /*
600  * Allocate a new MRU entry, we need to add two characters
601  * for the terminating "\\1" part, then the NULL character.
602  */
603  psz = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (ic + 2 + 1)*sizeof(WCHAR));
604  if (!psz)
605  {
607  return TRUE;
608  }
609 
610  GetWindowTextW(htxt, psz, ic + 1);
611  sei.hwnd = hwnd;
612  sei.nShow = SW_SHOWNORMAL;
613  sei.lpFile = psz;
614  StrTrimW(psz, L" \t");
615 
616  if (wcschr(psz, L'%') != NULL)
617  {
618  cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
619  pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
620  if (!pszExpanded)
621  {
622  HeapFree(GetProcessHeap(), 0, psz);
624  return TRUE;
625  }
626  ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
627  StrTrimW(pszExpanded, L" \t");
628  }
629  else
630  {
631  pszExpanded = psz;
632  }
633 
634  /*
635  * The precedence is the following: first the user-given
636  * current directory is used; if there is none, a current
637  * directory is computed if the RFF_CALCDIRECTORY is set,
638  * otherwise no current directory is defined.
639  */
640  LPCWSTR pszStartDir;
641  if (prfdp->lpstrDirectory)
642  {
643  sei.lpDirectory = prfdp->lpstrDirectory;
644  pszStartDir = prfdp->lpstrDirectory;
645  }
646  else if (prfdp->uFlags & RFF_CALCDIRECTORY)
647  {
649  pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
650  }
651  else
652  {
653  sei.lpDirectory = NULL;
654  pszStartDir = NULL;
655  }
656 
657  /* Hide the dialog for now on, we will show it up in case of retry */
659 
660  /*
661  * As shown by manual tests on Windows, modifying the contents
662  * of the notification structure will not modify what the
663  * Run-Dialog will use for the nShow parameter. However the
664  * lpFile and lpDirectory pointers are set to the buffers used
665  * by the Run-Dialog, as a consequence they can be modified by
666  * the notification receiver, as long as it respects the lengths
667  * of the buffers (to avoid buffer overflows).
668  */
669  nmrfd.hdr.code = RFN_VALIDATE;
670  nmrfd.hdr.hwndFrom = hwnd;
671  nmrfd.hdr.idFrom = 0;
672  nmrfd.lpFile = pszExpanded;
673  nmrfd.lpDirectory = pszStartDir;
674  nmrfd.nShow = SW_SHOWNORMAL;
675 
676  lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
677 
678  switch (lRet)
679  {
680  case RF_CANCEL:
682  break;
683 
684  case RF_OK:
685  /* We use SECL_NO_UI because we don't want to see
686  * errors here, but we will try again below and
687  * there we will output our errors. */
688  if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
690  {
691  /* Call GetWindowText again in case the contents of the edit box have changed. */
692  GetWindowTextW(htxt, psz, ic + 1);
693  FillList(htxt, psz, ic + 2 + 1, FALSE);
694  EndDialog(hwnd, IDOK);
695  break;
696  }
697  else if (SUCCEEDED(ShellExecuteExW(&sei)))
698  {
699  /* Call GetWindowText again in case the contents of the edit box have changed. */
700  GetWindowTextW(htxt, psz, ic + 1);
701  FillList(htxt, psz, ic + 2 + 1, FALSE);
702  EndDialog(hwnd, IDOK);
703  break;
704  }
705 
706  /* Fall-back */
707  case RF_RETRY:
708  default:
709  SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
710  /* Show back the dialog */
712  break;
713  }
714 
716  HeapFree(GetProcessHeap(), 0, psz);
717  if (psz != pszExpanded)
718  HeapFree(GetProcessHeap(), 0, pszExpanded);
719  return TRUE;
720  }
721 
722  case IDCANCEL:
724  return TRUE;
725 
726  case IDC_RUNDLG_BROWSE:
727  {
728  HMODULE hComdlg = NULL;
729  LPFNOFN ofnProc = NULL;
730  WCHAR szFName[1024] = {0};
731  WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
733 
736 
737  ZeroMemory(&ofn, sizeof(ofn));
738  ofn.lStructSize = sizeof(ofn);
739  ofn.hwndOwner = hwnd;
741  ofn.lpstrFile = szFName;
742  ofn.nMaxFile = _countof(szFName) - 1;
743  ofn.lpstrTitle = szCaption;
746 
747  if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)) ||
748  NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
749  {
750  ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
752  return TRUE;
753  }
754 
755  if (ofnProc(&ofn))
756  {
762  }
763 
764  FreeLibrary(hComdlg);
765 
766  return TRUE;
767  }
768  case IDC_RUNDLG_EDITPATH:
769  {
770  if (HIWORD(wParam) == CBN_EDITCHANGE)
771  {
773  }
774  return TRUE;
775  }
776  }
777  return TRUE;
778  }
779  return FALSE;
780 }
#define SHACF_URLALL
Definition: shlwapi.h:1915
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
#define STM_SETICON
Definition: winuser.h:2079
#define IDC_RUNDLG_EDITPATH
Definition: shresdef.h:337
Definition: tftpd.h:59
static void FillList(HWND, LPWSTR, UINT, BOOL)
Definition: dialogs.cpp:788
#define IDOK
Definition: winuser.h:824
#define IDC_RUNDLG_ICON
Definition: shresdef.h:336
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 SECL_NO_UI
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1667
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:4809
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_RUNDLG_BROWSE_ERROR
Definition: shresdef.h:193
#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:488
static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
Definition: dialogs.cpp:432
DWORD nMaxFile
Definition: commdlg.h:337
UINT code
Definition: winuser.h:3139
LPCWSTR lpstrDescription
Definition: dialogs.cpp:31
#define L(x)
Definition: ntvdm.h:50
#define IDC_RUNDLG_DESCRIPTION
Definition: shresdef.h:334
#define FALSE
Definition: types.h:117
UINT_PTR idFrom
Definition: winuser.h:3138
if SUCCEEDED(hr)
LPCWSTR lpDirectory
Definition: shellapi.h:332
#define IDS_RUNDLG_BROWSE_FILTER
Definition: shresdef.h:195
#define FIXME(fmt,...)
Definition: debug.h:111
#define IDC_RUNDLG_LABEL
Definition: shresdef.h:338
#define SHACF_FILESYSTEM
Definition: shlwapi.h:1912
#define RFN_VALIDATE
Definition: undocshell.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define SECL_ALLOW_NONEXE
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2343
#define SW_SHOW
Definition: winuser.h:769
#define WM_DESTROY
Definition: winuser.h:1596
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#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:1962
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define ASSERT(a)
Definition: mode.c:44
r parent
Definition: btrfs.c:2979
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
#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:1727
HWND hwndFrom
Definition: winuser.h:3137
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:1950
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:63
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
BOOL(WINAPI * LPFNOFN)(OPENFILENAMEW *)
Definition: dialogs.cpp:46
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
LPCWSTR lpstrTitle
Definition: dialogs.cpp:30
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:194
#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:29
#define GetProcAddress(x, y)
Definition: compat.h:612
#define SHACF_FILESYS_ONLY
Definition: shlwapi.h:1917
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define WM_INITDIALOG
Definition: winuser.h:1726
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:548
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
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 409 of file dialogs.cpp.

416 {
417  TRACE("\n");
418 
419  RUNFILEDLGPARAMS rfdp;
420  rfdp.hwndOwner = hWndOwner;
421  rfdp.hIcon = hIcon;
422  rfdp.lpstrDirectory = lpstrDirectory;
423  rfdp.lpstrTitle = lpstrTitle;
424  rfdp.lpstrDescription = lpstrDescription;
425  rfdp.uFlags = uFlags;
426 
428 }
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:31
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM)
Definition: dialogs.cpp:511
#define TRACE(s)
Definition: solgame.cpp:4
#define IDD_RUN
Definition: shresdef.h:333
#define shell32_hInstance
HICON hIcon
Definition: msconfig.c:44
LPCWSTR lpstrTitle
Definition: dialogs.cpp:30
LPCWSTR lpstrDirectory
Definition: dialogs.cpp:29
#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  )