Skip to content

Commit d187923

Browse files
committed
fixed gcc/clang errors
1 parent 2f9cb52 commit d187923

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

TODO.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,20 @@
44
- [ ] upload the lib to apt
55
- [ ] make a man file in markdown for the cli tool
66
- [ ] implement techniques from here https://stackoverflow.com/questions/43026032/detect-running-on-virtual-machine
7-
- [ ] add a .clang_format thingy
87
- [ ] make a medium post about it
98
- [ ] check if bios date in /sys/class/dmi/id/ could be useful under QEMU
109
- [ ] add a .so, .dll, and .dylib shared object files in the release
11-
- [ ] fix the issue of VM::QEMU_USB being ultra slow in some edge-cases
1210
- [ ] /sys/class/dmi/id/product_name check this in qemu
13-
- [ ] add linux support for the hdd_serial_number technique
1411
- [ ] fix "dmidecode not found" error
1512
- [ ] fix /dev/mem not found in vbox default
1613
- [ ] update sourceforge
1714
- [ ] rearrange the techniques so that the more likely ones will be executed first
1815
- [ ] make a hardware scanner module where it'll find for VM strings in all sorts of devices
19-
- [ ] add more QEMU techniques
2016
- [ ] implement techniques from here https://www.cyberciti.biz/faq/linux-determine-virtualization-technology-command/
2117
- [ ] implement techniques from virt-what
2218
- [ ] https://cloud.google.com/compute/docs/instances/detect-compute-engine
23-
- [ ] update the updater.py script and fix it
2419
- [ ] @thereisnospoon this is where we need to start modifing the qemu source further by replacing vendor/device ids.
2520
https://www.pcilookup.com/
26-
- [ ] https://wasm.in/threads/testy-v-vmware.35315/#post-444576
2721

2822
QEMU default: 0x1234
2923
Intel: 0x8086

src/vmaware.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
* - struct for internal cpu operations => line 743
3232
* - struct for internal memoization => line 1214
3333
* - struct for internal utility functions => line 1342
34-
* - struct for internal core components => line 10173
34+
* - struct for internal core components => line 10175
3535
* - start of VM detection technique list => line 2429
36-
* - start of public VM detection functions => line 10841
37-
* - start of externally defined variables => line 11784
36+
* - start of public VM detection functions => line 10843
37+
* - start of externally defined variables => line 11786
3838
*
3939
*
4040
* ============================== EXAMPLE ===================================
@@ -7955,7 +7955,7 @@ struct VM {
79557955
}
79567956
}
79577957
return (tscIssueCount >= tscIterations / 2);
7958-
}();
7958+
}();
79597959

79607960
#if (WINDOWS)
79617961
SetThreadAffinityMask(GetCurrentThread(), procMask);
@@ -8173,7 +8173,9 @@ struct VM {
81738173
overlap = chunk;
81748174
}
81758175

8176-
for (size_t i = 0; i < patterns.size(); ++i) {
8176+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
8177+
8178+
for (size_t i = 0; i < ARRAY_SIZE(patterns); ++i) {
81778179
if (!seen[i] && chunk.find(patterns[i]) != std::string::npos) {
81788180
debug("LSHW_QEMU: found ", patterns[i]);
81798181
seen[i] = true;

src/vmaware_MIT.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
* - struct for internal cpu operations => line 758
5454
* - struct for internal memoization => line 1229
5555
* - struct for internal utility functions => line 1357
56-
* - struct for internal core components => line 9961
56+
* - struct for internal core components => line 9963
5757
* - start of VM detection technique list => line 2444
58-
* - start of public VM detection functions => line 10629
59-
* - start of externally defined variables => line 11565
58+
* - start of public VM detection functions => line 10631
59+
* - start of externally defined variables => line 11567
6060
*
6161
*
6262
* ============================== EXAMPLE ===================================
@@ -7743,7 +7743,7 @@ struct VM {
77437743
}
77447744
}
77457745
return (tscIssueCount >= tscIterations / 2);
7746-
}();
7746+
}();
77477747

77487748
#if (WINDOWS)
77497749
SetThreadAffinityMask(GetCurrentThread(), procMask);
@@ -7961,7 +7961,9 @@ struct VM {
79617961
overlap = chunk;
79627962
}
79637963

7964-
for (size_t i = 0; i < patterns.size(); ++i) {
7964+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
7965+
7966+
for (size_t i = 0; i < ARRAY_SIZE(patterns); ++i) {
79657967
if (!seen[i] && chunk.find(patterns[i]) != std::string::npos) {
79667968
debug("LSHW_QEMU: found ", patterns[i]);
79677969
seen[i] = true;

0 commit comments

Comments
 (0)