Skip to content

Commit 44fbe27

Browse files
author
Requiem
committed
Added looking-glass detection
2 parents b1d41ed + 08cf38d commit 44fbe27

2 files changed

Lines changed: 26 additions & 19 deletions

File tree

src/vmaware.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,7 +3078,7 @@ struct VM {
30783078
key(brands::WINE, "HKLM\\SOFTWARE\\Wine");
30793079

30803080
// Xen
3081-
key(brands::KVM, "HKLM\\SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_5853*");
3081+
key(brands::XEN, "HKLM\\SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_5853*");
30823082
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\DSDT\\xen");
30833083
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\FADT\\xen");
30843084
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\RSDT\\xen");
@@ -7533,6 +7533,7 @@ struct VM {
75337533
* @brief Check for specific GPU string signatures related to VMs
75347534
* @category Windows
75357535
* @author Requiem (https://github.com/NotRequiem)
7536+
* @author dmfrpro (https://github.com/dmfrpro) (VDD detection)
75367537
* @note utoshu did this with WMI in a removed technique (VM::GPU_CHIPTYPE)
75377538
* @implements VM::GPU_VM_STRING
75387539
*/
@@ -7546,14 +7547,17 @@ struct VM {
75467547
size_t length;
75477548
};
75487549

7549-
constexpr std::array<VMGpuInfo, 7> vm_gpu_names = { {
7550+
constexpr std::array<VMGpuInfo, 10> vm_gpu_names = { {
75507551
{ L"VMware SVGA 3D", brands::VMWARE, 14 },
75517552
{ L"VirtualBox Graphics Adapter", brands::VBOX, 27 },
75527553
{ L"QXL GPU", brands::KVM, 7 },
75537554
{ L"VirGL 3D", brands::QEMU, 8 },
75547555
{ L"Microsoft Hyper-V Video", brands::HYPERV, 23 },
75557556
{ L"Parallels Display Adapter (WDDM)", brands::PARALLELS, 32 },
7556-
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 }
7557+
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 },
7558+
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 },
7559+
{ L"Virtual Display Driver", brands::NULL_BRAND, 22 },
7560+
{ L"IddSampleDriver Device", brands::NULL_BRAND, 22 }
75577561
} };
75587562

75597563
DISPLAY_DEVICEW dd{};
@@ -7572,8 +7576,11 @@ struct VM {
75727576
const char* brand = entry.brand;
75737577
const size_t len = entry.length;
75747578
#endif
7575-
if (deviceStrLen == len && wcscmp(deviceStr, name) == 0) {
7576-
return core::add(brand);;
7579+
if (deviceStrLen == len && wcscmp(deviceStr, name) == 0) {
7580+
char* castedName = (char*)calloc(len, sizeof(char));
7581+
size_t ret = wcstombs(castedName, name, len);
7582+
castedName[ret] = '\0';
7583+
return core::add(brand);
75777584
}
75787585
}
75797586

src/vmaware_MIT.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,10 @@
384384
#include <psapi.h>
385385
#include <shlwapi.h>
386386
#include <shlobj_core.h>
387-
#include <dshow.h>
388-
#include <io.h>
389387
#include <winspool.h>
390388
#include <powerbase.h>
391389
#include <setupapi.h>
392-
#include <mmdeviceapi.h>
393-
#include <Functiondiscoverykeys_devpkey.h>
394390
#include <mmsystem.h>
395-
#include <queue>
396391
#include <dxgi.h>
397392
#include <d3d9.h>
398393

@@ -3099,7 +3094,7 @@ struct VM {
30993094
key(brands::WINE, "HKLM\\SOFTWARE\\Wine");
31003095

31013096
// Xen
3102-
key(brands::KVM, "HKLM\\SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_5853*");
3097+
key(brands::XEN, "HKLM\\SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_5853*");
31033098
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\DSDT\\xen");
31043099
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\FADT\\xen");
31053100
key(brands::XEN, "HKLM\\HARDWARE\\ACPI\\RSDT\\xen");
@@ -7323,6 +7318,7 @@ struct VM {
73237318
* @brief Check for specific GPU string signatures related to VMs
73247319
* @category Windows
73257320
* @author Requiem (https://github.com/NotRequiem)
7321+
* @author dmfrpro (https://github.com/dmfrpro) (VDD detection)
73267322
* @note utoshu did this with WMI in a removed technique (VM::GPU_CHIPTYPE)
73277323
* @implements VM::GPU_VM_STRING
73287324
*/
@@ -7336,14 +7332,17 @@ struct VM {
73367332
size_t length;
73377333
};
73387334

7339-
constexpr std::array<VMGpuInfo, 7> vm_gpu_names = { {
7335+
constexpr std::array<VMGpuInfo, 10> vm_gpu_names = { {
73407336
{ L"VMware SVGA 3D", brands::VMWARE, 14 },
73417337
{ L"VirtualBox Graphics Adapter", brands::VBOX, 27 },
73427338
{ L"QXL GPU", brands::KVM, 7 },
73437339
{ L"VirGL 3D", brands::QEMU, 8 },
73447340
{ L"Microsoft Hyper-V Video", brands::HYPERV, 23 },
73457341
{ L"Parallels Display Adapter (WDDM)", brands::PARALLELS, 32 },
7346-
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 }
7342+
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 },
7343+
{ L"Bochs Graphics Adapter", brands::BOCHS, 22 },
7344+
{ L"Virtual Display Driver", brands::NULL_BRAND, 22 },
7345+
{ L"IddSampleDriver Device", brands::NULL_BRAND, 22 }
73477346
} };
73487347

73497348
DISPLAY_DEVICEW dd{};
@@ -7362,8 +7361,11 @@ struct VM {
73627361
const char* brand = entry.brand;
73637362
const size_t len = entry.length;
73647363
#endif
7365-
if (deviceStrLen == len && wcscmp(deviceStr, name) == 0) {
7366-
return core::add(brand);;
7364+
if (deviceStrLen == len && wcscmp(deviceStr, name) == 0) {
7365+
char* castedName = (char*)calloc(len, sizeof(char));
7366+
size_t ret = wcstombs(castedName, name, len);
7367+
castedName[ret] = '\0';
7368+
return core::add(brand);
73677369
}
73687370
}
73697371

@@ -7668,7 +7670,7 @@ struct VM {
76687670
newParam.sched_priority = sched_get_priority_max(SCHED_FIFO);
76697671

76707672
if (sched_setscheduler(0, SCHED_FIFO, &newParam) == -1) {
7671-
hasSchedPriority = false;
7673+
hasSchedPriority = false;
76727674
}
76737675
}
76747676
#endif
@@ -7946,7 +7948,7 @@ struct VM {
79467948
? (tscCore2 - tscCore1)
79477949
: (tscCore1 - tscCore2);
79487950

7949-
if (diff < tscSyncDiffThreshold) {
7951+
if (diff < tscSyncDiffThreshold) {
79507952
tscIssueCount++;
79517953
}
79527954
}
@@ -10775,8 +10777,6 @@ struct VM {
1077510777
// brand is "Azure Hyper-V" instead of just "Hyper-V". So what
1077610778
// this section does is "merge" the brands together to form
1077710779
// a more accurate idea of the brand(s) involved.
10778-
10779-
1078010780
merge(TMP_AZURE, TMP_HYPERV, TMP_AZURE);
1078110781
merge(TMP_AZURE, TMP_VPC, TMP_AZURE);
1078210782
merge(TMP_AZURE, TMP_HYPERV_VPC, TMP_AZURE);

0 commit comments

Comments
 (0)