diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c index bada447e979..fd0b9eaa8b9 100644 --- a/dlls/kernel/sync.c +++ b/dlls/kernel/sync.c @@ -1672,7 +1672,10 @@ HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; - timeout.QuadPart = (ULONGLONG) lReadTimeout * -10000; + if (lReadTimeout != MAILSLOT_WAIT_FOREVER) + timeout.QuadPart = (ULONGLONG) lReadTimeout * -10000; + else + timeout.QuadPart = ((LONGLONG)0x7fffffff << 32) | 0xffffffff; status = NtCreateMailslotFile( &handle, GENERIC_READ | GENERIC_WRITE, &attr, &iosb, 0, 0, nMaxMessageSize, &timeout ); diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 13105291591..b5d3f6ab1aa 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2061,7 +2061,7 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, req->access = DesiredAccess; req->attributes = (attr) ? attr->Attributes : 0; req->max_msgsize = MaxMessageSize; - req->read_timeout = TimeOut->QuadPart / -10000; + req->read_timeout = (TimeOut->QuadPart <= 0) ? TimeOut->QuadPart / -10000 : -1; wine_server_add_data( req, attr->ObjectName->Buffer + 4, attr->ObjectName->Length - 4*sizeof(WCHAR) ); ret = wine_server_call( req ); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index e8dc3b346cb..168e9316727 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3532,7 +3532,7 @@ struct create_mailslot_request unsigned int access; unsigned int attributes; unsigned int max_msgsize; - unsigned int read_timeout; + int read_timeout; /* VARARG(name,unicode_str); */ }; struct create_mailslot_reply @@ -3564,13 +3564,13 @@ struct set_mailslot_info_request struct request_header __header; obj_handle_t handle; unsigned int flags; - unsigned int read_timeout; + int read_timeout; }; struct set_mailslot_info_reply { struct reply_header __header; unsigned int max_msgsize; - unsigned int read_timeout; + int read_timeout; unsigned int msg_count; unsigned int next_msgsize; }; @@ -4208,6 +4208,6 @@ union generic_reply struct set_mailslot_info_reply set_mailslot_info_reply; }; -#define SERVER_PROTOCOL_VERSION 198 +#define SERVER_PROTOCOL_VERSION 199 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/mailslot.c b/server/mailslot.c index 918bcdda761..d421a9d2942 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -56,7 +56,7 @@ struct mailslot struct fd *fd; struct fd *write_fd; unsigned int max_msgsize; - unsigned int read_timeout; + int read_timeout; struct list writers; }; @@ -207,8 +207,7 @@ static void mailslot_queue_async( struct fd *fd, void *apc, void *user, return; } - if (mailslot->read_timeout != MAILSLOT_WAIT_FOREVER) - timeout = &mailslot->read_timeout; + if (mailslot->read_timeout != -1) timeout = &mailslot->read_timeout; fd_queue_async_timeout( fd, apc, user, iosb, type, count, timeout ); } diff --git a/server/protocol.def b/server/protocol.def index 23140dfe4a5..95ec43b5433 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2475,7 +2475,7 @@ enum message_type unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ unsigned int max_msgsize; - unsigned int read_timeout; + int read_timeout; VARARG(name,unicode_str); /* mailslot name */ @REPLY obj_handle_t handle; /* handle to the mailslot */ @@ -2497,10 +2497,10 @@ enum message_type @REQ(set_mailslot_info) obj_handle_t handle; /* handle to the mailslot */ unsigned int flags; - unsigned int read_timeout; + int read_timeout; @REPLY unsigned int max_msgsize; - unsigned int read_timeout; + int read_timeout; unsigned int msg_count; unsigned int next_msgsize; @END diff --git a/server/trace.c b/server/trace.c index 7f98962662c..d3899978e48 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3052,7 +3052,7 @@ static void dump_create_mailslot_request( const struct create_mailslot_request * fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize ); - fprintf( stderr, " read_timeout=%08x,", req->read_timeout ); + fprintf( stderr, " read_timeout=%d,", req->read_timeout ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } @@ -3080,13 +3080,13 @@ static void dump_set_mailslot_info_request( const struct set_mailslot_info_reque { fprintf( stderr, " handle=%p,", req->handle ); fprintf( stderr, " flags=%08x,", req->flags ); - fprintf( stderr, " read_timeout=%08x", req->read_timeout ); + fprintf( stderr, " read_timeout=%d", req->read_timeout ); } static void dump_set_mailslot_info_reply( const struct set_mailslot_info_reply *req ) { fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize ); - fprintf( stderr, " read_timeout=%08x,", req->read_timeout ); + fprintf( stderr, " read_timeout=%d,", req->read_timeout ); fprintf( stderr, " msg_count=%08x,", req->msg_count ); fprintf( stderr, " next_msgsize=%08x", req->next_msgsize ); }