diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2010-02-08 21:37:20 +0300 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2010-02-08 21:37:35 +0300 |
commit | de21a2231c7d515a69dba7af7df969a80dc9bca9 (patch) | |
tree | 9a0298b4c5dff999886d58c936e04422c8254829 /plugins/sto | |
parent | effc993f56b434ec986f609a90250e30e254b80b (diff) |
Update STO plugin and add common initialize() function
Diffstat (limited to 'plugins/sto')
-rw-r--r-- | plugins/sto/sto.cpp | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/plugins/sto/sto.cpp b/plugins/sto/sto.cpp index 88630b81f..56ca41993 100644 --- a/plugins/sto/sto.cpp +++ b/plugins/sto/sto.cpp @@ -36,11 +36,9 @@ #include "../mumble_plugin_win32.h" -#define PLUGIN_DEBUG - -BYTE *identptr; -BYTE *contextptr; -BYTE *posptr; +static BYTE *identptr; +static BYTE *contextptr; +static BYTE *posptr; static void about(HWND h) { ::MessageBox(h, L"Reads audio position information from Star Trek Online", L"Mumble STO Plugin", MB_OK); @@ -103,35 +101,22 @@ static void unlock() { } static int trylock() { - hProcess = NULL; identptr = contextptr = posptr = NULL; - - DWORD pid=getProcess(L"GameClient.exe"); - if (!pid) - return false; - - BYTE *mod=getModuleAddr(pid, L"GameClient.exe"); - if (!mod) - return false; - - hProcess=OpenProcess(PROCESS_VM_READ, false, pid); - if (!hProcess) + + if (! initialize(L"GameClient.exe")) return false; - - BYTE *versionptr = mod + 0x15E8778; + char version[17]; + peekProc(pModule + 0x15E8778, version); version[16]=0; - peekProc(versionptr, version, 16); - - - if (memcmp(version, "ST.0.20100202a.7", 16) == 0) { + if (memcmp(version, "ST.0.20100202a.7", sizeof(version)) == 0) { #ifdef PLUGIN_DEBUG printf("STO: WANTLINK %s\n", version); #endif - identptr = mod + 0x1675E80; - contextptr = mod + 0x1675a30; - posptr = mod + 0x1885da0; + identptr = pModule + 0x1675E80; + contextptr = pModule + 0x1675a30; + posptr = pModule + 0x1885da0; return true; } |