[XAM] Ensure items returned is set in enumerate.
[XAM] Ensure items returned is set in xeXamEnumerate.
This commit is contained in:
parent
c55918d944
commit
215f2a340b
|
@ -32,17 +32,13 @@ uint32_t xeXamEnumerate(uint32_t handle, uint32_t flags, void* buffer,
|
|||
uint32_t overlapped_ptr) {
|
||||
assert_true(flags == 0);
|
||||
|
||||
X_RESULT result;
|
||||
uint32_t item_count = 0;
|
||||
|
||||
auto e = kernel_state()->object_table()->LookupObject<XEnumerator>(handle);
|
||||
if (!e) {
|
||||
if (overlapped_ptr) {
|
||||
kernel_state()->CompleteOverlappedImmediateEx(
|
||||
overlapped_ptr, X_ERROR_INVALID_HANDLE, X_ERROR_INVALID_HANDLE, 0);
|
||||
return X_ERROR_IO_PENDING;
|
||||
result = X_ERROR_INVALID_HANDLE;
|
||||
} else {
|
||||
return X_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
size_t actual_buffer_length = buffer_length;
|
||||
if (buffer_length == e->items_per_enumerate()) {
|
||||
actual_buffer_length = e->item_size() * e->items_per_enumerate();
|
||||
|
@ -58,9 +54,6 @@ uint32_t xeXamEnumerate(uint32_t handle, uint32_t flags, void* buffer,
|
|||
|
||||
std::memset(buffer, 0, actual_buffer_length);
|
||||
|
||||
X_RESULT result;
|
||||
uint32_t item_count = 0;
|
||||
|
||||
if (actual_buffer_length < e->item_size()) {
|
||||
result = X_ERROR_INSUFFICIENT_BUFFER;
|
||||
} else if (e->current_item() >= e->item_count()) {
|
||||
|
@ -77,6 +70,7 @@ uint32_t xeXamEnumerate(uint32_t handle, uint32_t flags, void* buffer,
|
|||
}
|
||||
result = X_ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (items_returned) {
|
||||
assert_true(!overlapped_ptr);
|
||||
|
|
Loading…
Reference in New Issue