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:
app/win
base
file_util_unittest.ccmessage_loop_unittest.ccmessage_pump_win.hscoped_handle.hscoped_handle_win.h
test
win
ceee
chrome
browser
aeropeek_manager.ccenumerate_modules_model_win.cc
importer
memory_details_win.ccprocess_singleton_win.cctab_contents
common
installer
service
utility
chrome_frame
crash_reporting
test
chrome_frame_test_utils.ccdll_redirector_test.ccie_event_sink.cc
test_utils.ccvtable_patch_manager_unittest.ccnet
test_server_test.cctest_with_web_server.hurlmon_moniker_integration_test.ccgfx
ipc
media/audio/win
net
disk_cache
test
tools
dump_cache
printing
sandbox/src
@@ -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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "base/i18n/rtl.h"
|
#include "base/i18n/rtl.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/scoped_handle.h"
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/win/scoped_gdi_object.h"
|
#include "base/win/scoped_gdi_object.h"
|
||||||
#include "base/win/scoped_hdc.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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/scoped_temp_dir.h"
|
#include "base/scoped_temp_dir.h"
|
||||||
#include "base/threading/platform_thread.h"
|
#include "base/threading/platform_thread.h"
|
||||||
#include "base/time.h"
|
#include "base/time.h"
|
||||||
@@ -27,6 +26,10 @@
|
|||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "testing/platform_test.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.
|
// This macro helps avoid wrapped lines in the test structs.
|
||||||
#define FPL(x) FILE_PATH_LITERAL(x)
|
#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"));
|
FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
|
||||||
ASSERT_TRUE(file_util::CreateDirectory(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(),
|
::CreateFile(to_sub_a.value().c_str(),
|
||||||
FILE_ALL_ACCESS,
|
FILE_ALL_ACCESS,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
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"));
|
FilePath to_base_b = base_b.Append(FPL("to_base_b"));
|
||||||
ASSERT_TRUE(file_util::CreateDirectory(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(),
|
::CreateFile(to_base_b.value().c_str(),
|
||||||
FILE_ALL_ACCESS,
|
FILE_ALL_ACCESS,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
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"));
|
FilePath to_sub_long = base_b.Append(FPL("to_sub_long"));
|
||||||
ASSERT_TRUE(file_util::CreateDirectory(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(),
|
::CreateFile(to_sub_long.value().c_str(),
|
||||||
FILE_ALL_ACCESS,
|
FILE_ALL_ACCESS,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/message_pump_win.h"
|
#include "base/message_pump_win.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(OS_POSIX)
|
#if defined(OS_POSIX)
|
||||||
#include "base/message_pump_libevent.h"
|
#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;
|
options.message_loop_type = message_loop_type;
|
||||||
ASSERT_EQ(true, worker.StartWithOptions(options));
|
ASSERT_EQ(true, worker.StartWithOptions(options));
|
||||||
TaskList order;
|
TaskList order;
|
||||||
ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
|
base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
|
||||||
worker.message_loop()->PostTask(FROM_HERE,
|
worker.message_loop()->PostTask(FROM_HERE,
|
||||||
new Recursive2Tasks(MessageLoop::current(),
|
new Recursive2Tasks(MessageLoop::current(),
|
||||||
event,
|
event,
|
||||||
@@ -980,7 +980,7 @@ void RunTest_RecursiveSupport2(MessageLoop::Type message_loop_type) {
|
|||||||
options.message_loop_type = message_loop_type;
|
options.message_loop_type = message_loop_type;
|
||||||
ASSERT_EQ(true, worker.StartWithOptions(options));
|
ASSERT_EQ(true, worker.StartWithOptions(options));
|
||||||
TaskList order;
|
TaskList order;
|
||||||
ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
|
base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
|
||||||
worker.message_loop()->PostTask(FROM_HERE,
|
worker.message_loop()->PostTask(FROM_HERE,
|
||||||
new Recursive2Tasks(MessageLoop::current(),
|
new Recursive2Tasks(MessageLoop::current(),
|
||||||
event,
|
event,
|
||||||
@@ -1187,7 +1187,7 @@ class TestIOHandler : public MessageLoopForIO::IOHandler {
|
|||||||
char buffer_[48];
|
char buffer_[48];
|
||||||
MessageLoopForIO::IOContext context_;
|
MessageLoopForIO::IOContext context_;
|
||||||
HANDLE signal_;
|
HANDLE signal_;
|
||||||
ScopedHandle file_;
|
base::win::ScopedHandle file_;
|
||||||
bool wait_;
|
bool wait_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void RunTest_IOHandler() {
|
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());
|
ASSERT_TRUE(callback_called.IsValid());
|
||||||
|
|
||||||
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
|
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
|
||||||
ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1,
|
base::win::ScopedHandle server(
|
||||||
0, 0, 0, NULL));
|
CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
|
||||||
ASSERT_TRUE(server.IsValid());
|
ASSERT_TRUE(server.IsValid());
|
||||||
|
|
||||||
Thread thread("IOHandler test");
|
Thread thread("IOHandler test");
|
||||||
@@ -1267,17 +1267,19 @@ void RunTest_IOHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RunTest_WaitForIO() {
|
void RunTest_WaitForIO() {
|
||||||
ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL));
|
base::win::ScopedHandle callback1_called(
|
||||||
ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL));
|
CreateEvent(NULL, TRUE, FALSE, NULL));
|
||||||
|
base::win::ScopedHandle callback2_called(
|
||||||
|
CreateEvent(NULL, TRUE, FALSE, NULL));
|
||||||
ASSERT_TRUE(callback1_called.IsValid());
|
ASSERT_TRUE(callback1_called.IsValid());
|
||||||
ASSERT_TRUE(callback2_called.IsValid());
|
ASSERT_TRUE(callback2_called.IsValid());
|
||||||
|
|
||||||
const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1";
|
const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1";
|
||||||
const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2";
|
const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2";
|
||||||
ScopedHandle server1(CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1,
|
base::win::ScopedHandle server1(
|
||||||
0, 0, 0, NULL));
|
CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
|
||||||
ScopedHandle server2(CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1,
|
base::win::ScopedHandle server2(
|
||||||
0, 0, 0, NULL));
|
CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
|
||||||
ASSERT_TRUE(server1.IsValid());
|
ASSERT_TRUE(server1.IsValid());
|
||||||
ASSERT_TRUE(server2.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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/message_pump.h"
|
#include "base/message_pump.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/time.h"
|
#include "base/time.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ class MessagePumpForIO : public MessagePumpWin {
|
|||||||
void DidProcessIOEvent();
|
void DidProcessIOEvent();
|
||||||
|
|
||||||
// The completion port associated with this thread.
|
// 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
|
// This list will be empty almost always. It stores IO completions that have
|
||||||
// not been delivered yet because somebody was doing cleanup.
|
// not been delivered yet because somebody was doing cleanup.
|
||||||
std::list<IOItem> completed_io_;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -10,10 +10,6 @@
|
|||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ScopedStdioHandle {
|
class ScopedStdioHandle {
|
||||||
public:
|
public:
|
||||||
ScopedStdioHandle()
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/threading/platform_thread.h"
|
#include "base/threading/platform_thread.h"
|
||||||
|
|
||||||
namespace file_util {
|
namespace file_util {
|
||||||
@@ -39,7 +39,7 @@ bool DieFileDie(const FilePath& file, bool recurse) {
|
|||||||
|
|
||||||
bool EvictFileFromSystemCache(const FilePath& file) {
|
bool EvictFileFromSystemCache(const FilePath& file) {
|
||||||
// Request exclusive access to the file and overwrite it with no buffering.
|
// 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,
|
CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||||
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
|
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
|
||||||
if (!file_handle)
|
if (!file_handle)
|
||||||
|
@@ -4,14 +4,16 @@
|
|||||||
//
|
//
|
||||||
// Unit tests for event trace consumer_ base class.
|
// Unit tests for event trace consumer_ base class.
|
||||||
#include "base/win/event_trace_consumer.h"
|
#include "base/win/event_trace_consumer.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#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_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.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 "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
#include <initguid.h> // NOLINT - has to be last
|
#include <initguid.h> // NOLINT - has to be last
|
||||||
@@ -63,14 +65,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
|
|||||||
::SetEvent(sank_event_.Get());
|
::SetEvent(sank_event_.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
static ScopedHandle sank_event_;
|
static base::win::ScopedHandle sank_event_;
|
||||||
static EventQueue events_;
|
static EventQueue events_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
|
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
|
||||||
};
|
};
|
||||||
|
|
||||||
ScopedHandle TestConsumer::sank_event_;
|
base::win::ScopedHandle TestConsumer::sank_event_;
|
||||||
EventQueue TestConsumer::events_;
|
EventQueue TestConsumer::events_;
|
||||||
|
|
||||||
const wchar_t* const kTestSessionName = L"TestLogSession";
|
const wchar_t* const kTestSessionName = L"TestLogSession";
|
||||||
@@ -175,8 +177,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestConsumer consumer_;
|
TestConsumer consumer_;
|
||||||
ScopedHandle consumer_ready_;
|
base::win::ScopedHandle consumer_ready_;
|
||||||
ScopedHandle consumer_thread_;
|
base::win::ScopedHandle consumer_thread_;
|
||||||
};
|
};
|
||||||
} // namespace
|
} // 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
//
|
//
|
||||||
// Unit tests for event trace controller.
|
// 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_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/sys_info.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 "testing/gtest/include/gtest/gtest.h"
|
||||||
#include <initguid.h> // NOLINT - must be last.
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ class TestingProvider: public EtwTraceProvider {
|
|||||||
::SetEvent(callback_event_.Get());
|
::SetEvent(callback_event_.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle callback_event_;
|
base::win::ScopedHandle callback_event_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/scoped_ptr.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
@@ -47,7 +47,7 @@ bool GetUserSidString(std::wstring* user_sid) {
|
|||||||
HANDLE token = NULL;
|
HANDLE token = NULL;
|
||||||
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
|
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||||
return false;
|
return false;
|
||||||
ScopedHandle token_scoped(token);
|
base::win::ScopedHandle token_scoped(token);
|
||||||
|
|
||||||
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
|
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
|
||||||
scoped_array<BYTE> user_bytes(new BYTE[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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
//
|
//
|
||||||
@@ -9,24 +9,23 @@
|
|||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "ceee/common/com_utils.h"
|
#include "ceee/common/com_utils.h"
|
||||||
|
|
||||||
|
|
||||||
namespace process_utils_win {
|
namespace process_utils_win {
|
||||||
|
|
||||||
HRESULT SetThreadIntegrityLevel(HANDLE* thread, const std::wstring& level) {
|
HRESULT SetThreadIntegrityLevel(HANDLE* thread, const std::wstring& level) {
|
||||||
HANDLE temp_handle = NULL;
|
HANDLE temp_handle = NULL;
|
||||||
BOOL success = ::OpenProcessToken(
|
BOOL success = ::OpenProcessToken(
|
||||||
::GetCurrentProcess(), MAXIMUM_ALLOWED, &temp_handle);
|
::GetCurrentProcess(), MAXIMUM_ALLOWED, &temp_handle);
|
||||||
ScopedHandle process_token(temp_handle);
|
base::win::ScopedHandle process_token(temp_handle);
|
||||||
temp_handle = NULL;
|
temp_handle = NULL;
|
||||||
if (success) {
|
if (success) {
|
||||||
success = ::DuplicateTokenEx(
|
success = ::DuplicateTokenEx(
|
||||||
process_token, MAXIMUM_ALLOWED, NULL, SecurityImpersonation,
|
process_token, MAXIMUM_ALLOWED, NULL, SecurityImpersonation,
|
||||||
TokenImpersonation, &temp_handle);
|
TokenImpersonation, &temp_handle);
|
||||||
ScopedHandle mic_token(temp_handle);
|
base::win::ScopedHandle mic_token(temp_handle);
|
||||||
temp_handle = NULL;
|
temp_handle = NULL;
|
||||||
if (success) {
|
if (success) {
|
||||||
PSID mic_sid = NULL;
|
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.
|
// 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
|
// This logic applies to Vista/Win7. The case of earlier systems is handled
|
||||||
// at the start.
|
// at the start.
|
||||||
ScopedHandle process_token(temp_handle);
|
base::win::ScopedHandle process_token(temp_handle);
|
||||||
TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
|
TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
|
||||||
DWORD variable_len_dummy = 0;
|
DWORD variable_len_dummy = 0;
|
||||||
if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type,
|
if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type,
|
||||||
@@ -331,4 +330,4 @@ void ProcessCompatibilityCheck::ResetState() {
|
|||||||
GetInstance()->StandardInitialize();
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
//
|
//
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "ceee/common/initializing_coclass.h"
|
#include "ceee/common/initializing_coclass.h"
|
||||||
#include "chrome_tab.h" // NOLINT
|
#include "chrome_tab.h" // NOLINT
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ class ATL_NO_VTABLE ChromeFrameHost
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// We use a cross process event to make sure there is only one chrome frame
|
// 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.
|
// host that returns ExtensionApisToAutomate... But only needed for a DCHECK.
|
||||||
ScopedHandle automating_extension_api_;
|
base::win::ScopedHandle automating_extension_api_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// A cached BSTR for the posted messages origin (which is kAutomationOrigin).
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
//
|
//
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "ceee/common/initializing_coclass.h"
|
#include "ceee/common/initializing_coclass.h"
|
||||||
#include "ceee/ie/plugin/toolband/toolband_proxy.h"
|
#include "ceee/ie/plugin/toolband/toolband_proxy.h"
|
||||||
@@ -159,7 +161,7 @@ class RemoteObjectHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RunSync(Task* task) {
|
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, task);
|
||||||
remote_thread_.message_loop()->PostTask(FROM_HERE,
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "app/win/shell.h"
|
#include "app/win/shell.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/scoped_comptr_win.h"
|
#include "base/scoped_comptr_win.h"
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#include "base/scoped_native_library.h"
|
#include "base/scoped_native_library.h"
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
#include "base/win/scoped_gdi_object.h"
|
#include "base/win/scoped_gdi_object.h"
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_version_info_win.h"
|
#include "base/file_version_info_win.h"
|
||||||
#include "base/metrics/histogram.h"
|
#include "base/metrics/histogram.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/sha2.h"
|
#include "base/sha2.h"
|
||||||
#include "base/string_number_conversions.h"
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/browser/net/service_providers_win.h"
|
#include "chrome/browser/net/service_providers_win.h"
|
||||||
#include "chrome/common/chrome_constants.h"
|
#include "chrome/common/chrome_constants.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
@@ -386,8 +386,8 @@ void ModuleEnumerator::ScanImpl() {
|
|||||||
|
|
||||||
void ModuleEnumerator::EnumerateLoadedModules() {
|
void ModuleEnumerator::EnumerateLoadedModules() {
|
||||||
// Get all modules in the current process.
|
// Get all modules in the current process.
|
||||||
ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
|
base::win::ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
|
||||||
::GetCurrentProcessId()));
|
::GetCurrentProcessId()));
|
||||||
if (!snap.Get())
|
if (!snap.Get())
|
||||||
return;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "chrome/browser/bookmarks/bookmark_model.h"
|
#include "chrome/browser/bookmarks/bookmark_model.h"
|
||||||
#include "chrome/browser/importer/importer_bridge.h"
|
#include "chrome/browser/importer/importer_bridge.h"
|
||||||
@@ -49,7 +50,7 @@ namespace {
|
|||||||
// Gets the creation time of the given file or directory.
|
// Gets the creation time of the given file or directory.
|
||||||
static Time GetFileCreationTime(const std::wstring& file) {
|
static Time GetFileCreationTime(const std::wstring& file) {
|
||||||
Time creation_time;
|
Time creation_time;
|
||||||
ScopedHandle file_handle(
|
base::win::ScopedHandle file_handle(
|
||||||
CreateFile(file.c_str(), GENERIC_READ,
|
CreateFile(file.c_str(), GENERIC_READ,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
NULL, OPEN_EXISTING,
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "chrome/browser/memory_details.h"
|
#include "chrome/browser/memory_details.h"
|
||||||
|
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
|
|
||||||
#include "app/l10n_util.h"
|
#include "app/l10n_util.h"
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
#include "base/file_version_info.h"
|
#include "base/file_version_info.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/utf_string_conversions.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_child_process_host.h"
|
||||||
#include "chrome/browser/browser_thread.h"
|
#include "chrome/browser/browser_thread.h"
|
||||||
#include "chrome/browser/renderer_host/backing_store_manager.h"
|
#include "chrome/browser/renderer_host/backing_store_manager.h"
|
||||||
@@ -74,7 +76,8 @@ void MemoryDetails::CollectProcessData(
|
|||||||
bool is_64bit_os =
|
bool is_64bit_os =
|
||||||
system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
|
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)};
|
PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)};
|
||||||
if (!snapshot.Get()) {
|
if (!snapshot.Get()) {
|
||||||
LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError();
|
LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError();
|
||||||
@@ -86,7 +89,7 @@ void MemoryDetails::CollectProcessData(
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
base::ProcessId pid = process_entry.th32ProcessID;
|
base::ProcessId pid = process_entry.th32ProcessID;
|
||||||
ScopedHandle handle(::OpenProcess(
|
base::win::ScopedHandle handle(::OpenProcess(
|
||||||
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
|
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
|
||||||
if (!handle.Get())
|
if (!handle.Get())
|
||||||
continue;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/extensions/extensions_startup.h"
|
#include "chrome/browser/extensions/extensions_startup.h"
|
||||||
#include "chrome/browser/platform_util.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
|
// since it isn't guaranteed we will get it. It is better to create it
|
||||||
// without ownership and explicitly get the ownership afterward.
|
// without ownership and explicitly get the ownership afterward.
|
||||||
std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!");
|
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();
|
DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError();
|
||||||
|
|
||||||
// This is how we acquire the mutex (as opposed to the initial ownership).
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -39,6 +39,10 @@
|
|||||||
#include "gfx/native_widget_types.h"
|
#include "gfx/native_widget_types.h"
|
||||||
#include "net/base/load_states.h"
|
#include "net/base/load_states.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
class Rect;
|
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
|
// 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
|
// equivalent constrained window). Plugin processes check this to know if
|
||||||
// they should pump messages then.
|
// they should pump messages then.
|
||||||
ScopedHandle message_box_active_;
|
base::win::ScopedHandle message_box_active_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The time that the last javascript message was dismissed.
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#include "base/string16.h"
|
#include "base/string16.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/win/object_watcher.h"
|
#include "base/win/object_watcher.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/win_util.h"
|
#include "base/win/win_util.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ class ServiceProcessShutdownMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScopedHandle shutdown_event_;
|
base::win::ScopedHandle shutdown_event_;
|
||||||
base::win::ObjectWatcher watcher_;
|
base::win::ObjectWatcher watcher_;
|
||||||
scoped_ptr<Task> shutdown_task_;
|
scoped_ptr<Task> shutdown_task_;
|
||||||
};
|
};
|
||||||
@@ -55,7 +55,7 @@ class ServiceProcessShutdownMonitor
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool ForceServiceProcessShutdown(const std::string& version) {
|
bool ForceServiceProcessShutdown(const std::string& version) {
|
||||||
ScopedHandle shutdown_event;
|
base::win::ScopedHandle shutdown_event;
|
||||||
std::string versioned_name = version;
|
std::string versioned_name = version;
|
||||||
versioned_name.append("_service_shutdown_evt");
|
versioned_name.append("_service_shutdown_evt");
|
||||||
string16 event_name =
|
string16 event_name =
|
||||||
@@ -69,7 +69,7 @@ bool ForceServiceProcessShutdown(const std::string& version) {
|
|||||||
|
|
||||||
bool CheckServiceProcessReady() {
|
bool CheckServiceProcessReady() {
|
||||||
string16 event_name = GetServiceProcessReadyEventName();
|
string16 event_name = GetServiceProcessReadyEventName();
|
||||||
ScopedHandle event(
|
base::win::ScopedHandle event(
|
||||||
OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str()));
|
OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str()));
|
||||||
if (!event.IsValid())
|
if (!event.IsValid())
|
||||||
return false;
|
return false;
|
||||||
@@ -79,7 +79,7 @@ bool CheckServiceProcessReady() {
|
|||||||
|
|
||||||
struct ServiceProcessState::StateData {
|
struct ServiceProcessState::StateData {
|
||||||
// An event that is signaled when a service process is ready.
|
// An event that is signaled when a service process is ready.
|
||||||
ScopedHandle ready_event;
|
base::win::ScopedHandle ready_event;
|
||||||
scoped_ptr<ServiceProcessShutdownMonitor> shutdown_monitor;
|
scoped_ptr<ServiceProcessShutdownMonitor> shutdown_monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ bool ServiceProcessState::TakeSingletonLock() {
|
|||||||
DCHECK(!state_);
|
DCHECK(!state_);
|
||||||
string16 event_name = GetServiceProcessReadyEventName();
|
string16 event_name = GetServiceProcessReadyEventName();
|
||||||
CHECK(event_name.length() <= MAX_PATH);
|
CHECK(event_name.length() <= MAX_PATH);
|
||||||
ScopedHandle service_process_ready_event;
|
base::win::ScopedHandle service_process_ready_event;
|
||||||
service_process_ready_event.Set(
|
service_process_ready_event.Set(
|
||||||
CreateEvent(NULL, TRUE, FALSE, event_name.c_str()));
|
CreateEvent(NULL, TRUE, FALSE, event_name.c_str()));
|
||||||
DWORD error = GetLastError();
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@
|
|||||||
#include "base/file_version_info.h"
|
#include "base/file_version_info.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#include "base/string_number_conversions.h"
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/win_util.h"
|
#include "base/win/win_util.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "breakpad/src/client/windows/handler/exception_handler.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.
|
// Use a ScopedHandle to keep track of and eventually close our handle.
|
||||||
// TODO(robertshield): Add a Receive() method to base's ScopedHandle.
|
// 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.
|
// Get the LUID for the shutdown privilege.
|
||||||
TOKEN_PRIVILEGES tkp = {0};
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
//
|
//
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/string_number_conversions.h"
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "chrome/common/result_codes.h"
|
#include "chrome/common/result_codes.h"
|
||||||
#include "chrome/common/chrome_constants.h"
|
#include "chrome/common/chrome_constants.h"
|
||||||
@@ -146,7 +146,7 @@ void CloseChromeFrameHelperProcess() {
|
|||||||
DWORD pid = 0;
|
DWORD pid = 0;
|
||||||
::GetWindowThreadProcessId(window, &pid);
|
::GetWindowThreadProcessId(window, &pid);
|
||||||
DCHECK_NE(pid, 0U);
|
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;
|
PLOG_IF(INFO, !process) << "Failed to open process: " << pid;
|
||||||
|
|
||||||
bool kill = true;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/installer/util/browser_distribution.h"
|
#include "chrome/installer/util/browser_distribution.h"
|
||||||
#include "chrome/installer/util/google_update_constants.h"
|
#include "chrome/installer/util/google_update_constants.h"
|
||||||
#include "chrome/installer/util/master_preferences.h"
|
#include "chrome/installer/util/master_preferences.h"
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "chrome/installer/util/util_constants.h"
|
#include "chrome/installer/util/util_constants.h"
|
||||||
|
|
||||||
using base::win::RegKey;
|
using base::win::RegKey;
|
||||||
using base::win::ScopedHandle;
|
|
||||||
using installer::ChromePackageProperties;
|
using installer::ChromePackageProperties;
|
||||||
using installer::ChromiumPackageProperties;
|
using installer::ChromiumPackageProperties;
|
||||||
using installer::Package;
|
using installer::Package;
|
||||||
@@ -72,8 +71,9 @@ TEST_F(PackageTest, Basic) {
|
|||||||
|
|
||||||
// Hold on to the file exclusively to prevent the directory from
|
// Hold on to the file exclusively to prevent the directory from
|
||||||
// being deleted.
|
// being deleted.
|
||||||
ScopedHandle file(::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
|
base::win::ScopedHandle file(
|
||||||
0, NULL, OPEN_ALWAYS, 0, NULL));
|
::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ,
|
||||||
|
0, NULL, OPEN_ALWAYS, 0, NULL));
|
||||||
EXPECT_TRUE(file.IsValid());
|
EXPECT_TRUE(file.IsValid());
|
||||||
EXPECT_TRUE(file_util::PathExists(old_chrome_dll));
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "chrome/installer/util/product_unittest.h"
|
#include "chrome/installer/util/product_unittest.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "chrome/installer/util/chrome_frame_distribution.h"
|
#include "chrome/installer/util/chrome_frame_distribution.h"
|
||||||
#include "chrome/installer/util/google_update_constants.h"
|
#include "chrome/installer/util/google_update_constants.h"
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
#include "chrome/installer/util/product.h"
|
#include "chrome/installer/util/product.h"
|
||||||
|
|
||||||
using base::win::RegKey;
|
using base::win::RegKey;
|
||||||
using base::win::ScopedHandle;
|
|
||||||
using installer::ChromePackageProperties;
|
using installer::ChromePackageProperties;
|
||||||
using installer::ChromiumPackageProperties;
|
using installer::ChromiumPackageProperties;
|
||||||
using installer::Package;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -17,6 +17,10 @@
|
|||||||
#include "printing/native_metafile.h"
|
#include "printing/native_metafile.h"
|
||||||
#include "printing/page_range.h"
|
#include "printing/page_range.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
|
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
|
||||||
Client* client, base::MessageLoopProxy* client_message_loop_proxy)
|
Client* client, base::MessageLoopProxy* client_message_loop_proxy)
|
||||||
: ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS),
|
: ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS),
|
||||||
@@ -50,7 +54,7 @@ bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
|
|||||||
if (!StartProcess(false, scratch_metafile_dir_->path()))
|
if (!StartProcess(false, scratch_metafile_dir_->path()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScopedHandle pdf_file(
|
base::win::ScopedHandle pdf_file(
|
||||||
::CreateFile(pdf_path.value().c_str(),
|
::CreateFile(pdf_path.value().c_str(),
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "app/win/iat_patch_function.h"
|
#include "app/win/iat_patch_function.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -204,7 +205,7 @@ bool UtilityThread::RenderPDFToWinMetafile(
|
|||||||
printing::NativeMetafile* metafile,
|
printing::NativeMetafile* metafile,
|
||||||
int* highest_rendered_page_number) {
|
int* highest_rendered_page_number) {
|
||||||
*highest_rendered_page_number = -1;
|
*highest_rendered_page_number = -1;
|
||||||
ScopedHandle file(pdf_file);
|
base::win::ScopedHandle file(pdf_file);
|
||||||
FilePath pdf_module_path;
|
FilePath pdf_module_path;
|
||||||
PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path);
|
PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path);
|
||||||
HMODULE pdf_module = GetModuleHandle(pdf_module_path.value().c_str());
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/file_version_info.h"
|
#include "base/file_version_info.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -277,8 +278,8 @@ class MinidumpTest: public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScopedHandle dump_file_handle_;
|
base::win::ScopedHandle dump_file_handle_;
|
||||||
ScopedHandle dump_file_mapping_;
|
base::win::ScopedHandle dump_file_mapping_;
|
||||||
void* dump_file_view_;
|
void* dump_file_view_;
|
||||||
|
|
||||||
FilePath dump_file_;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -10,12 +10,12 @@
|
|||||||
#include "base/at_exit.h"
|
#include "base/at_exit.h"
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/scoped_ptr.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/sys_info.h"
|
#include "base/sys_info.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome_frame/crash_reporting/crash_dll.h"
|
#include "chrome_frame/crash_reporting/crash_dll.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ TEST(NtLoader, OwnsCriticalSection) {
|
|||||||
other.message_loop()->PostTask(
|
other.message_loop()->PostTask(
|
||||||
FROM_HERE, NewRunnableFunction(::EnterCriticalSection, &cs));
|
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(
|
other.message_loop()->PostTask(
|
||||||
FROM_HERE, NewRunnableFunction(::SetEvent, event.Get()));
|
FROM_HERE, NewRunnableFunction(::SetEvent, event.Get()));
|
||||||
|
|
||||||
@@ -125,8 +125,8 @@ TEST(NtLoader, OwnsLoaderLock) {
|
|||||||
|
|
||||||
TEST(NtLoader, GetLoaderEntry) {
|
TEST(NtLoader, GetLoaderEntry) {
|
||||||
// Get all modules in the current process.
|
// Get all modules in the current process.
|
||||||
ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
|
base::win::ScopedHandle snap(
|
||||||
::GetCurrentProcessId()));
|
::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ::GetCurrentProcessId()));
|
||||||
EXPECT_TRUE(snap.Get() != NULL);
|
EXPECT_TRUE(snap.Get() != NULL);
|
||||||
|
|
||||||
// Walk them, while checking we get an entry for each, and that it
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -16,12 +16,12 @@
|
|||||||
#include "base/file_version_info.h"
|
#include "base/file_version_info.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/scoped_ptr.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "ceee/ie/common/ceee_util.h"
|
#include "ceee/ie/common/ceee_util.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
@@ -95,7 +95,8 @@ int CloseVisibleWindowsOnAllThreads(HANDLE process) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0));
|
base::win::ScopedHandle snapshot(
|
||||||
|
CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0));
|
||||||
if (!snapshot.IsValid()) {
|
if (!snapshot.IsValid()) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -309,7 +310,7 @@ BOOL LowIntegrityToken::Impersonate() {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle process_token(process_token_handle);
|
base::win::ScopedHandle process_token(process_token_handle);
|
||||||
// Create impersonation low integrity token.
|
// Create impersonation low integrity token.
|
||||||
HANDLE impersonation_token_handle = NULL;
|
HANDLE impersonation_token_handle = NULL;
|
||||||
ok = ::DuplicateTokenEx(process_token,
|
ok = ::DuplicateTokenEx(process_token,
|
||||||
@@ -322,7 +323,7 @@ BOOL LowIntegrityToken::Impersonate() {
|
|||||||
|
|
||||||
// TODO(stoyan): sandbox/src/restricted_token_utils.cc has
|
// TODO(stoyan): sandbox/src/restricted_token_utils.cc has
|
||||||
// SetTokenIntegrityLevel function already.
|
// SetTokenIntegrityLevel function already.
|
||||||
ScopedHandle impersonation_token(impersonation_token_handle);
|
base::win::ScopedHandle impersonation_token(impersonation_token_handle);
|
||||||
PSID integrity_sid = NULL;
|
PSID integrity_sid = NULL;
|
||||||
TOKEN_MANDATORY_LABEL tml = {0};
|
TOKEN_MANDATORY_LABEL tml = {0};
|
||||||
ok = ::ConvertStringSidToSid(SDDL_ML_LOW, &integrity_sid);
|
ok = ::ConvertStringSidToSid(SDDL_ML_LOW, &integrity_sid);
|
||||||
@@ -540,7 +541,7 @@ CloseIeAtEndOfScope::~CloseIeAtEndOfScope() {
|
|||||||
bool DetectRunningCrashService(int timeout_ms) {
|
bool DetectRunningCrashService(int timeout_ms) {
|
||||||
// Wait for the crash_service.exe to be ready for clients.
|
// Wait for the crash_service.exe to be ready for clients.
|
||||||
base::Time start = base::Time::Now();
|
base::Time start = base::Time::Now();
|
||||||
ScopedHandle new_pipe;
|
base::win::ScopedHandle new_pipe;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
new_pipe.Set(::CreateFile(kCrashServicePipeName,
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "chrome_frame/dll_redirector.h"
|
#include "chrome_frame/dll_redirector.h"
|
||||||
|
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/shared_memory.h"
|
#include "base/shared_memory.h"
|
||||||
#include "base/sys_info.h"
|
#include "base/sys_info.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome_frame/test/chrome_frame_test_utils.h"
|
#include "chrome_frame/test/chrome_frame_test_utils.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
@@ -27,8 +27,6 @@ const uint32 kSharedMemorySize = 128;
|
|||||||
// before failing.
|
// before failing.
|
||||||
const uint32 kWaitTestTimeout = 20000;
|
const uint32 kWaitTestTimeout = 20000;
|
||||||
|
|
||||||
using base::win::ScopedHandle;
|
|
||||||
|
|
||||||
class MockDllRedirector : public DllRedirector {
|
class MockDllRedirector : public DllRedirector {
|
||||||
public:
|
public:
|
||||||
explicit MockDllRedirector(const char* beacon_name)
|
explicit MockDllRedirector(const char* beacon_name)
|
||||||
@@ -231,8 +229,8 @@ TEST_F(DllRedirectorTest, TestBeaconOwnershipHandoff) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct LockSquattingThreadParams {
|
struct LockSquattingThreadParams {
|
||||||
ScopedHandle is_squatting;
|
base::win::ScopedHandle is_squatting;
|
||||||
ScopedHandle time_to_die;
|
base::win::ScopedHandle time_to_die;
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD WINAPI LockSquattingThread(void* in_params) {
|
DWORD WINAPI LockSquattingThread(void* in_params) {
|
||||||
@@ -268,7 +266,7 @@ TEST_F(DllRedirectorTest, LockSquatting) {
|
|||||||
params.is_squatting.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
|
params.is_squatting.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
|
||||||
params.time_to_die.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
|
params.time_to_die.Set(::CreateEvent(NULL, FALSE, FALSE, NULL));
|
||||||
DWORD tid = 0;
|
DWORD tid = 0;
|
||||||
ScopedHandle lock_squat_thread(
|
base::win::ScopedHandle lock_squat_thread(
|
||||||
::CreateThread(NULL, 0, LockSquattingThread, ¶ms, 0, &tid));
|
::CreateThread(NULL, 0, LockSquattingThread, ¶ms, 0, &tid));
|
||||||
|
|
||||||
// Make sure the squatter has started squatting.
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "chrome_frame/test/ie_event_sink.h"
|
#include "chrome_frame/test/ie_event_sink.h"
|
||||||
|
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "base/win/scoped_bstr.h"
|
#include "base/win/scoped_bstr.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/scoped_variant.h"
|
#include "base/win/scoped_variant.h"
|
||||||
#include "chrome_frame/test/chrome_frame_test_utils.h"
|
#include "chrome_frame/test/chrome_frame_test_utils.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -147,9 +147,8 @@ void IEEventSink::Uninitialize() {
|
|||||||
web_browser2_->Quit();
|
web_browser2_->Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle process;
|
base::win::ScopedHandle process;
|
||||||
process.Set(OpenProcess(SYNCHRONIZE, FALSE,
|
process.Set(OpenProcess(SYNCHRONIZE, FALSE, ie_process_id_));
|
||||||
ie_process_id_));
|
|
||||||
web_browser2_.Release();
|
web_browser2_.Release();
|
||||||
|
|
||||||
if (!process.IsValid()) {
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/threading/platform_thread.h"
|
#include "base/threading/platform_thread.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/browser/automation/automation_provider_list.h"
|
#include "chrome/browser/automation/automation_provider_list.h"
|
||||||
#include "chrome/browser/plugin_service.h"
|
#include "chrome/browser/plugin_service.h"
|
||||||
#include "chrome/browser/prefs/browser_prefs.h"
|
#include "chrome/browser/prefs/browser_prefs.h"
|
||||||
@@ -279,7 +280,7 @@ void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() {
|
|||||||
kTestServerPort).c_str());
|
kTestServerPort).c_str());
|
||||||
|
|
||||||
// Launch IE. This launches IE correctly on Vista too.
|
// 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());
|
EXPECT_TRUE(ie_process.IsValid());
|
||||||
|
|
||||||
// NOTE: If you're running IE8 and CF is not being loaded, you need to
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
|
#ifndef CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
|
||||||
#define CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
|
#define CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/app/scoped_ole_initializer.h"
|
#include "chrome/app/scoped_ole_initializer.h"
|
||||||
#include "chrome/browser/browser_process_impl.h"
|
#include "chrome/browser/browser_process_impl.h"
|
||||||
#include "chrome/browser/browser_thread.h"
|
#include "chrome/browser/browser_thread.h"
|
||||||
#include "chrome_frame/test/test_server.h"
|
#include "chrome_frame/test/test_server.h"
|
||||||
#include "chrome_frame/test/net/test_automation_provider.h"
|
#include "chrome_frame/test/net/test_automation_provider.h"
|
||||||
#include "chrome_frame/test/net/process_singleton_subclass.h"
|
#include "chrome_frame/test/net/process_singleton_subclass.h"
|
||||||
|
|
||||||
#include "net/base/net_test_suite.h"
|
#include "net/base/net_test_suite.h"
|
||||||
|
|
||||||
class ProcessSingleton;
|
class ProcessSingleton;
|
||||||
@@ -87,7 +87,7 @@ class CFUrlRequestUnittestRunner
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScopedHandle test_thread_;
|
base::win::ScopedHandle test_thread_;
|
||||||
DWORD test_thread_id_;
|
DWORD test_thread_id_;
|
||||||
|
|
||||||
scoped_ptr<test_server::SimpleWebServer> test_http_server_;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/path_service.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 "chrome_frame/test/test_server.h"
|
||||||
#include "net/base/cookie_monster.h"
|
#include "net/base/cookie_monster.h"
|
||||||
#include "net/base/host_resolver_proc.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);
|
UrlTaskChain goog_task("http://localhost:1337/goog", &file_task);
|
||||||
|
|
||||||
DWORD tid = 0;
|
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();
|
loop.MessageLoop::Run();
|
||||||
|
|
||||||
EXPECT_FALSE(quit_msg.hit_);
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
|
#ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
|
||||||
#define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
|
#define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/utf_string_conversions.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/chrome_frame_test_utils.h"
|
||||||
#include "chrome_frame/test/http_server.h"
|
#include "chrome_frame/test/http_server.h"
|
||||||
#include "chrome_frame/test/test_server.h"
|
#include "chrome_frame/test/test_server.h"
|
||||||
@@ -216,7 +218,7 @@ class ChromeFrameTestWithWebServer: public testing::Test {
|
|||||||
|
|
||||||
BrowserKind browser_;
|
BrowserKind browser_;
|
||||||
FilePath results_dir_;
|
FilePath results_dir_;
|
||||||
ScopedHandle browser_handle_;
|
base::win::ScopedHandle browser_handle_;
|
||||||
// The on-disk path to our html test files.
|
// The on-disk path to our html test files.
|
||||||
FilePath test_file_path_;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
|
|
||||||
#include "base/scoped_comptr_win.h"
|
#include "base/scoped_comptr_win.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "chrome_frame/bho.h"
|
#include "chrome_frame/bho.h"
|
||||||
//#include "chrome_frame/urlmon_moniker.h"
|
//#include "chrome_frame/urlmon_moniker.h"
|
||||||
@@ -82,7 +83,7 @@ class RunTestServer : public base::Thread {
|
|||||||
protected:
|
protected:
|
||||||
scoped_ptr<test_server::SimpleWebServer> server_;
|
scoped_ptr<test_server::SimpleWebServer> server_;
|
||||||
test_server::SimpleResponse default_response_;
|
test_server::SimpleResponse default_response_;
|
||||||
ScopedHandle ready_;
|
base::win::ScopedHandle ready_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper class for running tests that rely on the NavigationManager.
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -177,10 +177,10 @@ bool GetCommandLineForProcess(uint32 process_id, std::wstring* cmd_line) {
|
|||||||
DCHECK(cmd_line);
|
DCHECK(cmd_line);
|
||||||
|
|
||||||
// Open the process
|
// Open the process
|
||||||
ScopedHandle process_handle(::OpenProcess(
|
base::win::ScopedHandle process_handle(::OpenProcess(
|
||||||
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
|
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
|
||||||
false,
|
false,
|
||||||
process_id));
|
process_id));
|
||||||
if (!process_handle) {
|
if (!process_handle) {
|
||||||
DLOG(ERROR) << "Failed to open process " << process_id << ", last error = "
|
DLOG(ERROR) << "Failed to open process " << process_id << ", last error = "
|
||||||
<< GetLastError();
|
<< 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "chrome_frame/vtable_patch_manager.h"
|
#include "chrome_frame/vtable_patch_manager.h"
|
||||||
|
|
||||||
#include <unknwn.h>
|
#include <unknwn.h>
|
||||||
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
|
||||||
@@ -209,7 +211,7 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) {
|
|||||||
base::Thread background("Background Test Thread");
|
base::Thread background("Background Test Thread");
|
||||||
|
|
||||||
EXPECT_TRUE(background.Start());
|
EXPECT_TRUE(background.Start());
|
||||||
ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
|
base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
|
||||||
|
|
||||||
// Grab the patch lock.
|
// Grab the patch lock.
|
||||||
vtable_patch::patch_lock_.Acquire();
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/scoped_ptr.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "gfx/size.h"
|
#include "gfx/size.h"
|
||||||
#include "skia/ext/image_operations.h"
|
#include "skia/ext/image_operations.h"
|
||||||
#include "third_party/skia/include/core/SkBitmap.h"
|
#include "third_party/skia/include/core/SkBitmap.h"
|
||||||
@@ -197,7 +197,7 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We start by creating the file.
|
// 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));
|
GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
|
||||||
|
|
||||||
if (icon_file.Get() == INVALID_HANDLE_VALUE)
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/threading/non_thread_safe.h"
|
#include "base/threading/non_thread_safe.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "ipc/ipc_logging.h"
|
#include "ipc/ipc_logging.h"
|
||||||
#include "ipc/ipc_message_utils.h"
|
#include "ipc/ipc_message_utils.h"
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) {
|
|||||||
HANDLE token = NULL;
|
HANDLE token = NULL;
|
||||||
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
|
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||||
return false;
|
return false;
|
||||||
ScopedHandle token_scoped(token);
|
base::win::ScopedHandle token_scoped(token);
|
||||||
|
|
||||||
// Get the size of the TokenGroups structure.
|
// Get the size of the TokenGroups structure.
|
||||||
DWORD size = 0;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
||||||
#include "base/basictypes.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_io.h"
|
||||||
#include "media/audio/audio_parameters.h"
|
#include "media/audio/audio_parameters.h"
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class PCMWaveInAudioInputStream : public AudioInputStream {
|
|||||||
WAVEHDR* buffer_;
|
WAVEHDR* buffer_;
|
||||||
|
|
||||||
// An event that is signaled when the callback thread is ready to stop.
|
// 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);
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
|
#ifndef MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
|
||||||
#define MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
|
#define MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
|
||||||
#include "base/basictypes.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_io.h"
|
||||||
#include "media/audio/audio_parameters.h"
|
#include "media/audio/audio_parameters.h"
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream {
|
|||||||
WAVEHDR* buffer_;
|
WAVEHDR* buffer_;
|
||||||
|
|
||||||
// An event that is signaled when the callback thread is ready to stop.
|
// 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);
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
#include "net/disk_cache/mem_backend_impl.h"
|
#include "net/disk_cache/mem_backend_impl.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using base::Time;
|
using base::Time;
|
||||||
|
|
||||||
// Tests that can run with different types of caches.
|
// Tests that can run with different types of caches.
|
||||||
@@ -1929,8 +1933,8 @@ TEST_F(DiskCacheBackendTest, FileSharing) {
|
|||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
DWORD access = GENERIC_READ | GENERIC_WRITE;
|
DWORD access = GENERIC_READ | GENERIC_WRITE;
|
||||||
ScopedHandle file2(CreateFile(name.value().c_str(), access, sharing, NULL,
|
base::win::ScopedHandle file2(CreateFile(
|
||||||
OPEN_EXISTING, 0, NULL));
|
name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
|
||||||
EXPECT_FALSE(file2.IsValid());
|
EXPECT_FALSE(file2.IsValid());
|
||||||
|
|
||||||
sharing |= FILE_SHARE_DELETE;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,9 +6,10 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/file_util.h"
|
#include "base/win/scoped_handle.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -66,8 +67,8 @@ bool DeleteCacheFile(const FilePath& name) {
|
|||||||
// us from opening the file again (unless it was deleted).
|
// us from opening the file again (unless it was deleted).
|
||||||
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
|
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
|
||||||
DWORD access = SYNCHRONIZE;
|
DWORD access = SYNCHRONIZE;
|
||||||
ScopedHandle file(CreateFile(name.value().c_str(), access, sharing, NULL,
|
base::win::ScopedHandle file(CreateFile(
|
||||||
OPEN_EXISTING, 0, NULL));
|
name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
|
||||||
if (file.IsValid())
|
if (file.IsValid())
|
||||||
return false;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "net/base/net_util.h"
|
#include "net/base/net_util.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CommandLine;
|
class CommandLine;
|
||||||
@@ -177,13 +177,13 @@ class TestServer {
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// JobObject used to clean up orphaned child processes.
|
// JobObject used to clean up orphaned child processes.
|
||||||
ScopedHandle job_handle_;
|
base::win::ScopedHandle job_handle_;
|
||||||
|
|
||||||
// The pipe file handle we read from.
|
// 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.
|
// The pipe file handle the child and we write to.
|
||||||
ScopedHandle child_write_fd_;
|
base::win::ScopedHandle child_write_fd_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_POSIX)
|
#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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "base/test/test_timeouts.h"
|
#include "base/test/test_timeouts.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
|
|
||||||
#pragma comment(lib, "crypt32.lib")
|
#pragma comment(lib, "crypt32.lib")
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ namespace {
|
|||||||
bool LaunchTestServerAsJob(const CommandLine& cmdline,
|
bool LaunchTestServerAsJob(const CommandLine& cmdline,
|
||||||
bool start_hidden,
|
bool start_hidden,
|
||||||
base::ProcessHandle* process_handle,
|
base::ProcessHandle* process_handle,
|
||||||
ScopedHandle* job_handle) {
|
base::win::ScopedHandle* job_handle) {
|
||||||
// Launch test server process.
|
// Launch test server process.
|
||||||
STARTUPINFO startup_info = {0};
|
STARTUPINFO startup_info = {0};
|
||||||
startup_info.cb = sizeof(startup_info);
|
startup_info.cb = sizeof(startup_info);
|
||||||
@@ -191,8 +192,8 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TestServer::WaitToStart() {
|
bool TestServer::WaitToStart() {
|
||||||
ScopedHandle read_fd(child_read_fd_.Take());
|
base::win::ScopedHandle read_fd(child_read_fd_.Take());
|
||||||
ScopedHandle write_fd(child_write_fd_.Take());
|
base::win::ScopedHandle write_fd(child_write_fd_.Take());
|
||||||
|
|
||||||
uint32 server_data_len = 0;
|
uint32 server_data_len = 0;
|
||||||
if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len),
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -11,10 +11,9 @@
|
|||||||
#include "base/at_exit.h"
|
#include "base/at_exit.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "base/scoped_handle.h"
|
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "net/disk_cache/disk_format.h"
|
#include "net/disk_cache/disk_format.h"
|
||||||
|
|
||||||
enum Errors {
|
enum Errors {
|
||||||
@@ -156,7 +155,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
if (command_line.HasSwitch(kSlave) && slave_required)
|
if (command_line.HasSwitch(kSlave) && slave_required)
|
||||||
return RunSlave(input_path, pipe_number);
|
return RunSlave(input_path, pipe_number);
|
||||||
|
|
||||||
ScopedHandle server;
|
base::win::ScopedHandle server;
|
||||||
if (slave_required) {
|
if (slave_required) {
|
||||||
server.Set(CreateServer(&pipe_number));
|
server.Set(CreateServer(&pipe_number));
|
||||||
if (!server.IsValid()) {
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "base/string_number_conversions.h"
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
|
#include "base/win/scoped_handle.h"
|
||||||
#include "googleurl/src/gurl.h"
|
#include "googleurl/src/gurl.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
#include "net/base/test_completion_callback.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) {
|
int RunSlave(const std::wstring& input_path, const std::wstring& pipe_number) {
|
||||||
MessageLoop loop(MessageLoop::TYPE_IO);
|
MessageLoop loop(MessageLoop::TYPE_IO);
|
||||||
|
|
||||||
ScopedHandle pipe(OpenServer(pipe_number));
|
base::win::ScopedHandle pipe(OpenServer(pipe_number));
|
||||||
if (!pipe.IsValid()) {
|
if (!pipe.IsValid()) {
|
||||||
printf("Unable to open the server pipe\n");
|
printf("Unable to open the server pipe\n");
|
||||||
return -1;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/scoped_handle_win.h"
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/scoped_ptr.h"
|
||||||
#include "base/scoped_temp_dir.h"
|
#include "base/scoped_temp_dir.h"
|
||||||
#include "base/win/scoped_hdc.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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winioctl.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/nt_internals.h"
|
||||||
#include "sandbox/src/sandbox.h"
|
#include "sandbox/src/sandbox.h"
|
||||||
#include "sandbox/src/sandbox_factory.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);
|
bool read = (_wcsicmp(argv[0], L"Read") == 0);
|
||||||
|
|
||||||
if (read) {
|
if (read) {
|
||||||
ScopedHandle file1(CreateFile(argv[1], GENERIC_READ, kSharing, NULL,
|
base::win::ScopedHandle file1(CreateFile(
|
||||||
OPEN_EXISTING, 0, NULL));
|
argv[1], GENERIC_READ, kSharing, NULL, OPEN_EXISTING, 0, NULL));
|
||||||
ScopedHandle file2(CreateFile(argv[1], FILE_EXECUTE, kSharing, NULL,
|
base::win::ScopedHandle file2(CreateFile(
|
||||||
OPEN_EXISTING, 0, NULL));
|
argv[1], FILE_EXECUTE, kSharing, NULL, OPEN_EXISTING, 0, NULL));
|
||||||
|
|
||||||
if (file1.Get() && file2.Get())
|
if (file1.Get() && file2.Get())
|
||||||
return SBOX_TEST_SUCCEEDED;
|
return SBOX_TEST_SUCCEEDED;
|
||||||
return SBOX_TEST_DENIED;
|
return SBOX_TEST_DENIED;
|
||||||
} else {
|
} else {
|
||||||
ScopedHandle file1(CreateFile(argv[1], GENERIC_ALL, kSharing, NULL,
|
base::win::ScopedHandle file1(CreateFile(
|
||||||
OPEN_EXISTING, 0, NULL));
|
argv[1], GENERIC_ALL, kSharing, NULL, OPEN_EXISTING, 0, NULL));
|
||||||
ScopedHandle file2(CreateFile(argv[1], GENERIC_READ | FILE_WRITE_DATA,
|
base::win::ScopedHandle file2(CreateFile(
|
||||||
kSharing, NULL, OPEN_EXISTING, 0, NULL));
|
argv[1], GENERIC_READ | FILE_WRITE_DATA, kSharing, NULL, OPEN_EXISTING,
|
||||||
|
0, NULL));
|
||||||
|
|
||||||
if (file1.Get() && file2.Get())
|
if (file1.Get() && file2.Get())
|
||||||
return SBOX_TEST_SUCCEEDED;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "sandbox/src/filesystem_policy.h"
|
#include "sandbox/src/filesystem_policy.h"
|
||||||
|
|
||||||
#include "base/logging.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/ipc_tags.h"
|
||||||
#include "sandbox/src/policy_engine_opcodes.h"
|
#include "sandbox/src/policy_engine_opcodes.h"
|
||||||
#include "sandbox/src/policy_params.h"
|
#include "sandbox/src/policy_params.h"
|
||||||
@@ -363,7 +363,7 @@ bool FileSystemPolicy::SetInformationFileAction(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle handle(local_handle);
|
base::win::ScopedHandle handle(local_handle);
|
||||||
|
|
||||||
FILE_INFORMATION_CLASS file_info_class =
|
FILE_INFORMATION_CLASS file_info_class =
|
||||||
static_cast<FILE_INFORMATION_CLASS>(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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
|
||||||
#include "sandbox/src/sandbox.h"
|
#include "sandbox/src/sandbox.h"
|
||||||
#include "sandbox/src/sandbox_policy.h"
|
#include "sandbox/src/sandbox_policy.h"
|
||||||
#include "sandbox/src/sandbox_factory.h"
|
#include "sandbox/src/sandbox_factory.h"
|
||||||
#include "sandbox/src/sandbox_utils.h"
|
#include "sandbox/src/sandbox_utils.h"
|
||||||
#include "sandbox/tests/common/controller.h"
|
#include "sandbox/tests/common/controller.h"
|
||||||
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -178,14 +178,14 @@ SBOX_TESTS_COMMAND int Process_GetChildProcessToken(int argc, wchar_t **argv) {
|
|||||||
return SBOX_TEST_FAILED;
|
return SBOX_TEST_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle process(pi.hProcess);
|
base::win::ScopedHandle process(pi.hProcess);
|
||||||
ScopedHandle thread(pi.hThread);
|
base::win::ScopedHandle thread(pi.hThread);
|
||||||
|
|
||||||
HANDLE token = NULL;
|
HANDLE token = NULL;
|
||||||
BOOL result = ::OpenProcessToken(process.Get(), TOKEN_IMPERSONATE, &token);
|
BOOL result = ::OpenProcessToken(process.Get(), TOKEN_IMPERSONATE, &token);
|
||||||
DWORD error = ::GetLastError();
|
DWORD error = ::GetLastError();
|
||||||
|
|
||||||
ScopedHandle token_handle(token);
|
base::win::ScopedHandle token_handle(token);
|
||||||
|
|
||||||
if (!::TerminateProcess(process.Get(), 0))
|
if (!::TerminateProcess(process.Get(), 0))
|
||||||
return SBOX_TEST_FAILED;
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "sandbox/src/registry_dispatcher.h"
|
#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 "base/win/windows_version.h"
|
||||||
#include "sandbox/src/crosscall_client.h"
|
#include "sandbox/src/crosscall_client.h"
|
||||||
#include "sandbox/src/interception.h"
|
#include "sandbox/src/interception.h"
|
||||||
@@ -74,7 +74,7 @@ bool RegistryDispatcher::SetupService(InterceptionManager* manager,
|
|||||||
bool RegistryDispatcher::NtCreateKey(
|
bool RegistryDispatcher::NtCreateKey(
|
||||||
IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root,
|
IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root,
|
||||||
DWORD desired_access, DWORD title_index, DWORD create_options) {
|
DWORD desired_access, DWORD title_index, DWORD create_options) {
|
||||||
ScopedHandle root_handle;
|
base::win::ScopedHandle root_handle;
|
||||||
std::wstring real_path = *name;
|
std::wstring real_path = *name;
|
||||||
|
|
||||||
// If there is a root directory, we need to duplicate the handle to make
|
// 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,
|
bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, std::wstring* name,
|
||||||
DWORD attributes, HANDLE root,
|
DWORD attributes, HANDLE root,
|
||||||
DWORD desired_access) {
|
DWORD desired_access) {
|
||||||
ScopedHandle root_handle;
|
base::win::ScopedHandle root_handle;
|
||||||
std::wstring real_path = *name;
|
std::wstring real_path = *name;
|
||||||
|
|
||||||
// If there is a root directory, we need to duplicate the handle to make
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "sandbox/src/restricted_token_utils.h"
|
#include "sandbox/src/restricted_token_utils.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "sandbox/src/job.h"
|
#include "sandbox/src/job.h"
|
||||||
#include "sandbox/src/restricted_token.h"
|
#include "sandbox/src/restricted_token.h"
|
||||||
@@ -166,7 +166,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
|
|||||||
if (ERROR_SUCCESS != err_code) {
|
if (ERROR_SUCCESS != err_code) {
|
||||||
return 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
|
// Create the impersonation token (restricted) to be able to start the
|
||||||
// process.
|
// process.
|
||||||
@@ -178,7 +178,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
|
|||||||
if (ERROR_SUCCESS != err_code) {
|
if (ERROR_SUCCESS != err_code) {
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
ScopedHandle impersonation_token(impersonation_token_handle);
|
base::win::ScopedHandle impersonation_token(impersonation_token_handle);
|
||||||
|
|
||||||
// Start the process
|
// Start the process
|
||||||
STARTUPINFO startup_info = {0};
|
STARTUPINFO startup_info = {0};
|
||||||
@@ -198,8 +198,8 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line,
|
|||||||
return ::GetLastError();
|
return ::GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedHandle thread_handle(process_info.hThread);
|
base::win::ScopedHandle thread_handle(process_info.hThread);
|
||||||
ScopedHandle process_handle(process_info.hProcess);
|
base::win::ScopedHandle process_handle(process_info.hProcess);
|
||||||
|
|
||||||
// Change the token of the main thread of the new process for the
|
// Change the token of the main thread of the new process for the
|
||||||
// impersonation token with more rights.
|
// impersonation token with more rights.
|
||||||
@@ -335,10 +335,9 @@ DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {
|
|||||||
&token_handle))
|
&token_handle))
|
||||||
return ::GetLastError();
|
return ::GetLastError();
|
||||||
|
|
||||||
ScopedHandle token(token_handle);
|
base::win::ScopedHandle token(token_handle);
|
||||||
|
|
||||||
return SetTokenIntegrityLevel(token.Get(), integrity_level);
|
return SetTokenIntegrityLevel(token.Get(), integrity_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace sandbox
|
} // 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
|
||||||
#include "sandbox/src/sandbox.h"
|
#include "sandbox/src/sandbox.h"
|
||||||
#include "sandbox/src/sandbox_policy.h"
|
#include "sandbox/src/sandbox_policy.h"
|
||||||
#include "sandbox/src/sandbox_factory.h"
|
#include "sandbox/src/sandbox_factory.h"
|
||||||
#include "sandbox/src/nt_internals.h"
|
#include "sandbox/src/nt_internals.h"
|
||||||
#include "sandbox/tests/common/controller.h"
|
#include "sandbox/tests/common/controller.h"
|
||||||
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
namespace sandbox {
|
namespace sandbox {
|
||||||
|
|
||||||
@@ -20,7 +20,8 @@ SBOX_TESTS_COMMAND int Event_Open(int argc, wchar_t **argv) {
|
|||||||
if (L'f' == argv[0][0])
|
if (L'f' == argv[0][0])
|
||||||
desired_access = EVENT_ALL_ACCESS;
|
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();
|
DWORD error_open = ::GetLastError();
|
||||||
|
|
||||||
if (event_open.Get())
|
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])
|
if (L't' == argv[1][0])
|
||||||
initial_state = TRUE;
|
initial_state = TRUE;
|
||||||
|
|
||||||
ScopedHandle event_create(::CreateEvent(NULL, manual_reset, initial_state,
|
base::win::ScopedHandle event_create(::CreateEvent(
|
||||||
event_name));
|
NULL, manual_reset, initial_state, event_name));
|
||||||
DWORD error_create = ::GetLastError();
|
DWORD error_create = ::GetLastError();
|
||||||
ScopedHandle event_open;
|
base::win::ScopedHandle event_open;
|
||||||
if (event_name)
|
if (event_name)
|
||||||
event_open.Set(::OpenEvent(EVENT_ALL_ACCESS, FALSE, event_name));
|
event_open.Set(::OpenEvent(EVENT_ALL_ACCESS, FALSE, event_name));
|
||||||
|
|
||||||
@@ -124,10 +125,10 @@ TEST(SyncPolicyTest, TestEventReadOnly) {
|
|||||||
TargetPolicy::EVENTS_ALLOW_READONLY,
|
TargetPolicy::EVENTS_ALLOW_READONLY,
|
||||||
L"test6"));
|
L"test6"));
|
||||||
|
|
||||||
ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1"));
|
base::win::ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1"));
|
||||||
ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2"));
|
base::win::ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2"));
|
||||||
ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3"));
|
base::win::ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3"));
|
||||||
ScopedHandle handle4(::CreateEvent(NULL, FALSE, FALSE, L"test4"));
|
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 f f"));
|
||||||
EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_CreateOpen t 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
|
||||||
#include "sandbox/src/sandbox.h"
|
#include "sandbox/src/sandbox.h"
|
||||||
#include "sandbox/src/sandbox_factory.h"
|
#include "sandbox/src/sandbox_factory.h"
|
||||||
#include "sandbox/src/target_services.h"
|
#include "sandbox/src/target_services.h"
|
||||||
#include "sandbox/tests/common/controller.h"
|
#include "sandbox/tests/common/controller.h"
|
||||||
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
namespace sandbox {
|
namespace sandbox {
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ SBOX_TESTS_COMMAND int SimpleOpenEvent(int argc, wchar_t **argv) {
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
|
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;
|
return event_open.Get() ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,8 @@ TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) {
|
|||||||
sandbox::TargetPolicy* policy = runner.GetPolicy();
|
sandbox::TargetPolicy* policy = runner.GetPolicy();
|
||||||
policy->AddDllToUnload(L"avicap32.dll");
|
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
|
// 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
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "base/scoped_handle_win.h"
|
#include "base/win/scoped_handle.h"
|
||||||
#include "sandbox/src/win_utils.h"
|
#include "sandbox/src/win_utils.h"
|
||||||
#include "sandbox/tests/common/test_utils.h"
|
#include "sandbox/tests/common/test_utils.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@@ -67,8 +67,9 @@ TEST(WinUtils, SameObject) {
|
|||||||
std::wstring folder(my_folder);
|
std::wstring folder(my_folder);
|
||||||
std::wstring file_name = folder + L"\\foo.txt";
|
std::wstring file_name = folder + L"\\foo.txt";
|
||||||
const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||||
ScopedHandle file(CreateFile(file_name.c_str(), GENERIC_WRITE, kSharing, NULL,
|
base::win::ScopedHandle file(CreateFile(
|
||||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL));
|
file_name.c_str(), GENERIC_WRITE, kSharing, NULL, CREATE_ALWAYS,
|
||||||
|
FILE_FLAG_DELETE_ON_CLOSE, NULL));
|
||||||
|
|
||||||
EXPECT_TRUE(file.IsValid());
|
EXPECT_TRUE(file.IsValid());
|
||||||
std::wstring file_name_nt1 = std::wstring(L"\\??\\") + file_name;
|
std::wstring file_name_nt1 = std::wstring(L"\\??\\") + file_name;
|
||||||
|
Reference in New Issue
Block a user