aboutsummaryrefslogtreecommitdiff
path: root/hardware_functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hardware_functions.cpp')
-rw-r--r--hardware_functions.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/hardware_functions.cpp b/hardware_functions.cpp
new file mode 100644
index 0000000..ce6e35a
--- /dev/null
+++ b/hardware_functions.cpp
@@ -0,0 +1,34 @@
+#include "hardware_functions.h"
+
+#if (defined (_WIN32) || defined (_WIN64))
+DWORD dwVolSerial;
+BOOL bIsRetrieved;
+
+QString get_hdid()
+{
+ bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), NULL, NULL, &dwVolSerial, NULL, NULL, NULL, NULL);
+
+ if (bIsRetrieved)
+ return QString::number(dwVolSerial, 16);
+ else
+ return "invalid_windows_hd"; //what could possibly go wrong
+
+}
+
+#elif (defined (LINUX) || defined (__linux__))
+
+QString get_hdid()
+{
+ //T0D0: add linux implementation
+ return "linux_os_hdid";
+}
+
+#else
+
+QString get_hdid()
+{
+ //T0D0: find a sane way to handle this
+ return "unknown_os_hdid";
+}
+
+#endif