From 74db5a192e6dc593ce77d5233dea8b1530eabb28 Mon Sep 17 00:00:00 2001 From: Jeff Latimer Date: Tue, 27 Feb 2007 23:42:06 +1100 Subject: [PATCH] ntdll: Set default timeout in NtCreateMailslotFile if parameter is NULL. --- dlls/ntdll/file.c | 11 ++++++++++- dlls/ntdll/tests/file.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index ffda3793b4d..29295906f01 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2202,6 +2202,7 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, ULONG CreateOptions, ULONG MailslotQuota, ULONG MaxMessageSize, PLARGE_INTEGER TimeOut) { + LARGE_INTEGER timeout; static const WCHAR leadin[] = { '\\','?','?','\\','M','A','I','L','S','L','O','T','\\'}; NTSTATUS ret; @@ -2219,13 +2220,21 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, return STATUS_OBJECT_NAME_INVALID; } + /* + * For a NULL TimeOut pointer set the default timeout value + */ + if (!TimeOut) + timeout.QuadPart = -1; + else + timeout.QuadPart = TimeOut->QuadPart; + SERVER_START_REQ( create_mailslot ) { req->access = DesiredAccess; req->attributes = attr->Attributes; req->rootdir = attr->RootDirectory; req->max_msgsize = MaxMessageSize; - req->read_timeout = (TimeOut->QuadPart <= 0) ? TimeOut->QuadPart / -10000 : -1; + req->read_timeout = (timeout.QuadPart <= 0) ? timeout.QuadPart / -10000 : -1; wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length ); ret = wine_server_call( req ); diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 9baadfec2dc..f3a3867c550 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -70,6 +70,17 @@ static void nt_mailslot_test(void) ok( rc == STATUS_ACCESS_VIOLATION, "rc = %x not c0000005 STATUS_ACCESS_VIOLATION\n", rc); /* + * Test to see if the Timeout can be NULL + */ + rc = pNtCreateMailslotFile(&hslot, DesiredAccess, + &attr, &IoStatusBlock, CreateOptions, MailslotQuota, MaxMessageSize, + NULL); + ok( rc == STATUS_SUCCESS, "rc = %x not STATUS_SUCCESS\n", rc); + ok( hslot != 0, "Handle is invalid\n"); + + if ( rc == STATUS_SUCCESS ) rc = pNtClose(hslot); + + /* * Test a valid call */ rc = pNtCreateMailslotFile(&hslot, DesiredAccess, -- 2.11.4.GIT