diff --git a/Hidden/Device.c b/Hidden/Device.c index eb1d3de..98d48f5 100644 --- a/Hidden/Device.c +++ b/Hidden/Device.c @@ -236,7 +236,7 @@ NTSTATUS GetPsObjectInfo(PHid_GetPsObjectInfoPacket Packet, USHORT Size, PHid_Ge case PsProtectedObject: status = GetProtectedProcessState((HANDLE)Packet->procId, &inheritType, &enable); break; - case PsHiddenObject: + case PsActiveHiddenObject: status = GetHiddenProcessState((HANDLE)Packet->procId, &inheritType, &enable); break; default: @@ -270,7 +270,7 @@ NTSTATUS SetPsObjectInfo(PHid_SetPsObjectInfoPacket Packet, USHORT Size) case PsProtectedObject: status = SetProtectedProcessState((HANDLE)Packet->procId, Packet->inheritType, (Packet->enable ? TRUE : FALSE)); break; - case PsHiddenObject: + case PsActiveHiddenObject: status = SetHiddenProcessState((HANDLE)Packet->procId, Packet->inheritType, (Packet->enable ? TRUE : FALSE)); break; default: diff --git a/HiddenCLI/Query.cpp b/HiddenCLI/Query.cpp index 94a02f1..1ddc14b 100644 --- a/HiddenCLI/Query.cpp +++ b/HiddenCLI/Query.cpp @@ -62,8 +62,8 @@ void CommandQuery::PerformCommand(Connection& connection) } else if (m_queryType == EQueryType::QueryProcess) { - HidActiveState excludeState, protectedState; - HidPsInheritTypes excludedInherit, protectedInherit; + HidActiveState excludeState, protectedState, hiddenState; + HidPsInheritTypes excludedInherit, protectedInherit, hiddenInherit; status = Hid_GetExcludedState(connection.GetContext(), m_targetProcId, &excludeState, &excludedInherit); if (!HID_STATUS_SUCCESSFUL(status)) @@ -73,13 +73,20 @@ void CommandQuery::PerformCommand(Connection& connection) if (!HID_STATUS_SUCCESSFUL(status)) throw WException(HID_STATUS_CODE(status), L"Error, query protected state rejected"); + status = Hid_GetHiddenState(connection.GetContext(), m_targetProcId, &hiddenState, &hiddenInherit); + if (!HID_STATUS_SUCCESSFUL(status)) + throw WException(HID_STATUS_CODE(status), L"Error, query hidden state rejected"); + g_stderr << L"Ignored state:" << (excludeState == HidActiveState::StateEnabled ? L"true" : L"false") - << L", inherit:" << ConvertInheritTypeToUnicode(excludedInherit) << endl; + << L", inherit:" << ConvertInheritTypeToUnicode(excludedInherit) << endl; g_stderr << L"Protected state:" << (protectedState == HidActiveState::StateEnabled ? L"true" : L"false") - << L", inherit:" << ConvertInheritTypeToUnicode(protectedInherit) << endl; + << L", inherit:" << ConvertInheritTypeToUnicode(protectedInherit) << endl; + g_stderr << L"Hidden state:" << (hiddenState == HidActiveState::StateEnabled ? L"true" : L"false") + << L", inherit:" << ConvertInheritTypeToUnicode(hiddenInherit) << endl; g_stdout << L"ignored:" << static_cast(excludeState) << L"," << static_cast(excludedInherit) - << L";protected:" << static_cast(protectedState) << L"," << static_cast(protectedInherit) << endl; + << L";protected:" << static_cast(protectedState) << L"," << static_cast(protectedInherit) + << L";hidden:" << static_cast(hiddenState) << L"," << static_cast(hiddenInherit) << endl; } } diff --git a/HiddenLib/HiddenLib.cpp b/HiddenLib/HiddenLib.cpp index ddcaf14..0514a34 100644 --- a/HiddenLib/HiddenLib.cpp +++ b/HiddenLib/HiddenLib.cpp @@ -776,17 +776,17 @@ HidStatus _API Hid_RemoveAllHiddenProcesses(HidContext context) HidStatus _API Hid_GetHiddenState(HidContext context, HidProcId procId, HidActiveState* state, HidPsInheritTypes* inheritType) { - return SendIoctl_GetPsStatePacket((PHidContextInternal)context, procId, PsHiddenObject, state, inheritType); + return SendIoctl_GetPsStatePacket((PHidContextInternal)context, procId, PsActiveHiddenObject, state, inheritType); } HidStatus _API Hid_AttachHiddenState(HidContext context, HidProcId procId, HidPsInheritTypes inheritType) { - return SendIoctl_SetPsStatePacket((PHidContextInternal)context, procId, PsHiddenObject, HidActiveState::StateEnabled, inheritType); + return SendIoctl_SetPsStatePacket((PHidContextInternal)context, procId, PsActiveHiddenObject, HidActiveState::StateEnabled, inheritType); } HidStatus _API Hid_RemoveHiddenState(HidContext context, HidProcId procId) { - return SendIoctl_SetPsStatePacket((PHidContextInternal)context, procId, PsHiddenObject, HidActiveState::StateDisabled, HidPsInheritTypes::WithoutInherit); + return SendIoctl_SetPsStatePacket((PHidContextInternal)context, procId, PsActiveHiddenObject, HidActiveState::StateDisabled, HidPsInheritTypes::WithoutInherit); } HidStatus _API Hid_NormalizeFilePath(const wchar_t* filePath, wchar_t* normalized, size_t normalizedLen)