1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#ifndef _NT_SEM_H_
#define _NT_SEM_H_
#include "nt_abi.h"
#include "nt_object.h"
/* semaphore commands */
#define NT_SEM_CMD_GETPID (11)
#define NT_SEM_CMD_GETVAL (12)
#define NT_SEM_CMD_GETALL (13)
#define NT_SEM_CMD_GETNCNT (14)
#define NT_SEM_CMD_GETZCNT (15)
#define NT_SEM_CMD_SETVAL (16)
#define NT_SEM_CMD_SETALL (17)
/* semaphore command flags */
#define NT_SEM_FLAG_NOWAIT (0x0800)
#define NT_SEM_FLAG_UNDO (0x1000)
/* semaphore info */
typedef struct __attr_ptr_size_aligned__ _nt_sem_info {
void * hport;
void * section;
void * section_addr;
size_t section_size;
void * hevent;
void * apc_routine;
void * apc_context;
int32_t semkey;
int32_t semslots;
int32_t semid;
int32_t semnum;
int32_t semcmd;
int32_t sempid;
int32_t semncnt;
int32_t semzcnt;
int32_t semval;
int32_t semadj;
nt_filetime semotime;
nt_filetime semctime;
uint32_t ipcuid;
uint32_t ipcgid;
uint32_t ipccuid;
uint32_t ipccgid;
uint32_t ipcmode;
int32_t ipcseq;
uint32_t ntaccess;
uint32_t ntattr;
uint32_t ntshare;
uint32_t ntoptions;
nt_iosb ntiosb;
nt_iosb * riosb;
} nt_sem_info;
/* semaphore operation */
typedef struct _nt_sem_op {
uint16_t semnum;
int16_t semop;
int16_t semflag;
} nt_sem_op;
/* semaphore client interfaces */
typedef int32_t __stdcall ntapi_sem_create(
__in void * hport,
__out nt_sem_info * sem,
__in uint32_t access,
__in nt_object_attributes * oa,
__out nt_iosb * iosb,
__in uint32_t share,
__in uint32_t nslots);
typedef int32_t __stdcall ntapi_sem_open(
__in void * hport,
__out nt_sem_info * sem,
__in uint32_t access,
__in nt_object_attributes * oa,
__out nt_iosb * iosb,
__in uint32_t share,
__in uint32_t nslots);
typedef int32_t __stdcall ntapi_sem_fcntl(
__in nt_sem_info * sem,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__out nt_iosb * iosb,
__in uint32_t tty_control_code,
__in void * input_buffer __optional,
__in uint32_t input_buffer_length,
__out void * output_buffer __optional,
__in uint32_t output_buffer_length);
typedef int32_t __stdcall ntapi_sem_ioctl(
__in nt_sem_info * sem,
__in void * hevent __optional,
__in nt_io_apc_routine * apc_routine __optional,
__in void * apc_context __optional,
__out nt_iosb * iosb,
__in uint32_t ipc_control_code,
__in void * input_buffer __optional,
__in uint32_t input_buffer_length,
__out void * output_buffer __optional,
__in uint32_t output_buffer_length);
typedef int32_t __stdcall ntapi_sem_query(
__in nt_sem_info * sem,
__out nt_io_status_block * iosb,
__out void * sem_info,
__in uint32_t sem_info_length,
__in int32_t sem_ipc_cmd);
typedef int32_t __stdcall ntapi_sem_set(
__in nt_sem_info * sem,
__out nt_io_status_block * iosb,
__in void * sem_info,
__in uint32_t sem_info_length,
__in int32_t sem_ipc_cmd);
typedef int32_t __stdcall ntapi_sem_cancel(
__in nt_sem_info * sem,
__out nt_iosb * iosb);
typedef int32_t __stdcall ntapi_sem_free(
__in nt_sem_info * sem,
__out nt_iosb * iosb);
#endif
|