From a6563a605d7906252921503e89eae8da00eb599c Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 8 Sep 2017 22:22:22 +0000 Subject: subsystem interfaces: integrated sysv msgqueue definitions. --- include/ntapi/nt_ipc.h | 9 +++++++ include/ntapi/nt_msq.h | 49 +++++++++++++++++++++++++++++++++++++++ include/ntapi/nt_port.h | 5 ++++ include/ntapi/nt_tty.h | 29 +++++++++++++++++++++++ project/headers.mk | 1 + src/port/ntapi_port_name_helper.c | 8 +++++-- 6 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 include/ntapi/nt_msq.h diff --git a/include/ntapi/nt_ipc.h b/include/ntapi/nt_ipc.h index ad5aacd..dd71874 100644 --- a/include/ntapi/nt_ipc.h +++ b/include/ntapi/nt_ipc.h @@ -9,11 +9,20 @@ #define NT_IPC_GUID_SEMKEY {0xc6e442c3,0x2ac5,0x4d1d,{0x92,0xf3,0x6e,0x10,0xc6,0x1f,0x53,0x79}} #define NT_IPC_GUID_SEMPID {0x571ac9bb,0x22eb,0x43f2,{0x8d,0xd6,0x64,0x39,0x49,0xa6,0xe9,0x1f}} +#define NT_IPC_GUID_MSQCTL {0x7c1113e3,0x224f,0x435e,{0xa9,0x58,0xb8,0x2b,0x08,0xae,0x3d,0x67}} +#define NT_IPC_GUID_MSQKEY {0x8f700621,0x45d2,0x4470,{0x82,0xe4,0xbc,0xad,0x06,0x71,0xb7,0x14}} +#define NT_IPC_GUID_MSQPID {0x3c6c2b5b,0x727f,0x4a2e,{0xb2,0x21,0xed,0xd2,0xe6,0xe7,0x80,0xdc}} + + /* friendly ipc object directory prefixes */ #define NT_IPC_OBJDIR_PREFIX_SEMCTL {'s','e','m','c','t','l'} #define NT_IPC_OBJDIR_PREFIX_SEMKEY {'s','e','m','k','e','y'} #define NT_IPC_OBJDIR_PREFIX_SEMPID {'s','e','m','p','i','d'} +#define NT_IPC_OBJDIR_PREFIX_MSQCTL {'m','s','q','c','t','l'} +#define NT_IPC_OBJDIR_PREFIX_MSQKEY {'m','s','q','k','e','y'} +#define NT_IPC_OBJDIR_PREFIX_MSQPID {'m','s','q','p','i','d'} + /* ipc commands */ #define NT_IPC_CMD_RMID (0) diff --git a/include/ntapi/nt_msq.h b/include/ntapi/nt_msq.h new file mode 100644 index 0000000..1aff629 --- /dev/null +++ b/include/ntapi/nt_msq.h @@ -0,0 +1,49 @@ +#ifndef _NT_MSQ_H_ +#define _NT_MSQ_H_ + +#include "nt_abi.h" +#include "nt_object.h" + +/* semaphore command flags */ +#define NT_MSQ_FLAG_NOWAIT (0x0800) +#define NT_MSQ_FLAG_NOERROR (0x1000) + + +/* msgqueue info */ +typedef struct __attr_ptr_size_aligned__ _nt_msq_info { + void * hport; + void * section; + void * section_addr; + size_t section_size; + void * hevent; + void * apc_routine; + void * apc_context; + int32_t msqkey; + int32_t msqid; + int32_t msqspid; + int32_t msqrpid; + intptr_t msqrank; + uintptr_t msqslots; + uintptr_t msqcbytes; + uintptr_t msqqbytes; + uint32_t msqscnt; + uint32_t msqrcnt; + nt_filetime msqstime; + nt_filetime msqrtime; + nt_filetime msqctime; + 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_msq_info; + + +#endif diff --git a/include/ntapi/nt_port.h b/include/ntapi/nt_port.h index dcf1b4f..86c3d93 100644 --- a/include/ntapi/nt_port.h +++ b/include/ntapi/nt_port.h @@ -37,6 +37,8 @@ typedef enum _nt_port_type { NT_PORT_TYPE_NTPROC, /* {'n','t','p','r','o','c'} */ NT_PORT_TYPE_SEMCTL, /* {'s','e','m','c','t','l'} */ NT_PORT_TYPE_SEMSVC, /* {'s','e','m','s','v','c'} */ + NT_PORT_TYPE_MSQCTL, /* {'m','s','q','c','t','l'} */ + NT_PORT_TYPE_MSQSVC, /* {'m','s','q','s','v','c'} */ NT_PORT_TYPE_CAP } nt_port_type; @@ -57,6 +59,9 @@ typedef enum _nt_port_subtype { #define NT_PORT_GUID_NTPROC {0xd7f3f3a5,0x3e82,0x4f3e,{0x9d,0x6c,0x36,0x18,0xde,0xfa,0xc6,0x69}} #define NT_PORT_GUID_SEMCTL {0x7850be42,0x7eef,0x4c3d,{0xa7,0x05,0xa4,0xd8,0x47,0x3f,0x67,0x56}} #define NT_PORT_GUID_SEMSVC {0xa50f4380,0x854a,0x4260,{0x9d,0x8d,0xc2,0xc2,0xa1,0x16,0xde,0xf3}} +#define NT_PORT_GUID_MSQCTL {0xd2a8c20a,0x0e4b,0x4a7b,{0xb2,0x3a,0x86,0xa4,0x3b,0x87,0x9a,0x26}} +#define NT_PORT_GUID_MSQSVC {0x3e443cd7,0xdd08,0x4133,{0x9c,0x92,0x02,0x5d,0x9e,0xbd,0x3a,0xcd}} + /* lpc messages */ #define NT_LPC_REFUSE_CONNECTION 0x0000 diff --git a/include/ntapi/nt_tty.h b/include/ntapi/nt_tty.h index 5555d85..3ad46c7 100644 --- a/include/ntapi/nt_tty.h +++ b/include/ntapi/nt_tty.h @@ -16,6 +16,7 @@ #include "nt_port.h" #include "nt_termios.h" #include "nt_sem.h" +#include "nt_msq.h" /* tty affiliation */ typedef struct _nt_tty_affiliation { @@ -65,6 +66,8 @@ typedef enum _nt_tty_opcode { NT_TTY_QUERY_INFORMATION_SECTION, NT_TTY_QUERY_INFORMATION_PTY, NT_TTY_QUERY_INFORMATION_SEMAPHORE, + NT_TTY_QUERY_INFORMATION_MSGQUEUE, + NT_TTY_QUERY_INFORMATION_RESERVED, /* peer daemon calls */ NT_TTY_REQUEST_PEER, NT_TTY_SIGNAL_PEER, @@ -92,6 +95,21 @@ typedef enum _nt_tty_opcode { NT_TTY_SEM_TRACE, NT_TTY_SEM_TRANSFER, NT_TTY_SEM_WAIT, + /* msgqueue */ + NT_TTY_MSQ_ALLOC, + NT_TTY_MSQ_FREE, + NT_TTY_MSQ_OPEN, + NT_TTY_MSQ_CLOSE, + NT_TTY_MSQ_SEND, + NT_TTY_MSQ_RECV, + NT_TTY_MSQ_QUERY, + NT_TTY_MSQ_SET, + NT_TTY_MSQ_FCNTL, + NT_TTY_MSQ_IOCTL, + NT_TTY_MSQ_CANCEL, + NT_TTY_MSQ_TRACE, + NT_TTY_MSQ_TRANSFER, + NT_TTY_MSQ_WAIT, /* virtual mount system */ NT_TTY_VMS_QUERY, NT_TTY_VMS_REQUEST, @@ -120,6 +138,7 @@ typedef enum _nt_tty_server_info_class { NT_TTY_SERVER_DBM_SLOT_INFORMATION, NT_TTY_SERVER_DBG_SLOT_INFORMATION, NT_TTY_SERVER_SEM_SLOT_INFORMATION, + NT_TTY_SERVER_MSQ_SLOT_INFORMATION, NT_TTY_SERVER_INFORMATION_CAP } nt_tty_server_info_class; @@ -436,6 +455,15 @@ typedef struct __attr_ptr_size_aligned__ _nt_sem_info_msg { } nt_sem_info_msg; +typedef struct __attr_ptr_size_aligned__ _nt_msq_info_msg { + nt_port_message header; + struct { + nt_tty_msg_info ttyinfo; + nt_msq_info msqinfo; + } data; +} nt_msq_info_msg; + + typedef struct __attr_ptr_size_aligned__ _nt_tty_session_msg { nt_port_message header; struct { @@ -464,6 +492,7 @@ typedef struct __attr_ptr_size_aligned__ _nt_tty_port_msg { nt_tty_service_info svcinfo; nt_tty_section_info secinfo; nt_sem_info seminfo; + nt_msq_info msqinfo; }; } nt_tty_port_msg; diff --git a/project/headers.mk b/project/headers.mk index c8d5a25..a89457b 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -27,6 +27,7 @@ API_HEADERS = \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_locale.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_memory.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_mount.h \ + $(SOURCE_DIR)/include/$(PACKAGE)/./nt_msq.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_object.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_os.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_pe.h \ diff --git a/src/port/ntapi_port_name_helper.c b/src/port/ntapi_port_name_helper.c index dabbdc0..3ade3e1 100644 --- a/src/port/ntapi_port_name_helper.c +++ b/src/port/ntapi_port_name_helper.c @@ -21,7 +21,9 @@ static const __port_service_prefix __port_service_prefixes[NT_PORT_TYPE_CAP][NT_ {{'s','y','m','l','n','k'}}, {{'n','t','p','r','o','c'}}, {{'s','e','m','c','t','l'}}, - {{'s','e','m','s','v','c'}}}; + {{'s','e','m','s','v','c'}}, + {{'m','s','q','c','t','l'}}, + {{'m','s','q','s','v','c'}}}; static const nt_guid __port_guids[NT_PORT_TYPE_CAP][NT_PORT_SUBTYPE_CAP] = { {NT_PORT_GUID_DEFAULT}, @@ -31,7 +33,9 @@ static const nt_guid __port_guids[NT_PORT_TYPE_CAP][NT_PORT_SUBTYPE_CAP] = { {NT_PORT_GUID_SYMLNK}, {NT_PORT_GUID_NTPROC}, {NT_PORT_GUID_SEMCTL}, - {NT_PORT_GUID_SEMSVC}}; + {NT_PORT_GUID_SEMSVC}, + {NT_PORT_GUID_MSQCTL}, + {NT_PORT_GUID_MSQSVC}}; int32_t __stdcall __ntapi_tt_port_guid_from_type( __out nt_guid * guid, -- cgit v1.2.3