OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test_utils.h" | 5 #include "chrome_frame/test_utils.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlwin.h> | 8 #include <atlwin.h> |
9 #include <winternl.h> | 9 #include <winternl.h> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/scoped_handle.h" | |
17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/win/scoped_handle.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 const wchar_t kChromeFrameDllName[] = L"npchrome_frame.dll"; | 22 const wchar_t kChromeFrameDllName[] = L"npchrome_frame.dll"; |
23 const wchar_t kChromeLauncherExeName[] = L"chrome_launcher.exe"; | 23 const wchar_t kChromeLauncherExeName[] = L"chrome_launcher.exe"; |
24 | 24 |
25 // Statics | 25 // Statics |
26 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { | 26 FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { |
27 FilePath build_path; | 27 FilePath build_path; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 *qip_func_ptr = qip_func; | 170 *qip_func_ptr = qip_func; |
171 return qip_func != NULL; | 171 return qip_func != NULL; |
172 } | 172 } |
173 | 173 |
174 // Get the command line of a process | 174 // Get the command line of a process |
175 bool GetCommandLineForProcess(uint32 process_id, std::wstring* cmd_line) { | 175 bool GetCommandLineForProcess(uint32 process_id, std::wstring* cmd_line) { |
176 DCHECK(process_id != 0); | 176 DCHECK(process_id != 0); |
177 DCHECK(cmd_line); | 177 DCHECK(cmd_line); |
178 | 178 |
179 // Open the process | 179 // Open the process |
180 ScopedHandle process_handle(::OpenProcess( | 180 base::win::ScopedHandle process_handle(::OpenProcess( |
181 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, | 181 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, |
182 false, | 182 false, |
183 process_id)); | 183 process_id)); |
184 if (!process_handle) { | 184 if (!process_handle) { |
185 DLOG(ERROR) << "Failed to open process " << process_id << ", last error = " | 185 DLOG(ERROR) << "Failed to open process " << process_id << ", last error = " |
186 << GetLastError(); | 186 << GetLastError(); |
187 } | 187 } |
188 | 188 |
189 // Obtain Process Environment Block | 189 // Obtain Process Environment Block |
190 NtQueryInformationProcess* qip_func = NULL; | 190 NtQueryInformationProcess* qip_func = NULL; |
191 if (process_handle) { | 191 if (process_handle) { |
192 GetQIP(&qip_func); | 192 GetQIP(&qip_func); |
193 } | 193 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 UOI_NAME, | 314 UOI_NAME, |
315 name, | 315 name, |
316 sizeof(name), | 316 sizeof(name), |
317 &needed)) { | 317 &needed)) { |
318 is_locked = lstrcmpi(name, L"default") != 0; | 318 is_locked = lstrcmpi(name, L"default") != 0; |
319 } | 319 } |
320 ::CloseDesktop(input_desk); | 320 ::CloseDesktop(input_desk); |
321 } | 321 } |
322 return is_locked; | 322 return is_locked; |
323 } | 323 } |
OLD | NEW |