Move mailslot set and query info implementation to ntdll.

This commit is contained in:
Mike McCormack 2005-04-11 14:20:49 +00:00 committed by Alexandre Julliard
parent 861282bf28
commit 016206c1e1
3 changed files with 80 additions and 30 deletions

View File

@ -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 )
status = NtQueryInformationFile( hMailslot, &iosb, &info, sizeof info,
FileMailslotQueryInformation );
if( status != STATUS_SUCCESS )
{
req->handle = hMailslot;
req->flags = 0;
r = !wine_server_call_err( req );
if( r )
{
if( lpMaxMessageSize )
*lpMaxMessageSize = reply->max_msgsize;
if( lpNextSize )
*lpNextSize = reply->next_msgsize;
if( lpMessageCount )
*lpMessageCount = reply->msg_count;
if( lpReadTimeout )
*lpReadTimeout = reply->read_timeout;
}
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
SERVER_END_REQ;
return r;
if( lpMaxMessageSize )
*lpMaxMessageSize = info.MaximumMessageSize;
if( lpNextSize )
*lpNextSize = info.NextMessageSize;
if( lpMessageCount )
*lpMessageCount = info.MessagesAvailable;
if( lpReadTimeout )
*lpReadTimeout = info.ReadTimeout.QuadPart / -10000;
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;
}

View File

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

View File

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