0

Reland "Remove base/scoped_handle_win.h."

Fixed the problem with rlz library. Now should be fine to land this again.

This reverts commit 3620d9501af7bff688862c54fdd60f7eb41797f3.

Original Review URL: http://codereview.chromium.org/6126002/

BUG=None
TEST=trybots

Review URL: http://codereview.chromium.org/6110005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70861 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
tfarina@chromium.org
2011-01-09 16:32:20 +00:00
parent d716d41781
commit b90d7e80c2
57 changed files with 269 additions and 245 deletions

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -17,7 +17,6 @@
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/scoped_handle_win.h"
#include "base/string_util.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -19,7 +19,6 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
#include "base/threading/platform_thread.h"
#include "base/time.h"
@ -27,6 +26,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#if defined(OS_WIN)
#include "base/win/scoped_handle.h"
#endif
// This macro helps avoid wrapped lines in the test structs.
#define FPL(x) FILE_PATH_LITERAL(x)
@ -471,7 +474,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_a));
ScopedHandle reparse_to_sub_a(
base::win::ScopedHandle reparse_to_sub_a(
::CreateFile(to_sub_a.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@ -484,7 +487,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_base_b = base_b.Append(FPL("to_base_b"));
ASSERT_TRUE(file_util::CreateDirectory(to_base_b));
ScopedHandle reparse_to_base_b(
base::win::ScopedHandle reparse_to_base_b(
::CreateFile(to_base_b.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@ -497,7 +500,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_long = base_b.Append(FPL("to_sub_long"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_long));
ScopedHandle reparse_to_sub_long(
base::win::ScopedHandle reparse_to_sub_long(
::CreateFile(to_sub_long.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -15,7 +15,7 @@
#if defined(OS_WIN)
#include "base/message_pump_win.h"
#include "base/scoped_handle.h"
#include "base/win/scoped_handle.h"
#endif
#if defined(OS_POSIX)
#include "base/message_pump_libevent.h"
@ -937,7 +937,7 @@ void RunTest_RecursiveDenial2(MessageLoop::Type message_loop_type) {
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@ -980,7 +980,7 @@ void RunTest_RecursiveSupport2(MessageLoop::Type message_loop_type) {
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@ -1187,7 +1187,7 @@ class TestIOHandler : public MessageLoopForIO::IOHandler {
char buffer_[48];
MessageLoopForIO::IOContext context_;
HANDLE signal_;
ScopedHandle file_;
base::win::ScopedHandle file_;
bool wait_;
};
@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task {
};
void RunTest_IOHandler() {
ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback_called.IsValid());
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1,
0, 0, 0, NULL));
base::win::ScopedHandle server(
CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
ASSERT_TRUE(server.IsValid());
Thread thread("IOHandler test");
@ -1267,17 +1267,19 @@ void RunTest_IOHandler() {
}
void RunTest_WaitForIO() {
ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL));
base::win::ScopedHandle callback1_called(
CreateEvent(NULL, TRUE, FALSE, NULL));
base::win::ScopedHandle callback2_called(
CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback1_called.IsValid());
ASSERT_TRUE(callback2_called.IsValid());
const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1";
const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2";
ScopedHandle server1(CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1,
0, 0, 0, NULL));
ScopedHandle server2(CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1,
0, 0, 0, NULL));
base::win::ScopedHandle server1(
CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
base::win::ScopedHandle server2(
CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
ASSERT_TRUE(server1.IsValid());
ASSERT_TRUE(server2.IsValid());

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -13,8 +13,8 @@
#include "base/basictypes.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
#include "base/scoped_handle.h"
#include "base/time.h"
#include "base/win/scoped_handle.h"
namespace base {
@ -356,7 +356,7 @@ class MessagePumpForIO : public MessagePumpWin {
void DidProcessIOEvent();
// The completion port associated with this thread.
ScopedHandle port_;
win::ScopedHandle port_;
// This list will be empty almost always. It stores IO completions that have
// not been delivered yet because somebody was doing cleanup.
std::list<IOItem> completed_io_;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -10,10 +10,6 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
#include "base/scoped_handle_win.h"
#endif
class ScopedStdioHandle {
public:
ScopedStdioHandle()

@ -1,9 +0,0 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(brettw) remove this file when all callers are converted to using the
// new location/namespace
#include "base/win/scoped_handle.h"
using base::win::ScopedHandle;

@ -1,4 +1,4 @@
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -12,7 +12,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/win/scoped_handle.h"
#include "base/threading/platform_thread.h"
namespace file_util {
@ -39,7 +39,7 @@ bool DieFileDie(const FilePath& file, bool recurse) {
bool EvictFileFromSystemCache(const FilePath& file) {
// Request exclusive access to the file and overwrite it with no buffering.
ScopedHandle file_handle(
base::win::ScopedHandle file_handle(
CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
if (!file_handle)

@ -4,14 +4,16 @@
//
// Unit tests for event trace consumer_ base class.
#include "base/win/event_trace_consumer.h"
#include <list>
#include "base/basictypes.h"
#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_provider.h"
#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <initguid.h> // NOLINT - has to be last
@ -63,14 +65,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
::SetEvent(sank_event_.Get());
}
static ScopedHandle sank_event_;
static base::win::ScopedHandle sank_event_;
static EventQueue events_;
private:
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
};
ScopedHandle TestConsumer::sank_event_;
base::win::ScopedHandle TestConsumer::sank_event_;
EventQueue TestConsumer::events_;
const wchar_t* const kTestSessionName = L"TestLogSession";
@ -175,8 +177,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test {
}
TestConsumer consumer_;
ScopedHandle consumer_ready_;
ScopedHandle consumer_thread_;
base::win::ScopedHandle consumer_ready_;
base::win::ScopedHandle consumer_thread_;
};
} // namespace

@ -1,17 +1,19 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Unit tests for event trace controller.
#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_provider.h"
#include <initguid.h> // NOLINT.
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/sys_info.h"
#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_provider.h"
#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <initguid.h> // NOLINT - must be last.
namespace {
@ -50,7 +52,7 @@ class TestingProvider: public EtwTraceProvider {
::SetEvent(callback_event_.Get());
}
ScopedHandle callback_event_;
base::win::ScopedHandle callback_event_;
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
};

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -13,11 +13,11 @@
#include "base/logging.h"
#include "base/win/registry.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
namespace base {
@ -47,7 +47,7 @@ bool GetUserSidString(std::wstring* user_sid) {
HANDLE token = NULL;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
return false;
ScopedHandle token_scoped(token);
base::win::ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
scoped_array<BYTE> user_bytes(new BYTE[size]);

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@ -9,24 +9,23 @@
#include <sddl.h>
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "ceee/common/com_utils.h"
namespace process_utils_win {
HRESULT SetThreadIntegrityLevel(HANDLE* thread, const std::wstring& level) {
HANDLE temp_handle = NULL;
BOOL success = ::OpenProcessToken(
::GetCurrentProcess(), MAXIMUM_ALLOWED, &temp_handle);
ScopedHandle process_token(temp_handle);
base::win::ScopedHandle process_token(temp_handle);
temp_handle = NULL;
if (success) {
success = ::DuplicateTokenEx(
process_token, MAXIMUM_ALLOWED, NULL, SecurityImpersonation,
TokenImpersonation, &temp_handle);
ScopedHandle mic_token(temp_handle);
base::win::ScopedHandle mic_token(temp_handle);
temp_handle = NULL;
if (success) {
PSID mic_sid = NULL;
@ -98,7 +97,7 @@ HRESULT IsCurrentProcessUacElevated(bool* running_as_admin) {
// All that for an admin-group member, who can run in elevated mode.
// This logic applies to Vista/Win7. The case of earlier systems is handled
// at the start.
ScopedHandle process_token(temp_handle);
base::win::ScopedHandle process_token(temp_handle);
TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
DWORD variable_len_dummy = 0;
if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type,
@ -331,4 +330,4 @@ void ProcessCompatibilityCheck::ResetState() {
GetInstance()->StandardInitialize();
}
} // namespace com
} // namespace process_utils_win

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@ -12,7 +12,7 @@
#include <list>
#include "base/basictypes.h"
#include "base/scoped_handle.h"
#include "base/win/scoped_handle.h"
#include "ceee/common/initializing_coclass.h"
#include "chrome_tab.h" // NOLINT
@ -212,7 +212,7 @@ class ATL_NO_VTABLE ChromeFrameHost
#ifndef NDEBUG
// We use a cross process event to make sure there is only one chrome frame
// host that returns ExtensionApisToAutomate... But only needed for a DCHECK.
ScopedHandle automating_extension_api_;
base::win::ScopedHandle automating_extension_api_;
#endif
// A cached BSTR for the posted messages origin (which is kAutomationOrigin).

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@ -8,6 +8,7 @@
#include <shlobj.h>
#include <atlbase.h>
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/message_loop.h"
@ -15,6 +16,7 @@
#include "base/process_util.h"
#include "base/threading/thread.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "ceee/common/initializing_coclass.h"
#include "ceee/ie/plugin/toolband/toolband_proxy.h"
@ -159,7 +161,7 @@ class RemoteObjectHost {
}
void RunSync(Task* task) {
ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
remote_thread_.message_loop()->PostTask(FROM_HERE, task);
remote_thread_.message_loop()->PostTask(FROM_HERE,

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -12,7 +12,6 @@
#include "app/win/shell.h"
#include "base/command_line.h"
#include "base/scoped_comptr_win.h"
#include "base/scoped_handle_win.h"
#include "base/scoped_native_library.h"
#include "base/synchronization/waitable_event.h"
#include "base/win/scoped_gdi_object.h"

@ -14,7 +14,6 @@
#include "base/file_path.h"
#include "base/file_version_info_win.h"
#include "base/metrics/histogram.h"
#include "base/scoped_handle.h"
#include "base/sha2.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
@ -23,6 +22,7 @@
#include "base/values.h"
#include "base/version.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "chrome/browser/net/service_providers_win.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@ -386,8 +386,8 @@ void ModuleEnumerator::ScanImpl() {
void ModuleEnumerator::EnumerateLoadedModules() {
// Get all modules in the current process.
ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
::GetCurrentProcessId()));
base::win::ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
::GetCurrentProcessId()));
if (!snap.Get())
return;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -27,6 +27,7 @@
#include "base/values.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/importer/importer_bridge.h"
@ -49,7 +50,7 @@ namespace {
// Gets the creation time of the given file or directory.
static Time GetFileCreationTime(const std::wstring& file) {
Time creation_time;
ScopedHandle file_handle(
base::win::ScopedHandle file_handle(
CreateFile(file.c_str(), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING,

@ -1,8 +1,9 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/memory_details.h"
#include <psapi.h>
#include "app/l10n_util.h"
@ -10,6 +11,7 @@
#include "base/file_version_info.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
@ -74,7 +76,8 @@ void MemoryDetails::CollectProcessData(
bool is_64bit_os =
system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
ScopedHandle snapshot(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
base::win::ScopedHandle snapshot(
::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)};
if (!snapshot.Get()) {
LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError();
@ -86,7 +89,7 @@ void MemoryDetails::CollectProcessData(
}
do {
base::ProcessId pid = process_entry.th32ProcessID;
ScopedHandle handle(::OpenProcess(
base::win::ScopedHandle handle(::OpenProcess(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
if (!handle.Get())
continue;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -11,8 +11,8 @@
#include "base/file_path.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/scoped_handle.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_startup.h"
#include "chrome/browser/platform_util.h"
@ -53,7 +53,8 @@ ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir)
// since it isn't guaranteed we will get it. It is better to create it
// without ownership and explicitly get the ownership afterward.
std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!");
ScopedHandle only_me(CreateMutex(NULL, FALSE, mutex_name.c_str()));
base::win::ScopedHandle only_me(
CreateMutex(NULL, FALSE, mutex_name.c_str()));
DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError();
// This is how we acquire the mutex (as opposed to the initial ownership).

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -39,6 +39,10 @@
#include "gfx/native_widget_types.h"
#include "net/base/load_states.h"
#if defined(OS_WIN)
#include "base/win/scoped_handle.h"
#endif
namespace gfx {
class Rect;
}
@ -1280,7 +1284,7 @@ class TabContents : public PageNavigator,
// Handle to an event that's set when the page is showing a message box (or
// equivalent constrained window). Plugin processes check this to know if
// they should pump messages then.
ScopedHandle message_box_active_;
base::win::ScopedHandle message_box_active_;
#endif
// The time that the last javascript message was dismissed.

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -8,10 +8,10 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/scoped_handle_win.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/win/object_watcher.h"
#include "base/win/scoped_handle.h"
#include "base/win/win_util.h"
#include "chrome/common/chrome_switches.h"
@ -47,7 +47,7 @@ class ServiceProcessShutdownMonitor
}
private:
ScopedHandle shutdown_event_;
base::win::ScopedHandle shutdown_event_;
base::win::ObjectWatcher watcher_;
scoped_ptr<Task> shutdown_task_;
};
@ -55,7 +55,7 @@ class ServiceProcessShutdownMonitor
} // namespace
bool ForceServiceProcessShutdown(const std::string& version) {
ScopedHandle shutdown_event;
base::win::ScopedHandle shutdown_event;
std::string versioned_name = version;
versioned_name.append("_service_shutdown_evt");
string16 event_name =
@ -69,7 +69,7 @@ bool ForceServiceProcessShutdown(const std::string& version) {
bool CheckServiceProcessReady() {
string16 event_name = GetServiceProcessReadyEventName();
ScopedHandle event(
base::win::ScopedHandle event(
OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str()));
if (!event.IsValid())
return false;
@ -79,7 +79,7 @@ bool CheckServiceProcessReady() {
struct ServiceProcessState::StateData {
// An event that is signaled when a service process is ready.
ScopedHandle ready_event;
base::win::ScopedHandle ready_event;
scoped_ptr<ServiceProcessShutdownMonitor> shutdown_monitor;
};
@ -87,7 +87,7 @@ bool ServiceProcessState::TakeSingletonLock() {
DCHECK(!state_);
string16 event_name = GetServiceProcessReadyEventName();
CHECK(event_name.length() <= MAX_PATH);
ScopedHandle service_process_ready_event;
base::win::ScopedHandle service_process_ready_event;
service_process_ready_event.Set(
CreateEvent(NULL, TRUE, FALSE, event_name.c_str()));
DWORD error = GetLastError();

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -16,11 +16,11 @@
#include "base/file_version_info.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/scoped_handle_win.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/win/scoped_handle.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "breakpad/src/client/windows/handler/exception_handler.h"
@ -694,7 +694,7 @@ bool ShowRebootDialog() {
// Use a ScopedHandle to keep track of and eventually close our handle.
// TODO(robertshield): Add a Receive() method to base's ScopedHandle.
ScopedHandle scoped_handle(token);
base::win::ScopedHandle scoped_handle(token);
// Get the LUID for the shutdown privilege.
TOKEN_PRIVILEGES tkp = {0};

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@ -8,11 +8,11 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/scoped_handle.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/common/result_codes.h"
#include "chrome/common/chrome_constants.h"
@ -146,7 +146,7 @@ void CloseChromeFrameHelperProcess() {
DWORD pid = 0;
::GetWindowThreadProcessId(window, &pid);
DCHECK_NE(pid, 0U);
ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid));
base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid));
PLOG_IF(INFO, !process) << "Failed to open process: " << pid;
bool kill = true;

@ -1,11 +1,11 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/master_preferences.h"
@ -16,7 +16,6 @@
#include "chrome/installer/util/util_constants.h"
using base::win::RegKey;
using base::win::ScopedHandle;
using installer::ChromePackageProperties;
using installer::ChromiumPackageProperties;
using installer::Package;
@ -72,8 +71,9 @@ TEST_F(PackageTest, Basic) {
// Hold on to the file exclusively to prevent the directory from
// being deleted.
ScopedHandle file(::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
0, NULL, OPEN_ALWAYS, 0, NULL));
base::win::ScopedHandle file(
::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
0, NULL, OPEN_ALWAYS, 0, NULL));
EXPECT_TRUE(file.IsValid());
EXPECT_TRUE(file_util::PathExists(old_chrome_dll));

@ -1,11 +1,10 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/installer/util/product_unittest.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/utf_string_conversions.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
@ -16,7 +15,6 @@
#include "chrome/installer/util/product.h"
using base::win::RegKey;
using base::win::ScopedHandle;
using installer::ChromePackageProperties;
using installer::ChromiumPackageProperties;
using installer::Package;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -17,6 +17,10 @@
#include "printing/native_metafile.h"
#include "printing/page_range.h"
#if defined(OS_WIN)
#include "base/win/scoped_handle.h"
#endif
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
Client* client, base::MessageLoopProxy* client_message_loop_proxy)
: ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS),
@ -50,7 +54,7 @@ bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
if (!StartProcess(false, scratch_metafile_dir_->path()))
return false;
ScopedHandle pdf_file(
base::win::ScopedHandle pdf_file(
::CreateFile(pdf_path.value().c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -29,6 +29,7 @@
#if defined(OS_WIN)
#include "app/win/iat_patch_function.h"
#include "base/win/scoped_handle.h"
#endif
namespace {
@ -204,7 +205,7 @@ bool UtilityThread::RenderPDFToWinMetafile(
printing::NativeMetafile* metafile,
int* highest_rendered_page_number) {
*highest_rendered_page_number = -1;
ScopedHandle file(pdf_file);
base::win::ScopedHandle file(pdf_file);
FilePath pdf_module_path;
PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path);
HMODULE pdf_module = GetModuleHandle(pdf_module_path.value().c_str());

@ -1,6 +1,7 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <windows.h>
#include <objbase.h>
#include <dbghelp.h>
@ -11,7 +12,7 @@
#include "base/file_util.h"
#include "base/file_version_info.h"
#include "base/logging.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "gtest/gtest.h"
namespace {
@ -277,8 +278,8 @@ class MinidumpTest: public testing::Test {
}
protected:
ScopedHandle dump_file_handle_;
ScopedHandle dump_file_mapping_;
base::win::ScopedHandle dump_file_handle_;
base::win::ScopedHandle dump_file_mapping_;
void* dump_file_view_;
FilePath dump_file_;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -10,12 +10,12 @@
#include "base/at_exit.h"
#include "base/environment.h"
#include "base/message_loop.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/sys_info.h"
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "chrome_frame/crash_reporting/crash_dll.h"
#include "gtest/gtest.h"
@ -83,7 +83,7 @@ TEST(NtLoader, OwnsCriticalSection) {
other.message_loop()->PostTask(
FROM_HERE, NewRunnableFunction(::EnterCriticalSection, &cs));
ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL));
base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL));
other.message_loop()->PostTask(
FROM_HERE, NewRunnableFunction(::SetEvent, event.Get()));
@ -125,8 +125,8 @@ TEST(NtLoader, OwnsLoaderLock) {
TEST(NtLoader, GetLoaderEntry) {
// Get all modules in the current process.
ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
::GetCurrentProcessId()));
base::win::ScopedHandle snap(
::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ::GetCurrentProcessId()));
EXPECT_TRUE(snap.Get() != NULL);
// Walk them, while checking we get an entry for each, and that it

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -16,12 +16,12 @@
#include "base/file_version_info.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "ceee/ie/common/ceee_util.h"
#include "chrome/common/chrome_switches.h"
@ -95,7 +95,8 @@ int CloseVisibleWindowsOnAllThreads(HANDLE process) {
return 0;
}
ScopedHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0));
base::win::ScopedHandle snapshot(
CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0));
if (!snapshot.IsValid()) {
NOTREACHED();
return 0;
@ -309,7 +310,7 @@ BOOL LowIntegrityToken::Impersonate() {
return ok;
}
ScopedHandle process_token(process_token_handle);
base::win::ScopedHandle process_token(process_token_handle);
// Create impersonation low integrity token.
HANDLE impersonation_token_handle = NULL;
ok = ::DuplicateTokenEx(process_token,
@ -322,7 +323,7 @@ BOOL LowIntegrityToken::Impersonate() {
// TODO(stoyan): sandbox/src/restricted_token_utils.cc has
// SetTokenIntegrityLevel function already.
ScopedHandle impersonation_token(impersonation_token_handle);
base::win::ScopedHandle impersonation_token(impersonation_token_handle);
PSID integrity_sid = NULL;
TOKEN_MANDATORY_LABEL tml = {0};
ok = ::ConvertStringSidToSid(SDDL_ML_LOW, &integrity_sid);
@ -540,7 +541,7 @@ CloseIeAtEndOfScope::~CloseIeAtEndOfScope() {
bool DetectRunningCrashService(int timeout_ms) {
// Wait for the crash_service.exe to be ready for clients.
base::Time start = base::Time::Now();
ScopedHandle new_pipe;
base::win::ScopedHandle new_pipe;
while (true) {
new_pipe.Set(::CreateFile(kCrashServicePipeName,

@ -1,14 +1,14 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome_frame/dll_redirector.h"
#include "base/scoped_handle.h"
#include "base/shared_memory.h"
#include "base/sys_info.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
#include "base/win/scoped_handle.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "gtest/gtest.h"
@ -27,8 +27,6 @@ const uint32 kSharedMemorySize = 128;
// before failing.
const uint32 kWaitTestTimeout = 20000;
using base::win::ScopedHandle;
class MockDllRedirector : public DllRedirector {
public:
explicit MockDllRedirector(const char* beacon_name)
@ -231,8 +229,8 @@ TEST_F(DllRedirectorTest, TestBeaconOwnershipHandoff) {
}
struct LockSquattingThreadParams {
ScopedHandle is_squatting;
ScopedHandle time_to_die;
base::win::ScopedHandle is_squatting;
base::win::ScopedHandle time_to_die;
};
DWORD WINAPI LockSquattingThread(void* in_params) {
@ -268,7 +266,7 @@ TEST_F(DllRedirectorTest, LockSquatting) {
params.is_squatting.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
params.time_to_die.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
DWORD tid = 0;
ScopedHandle lock_squat_thread(
base::win::ScopedHandle lock_squat_thread(
::CreateThread(NULL, 0, LockSquattingThread, &params, 0, &tid));
// Make sure the squatter has started squatting.

@ -1,14 +1,14 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome_frame/test/ie_event_sink.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_bstr.h"
#include "base/win/scoped_handle.h"
#include "base/win/scoped_variant.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -147,9 +147,8 @@ void IEEventSink::Uninitialize() {
web_browser2_->Quit();
}
ScopedHandle process;
process.Set(OpenProcess(SYNCHRONIZE, FALSE,
ie_process_id_));
base::win::ScopedHandle process;
process.Set(OpenProcess(SYNCHRONIZE, FALSE, ie_process_id_));
web_browser2_.Release();
if (!process.IsValid()) {

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -21,6 +21,7 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/platform_thread.h"
#include "base/win/scoped_handle.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/prefs/browser_prefs.h"
@ -279,7 +280,7 @@ void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() {
kTestServerPort).c_str());
// Launch IE. This launches IE correctly on Vista too.
ScopedHandle ie_process(chrome_frame_test::LaunchIE(url));
base::win::ScopedHandle ie_process(chrome_frame_test::LaunchIE(url));
EXPECT_TRUE(ie_process.IsValid());
// NOTE: If you're running IE8 and CF is not being loaded, you need to

@ -1,22 +1,22 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
#define CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
#pragma once
#include <string>
#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/win/scoped_handle.h"
#include "chrome/app/scoped_ole_initializer.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/browser_thread.h"
#include "chrome_frame/test/test_server.h"
#include "chrome_frame/test/net/test_automation_provider.h"
#include "chrome_frame/test/net/process_singleton_subclass.h"
#include "net/base/net_test_suite.h"
class ProcessSingleton;
@ -87,7 +87,7 @@ class CFUrlRequestUnittestRunner
protected:
protected:
ScopedHandle test_thread_;
base::win::ScopedHandle test_thread_;
DWORD test_thread_id_;
scoped_ptr<test_server::SimpleWebServer> test_http_server_;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/path_service.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "chrome_frame/test/test_server.h"
#include "net/base/cookie_monster.h"
#include "net/base/host_resolver_proc.h"
@ -192,7 +192,8 @@ TEST_F(TestServerTest, TestServer) {
UrlTaskChain goog_task("http://localhost:1337/goog", &file_task);
DWORD tid = 0;
ScopedHandle worker(::CreateThread(NULL, 0, FetchUrl, &goog_task, 0, &tid));
base::win::ScopedHandle worker(::CreateThread(
NULL, 0, FetchUrl, &goog_task, 0, &tid));
loop.MessageLoop::Run();
EXPECT_FALSE(quit_msg.hit_);

@ -1,9 +1,10 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
#define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
#pragma once
#include <windows.h>
#include <string>
@ -11,6 +12,7 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "chrome_frame/test/http_server.h"
#include "chrome_frame/test/test_server.h"
@ -216,7 +218,7 @@ class ChromeFrameTestWithWebServer: public testing::Test {
BrowserKind browser_;
FilePath results_dir_;
ScopedHandle browser_handle_;
base::win::ScopedHandle browser_handle_;
// The on-disk path to our html test files.
FilePath test_file_path_;

@ -1,4 +1,4 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -6,6 +6,7 @@
#include <atlcom.h>
#include "base/scoped_comptr_win.h"
#include "base/win/scoped_handle.h"
#include "base/threading/thread.h"
#include "chrome_frame/bho.h"
//#include "chrome_frame/urlmon_moniker.h"
@ -82,7 +83,7 @@ class RunTestServer : public base::Thread {
protected:
scoped_ptr<test_server::SimpleWebServer> server_;
test_server::SimpleResponse default_response_;
ScopedHandle ready_;
base::win::ScopedHandle ready_;
};
// Helper class for running tests that rely on the NavigationManager.

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -13,8 +13,8 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/win/scoped_handle.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -177,10 +177,10 @@ bool GetCommandLineForProcess(uint32 process_id, std::wstring* cmd_line) {
DCHECK(cmd_line);
// Open the process
ScopedHandle process_handle(::OpenProcess(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
false,
process_id));
base::win::ScopedHandle process_handle(::OpenProcess(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
false,
process_id));
if (!process_handle) {
DLOG(ERROR) << "Failed to open process " << process_id << ", last error = "
<< GetLastError();

@ -1,12 +1,14 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome_frame/vtable_patch_manager.h"
#include <unknwn.h>
#include "base/message_loop.h"
#include "base/threading/thread.h"
#include "base/scoped_handle.h"
#include "base/win/scoped_handle.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
@ -209,7 +211,7 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) {
base::Thread background("Background Test Thread");
EXPECT_TRUE(background.Start());
ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
// Grab the patch lock.
vtable_patch::patch_lock_.Acquire();

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -6,8 +6,8 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/win/scoped_handle.h"
#include "gfx/size.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkBitmap.h"
@ -197,7 +197,7 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap,
return false;
// We start by creating the file.
ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(),
base::win::ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(),
GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
if (icon_file.Get() == INVALID_HANDLE_VALUE)

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/threading/non_thread_safe.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message_utils.h"
@ -29,7 +30,7 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) {
HANDLE token = NULL;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
return false;
ScopedHandle token_scoped(token);
base::win::ScopedHandle token_scoped(token);
// Get the size of the TokenGroups structure.
DWORD size = 0;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -9,7 +9,7 @@
#include <mmsystem.h>
#include "base/basictypes.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@ -93,7 +93,7 @@ class PCMWaveInAudioInputStream : public AudioInputStream {
WAVEHDR* buffer_;
// An event that is signaled when the callback thread is ready to stop.
ScopedHandle stopped_event_;
base::win::ScopedHandle stopped_event_;
DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream);
};

@ -1,16 +1,17 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
#define MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
#pragma once
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
#include "base/basictypes.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@ -110,7 +111,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream {
WAVEHDR* buffer_;
// An event that is signaled when the callback thread is ready to stop.
ScopedHandle stopped_event_;
base::win::ScopedHandle stopped_event_;
DISALLOW_COPY_AND_ASSIGN(PCMWaveOutAudioOutputStream);
};

@ -1,4 +1,4 @@
// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -20,6 +20,10 @@
#include "net/disk_cache/mem_backend_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
#include "base/win/scoped_handle.h"
#endif
using base::Time;
// Tests that can run with different types of caches.
@ -1929,8 +1933,8 @@ TEST_F(DiskCacheBackendTest, FileSharing) {
#if defined(OS_WIN)
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD access = GENERIC_READ | GENERIC_WRITE;
ScopedHandle file2(CreateFile(name.value().c_str(), access, sharing, NULL,
OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file2(CreateFile(
name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
EXPECT_FALSE(file2.IsValid());
sharing |= FILE_SHARE_DELETE;

@ -1,4 +1,4 @@
// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -6,9 +6,10 @@
#include <windows.h>
#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/file_util.h"
#include "base/win/scoped_handle.h"
namespace {
@ -66,8 +67,8 @@ bool DeleteCacheFile(const FilePath& name) {
// us from opening the file again (unless it was deleted).
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
DWORD access = SYNCHRONIZE;
ScopedHandle file(CreateFile(name.value().c_str(), access, sharing, NULL,
OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file(CreateFile(
name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
if (file.IsValid())
return false;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -20,7 +20,7 @@
#include "net/base/net_util.h"
#if defined(OS_WIN)
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#endif
class CommandLine;
@ -177,13 +177,13 @@ class TestServer {
#if defined(OS_WIN)
// JobObject used to clean up orphaned child processes.
ScopedHandle job_handle_;
base::win::ScopedHandle job_handle_;
// The pipe file handle we read from.
ScopedHandle child_read_fd_;
base::win::ScopedHandle child_read_fd_;
// The pipe file handle the child and we write to.
ScopedHandle child_write_fd_;
base::win::ScopedHandle child_write_fd_;
#endif
#if defined(OS_POSIX)

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -17,6 +17,7 @@
#include "base/test/test_timeouts.h"
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#pragma comment(lib, "crypt32.lib")
@ -25,7 +26,7 @@ namespace {
bool LaunchTestServerAsJob(const CommandLine& cmdline,
bool start_hidden,
base::ProcessHandle* process_handle,
ScopedHandle* job_handle) {
base::win::ScopedHandle* job_handle) {
// Launch test server process.
STARTUPINFO startup_info = {0};
startup_info.cb = sizeof(startup_info);
@ -191,8 +192,8 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) {
}
bool TestServer::WaitToStart() {
ScopedHandle read_fd(child_read_fd_.Take());
ScopedHandle write_fd(child_write_fd_.Take());
base::win::ScopedHandle read_fd(child_read_fd_.Take());
base::win::ScopedHandle write_fd(child_write_fd_.Take());
uint32 server_data_len = 0;
if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len),

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -11,10 +11,9 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/process_util.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/win/scoped_handle.h"
#include "net/disk_cache/disk_format.h"
enum Errors {
@ -156,7 +155,7 @@ int main(int argc, const char* argv[]) {
if (command_line.HasSwitch(kSlave) && slave_required)
return RunSlave(input_path, pipe_number);
ScopedHandle server;
base::win::ScopedHandle server;
if (slave_required) {
server.Set(CreateServer(&pipe_number));
if (!server.IsValid()) {

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -9,6 +9,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/threading/thread.h"
#include "base/win/scoped_handle.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
@ -912,7 +913,7 @@ int CopyCache(const std::wstring& output_path, HANDLE pipe, bool copy_to_text) {
int RunSlave(const std::wstring& input_path, const std::wstring& pipe_number) {
MessageLoop loop(MessageLoop::TYPE_IO);
ScopedHandle pipe(OpenServer(pipe_number));
base::win::ScopedHandle pipe(OpenServer(pipe_number));
if (!pipe.IsValid()) {
printf("Unable to open the server pipe\n");
return -1;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -12,7 +12,6 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/scoped_handle_win.h"
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "base/win/scoped_hdc.h"

@ -1,13 +1,14 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include <cctype>
#include <windows.h>
#include <winioctl.h>
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/nt_internals.h"
#include "sandbox/src/sandbox.h"
#include "sandbox/src/sandbox_factory.h"
@ -35,19 +36,20 @@ SBOX_TESTS_COMMAND int File_Create(int argc, wchar_t **argv) {
bool read = (_wcsicmp(argv[0], L"Read") == 0);
if (read) {
ScopedHandle file1(CreateFile(argv[1], GENERIC_READ, kSharing, NULL,
OPEN_EXISTING, 0, NULL));
ScopedHandle file2(CreateFile(argv[1], FILE_EXECUTE, kSharing, NULL,
OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file1(CreateFile(
argv[1], GENERIC_READ, kSharing, NULL, OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file2(CreateFile(
argv[1], FILE_EXECUTE, kSharing, NULL, OPEN_EXISTING, 0, NULL));
if (file1.Get() && file2.Get())
return SBOX_TEST_SUCCEEDED;
return SBOX_TEST_DENIED;
} else {
ScopedHandle file1(CreateFile(argv[1], GENERIC_ALL, kSharing, NULL,
OPEN_EXISTING, 0, NULL));
ScopedHandle file2(CreateFile(argv[1], GENERIC_READ | FILE_WRITE_DATA,
kSharing, NULL, OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file1(CreateFile(
argv[1], GENERIC_ALL, kSharing, NULL, OPEN_EXISTING, 0, NULL));
base::win::ScopedHandle file2(CreateFile(
argv[1], GENERIC_READ | FILE_WRITE_DATA, kSharing, NULL, OPEN_EXISTING,
0, NULL));
if (file1.Get() && file2.Get())
return SBOX_TEST_SUCCEEDED;

@ -1,4 +1,4 @@
// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -7,7 +7,7 @@
#include "sandbox/src/filesystem_policy.h"
#include "base/logging.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/ipc_tags.h"
#include "sandbox/src/policy_engine_opcodes.h"
#include "sandbox/src/policy_params.h"
@ -363,7 +363,7 @@ bool FileSystemPolicy::SetInformationFileAction(
return true;
}
ScopedHandle handle(local_handle);
base::win::ScopedHandle handle(local_handle);
FILE_INFORMATION_CLASS file_info_class =
static_cast<FILE_INFORMATION_CLASS>(info_class);

@ -1,17 +1,17 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <memory>
#include <string>
#include "base/scoped_handle_win.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/sandbox.h"
#include "sandbox/src/sandbox_policy.h"
#include "sandbox/src/sandbox_factory.h"
#include "sandbox/src/sandbox_utils.h"
#include "sandbox/tests/common/controller.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@ -178,14 +178,14 @@ SBOX_TESTS_COMMAND int Process_GetChildProcessToken(int argc, wchar_t **argv) {
return SBOX_TEST_FAILED;
}
ScopedHandle process(pi.hProcess);
ScopedHandle thread(pi.hThread);
base::win::ScopedHandle process(pi.hProcess);
base::win::ScopedHandle thread(pi.hThread);
HANDLE token = NULL;
BOOL result = ::OpenProcessToken(process.Get(), TOKEN_IMPERSONATE, &token);
DWORD error = ::GetLastError();
ScopedHandle token_handle(token);
base::win::ScopedHandle token_handle(token);
if (!::TerminateProcess(process.Get(), 0))
return SBOX_TEST_FAILED;

@ -1,10 +1,10 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sandbox/src/registry_dispatcher.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "sandbox/src/crosscall_client.h"
#include "sandbox/src/interception.h"
@ -74,7 +74,7 @@ bool RegistryDispatcher::SetupService(InterceptionManager* manager,
bool RegistryDispatcher::NtCreateKey(
IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root,
DWORD desired_access, DWORD title_index, DWORD create_options) {
ScopedHandle root_handle;
base::win::ScopedHandle root_handle;
std::wstring real_path = *name;
// If there is a root directory, we need to duplicate the handle to make
@ -120,7 +120,7 @@ bool RegistryDispatcher::NtCreateKey(
bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, std::wstring* name,
DWORD attributes, HANDLE root,
DWORD desired_access) {
ScopedHandle root_handle;
base::win::ScopedHandle root_handle;
std::wstring real_path = *name;
// If there is a root directory, we need to duplicate the handle to make

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -9,7 +9,7 @@
#include "sandbox/src/restricted_token_utils.h"
#include "base/logging.h"
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "sandbox/src/job.h"
#include "sandbox/src/restricted_token.h"
@ -166,7 +166,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
if (ERROR_SUCCESS != err_code) {
return err_code;
}
ScopedHandle primary_token(primary_token_handle);
base::win::ScopedHandle primary_token(primary_token_handle);
// Create the impersonation token (restricted) to be able to start the
// process.
@ -178,7 +178,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
if (ERROR_SUCCESS != err_code) {
return err_code;
}
ScopedHandle impersonation_token(impersonation_token_handle);
base::win::ScopedHandle impersonation_token(impersonation_token_handle);
// Start the process
STARTUPINFO startup_info = {0};
@ -198,8 +198,8 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
return ::GetLastError();
}
ScopedHandle thread_handle(process_info.hThread);
ScopedHandle process_handle(process_info.hProcess);
base::win::ScopedHandle thread_handle(process_info.hThread);
base::win::ScopedHandle process_handle(process_info.hProcess);
// Change the token of the main thread of the new process for the
// impersonation token with more rights.
@ -335,10 +335,9 @@ DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {
&token_handle))
return ::GetLastError();
ScopedHandle token(token_handle);
base::win::ScopedHandle token(token_handle);
return SetTokenIntegrityLevel(token.Get(), integrity_level);
}
} // namespace sandbox

@ -1,14 +1,14 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/scoped_handle_win.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/sandbox.h"
#include "sandbox/src/sandbox_policy.h"
#include "sandbox/src/sandbox_factory.h"
#include "sandbox/src/nt_internals.h"
#include "sandbox/tests/common/controller.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace sandbox {
@ -20,7 +20,8 @@ SBOX_TESTS_COMMAND int Event_Open(int argc, wchar_t **argv) {
if (L'f' == argv[0][0])
desired_access = EVENT_ALL_ACCESS;
ScopedHandle event_open(::OpenEvent(desired_access, FALSE, argv[1]));
base::win::ScopedHandle event_open(::OpenEvent(
desired_access, FALSE, argv[1]));
DWORD error_open = ::GetLastError();
if (event_open.Get())
@ -48,10 +49,10 @@ SBOX_TESTS_COMMAND int Event_CreateOpen(int argc, wchar_t **argv) {
if (L't' == argv[1][0])
initial_state = TRUE;
ScopedHandle event_create(::CreateEvent(NULL, manual_reset, initial_state,
event_name));
base::win::ScopedHandle event_create(::CreateEvent(
NULL, manual_reset, initial_state, event_name));
DWORD error_create = ::GetLastError();
ScopedHandle event_open;
base::win::ScopedHandle event_open;
if (event_name)
event_open.Set(::OpenEvent(EVENT_ALL_ACCESS, FALSE, event_name));
@ -124,10 +125,10 @@ TEST(SyncPolicyTest, TestEventReadOnly) {
TargetPolicy::EVENTS_ALLOW_READONLY,
L"test6"));
ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1"));
ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2"));
ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3"));
ScopedHandle handle4(::CreateEvent(NULL, FALSE, FALSE, L"test4"));
base::win::ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1"));
base::win::ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2"));
base::win::ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3"));
base::win::ScopedHandle handle4(::CreateEvent(NULL, FALSE, FALSE, L"test4"));
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_CreateOpen f f"));
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_CreateOpen t f"));

@ -1,13 +1,13 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/scoped_handle_win.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/sandbox.h"
#include "sandbox/src/sandbox_factory.h"
#include "sandbox/src/target_services.h"
#include "sandbox/tests/common/controller.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace sandbox {
@ -36,7 +36,7 @@ SBOX_TESTS_COMMAND int SimpleOpenEvent(int argc, wchar_t **argv) {
if (argc != 1)
return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0]));
base::win::ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0]));
return event_open.Get() ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED;
}
@ -73,7 +73,8 @@ TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) {
sandbox::TargetPolicy* policy = runner.GetPolicy();
policy->AddDllToUnload(L"avicap32.dll");
ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"tst0001"));
base::win::ScopedHandle handle1(::CreateEvent(
NULL, FALSE, FALSE, L"tst0001"));
// Add a couple of rules that ensures that the interception agent add EAT
// patching on the client which makes sure that the unload dll record does

@ -1,10 +1,10 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <windows.h>
#include "base/scoped_handle_win.h"
#include "base/win/scoped_handle.h"
#include "sandbox/src/win_utils.h"
#include "sandbox/tests/common/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -67,8 +67,9 @@ TEST(WinUtils, SameObject) {
std::wstring folder(my_folder);
std::wstring file_name = folder + L"\\foo.txt";
const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
ScopedHandle file(CreateFile(file_name.c_str(), GENERIC_WRITE, kSharing, NULL,
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL));
base::win::ScopedHandle file(CreateFile(
file_name.c_str(), GENERIC_WRITE, kSharing, NULL, CREATE_ALWAYS,
FILE_FLAG_DELETE_ON_CLOSE, NULL));
EXPECT_TRUE(file.IsValid());
std::wstring file_name_nt1 = std::wstring(L"\\??\\") + file_name;