diff --git a/config/rules.mk b/config/rules.mk index 31d4bd097813..ffb1f28ca9e5 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -1047,10 +1047,12 @@ endif # NO_LD_ARCHIVE_FLAGS $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) ifdef MSMANIFEST_TOOL +ifdef EMBED_MANIFEST_AT @if test -f $@.manifest; then \ - mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ + mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \ rm -f $@.manifest; \ fi +endif # embed manifest endif # MSVC with manifest tool endif # WINNT && !GCC @rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK) diff --git a/toolkit/mozapps/installer/windows/wizard/setup/xpi.c b/toolkit/mozapps/installer/windows/wizard/setup/xpi.c index a9d6624d3f3b..c05946beaa5d 100644 --- a/toolkit/mozapps/installer/windows/wizard/setup/xpi.c +++ b/toolkit/mozapps/installer/windows/wizard/setup/xpi.c @@ -55,6 +55,22 @@ typedef HRESULT (_cdecl *XpiInstall)(const char *, const char *, long); typedef void (_cdecl *XpiExit)(void); typedef BOOL (WINAPI *SetDllPathProc)(const char*); +#if _MSC_VER >= 1400 +typedef HANDLE (WINAPI *FnCreateActCtxA)(PCACTCTXA pActCtx); +typedef BOOL (WINAPI *FnActivateActCtx)(HANDLE hActCtx, ULONG_PTR* lpCookie); +typedef BOOL (WINAPI *FnDeactivateActCtx)(DWORD dwFlags, ULONG_PTR ulCookie); +typedef VOID (WINAPI *FnReleaseActCtx)(HANDLE hActCtx); + +ACTCTXA actctx; +HANDLE hActCtx = INVALID_HANDLE_VALUE; +ULONG_PTR ulpActivationCookie; + +static FnCreateActCtxA pfnCreateActCtxA = NULL; +static FnActivateActCtx pfnActivateActCtx = NULL; +static FnDeactivateActCtx pfnDeactivateActCtx = NULL; +static FnReleaseActCtx pfnReleaseActCtx = NULL; +#endif + static XpiInit pfnXpiInit; static XpiInstall pfnXpiInstall; static XpiExit pfnXpiExit; @@ -113,6 +129,38 @@ HRESULT InitializeXPIStub(char *xpinstallPath) if(FileExists(szXPIStubFile) == FALSE) return(2); +#if _MSC_VER >= 1400 + /* Windows XP + Visual C++ 8 requires proper + * Side by Side configuration, which means + * we have to have a manifest to create an + * Activation Context so we can locate the + * VC8 runtime. + */ + if (hKernel != NULL && + (pfnCreateActCtxA = (FnCreateActCtxA)GetProcAddress(hKernel, "CreateActCtxA")) != NULL && + (pfnActivateActCtx = (FnActivateActCtx)GetProcAddress(hKernel, "ActivateActCtx")) != NULL && + (pfnDeactivateActCtx = (FnDeactivateActCtx)GetProcAddress(hKernel, "DeactivateActCtx")) != NULL && + (pfnReleaseActCtx = (FnReleaseActCtx)GetProcAddress(hKernel, "ReleaseActCtx")) != NULL) + { + memset(&actctx, 0, sizeof(actctx)); + actctx.cbSize = sizeof(actctx); + actctx.lpSource = (LPCSTR)szXPIStubFile; + actctx.lpResourceName = MAKEINTRESOURCE(17); + actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; + + hActCtx = pfnCreateActCtxA(&actctx); + + if (hActCtx == INVALID_HANDLE_VALUE) + return(2); /* XXX: is this a good return value? */ + + if (!pfnActivateActCtx(hActCtx, &ulpActivationCookie)) + { + pfnReleaseActCtx(hActCtx); + return(2); + } + } +#endif + /* load xpistub.dll */ if((hXPIStubInst = LoadLibraryEx(szXPIStubFile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) == NULL) { @@ -148,6 +196,19 @@ HRESULT DeInitializeXPIStub() pfnXpiInstall = NULL; pfnXpiExit = NULL; +#if _MSC_VER >= 1400 + if (pfnDeactivateActCtx) + { + pfnDeactivateActCtx(0, ulpActivationCookie); + pfnReleaseActCtx(hActCtx); + } + + pfnCreateActCtxA = NULL; + pfnActivateActCtx = NULL; + pfnDeactivateActCtx = NULL; + pfnReleaseActCtx = NULL; +#endif + if(hXPIStubInst) FreeLibrary(hXPIStubInst); diff --git a/xpinstall/stub/Makefile.in b/xpinstall/stub/Makefile.in index de53cc0475de..1aae5f17e06b 100644 --- a/xpinstall/stub/Makefile.in +++ b/xpinstall/stub/Makefile.in @@ -67,5 +67,5 @@ EXTRA_DSO_LDOPTS= \ $(MOZ_COMPONENT_LIBS) \ $(NULL) +EMBED_MANIFEST_AT = 17 include $(topsrcdir)/config/rules.mk -