| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/win/com_init_check_hook.h" | 5 #include "base/win/com_init_check_hook.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> | 8 #include <objbase.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // it improves readability. | 66 // it improves readability. |
| 67 #pragma pack(push, 1) | 67 #pragma pack(push, 1) |
| 68 struct StructuredHotpatch { | 68 struct StructuredHotpatch { |
| 69 unsigned char jmp_32_relative = 0xe9; // jmp relative 32-bit. | 69 unsigned char jmp_32_relative = 0xe9; // jmp relative 32-bit. |
| 70 int32_t relative_address = 0; // 32-bit signed operand. | 70 int32_t relative_address = 0; // 32-bit signed operand. |
| 71 unsigned char jmp_8_relative = 0xeb; // jmp relative 8-bit. | 71 unsigned char jmp_8_relative = 0xeb; // jmp relative 8-bit. |
| 72 unsigned char back_address = 0xf9; // Operand of -7. | 72 unsigned char back_address = 0xf9; // Operand of -7. |
| 73 }; | 73 }; |
| 74 #pragma pack(pop) | 74 #pragma pack(pop) |
| 75 | 75 |
| 76 // whitespace change. |
| 77 |
| 76 static_assert(sizeof(StructuredHotpatch) == 7, | 78 static_assert(sizeof(StructuredHotpatch) == 7, |
| 77 "Needs to be exactly 7 bytes for the hotpatch to work."); | 79 "Needs to be exactly 7 bytes for the hotpatch to work."); |
| 78 | 80 |
| 79 // nop Function Padding with "mov edi,edi" | 81 // nop Function Padding with "mov edi,edi" |
| 80 const unsigned char g_hotpatch_placeholder_nop[] = {0x90, 0x90, 0x90, 0x90, | 82 const unsigned char g_hotpatch_placeholder_nop[] = {0x90, 0x90, 0x90, 0x90, |
| 81 0x90, 0x8b, 0xff}; | 83 0x90, 0x8b, 0xff}; |
| 82 | 84 |
| 83 // int 3 Function Padding with "mov edi,edi" | 85 // int 3 Function Padding with "mov edi,edi" |
| 84 const unsigned char g_hotpatch_placeholder_int3[] = {0xcc, 0xcc, 0xcc, 0xcc, | 86 const unsigned char g_hotpatch_placeholder_int3[] = {0xcc, 0xcc, 0xcc, 0xcc, |
| 85 0xcc, 0x8b, 0xff}; | 87 0xcc, 0x8b, 0xff}; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 264 } |
| 263 | 265 |
| 264 ComInitCheckHook::~ComInitCheckHook() { | 266 ComInitCheckHook::~ComInitCheckHook() { |
| 265 #if defined(COM_INIT_CHECK_HOOK_ENABLED) | 267 #if defined(COM_INIT_CHECK_HOOK_ENABLED) |
| 266 HookManager::GetInstance()->UnregisterHook(); | 268 HookManager::GetInstance()->UnregisterHook(); |
| 267 #endif // defined(COM_INIT_CHECK_HOOK_ENABLED) | 269 #endif // defined(COM_INIT_CHECK_HOOK_ENABLED) |
| 268 } | 270 } |
| 269 | 271 |
| 270 } // namespace win | 272 } // namespace win |
| 271 } // namespace base | 273 } // namespace base |
| OLD | NEW |