aboutsummaryrefslogtreecommitdiff
path: root/client/src/hwid
diff options
context:
space:
mode:
authorauth12 <[email protected]>2020-08-05 03:17:00 +0100
committerauth12 <[email protected]>2020-08-05 03:17:00 +0100
commit6b11856dbd89628ab198820c7dd1f117077a5420 (patch)
treed34ddff8f3658956b5c435a33c2829208ab2fc4f /client/src/hwid
parentAdded ui. (diff)
downloadloader-6b11856dbd89628ab198820c7dd1f117077a5420.tar.xz
loader-6b11856dbd89628ab198820c7dd1f117077a5420.zip
More ui improvements.
Under the hood improvements.
Diffstat (limited to 'client/src/hwid')
-rw-r--r--client/src/hwid/hwid.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/client/src/hwid/hwid.h b/client/src/hwid/hwid.h
index 8fae489..445635d 100644
--- a/client/src/hwid/hwid.h
+++ b/client/src/hwid/hwid.h
@@ -1,10 +1,38 @@
#pragma once
-
+#include "../ui/ui.h"
namespace hwid {
- __forceinline std::string fetch() {
- nlohmann::json j;
- j["uid"] = 0;
- return j.dump();
+ struct hwid_data_t {
+ std::string gpu;
+
+ uint64_t uid;
+ };
+
+ __forceinline bool fetch(hwid_data_t& out) {
+ IDXGIDevice* dxgi_device;
+ if (ui::device->QueryInterface(&dxgi_device) != S_OK) {
+ return false;
+ }
+
+ IDXGIAdapter* adapter;
+ if (dxgi_device->GetParent(__uuidof(IDXGIAdapter), reinterpret_cast<void**>(&adapter)) != S_OK) {
+ return false;
+ }
+
+ DXGI_ADAPTER_DESC desc;
+ if (adapter->GetDesc(&desc) != S_OK) {
+ return false;
+ }
+
+ out.uid += desc.VendorId >> 1;
+ out.uid += desc.DeviceId >> 1;
+ out.uid += desc.DedicatedVideoMemory << 5;
+
+ out.gpu = util::wide_to_multibyte(desc.Description);
+
+ adapter->Release();
+ dxgi_device->Release();
+
+ return true;
}
}; \ No newline at end of file