|
|
dd89bb |
#ifndef _NT_SYNC_H_
|
|
|
dd89bb |
#define _NT_SYNC_H_
|
|
|
dd89bb |
|
|
|
414ad3 |
#include "nt_abi.h"
|
|
|
414ad3 |
#include "nt_compiler.h"
|
|
|
dd89bb |
#include "nt_object.h"
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_wait_type {
|
|
|
dd89bb |
NT_WAIT_ALL,
|
|
|
dd89bb |
NT_WAIT_ANY
|
|
|
dd89bb |
} nt_wait_type;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_timer_type {
|
|
|
dd89bb |
NT_NOTIFICATION_TIMER,
|
|
|
dd89bb |
NT_SYNCHRONIZATION_TIMER
|
|
|
dd89bb |
} nt_timer_type;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_timer_info_class {
|
|
|
dd89bb |
NT_TIMER_BASIC_INFORMATION
|
|
|
dd89bb |
} nt_timer_info_class;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_event_type {
|
|
|
dd89bb |
NT_NOTIFICATION_EVENT,
|
|
|
dd89bb |
NT_SYNCHRONIZATION_EVENT
|
|
|
dd89bb |
} nt_event_type;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_event_states {
|
|
|
dd89bb |
NT_EVENT_NOT_SIGNALED,
|
|
|
dd89bb |
NT_EVENT_SIGNALED
|
|
|
dd89bb |
} nt_event_states;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_event_info_class {
|
|
|
dd89bb |
NT_EVENT_BASIC_INFORMATION
|
|
|
dd89bb |
} nt_event_info_class;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_semaphore_info_class {
|
|
|
dd89bb |
NT_SEMAPHORE_BASIC_INFORMATION
|
|
|
dd89bb |
} nt_semaphore_info_class;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_mutant_info_class {
|
|
|
dd89bb |
NT_MUTANT_BASIC_INFORMATION
|
|
|
dd89bb |
} nt_mutant_info_class;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_io_completion_info_class {
|
|
|
dd89bb |
NT_IO_COMPLETION_BASIC_INFORMATION
|
|
|
dd89bb |
} nt_io_completion_info_class;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* timer access bits */
|
|
|
dd89bb |
#define NT_TIMER_QUERY_STATE 0x00000001U
|
|
|
dd89bb |
#define NT_TIMER_MODIFY_STATE 0x00000002U
|
|
|
dd89bb |
#define NT_TIMER_ALL_ACCESS 0x001F0003U
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* event access bits */
|
|
|
dd89bb |
#define NT_EVENT_QUERY_STATE 0x00000001U
|
|
|
dd89bb |
#define NT_EVENT_MODIFY_STATE 0x00000002U
|
|
|
dd89bb |
#define NT_EVENT_ALL_ACCESS 0x001F0003U
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* semaphore access bits */
|
|
|
dd89bb |
#define NT_SEMAPHORE_QUERY_STATE 0x00000001U
|
|
|
dd89bb |
#define NT_SEMAPHORE_MODIFY_STATE 0x00000002U
|
|
|
dd89bb |
#define NT_SEMAPHORE_ALL_ACCESS 0x001F0003U
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* mutant access bits */
|
|
|
dd89bb |
#define NT_MUTANT_QUERY_STATE 0x00000001U
|
|
|
dd89bb |
#define NT_MUTANT_ALL_ACCESS 0x001F0001U
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* io completion access bits */
|
|
|
dd89bb |
#define NT_IO_COMPLETION_QUERY_STATE 0x00000001U
|
|
|
dd89bb |
#define NT_IO_COMPLETION_MODIFY_STATE 0x00000002U
|
|
|
dd89bb |
#define NT_IO_COMPLETION_ALL_ACCESS 0x001F0003U
|
|
|
dd89bb |
|
|
|
dd89bb |
/* alertable threads */
|
|
|
dd89bb |
#define NT_SYNC_NON_ALERTABLE 0x00000000U
|
|
|
dd89bb |
#define NT_SYNC_ALERTABLE 0x00000001U
|
|
|
dd89bb |
|
|
|
6445d5 |
/* sync structures */
|
|
|
dd89bb |
typedef struct _nt_timer_basic_information {
|
|
|
dd89bb |
nt_large_integer timer_remaining;
|
|
|
dd89bb |
int32_t signal_state;
|
|
|
dd89bb |
} nt_timer_basic_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_event_basic_information {
|
|
|
dd89bb |
nt_event_type event_type;
|
|
|
dd89bb |
int32_t signal_state;
|
|
|
dd89bb |
} nt_event_basic_information, nt_ebi;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_semaphore_basic_information {
|
|
|
dd89bb |
int32_t current_count;
|
|
|
dd89bb |
int32_t max_count;
|
|
|
dd89bb |
} nt_semaphore_basic_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_mutant_basic_information {
|
|
|
dd89bb |
int32_t signal_state;
|
|
|
dd89bb |
int32_t owned;
|
|
|
dd89bb |
int32_t abandoned;
|
|
|
dd89bb |
} nt_mutant_basic_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_io_completion_basic_information {
|
|
|
dd89bb |
int32_t signal_state;
|
|
|
dd89bb |
} nt_io_completion_basic_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef void __stdcall nt_timer_apc_routine(
|
|
|
dd89bb |
void * timer_context,
|
|
|
dd89bb |
uint32_t timer_low_value,
|
|
|
dd89bb |
uint32_t timer_high_value);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_wait_for_single_object(
|
|
|
dd89bb |
__in void * handle,
|
|
|
dd89bb |
__in int32_t alertable,
|
|
|
dd89bb |
__in nt_large_integer * timeout __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_signal_and_wait_for_single_object(
|
|
|
dd89bb |
__in void * handle_to_signal,
|
|
|
dd89bb |
__in void * handle_to_wait,
|
|
|
dd89bb |
__in int32_t alertable,
|
|
|
dd89bb |
__in nt_large_integer * timeout __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_wait_for_multiple_objects(
|
|
|
dd89bb |
__in uint32_t handle_count,
|
|
|
dd89bb |
__in void ** handles,
|
|
|
dd89bb |
__in nt_wait_type wait_type,
|
|
|
dd89bb |
__in int32_t alertable,
|
|
|
dd89bb |
__in nt_large_integer * timeout __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_timer(
|
|
|
dd89bb |
__out void ** htimer,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr,
|
|
|
dd89bb |
__in nt_timer_type timer_type);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_timer(
|
|
|
dd89bb |
__out void ** htimer,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_cancel_timer(
|
|
|
dd89bb |
__in void * htimer,
|
|
|
dd89bb |
__out int32_t * previous_state __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_timer(
|
|
|
dd89bb |
__in void * htimer,
|
|
|
dd89bb |
__in nt_large_integer * due_time,
|
|
|
dd89bb |
__in nt_timer_apc_routine * timer_apc_routine __optional,
|
|
|
dd89bb |
__in void * timer_context,
|
|
|
dd89bb |
__in int32_t resume,
|
|
|
dd89bb |
__in int32_t period,
|
|
|
dd89bb |
__out int32_t * previous_state __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_query_timer(
|
|
|
dd89bb |
__in void * htimer,
|
|
|
dd89bb |
__in nt_timer_info_class timer_info_class,
|
|
|
dd89bb |
__out void * timer_info,
|
|
|
dd89bb |
__in size_t timer_info_length,
|
|
|
dd89bb |
__out size_t * returned_length __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_event(
|
|
|
b7cd2b |
__out void * volatile * hevent,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr,
|
|
|
dd89bb |
__in nt_event_type event_type,
|
|
|
dd89bb |
__in int32_t initial_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_event(
|
|
|
dd89bb |
__out void ** hevent,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_event(
|
|
|
dd89bb |
__in void * hevent,
|
|
|
dd89bb |
__out int32_t * previous_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_pulse_event(
|
|
|
dd89bb |
__in void * hevent,
|
|
|
dd89bb |
__out int32_t * previous_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_reset_event(
|
|
|
dd89bb |
__in void * hevent,
|
|
|
dd89bb |
__out int32_t * previous_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_clear_event(
|
|
|
dd89bb |
__in void * hevent);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_query_event(
|
|
|
dd89bb |
__in void * hevent,
|
|
|
dd89bb |
__in nt_event_info_class event_info_class,
|
|
|
dd89bb |
__out void * event_info,
|
|
|
dd89bb |
__in size_t event_info_length,
|
|
|
dd89bb |
__out size_t * returned_length __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_semaphore(
|
|
|
dd89bb |
__out void ** hsemaphore,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr,
|
|
|
dd89bb |
__in int32_t initial_count,
|
|
|
dd89bb |
__in int32_t max_count);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_semaphore(
|
|
|
dd89bb |
__out void ** hsemaphore,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_release_semaphore(
|
|
|
dd89bb |
__in void * hsemaphore,
|
|
|
dd89bb |
__in int32_t release_count,
|
|
|
dd89bb |
__out int32_t * previous_count);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_query_semaphore(
|
|
|
dd89bb |
__in void * hsemaphore,
|
|
|
dd89bb |
__in nt_semaphore_info_class semaphore_info_class,
|
|
|
dd89bb |
__out void * semaphore_info,
|
|
|
dd89bb |
__in size_t semaphore_info_length,
|
|
|
dd89bb |
__out size_t * returned_length __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_mutant(
|
|
|
dd89bb |
__out void ** hmutant,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr,
|
|
|
dd89bb |
__in int32_t initial_owner);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_mutant(
|
|
|
dd89bb |
__out void ** hmutant,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_release_mutant(
|
|
|
dd89bb |
__in void * hmutant,
|
|
|
dd89bb |
__out int32_t * previous_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_query_mutant(
|
|
|
dd89bb |
__in void * hmutant,
|
|
|
dd89bb |
__in nt_mutant_info_class mutant_info_class,
|
|
|
dd89bb |
__out void * mutant_info,
|
|
|
dd89bb |
__in size_t mutant_info_length,
|
|
|
dd89bb |
__out size_t * returned_length __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_io_completion(
|
|
|
dd89bb |
__out void ** hio_completion,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr,
|
|
|
dd89bb |
__in uint32_t max_concurrent_threads);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_io_completion(
|
|
|
dd89bb |
__out void ** hio_completion,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_io_completion(
|
|
|
dd89bb |
__in void * hio_completion,
|
|
|
dd89bb |
__in uint32_t completion_key,
|
|
|
dd89bb |
__in uint32_t completion_value,
|
|
|
dd89bb |
__in int32_t status,
|
|
|
dd89bb |
__in uint32_t information);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_remove_io_completion(
|
|
|
dd89bb |
__in void * hio_completion,
|
|
|
dd89bb |
__out uint32_t * completion_key,
|
|
|
dd89bb |
__out uint32_t * completion_value,
|
|
|
dd89bb |
__out nt_io_status_block * io_status_block,
|
|
|
dd89bb |
__in nt_large_integer * timeout);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_query_io_completion(
|
|
|
dd89bb |
__in void * hio_completion,
|
|
|
dd89bb |
__in nt_io_completion_info_class io_completion_info_class,
|
|
|
dd89bb |
__out void * io_completion_info,
|
|
|
dd89bb |
__in size_t io_completion_info_length,
|
|
|
dd89bb |
__out size_t * returned_length __optional);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_create_event_pair(
|
|
|
dd89bb |
__out void ** hevent_pair,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_open_event_pair(
|
|
|
dd89bb |
__out void ** hevent_pair,
|
|
|
dd89bb |
__in uint32_t desired_access,
|
|
|
dd89bb |
__in nt_object_attributes * obj_attr);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_wait_low_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_low_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_wait_high_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_high_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_low_wait_high_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_high_wait_low_event_pair(
|
|
|
dd89bb |
__in void * hevent_pair);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* extensions */
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_tt_create_inheritable_event(
|
|
|
dd89bb |
__out void ** hevent,
|
|
|
dd89bb |
__in nt_event_type event_type,
|
|
|
dd89bb |
__in int32_t initial_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_tt_create_private_event(
|
|
|
b7cd2b |
__out void * volatile * hevent,
|
|
|
b7cd2b |
__in nt_event_type event_type,
|
|
|
b7cd2b |
__in int32_t initial_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_tt_wait_for_dummy_event(void);
|
|
|
dd89bb |
|
|
|
dd89bb |
#endif
|