ReactOS 0.4.16-dev-306-g647d351
folder_options.cpp File Reference
#include "precomp.h"
Include dependency graph for folder_options.cpp:

Go to the source code of this file.

Classes

class  CMSGlobalFolderOptionsStub
 

Macros

#define GlobalFolderOptionsClassName   _T("MSGlobalFolderOptionsStub")
 

Enumerations

enum  { PAGE_GENERAL , PAGE_VIEW , PAGE_FILETYPES }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
HBITMAP Create24BppBitmap (HDC hDC, INT cx, INT cy)
 
HBITMAP BitmapFromIcon (HICON hIcon, INT cx, INT cy)
 
HBITMAP CreateCheckImage (HDC hDC, BOOL bCheck, BOOL bEnabled)
 
HBITMAP CreateCheckMask (HDC hDC)
 
HBITMAP CreateRadioImage (HDC hDC, BOOL bCheck, BOOL bEnabled)
 
HBITMAP CreateRadioMask (HDC hDC)
 
EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx (HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
static DWORD CALLBACK ShowFolderOptionsDialogThreadProc (LPVOID param)
 
VOID WINAPI ShowFolderOptionsDialog (UINT Page, BOOL Async=FALSE)
 
static VOID Options_RunDLLCommon (HWND hWnd, HINSTANCE hInst, int fOptions, DWORD nCmdShow)
 
EXTERN_C VOID WINAPI Options_RunDLL (HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow)
 
EXTERN_C VOID WINAPI Options_RunDLLA (HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow)
 
EXTERN_C VOID WINAPI Options_RunDLLW (HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
 

Variables

LPCWSTR g_pszShell32 = L"%SystemRoot%\\system32\\shell32.dll"
 
LPCWSTR g_pszSpace = L" \t\n\r\f\v"
 

Macro Definition Documentation

◆ GlobalFolderOptionsClassName

#define GlobalFolderOptionsClassName   _T("MSGlobalFolderOptionsStub")

Definition at line 196 of file folder_options.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PAGE_GENERAL 
PAGE_VIEW 
PAGE_FILETYPES 

Definition at line 228 of file folder_options.cpp.

228 {
230 PAGE_VIEW,
232};
@ PAGE_FILETYPES
@ PAGE_VIEW
@ PAGE_GENERAL

Function Documentation

◆ BitmapFromIcon()

HBITMAP BitmapFromIcon ( HICON  hIcon,
INT  cx,
INT  cy 
)

Definition at line 58 of file folder_options.cpp.

59{
61 if (!hDC)
62 return NULL;
63
65 if (!hbm)
66 {
68 return NULL;
69 }
70
71 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
72 {
73 RECT rc = { 0, 0, cx, cy };
74 FillRect(hDC, &rc, HBRUSH(COLOR_3DFACE + 1));
75 if (hIcon)
76 {
77 DrawIconEx(hDC, 0, 0, hIcon, cx, cy, 0, NULL, DI_NORMAL);
78 }
79 }
80 SelectObject(hDC, hbmOld);
82
83 return hbm;
84}
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
HBITMAP Create24BppBitmap(HDC hDC, INT cx, INT cy)
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
HICON hIcon
Definition: msconfig.c:44
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DI_NORMAL
Definition: wingdi.h:72
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
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:2080
#define COLOR_3DFACE
Definition: winuser.h:932

◆ Create24BppBitmap()

HBITMAP Create24BppBitmap ( HDC  hDC,
INT  cx,
INT  cy 
)

Definition at line 41 of file folder_options.cpp.

42{
43 BITMAPINFO bi;
44 LPVOID pvBits;
45
46 ZeroMemory(&bi, sizeof(bi));
48 bi.bmiHeader.biWidth = cx;
50 bi.bmiHeader.biPlanes = 1;
51 bi.bmiHeader.biBitCount = 24;
53
54 HBITMAP hbm = CreateDIBSection(hDC, &bi, DIB_RGB_COLORS, &pvBits, NULL, 0);
55 return hbm;
56}
#define BI_RGB
Definition: precomp.h:56
USHORT biBitCount
Definition: precomp.h:46
ULONG biCompression
Definition: precomp.h:47
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define ZeroMemory
Definition: winbase.h:1737
#define DIB_RGB_COLORS
Definition: wingdi.h:367

Referenced by BitmapFromIcon(), CreateCheckImage(), and CreateRadioImage().

◆ CreateCheckImage()

HBITMAP CreateCheckImage ( HDC  hDC,
BOOL  bCheck,
BOOL  bEnabled 
)

Definition at line 86 of file folder_options.cpp.

87{
88 INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
89 INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
90
91 HBITMAP hbm = Create24BppBitmap(hDC, cxSmallIcon, cySmallIcon);
92 if (hbm == NULL)
93 return NULL; // failure
94
95 RECT Rect, BoxRect;
96 SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
97 BoxRect = Rect;
98 InflateRect(&BoxRect, -1, -1);
99
100 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
101 {
103 if (bCheck)
104 uState |= DFCS_CHECKED;
105 if (!bEnabled)
106 uState |= DFCS_INACTIVE;
107 DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
108 }
109 SelectObject(hDC, hbmOld);
110
111 return hbm; // success
112}
unsigned int UINT
Definition: ndis.h:50
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFC_BUTTON
Definition: winuser.h:476
#define SM_CYSMICON
Definition: winuser.h:1016
#define DFCS_MONO
Definition: winuser.h:511
#define SM_CXSMICON
Definition: winuser.h:1015
#define DFCS_CHECKED
Definition: winuser.h:504
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

◆ CreateCheckMask()

HBITMAP CreateCheckMask ( HDC  hDC)

Definition at line 114 of file folder_options.cpp.

115{
116 INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
117 INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
118
119 HBITMAP hbm = CreateBitmap(cxSmallIcon, cySmallIcon, 1, 1, NULL);
120 if (hbm == NULL)
121 return NULL; // failure
122
123 RECT Rect, BoxRect;
124 SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
125 BoxRect = Rect;
126 InflateRect(&BoxRect, -1, -1);
127
128 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
129 {
131 FillRect(hDC, &BoxRect, HBRUSH(GetStockObject(BLACK_BRUSH)));
132 }
133 SelectObject(hDC, hbmOld);
134
135 return hbm; // success
136}
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_BRUSH
Definition: wingdi.h:896

◆ CreateRadioImage()

HBITMAP CreateRadioImage ( HDC  hDC,
BOOL  bCheck,
BOOL  bEnabled 
)

Definition at line 138 of file folder_options.cpp.

139{
140 INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
141 INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
142
143 HBITMAP hbm = Create24BppBitmap(hDC, cxSmallIcon, cySmallIcon);
144 if (hbm == NULL)
145 return NULL; // failure
146
147 RECT Rect, BoxRect;
148 SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
149 BoxRect = Rect;
150 InflateRect(&BoxRect, -1, -1);
151
152 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
153 {
155 if (bCheck)
156 uState |= DFCS_CHECKED;
157 if (!bEnabled)
158 uState |= DFCS_INACTIVE;
159 DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
160 }
161 SelectObject(hDC, hbmOld);
162
163 return hbm; // success
164}
#define DFCS_BUTTONRADIOIMAGE
Definition: winuser.h:497

◆ CreateRadioMask()

HBITMAP CreateRadioMask ( HDC  hDC)

Definition at line 166 of file folder_options.cpp.

167{
168 INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
169 INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
170
171 HBITMAP hbm = CreateBitmap(cxSmallIcon, cySmallIcon, 1, 1, NULL);
172 if (hbm == NULL)
173 return NULL; // failure
174
175 RECT Rect, BoxRect;
176 SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
177 BoxRect = Rect;
178 InflateRect(&BoxRect, -1, -1);
179
180 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
181 {
184 DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
185 }
186 SelectObject(hDC, hbmOld);
187
188 return hbm; // success
189}
#define DFCS_BUTTONRADIOMASK
Definition: winuser.h:498

◆ Options_RunDLL()

EXTERN_C VOID WINAPI Options_RunDLL ( HWND  hWnd,
HINSTANCE  hInst,
LPCSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 336 of file folder_options.cpp.

337{
339}
HWND hWnd
Definition: settings.c:17
INT WINAPI StrToIntA(LPCSTR lpszStr)
Definition: string.c:370
HINSTANCE hInst
Definition: dxdiag.c:13
static VOID Options_RunDLLCommon(HWND hWnd, HINSTANCE hInst, int fOptions, DWORD nCmdShow)
Definition: ftp_var.h:139

◆ Options_RunDLLA()

EXTERN_C VOID WINAPI Options_RunDLLA ( HWND  hWnd,
HINSTANCE  hInst,
LPCSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 345 of file folder_options.cpp.

346{
348}

◆ Options_RunDLLCommon()

static VOID Options_RunDLLCommon ( HWND  hWnd,
HINSTANCE  hInst,
int  fOptions,
DWORD  nCmdShow 
)
static

Definition at line 306 of file folder_options.cpp.

307{
308 switch(fOptions)
309 {
310 case 0:
312 break;
313
314 case 1: // Taskbar settings
315#if (NTDDI_VERSION >= NTDDI_VISTA)
316 case 3: // Start menu settings
317 case 4: // Tray icon settings
318 case 6: // Taskbar toolbars
319#endif
321 break;
322
323 case 7: // Windows 8, 10
325 break;
326
327 default:
328 FIXME("unrecognized options id %d\n", fOptions);
329 }
330}
#define FIXME(fmt,...)
Definition: precomp.h:53
VOID WINAPI ShowFolderOptionsDialog(UINT Page, BOOL Async=FALSE)
#define WM_PROGMAN_OPENSHELLSETTINGS
Definition: undocshell.h:60
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define PostMessage
Definition: winuser.h:5844

Referenced by Options_RunDLL(), Options_RunDLLA(), and Options_RunDLLW().

◆ Options_RunDLLW()

EXTERN_C VOID WINAPI Options_RunDLLW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 354 of file folder_options.cpp.

355{
357}
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:407

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 212 of file folder_options.cpp.

213{
214 // NOTE: This callback is needed to set large icon correctly.
215 HICON hIcon;
216 switch (uMsg)
217 {
218 case PSCB_INITIALIZED:
219 {
221 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
222 break;
223 }
224 }
225 return 0;
226}
#define shell32_hInstance
static HICON
Definition: imagelist.c:80
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define IDI_SHELL_FOLDER_OPTIONS
Definition: shresdef.h:666
#define ICON_BIG
Definition: tnclass.cpp:51
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ShowFolderOptionsDialogThreadProc().

◆ SHCreatePropSheetExtArrayEx()

EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx ( HKEY  hKey,
LPCWSTR  pszSubKey,
UINT  max_iface,
IDataObject pDataObj 
)

◆ ShowFolderOptionsDialog()

VOID WINAPI ShowFolderOptionsDialog ( UINT  Page,
BOOL  Async = FALSE 
)

Definition at line 284 of file folder_options.cpp.

285{
287 if (hWnd)
288 {
290 if (hWnd == GetParent(hPop))
291 {
292 PostMessage(hPop, PSM_SETCURSEL, Page, 0);
293 }
295 return;
296 }
297
299 if (Async)
301 else
302 ShowFolderOptionsDialogThreadProc(param); // Rundll32 caller cannot be async!
303}
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
#define UlongToPtr(u)
Definition: config.h:106
#define GlobalFolderOptionsClassName
static DWORD CALLBACK ShowFolderOptionsDialogThreadProc(LPVOID param)
GLfloat param
Definition: glext.h:5796
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
#define PSM_SETCURSEL
Definition: prsht.h:167
#define FindWindow
Definition: winuser.h:5789
HWND WINAPI GetLastActivePopup(_In_ HWND)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HWND WINAPI GetParent(_In_ HWND)

Referenced by CDesktopBrowser::OnShowOptionsDlg(), and Options_RunDLLCommon().

◆ ShowFolderOptionsDialogThreadProc()

static DWORD CALLBACK ShowFolderOptionsDialogThreadProc ( LPVOID  param)
static

Definition at line 235 of file folder_options.cpp.

236{
237 CCoInit com; // Required when started from rundll32 (SHAutoComplete in PickIconDlg)
238 PROPSHEETHEADERW pinfo;
239 HPROPSHEETPAGE hppages[3];
240 HPROPSHEETPAGE hpage;
241 UINT num_pages = 0;
242
244 if (hpage)
245 hppages[num_pages++] = hpage;
246
248 if (hpage)
249 hppages[num_pages++] = hpage;
250
252 if (hpage)
253 hppages[num_pages++] = hpage;
254
255 // the stub window to hide taskbar button
259 if (!stub.Create(NULL, NULL, NULL, style, exstyle))
260 {
261 ERR("stub.Create failed\n");
262 return 0;
263 }
264
265 memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW));
266 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
267 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_USEICONID | PSH_USECALLBACK;
268 pinfo.hwndParent = stub;
269 pinfo.nPages = num_pages;
270 pinfo.phpage = hppages;
275 pinfo.nStartPage = PtrToUlong(param);
276
277 PropertySheetW(&pinfo);
278
279 stub.DestroyWindow();
280 return 0;
281}
INT_PTR CALLBACK FolderOptionsViewDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: view.cpp:953
INT_PTR CALLBACK FolderOptionsFileTypesDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1871
INT_PTR CALLBACK FolderOptionsGeneralDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.cpp:331
Arabic default style
Definition: afstyles.h:94
#define ERR(fmt,...)
Definition: precomp.h:57
#define IDS_FOLDER_OPTIONS
Definition: resource.h:132
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define PtrToUlong(u)
Definition: config.h:107
unsigned long DWORD
Definition: ntddk_ex.h:95
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define WS_CAPTION
Definition: pedump.c:624
#define WS_DISABLED
Definition: pedump.c:621
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define memset(x, y, z)
Definition: compat.h:39
#define IDD_FOLDER_OPTIONS_FILETYPES
Definition: shresdef.h:412
#define IDD_FOLDER_OPTIONS_GENERAL
Definition: shresdef.h:410
#define IDD_FOLDER_OPTIONS_VIEW
Definition: shresdef.h:411
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
UINT nStartPage
Definition: prsht.h:304
LPCWSTR pszCaption
Definition: prsht.h:301
Definition: stubgen.c:11
struct _stub stub
HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle)
Definition: propsheet.cpp:208
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407

Referenced by ShowFolderOptionsDialog().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fprop  )

Variable Documentation

◆ g_pszShell32

LPCWSTR g_pszShell32 = L"%SystemRoot%\\system32\\shell32.dll"

Definition at line 33 of file folder_options.cpp.

Referenced by NoIconsInFile(), Normalize(), and PickIconDlg().

◆ g_pszSpace

LPCWSTR g_pszSpace = L" \t\n\r\f\v"