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-25 17:38:12 +0300
committerThorvald Natvig <slicer@users.sourceforge.net>2010-02-25 17:38:12 +0300
commit6d11c22a49c4d48e4acf4e81f0dd5c383d372ff8 (patch)
tree2f1ebd3836668da90bfcc36adc6a4036cd35a356 /plugins/mumble_plugin_win32.h
parentf2c191daf8f5c7f5fa3b64ff9a6da5aaf108a85e (diff)
Use process map in initialize
Diffstat (limited to 'plugins/mumble_plugin_win32.h')
-rw-r--r--plugins/mumble_plugin_win32.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/plugins/mumble_plugin_win32.h b/plugins/mumble_plugin_win32.h
index 6d028b51e..125bbcaf3 100644
--- a/plugins/mumble_plugin_win32.h
+++ b/plugins/mumble_plugin_win32.h
@@ -129,21 +129,36 @@ static void inline u8(std::wstring &dst, const char *src, int srclen) {
dst.assign(wbuff, len);
}
-static bool inline initialize(const std::multimap<std::wstring, unsigned long long int> &, const wchar_t *procname, const wchar_t *modname = NULL) {
+static bool inline initialize(const std::multimap<std::wstring, unsigned long long int> &pids, const wchar_t *procname, const wchar_t *modname = NULL) {
hProcess = NULL;
pModule = NULL;
- dwPid=getProcess(procname);
+ if (! pids.empty()) {
+ std::multimap<std::wstring, unsigned long long int>::const_iterator iter = pids.find(std::wstring(procname));
+
+ if (iter != pids.end())
+ dwPid = static_cast<DWORD>(iter->second);
+ else
+ dwPid = 0;
+ } else {
+ dwPid=getProcess(procname);
+ }
+
if (!dwPid)
return false;
pModule=getModuleAddr(modname ? modname : procname);
- if (!pModule)
+ if (!pModule) {
+ dwPid = 0;
return false;
+ }
hProcess=OpenProcess(PROCESS_VM_READ, false, dwPid);
- if (!hProcess)
+ if (!hProcess) {
+ dwPid = 0;
+ pModule = NULL;
return false;
+ }
return true;
}
@@ -153,6 +168,7 @@ static void generic_unlock() {
CloseHandle(hProcess);
hProcess = NULL;
pModule = NULL;
+ dwPid = 0;
}
}