added hdid function(for win32)
This commit is contained in:
		
							parent
							
								
									623d67999a
								
							
						
					
					
						commit
						7b73150053
					
				@ -29,7 +29,8 @@ SOURCES += main.cpp\
 | 
			
		||||
    hex_functions.cpp \
 | 
			
		||||
    encryption_functions.cpp \
 | 
			
		||||
    courtroom.cpp \
 | 
			
		||||
    aocharbutton.cpp
 | 
			
		||||
    aocharbutton.cpp \
 | 
			
		||||
    win32_functions.cpp
 | 
			
		||||
 | 
			
		||||
HEADERS  += lobby.h \
 | 
			
		||||
    text_file_functions.h \
 | 
			
		||||
@ -46,4 +47,5 @@ HEADERS  += lobby.h \
 | 
			
		||||
    hex_functions.h \
 | 
			
		||||
    encryption_functions.h \
 | 
			
		||||
    courtroom.h \
 | 
			
		||||
    aocharbutton.h
 | 
			
		||||
    aocharbutton.h \
 | 
			
		||||
    win32_functions.h
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include "encryption_functions.h"
 | 
			
		||||
#include "win32_functions.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
@ -85,9 +86,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
			
		||||
    //you may ask where 322 comes from. that would be a good question.
 | 
			
		||||
    s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
 | 
			
		||||
 | 
			
		||||
    //T0D0 add an actual HDID here
 | 
			
		||||
    AOPacket *hi_packet = new AOPacket("HI#ao2testinginprogressdontmindme#%");
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
    delete hi_packet;
 | 
			
		||||
@ -97,6 +103,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
			
		||||
    if (f_contents.size() < 1)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
    //T0D0: save server version here, somehow
 | 
			
		||||
  }
 | 
			
		||||
  else if (header == "CT")
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								win32_functions.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								win32_functions.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
#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
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								win32_functions.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								win32_functions.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
#ifndef WIN32_FUNCTIONS_H
 | 
			
		||||
#define WIN32_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
QString get_hdid();
 | 
			
		||||
 | 
			
		||||
#endif // WIN32_FUNCTIONS_H
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user