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

Unified Diff: base/iat_patch.h

Issue 21453: Try a new approach to fixing IAT unpatch crashes when the DLL is gone. (Closed)
Patch Set: DCHECK Created 11 years, 10 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 | base/iat_patch.cc » ('j') | chrome/browser/autocomplete/autocomplete_edit.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/iat_patch.h
diff --git a/base/iat_patch.h b/base/iat_patch.h
index 819037c4cdf209e533298b9d38c7a17870a41eed..9e470d628bcf4581f89ac7dece98b15768811d2c 100644
--- a/base/iat_patch.h
+++ b/base/iat_patch.h
@@ -80,13 +80,19 @@ class IATPatchFunction {
// during Unpatch
//
// Arguments:
- // module_handle Module to be intercepted
+ // module Module to be intercepted
// imported_from_module Module that exports the 'function_name'
// function_name Name of the API to be intercepted
//
// Returns: Windows error code (winerror.h). NO_ERROR if successful
//
- DWORD Patch(HMODULE module_handle,
+ // Note: Patching a function will make the IAT patch take some "ownership" on
+ // |module|. It will LoadLibrary(module) to keep the DLL alive until a call
+ // to Unpatch(), which will call FreeLibrary() and allow the module to be
+ // unloaded. The idea is to help prevent the DLL from going away while a
+ // patch is still active.
+ //
+ DWORD Patch(const wchar_t* module,
const char* imported_from_module,
const char* function_name,
void* new_function);
@@ -103,6 +109,7 @@ class IATPatchFunction {
}
private:
+ HMODULE module_handle_;
void* intercept_function_;
void* original_function_;
IMAGE_THUNK_DATA* iat_thunk_;
« no previous file with comments | « no previous file | base/iat_patch.cc » ('j') | chrome/browser/autocomplete/autocomplete_edit.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698