added cleaner frame for cross-platform hdid implementation
This commit is contained in:
parent
7b73150053
commit
9ba9987d1f
@ -30,7 +30,7 @@ SOURCES += main.cpp\
|
||||
encryption_functions.cpp \
|
||||
courtroom.cpp \
|
||||
aocharbutton.cpp \
|
||||
win32_functions.cpp
|
||||
hardware_functions.cpp
|
||||
|
||||
HEADERS += lobby.h \
|
||||
text_file_functions.h \
|
||||
@ -48,4 +48,4 @@ HEADERS += lobby.h \
|
||||
encryption_functions.h \
|
||||
courtroom.h \
|
||||
aocharbutton.h \
|
||||
win32_functions.h
|
||||
hardware_functions.h
|
||||
|
34
hardware_functions.cpp
Normal file
34
hardware_functions.cpp
Normal file
@ -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
|
@ -3,7 +3,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <windows.h>
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
QString get_hdid();
|
@ -3,7 +3,7 @@
|
||||
#include "lobby.h"
|
||||
#include "networkmanager.h"
|
||||
#include "encryption_functions.h"
|
||||
#include "win32_functions.h"
|
||||
#include "hardware_functions.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -87,11 +87,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
|
||||
|
||||
QString f_hdid;
|
||||
#ifdef Q_OS_WIN32
|
||||
f_hdid = get_hdid();
|
||||
#else
|
||||
f_hdid = "ao2testinginprogress";
|
||||
#endif
|
||||
|
||||
AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
|
||||
send_server_packet(hi_packet);
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include "win32_functions.h"
|
||||
|
||||
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 "invalidhd"; //what could possibly go wrong
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user