mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Merge pull request #453 from mwalker33/Win10ColorUpdate
Win10 color update
This commit is contained in:
commit
c0a850170b
2 changed files with 36 additions and 3 deletions
|
@ -473,10 +473,15 @@ finish2:
|
||||||
// Check if windows AnsiColor Support is enabled in the registery
|
// Check if windows AnsiColor Support is enabled in the registery
|
||||||
// [HKEY_CURRENT_USER\Console]
|
// [HKEY_CURRENT_USER\Console]
|
||||||
// "VirtualTerminalLevel"=dword:00000001
|
// "VirtualTerminalLevel"=dword:00000001
|
||||||
|
// 2nd Key needs to be enabled... This key takes the console out of legacy mode.
|
||||||
|
// [HKEY_CURRENT_USER\Console]
|
||||||
|
// "ForceV2"=dword:00000001
|
||||||
static bool DetectWindowsAnsiSupport(void) {
|
static bool DetectWindowsAnsiSupport(void) {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
HKEY hKey = NULL;
|
HKEY hKey = NULL;
|
||||||
|
bool virtualTerminalLevelSet = false;
|
||||||
|
bool forceV2Set = false;
|
||||||
|
|
||||||
if (RegOpenKeyA(HKEY_CURRENT_USER, "Console", &hKey) == ERROR_SUCCESS) {
|
if (RegOpenKeyA(HKEY_CURRENT_USER, "Console", &hKey) == ERROR_SUCCESS) {
|
||||||
DWORD dwType = REG_SZ;
|
DWORD dwType = REG_SZ;
|
||||||
|
@ -490,11 +495,31 @@ static bool DetectWindowsAnsiSupport(void) {
|
||||||
Data += KeyValue[i] << (8 * i);
|
Data += KeyValue[i] << (8 * i);
|
||||||
|
|
||||||
if (Data == 1) { // Reg key is set to 1, Ansi Color Enabled
|
if (Data == 1) { // Reg key is set to 1, Ansi Color Enabled
|
||||||
ret = true;
|
virtualTerminalLevelSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RegOpenKeyA(HKEY_CURRENT_USER, "Console", &hKey) == ERROR_SUCCESS) {
|
||||||
|
DWORD dwType = REG_SZ;
|
||||||
|
BYTE KeyValue[sizeof(dwType)];
|
||||||
|
DWORD len = sizeof(KeyValue);
|
||||||
|
|
||||||
|
if (RegQueryValueEx(hKey, "ForceV2", 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, Not using legacy Mode.
|
||||||
|
forceV2Set = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
// If both VirtualTerminalLevel and ForceV2 is set, AnsiColor should work
|
||||||
|
ret = virtualTerminalLevelSet && forceV2Set;
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,4 +135,12 @@ In later versions of windows 10 you may be able to get color to work by setting
|
||||||
[HKEY_CURRENT_USER\Console]
|
[HKEY_CURRENT_USER\Console]
|
||||||
"VirtualTerminalLevel"=dword:00000001
|
"VirtualTerminalLevel"=dword:00000001
|
||||||
```
|
```
|
||||||
If after setting this key (and restarting proxmark3.exe) you get extra characters and no color text, either delete the key or set the value to 0
|
You also need to disable "use legacy console" in the cmd.exe properties, or set the following registry key
|
||||||
|
```
|
||||||
|
[HKEY_CURRENT_USER\Console]
|
||||||
|
"ForceV2"=dword:00000001
|
||||||
|
```
|
||||||
|
After making these changes, you will need to start a new command prompt (cmd.exe) to ensure its using the new settings.
|
||||||
|
|
||||||
|
If after making these changes (and restarting proxmark3.exe) you get extra characters and no color text, set either key to 0 or enable legacy mode again (and restart the command prompt).
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue