Proper XamEnumerate return when there are zero items.

This commit is contained in:
Ben Vanik 2015-03-14 23:54:43 -07:00
parent c6c24d50bd
commit 0117c39968
1 changed files with 2 additions and 3 deletions

View File

@ -165,14 +165,13 @@ SHIM_CALL XamEnumerate_shim(PPCContext* ppc_state, KernelState* state) {
auto item_count = e->item_count(); auto item_count = e->item_count();
e->WriteItems(SHIM_MEM_ADDR(buffer_ptr)); e->WriteItems(SHIM_MEM_ADDR(buffer_ptr));
X_RESULT result; X_RESULT result = item_count ? X_ERROR_SUCCESS : X_ERROR_NO_MORE_FILES;
if (item_count_ptr) { if (item_count_ptr) {
assert_zero(overlapped_ptr); assert_zero(overlapped_ptr);
SHIM_SET_MEM_32(item_count_ptr, item_count); SHIM_SET_MEM_32(item_count_ptr, item_count);
result = X_ERROR_SUCCESS;
} else if (overlapped_ptr) { } else if (overlapped_ptr) {
assert_zero(item_count_ptr); assert_zero(item_count_ptr);
state->CompleteOverlappedImmediate(overlapped_ptr, 0, item_count); state->CompleteOverlappedImmediate(overlapped_ptr, result, item_count);
result = X_ERROR_IO_PENDING; result = X_ERROR_IO_PENDING;
} else { } else {
assert_always(); assert_always();