mirror-ac/user/report.cpp

26 lines
652 B
C++
Raw Normal View History

2023-08-18 07:33:13 +02:00
#include "report.h"
2023-08-18 09:18:00 +02:00
#include "common.h"
2023-08-18 07:33:13 +02:00
global::Report::Report( std::shared_ptr<global::ThreadPool> ThreadPool, LPTSTR PipeName )
{
this->thread_pool = ThreadPool;
2023-08-18 09:18:00 +02:00
this->client = std::make_shared<global::Client>( PipeName );
//test report
TestReport report;
report.value1 = 10;
report.value2 = 1337;
this->ReportViolation( &report );
2023-08-18 07:33:13 +02:00
}
void global::Report::ReportViolation( TestReport* Report )
{
2023-08-18 09:18:00 +02:00
byte buffer[ 1024 ];
int size = sizeof( TestReport );
memcpy( buffer, Report, size );
LOG_INFO( "sending report over pipe" );
this->thread_pool->QueueJob( [ this, buffer, size ]() {this->client->WriteToPipe( (PVOID)buffer, size ); } );
2023-08-18 07:33:13 +02:00
}