diff --git a/src/ipc/ntapi_tt_create_pipe_v2.c b/src/ipc/ntapi_tt_create_pipe_v2.c index 7252bf4..23cc61d 100644 --- a/src/ipc/ntapi_tt_create_pipe_v2.c +++ b/src/ipc/ntapi_tt_create_pipe_v2.c @@ -26,7 +26,7 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( nt_io_status_block iosb; nt_sqos sqos; nt_unicode_string nt_name; - nt_large_integer timeout; + nt_timeout timeout; const wchar16_t pipe_dir[] = { '\\','D','e','v','i','c','e', @@ -54,15 +54,13 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( oa.sec_desc = (nt_security_descriptor *)0; oa.sec_qos = &sqos; - 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); - - if (status != NT_STATUS_SUCCESS) + 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; @@ -70,8 +68,8 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( oa.root_dir = hdevpipes; - nt_name.strlen=0; - nt_name.buffer = (uint16_t *)0; + nt_name.strlen = 0; + nt_name.buffer = 0; status = __ntapi->zw_create_named_pipe_file( &hread, @@ -89,10 +87,11 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( 0x2000, &timeout); - if (status != NT_STATUS_SUCCESS) { - __ntapi->zw_close(hdevpipes); + __ntapi->zw_close( + hdevpipes); + + if (status) return status; - } /* the pipe is now our root directory */ oa.root_dir = hread; @@ -105,8 +104,7 @@ int32_t __stdcall __ntapi_ipc_create_pipe_v2( NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE, NT_FILE_WRITE_THROUGH | NT_FILE_ASYNCHRONOUS_IO | NT_FILE_NON_DIRECTORY_FILE); - if (status != NT_STATUS_SUCCESS) { - __ntapi->zw_close(hdevpipes); + if (status) { __ntapi->zw_close(hread); return status; }