diff --git a/include/ntapi/nt_ipc.h b/include/ntapi/nt_ipc.h index 80760c1..ad5aacd 100644 --- a/include/ntapi/nt_ipc.h +++ b/include/ntapi/nt_ipc.h @@ -30,7 +30,7 @@ typedef int32_t __stdcall ntapi_ipc_create_pipe( __out void ** hpipe_read, __out void ** hpipe_write, - __in uint32_t advisory_buffer_size __optional); + __in uint32_t advisory_buffer_size); typedef int32_t __stdcall ntapi_ipc_connect_by_attr( diff --git a/src/ipc/ntapi_tt_create_pipe_v1.c b/src/ipc/ntapi_tt_create_pipe_v1.c index a1ef92c..53dbd7e 100644 --- a/src/ipc/ntapi_tt_create_pipe_v1.c +++ b/src/ipc/ntapi_tt_create_pipe_v1.c @@ -34,7 +34,7 @@ typedef struct __attr_ptr_size_aligned__ _nt_tty_pipe_name { int32_t __stdcall __ntapi_ipc_create_pipe_v1( __out void ** hpipe_read, __out void ** hpipe_write, - __in uint32_t advisory_buffer_size __optional) + __in uint32_t advisory_buffer_size) { int32_t status; @@ -110,8 +110,8 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v1( /* init security structure */ sqos.length = sizeof(sqos); - sqos.impersonation_level = NT_SECURITY_IMPERSONATION; - sqos.context_tracking_mode = NT_SECURITY_TRACKING_DYNAMIC; + sqos.impersonation_level = NT_SECURITY_ANONYMOUS; + sqos.context_tracking_mode = NT_SECURITY_TRACKING_STATIC; sqos.effective_only = 1; /* oa */ @@ -134,12 +134,12 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v1( NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE, NT_FILE_CREATE, NT_FILE_ASYNCHRONOUS_IO, - 0, - 0, - 0, + NT_FILE_PIPE_BYTE_STREAM_TYPE, + NT_FILE_PIPE_BYTE_STREAM_MODE, + NT_FILE_PIPE_QUEUE_OPERATION, 1, - 0x2000, - 0x2000, + advisory_buffer_size, + advisory_buffer_size, &timeout); if (status != NT_STATUS_SUCCESS) { @@ -153,7 +153,7 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v1( &oa, &iosb, NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE, - NT_FILE_WRITE_THROUGH | NT_FILE_ASYNCHRONOUS_IO | NT_FILE_NON_DIRECTORY_FILE); + NT_FILE_WRITE_THROUGH | NT_FILE_SYNCHRONOUS_IO_ALERT | NT_FILE_NON_DIRECTORY_FILE); if (status != NT_STATUS_SUCCESS) { __ntapi->zw_close(hread); diff --git a/src/ipc/ntapi_tt_create_pipe_v2.c b/src/ipc/ntapi_tt_create_pipe_v2.c index 61142f6..a61036b 100644 --- a/src/ipc/ntapi_tt_create_pipe_v2.c +++ b/src/ipc/ntapi_tt_create_pipe_v2.c @@ -14,7 +14,7 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( __out void ** hpipe_read, __out void ** hpipe_write, - __in uint32_t advisory_buffer_size __optional) + __in uint32_t advisory_buffer_size) { int32_t status; @@ -33,8 +33,6 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( '\\','N','a','m','e','d','P','i','p','e','\\',0 }; - (void)advisory_buffer_size; - /* nt_name: pipe device directory */ nt_name.strlen = (uint16_t)(sizeof(pipe_dir) - sizeof(wchar16_t)); nt_name.maxlen = 0; @@ -42,8 +40,8 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( /* init security structure */ sqos.length = sizeof(sqos); - sqos.impersonation_level = NT_SECURITY_IMPERSONATION; - sqos.context_tracking_mode = NT_SECURITY_TRACKING_DYNAMIC; + sqos.impersonation_level = NT_SECURITY_ANONYMOUS; + sqos.context_tracking_mode = NT_SECURITY_TRACKING_STATIC; sqos.effective_only = 1; /* oa */ @@ -79,12 +77,12 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE, NT_FILE_CREATE, NT_FILE_ASYNCHRONOUS_IO, - 0, - 0, - 0, + NT_FILE_PIPE_BYTE_STREAM_TYPE, + NT_FILE_PIPE_BYTE_STREAM_MODE, + NT_FILE_PIPE_QUEUE_OPERATION, 1, - 0X2000, - 0x2000, + advisory_buffer_size, + advisory_buffer_size, &timeout); __ntapi->zw_close( @@ -102,7 +100,7 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( &oa, &iosb, NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE, - NT_FILE_WRITE_THROUGH | NT_FILE_ASYNCHRONOUS_IO | NT_FILE_NON_DIRECTORY_FILE); + NT_FILE_WRITE_THROUGH | NT_FILE_SYNCHRONOUS_IO_ALERT | NT_FILE_NON_DIRECTORY_FILE); if (status) { __ntapi->zw_close(hread);