| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome_frame/module_utils.h" | 5 #include "chrome_frame/module_utils.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 const wchar_t kBeaconWindowClassName[] = | 10 const wchar_t kBeaconWindowClassName[] = |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 HMODULE DllRedirector::GetFirstCFModule() { | 44 HMODULE DllRedirector::GetFirstCFModule() { |
| 45 WNDCLASSEX wnd_class = {0}; | 45 WNDCLASSEX wnd_class = {0}; |
| 46 HMODULE oldest_module = NULL; | 46 HMODULE oldest_module = NULL; |
| 47 if (GetClassInfoEx(GetModuleHandle(NULL), kBeaconWindowClassName, | 47 if (GetClassInfoEx(GetModuleHandle(NULL), kBeaconWindowClassName, |
| 48 &wnd_class)) { | 48 &wnd_class)) { |
| 49 oldest_module = reinterpret_cast<HMODULE>(wnd_class.lpfnWndProc); | 49 oldest_module = reinterpret_cast<HMODULE>(wnd_class.lpfnWndProc); |
| 50 // Handle older versions that store module pointer in a class info. | 50 // Handle older versions that store module pointer in a class info. |
| 51 // TODO(amit): Remove this in future versions. | 51 // TODO(amit): Remove this in future versions. |
| 52 if (reinterpret_cast<HMODULE>(DefWindowProc) == oldest_module) { | 52 if (reinterpret_cast<HMODULE>(DefWindowProc) == oldest_module) { |
| 53 WNDCLASSEX wnd_class = {0}; | 53 WNDCLASSEX wnd_class = {0}; |
| 54 HMODULE oldest_module = NULL; | |
| 55 HWND hwnd = CreateWindow(kBeaconWindowClassName, L"temp_window", | 54 HWND hwnd = CreateWindow(kBeaconWindowClassName, L"temp_window", |
| 56 WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, NULL); | 55 WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, NULL); |
| 57 DCHECK(IsWindow(hwnd)); | 56 DCHECK(IsWindow(hwnd)); |
| 58 if (hwnd) { | 57 if (hwnd) { |
| 59 oldest_module = reinterpret_cast<HMODULE>(GetClassLongPtr(hwnd, 0)); | 58 oldest_module = reinterpret_cast<HMODULE>(GetClassLongPtr(hwnd, 0)); |
| 60 DestroyWindow(hwnd); | 59 DestroyWindow(hwnd); |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 return oldest_module; | 63 return oldest_module; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 LOG(ERROR) << "Module Scan: Couldn't get address of " | 78 LOG(ERROR) << "Module Scan: Couldn't get address of " |
| 80 << "DllGetClassObject: " | 79 << "DllGetClassObject: " |
| 81 << GetLastError(); | 80 << GetLastError(); |
| 82 } | 81 } |
| 83 } else { | 82 } else { |
| 84 LOG(ERROR) << "Module Scan: Could not increment module count: " | 83 LOG(ERROR) << "Module Scan: Could not increment module count: " |
| 85 << GetLastError(); | 84 << GetLastError(); |
| 86 } | 85 } |
| 87 return proc_ptr; | 86 return proc_ptr; |
| 88 } | 87 } |
| OLD | NEW |