From: Giannis Adamopoulos Date: Tue, 14 Feb 2017 09:47:13 +0000 (+0000) Subject: [RUNDLL32] -Load and activate the manifest of the hosted dll before loading the library. X-Git-Tag: ReactOS-0.4.4-CLT2017~290 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=18d52d43368d3574001e68a0cfcdc02dac3c8fd3;hp=c2c30fe9409f313e5e11bbd33f60f13aad04a234 [RUNDLL32] -Load and activate the manifest of the hosted dll before loading the library. svn path=/trunk/; revision=73799 --- diff --git a/reactos/base/system/rundll32/rundll32.c b/reactos/base/system/rundll32/rundll32.c index f9d6b7e4c7a..23bba1e2539 100644 --- a/reactos/base/system/rundll32/rundll32.c +++ b/reactos/base/system/rundll32/rundll32.c @@ -346,6 +346,11 @@ int WINAPI _tWinMain( int i; size_t nStrLen; + ACTCTXW ActCtx = {sizeof(ACTCTX), ACTCTX_FLAG_RESOURCE_NAME_VALID}; + HANDLE hActCtx; + ULONG_PTR cookie; + BOOL bActivated; + // Get command-line in argc-argv format argv = CommandLineToArgv(GetCommandLine(),&argc); @@ -381,6 +386,11 @@ int WINAPI _tWinMain( else lptCmdLine = _T(""); + ActCtx.lpSource = lptDllName; + ActCtx.lpResourceName = (LPCWSTR)123; + hActCtx = CreateActCtx(&ActCtx); + bActivated = (hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx, &cookie) : FALSE); + // Everything is all setup, so load the dll now hDll = LoadLibrary(lptDllName); if (hDll) { @@ -429,6 +439,8 @@ int WINAPI _tWinMain( if (!RegisterBlankClass(hInstance, hPrevInstance)) { FreeLibrary(hDll); + if (bActivated) + DeactivateActCtx(0, cookie); return 0; } // Create a window so we can pass a window handle to @@ -476,6 +488,9 @@ int WINAPI _tWinMain( free(lptMsgBuffer); } + if (bActivated) + DeactivateActCtx(0, cookie); + if (argv) free(argv); return 0; /* rundll32 always returns 0! */ }