// The macro ConvertToWideChar takes a tstring parameter and returns
// a pointer to a unicode string. A conversion is performed if
-// neccessary. FreeConvertedWideChar string should be used on the
+// necessary. FreeConvertedWideChar string should be used on the
// return value of ConvertToWideChar when the string is no longer
// needed. The original string or the string that is returned
// should not be modified until FreeConvertedWideChar has been called.
// The macro ConvertToMultiByte takes a tstring parameter and returns
// a pointer to an ansi string. A conversion is performed if
-// neccessary. FreeConvertedMultiByte string should be used on the
+// necessary. FreeConvertedMultiByte string should be used on the
// return value of ConvertToMultiByte when the string is no longer
// needed. The original string or the string that is returned
// should not be modified until FreeConvertedMultiByte has been called.
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);
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) {
if (!RegisterBlankClass(hInstance, hPrevInstance))
{
+ FreeLibrary(hDll);
+ if (bActivated)
+ DeactivateActCtx(0, cookie);
return 0;
}
// Create a window so we can pass a window handle to
free(lptMsgBuffer);
}
+ if (bActivated)
+ DeactivateActCtx(0, cookie);
+
if (argv) free(argv);
return 0; /* rundll32 always returns 0! */
}