Module: wine Branch: master Commit: 74db5a192e6dc593ce77d5233dea8b1530eabb28 URL: http://source.winehq.org/git/wine.git/?a=commit;h=74db5a192e6dc593ce77d5233d...
Author: Jeff Latimer lats@yless4u.com.au Date: Tue Feb 27 23:42:06 2007 +1100
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 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index ffda379..2929590 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 9baadfe..f3a3867 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,