Author: gadamopoulos
Date: Tue Feb 14 09:47:13 2017
New Revision: 73799
URL:
http://svn.reactos.org/svn/reactos?rev=73799&view=rev
Log:
[RUNDLL32] -Load and activate the manifest of the hosted dll before loading the library.
Modified:
trunk/reactos/base/system/rundll32/rundll32.c
Modified: trunk/reactos/base/system/rundll32/rundll32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/rundll32/rundl…
==============================================================================
--- trunk/reactos/base/system/rundll32/rundll32.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/rundll32/rundll32.c [iso-8859-1] Tue Feb 14 09:47:13 2017
@@ -346,6 +346,11 @@
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);
@@ -380,6 +385,11 @@
lptCmdLine = argv[i];
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);
@@ -429,6 +439,8 @@
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 @@
free(lptMsgBuffer);
}
+ if (bActivated)
+ DeactivateActCtx(0, cookie);
+
if (argv) free(argv);
return 0; /* rundll32 always returns 0! */
}