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

Side by Side Diff: sandbox/win/src/handle_closer.cc

Issue 119713003: Add base:: to string16s in sandbox/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « sandbox/win/src/handle_closer.h ('k') | sandbox/win/src/handle_closer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 "sandbox/win/src/handle_closer.h" 5 #include "sandbox/win/src/handle_closer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "sandbox/win/src/interceptors.h" 10 #include "sandbox/win/src/interceptors.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 GET_USER_DEFAULT_LCID_ID, 4)) { 167 GET_USER_DEFAULT_LCID_ID, 4)) {
168 return false; 168 return false;
169 } 169 }
170 170
171 return true; 171 return true;
172 } 172 }
173 173
174 return true; 174 return true;
175 } 175 }
176 176
177 bool GetHandleName(HANDLE handle, string16* handle_name) { 177 bool GetHandleName(HANDLE handle, base::string16* handle_name) {
178 static NtQueryObject QueryObject = NULL; 178 static NtQueryObject QueryObject = NULL;
179 if (!QueryObject) 179 if (!QueryObject)
180 ResolveNTFunctionPtr("NtQueryObject", &QueryObject); 180 ResolveNTFunctionPtr("NtQueryObject", &QueryObject);
181 181
182 ULONG size = MAX_PATH; 182 ULONG size = MAX_PATH;
183 scoped_ptr<UNICODE_STRING, base::FreeDeleter> name; 183 scoped_ptr<UNICODE_STRING, base::FreeDeleter> name;
184 NTSTATUS result; 184 NTSTATUS result;
185 185
186 do { 186 do {
187 name.reset(static_cast<UNICODE_STRING*>(malloc(size))); 187 name.reset(static_cast<UNICODE_STRING*>(malloc(size)));
188 DCHECK(name.get()); 188 DCHECK(name.get());
189 result = QueryObject(handle, ObjectNameInformation, name.get(), 189 result = QueryObject(handle, ObjectNameInformation, name.get(),
190 size, &size); 190 size, &size);
191 } while (result == STATUS_INFO_LENGTH_MISMATCH || 191 } while (result == STATUS_INFO_LENGTH_MISMATCH ||
192 result == STATUS_BUFFER_OVERFLOW); 192 result == STATUS_BUFFER_OVERFLOW);
193 193
194 if (NT_SUCCESS(result) && name->Buffer && name->Length) 194 if (NT_SUCCESS(result) && name->Buffer && name->Length)
195 handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t)); 195 handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t));
196 else 196 else
197 handle_name->clear(); 197 handle_name->clear();
198 198
199 return NT_SUCCESS(result); 199 return NT_SUCCESS(result);
200 } 200 }
201 201
202 } // namespace sandbox 202 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/handle_closer.h ('k') | sandbox/win/src/handle_closer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698