LibreOffice Module onlineupdate (master) 1
|
#include <windows.h>
#include <aclapi.h>
#include <stdlib.h>
#include <shlwapi.h>
#include <lm.h>
#include "serviceinstall.hxx"
#include "servicebase.hxx"
#include "updatehelper.h"
#include "shellapi.h"
#include "readstrings.h"
#include "errors.h"
#include <memory>
Go to the source code of this file.
Functions | |
static int | ReadMaintenanceServiceStrings (LPCWSTR path, MaintenanceServiceStringTable *results) |
A wrapper function to read strings for the maintenance service. More... | |
static BOOL | GetVersionNumberFromPath (LPWSTR path, DWORD &A, DWORD &B, DWORD &C, DWORD &D) |
Obtains the version number from the specified PE file's version information Version Format: A.B.C.D (Example 10.0.0.300) More... | |
BOOL | UpdateServiceDescription (SC_HANDLE serviceHandle) |
Updates the service description with what is stored in updater.ini at the same path as the currently executing module binary. More... | |
BOOL | FixServicePath (SC_HANDLE service, LPCWSTR currentServicePath, BOOL &servicePathWasWrong) |
Determines if the MozillaMaintenance service path needs to be updated and fixes it if it is wrong. More... | |
BOOL | SvcInstall (SvcInstallAction action) |
Installs or upgrades the SVC_NAME service. More... | |
BOOL | StopService () |
Stops the Maintenance service. More... | |
BOOL | SvcUninstall () |
Uninstalls the Maintenance service. More... | |
BOOL | SetUserAccessServiceDACL (SC_HANDLE hService) |
Sets the access control list for user access for the specified service. More... | |
DWORD | SetUserAccessServiceDACL (SC_HANDLE hService, PACL &pNewAcl, PSECURITY_DESCRIPTOR psd) |
Sets the access control list for user access for the specified service. More... | |
Determines if the MozillaMaintenance service path needs to be updated and fixes it if it is wrong.
service | A handle to the service to fix. |
currentServicePath | The current (possibly wrong) path that is used. |
servicePathWasWrong | Out parameter set to TRUE if a fix was needed. |
Definition at line 223 of file serviceinstall.cxx.
References FALSE, LOG, LOG_WARN, MAX_PATH, PathAppendSafe(), and TRUE.
Referenced by SvcInstall().
|
static |
Obtains the version number from the specified PE file's version information Version Format: A.B.C.D (Example 10.0.0.300)
path | The path of the file to check the version on |
A | The first part of the version number |
B | The second part of the version number |
C | The third part of the version number |
D | The fourth part of the version number |
Definition at line 105 of file serviceinstall.cxx.
References A, B, C, D, FALSE, LOG_WARN, size, and TRUE.
Referenced by SvcInstall().
|
static |
A wrapper function to read strings for the maintenance service.
path | The path of the ini file to read from |
results | The maintenance service strings that were read |
Definition at line 73 of file serviceinstall.cxx.
References MAX_TEXT_LEN, OK, ReadStrings(), result, and MaintenanceServiceStringTable::serviceDescription.
Referenced by UpdateServiceDescription().
BOOL SetUserAccessServiceDACL | ( | SC_HANDLE | hService | ) |
Sets the access control list for user access for the specified service.
hService | The service to set the access control list on |
Definition at line 702 of file serviceinstall.cxx.
References SetUserAccessServiceDACL().
Referenced by SetUserAccessServiceDACL(), and SvcInstall().
DWORD SetUserAccessServiceDACL | ( | SC_HANDLE | hService, |
PACL & | pNewAcl, | ||
PSECURITY_DESCRIPTOR | psd | ||
) |
Sets the access control list for user access for the specified service.
hService | The service to set the access control list on |
pNewAcl | The out param ACL which should be freed by caller |
psd | out param security descriptor, should be freed by caller |
Definition at line 727 of file serviceinstall.cxx.
BOOL StopService | ( | ) |
Stops the Maintenance service.
Definition at line 593 of file serviceinstall.cxx.
References FALSE, LOG, LOG_WARN, SVC_NAME, WaitForProcessExit(), and WaitForServiceStop().
Referenced by SvcInstall().
BOOL SvcInstall | ( | SvcInstallAction | action | ) |
Installs or upgrades the SVC_NAME service.
If an existing service is already installed, we replace it with the currently running process.
action | The action to perform. |
Definition at line 290 of file serviceinstall.cxx.
References action, FALSE, FixServicePath(), ForceInstallSvc, GetVersionNumberFromPath(), LOG, LOG_WARN, MAX_PATH, result, SetUserAccessServiceDACL(), StopService(), SVC_DISPLAY_NAME, SVC_NAME, SvcInstall(), TRUE, UpdateServiceDescription(), and UpgradeSvc.
Referenced by SvcInstall(), and wmain().
BOOL SvcUninstall | ( | ) |
BOOL UpdateServiceDescription | ( | SC_HANDLE | serviceHandle | ) |
Updates the service description with what is stored in updater.ini at the same path as the currently executing module binary.
serviceHandle | A handle to an opened service with SERVICE_CHANGE_CONFIG access right |
TRUE | on success. |
Definition at line 145 of file serviceinstall.cxx.
References FALSE, LOG, LOG_WARN, MAX_PATH, MAX_TEXT_LEN, OK, PathAppendSafe(), ReadMaintenanceServiceStrings(), MaintenanceServiceStringTable::serviceDescription, and TRUE.
Referenced by SvcInstall().