Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: chrome_frame/module_utils.cc

Issue 2024003: Add ExceptionBarrier to module scanning in the hope of reducing some false po... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/module_utils.cc
===================================================================
--- chrome_frame/module_utils.cc (revision 46472)
+++ chrome_frame/module_utils.cc (working copy)
@@ -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 @@
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698