[Kernel] Add XN_SYS_UI notifications to XamShow*UI exports

This commit is contained in:
emoose 2019-08-04 03:57:06 +01:00
parent c3476e8e19
commit 313e81ec38
No known key found for this signature in database
GPG Key ID: 3735C67912F5FF97
1 changed files with 19 additions and 0 deletions

View File

@ -111,6 +111,9 @@ dword_result_t XamShowMessageBoxUI(dword_t user_index, lpwstring_t title_ptr,
buttons.push_back(button); buttons.push_back(button);
} }
// Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true);
uint32_t chosen_button; uint32_t chosen_button;
if (cvars::headless) { if (cvars::headless) {
// Auto-pick the focused button. // Auto-pick the focused button.
@ -144,6 +147,9 @@ dword_result_t XamShowMessageBoxUI(dword_t user_index, lpwstring_t title_ptr,
} }
*result_ptr = chosen_button; *result_ptr = chosen_button;
// Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false);
if (overlapped) { if (overlapped) {
kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS); kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS);
return X_ERROR_IO_PENDING; return X_ERROR_IO_PENDING;
@ -232,6 +238,9 @@ dword_result_t XamShowKeyboardUI(dword_t user_index, dword_t flags,
return X_ERROR_INVALID_PARAMETER; return X_ERROR_INVALID_PARAMETER;
} }
// Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true);
if (cvars::headless) { if (cvars::headless) {
// Redirect default_text back into the buffer. // Redirect default_text back into the buffer.
std::memset(buffer, 0, buffer_length * 2); std::memset(buffer, 0, buffer_length * 2);
@ -239,6 +248,9 @@ dword_result_t XamShowKeyboardUI(dword_t user_index, dword_t flags,
xe::store_and_swap<std::wstring>(buffer, default_text.value()); xe::store_and_swap<std::wstring>(buffer, default_text.value());
} }
// Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false);
if (overlapped) { if (overlapped) {
kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS); kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS);
return X_ERROR_IO_PENDING; return X_ERROR_IO_PENDING;
@ -269,6 +281,9 @@ dword_result_t XamShowKeyboardUI(dword_t user_index, dword_t flags,
out_text = out_text.substr(0, buffer_length - 1); out_text = out_text.substr(0, buffer_length - 1);
xe::store_and_swap<std::wstring>(buffer, out_text); xe::store_and_swap<std::wstring>(buffer, out_text);
// Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false);
if (overlapped) { if (overlapped) {
kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS); kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS);
return X_ERROR_IO_PENDING; return X_ERROR_IO_PENDING;
@ -300,6 +315,10 @@ dword_result_t XamShowDeviceSelectorUI(dword_t user_index, dword_t content_type,
break; break;
} }
// Broadcast XN_SYS_UI = true followed by XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, true);
kernel_state()->BroadcastNotification(0x9, false);
if (overlapped) { if (overlapped) {
kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS); kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS);
return X_ERROR_IO_PENDING; return X_ERROR_IO_PENDING;