Add SECURITY_ATTRIBUTES wrapper
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
26
UnitTests/SDDL.cpp
Normal file
26
UnitTests/SDDL.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2022 Amebis
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
TEST_CLASS(SDDL)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(security_attributes)
|
||||
{
|
||||
winstd::security_attributes sa;
|
||||
Assert::IsTrue(ConvertStringSecurityDescriptorToSecurityDescriptorW(L"O:BAD:PAI(A;;FA;;;BA)", SDDL_REVISION_1, sa, NULL));
|
||||
Assert::IsNotNull(sa.lpSecurityDescriptor);
|
||||
winstd::security_attributes sa2(move(sa));
|
||||
Assert::IsNull(sa.lpSecurityDescriptor);
|
||||
Assert::IsNotNull(sa2.lpSecurityDescriptor);
|
||||
}
|
||||
};
|
||||
}
|
@@ -86,7 +86,7 @@
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Advapi32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
@@ -118,6 +118,7 @@
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SDDL.cpp" />
|
||||
<ClCompile Include="Shell.cpp" />
|
||||
<ClCompile Include="Win.cpp" />
|
||||
</ItemGroup>
|
||||
|
@@ -24,6 +24,9 @@
|
||||
<ClCompile Include="Win.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SDDL.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h">
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <WinStd/ETW.h>
|
||||
#include <WinStd/GDI.h>
|
||||
#include <WinStd/MSI.h>
|
||||
#include <WinStd/SDDL.h>
|
||||
#include <WinStd/Sec.h>
|
||||
#include <WinStd/SetupAPI.h>
|
||||
#include <WinStd/Shell.h>
|
||||
|
Reference in New Issue
Block a user