diff --git a/kvc/HelpSystem.cpp b/kvc/HelpSystem.cpp index 1936216..4147a85 100644 --- a/kvc/HelpSystem.cpp +++ b/kvc/HelpSystem.cpp @@ -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); } \ No newline at end of file diff --git a/kvc/HelpSystem.h b/kvc/HelpSystem.h index c184413..e539aff 100644 --- a/kvc/HelpSystem.h +++ b/kvc/HelpSystem.h @@ -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; diff --git a/kvc/Kvc.cpp b/kvc/Kvc.cpp index 1afc8df..aca8b40 100644 --- a/kvc/Kvc.cpp +++ b/kvc/Kvc.cpp @@ -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) { diff --git a/kvc/OffsetFinder.cpp b/kvc/OffsetFinder.cpp index 81fea02..ebdbcae 100644 --- a/kvc/OffsetFinder.cpp +++ b/kvc/OffsetFinder.cpp @@ -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; }