mirror of
https://github.com/JKornev/hidden
synced 2024-06-20 14:08:05 +00:00
Multiple fixes
- Fixed issue with RuleId - Added loading of the new commands - Fixed issue with inherit\apply flags - Fixed invalid type issue for Protect\Ignore commands etc
This commit is contained in:
parent
0959938a6a
commit
fbbb57c346
@ -55,7 +55,7 @@ NTSTATUS InitializeExcludeListContext(PExcludeContext Context, UINT32 Type)
|
||||
|
||||
InitializeListHead(&cntx->listHead);
|
||||
KeInitializeSpinLock(&cntx->listLock);
|
||||
cntx->guidCounter = 0;
|
||||
cntx->guidCounter = 1;
|
||||
cntx->type = Type;
|
||||
|
||||
*Context = cntx;
|
||||
|
@ -51,7 +51,7 @@ NTSTATUS InitializePsRuleListContext(PPsRulesContext pRuleContext)
|
||||
return STATUS_MEMORY_NOT_ALLOCATED;
|
||||
}
|
||||
|
||||
context->idCounter = 0;
|
||||
context->idCounter = 1;
|
||||
KeInitializeSpinLock(&context->tableLock);
|
||||
RtlInitializeGenericTableAvl(&context->table, ComparePsRuleEntry, AllocatePsRuleEntry, FreePsRuleEntry, NULL);
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
+ unprotect
|
||||
+ query
|
||||
- Протестировать все комманды
|
||||
- При выполнении /unhide с любым ID возвращается статус ок
|
||||
- Проверить чтобы все ObjId генерировались начиная с 1
|
||||
- Реализовать функционал вкл\выкл драйвера через IOCTL
|
||||
- Написать тест HiddenCLITests
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "Commands.h"
|
||||
#include "Hide.h"
|
||||
#include "Ignore.h"
|
||||
#include "Protect.h"
|
||||
#include "Query.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -44,6 +47,11 @@ void Commands::LoadCommandsStack()
|
||||
{
|
||||
m_commandsStack.push_back(CommandPtr(new CommandHide()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandUnhide()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandIgnore()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandUnignore()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandProtect()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandUnprotect()));
|
||||
m_commandsStack.push_back(CommandPtr(new CommandQuery()));
|
||||
}
|
||||
|
||||
void Commands::Perform(Connection& connection)
|
||||
|
@ -110,11 +110,20 @@ HidPsInheritTypes LoadInheritOption(Arguments& args, HidPsInheritTypes default)
|
||||
return default;
|
||||
|
||||
if (arg == L"inherit:none")
|
||||
{
|
||||
args.SwitchToNext();
|
||||
return HidPsInheritTypes::WithoutInherit;
|
||||
}
|
||||
else if (arg == L"inherit:always")
|
||||
{
|
||||
args.SwitchToNext();
|
||||
return HidPsInheritTypes::InheritAlways;
|
||||
}
|
||||
else if (arg == L"inherit:once")
|
||||
{
|
||||
args.SwitchToNext();
|
||||
return HidPsInheritTypes::InheritOnce;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
@ -127,9 +136,15 @@ bool LoadApplyOption(Arguments& args, bool applyByDefault)
|
||||
return applyByDefault;
|
||||
|
||||
if (arg == L"apply:fornew")
|
||||
{
|
||||
args.SwitchToNext();
|
||||
return false;
|
||||
}
|
||||
else if (arg == L"apply:forall")
|
||||
{
|
||||
args.SwitchToNext();
|
||||
return true;
|
||||
}
|
||||
|
||||
return applyByDefault;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ int wmain(int argc, wchar_t* argv[])
|
||||
if (!arguments.ArgsCount())
|
||||
throw WException(
|
||||
-2,
|
||||
L"Welcome to HiddenCLI, please use 'hiddencli help'"
|
||||
L"Welcome to HiddenCLI, please use 'hiddencli /help'"
|
||||
);
|
||||
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ void CommandIgnore::LoadArgs(Arguments& args)
|
||||
void CommandIgnore::PerformCommand(Connection& connection)
|
||||
{
|
||||
HidStatus status;
|
||||
HidObjId objId;
|
||||
HidObjId objId = 0;
|
||||
|
||||
switch (m_procType)
|
||||
{
|
||||
@ -80,7 +80,7 @@ void CommandIgnore::PerformCommand(Connection& connection)
|
||||
throw WException(HID_STATUS_CODE(status), L"Error, command 'ignore' rejected");
|
||||
|
||||
wcerr << L"Command 'ignore' successful" << endl;
|
||||
if (EProcTypes::TypeProcessId)
|
||||
if (m_procType == EProcTypes::TypeProcessId)
|
||||
wcout << L"status:ok" << endl;
|
||||
else
|
||||
wcout << L"status:ok;objid:" << objId << endl;
|
||||
|
@ -80,7 +80,7 @@ void CommandProtect::PerformCommand(Connection& connection)
|
||||
throw WException(HID_STATUS_CODE(status), L"Error, command 'protect' rejected");
|
||||
|
||||
wcerr << L"Command 'protect' successful" << endl;
|
||||
if (EProcTypes::TypeProcessId)
|
||||
if (m_procType == EProcTypes::TypeProcessId)
|
||||
wcout << L"status:ok" << endl;
|
||||
else
|
||||
wcout << L"status:ok;objid:" << objId << endl;
|
||||
|
@ -65,11 +65,11 @@ void CommandQuery::PerformCommand(Connection& connection)
|
||||
if (!HID_STATUS_SUCCESSFUL(status))
|
||||
throw WException(HID_STATUS_CODE(status), L"Error, query protected state rejected");
|
||||
|
||||
wcerr << L"ignore state:" << (excludeState == HidActiveState::StateEnabled ? L"true" : L"false")
|
||||
wcerr << L"Ignored state:" << (excludeState == HidActiveState::StateEnabled ? L"true" : L"false")
|
||||
<< L", inherit:" << ConvertInheritTypeToUnicode(excludedInherit) << endl;
|
||||
wcerr << L"protect state:" << (protectedState == HidActiveState::StateEnabled ? L"true" : L"false")
|
||||
wcerr << L"Protected state:" << (protectedState == HidActiveState::StateEnabled ? L"true" : L"false")
|
||||
<< L", inherit:" << ConvertInheritTypeToUnicode(protectedInherit) << endl;
|
||||
|
||||
wcout << L"status:ok;ignore:" << excludeState << L"," << excludedInherit
|
||||
<< L";protect:" << protectedState << L"," << protectedInherit << endl;
|
||||
wcout << L"status:ok;ignored:" << excludeState << L"," << excludedInherit
|
||||
<< L";protected:" << protectedState << L"," << protectedInherit << endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user