rundll32: Activate context at ID 123 before calling library functions.
This is required to enable common control v6 for library functions called by rundll32.exe. Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
765d4c1e77
commit
d1d91288ff
|
@ -276,9 +276,12 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
LPWSTR szDllName,szEntryPoint;
|
LPWSTR szDllName,szEntryPoint;
|
||||||
void *entry_point = NULL;
|
void *entry_point = NULL;
|
||||||
BOOL unicode = FALSE, win16 = FALSE;
|
BOOL unicode = FALSE, win16 = FALSE, activated = FALSE;
|
||||||
|
HMODULE hDll, hCtx = INVALID_HANDLE_VALUE;
|
||||||
|
WCHAR path[MAX_PATH];
|
||||||
STARTUPINFOW info;
|
STARTUPINFOW info;
|
||||||
HMODULE hDll;
|
ULONG_PTR cookie;
|
||||||
|
ACTCTXW ctx;
|
||||||
|
|
||||||
hWnd=NULL;
|
hWnd=NULL;
|
||||||
hDll=NULL;
|
hDll=NULL;
|
||||||
|
@ -301,6 +304,21 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine
|
||||||
szEntryPoint = get_next_arg(&szCmdLine);
|
szEntryPoint = get_next_arg(&szCmdLine);
|
||||||
WINE_TRACE("EntryPoint=%s\n",wine_dbgstr_w(szEntryPoint));
|
WINE_TRACE("EntryPoint=%s\n",wine_dbgstr_w(szEntryPoint));
|
||||||
|
|
||||||
|
/* Activate context before DllMain() is called */
|
||||||
|
if (SearchPathW(NULL, szDllName, 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;
|
||||||
|
hCtx = CreateActCtxW(&ctx);
|
||||||
|
if (hCtx != INVALID_HANDLE_VALUE)
|
||||||
|
activated = ActivateActCtx(hCtx, &cookie);
|
||||||
|
else
|
||||||
|
WINE_TRACE("No manifest at ID 123 in %s\n", wine_dbgstr_w(path));
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the library */
|
/* Load the library */
|
||||||
hDll=LoadLibraryW(szDllName);
|
hDll=LoadLibraryW(szDllName);
|
||||||
if (hDll) entry_point = get_entry_point32( hDll, szEntryPoint, &unicode );
|
if (hDll) entry_point = get_entry_point32( hDll, szEntryPoint, &unicode );
|
||||||
|
@ -367,6 +385,9 @@ CLEANUP:
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
if (hDll)
|
if (hDll)
|
||||||
FreeLibrary(hDll);
|
FreeLibrary(hDll);
|
||||||
|
if (activated)
|
||||||
|
DeactivateActCtx(0, cookie);
|
||||||
|
ReleaseActCtx(hCtx);
|
||||||
HeapFree(GetProcessHeap(),0,szDllName);
|
HeapFree(GetProcessHeap(),0,szDllName);
|
||||||
return 0; /* rundll32 always returns 0! */
|
return 0; /* rundll32 always returns 0! */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue