summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 13:56:29 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 13:56:29 +0000
commit8b84f102ec2e789ceae82318cbdde14d3665ecd7 (patch)
treeadf76cf773c5fa7f67912797a70b834f0ddda607 /chrome_frame
parent2ae6e0211643007dba78a6d753960c8fffc38aae (diff)
downloadchromium_src-8b84f102ec2e789ceae82318cbdde14d3665ecd7.zip
chromium_src-8b84f102ec2e789ceae82318cbdde14d3665ecd7.tar.gz
chromium_src-8b84f102ec2e789ceae82318cbdde14d3665ecd7.tar.bz2
Add ExceptionBarrier to module scanning in the hope of reducing some false positives.
BUG=43343 Review URL: http://codereview.chromium.org/2024003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46683 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/module_utils.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/chrome_frame/module_utils.cc b/chrome_frame/module_utils.cc
index 77cdd91..f0e0e3f 100644
--- a/chrome_frame/module_utils.cc
+++ b/chrome_frame/module_utils.cc
@@ -13,6 +13,7 @@
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/version.h"
+#include "chrome_frame/exception_barrier.h"
DllRedirector::DllRedirector() : dcgo_ptr_(NULL), initialized_(false),
module_handle_(NULL) {}
@@ -72,20 +73,31 @@ bool DllRedirector::GetOldestNamedModuleHandle(const std::wstring& module_name,
return false;
}
+
bool success = false;
PathToHModuleMap map;
- // First get the list of module paths, and save the full path to base address
- // mapping.
- MODULEENTRY32W module_entry;
- module_entry.dwSize = sizeof(module_entry);
- BOOL cont = Module32FirstW(snapshot, &module_entry);
- while (cont) {
- if (!lstrcmpi(module_entry.szModule, module_name.c_str())) {
- std::wstring full_path(module_entry.szExePath);
- map[full_path] = module_entry.hModule;
+ {
+ // Here we add an SEH to the chain to prevent our VEH from picking up on any
+ // exceptions thrown in DLLs who hook some of the below api calls. We will
+ // still report the exceptions if they make our way back to us, the hope is
+ // that they will not.
+ ExceptionBarrier exception_barrier;
+
+ // First get the list of module paths, and save the full path to base
+ // address mapping.
+ MODULEENTRY32W module_entry = {0};
+ module_entry.dwSize = sizeof(module_entry);
+ BOOL cont = Module32FirstW(snapshot, &module_entry);
+ while (cont) {
+ if (!lstrcmpi(module_entry.szModule, module_name.c_str())) {
+ std::wstring full_path(module_entry.szExePath);
+ map[full_path] = module_entry.hModule;
+ }
+ SecureZeroMemory(&module_entry, sizeof(MODULEENTRY32W));
+ module_entry.dwSize = sizeof(module_entry);
+ cont = Module32NextW(snapshot, &module_entry);
}
- cont = Module32NextW(snapshot, &module_entry);
}
// Next, enumerate the map and find the oldest version of the module.