Skip to content

Commit

Permalink
dirty pipe hack
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi committed Nov 16, 2023
1 parent 12e047a commit 406ba61
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,33 @@ void TestProgramComputer::program(ProgramEnvironment& env, CancellableScope& sco
// using namespace NintendoSwitch::PokemonSwSh::MaxLairInternal;


ImageRGB32 image("screenshot-20231016-130205783594.png");
PokemonSummaryDetector detector;
cout << detector.detect(image) << endl;
const LPCTSTR pipeName = TEXT("\\\\.\\pipe\\TestPipe");
HANDLE hPipe = CreateFile(
pipeName, // pipe name
GENERIC_READ | GENERIC_WRITE, // read and write access
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
0, // default attributes
NULL); // no template file
while (true)
{
const char* messageToSend = "Hello from the client!";
DWORD bytesWritten;
WriteFile(hPipe, messageToSend, static_cast<DWORD>(strlen(messageToSend)), &bytesWritten, NULL);

char buffer[100];
DWORD bytesRead;
ReadFile(hPipe, buffer, sizeof(buffer), &bytesRead, NULL);
buffer[bytesRead] = '\0';

std::stringstream ss;
ss << "Received : " << buffer;
env.logger().log(ss.str());

std::this_thread::sleep_for(std::chrono::seconds(10));
}
CloseHandle(hPipe);



Expand Down

0 comments on commit 406ba61

Please sign in to comment.