This commit is contained in:
lhodges1 2023-09-08 04:47:48 +10:00
parent ea36f16703
commit 87d1b66fd9
6 changed files with 45 additions and 19 deletions

View file

@ -7,8 +7,8 @@
#include "common.h"
#define DRIVER_PATH_MAX_LENGTH 512
#define MOTHERBOARD_SERIAL_CODE_LENGTH 128
#define DEVICE_DRIVE_0_SERIAL_CODE_LENGTH 256
#define MOTHERBOARD_SERIAL_CODE_LENGTH 32
#define DEVICE_DRIVE_0_SERIAL_CODE_LENGTH 32
#define POOL_TAG_STRINGS 'strs'

View file

@ -875,12 +875,12 @@ NTSTATUS ParseSMBIOSTable(
*
* source: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf line 823
*/
while ( smbios_table_header->Type != VMWARE_SMBIOS_TABLE )
while ( smbios_table_header->Type != SMBIOS_SYSTEM_INFORMATION_TYPE_2_TABLE )
GetNextSMBIOSStructureInTable( &smbios_table_header );
status = GetStringAtIndexFromSMBIOSTable(
smbios_table_header,
VMWARE_SMBIOS_TABLE_INDEX,
MOTHERBOARD_SERIAL_CODE_TABLE_INDEX,
ConfigMotherboardSerialNumber,
ConfigMotherboardSerialNumberMaxSize
);

View file

@ -35,8 +35,8 @@ namespace server
{
public int message_type;
public Int64 steam64_id;
public fixed char motherboard_serial_number[128];
public fixed char device_drive_0_serial[256];
public fixed char motherboard_serial_number[32];
public fixed char device_drive_0_serial[32];
};
struct REPORT_PACKET_HEADER
@ -52,27 +52,30 @@ namespace server
_logger = logger;
_header = this.GetMessageHeader();
char[] string_1 = new char[128];
char[] string_2 = new char[256];
char[] string_1 = new char[32];
char[] string_2 = new char[32];
unsafe
{
for (int i = 0; i < 128; i++)
for (int i = 0; i < 32; i++)
{
string_1[i] = _header.motherboard_serial_number[i];
}
for (int i=0;i<256;i++)
for (int i=0;i<32;i++)
{
string_2[i] = _header.device_drive_0_serial[i];
}
}
_logger.Information("SteamID: {0}, MoboSerial: {3}, DriveSerial: {4}, Message type: {1}",
string test1 = new string(string_1);
string test2 = new string(string_2);
_logger.Information("SteamID: {0}, MoboSerial: {2}, DriveSerial: {3}, Message type: {1}",
_header.steam64_id,
_header.message_type,
string_1,
string_2
test1,
test2
);
@ -95,7 +98,7 @@ namespace server
unsafe private REPORT_PACKET_HEADER GetReportType()
{
return Helper.BytesToStructure<REPORT_PACKET_HEADER>(ref _buffer, sizeof(REPORT_PACKET_HEADER));
return Helper.BytesToStructure<REPORT_PACKET_HEADER>(ref _buffer, sizeof(PACKET_HEADER));
}
unsafe private void HandleReportMessage(int reportId)

View file

@ -12,9 +12,15 @@ global::Client::Client( std::shared_ptr<global::ThreadPool> ThreadPool, LPTSTR P
this->pipe = std::make_shared<global::Pipe>( PipeName );
}
global::Client::~Client()
{
delete system_information;
}
void global::Client::UpdateSystemInformation(global::headers::SYSTEM_INFORMATION* SystemInformation)
{
memcpy( &this->system_information, SystemInformation, sizeof( global::headers::SYSTEM_INFORMATION ) );
this->system_information = new global::headers::SYSTEM_INFORMATION;
memcpy( this->system_information, SystemInformation, sizeof( global::headers::SYSTEM_INFORMATION ) );
}
/*

View file

@ -6,6 +6,7 @@
#include "threadpool.h"
#include "pipe.h"
#include <TlHelp32.h>
#include "common.h"
#define REPORT_BUFFER_SIZE 8192
#define SEND_BUFFER_SIZE 8192
@ -52,7 +53,7 @@ namespace global
std::shared_ptr<global::ThreadPool> thread_pool;
std::shared_ptr<global::Pipe> pipe;
std::mutex mutex;
global::headers::SYSTEM_INFORMATION system_information;
global::headers::SYSTEM_INFORMATION* system_information;
byte report_buffer[ REPORT_BUFFER_SIZE ];
byte send_buffer[ SEND_BUFFER_SIZE ];
@ -60,6 +61,7 @@ namespace global
public:
Client( std::shared_ptr<global::ThreadPool> ThreadPool, LPTSTR PipeName );
~Client();
void UpdateSystemInformation( global::headers::SYSTEM_INFORMATION* SystemInformation );
@ -72,8 +74,23 @@ namespace global
global::headers::PIPE_PACKET_HEADER header;
header.message_type = REPORT_PACKET_ID;
header.steam64_id = TEST_STEAM_64_ID;
memcpy( this->report_buffer, &header, sizeof( global::headers::PIPE_PACKET_HEADER ) );
memcpy(
header.system_information.drive_0_serial,
this->system_information->drive_0_serial,
sizeof(this->system_information->drive_0_serial) );
memcpy(
header.system_information.motherboard_serial,
this->system_information->motherboard_serial,
sizeof( this->system_information->motherboard_serial ) );
memcpy(
this->report_buffer,
&header,
sizeof( global::headers::PIPE_PACKET_HEADER ) );
global::headers::PIPE_PACKET_HEADER* test = ( global::headers::PIPE_PACKET_HEADER* )this->report_buffer;
memcpy( PVOID( ( UINT64 )this->report_buffer + sizeof( global::headers::PIPE_PACKET_HEADER ) ), Report, sizeof( T ) );
this->pipe->WriteToPipe( this->report_buffer, sizeof(T) + sizeof( global::headers::PIPE_PACKET_HEADER ) );
RtlZeroMemory( this->report_buffer, REPORT_BUFFER_SIZE );

View file

@ -7,8 +7,8 @@
#define SERVER_REQUEST_PACKET_ID 2
#define SERVER_SEND_PACKET_ID 3
#define MOTHERBOARD_SERIAL_CODE_LENGTH 128
#define DEVICE_DRIVE_0_SERIAL_CODE_LENGTH 256
#define MOTHERBOARD_SERIAL_CODE_LENGTH 32
#define DEVICE_DRIVE_0_SERIAL_CODE_LENGTH 32
namespace global
{