On 1/22/22 22:00, Jinoh Kang wrote:
diff --git a/server/request.h b/server/request.h index 3c455799d54..dd11a919361 100644 --- a/server/request.h +++ b/server/request.h @@ -688,6 +688,7 @@ C_ASSERT( sizeof(data_size_t) == 4 ); C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(generic_map_t) == 16 ); C_ASSERT( sizeof(hw_input_t) == 40 ); +C_ASSERT( sizeof(inline_apc_t) == 56 );
This file is auto-generated; it shouldn't be modified.
C_ASSERT( sizeof(int) == 4 ); C_ASSERT( sizeof(ioctl_code_t) == 4 ); C_ASSERT( sizeof(irp_params_t) == 32 ); diff --git a/server/thread.c b/server/thread.c index 467ccd1f0db..5d6cc8f433d 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1211,6 +1211,49 @@ static void clear_apc_queue( struct list *queue ) } }
+void try_suspend_apc_interrupt(void) +{ + static const select_op_t select_op_none = { SELECT_NONE }; + unsigned int error = get_error(); + select_on( &select_op_none, sizeof(select_op_none), 0, + SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE ); + set_error( error ); +} + +static void enable_next_apc_interrupt(void) +{ + if (current->wait && !current->wait->cookie) end_wait( current, STATUS_TIMEOUT ); +} + +void resume_apc_interrupt(void) +{ + enable_next_apc_interrupt(); + if (!list_empty( ¤t->system_apc )) + wake_thread( current ); +} + +int dequeue_synchronous_system_apc( inline_apc_t *inline_apc ) +{ + struct thread_apc *apc; + obj_handle_t handle; + int result = 0; + unsigned int error = get_error(); + + if ((apc = thread_dequeue_apc( current, 1 ))) + { + if ((handle = alloc_handle_no_access_check( current->process, &apc->obj, SYNCHRONIZE, 0 ))) + { + memset( inline_apc, 0, sizeof(*inline_apc) ); + inline_apc->call = apc->call; + inline_apc->apc_handle = handle; + result = 1; + } + release_object( apc );
Handle allocation failure is left unhandled. -- Sincerely, Jinoh Kang