bugfix/clean up engine
This commit is contained in:
parent
5edfb4de0d
commit
1b9febb4a5
@ -640,26 +640,6 @@ int TextHook::UnsafeInsertHookCode()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TextHook::InitHook(LPVOID addr, DWORD data, DWORD data_ind,
|
||||
DWORD split_off, DWORD split_ind, WORD type, DWORD len_off)
|
||||
{
|
||||
WaitForSingleObject(hmMutex, 0);
|
||||
hp.address = (DWORD)addr;
|
||||
hp.offset = data;
|
||||
hp.index = data_ind;
|
||||
hp.split = split_off;
|
||||
hp.split_index = split_ind;
|
||||
hp.type = type;
|
||||
hp.hook_len = 0;
|
||||
hp.module = 0;
|
||||
hp.length_offset = len_off & 0xffff;
|
||||
currentHook++;
|
||||
if (current_available >= this)
|
||||
for (current_available = this + 1; current_available->Address(); current_available++);
|
||||
ReleaseMutex(hmMutex);
|
||||
return this - hookman;
|
||||
}
|
||||
|
||||
int TextHook::InitHook(const HookParam &h, LPCSTR name, WORD set_flag)
|
||||
{
|
||||
WaitForSingleObject(hmMutex, 0);
|
||||
|
@ -30,18 +30,15 @@ class TextHook : public Hook
|
||||
{
|
||||
int UnsafeInsertHookCode();
|
||||
DWORD UnsafeSend(DWORD dwDataBase, DWORD dwRetn);
|
||||
int RemoveHook();
|
||||
public:
|
||||
int InsertHook();
|
||||
int InsertHookCode();
|
||||
int InitHook(const HookParam &hp, LPCSTR name = 0, WORD set_flag = 0);
|
||||
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 RemoveHook();
|
||||
int ClearHook();
|
||||
int SetHookName(LPCSTR name);
|
||||
int GetLength(DWORD base, DWORD in); // jichi 12/25/2013: Return 0 if failed
|
||||
void CoolDown(); // jichi 9/28/2013: flush instruction cache on wine
|
||||
};
|
||||
|
||||
extern TextHook *hookman,
|
||||
|
@ -126,7 +126,6 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID unused)
|
||||
CloseHandle(pipeThread);
|
||||
}
|
||||
|
||||
for (TextHook *man = ::hookman; man->RemoveHook(); man++);
|
||||
for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++)
|
||||
man->ClearHook();
|
||||
//if (ith_has_section)
|
||||
|
@ -196,6 +196,16 @@ bool Util::CheckFile(LPCWSTR name)
|
||||
FindClose(file);
|
||||
return true;
|
||||
}
|
||||
wchar_t path[MAX_PATH * 2];
|
||||
wchar_t* end = path + GetModuleFileNameW(nullptr, path, MAX_PATH);
|
||||
while (*(--end) != L'\\');
|
||||
wcscpy(end + 1, name);
|
||||
file = FindFirstFileW(path, &unused);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(file);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user