Commit 016206c1 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Move mailslot set and query info implementation to ntdll.

parent 861282bf
......@@ -1641,31 +1641,32 @@ BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
LPDWORD lpNextSize, LPDWORD lpMessageCount,
LPDWORD lpReadTimeout )
{
BOOL r;
FILE_MAILSLOT_QUERY_INFORMATION info;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
TRACE("%p %p %p %p %p\n",hMailslot,
lpMaxMessageSize,lpNextSize,lpMessageCount,lpReadTimeout);
TRACE("%p %p %p %p %p\n",hMailslot, lpMaxMessageSize,
lpNextSize, lpMessageCount, lpReadTimeout);
SERVER_START_REQ( set_mailslot_info )
{
req->handle = hMailslot;
req->flags = 0;
r = !wine_server_call_err( req );
if( r )
status = NtQueryInformationFile( hMailslot, &iosb, &info, sizeof info,
FileMailslotQueryInformation );
if( status != STATUS_SUCCESS )
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
if( lpMaxMessageSize )
*lpMaxMessageSize = reply->max_msgsize;
*lpMaxMessageSize = info.MaximumMessageSize;
if( lpNextSize )
*lpNextSize = reply->next_msgsize;
*lpNextSize = info.NextMessageSize;
if( lpMessageCount )
*lpMessageCount = reply->msg_count;
*lpMessageCount = info.MessagesAvailable;
if( lpReadTimeout )
*lpReadTimeout = reply->read_timeout;
}
}
SERVER_END_REQ;
*lpReadTimeout = info.ReadTimeout.QuadPart / -10000;
return r;
return TRUE;
}
......@@ -1684,20 +1685,21 @@ BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
*/
BOOL WINAPI SetMailslotInfo( HANDLE hMailslot, DWORD dwReadTimeout)
{
BOOL r;
FILE_MAILSLOT_SET_INFORMATION info;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
TRACE("%p %ld\n", hMailslot, dwReadTimeout);
SERVER_START_REQ( set_mailslot_info )
info.ReadTimeout.QuadPart = dwReadTimeout * -10000;
status = NtSetInformationFile( hMailslot, &iosb, &info, sizeof info,
FileMailslotSetInformation );
if( status != STATUS_SUCCESS )
{
req->handle = hMailslot;
req->flags = MAILSLOT_SET_READ_TIMEOUT;
req->read_timeout = dwReadTimeout;
r = !wine_server_call_err( req );
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
SERVER_END_REQ;
return r;
return TRUE;
}
......
......@@ -941,7 +941,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
0, /* FilePipeInformation */
0, /* FilePipeLocalInformation */
0, /* FilePipeRemoteInformation */
0, /* FileMailslotQueryInformation */
sizeof(FILE_MAILSLOT_QUERY_INFORMATION), /* FileMailslotQueryInformation */
0, /* FileMailslotSetInformation */
0, /* FileCompressionInformation */
0, /* FileObjectIdInformation */
......@@ -1093,6 +1093,27 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
}
}
break;
case FileMailslotQueryInformation:
{
FILE_MAILSLOT_QUERY_INFORMATION *info = ptr;
SERVER_START_REQ( set_mailslot_info )
{
req->handle = hFile;
req->flags = 0;
io->u.Status = wine_server_call( req );
if( io->u.Status == STATUS_SUCCESS )
{
info->MaximumMessageSize = reply->max_msgsize;
info->MailslotQuota = 0;
info->NextMessageSize = reply->next_msgsize;
info->MessagesAvailable = reply->msg_count;
info->ReadTimeout.QuadPart = reply->read_timeout * -10000;
}
}
SERVER_END_REQ;
}
break;
default:
FIXME("Unsupported class (%d)\n", class);
io->u.Status = STATUS_NOT_IMPLEMENTED;
......@@ -1229,6 +1250,21 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
else io->u.Status = STATUS_INVALID_PARAMETER_3;
break;
case FileMailslotSetInformation:
{
FILE_MAILSLOT_SET_INFORMATION *info = ptr;
SERVER_START_REQ( set_mailslot_info )
{
req->handle = handle;
req->flags = MAILSLOT_SET_READ_TIMEOUT;
req->read_timeout = info->ReadTimeout.QuadPart / -10000;
io->u.Status = wine_server_call( req );
}
SERVER_END_REQ;
}
break;
default:
FIXME("Unsupported class (%d)\n", class);
io->u.Status = STATUS_NOT_IMPLEMENTED;
......
......@@ -436,6 +436,18 @@ typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION
ULONG ReparseTag;
} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
ULONG MaximumMessageSize;
ULONG MailslotQuota;
ULONG NextMessageSize;
ULONG MessagesAvailable;
LARGE_INTEGER ReadTimeout;
} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
typedef struct _FILE_MAILSLOT_SET_INFORMATION {
LARGE_INTEGER ReadTimeout;
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
typedef struct _FILE_ALL_INFORMATION
{
FILE_BASIC_INFORMATION BasicInformation;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment