Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2010-02-08 21:37:20 +0300
committerThorvald Natvig <slicer@users.sourceforge.net>2010-02-08 21:37:35 +0300
commitde21a2231c7d515a69dba7af7df969a80dc9bca9 (patch)
tree9a0298b4c5dff999886d58c936e04422c8254829 /plugins/mumble_plugin_win32.h
parenteffc993f56b434ec986f609a90250e30e254b80b (diff)
Update STO plugin and add common initialize() function
Diffstat (limited to 'plugins/mumble_plugin_win32.h')
-rw-r--r--plugins/mumble_plugin_win32.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/mumble_plugin_win32.h b/plugins/mumble_plugin_win32.h
index 820f3d492..6d641ac15 100644
--- a/plugins/mumble_plugin_win32.h
+++ b/plugins/mumble_plugin_win32.h
@@ -34,6 +34,7 @@
#include "mumble_plugin.h"
static HANDLE hProcess;
+static BYTE *pModule;
static inline DWORD getProcess(const wchar_t *exename) {
PROCESSENTRY32 pe;
@@ -96,7 +97,7 @@ T peekProc(VOID *base) {
return v;
}
-static void u8(std::wstring &dst, const std::string &src) {
+static void inline u8(std::wstring &dst, const std::string &src) {
int len = MultiByteToWideChar(CP_UTF8, 0, src.data(), src.length(), NULL, 0);
wchar_t *wbuff = reinterpret_cast<wchar_t *>(_alloca(sizeof(wchar_t) * len));
@@ -105,7 +106,7 @@ static void u8(std::wstring &dst, const std::string &src) {
dst.assign(wbuff, len);
}
-static void u8(std::wstring &dst, const char *src, int srclen) {
+static void inline u8(std::wstring &dst, const char *src, int srclen) {
int len = MultiByteToWideChar(CP_UTF8, 0, src, srclen, NULL, 0);
wchar_t *wbuff = reinterpret_cast<wchar_t *>(_alloca(sizeof(wchar_t) * len));
@@ -114,4 +115,23 @@ static void u8(std::wstring &dst, const char *src, int srclen) {
dst.assign(wbuff, len);
}
+static bool inline initialize(const wchar_t *procname, const wchar_t *modname = NULL) {
+ hProcess = NULL;
+ pModule = NULL;
+
+ DWORD pid=getProcess(procname);
+ if (!pid)
+ return false;
+
+ pModule=getModuleAddr(pid, modname ? modname : procname);
+ if (!pModule)
+ return false;
+
+ hProcess=OpenProcess(PROCESS_VM_READ, false, pid);
+ if (!hProcess)
+ return false;
+
+ return true;
+}
+
#endif