1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifdef MOZ_MAINTENANCE_SERVICE
6 BOOL StartServiceUpdate(LPCWSTR installDir);
7 DWORD LaunchServiceSoftwareUpdateCommand(int argc, LPCWSTR* argv);
8 BOOL WriteStatusFailure(LPCWSTR updateDirPath, int errorCode);
9 DWORD WaitForServiceStop(LPCWSTR serviceName, DWORD maxWaitSeconds);
10 BOOL DoesFallbackKeyExist();
11 BOOL IsLocalFile(LPCWSTR file, BOOL& isLocal);
12 DWORD StartServiceCommand(int argc, LPCWSTR* argv);
13 BOOL IsUnpromptedElevation(BOOL& isUnpromptedElevation);
14 #endif
15 
16 DWORD WaitForProcessExit(LPCWSTR filename, DWORD maxSeconds);
17 DWORD IsProcessRunning(LPCWSTR filename);
18 BOOL GetSecureOutputDirectoryPath(LPWSTR outBuf);
19 BOOL GetSecureOutputFilePath(LPCWSTR patchDirPath, LPCWSTR fileExt,
20                              LPWSTR outBuf);
21 BOOL WriteSecureIDFile(LPCWSTR patchDirPath);
22 void RemoveSecureOutputFiles(LPCWSTR patchDirPath);
23 
24 #define PATCH_DIR_PATH L"\\updates\\0"
25 
26 #ifdef MOZ_MAINTENANCE_SERVICE
27 #  define SVC_NAME L"MozillaMaintenance"
28 
29 #  define BASE_SERVICE_REG_KEY L"SOFTWARE\\Mozilla\\MaintenanceService"
30 
31 // The test only fallback key, as its name implies, is only present on machines
32 // that will use automated tests.  Since automated tests always run from a
33 // different directory for each test, the presence of this key bypasses the
34 // "This is a valid installation directory" check.  This key also stores
35 // the allowed name and issuer for cert checks so that the cert check
36 // code can still be run unchanged.
37 #  define TEST_ONLY_FALLBACK_KEY_PATH \
38     BASE_SERVICE_REG_KEY L"\\3932ecacee736d366d6436db0f55bce4"
39 #endif
40