-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
OperationPrintDescriptor.cpp
34 lines (30 loc) · 1.18 KB
/
OperationPrintDescriptor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "OperationPrintDescriptor.h"
#include "DriverKitPartial.h"
#include "InputOutput.h"
#include "Helpers.h"
ClassFactory<OperationPrintDescriptor> OperationPrintDescriptor::RegisteredFactory(GetCommand());
OperationPrintDescriptor::OperationPrintDescriptor(std::queue<std::wstring> & oArgList, const std::wstring & sCommand) : Operation(oArgList)
{
// flag this as being an ace-level action
AppliesToSd = true;
AppliesToDacl = true;
AppliesToSacl = true;
AppliesToOwner = true;
AppliesToGroup = true;
}
bool OperationPrintDescriptor::ProcessSdAction(std::wstring & sFileName, ObjectEntry & tObjectEntry, PSECURITY_DESCRIPTOR & tDescriptor, bool & bDescReplacement)
{
// convert the current security descriptor to a string
WCHAR * sInfo = nullptr;
if (ConvertSecurityDescriptorToStringSecurityDescriptor(tDescriptor, SDDL_REVISION_1,
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
&sInfo, nullptr) == 0)
{
InputOutput::AddError(L"Unable to generate string security descriptor.");
return false;
}
// write to screen
InputOutput::AddInfo(L"SD: " + std::wstring(sInfo), L"", true);
LocalFree(sInfo);
return false;
}