diff --git a/CHANGELOG.md b/CHANGELOG.md index a01ccab19..e566eec9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -359,7 +359,8 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac - Fix `em 4x05_dump` to print all blocks read (@mwalker33) - Added save to .eml and .bin for `em 4x05_dump` (@mwalker33) - Added `s` to `lf config` / `lf sniff` to skip samples when sniffing based on same option in Proxmark/proxmark3 by @marshmellow42. (@mwalker33) - + - Added support for color text on windows 10 (@mwalker33) + ### Fixed - Changed driver file proxmark3.inf to support both old and new Product/Vendor IDs (@pwpiwi) - Changed start sequence in Qt mode (fix: short commands hangs main Qt thread) (@merlokk) diff --git a/client/proxmark3.c b/client/proxmark3.c index a6eadb15b..ced6ed5c5 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -684,6 +684,34 @@ int main(int argc, char *argv[]) { } session.supports_colors = false; + +#if defined(_WIN32) + // Check if windows AnsiColor Support is enabled in the registery + // [HKEY_CURRENT_USER\Console] + // "VirtualTerminalLevel"=dword:00000001 + + HKEY hKey = NULL; + + if(RegOpenKeyA (HKEY_CURRENT_USER,"Console",&hKey) == ERROR_SUCCESS) { + DWORD dwType = REG_SZ; + BYTE KeyValue[sizeof(dwType)]; + DWORD len = sizeof(KeyValue); + + if (RegQueryValueEx(hKey,"VirtualTerminalLevel", NULL, &dwType,KeyValue, &len) != ERROR_FILE_NOT_FOUND) { + uint8_t i; + uint32_t Data = 0; + for (i = 0; i < 4; i++) + Data += KeyValue[i] << (8 * i); + + if (Data == 1) { // Reg key is set to 1, Ansi Color Enabled + session.supports_colors = true; + } + } + RegCloseKey(hKey); + } + +#endif + session.stdinOnTTY = isatty(STDIN_FILENO); session.stdoutOnTTY = isatty(STDOUT_FILENO); #if defined(__linux__) || (__APPLE__) diff --git a/doc/md/Installation_Instructions/Windows-Installation-Instructions.md b/doc/md/Installation_Instructions/Windows-Installation-Instructions.md index 2f5618c40..32cc42b2a 100644 --- a/doc/md/Installation_Instructions/Windows-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/Windows-Installation-Instructions.md @@ -128,3 +128,11 @@ echo "export DISPLAY=:0" >> ~/.bashrc Note that it may take a quite long time for a freshly plugged Proxmark3 to be visible on a WSL /dev/ttySX port. Now you're ready to follow the [compilation instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md). + +## Color text on windows 10 +In later versions of windows 10 you may be able to get color to work by setting this registery key +``` +[HKEY_CURRENT_USER\Console] + "VirtualTerminalLevel"=dword:00000001 +``` +If after setting this key (and restarting proxmark.exe) you get extra characters and no color text, either delete the key or set the value to 0