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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 6126002: Remove base/scoped_handle_win.h stub and fix up all callers to use the new location and namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/ipc_channel_win.h" 5 #include "ipc/ipc_channel_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <sddl.h> 8 #include <sddl.h>
9 #include <sstream> 9 #include <sstream>
10 10
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/win/scoped_handle.h"
16 #include "ipc/ipc_logging.h" 17 #include "ipc/ipc_logging.h"
17 #include "ipc/ipc_message_utils.h" 18 #include "ipc/ipc_message_utils.h"
18 19
19 namespace IPC { 20 namespace IPC {
20 21
21 namespace { 22 namespace {
22 23
23 // Creates a security descriptor with a DACL that has one ace giving full 24 // Creates a security descriptor with a DACL that has one ace giving full
24 // access to the current logon session. 25 // access to the current logon session.
25 // The security descriptor returned must be freed using LocalFree. 26 // The security descriptor returned must be freed using LocalFree.
26 // The function returns true if it succeeds, false otherwise. 27 // The function returns true if it succeeds, false otherwise.
27 bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) { 28 bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) {
28 // Get the current token. 29 // Get the current token.
29 HANDLE token = NULL; 30 HANDLE token = NULL;
30 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) 31 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
31 return false; 32 return false;
32 ScopedHandle token_scoped(token); 33 base::win::ScopedHandle token_scoped(token);
33 34
34 // Get the size of the TokenGroups structure. 35 // Get the size of the TokenGroups structure.
35 DWORD size = 0; 36 DWORD size = 0;
36 BOOL result = GetTokenInformation(token, TokenGroups, NULL, 0, &size); 37 BOOL result = GetTokenInformation(token, TokenGroups, NULL, 0, &size);
37 if (result != FALSE && GetLastError() != ERROR_INSUFFICIENT_BUFFER) 38 if (result != FALSE && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
38 return false; 39 return false;
39 40
40 // Get the data. 41 // Get the data.
41 scoped_array<char> token_groups_chars(new char[size]); 42 scoped_array<char> token_groups_chars(new char[size]);
42 TOKEN_GROUPS* token_groups = 43 TOKEN_GROUPS* token_groups =
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 504
504 void Channel::set_listener(Listener* listener) { 505 void Channel::set_listener(Listener* listener) {
505 channel_impl_->set_listener(listener); 506 channel_impl_->set_listener(listener);
506 } 507 }
507 508
508 bool Channel::Send(Message* message) { 509 bool Channel::Send(Message* message) {
509 return channel_impl_->Send(message); 510 return channel_impl_->Send(message);
510 } 511 }
511 512
512 } // namespace IPC 513 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698