| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 #include "chrome_frame/crash_reporting/nt_loader.h" | |
| 5 | |
| 6 #include <winnt.h> | |
| 7 #include <winternl.h> | |
| 8 #include "base/logging.h" | |
| 9 | |
| 10 namespace nt_loader { | |
| 11 | |
| 12 LDR_DATA_TABLE_ENTRY* GetLoaderEntry(HMODULE module) { | |
| 13 // Make sure we own the loader's lock on entry here. | |
| 14 DCHECK(OwnsCriticalSection(GetLoaderLock())); | |
| 15 PEB* peb = GetCurrentPeb(); | |
| 16 | |
| 17 LIST_ENTRY* head = &peb->Ldr->InLoadOrderModuleList; | |
| 18 for (LIST_ENTRY* entry = head->Flink; entry != head; entry = entry->Flink) { | |
| 19 LDR_DATA_TABLE_ENTRY* ldr_entry = | |
| 20 CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); | |
| 21 | |
| 22 if (reinterpret_cast<HMODULE>(ldr_entry->DllBase) == module) | |
| 23 return ldr_entry; | |
| 24 } | |
| 25 | |
| 26 return NULL; | |
| 27 } | |
| 28 | |
| 29 } // namespace nt_loader | |
| OLD | NEW |