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

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

Issue 1328703003: Correct PROCESS_BASIC_INFORMATION for 64 bit Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split test into smaller pieces. Created 5 years, 3 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
« no previous file with comments | « sandbox/win/src/policy_broker.cc ('k') | sandbox/win/src/sandbox_nt_util_unittest.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) 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 "sandbox/win/src/sandbox_nt_util.h" 5 #include "sandbox/win/src/sandbox_nt_util.h"
6 6
7 #include "base/win/pe_image.h" 7 #include "base/win/pe_image.h"
8 #include "sandbox/win/src/sandbox_factory.h" 8 #include "sandbox/win/src/sandbox_factory.h"
9 #include "sandbox/win/src/target_services.h" 9 #include "sandbox/win/src/target_services.h"
10 10
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 331
332 if (!NT_SUCCESS(ret) && *out_name) { 332 if (!NT_SUCCESS(ret) && *out_name) {
333 operator delete(*out_name, NT_ALLOC); 333 operator delete(*out_name, NT_ALLOC);
334 *out_name = NULL; 334 *out_name = NULL;
335 } 335 }
336 336
337 return ret; 337 return ret;
338 } 338 }
339 339
340 NTSTATUS GetProcessId(HANDLE process, ULONG *process_id) { 340 NTSTATUS GetProcessId(HANDLE process, DWORD *process_id) {
341 PROCESS_BASIC_INFORMATION proc_info; 341 PROCESS_BASIC_INFORMATION proc_info;
342 ULONG bytes_returned; 342 ULONG bytes_returned;
343 343
344 NTSTATUS ret = g_nt.QueryInformationProcess(process, ProcessBasicInformation, 344 NTSTATUS ret = g_nt.QueryInformationProcess(process, ProcessBasicInformation,
345 &proc_info, sizeof(proc_info), 345 &proc_info, sizeof(proc_info),
346 &bytes_returned); 346 &bytes_returned);
347 if (!NT_SUCCESS(ret) || sizeof(proc_info) != bytes_returned) 347 if (!NT_SUCCESS(ret) || sizeof(proc_info) != bytes_returned)
348 return ret; 348 return ret;
349 349
350 *process_id = proc_info.UniqueProcessId; 350 *process_id = proc_info.UniqueProcessId;
351 return STATUS_SUCCESS; 351 return STATUS_SUCCESS;
352 } 352 }
353 353
354 bool IsSameProcess(HANDLE process) { 354 bool IsSameProcess(HANDLE process) {
355 if (NtCurrentProcess == process) 355 if (NtCurrentProcess == process)
356 return true; 356 return true;
357 357
358 static ULONG s_process_id = 0; 358 static DWORD s_process_id = 0;
359 359
360 if (!s_process_id) { 360 if (!s_process_id) {
361 NTSTATUS ret = GetProcessId(NtCurrentProcess, &s_process_id); 361 NTSTATUS ret = GetProcessId(NtCurrentProcess, &s_process_id);
362 if (!NT_SUCCESS(ret)) 362 if (!NT_SUCCESS(ret))
363 return false; 363 return false;
364 } 364 }
365 365
366 ULONG process_id; 366 DWORD process_id;
367 NTSTATUS ret = GetProcessId(process, &process_id); 367 NTSTATUS ret = GetProcessId(process, &process_id);
368 if (!NT_SUCCESS(ret)) 368 if (!NT_SUCCESS(ret))
369 return false; 369 return false;
370 370
371 return (process_id == s_process_id); 371 return (process_id == s_process_id);
372 } 372 }
373 373
374 bool IsValidImageSection(HANDLE section, PVOID *base, PLARGE_INTEGER offset, 374 bool IsValidImageSection(HANDLE section, PVOID *base, PLARGE_INTEGER offset,
375 PSIZE_T view_size) { 375 PSIZE_T view_size) {
376 if (!section || !base || !view_size || offset) 376 if (!section || !base || !view_size || offset)
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 UNREFERENCED_PARAMETER(type); 670 UNREFERENCED_PARAMETER(type);
671 return buffer; 671 return buffer;
672 } 672 }
673 673
674 void __cdecl operator delete(void* memory, void* buffer, 674 void __cdecl operator delete(void* memory, void* buffer,
675 sandbox::AllocationType type) { 675 sandbox::AllocationType type) {
676 UNREFERENCED_PARAMETER(memory); 676 UNREFERENCED_PARAMETER(memory);
677 UNREFERENCED_PARAMETER(buffer); 677 UNREFERENCED_PARAMETER(buffer);
678 UNREFERENCED_PARAMETER(type); 678 UNREFERENCED_PARAMETER(type);
679 } 679 }
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_broker.cc ('k') | sandbox/win/src/sandbox_nt_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698