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

Side by Side Diff: chrome/app/close_handle_hook_win.cc

Issue 618543002: Disable the scoped handle verifier (and close hook) for M-39 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/app/close_handle_hook_win.h" 5 #include "chrome/app/close_handle_hook_win.h"
6 6
7 #include <Windows.h> 7 #include <Windows.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void CloseHandleHooks::Unpatch() { 61 void CloseHandleHooks::Unpatch() {
62 for (std::vector<base::win::IATPatchFunction*>::iterator it = hooks_.begin(); 62 for (std::vector<base::win::IATPatchFunction*>::iterator it = hooks_.begin();
63 it != hooks_.end(); ++it) { 63 it != hooks_.end(); ++it) {
64 (*it)->Unpatch(); 64 (*it)->Unpatch();
65 } 65 }
66 } 66 }
67 67
68 bool UseHooks() { 68 bool UseHooks() {
69 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
70 if (channel == chrome::VersionInfo::CHANNEL_CANARY ||
71 channel == chrome::VersionInfo::CHANNEL_DEV) {
72 return true;
73 }
74
75 return false; 69 return false;
76 } 70 }
77 71
78 base::string16 GetModuleName(HMODULE module) { 72 base::string16 GetModuleName(HMODULE module) {
79 base::string16 name; 73 base::string16 name;
80 if (!module) 74 if (!module)
81 return name; 75 return name;
82 wchar_t buffer[MAX_PATH]; 76 wchar_t buffer[MAX_PATH];
83 int rv = GetModuleFileName(module, buffer, MAX_PATH); 77 int rv = GetModuleFileName(module, buffer, MAX_PATH);
84 if (rv == MAX_PATH) 78 if (rv == MAX_PATH)
(...skipping 24 matching lines...) Expand all
109 hooks->AddIATPatch(L"chrome.exe"); 103 hooks->AddIATPatch(L"chrome.exe");
110 hooks->AddIATPatch(GetModuleName(GetChromeDLLModule())); 104 hooks->AddIATPatch(GetModuleName(GetChromeDLLModule()));
111 } else { 105 } else {
112 base::win::DisableHandleVerifier(); 106 base::win::DisableHandleVerifier();
113 } 107 }
114 } 108 }
115 109
116 void RemoveCloseHandleHooks() { 110 void RemoveCloseHandleHooks() {
117 g_hooks.Get().Unpatch(); 111 g_hooks.Get().Unpatch();
118 } 112 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698