From 6e9fc00be1da38f18c27ec6710c475815e046f8d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 1 Aug 2022 19:28:18 -0700 Subject: Remove unused resetacls from wixnative --- src/wix/wixnative/precomp.h | 1 - src/wix/wixnative/resetacls.cpp | 56 ------------------------------------- src/wix/wixnative/wixnative.cpp | 4 --- src/wix/wixnative/wixnative.vcxproj | 1 - 4 files changed, 62 deletions(-) delete mode 100644 src/wix/wixnative/resetacls.cpp diff --git a/src/wix/wixnative/precomp.h b/src/wix/wixnative/precomp.h index 0a458ca6..bc59d693 100644 --- a/src/wix/wixnative/precomp.h +++ b/src/wix/wixnative/precomp.h @@ -20,6 +20,5 @@ HRESULT WixNativeReadStdinPreamble(); HRESULT CertificateHashesCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); HRESULT SmartCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); -HRESULT ResetAclsCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); HRESULT EnumCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); HRESULT ExtractCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); diff --git a/src/wix/wixnative/resetacls.cpp b/src/wix/wixnative/resetacls.cpp deleted file mode 100644 index 91bc633d..00000000 --- a/src/wix/wixnative/resetacls.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -#include "precomp.h" - -HRESULT ResetAclsCommand( - __in int argc, - __in_ecount(argc) LPWSTR argv[]) -{ - Unused(argc); - Unused(argv); - - HRESULT hr = S_OK; - ACL* pacl = NULL; - DWORD cbAcl = sizeof(ACL); - LPWSTR sczFilePath = NULL; - - // create an empty (not NULL!) ACL to use on all the files - pacl = static_cast(MemAlloc(cbAcl, FALSE)); - ConsoleExitOnNull(pacl, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "failed to allocate ACL"); - -#pragma prefast(push) -#pragma prefast(disable:25029) - if (!::InitializeAcl(pacl, cbAcl, ACL_REVISION)) -#pragma prefast(op) - { - ConsoleExitOnLastError(hr, CONSOLE_COLOR_RED, "failed to initialize ACL"); - } - - hr = WixNativeReadStdinPreamble(); - ExitOnFailure(hr, "failed to read stdin preamble before resetting ACLs"); - - // Reset the existing security permissions on each provided file. - for (;;) - { - hr = ConsoleReadW(&sczFilePath); - ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "failed to read file path from stdin"); - - if (!*sczFilePath) - { - break; - } - - hr = ::SetNamedSecurityInfoW(sczFilePath, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, pacl, NULL); - if (ERROR_FILE_NOT_FOUND != hr && ERROR_PATH_NOT_FOUND != hr) - { - ConsoleExitOnFailure(hr = HRESULT_FROM_WIN32(hr), CONSOLE_COLOR_RED, "failed to set security descriptor for file: %ls", sczFilePath); - } - } - - AssertSz(::IsValidAcl(pacl), "ResetAcls() - created invalid ACL"); - -LExit: - ReleaseStr(sczFilePath); - ReleaseMem(pacl); - return hr; -} diff --git a/src/wix/wixnative/wixnative.cpp b/src/wix/wixnative/wixnative.cpp index 8a24d5f1..7a689fc3 100644 --- a/src/wix/wixnative/wixnative.cpp +++ b/src/wix/wixnative/wixnative.cpp @@ -28,10 +28,6 @@ int __cdecl wmain(int argc, LPWSTR argv[]) { hr = CertificateHashesCommand(argc - 2, argv + 2); } - else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"resetacls", -1)) - { - hr = ResetAclsCommand(argc - 2, argv + 2); - } else { ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Unknown command: %ls", argv[1]); diff --git a/src/wix/wixnative/wixnative.vcxproj b/src/wix/wixnative/wixnative.vcxproj index 2e90661c..e61a8a3d 100644 --- a/src/wix/wixnative/wixnative.vcxproj +++ b/src/wix/wixnative/wixnative.vcxproj @@ -53,7 +53,6 @@ - -- cgit v1.2.3-55-g6feb