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

Unified Diff: sandbox/sandbox_poc/pocdll/handles.cc

Issue 1168002: Fix the POC and some of unit tests to be build and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/sandbox_poc/main_ui_window.cc ('k') | sandbox/sandbox_poc/sandbox.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/sandbox_poc/pocdll/handles.cc
===================================================================
--- sandbox/sandbox_poc/pocdll/handles.cc (revision 42238)
+++ sandbox/sandbox_poc/pocdll/handles.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
@@ -18,7 +18,7 @@
FILE *output = handle2file.Translate(log, "w");
// Initialize the NTAPI functions we need
- HMODULE ntdll_handle = ::LoadLibraryA("ntdll.dll");
+ HMODULE ntdll_handle = ::GetModuleHandle(L"ntdll.dll");
if (!ntdll_handle) {
fprintf(output, "[ERROR] Cannot load ntdll.dll. Error %d\r\n",
::GetLastError());
@@ -35,7 +35,6 @@
if (!NtQueryObject || !NtQueryInformationFile || !NtQuerySystemInformation) {
fprintf(output, "[ERROR] Cannot load all NT functions. Error %d\r\n",
::GetLastError());
- ::FreeLibrary(ntdll_handle);
return;
}
@@ -48,7 +47,6 @@
if (!buffer_size) {
fprintf(output, "[ERROR] Get the number of handles. Error 0x%X\r\n",
status);
- ::FreeLibrary(ntdll_handle);
return;
}
@@ -60,12 +58,11 @@
if (STATUS_SUCCESS != status) {
fprintf(output, "[ERROR] Failed to get the handle list. Error 0x%X\r\n",
status);
- ::FreeLibrary(ntdll_handle);
delete [] system_handles;
return;
}
- for (unsigned int i = 0; i < system_handles->NumberOfHandles; ++i) {
+ for (ULONG i = 0; i < system_handles->NumberOfHandles; ++i) {
USHORT h = system_handles->Information[i].Handle;
if (system_handles->Information[i].ProcessId != ::GetCurrentProcessId())
continue;
@@ -122,8 +119,8 @@
// This function does not return the size of the buffer. We need to
// iterate and always increase the buffer size until the function
// succeeds. (Or at least does not fail with STATUS_BUFFER_OVERFLOW)
- DWORD size_file = MAX_PATH;
- IO_STATUS_BLOCK status_block;
+ ULONG size_file = MAX_PATH;
+ IO_STATUS_BLOCK status_block = {0};
do {
// Delete the previous buffer create. The buffer was too small
if (file_name) {
@@ -186,6 +183,4 @@
if (system_handles) {
delete [] system_handles;
}
-
- ::FreeLibrary(ntdll_handle);
}
« no previous file with comments | « sandbox/sandbox_poc/main_ui_window.cc ('k') | sandbox/sandbox_poc/sandbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698