shell32: Activate context at ID 123 before loading control panel applets.
This is required to enable common control v6 when running control panel applets using "rundll32.exe shell32.dll,Control_RunDLL". Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
596b647391
commit
765d4c1e77
|
@ -53,6 +53,9 @@ void Control_UnloadApplet(CPlApplet* applet)
|
||||||
|
|
||||||
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
|
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
|
||||||
FreeLibrary(applet->hModule);
|
FreeLibrary(applet->hModule);
|
||||||
|
if (applet->context_activated)
|
||||||
|
DeactivateActCtx(0, applet->cookie);
|
||||||
|
ReleaseActCtx(applet->context);
|
||||||
list_remove( &applet->entry );
|
list_remove( &applet->entry );
|
||||||
heap_free(applet->cmd);
|
heap_free(applet->cmd);
|
||||||
heap_free(applet);
|
heap_free(applet);
|
||||||
|
@ -60,15 +63,19 @@ void Control_UnloadApplet(CPlApplet* applet)
|
||||||
|
|
||||||
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
{
|
{
|
||||||
|
WCHAR path[MAX_PATH];
|
||||||
CPlApplet* applet;
|
CPlApplet* applet;
|
||||||
DWORD len;
|
DWORD len;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
CPLINFO info;
|
CPLINFO info;
|
||||||
NEWCPLINFOW newinfo;
|
NEWCPLINFOW newinfo;
|
||||||
|
ACTCTXW ctx;
|
||||||
|
|
||||||
if (!(applet = heap_alloc_zero(sizeof(*applet))))
|
if (!(applet = heap_alloc_zero(sizeof(*applet))))
|
||||||
return applet;
|
return applet;
|
||||||
|
|
||||||
|
applet->context = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
len = ExpandEnvironmentStringsW(cmd, NULL, 0);
|
len = ExpandEnvironmentStringsW(cmd, NULL, 0);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +94,21 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
|
|
||||||
applet->hWnd = hWnd;
|
applet->hWnd = hWnd;
|
||||||
|
|
||||||
|
/* Activate context before DllMain() is called */
|
||||||
|
if (SearchPathW(NULL, applet->cmd, NULL, ARRAY_SIZE(path), path, NULL))
|
||||||
|
{
|
||||||
|
memset(&ctx, 0, sizeof(ctx));
|
||||||
|
ctx.cbSize = sizeof(ctx);
|
||||||
|
ctx.lpSource = path;
|
||||||
|
ctx.lpResourceName = MAKEINTRESOURCEW(123);
|
||||||
|
ctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
|
||||||
|
applet->context = CreateActCtxW(&ctx);
|
||||||
|
if (applet->context != INVALID_HANDLE_VALUE)
|
||||||
|
applet->context_activated = ActivateActCtx(applet->context, &applet->cookie);
|
||||||
|
else
|
||||||
|
TRACE("No manifest at ID 123 in %s\n", wine_dbgstr_w(path));
|
||||||
|
}
|
||||||
|
|
||||||
if (!(applet->hModule = LoadLibraryW(applet->cmd))) {
|
if (!(applet->hModule = LoadLibraryW(applet->cmd))) {
|
||||||
WARN("Cannot load control panel applet %s\n", debugstr_w(applet->cmd));
|
WARN("Cannot load control panel applet %s\n", debugstr_w(applet->cmd));
|
||||||
goto theError;
|
goto theError;
|
||||||
|
@ -177,6 +199,9 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
|
|
||||||
theError:
|
theError:
|
||||||
FreeLibrary(applet->hModule);
|
FreeLibrary(applet->hModule);
|
||||||
|
if (applet->context_activated)
|
||||||
|
DeactivateActCtx(0, applet->cookie);
|
||||||
|
ReleaseActCtx(applet->context);
|
||||||
heap_free(applet->cmd);
|
heap_free(applet->cmd);
|
||||||
heap_free(applet);
|
heap_free(applet);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -40,6 +40,9 @@ typedef struct CPlApplet {
|
||||||
unsigned count; /* number of subprograms */
|
unsigned count; /* number of subprograms */
|
||||||
HMODULE hModule; /* module of loaded applet */
|
HMODULE hModule; /* module of loaded applet */
|
||||||
APPLET_PROC proc; /* entry point address */
|
APPLET_PROC proc; /* entry point address */
|
||||||
|
BOOL context_activated; /* whether context is activated */
|
||||||
|
HANDLE context; /* activation context handle */
|
||||||
|
ULONG_PTR cookie; /* activation context cookie */
|
||||||
struct applet_info info[1]; /* array of count information */
|
struct applet_info info[1]; /* array of count information */
|
||||||
} CPlApplet;
|
} CPlApplet;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue