Implemented missing mailslot functions

svn path=/trunk/; revision=1874
This commit is contained in:
Eric Kohl 2001-05-03 06:10:29 +00:00
parent 4be50fdc7e
commit 973bed37c6
2 changed files with 67 additions and 5 deletions

View file

@ -1220,6 +1220,18 @@ typedef struct _FILE_MODE_INFORMATION {
ULONG Mode;
} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
ULONG MaxMessageSize;
ULONG Unknown; /* ?? */
ULONG NextSize;
ULONG MessageCount;
LARGE_INTEGER Timeout;
} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
typedef struct _FILE_MAILSLOT_SET_INFORMATION {
LARGE_INTEGER Timeout;
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
typedef struct _FILE_COMPRESSION_INFORMATION {
LARGE_INTEGER CompressedFileSize;
USHORT CompressionFormat;
@ -1241,6 +1253,7 @@ typedef struct _FILE_ALL_INFORMATION {
FILE_NAME_INFORMATION NameInformation;
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
// file system information structures
typedef struct _FILE_FS_DEVICE_INFORMATION {

View file

@ -1,4 +1,4 @@
/* $Id: mailslot.c,v 1.2 2001/05/02 22:29:18 ekohl Exp $
/* $Id: mailslot.c,v 1.3 2001/05/03 06:10:29 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -106,8 +106,40 @@ GetMailslotInfo(HANDLE hMailslot,
LPDWORD lpMessageCount,
LPDWORD lpReadTimeout)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
FILE_MAILSLOT_QUERY_INFORMATION Buffer;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
Status = NtQueryInformationFile(hMailslot,
&Iosb,
&Buffer,
sizeof(FILE_MAILSLOT_QUERY_INFORMATION),
FileMailslotQueryInformation);
if (!NT_SUCCESS(Status))
{
DPRINT("NtQueryInformationFile failed (Status %x)!\n", Status);
SetLastErrorByStatus (Status);
return(FALSE);
}
if (lpMaxMessageSize != NULL)
{
*lpMaxMessageSize = Buffer.MaxMessageSize;
}
if (lpNextSize != NULL)
{
*lpNextSize = Buffer.NextSize;
}
if (lpMessageCount != NULL)
{
*lpMessageCount = Buffer.MessageCount;
}
if (lpReadTimeout != NULL)
{
*lpReadTimeout = (DWORD)(Buffer.Timeout.QuadPart / 10000);
}
return(TRUE);
}
@ -115,8 +147,25 @@ WINBOOL STDCALL
SetMailslotInfo(HANDLE hMailslot,
DWORD lReadTimeout)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
FILE_MAILSLOT_SET_INFORMATION Buffer;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
Buffer.Timeout.QuadPart = lReadTimeout * 10000;
Status = NtSetInformationFile(hMailslot,
&Iosb,
&Buffer,
sizeof(FILE_MAILSLOT_SET_INFORMATION),
FileMailslotSetInformation);
if (!NT_SUCCESS(Status))
{
DPRINT("NtSetInformationFile failed (Status %x)!\n", Status);
SetLastErrorByStatus (Status);
return(FALSE);
}
return(TRUE);
}
/* EOF */