more bugfixing
This commit is contained in:
parent
097e274347
commit
55764bf8e2
@ -18,7 +18,6 @@
|
|||||||
#define HM_LOCK CriticalSectionLocker hmLocker(hmCs) // Synchronized scope for accessing private data
|
#define HM_LOCK CriticalSectionLocker hmLocker(hmCs) // Synchronized scope for accessing private data
|
||||||
|
|
||||||
HookManager::HookManager() :
|
HookManager::HookManager() :
|
||||||
current(nullptr),
|
|
||||||
create(nullptr),
|
create(nullptr),
|
||||||
remove(nullptr),
|
remove(nullptr),
|
||||||
reset(nullptr),
|
reset(nullptr),
|
||||||
@ -30,9 +29,9 @@ HookManager::HookManager() :
|
|||||||
{
|
{
|
||||||
InitializeCriticalSection(&hmCs);
|
InitializeCriticalSection(&hmCs);
|
||||||
|
|
||||||
TextThread* consoleTextThread = textThreadsByParams[{ 0, -1UL, -1UL, -1UL }] = new TextThread({ 0, -1UL, -1UL, -1UL }, nextThreadNumber++, splitDelay);
|
// Console text thread
|
||||||
consoleTextThread->Status() |= USING_UNICODE;
|
current = textThreadsByParams[{ 0, -1UL, -1UL, -1UL }] = new TextThread({ 0, -1UL, -1UL, -1UL }, nextThreadNumber++, splitDelay);
|
||||||
SetCurrent(consoleTextThread);
|
current->Status() |= USING_UNICODE | CURRENT_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
HookManager::~HookManager()
|
HookManager::~HookManager()
|
||||||
|
@ -879,10 +879,13 @@ DWORD InsertDynamicHook(LPVOID addr, DWORD frame, DWORD stack)
|
|||||||
|
|
||||||
void Hijack()
|
void Hijack()
|
||||||
{
|
{
|
||||||
|
static bool hijacked = false;
|
||||||
|
if (hijacked) return;
|
||||||
GetModuleFileNameW(nullptr, processPath, MAX_PATH);
|
GetModuleFileNameW(nullptr, processPath, MAX_PATH);
|
||||||
processName = wcsrchr(processPath, L'\\') + 1;
|
processName = wcsrchr(processPath, L'\\') + 1;
|
||||||
|
|
||||||
DetermineEngineType();
|
DetermineEngineType();
|
||||||
|
hijacked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Engine
|
} // namespace Engine
|
||||||
|
@ -728,17 +728,6 @@ int TextHook::ClearHook()
|
|||||||
return err;
|
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)
|
int TextHook::SetHookName(LPCSTR name)
|
||||||
{
|
{
|
||||||
name_length = strlen(name) + 1;
|
name_length = strlen(name) + 1;
|
||||||
|
@ -37,7 +37,6 @@ public:
|
|||||||
int InitHook(LPVOID addr, DWORD data, DWORD data_ind,
|
int InitHook(LPVOID addr, DWORD data, DWORD data_ind,
|
||||||
DWORD split_off, DWORD split_ind, WORD type, DWORD len_off = 0);
|
DWORD split_off, DWORD split_ind, WORD type, DWORD len_off = 0);
|
||||||
DWORD Send(DWORD dwDataBase, DWORD dwRetn);
|
DWORD Send(DWORD dwDataBase, DWORD dwRetn);
|
||||||
int RecoverHook();
|
|
||||||
int RemoveHook();
|
int RemoveHook();
|
||||||
int ClearHook();
|
int ClearHook();
|
||||||
int SetHookName(LPCSTR name);
|
int SetHookName(LPCSTR name);
|
||||||
|
@ -45,19 +45,11 @@ DWORD WINAPI PipeManager(LPVOID unused)
|
|||||||
*(DWORD*)buffer = GetCurrentProcessId();
|
*(DWORD*)buffer = GetCurrentProcessId();
|
||||||
WriteFile(::hookPipe, buffer, sizeof(DWORD), &count, nullptr);
|
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);
|
ReleaseMutex(pipeAcquisitionMutex);
|
||||||
CloseHandle(pipeAcquisitionMutex);
|
CloseHandle(pipeAcquisitionMutex);
|
||||||
|
|
||||||
Engine::Hijack();
|
|
||||||
ConsoleOutput("vnrcli:WaitForPipe: pipe connected");
|
ConsoleOutput("vnrcli:WaitForPipe: pipe connected");
|
||||||
|
Engine::Hijack();
|
||||||
|
|
||||||
while (::running)
|
while (::running)
|
||||||
{
|
{
|
||||||
@ -104,14 +96,6 @@ DWORD WINAPI PipeManager(LPVOID unused)
|
|||||||
}
|
}
|
||||||
CloseHandle(::hookPipe);
|
CloseHandle(::hookPipe);
|
||||||
CloseHandle(hostPipe);
|
CloseHandle(hostPipe);
|
||||||
|
|
||||||
for (int i = 0, count = 0; count < ::currentHook; i++)
|
|
||||||
{
|
|
||||||
if (hookman[i].RemoveHook())
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FreeLibraryAndExitThread(::currentModule, 0);
|
FreeLibraryAndExitThread(::currentModule, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user