LibreOffice Module onlineupdate (master) 1
|
#include <shlobj.h>
#include <shlwapi.h>
#include <wtsapi32.h>
#include <userenv.h>
#include <shellapi.h>
#include <cstddef>
#include "workmonitor.hxx"
#include "serviceinstall.hxx"
#include "servicebase.hxx"
#include "registrycertificates.hxx"
#include "uachelper.h"
#include "updatehelper.h"
#include "errors.h"
#include "windowsHelper.hxx"
Go to the source code of this file.
Functions | |
wchar_t * | MakeCommandLine (int argc, wchar_t **argv) |
BOOL | WriteStatusFailure (LPCWSTR updateDirPath, int errorCode) |
BOOL | PathGetSiblingFilePath (LPWSTR destinationBuffer, LPCWSTR siblingFilePath, LPCWSTR newFileName) |
static BOOL | IsStatusApplying (LPCWSTR updateDirPath, BOOL &isApplying) |
static bool | IsUpdateBeingStaged (int argc, LPWSTR *argv) |
Determines whether we're staging an update. More... | |
static bool | IsDigits (WCHAR *str) |
Determines whether the param only contains digits. More... | |
static bool | IsOldCommandline (int argc, LPWSTR *argv) |
Determines whether the command line contains just the directory to apply the update to (old command line) or if it contains the installation directory and the directory to apply the update to. More... | |
static BOOL | GetInstallationDir (int argcTmp, LPWSTR *argvTmp, WCHAR aResultDir[MAX_PATH+1]) |
Gets the installation directory from the arguments passed to updater.exe. More... | |
BOOL | StartUpdateProcess (int argc, LPWSTR *argv, LPCWSTR installDir, BOOL &processStarted) |
Runs an update process as the service using the SYSTEM account. More... | |
BOOL | ProcessSoftwareUpdateCommand (DWORD argc, LPWSTR *argv) |
Processes a software update command. More... | |
BOOL | GetSecureUpdaterPath (WCHAR serviceUpdaterPath[MAX_PATH+1]) |
Obtains the updater path alongside a subdir of the service binary. More... | |
BOOL | DeleteSecureUpdater (WCHAR serviceUpdaterPath[MAX_PATH+1]) |
Deletes the passed in updater path and the associated updater.ini file. More... | |
BOOL | ExecuteServiceCommand (int argc, LPWSTR *argv) |
Executes a service command. More... | |
Variables | |
static const int | TIME_TO_WAIT_ON_UPDATER = 15 * 60 * 1000 |
BOOL DeleteSecureUpdater | ( | WCHAR | serviceUpdaterPath[MAX_PATH+1] | ) |
Deletes the passed in updater path and the associated updater.ini file.
serviceUpdaterPath | The path to delete. |
Definition at line 639 of file workmonitor.cxx.
References FALSE, LOG_WARN, MAX_PATH, PathGetSiblingFilePath(), and result.
Referenced by ExecuteServiceCommand().
Executes a service command.
argc | The number of arguments in argv |
argv | The service command line arguments, argv[0] and argv[1] and automatically included by Windows. argv[2] is the service command. |
Definition at line 679 of file workmonitor.cxx.
References DeleteSecureUpdater(), FALSE, GetSecureUpdaterPath(), hr, LOG, LOG_WARN, MAX_PATH, PathGetSiblingFilePath(), ProcessSoftwareUpdateCommand(), result, SERVICE_COULD_NOT_COPY_UPDATER, TRUE, and WriteStatusFailure().
Referenced by SvcMain().
|
static |
Gets the installation directory from the arguments passed to updater.exe.
argcTmp | The argc value normally sent to updater.exe |
argvTmp | The argv value normally sent to updater.exe |
aResultDir | Buffer to hold the installation directory. |
Definition at line 144 of file workmonitor.cxx.
References FALSE, index, IsOldCommandline(), IsUpdateBeingStaged(), MAX_PATH, and TRUE.
Referenced by ProcessSoftwareUpdateCommand().
BOOL GetSecureUpdaterPath | ( | WCHAR | serviceUpdaterPath[MAX_PATH+1] | ) |
Obtains the updater path alongside a subdir of the service binary.
The purpose of this function is to return a path that is likely high integrity and therefore more safe to execute code from.
serviceUpdaterPath | Out parameter for the path where the updater should be copied to. |
Definition at line 597 of file workmonitor.cxx.
References FALSE, LOG_WARN, MAX_PATH, PathAppendSafe(), and TRUE.
Referenced by ExecuteServiceCommand().
|
static |
Determines whether the param only contains digits.
str | The string to check |
boolean | True if the param only contains digits |
Definition at line 107 of file workmonitor.cxx.
Referenced by IsOldCommandline().
|
static |
Determines whether the command line contains just the directory to apply the update to (old command line) or if it contains the installation directory and the directory to apply the update to.
argc | The argc value normally sent to updater.exe |
argv | The argv value normally sent to updater.exe |
boolean | True if the command line contains just the directory to apply the update to |
Definition at line 130 of file workmonitor.cxx.
References IsDigits().
Referenced by GetInstallationDir(), and StartUpdateProcess().
Definition at line 46 of file workmonitor.cxx.
References FALSE, AutoHandle::get(), LOG, LOG_WARN, MAX_PATH, PathAppendSafe(), and TRUE.
Referenced by StartUpdateProcess().
|
static |
Determines whether we're staging an update.
argc | The argc value normally sent to updater.exe |
argv | The argv value normally sent to updater.exe |
Definition at line 93 of file workmonitor.cxx.
Referenced by GetInstallationDir(), ProcessSoftwareUpdateCommand(), and StartUpdateProcess().
wchar_t * MakeCommandLine | ( | int | argc, |
wchar_t ** | argv | ||
) |
Referenced by NS_main(), and StartUpdateProcess().
BOOL PathGetSiblingFilePath | ( | LPWSTR | destinationBuffer, |
LPCWSTR | siblingFilePath, | ||
LPCWSTR | newFileName | ||
) |
Referenced by DeleteSecureUpdater(), ExecuteServiceCommand(), and StartUpdateProcess().
BOOL ProcessSoftwareUpdateCommand | ( | DWORD | argc, |
LPWSTR * | argv | ||
) |
Processes a software update command.
argc | The number of arguments in argv |
argv | The arguments normally passed to updater.exe argv[0] must be the path to updater.exe |
Definition at line 370 of file workmonitor.cxx.
References DoesBinaryMatchAllowedCertificates(), FALSE, GetInstallationDir(), IDS_UPDATER_IDENTITY, IsLocalFile(), IsUpdateBeingStaged(), LOG, LOG_WARN, LogFlush, MAX_PATH, PathAppendSafe(), result, SERVICE_COULD_NOT_LOCK_UPDATER, SERVICE_INSTALLDIR_ERROR, SERVICE_NOT_ENOUGH_COMMAND_LINE_ARGS, SERVICE_UPDATER_COMPARE_ERROR, SERVICE_UPDATER_COULD_NOT_BE_STARTED, SERVICE_UPDATER_IDENTITY_ERROR, SERVICE_UPDATER_NOT_FIXED_DRIVE, SERVICE_UPDATER_SIGN_ERROR, StartServiceUpdate(), StartUpdateProcess(), TRUE, UPDATER_IDENTITY_STRING, VerifySameFiles(), and WriteStatusFailure().
Referenced by ExecuteServiceCommand().
Runs an update process as the service using the SYSTEM account.
argc | The number of arguments in argv |
argv | The arguments normally passed to updater.exe argv[0] must be the path to updater.exe |
processStarted | Set to TRUE if the process was started. |
Definition at line 188 of file workmonitor.cxx.
References FALSE, index, IsOldCommandline(), IsStatusApplying(), IsUpdateBeingStaged(), LaunchWinPostProcess(), LOG, LOG_WARN, MakeCommandLine(), MAX_PATH, PathGetSiblingFilePath(), SERVICE_STILL_APPLYING_ON_FAILURE, SERVICE_STILL_APPLYING_ON_SUCCESS, TIME_TO_WAIT_ON_UPDATER, and WriteStatusFailure().
Referenced by ProcessSoftwareUpdateCommand().
Referenced by ExecuteServiceCommand(), ProcessSoftwareUpdateCommand(), and StartUpdateProcess().
|
static |
Definition at line 30 of file workmonitor.cxx.
Referenced by StartUpdateProcess().