| Index: base/win/scoped_handle.cc
|
| diff --git a/base/win/scoped_handle.cc b/base/win/scoped_handle.cc
|
| index 99dae66e3b2cc1610ea54c9d9e24750446b0566b..7fa8b4380913d4aed8e0b927fb8c0a3d2d82c22d 100644
|
| --- a/base/win/scoped_handle.cc
|
| +++ b/base/win/scoped_handle.cc
|
| @@ -22,6 +22,9 @@ __declspec(dllexport) void* GetHandleVerifier();
|
| typedef void* (*GetHandleVerifierFn)();
|
| }
|
|
|
| +// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
|
| +extern "C" IMAGE_DOS_HEADER __ImageBase;
|
| +
|
| namespace {
|
|
|
| struct HandleHash {
|
| @@ -85,6 +88,7 @@ class ActiveVerifier {
|
| const void* pc1, const void* pc2);
|
| virtual void Disable();
|
| virtual void OnHandleBeingClosed(HANDLE handle);
|
| + virtual HMODULE GetModule() const;
|
|
|
| private:
|
| ~ActiveVerifier(); // Not implemented.
|
| @@ -242,6 +246,10 @@ void ActiveVerifier::OnHandleBeingClosed(HANDLE handle) {
|
| CHECK(false); // CloseHandle called on tracked handle.
|
| }
|
|
|
| +HMODULE ActiveVerifier::GetModule() const {
|
| + return reinterpret_cast<HMODULE>(&__ImageBase);
|
| +}
|
| +
|
| } // namespace
|
|
|
| void* GetHandleVerifier() {
|
| @@ -276,5 +284,9 @@ void OnHandleBeingClosed(HANDLE handle) {
|
| return ActiveVerifier::Get()->OnHandleBeingClosed(handle);
|
| }
|
|
|
| +HMODULE GetHandleVerifierModuleForTesting() {
|
| + return g_active_verifier->GetModule();
|
| +}
|
| +
|
| } // namespace win
|
| } // namespace base
|
|
|