@joebigelow / wix-1 / commits / 6e9fc00b

Remove unused resetacls from wixnative

Rob Mensching committed Aug 1, 2022 at 19:28 UTC 6e9fc00be1da38f18c27ec6710c475815e046f8d
4 files changed -62
src/wix/wixnative/precomp.h
-1
@@ -20,6 +20,5 @@
20 HRESULT WixNativeReadStdinPreamble();
21 HRESULT CertificateHashesCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
22 HRESULT SmartCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
23 -HRESULT ResetAclsCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
23 HRESULT EnumCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
24 HRESULT ExtractCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
src/wix/wixnative/resetacls.cpp deleted
-56
@@ -1,56 +0,0 @@
1 -// 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.
2 -
3 -#include "precomp.h"
4 -
5 -HRESULT ResetAclsCommand(
6 - __in int argc,
7 - __in_ecount(argc) LPWSTR argv[])
8 -{
9 - Unused(argc);
10 - Unused(argv);
11 -
12 - HRESULT hr = S_OK;
13 - ACL* pacl = NULL;
14 - DWORD cbAcl = sizeof(ACL);
15 - LPWSTR sczFilePath = NULL;
16 -
17 - // create an empty (not NULL!) ACL to use on all the files
18 - pacl = static_cast<ACL*>(MemAlloc(cbAcl, FALSE));
19 - ConsoleExitOnNull(pacl, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "failed to allocate ACL");
20 -
21 -#pragma prefast(push)
22 -#pragma prefast(disable:25029)
23 - if (!::InitializeAcl(pacl, cbAcl, ACL_REVISION))
24 -#pragma prefast(op)
25 - {
26 - ConsoleExitOnLastError(hr, CONSOLE_COLOR_RED, "failed to initialize ACL");
27 - }
28 -
29 - hr = WixNativeReadStdinPreamble();
30 - ExitOnFailure(hr, "failed to read stdin preamble before resetting ACLs");
31 -
32 - // Reset the existing security permissions on each provided file.
33 - for (;;)
34 - {
35 - hr = ConsoleReadW(&sczFilePath);
36 - ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "failed to read file path from stdin");
37 -
38 - if (!*sczFilePath)
39 - {
40 - break;
41 - }
42 -
43 - hr = ::SetNamedSecurityInfoW(sczFilePath, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, pacl, NULL);
44 - if (ERROR_FILE_NOT_FOUND != hr && ERROR_PATH_NOT_FOUND != hr)
45 - {
46 - ConsoleExitOnFailure(hr = HRESULT_FROM_WIN32(hr), CONSOLE_COLOR_RED, "failed to set security descriptor for file: %ls", sczFilePath);
47 - }
48 - }
49 -
50 - AssertSz(::IsValidAcl(pacl), "ResetAcls() - created invalid ACL");
51 -
52 -LExit:
53 - ReleaseStr(sczFilePath);
54 - ReleaseMem(pacl);
55 - return hr;
56 -}
src/wix/wixnative/wixnative.cpp
-4
@@ -28,10 +28,6 @@ int __cdecl wmain(int argc, LPWSTR argv[])
28 {
29 hr = CertificateHashesCommand(argc - 2, argv + 2);
30 }
31 - else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"resetacls", -1))
32 - {
33 - hr = ResetAclsCommand(argc - 2, argv + 2);
34 - }
31 else
32 {
33 ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Unknown command: %ls", argv[1]);
src/wix/wixnative/wixnative.vcxproj
-1
@@ -53,7 +53,6 @@
53 <ClCompile Include="certhashes.cpp" />
54 <ClCompile Include="enumcab.cpp" />
55 <ClCompile Include="extractcab.cpp" />
56 - <ClCompile Include="resetacls.cpp" />
56 <ClCompile Include="smartcab.cpp" />
57 </ItemGroup>
58