aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-08-01 19:28:18 -0700
committerRob Mensching <rob@firegiant.com>2022-08-05 09:22:36 -0700
commit6e9fc00be1da38f18c27ec6710c475815e046f8d (patch)
treea8998013c83423809b5ed417356c14e3222b8ecc
parentf905838a6398e2d5083145acf279968506ac900b (diff)
downloadwix-6e9fc00be1da38f18c27ec6710c475815e046f8d.tar.gz
wix-6e9fc00be1da38f18c27ec6710c475815e046f8d.tar.bz2
wix-6e9fc00be1da38f18c27ec6710c475815e046f8d.zip
Remove unused resetacls from wixnative
-rw-r--r--src/wix/wixnative/precomp.h1
-rw-r--r--src/wix/wixnative/resetacls.cpp56
-rw-r--r--src/wix/wixnative/wixnative.cpp4
-rw-r--r--src/wix/wixnative/wixnative.vcxproj1
4 files changed, 0 insertions, 62 deletions
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 @@
20HRESULT WixNativeReadStdinPreamble(); 20HRESULT WixNativeReadStdinPreamble();
21HRESULT CertificateHashesCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); 21HRESULT CertificateHashesCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
22HRESULT SmartCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); 22HRESULT SmartCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
23HRESULT ResetAclsCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
24HRESULT EnumCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); 23HRESULT EnumCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]);
25HRESULT ExtractCabCommand(__in int argc, __in_ecount(argc) LPWSTR argv[]); 24HRESULT 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 @@
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
5HRESULT 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
52LExit:
53 ReleaseStr(sczFilePath);
54 ReleaseMem(pacl);
55 return hr;
56}
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[])
28 { 28 {
29 hr = CertificateHashesCommand(argc - 2, argv + 2); 29 hr = CertificateHashesCommand(argc - 2, argv + 2);
30 } 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 }
35 else 31 else
36 { 32 {
37 ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Unknown command: %ls", argv[1]); 33 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 @@
53 <ClCompile Include="certhashes.cpp" /> 53 <ClCompile Include="certhashes.cpp" />
54 <ClCompile Include="enumcab.cpp" /> 54 <ClCompile Include="enumcab.cpp" />
55 <ClCompile Include="extractcab.cpp" /> 55 <ClCompile Include="extractcab.cpp" />
56 <ClCompile Include="resetacls.cpp" />
57 <ClCompile Include="smartcab.cpp" /> 56 <ClCompile Include="smartcab.cpp" />
58 </ItemGroup> 57 </ItemGroup>
59 58