ntdll: Set default timeout in NtCreateMailslotFile if parameter is NULL.

This commit is contained in:
Jeff Latimer 2007-02-27 23:42:06 +11:00 committed by Alexandre Julliard
parent cb489f7a25
commit 74db5a192e
2 changed files with 21 additions and 1 deletions

View File

@ -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 );

View File

@ -69,6 +69,17 @@ static void nt_mailslot_test(void)
&TimeOut);
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
*/