summaryrefslogtreecommitdiffhomepage
path: root/src/ipc/ntapi_tt_create_pipe_v2.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-08-18 05:22:59 +0000
committermidipix <writeonce@midipix.org>2017-08-18 03:04:34 -0400
commit93df7957a125a9e6948da9101388f91667b25826 (patch)
tree8ef9bb94681c9580c9f39fa878371ef4719eea86 /src/ipc/ntapi_tt_create_pipe_v2.c
parent842d0f7290d2ac08f9e3a149363477274b9b95cd (diff)
downloadntapi-93df7957a125a9e6948da9101388f91667b25826.tar.bz2
ntapi-93df7957a125a9e6948da9101388f91667b25826.tar.xz
project: src/ipc: normalized source file names.
Diffstat (limited to 'src/ipc/ntapi_tt_create_pipe_v2.c')
-rw-r--r--src/ipc/ntapi_tt_create_pipe_v2.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/src/ipc/ntapi_tt_create_pipe_v2.c b/src/ipc/ntapi_tt_create_pipe_v2.c
deleted file mode 100644
index a61036b..0000000
--- a/src/ipc/ntapi_tt_create_pipe_v2.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/********************************************************/
-/* ntapi: Native API core library */
-/* Copyright (C) 2013--2017 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
-/********************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <ntapi/nt_file.h>
-#include <ntapi/nt_string.h>
-#include <ntapi/nt_tty.h>
-#include <ntapi/ntapi.h>
-#include "ntapi_impl.h"
-
-int32_t __stdcall __ntapi_ipc_create_pipe_v2(
- __out void ** hpipe_read,
- __out void ** hpipe_write,
- __in uint32_t advisory_buffer_size)
-{
- int32_t status;
-
- void * hdevpipes;
- void * hwrite;
- void * hread;
-
- nt_object_attributes oa;
- nt_io_status_block iosb;
- nt_sqos sqos;
- nt_unicode_string nt_name;
- nt_timeout timeout;
-
- const wchar16_t pipe_dir[] = {
- '\\','D','e','v','i','c','e',
- '\\','N','a','m','e','d','P','i','p','e','\\',0
- };
-
- /* nt_name: pipe device directory */
- nt_name.strlen = (uint16_t)(sizeof(pipe_dir) - sizeof(wchar16_t));
- nt_name.maxlen = 0;
- nt_name.buffer = (uint16_t *)pipe_dir;
-
- /* init security structure */
- sqos.length = sizeof(sqos);
- sqos.impersonation_level = NT_SECURITY_ANONYMOUS;
- sqos.context_tracking_mode = NT_SECURITY_TRACKING_STATIC;
- sqos.effective_only = 1;
-
- /* oa */
- oa.len = sizeof(oa);
- oa.root_dir = (void *)0;
- oa.obj_name = &nt_name;
- oa.obj_attr = NT_OBJ_CASE_INSENSITIVE | NT_OBJ_INHERIT;
- oa.sec_desc = (nt_security_descriptor *)0;
- oa.sec_qos = &sqos;
-
- if ((status = __ntapi->zw_open_file(
- &hdevpipes,
- NT_GENERIC_READ | NT_SEC_SYNCHRONIZE,
- &oa,
- &iosb,
- NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE,
- NT_FILE_DIRECTORY_FILE)))
- return status;
-
- timeout.ihigh = 0xffffffff;
- timeout.ulow = 0x0;
-
- oa.root_dir = hdevpipes;
-
- nt_name.strlen = 0;
- nt_name.buffer = 0;
-
- status = __ntapi->zw_create_named_pipe_file(
- &hread,
- NT_GENERIC_READ | NT_SEC_SYNCHRONIZE | NT_FILE_WRITE_ATTRIBUTES,
- &oa,
- &iosb,
- NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE,
- NT_FILE_CREATE,
- NT_FILE_ASYNCHRONOUS_IO,
- NT_FILE_PIPE_BYTE_STREAM_TYPE,
- NT_FILE_PIPE_BYTE_STREAM_MODE,
- NT_FILE_PIPE_QUEUE_OPERATION,
- 1,
- advisory_buffer_size,
- advisory_buffer_size,
- &timeout);
-
- __ntapi->zw_close(
- hdevpipes);
-
- if (status)
- return status;
-
- /* the pipe is now our root directory */
- oa.root_dir = hread;
-
- status = __ntapi->zw_open_file(
- &hwrite,
- NT_GENERIC_WRITE | NT_SEC_SYNCHRONIZE | NT_FILE_READ_ATTRIBUTES,
- &oa,
- &iosb,
- NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE,
- NT_FILE_WRITE_THROUGH | NT_FILE_SYNCHRONOUS_IO_ALERT | NT_FILE_NON_DIRECTORY_FILE);
-
- if (status) {
- __ntapi->zw_close(hread);
- return status;
- }
-
- *hpipe_read = hread;
- *hpipe_write = hwrite;
-
- return status;
-}