Aktualizacja: 2025-10-02 23:11:12

This commit is contained in:
wesmar
2025-10-02 23:11:12 +02:00
parent 5aaff0c4f9
commit 78f8ca5a7b
4 changed files with 30 additions and 9 deletions

View File

@@ -602,4 +602,25 @@ void HelpSystem::PrintWarning(const wchar_t* warning) noexcept
// Restore original color after warning
SetConsoleTextAttribute(hConsole, originalColor);
}
void HelpSystem::PrintUnknownCommandMessage(std::wstring_view command) noexcept
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hConsole, &csbi);
WORD originalColor = csbi.wAttributes;
// Red color for the entire message block
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
std::wcout << L"\nCommand not found: \"" << command << L"\"\n\n";
std::wcout << L"To display help, use one of the following:\n";
std::wcout << L" kvc -h\n";
std::wcout << L" kvc help\n";
std::wcout << L" kvc | more (for paginated output)\n";
std::wcout << L" kvc help >> \"%USERPROFILE%\\Desktop\\help.txt\" (save to file)\n\n";
// Restore original color
SetConsoleTextAttribute(hConsole, originalColor);
}

View File

@@ -27,6 +27,7 @@ public:
static void PrintExclusionTypes() noexcept;
static void PrintPatternMatching() noexcept;
static void PrintTechnicalFeatures() noexcept;
static void PrintUnknownCommandMessage(std::wstring_view command) noexcept;
static void PrintDefenderNotes() noexcept;
static void PrintRegistryCommands() noexcept;
static void PrintSecurityEngineCommands() noexcept;

View File

@@ -1024,12 +1024,11 @@ int wmain(int argc, wchar_t* argv[])
}
}
else
{
ERROR(L"Unknown command: %s", command.data());
HelpSystem::PrintUsage(argv[0]);
return 1;
}
else
{
HelpSystem::PrintUnknownCommandMessage(command);
return 1;
}
}
catch (const std::exception& e)
{

View File

@@ -118,7 +118,7 @@ bool OffsetFinder::FindKernelPsInitialSystemProcessOffset() noexcept
}
m_offsetMap[Offset::KernelPsInitialSystemProcess] = offset;
SUCCESS(L"Found PsInitialSystemProcess offset: 0x%x", offset);
DEBUG(L"Found PsInitialSystemProcess offset: 0x%x", offset);
return true;
}
@@ -174,7 +174,7 @@ bool OffsetFinder::FindProcessUniqueProcessIdOffset() noexcept
}
m_offsetMap[Offset::ProcessUniqueProcessId] = offset.value();
SUCCESS(L"Found UniqueProcessId offset: 0x%x", offset.value());
DEBUG(L"Found UniqueProcessId offset: 0x%x", offset.value());
return true;
}
@@ -211,7 +211,7 @@ bool OffsetFinder::FindProcessProtectionOffset() noexcept
}
m_offsetMap[Offset::ProcessProtection] = offsetA.value();
SUCCESS(L"Found ProcessProtection offset: 0x%x", offsetA.value());
DEBUG(L"Found ProcessProtection offset: 0x%x", offsetA.value());
return true;
}