Merge pull request #420 from mwalker33/master

Color on windows 10
This commit is contained in:
Iceman 2019-10-06 20:00:59 +02:00 committed by GitHub
commit 27ae47b38e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 1 deletions

View file

@ -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` <samples to skip> 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)

View file

@ -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__)

View file

@ -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