From 227cebabacc42b438133dcae8b0d70041d3ae8d9 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 25 Aug 2015 12:25:51 -0500 Subject: [PATCH 5/6] comdlg32: Enable visual styles in item dialog. --- dlls/comdlg32/cdlg.h | 2 ++ dlls/comdlg32/cdlg32.c | 14 +++++++++++++- dlls/comdlg32/comdlg32.rc | 3 +++ dlls/comdlg32/itemdlg.c | 22 ++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/dlls/comdlg32/cdlg.h b/dlls/comdlg32/cdlg.h index 886804c..2fd1d81 100644 --- a/dlls/comdlg32/cdlg.h +++ b/dlls/comdlg32/cdlg.h @@ -28,6 +28,8 @@ extern HINSTANCE COMDLG32_hInstance DECLSPEC_HIDDEN; +extern HANDLE COMDLG32_ActCtx DECLSPEC_HIDDEN; + void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN; LPVOID COMDLG32_AllocMem(int size) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN; diff --git a/dlls/comdlg32/cdlg32.c b/dlls/comdlg32/cdlg32.c index e794f94..e7c331c 100644 --- a/dlls/comdlg32/cdlg32.c +++ b/dlls/comdlg32/cdlg32.c @@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance = 0; +DECLSPEC_HIDDEN HANDLE COMDLG32_ActCtx = 0; + static DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES; static HINSTANCE SHELL32_hInstance; @@ -83,6 +85,9 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) switch(Reason) { case DLL_PROCESS_ATTACH: + { + ACTCTXW actctx; + COMDLG32_hInstance = hInstance; DisableThreadLibraryCalls(hInstance); @@ -109,12 +114,19 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) GPA(COMDLG32_SHGetFolderPathW, SHFOLDER_hInstance,"SHGetFolderPathW"); } - break; + actctx.cbSize = sizeof(actctx); + actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID|ACTCTX_FLAG_HMODULE_VALID; + actctx.lpResourceName = MAKEINTRESOURCEW(ISOLATIONAWARE_MANIFEST_RESOURCE_ID); + actctx.hModule = hInstance; + COMDLG32_ActCtx = CreateActCtxW(&actctx); + break; + } case DLL_PROCESS_DETACH: if (Reserved) break; if (COMDLG32_TlsIndex != TLS_OUT_OF_INDEXES) TlsFree(COMDLG32_TlsIndex); if(SHFOLDER_hInstance) FreeLibrary(SHFOLDER_hInstance); + if (COMDLG32_ActCtx) ReleaseActCtx(COMDLG32_ActCtx); break; } return TRUE; diff --git a/dlls/comdlg32/comdlg32.rc b/dlls/comdlg32/comdlg32.rc index bd19cf3..240972e 100644 --- a/dlls/comdlg32/comdlg32.rc +++ b/dlls/comdlg32/comdlg32.rc @@ -540,6 +540,9 @@ STRINGTABLE } +/* @makedep: comdlg32.manifest */ +ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST comdlg32.manifest + /* @makedep: pd32_collate.ico */ PD32_COLLATE ICON pd32_collate.ico diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index ef4da2b..aba4fc4 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -146,6 +146,8 @@ typedef struct FileDialogImpl { BOOL opendropdown_has_selection; DWORD opendropdown_selection; + ULONG_PTR actctx_cookie; + GUID client_guid; } FileDialogImpl; @@ -1105,6 +1107,7 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, HWND ns_hwnd, control_hwnd, parent_hwnd; DWORD wsflags = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS; customctrl *ctrl; + ULONG_PTR cookie; if(get_cctrl(This, id)) return E_UNEXPECTED; /* Duplicate id */ @@ -1114,6 +1117,8 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, else parent_hwnd = This->cctrls_hwnd; + ActivateActCtx(COMDLG32_ActCtx, &cookie); + ns_hwnd = CreateWindowExW(0, floatnotifysinkW, NULL, wsflags, 0, 0, This->cctrl_width, height, parent_hwnd, (HMENU)This->cctrl_next_dlgid, COMDLG32_hInstance, This); @@ -1121,6 +1126,8 @@ static HRESULT cctrl_create_new(FileDialogImpl *This, DWORD id, 0, 0, This->cctrl_width, height, ns_hwnd, (HMENU)This->cctrl_next_dlgid, COMDLG32_hInstance, 0); + DeactivateActCtx(0, cookie); + if(!ns_hwnd || !control_hwnd) { ERR("Failed to create wrapper (%p) or control (%p)\n", ns_hwnd, control_hwnd); @@ -1851,6 +1858,12 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam) SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LPARAM)This); This->dlg_hwnd = hwnd; + if (This->actctx_cookie) + { + DeactivateActCtx(0, This->actctx_cookie); + This->actctx_cookie = 0; + } + hitem = GetDlgItem(This->dlg_hwnd, pshHelp); if(hitem) ShowWindow(hitem, SW_HIDE); @@ -2108,9 +2121,16 @@ static HRESULT create_dialog(FileDialogImpl *This, HWND parent) INT_PTR res; SetLastError(0); + ActivateActCtx(COMDLG32_ActCtx, &This->actctx_cookie); res = DialogBoxParamW(COMDLG32_hInstance, MAKEINTRESOURCEW(NEWFILEOPENV3ORD), parent, itemdlg_dlgproc, (LPARAM)This); + if (This->actctx_cookie) + { + /* Normally our context will be deactivated in WM_INITDIALOG. */ + DeactivateActCtx(0, This->actctx_cookie); + This->actctx_cookie = 0; + } This->dlg_hwnd = NULL; if(res == -1) { @@ -4408,6 +4428,8 @@ static HRESULT FileDialog_constructor(IUnknown *pUnkOuter, REFIID riid, void **p fdimpl->client_guid = GUID_NULL; + fdimpl->actctx_cookie = 0; + fdimpl->hmenu_opendropdown = NULL; fdimpl->hfont_opendropdown = NULL; -- 2.1.4