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

Unified Diff: sandbox/src/handle_table.cc

Issue 7292028: Revert 91270 - sbox_unittests HandleTable.FindTable failing on Win XP & Vista (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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/src/handle_table.h ('k') | sandbox/src/handle_table_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/src/handle_table.cc
===================================================================
--- sandbox/src/handle_table.cc (revision 91270)
+++ sandbox/src/handle_table.cc (working copy)
@@ -17,8 +17,6 @@
return a.ProcessId < b.ProcessId;
}
-static NtQueryObject QueryObject = NULL;
-
} // namespace
namespace sandbox {
@@ -86,6 +84,7 @@
}
void HandleTable::HandleEntry::UpdateInfo(UpdateType flag) {
+ static NtQueryObject QueryObject = NULL;
if (!QueryObject)
ResolveNTFunctionPtr("NtQueryObject", &QueryObject);
@@ -120,8 +119,18 @@
switch (flag) {
case UPDATE_INFO_AND_NAME:
if (type_info_buffer_.size() && handle_name_.empty()) {
- GetHandleName(reinterpret_cast<HANDLE>(handle_entry_->Handle),
- &handle_name_);
+ ULONG size = MAX_PATH;
+ scoped_ptr<UNICODE_STRING> name;
+ do {
+ name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size]));
+ result = QueryObject(reinterpret_cast<HANDLE>(
+ handle_entry_->Handle), ObjectNameInformation, name.get(),
+ size, &size);
+ } while (result == STATUS_INFO_LENGTH_MISMATCH);
+
+ if (NT_SUCCESS(result)) {
+ handle_name_.assign(name->Buffer, name->Length / sizeof(wchar_t));
+ }
}
break;
@@ -135,27 +144,6 @@
}
}
-// Returns the object manager's name associated with a handle
-bool GetHandleName(HANDLE handle, string16* handle_name) {
- if (!QueryObject)
- ResolveNTFunctionPtr("NtQueryObject", &QueryObject);
-
- ULONG size = MAX_PATH;
- scoped_ptr<UNICODE_STRING> name;
- NTSTATUS result;
-
- do {
- name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size]));
- result = QueryObject(handle, ObjectNameInformation, name.get(),
- size, &size);
- } while (result == STATUS_INFO_LENGTH_MISMATCH);
-
- if (NT_SUCCESS(result))
- handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t));
-
- return NT_SUCCESS(result);
-}
-
const OBJECT_TYPE_INFORMATION* HandleTable::HandleEntry::TypeInfo() {
UpdateInfo(UPDATE_INFO_ONLY);
return type_info_buffer_.empty() ? NULL : type_info_internal();
« no previous file with comments | « sandbox/src/handle_table.h ('k') | sandbox/src/handle_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698