diff --git a/Functions.h b/Functions.h index 482de6f..69073dd 100644 --- a/Functions.h +++ b/Functions.h @@ -12,7 +12,7 @@ std::wstring GetNameFromSidEx(const PSID tSid, bool * bMarkAsOrphan = nullptr); std::wstring GetDomainNameFromSid(const PSID tSid); std::wstring GenerateAccessMask(DWORD iCurrentMask); std::wstring GenerateInheritanceFlags(DWORD iCurrentFlags); -HANDLE RegisterFileHandle(HANDLE hFile, std::wstring sOperation); +HANDLE RegisterFileHandle(HANDLE hFile, const std::wstring & sOperation); std::wstring GetAntivirusStateDescription(); std::wstring FileTimeToString(LPFILETIME const tFileTime); BOOL WriteToFile(const std::wstring & sStringToWrite, HANDLE hFile); diff --git a/Helpers.cpp b/Helpers.cpp index be43d44..3a0740a 100644 --- a/Helpers.cpp +++ b/Helpers.cpp @@ -341,7 +341,7 @@ VOID EnablePrivs() return; } -HANDLE RegisterFileHandle(HANDLE hFile, std::wstring sOperation) +HANDLE RegisterFileHandle(HANDLE hFile, const std::wstring & sOperation) { // lookup do a reverse lookup on file name static std::map> oFileLookup; diff --git a/Main.cpp b/Main.cpp index eaca57f..0a54dfd 100644 --- a/Main.cpp +++ b/Main.cpp @@ -14,14 +14,13 @@ #include #include "Operation.h" -#include "OperationHelp.h" #include "InputOutput.h" #include "ConcurrentQueue.h" #include "DriverKitPartial.h" #include "Functions.h" #include "Version.h" -#define MAX_DIRECTORY_BUFFER 65536 +constexpr ULONG MAX_DIRECTORY_BUFFER = 65536; std::vector oOperationList; diff --git a/OperationAddAccountIfMissing.cpp b/OperationAddAccountIfMissing.cpp index e410243..922546a 100644 --- a/OperationAddAccountIfMissing.cpp +++ b/OperationAddAccountIfMissing.cpp @@ -5,7 +5,7 @@ ClassFactory OperationAddAccountIfMissing::RegisteredFactory(GetCommand()); -OperationAddAccountIfMissing::OperationAddAccountIfMissing(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationAddAccountIfMissing::OperationAddAccountIfMissing(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationAddAccountIfMissing.h b/OperationAddAccountIfMissing.h index a60a038..f603ee9 100644 --- a/OperationAddAccountIfMissing.h +++ b/OperationAddAccountIfMissing.h @@ -20,5 +20,5 @@ class OperationAddAccountIfMissing : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationAddAccountIfMissing(std::queue & oArgList, std::wstring sCommand); + OperationAddAccountIfMissing(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationBackupSecurity.cpp b/OperationBackupSecurity.cpp index 8f2c1e9..f29d5e3 100644 --- a/OperationBackupSecurity.cpp +++ b/OperationBackupSecurity.cpp @@ -4,7 +4,7 @@ ClassFactory OperationBackupSecurity::RegisteredFactory(GetCommand()); -OperationBackupSecurity::OperationBackupSecurity(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationBackupSecurity::OperationBackupSecurity(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationBackupSecurity.h b/OperationBackupSecurity.h index fcbe80b..3dd5291 100644 --- a/OperationBackupSecurity.h +++ b/OperationBackupSecurity.h @@ -19,6 +19,6 @@ class OperationBackupSecurity : public Operation bool ProcessSdAction(std::wstring & sFileName, ObjectEntry & tObjectEntry, PSECURITY_DESCRIPTOR & tDescriptor, bool & bDescReplacement) override; // constructors - OperationBackupSecurity(std::queue & oArgList, std::wstring sCommand); + OperationBackupSecurity(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationCanonicalizeAcls.cpp b/OperationCanonicalizeAcls.cpp index ee5a421..2444900 100644 --- a/OperationCanonicalizeAcls.cpp +++ b/OperationCanonicalizeAcls.cpp @@ -2,11 +2,10 @@ #include "OperationCheckCanonical.h" #include "DriverKitPartial.h" #include "InputOutput.h" -#include "Functions.h" ClassFactory OperationCanonicalizeAcls::RegisteredFactory(GetCommand()); -OperationCanonicalizeAcls::OperationCanonicalizeAcls(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationCanonicalizeAcls::OperationCanonicalizeAcls(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationCanonicalizeAcls.h b/OperationCanonicalizeAcls.h index 16cbc4a..6e423f7 100644 --- a/OperationCanonicalizeAcls.h +++ b/OperationCanonicalizeAcls.h @@ -16,6 +16,6 @@ class OperationCanonicalizeAcls : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationCanonicalizeAcls(std::queue & oArgList, std::wstring sCommand); + OperationCanonicalizeAcls(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationCheckCanonical.cpp b/OperationCheckCanonical.cpp index 1cac35a..afe5d40 100644 --- a/OperationCheckCanonical.cpp +++ b/OperationCheckCanonical.cpp @@ -5,7 +5,7 @@ ClassFactory OperationCheckCanonical::RegisteredFactory(GetCommand()); -OperationCheckCanonical::OperationCheckCanonical(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationCheckCanonical::OperationCheckCanonical(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationCheckCanonical.h b/OperationCheckCanonical.h index 9f220ad..2479f0f 100644 --- a/OperationCheckCanonical.h +++ b/OperationCheckCanonical.h @@ -31,6 +31,6 @@ class OperationCheckCanonical : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationCheckCanonical(std::queue & oArgList, std::wstring sCommand); + OperationCheckCanonical(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationCompact.cpp b/OperationCompact.cpp index 749d7ef..fbe831a 100644 --- a/OperationCompact.cpp +++ b/OperationCompact.cpp @@ -7,7 +7,7 @@ ClassFactory OperationCompact::RegisteredFactory(GetCommand()); -OperationCompact::OperationCompact(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationCompact::OperationCompact(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationCompact.h b/OperationCompact.h index cade124..28b6c13 100644 --- a/OperationCompact.h +++ b/OperationCompact.h @@ -16,6 +16,6 @@ class OperationCompact : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationCompact(std::queue & oArgList, std::wstring sCommand); + OperationCompact(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationCopyDomain.cpp b/OperationCopyDomain.cpp index 56cc941..77c3750 100644 --- a/OperationCopyDomain.cpp +++ b/OperationCopyDomain.cpp @@ -5,7 +5,7 @@ ClassFactory OperationCopyDomain::RegisteredFactory(GetCommand()); -OperationCopyDomain::OperationCopyDomain(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationCopyDomain::OperationCopyDomain(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(2, oArgList); diff --git a/OperationCopyDomain.h b/OperationCopyDomain.h index ddeb457..a511ce0 100644 --- a/OperationCopyDomain.h +++ b/OperationCopyDomain.h @@ -22,5 +22,5 @@ class OperationCopyDomain : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationCopyDomain(std::queue & oArgList, std::wstring sCommand); + OperationCopyDomain(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationDomainPaths.cpp b/OperationDomainPaths.cpp index b54eb68..645cec8 100644 --- a/OperationDomainPaths.cpp +++ b/OperationDomainPaths.cpp @@ -16,7 +16,7 @@ ClassFactory OperationDomainPaths::RegisteredFactory(GetCommand()); -OperationDomainPaths::OperationDomainPaths(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationDomainPaths::OperationDomainPaths(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationDomainPaths.h b/OperationDomainPaths.h index 09420d0..3881a84 100644 --- a/OperationDomainPaths.h +++ b/OperationDomainPaths.h @@ -13,5 +13,5 @@ class OperationDomainPaths : public Operation public: // constructors - OperationDomainPaths(std::queue & oArgList, std::wstring sCommand); + OperationDomainPaths(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationFactory.h b/OperationFactory.h index 873d710..c15a6af 100644 --- a/OperationFactory.h +++ b/OperationFactory.h @@ -6,7 +6,7 @@ class FactoryPlant { protected: - virtual Operation * CreateInstanceSub(std::queue & oArgList, std::wstring sCommand) = 0; + virtual Operation * CreateInstanceSub(std::queue & oArgList, const std::wstring & sCommand) = 0; static std::map & GetCommands() { @@ -15,6 +15,8 @@ class FactoryPlant } public: + + virtual ~FactoryPlant() = default; static Operation * CreateInstance(std::queue & oArgList) { @@ -52,11 +54,11 @@ class FactoryPlant } }; -template class ClassFactory : public FactoryPlant +template class ClassFactory final : public FactoryPlant { private: - Operation * CreateInstanceSub(std::queue & oArgList, std::wstring sCommand) override + Operation * CreateInstanceSub(std::queue & oArgList, const std::wstring & sCommand) override { return new SubType(oArgList, sCommand); } diff --git a/OperationFindAccount.cpp b/OperationFindAccount.cpp index 213d367..48bdc88 100644 --- a/OperationFindAccount.cpp +++ b/OperationFindAccount.cpp @@ -4,7 +4,7 @@ ClassFactory OperationFindAccount::RegisteredFactory(GetCommand()); -OperationFindAccount::OperationFindAccount(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationFindAccount::OperationFindAccount(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationFindAccount.h b/OperationFindAccount.h index 4f7f748..63cd90a 100644 --- a/OperationFindAccount.h +++ b/OperationFindAccount.h @@ -20,5 +20,5 @@ class OperationFindAccount : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationFindAccount(std::queue & oArgList, std::wstring sCommand); + OperationFindAccount(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationFindDomain.cpp b/OperationFindDomain.cpp index a54c5a5..e579b6d 100644 --- a/OperationFindDomain.cpp +++ b/OperationFindDomain.cpp @@ -4,7 +4,7 @@ ClassFactory OperationFindDomain::RegisteredFactory(GetCommand()); -OperationFindDomain::OperationFindDomain(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationFindDomain::OperationFindDomain(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationFindDomain.h b/OperationFindDomain.h index f79bcfa..cf254d7 100644 --- a/OperationFindDomain.h +++ b/OperationFindDomain.h @@ -20,5 +20,5 @@ class OperationFindDomain : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationFindDomain(std::queue & oArgList, std::wstring sCommand); + OperationFindDomain(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationFindNullAcl.cpp b/OperationFindNullAcl.cpp index f712c2e..43f0a6d 100644 --- a/OperationFindNullAcl.cpp +++ b/OperationFindNullAcl.cpp @@ -4,7 +4,7 @@ ClassFactory OperationFindNullAcl::RegisteredFactory(GetCommand()); -OperationFindNullAcl::OperationFindNullAcl(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationFindNullAcl::OperationFindNullAcl(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationFindNullAcl.h b/OperationFindNullAcl.h index 5435800..3157729 100644 --- a/OperationFindNullAcl.h +++ b/OperationFindNullAcl.h @@ -16,6 +16,6 @@ class OperationFindNullAcl : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationFindNullAcl(std::queue & oArgList, std::wstring sCommand); + OperationFindNullAcl(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationGrantDenyPerms.cpp b/OperationGrantDenyPerms.cpp index ca70cad..309d34e 100644 --- a/OperationGrantDenyPerms.cpp +++ b/OperationGrantDenyPerms.cpp @@ -9,7 +9,7 @@ ClassFactory OperationGrantDenyPerms::RegisteredFactoryGrant(GetCommandAdd()); ClassFactory OperationGrantDenyPerms::RegisteredFactoryDeny(GetCommandDeny()); -OperationGrantDenyPerms::OperationGrantDenyPerms(std::queue& oArgList, std::wstring sCommand) : Operation(oArgList) +OperationGrantDenyPerms::OperationGrantDenyPerms(std::queue& oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(2, oArgList); @@ -23,20 +23,21 @@ OperationGrantDenyPerms::OperationGrantDenyPerms(std::queue& oArgL std::vector aPermList; const std::wregex oPermsRegex(LR"(\(([A-Z]+)\))"); for (std::wsregex_iterator oPermsIterator(sPerms.begin(), sPerms.end(), oPermsRegex, - std::regex_constants::match_continuous); oPermsIterator != std::wsregex_iterator(); oPermsIterator++) { + std::regex_constants::match_continuous); oPermsIterator != std::wsregex_iterator(); ++oPermsIterator) { aPermList.push_back((*oPermsIterator).str(1)); } // error if no options set - if (aPermList.size() == 0) + if (aPermList.empty()) { wprintf(L"ERROR: Invalid or no permissions string specified for parameter '%s'.\n", GetCommandAdd().c_str()); exit(-1); } // populate default values - ConvertToUpper(sCommand); - tEa.grfAccessMode = (sCommand == GetCommandAdd()) ? GRANT_ACCESS : DENY_ACCESS; + std::wstring sCommandUpper(sCommand); + ConvertToUpper(sCommandUpper); + tEa.grfAccessMode = (sCommandUpper == GetCommandAdd()) ? GRANT_ACCESS : DENY_ACCESS; tEa.grfInheritance = NO_INHERITANCE; tEa.grfAccessPermissions = 0; tEa.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; @@ -98,7 +99,7 @@ OperationGrantDenyPerms::OperationGrantDenyPerms(std::queue& oArgL }; // decode the permissions string to their binary values - for (const std::wstring sKey : aPermList) + for (const std::wstring & sKey : aPermList) { if (aInheritMap.find(sKey) != aInheritMap.end()) tEa.grfInheritance |= aInheritMap.at(sKey); else if (aPermsMap.find(sKey) != aPermsMap.end()) tEa.grfAccessPermissions |= aPermsMap.at(sKey); @@ -123,7 +124,7 @@ bool OperationGrantDenyPerms::ProcessAclAction(WCHAR* const sSdPart, ObjectEntry const DWORD iObjectTypeMask = IsDirectory(tObjectEntry.Attributes) ? ~0 : ~(CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE); - // verify this is not alraedy part of the ace as an inherited or explicit entry + // verify this is not already part of the ace as an inherited or explicit entry if (tCurrentAcl != nullptr) { ACCESS_ACE* tAceDacl = FirstAce(tCurrentAcl); diff --git a/OperationGrantDenyPerms.h b/OperationGrantDenyPerms.h index f9ad25b..074f899 100644 --- a/OperationGrantDenyPerms.h +++ b/OperationGrantDenyPerms.h @@ -25,5 +25,5 @@ class OperationGrantDenyPerms : public Operation bool ProcessAclAction(WCHAR* const sSdPart, ObjectEntry& tObjectEntry, PACL& tCurrentAcl, bool& bAclReplacement) override; // constructors - OperationGrantDenyPerms(std::queue& oArgList, std::wstring sCommand); + OperationGrantDenyPerms(std::queue& oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationHelp.cpp b/OperationHelp.cpp index fcc6e8c..5d08d14 100644 --- a/OperationHelp.cpp +++ b/OperationHelp.cpp @@ -6,7 +6,7 @@ ClassFactory OperationHelp::RegisteredFactory(GetCommand()); ClassFactory OperationHelp::RegisteredFactoryAltOne(GetCommandAltOne()); ClassFactory OperationHelp::RegisteredFactoryAltTwo(GetCommandAltTwo()); -OperationHelp::OperationHelp(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationHelp::OperationHelp(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { std::wcout << LR"( diff --git a/OperationHelp.h b/OperationHelp.h index 5705dd5..5f2141e 100644 --- a/OperationHelp.h +++ b/OperationHelp.h @@ -17,5 +17,5 @@ class OperationHelp : public Operation public: // constructors - OperationHelp(std::queue & oArgList, std::wstring sCommand); + OperationHelp(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationInheritChildren.cpp b/OperationInheritChildren.cpp index 91962a1..2a6e42f 100644 --- a/OperationInheritChildren.cpp +++ b/OperationInheritChildren.cpp @@ -5,7 +5,7 @@ ClassFactory OperationInheritChildren::RegisteredFactory(GetCommand()); -OperationInheritChildren::OperationInheritChildren(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationInheritChildren::OperationInheritChildren(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationInheritChildren.h b/OperationInheritChildren.h index 32a254f..d451a1d 100644 --- a/OperationInheritChildren.h +++ b/OperationInheritChildren.h @@ -16,6 +16,6 @@ class OperationInheritChildren : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationInheritChildren(std::queue & oArgList, std::wstring sCommand); + OperationInheritChildren(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationLocate.cpp b/OperationLocate.cpp index 8d9c330..4a51b70 100644 --- a/OperationLocate.cpp +++ b/OperationLocate.cpp @@ -6,7 +6,7 @@ ClassFactory OperationLocate::RegisteredFactory(GetCommand()); #define Q(x) L"\"" + (x) + L"\"" -OperationLocate::OperationLocate(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationLocate::OperationLocate(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sReportFile = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationLocate.h b/OperationLocate.h index 220128a..cf2dd87 100644 --- a/OperationLocate.h +++ b/OperationLocate.h @@ -22,5 +22,5 @@ class OperationLocate : public Operation void ProcessObjectAction(ObjectEntry & tObjectEntry) override; // constructors - OperationLocate(std::queue & oArgList, std::wstring sCommand); + OperationLocate(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationLocateShortcut.cpp b/OperationLocateShortcut.cpp index 1c4aa95..0a8b9a2 100644 --- a/OperationLocateShortcut.cpp +++ b/OperationLocateShortcut.cpp @@ -11,7 +11,7 @@ ClassFactory OperationLocateShortcut::RegisteredFactory #define Q(x) L"\"" + (x) + L"\"" -OperationLocateShortcut::OperationLocateShortcut(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationLocateShortcut::OperationLocateShortcut(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sReportFile = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationLocateShortcut.h b/OperationLocateShortcut.h index 5439e98..dff483a 100644 --- a/OperationLocateShortcut.h +++ b/OperationLocateShortcut.h @@ -23,5 +23,5 @@ class OperationLocateShortcut : public Operation void ProcessObjectAction(ObjectEntry & tObjectEntry) override; // constructors - OperationLocateShortcut(std::queue & oArgList, std::wstring sCommand); + OperationLocateShortcut(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationLog.cpp b/OperationLog.cpp index 4408689..4a3cff4 100644 --- a/OperationLog.cpp +++ b/OperationLog.cpp @@ -2,10 +2,7 @@ #include "InputOutput.h" #include "Functions.h" -#include -#include #include -#include ClassFactory OperationLog::RegisteredFactory(GetCommand()); @@ -13,7 +10,7 @@ ClassFactory OperationLog::RegisteredFactory(GetCommand()); HANDLE OperationLog::hLogHandle = INVALID_HANDLE_VALUE; -OperationLog::OperationLog(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationLog::OperationLog(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sLogFile = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationLog.h b/OperationLog.h index 79a1b41..50c7ec7 100644 --- a/OperationLog.h +++ b/OperationLog.h @@ -15,7 +15,7 @@ class OperationLog : public Operation public: // constructors - OperationLog(std::queue & oArgList, std::wstring sCommand); + OperationLog(std::queue & oArgList, const std::wstring & sCommand); // functions static void LogFileItem(const std::wstring & sInfoLevel, const std::wstring & sPath, const std::wstring & sMessage); diff --git a/OperationMoveDomain.cpp b/OperationMoveDomain.cpp index ec063c6..106d950 100644 --- a/OperationMoveDomain.cpp +++ b/OperationMoveDomain.cpp @@ -4,7 +4,7 @@ ClassFactory OperationMoveDomain::RegisteredFactory(GetCommand()); -OperationMoveDomain::OperationMoveDomain(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationMoveDomain::OperationMoveDomain(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(2, oArgList); diff --git a/OperationMoveDomain.h b/OperationMoveDomain.h index bbdf461..eb0d360 100644 --- a/OperationMoveDomain.h +++ b/OperationMoveDomain.h @@ -22,5 +22,5 @@ class OperationMoveDomain : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationMoveDomain(std::queue & oArgList, std::wstring sCommand); + OperationMoveDomain(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationNoHiddenSystem.cpp b/OperationNoHiddenSystem.cpp index e4c97b3..eb9fb73 100644 --- a/OperationNoHiddenSystem.cpp +++ b/OperationNoHiddenSystem.cpp @@ -3,7 +3,7 @@ ClassFactory OperationNoHiddenSystem::RegisteredFactory(GetCommand()); -OperationNoHiddenSystem::OperationNoHiddenSystem(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationNoHiddenSystem::OperationNoHiddenSystem(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { InputOutput::ExcludeHiddenSystem() = true; } \ No newline at end of file diff --git a/OperationNoHiddenSystem.h b/OperationNoHiddenSystem.h index 416c887..b5b9d06 100644 --- a/OperationNoHiddenSystem.h +++ b/OperationNoHiddenSystem.h @@ -13,5 +13,5 @@ class OperationNoHiddenSystem : public Operation public: // constructors - OperationNoHiddenSystem(std::queue & oArgList, std::wstring sCommand); + OperationNoHiddenSystem(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationPath.cpp b/OperationPath.cpp index 770e4d3..05c249f 100644 --- a/OperationPath.cpp +++ b/OperationPath.cpp @@ -4,7 +4,7 @@ ClassFactory OperationPath::RegisteredFactory(GetCommand()); -OperationPath::OperationPath(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationPath::OperationPath(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationPath.h b/OperationPath.h index 3352678..65ae068 100644 --- a/OperationPath.h +++ b/OperationPath.h @@ -13,5 +13,5 @@ class OperationPath : public Operation public: // constructors - OperationPath(std::queue & oArgList, std::wstring sCommand); + OperationPath(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationPathList.cpp b/OperationPathList.cpp index 7d67f53..2471fc4 100644 --- a/OperationPathList.cpp +++ b/OperationPathList.cpp @@ -9,7 +9,7 @@ ClassFactory OperationPathList::RegisteredFactory(GetCommand()); -OperationPathList::OperationPathList(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationPathList::OperationPathList(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationPathList.h b/OperationPathList.h index 07de059..639a8d4 100644 --- a/OperationPathList.h +++ b/OperationPathList.h @@ -13,5 +13,5 @@ class OperationPathList : public Operation public: // constructors - OperationPathList(std::queue & oArgList, std::wstring sCommand); + OperationPathList(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationPrintDescriptor.cpp b/OperationPrintDescriptor.cpp index d6e52f7..4087777 100644 --- a/OperationPrintDescriptor.cpp +++ b/OperationPrintDescriptor.cpp @@ -5,7 +5,7 @@ ClassFactory OperationPrintDescriptor::RegisteredFactory(GetCommand()); -OperationPrintDescriptor::OperationPrintDescriptor(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationPrintDescriptor::OperationPrintDescriptor(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToSd = true; diff --git a/OperationPrintDescriptor.h b/OperationPrintDescriptor.h index a089a06..2a90fe7 100644 --- a/OperationPrintDescriptor.h +++ b/OperationPrintDescriptor.h @@ -16,6 +16,6 @@ class OperationPrintDescriptor : public Operation bool ProcessSdAction(std::wstring & sFileName, ObjectEntry & tObjectEntry, PSECURITY_DESCRIPTOR & tDescriptor, bool & bDescReplacement) override; // constructors - OperationPrintDescriptor(std::queue & oArgList, std::wstring sCommand); + OperationPrintDescriptor(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationQuiet.cpp b/OperationQuiet.cpp index a3e79d9..0df2319 100644 --- a/OperationQuiet.cpp +++ b/OperationQuiet.cpp @@ -3,7 +3,7 @@ ClassFactory OperationQuiet::RegisteredFactory(GetCommand()); -OperationQuiet::OperationQuiet(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationQuiet::OperationQuiet(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { InputOutput::InQuietMode() = true; } \ No newline at end of file diff --git a/OperationQuiet.h b/OperationQuiet.h index 4597e0b..858a26a 100644 --- a/OperationQuiet.h +++ b/OperationQuiet.h @@ -13,5 +13,5 @@ class OperationQuiet : public Operation public: // constructors - OperationQuiet(std::queue & oArgList, std::wstring sCommand); + OperationQuiet(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationRemoveAccount.cpp b/OperationRemoveAccount.cpp index 33b88e2..454030b 100644 --- a/OperationRemoveAccount.cpp +++ b/OperationRemoveAccount.cpp @@ -4,7 +4,7 @@ ClassFactory OperationRemoveAccount::RegisteredFactory(GetCommand()); -OperationRemoveAccount::OperationRemoveAccount(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationRemoveAccount::OperationRemoveAccount(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationRemoveAccount.h b/OperationRemoveAccount.h index ed29160..bf1ea3b 100644 --- a/OperationRemoveAccount.h +++ b/OperationRemoveAccount.h @@ -20,5 +20,5 @@ class OperationRemoveAccount : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationRemoveAccount(std::queue & oArgList, std::wstring sCommand); + OperationRemoveAccount(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationRemoveOrphan.cpp b/OperationRemoveOrphan.cpp index dca5675..c585445 100644 --- a/OperationRemoveOrphan.cpp +++ b/OperationRemoveOrphan.cpp @@ -4,7 +4,7 @@ ClassFactory OperationRemoveOrphan::RegisteredFactory(GetCommand()); -OperationRemoveOrphan::OperationRemoveOrphan(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationRemoveOrphan::OperationRemoveOrphan(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationRemoveOrphan.h b/OperationRemoveOrphan.h index 8de727c..fcad326 100644 --- a/OperationRemoveOrphan.h +++ b/OperationRemoveOrphan.h @@ -20,5 +20,5 @@ class OperationRemoveOrphan : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationRemoveOrphan(std::queue & oArgList, std::wstring sCommand); + OperationRemoveOrphan(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationRemoveRedundant.cpp b/OperationRemoveRedundant.cpp index 7cb0bb9..c39e901 100644 --- a/OperationRemoveRedundant.cpp +++ b/OperationRemoveRedundant.cpp @@ -5,7 +5,7 @@ ClassFactory OperationRemoveRedundant::RegisteredFactory(GetCommand()); -OperationRemoveRedundant::OperationRemoveRedundant(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationRemoveRedundant::OperationRemoveRedundant(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationRemoveRedundant.h b/OperationRemoveRedundant.h index 10adbd0..10d6439 100644 --- a/OperationRemoveRedundant.h +++ b/OperationRemoveRedundant.h @@ -16,6 +16,6 @@ class OperationRemoveRedundant : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationRemoveRedundant(std::queue & oArgList, std::wstring sCommand); + OperationRemoveRedundant(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationReplaceAccount.cpp b/OperationReplaceAccount.cpp index 01e588d..a6303ea 100644 --- a/OperationReplaceAccount.cpp +++ b/OperationReplaceAccount.cpp @@ -4,7 +4,7 @@ ClassFactory OperationReplaceAccount::RegisteredFactory(GetCommand()); -OperationReplaceAccount::OperationReplaceAccount(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationReplaceAccount::OperationReplaceAccount(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(2, oArgList); diff --git a/OperationReplaceAccount.h b/OperationReplaceAccount.h index d3e8a53..6398537 100644 --- a/OperationReplaceAccount.h +++ b/OperationReplaceAccount.h @@ -22,5 +22,5 @@ class OperationReplaceAccount : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationReplaceAccount(std::queue & oArgList, std::wstring sCommand); + OperationReplaceAccount(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationReplaceMap.cpp b/OperationReplaceMap.cpp index a12bff3..3cb3b01 100644 --- a/OperationReplaceMap.cpp +++ b/OperationReplaceMap.cpp @@ -9,7 +9,7 @@ ClassFactory OperationReplaceMap::RegisteredFactory(GetCommand()); -OperationReplaceMap::OperationReplaceMap(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationReplaceMap::OperationReplaceMap(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationReplaceMap.h b/OperationReplaceMap.h index 459979e..4f62a81 100644 --- a/OperationReplaceMap.h +++ b/OperationReplaceMap.h @@ -19,5 +19,5 @@ class OperationReplaceMap : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationReplaceMap(std::queue & oArgList, std::wstring sCommand); + OperationReplaceMap(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationReport.cpp b/OperationReport.cpp index f84701a..f352b1a 100644 --- a/OperationReport.cpp +++ b/OperationReport.cpp @@ -6,7 +6,7 @@ ClassFactory OperationReport::RegisteredFactory(GetCommand()); #define Q(x) L"\"" + (x) + L"\"" -OperationReport::OperationReport(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationReport::OperationReport(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sReportFile = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationReport.h b/OperationReport.h index 3c65897..e8d9e9d 100644 --- a/OperationReport.h +++ b/OperationReport.h @@ -23,5 +23,5 @@ class OperationReport : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationReport(std::queue & oArgList, std::wstring sCommand); + OperationReport(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationResetChildren.cpp b/OperationResetChildren.cpp index 32579ff..33ee2cb 100644 --- a/OperationResetChildren.cpp +++ b/OperationResetChildren.cpp @@ -4,7 +4,7 @@ ClassFactory OperationResetChildren::RegisteredFactory(GetCommand()); -OperationResetChildren::OperationResetChildren(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationResetChildren::OperationResetChildren(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // setup null ace for allowing inheritance InitializeAcl(&tAclNull, sizeof(tAclNull), ACL_REVISION); diff --git a/OperationResetChildren.h b/OperationResetChildren.h index c3d22e5..7e054e8 100644 --- a/OperationResetChildren.h +++ b/OperationResetChildren.h @@ -19,6 +19,6 @@ class OperationResetChildren : public Operation bool ProcessAclAction(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PACL & tCurrentAcl, bool & bAclReplacement) override; // constructors - OperationResetChildren(std::queue & oArgList, std::wstring sCommand); + OperationResetChildren(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationRestoreSecurity.cpp b/OperationRestoreSecurity.cpp index 4b51cba..01b1398 100644 --- a/OperationRestoreSecurity.cpp +++ b/OperationRestoreSecurity.cpp @@ -9,7 +9,7 @@ ClassFactory OperationRestoreSecurity::RegisteredFactory(GetCommand()); -OperationRestoreSecurity::OperationRestoreSecurity(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationRestoreSecurity::OperationRestoreSecurity(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0"); diff --git a/OperationRestoreSecurity.h b/OperationRestoreSecurity.h index c1ce51f..273c35b 100644 --- a/OperationRestoreSecurity.h +++ b/OperationRestoreSecurity.h @@ -19,6 +19,6 @@ class OperationRestoreSecurity : public Operation bool ProcessSdAction(std::wstring & sFileName, ObjectEntry & tObjectEntry, PSECURITY_DESCRIPTOR & tDescriptor, bool & bDescReplacement) override; // constructors - OperationRestoreSecurity(std::queue & oArgList, std::wstring sCommand); + OperationRestoreSecurity(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationSetOwner.cpp b/OperationSetOwner.cpp index e01a550..2840796 100644 --- a/OperationSetOwner.cpp +++ b/OperationSetOwner.cpp @@ -4,7 +4,7 @@ ClassFactory OperationSetOwner::RegisteredFactory(GetCommand()); -OperationSetOwner::OperationSetOwner(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationSetOwner::OperationSetOwner(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationSetOwner.h b/OperationSetOwner.h index 9d4e31f..d118b6a 100644 --- a/OperationSetOwner.h +++ b/OperationSetOwner.h @@ -20,5 +20,5 @@ class OperationSetOwner : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationSetOwner(std::queue & oArgList, std::wstring sCommand); + OperationSetOwner(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationSharePaths.cpp b/OperationSharePaths.cpp index 56f6825..1360391 100644 --- a/OperationSharePaths.cpp +++ b/OperationSharePaths.cpp @@ -11,7 +11,7 @@ ClassFactory OperationSharePaths::RegisteredFactory(GetCommand()); -OperationSharePaths::OperationSharePaths(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationSharePaths::OperationSharePaths(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationSharePaths.h b/OperationSharePaths.h index 83f3cbb..db4551f 100644 --- a/OperationSharePaths.h +++ b/OperationSharePaths.h @@ -13,5 +13,5 @@ class OperationSharePaths : public Operation public: // constructors - OperationSharePaths(std::queue & oArgList, std::wstring sCommand); + OperationSharePaths(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationSidHistory.cpp b/OperationSidHistory.cpp index 07cd8ff..aef46b3 100644 --- a/OperationSidHistory.cpp +++ b/OperationSidHistory.cpp @@ -4,7 +4,7 @@ ClassFactory OperationSidHistory::RegisteredFactory(GetCommand()); -OperationSidHistory::OperationSidHistory(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationSidHistory::OperationSidHistory(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // flag this as being an ace-level action AppliesToDacl = true; diff --git a/OperationSidHistory.h b/OperationSidHistory.h index 252dbcf..a1d0029 100644 --- a/OperationSidHistory.h +++ b/OperationSidHistory.h @@ -16,5 +16,5 @@ class OperationSidHistory : public Operation SidActionResult DetermineSid(WCHAR * const sSdPart, ObjectEntry & tObjectEntry, PSID const tCurrentSid, PSID & tResultantSid) override; // constructors - OperationSidHistory(std::queue & oArgList, std::wstring sCommand); + OperationSidHistory(std::queue & oArgList, const std::wstring & sCommand); }; diff --git a/OperationThreads.cpp b/OperationThreads.cpp index 67a80e7..ecf4789 100644 --- a/OperationThreads.cpp +++ b/OperationThreads.cpp @@ -4,7 +4,7 @@ ClassFactory OperationThreads::RegisteredFactory(GetCommand()); -OperationThreads::OperationThreads(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationThreads::OperationThreads(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { // exit if there are not enough arguments to parse std::vector sSubArgs = ProcessAndCheckArgs(1, oArgList); diff --git a/OperationThreads.h b/OperationThreads.h index 67715bd..725bae2 100644 --- a/OperationThreads.h +++ b/OperationThreads.h @@ -13,5 +13,5 @@ class OperationThreads : public Operation public: // constructors - OperationThreads(std::queue & oArgList, std::wstring sCommand); + OperationThreads(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file diff --git a/OperationWhatIf.cpp b/OperationWhatIf.cpp index d4dc6b4..4a36336 100644 --- a/OperationWhatIf.cpp +++ b/OperationWhatIf.cpp @@ -3,7 +3,7 @@ ClassFactory OperationWhatIf::RegisteredFactory(GetCommand()); -OperationWhatIf::OperationWhatIf(std::queue & oArgList, std::wstring sCommand) : Operation(oArgList) +OperationWhatIf::OperationWhatIf(std::queue & oArgList, const std::wstring & sCommand) : Operation(oArgList) { InputOutput::InWhatIfMode() = true; } \ No newline at end of file diff --git a/OperationWhatIf.h b/OperationWhatIf.h index 181ea0b..efac68f 100644 --- a/OperationWhatIf.h +++ b/OperationWhatIf.h @@ -13,5 +13,5 @@ class OperationWhatIf : public Operation public: // constructors - OperationWhatIf(std::queue & oArgList, std::wstring sCommand); + OperationWhatIf(std::queue & oArgList, const std::wstring & sCommand); }; \ No newline at end of file