[XAM] XamContentGetCreator: Use deferred overlap

This commit is contained in:
Gliniak 2024-08-17 11:26:46 +02:00
parent 9ba96d46d1
commit 365a220b74
1 changed files with 42 additions and 24 deletions

View File

@ -315,10 +315,17 @@ dword_result_t XamContentGetCreator_entry(dword_t user_index,
lpdword_t is_creator_ptr, lpdword_t is_creator_ptr,
lpqword_t creator_xuid_ptr, lpqword_t creator_xuid_ptr,
lpunknown_t overlapped_ptr) { lpunknown_t overlapped_ptr) {
auto result = X_ERROR_SUCCESS; if (!is_creator_ptr) {
return X_ERROR_INVALID_PARAMETER;
}
XCONTENT_AGGREGATE_DATA content_data = *content_data_ptr.as<XCONTENT_DATA*>(); XCONTENT_AGGREGATE_DATA content_data = *content_data_ptr.as<XCONTENT_DATA*>();
auto run = [content_data, user_index, is_creator_ptr, creator_xuid_ptr,
overlapped_ptr](uint32_t& extended_error,
uint32_t& length) -> X_RESULT {
X_RESULT result = X_ERROR_SUCCESS;
bool content_exists = bool content_exists =
kernel_state()->content_manager()->ContentExists(content_data); kernel_state()->content_manager()->ContentExists(content_data);
@ -344,11 +351,22 @@ dword_result_t XamContentGetCreator_entry(dword_t user_index,
result = X_ERROR_PATH_NOT_FOUND; result = X_ERROR_PATH_NOT_FOUND;
} }
if (overlapped_ptr) { extended_error = X_HRESULT_FROM_WIN32(result);
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result); length = 0;
return X_ERROR_IO_PENDING;
} else { if (result && overlapped_ptr) {
result = X_ERROR_FUNCTION_FAILED;
}
return result; return result;
};
if (!overlapped_ptr) {
uint32_t extended_error, length;
return run(extended_error, length);
} else {
kernel_state()->CompleteOverlappedDeferredEx(run, overlapped_ptr);
return X_ERROR_IO_PENDING;
} }
} }
DECLARE_XAM_EXPORT1(XamContentGetCreator, kContent, kImplemented); DECLARE_XAM_EXPORT1(XamContentGetCreator, kContent, kImplemented);