more bugfixing

This commit is contained in:
Akash Mozumdar 2018-07-19 02:02:42 -04:00
parent 097e274347
commit 55764bf8e2
5 changed files with 7 additions and 33 deletions

View File

@ -18,7 +18,6 @@
#define HM_LOCK CriticalSectionLocker hmLocker(hmCs) // Synchronized scope for accessing private data
HookManager::HookManager() :
current(nullptr),
create(nullptr),
remove(nullptr),
reset(nullptr),
@ -30,9 +29,9 @@ HookManager::HookManager() :
{
InitializeCriticalSection(&hmCs);
TextThread* consoleTextThread = textThreadsByParams[{ 0, -1UL, -1UL, -1UL }] = new TextThread({ 0, -1UL, -1UL, -1UL }, nextThreadNumber++, splitDelay);
consoleTextThread->Status() |= USING_UNICODE;
SetCurrent(consoleTextThread);
// Console text thread
current = textThreadsByParams[{ 0, -1UL, -1UL, -1UL }] = new TextThread({ 0, -1UL, -1UL, -1UL }, nextThreadNumber++, splitDelay);
current->Status() |= USING_UNICODE | CURRENT_SELECT;
}
HookManager::~HookManager()

View File

@ -879,10 +879,13 @@ DWORD InsertDynamicHook(LPVOID addr, DWORD frame, DWORD stack)
void Hijack()
{
static bool hijacked = false;
if (hijacked) return;
GetModuleFileNameW(nullptr, processPath, MAX_PATH);
processName = wcsrchr(processPath, L'\\') + 1;
DetermineEngineType();
hijacked = true;
}
} // namespace Engine

View File

@ -728,17 +728,6 @@ int TextHook::ClearHook()
return err;
}
int TextHook::RecoverHook()
{
if (hp.address) {
// jichi 9/28/2013: Only enable TextOutA to debug Cross Channel
//if (hp.address == (DWORD)TextOutA)
InsertHook();
return 1;
}
return 0;
}
int TextHook::SetHookName(LPCSTR name)
{
name_length = strlen(name) + 1;

View File

@ -37,7 +37,6 @@ public:
int InitHook(LPVOID addr, DWORD data, DWORD data_ind,
DWORD split_off, DWORD split_ind, WORD type, DWORD len_off = 0);
DWORD Send(DWORD dwDataBase, DWORD dwRetn);
int RecoverHook();
int RemoveHook();
int ClearHook();
int SetHookName(LPCSTR name);

View File

@ -45,19 +45,11 @@ DWORD WINAPI PipeManager(LPVOID unused)
*(DWORD*)buffer = GetCurrentProcessId();
WriteFile(::hookPipe, buffer, sizeof(DWORD), &count, nullptr);
for (int i = 0, count = 0; count < ::currentHook; i++)
{
if (hookman[i].RecoverHook()) // jichi 9/27/2013: This is the place where built-in hooks like TextOutA are inserted
{
count++;
}
}
ReleaseMutex(pipeAcquisitionMutex);
CloseHandle(pipeAcquisitionMutex);
Engine::Hijack();
ConsoleOutput("vnrcli:WaitForPipe: pipe connected");
Engine::Hijack();
while (::running)
{
@ -104,14 +96,6 @@ DWORD WINAPI PipeManager(LPVOID unused)
}
CloseHandle(::hookPipe);
CloseHandle(hostPipe);
for (int i = 0, count = 0; count < ::currentHook; i++)
{
if (hookman[i].RemoveHook())
{
count++;
}
}
}
FreeLibraryAndExitThread(::currentModule, 0);
return 0;