Bug 709598 - If no registry keys exist for the install dir, don't try to use the maintenance service for updates. r=rstrong.

--HG--
rename : toolkit/components/maintenanceservice/pathhash.cpp => toolkit/mozapps/update/common/pathhash.cpp
rename : toolkit/components/maintenanceservice/pathhash.h => toolkit/mozapps/update/common/pathhash.h
This commit is contained in:
Brian R. Bondy 2012-01-04 23:19:16 -05:00
parent e6f1faa1ee
commit c41584e6f4
5 changed files with 29 additions and 1 deletions

View File

@ -49,7 +49,6 @@ CPPSRCS = \
certificatecheck.cpp \
servicebase.cpp \
registrycertificates.cpp \
pathhash.cpp \
$(NULL)
# For debugging purposes only

View File

@ -61,10 +61,12 @@ EXPORTS = updatelogging.h \
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
CPPSRCS += updatehelper.cpp \
uachelper.cpp \
pathhash.cpp \
$(NULL)
EXPORTS = updatehelper.h \
uachelper.h \
pathhash.h \
$(NULL)
endif

View File

@ -1383,6 +1383,7 @@ PatchIfFile::Finish(int status)
#ifdef XP_WIN
#include "nsWindowsRestart.cpp"
#include "uachelper.h"
#include "pathhash.h"
#endif
static void
@ -1715,6 +1716,32 @@ int NS_main(int argc, NS_tchar **argv)
return 1;
}
// Make sure the service registry entries for the instsallation path
// are available. If not don't use the service.
if (useService) {
WCHAR maintenanceServiceKey[MAX_PATH + 1];
if (CalculateRegistryPathFromFilePath(argv[2], maintenanceServiceKey)) {
HKEY baseKey;
LSTATUS retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
maintenanceServiceKey, 0,
KEY_READ | KEY_WOW64_64KEY,
&baseKey);
if (retCode != ERROR_SUCCESS) {
// Our tests run with a different apply directory for each test.
// We use this registry key on our test slaves to store the
// allowed name/issuers.
retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Mozilla\\MaintenanceService"
L"\\3932ecacee736d366d6436db0f55bce4", 0,
KEY_READ | KEY_WOW64_64KEY, &baseKey);
}
useService = retCode == ERROR_SUCCESS;
RegCloseKey(baseKey);
} else {
useService = FALSE;
}
}
HANDLE serviceInUseEvent = NULL;
if (useService) {
// Make sure the service isn't already busy processing another work item.