Commit 16bd095b authored by jschuh@chromium.org's avatar jschuh@chromium.org

Handle STATUS_BUFFER_OVERFLOW return value from NtQueryObject().

BUG=91386
TEST=None
Review URL: http://codereview.chromium.org/7542026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96478 0039d316-1c4b-4281-b951-d872f2087c98
parent ea881d9b
...@@ -187,7 +187,8 @@ bool GetHandleName(HANDLE handle, string16* handle_name) { ...@@ -187,7 +187,8 @@ bool GetHandleName(HANDLE handle, string16* handle_name) {
name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size])); name.reset(reinterpret_cast<UNICODE_STRING*>(new BYTE[size]));
result = QueryObject(handle, ObjectNameInformation, name.get(), result = QueryObject(handle, ObjectNameInformation, name.get(),
size, &size); size, &size);
} while (result == STATUS_INFO_LENGTH_MISMATCH); } while (result == STATUS_INFO_LENGTH_MISMATCH ||
result == STATUS_BUFFER_OVERFLOW);
if (NT_SUCCESS(result) && name->Buffer && name->Length) if (NT_SUCCESS(result) && name->Buffer && name->Length)
handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t)); handle_name->assign(name->Buffer, name->Length / sizeof(wchar_t));
......
...@@ -82,7 +82,8 @@ bool HandleCloserAgent::CloseHandles() { ...@@ -82,7 +82,8 @@ bool HandleCloserAgent::CloseHandles() {
// Get the type name, reusing the buffer. // Get the type name, reusing the buffer.
ULONG size = static_cast<ULONG>(type_info_buffer.size()); ULONG size = static_cast<ULONG>(type_info_buffer.size());
rc = QueryObject(handle, ObjectTypeInformation, type_info, size, &size); rc = QueryObject(handle, ObjectTypeInformation, type_info, size, &size);
while (rc == STATUS_INFO_LENGTH_MISMATCH) { while (rc == STATUS_INFO_LENGTH_MISMATCH ||
rc == STATUS_BUFFER_OVERFLOW) {
type_info_buffer.resize(size + sizeof(wchar_t)); type_info_buffer.resize(size + sizeof(wchar_t));
type_info = reinterpret_cast<OBJECT_TYPE_INFORMATION*>( type_info = reinterpret_cast<OBJECT_TYPE_INFORMATION*>(
&(type_info_buffer[0])); &(type_info_buffer[0]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment