[Friends] Add friend handler

This commit is contained in:
momo5502 2017-01-28 14:20:39 +01:00
parent 0221d24f07
commit 4cf2ca270c
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,65 @@
#include "STDInclude.hpp"
namespace Worker
{
int ProcessId;
int __stdcall EntryPoint(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, char* /*lpCmdLine*/, int /*nCmdShow*/)
{
Runner runner(Worker::ProcessId);
runner.run();
return 0;
}
void Initialize()
{
if(!Steam::Proxy::Inititalize())
{
printf("Failed to initialize worker!\n");
ExitProcess(1);
}
else
{
#ifdef DEBUG
SetConsoleTitleA("IW4x: Worker");
#else
FreeConsole();
#endif
Utils::Hook(0x6BABA1, Worker::EntryPoint, HOOK_CALL).install()->quick();
}
}
void Uninitialize()
{
Steam::Proxy::Uninititalize();
}
bool ParseWorkerFlag()
{
char* command = "-parent ";
char* parentProc = strstr(GetCommandLineA(), command);
if (parentProc)
{
parentProc += strlen(command);
Worker::ProcessId = atoi(parentProc);
return true;
}
return false;
}
bool IsWorker()
{
static Utils::Value<bool> flag;
if (!flag.isValid())
{
flag.set(Worker::ParseWorkerFlag());
}
return flag.get();
}
}

View File

@ -0,0 +1,11 @@
#pragma once
namespace Worker
{
void Initialize();
void Uninitialize();
bool IsWorker();
}
#include "Runner.hpp"