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

Side by Side Diff: cloud_print/service/win/local_security_policy.cc

Issue 1408623002: Add cloud_print to the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "cloud_print/service/win/local_security_policy.h" 5 #include "cloud_print/service/win/local_security_policy.h"
6 6
7 #include <atlsecurity.h> 7 #include <atlsecurity.h>
8 #include <ntsecapi.h> 8 #include <ntsecapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 const base::string16& privilage) { 102 const base::string16& privilage) {
103 DCHECK(policy_); 103 DCHECK(policy_);
104 ATL::CSid user_sid; 104 ATL::CSid user_sid;
105 if (!user_sid.LoadAccount(username.c_str())) { 105 if (!user_sid.LoadAccount(username.c_str())) {
106 LOG(ERROR) << "Unable to load Sid for" << username; 106 LOG(ERROR) << "Unable to load Sid for" << username;
107 return false; 107 return false;
108 } 108 }
109 LSA_UNICODE_STRING privilege_string; 109 LSA_UNICODE_STRING privilege_string;
110 base::string16 privilage_copy(privilage); 110 base::string16 privilage_copy(privilage);
111 privilege_string.Buffer = &privilage_copy[0]; 111 privilege_string.Buffer = &privilage_copy[0];
112 privilege_string.Length = wcslen(privilege_string.Buffer) * 112 privilege_string.Length = static_cast<USHORT>(
113 sizeof(privilege_string.Buffer[0]); 113 wcslen(privilege_string.Buffer) * sizeof(privilege_string.Buffer[0]));
114 privilege_string.MaximumLength = privilege_string.Length + 114 privilege_string.MaximumLength = privilege_string.Length +
115 sizeof(privilege_string.Buffer[0]); 115 sizeof(privilege_string.Buffer[0]);
116 return STATUS_SUCCESS == 116 return STATUS_SUCCESS ==
117 ::LsaAddAccountRights(policy_, const_cast<SID*>(user_sid.GetPSID()), 117 ::LsaAddAccountRights(policy_, const_cast<SID*>(user_sid.GetPSID()),
118 &privilege_string, 1); 118 &privilege_string, 1);
119 } 119 }
120 120
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698