mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[GPO] Add GPO to disable per-user install (#25141)
* Add per user installer
* Separate upgrade codes for per machine and per user installation
Move per machine check to bootstrapper
Move all defines to common.wxs
Fix CI
* Update installer/PowerToysSetup/generateFileList.ps1
Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
* Update installer/PowerToysSetup/generateAllFileComponents.ps1
Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
* Update installer/PowerToysSetup/generateFileList.ps1
Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
* expect.txt
* Revert "Update installer/PowerToysSetup/generateFileList.ps1"
This reverts commit 34545dab9c.
* Update release CI to build both installers
* Revert bundle name change
It messes up app ID for per-user installation which ends up breaking winget update
of the per-user PT
* spellcheck
* Fix bad merge
* Add RegistryPreview
* Include backup_restore_settings.json
* Revert testing endpoint change
* Add per-machine/per-user installation GPOs
* Update doc/gpo/README.md
* Update doc/gpo/README.md
* spellcheck
* Remove disable per-machine policy
* Update doc/gpo/README.md
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
---------
Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <spdlog/sinks/base_sink.h>
|
||||
|
||||
#include "../../src/common/logger/logger.h"
|
||||
#include "../../src/common/utils/gpo.h"
|
||||
#include "../../src/common/utils/MsiUtils.h"
|
||||
#include "../../src/common/utils/modulesRegistry.h"
|
||||
#include "../../src/common/updating/installer.h"
|
||||
@@ -50,6 +51,33 @@ HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring& installationDir)
|
||||
LExit:
|
||||
return hr;
|
||||
}
|
||||
|
||||
UINT __stdcall CheckGPOCA(MSIHANDLE hInstall)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
hr = WcaInitialize(hInstall, "CheckGPOCA");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
LPWSTR currentScope = nullptr;
|
||||
hr = WcaGetProperty(L"InstallScope", ¤tScope);
|
||||
|
||||
if(std::wstring{ currentScope } == L"perUser")
|
||||
{
|
||||
if (powertoys_gpo::getDisablePerUserInstallationValue() == powertoys_gpo::gpo_rule_configured_enabled)
|
||||
{
|
||||
PMSIHANDLE hRecord = MsiCreateRecord(0);
|
||||
MsiRecordSetString(hRecord, 0, TEXT("The system administrator has disabled per-user installation."));
|
||||
MsiProcessMessage(hInstall, static_cast<INSTALLMESSAGE>(INSTALLMESSAGE_ERROR + MB_OK), hRecord);
|
||||
hr = E_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
LExit:
|
||||
UINT er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
return WcaFinalize(er);
|
||||
}
|
||||
|
||||
UINT __stdcall ApplyModulesRegistryChangeSetsCA(MSIHANDLE hInstall)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
Reference in New Issue
Block a user