mirror of
https://github.com/reactos/reactos.git
synced 2024-10-03 07:53:49 +00:00
Implemented mailslot functions
svn path=/trunk/; revision=1873
This commit is contained in:
parent
9f1e5ac42c
commit
4be50fdc7e
|
@ -85,16 +85,16 @@
|
|||
#define FILE_ATTRIBUTE_SPARSE_FILE (512)
|
||||
#define FILE_ATTRIBUTE_SYSTEM (4)
|
||||
#define FILE_ATTRIBUTE_TEMPORARY (256)
|
||||
#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
|
||||
#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
|
||||
#define FILE_FLAG_WRITE_THROUGH (2147483648)
|
||||
#define FILE_FLAG_OVERLAPPED (1073741824)
|
||||
#define FILE_FLAG_NO_BUFFERING (536870912)
|
||||
#define FILE_FLAG_RANDOM_ACCESS (268435456)
|
||||
#define FILE_FLAG_SEQUENTIAL_SCAN (134217728)
|
||||
#define FILE_FLAG_DELETE_ON_CLOSE (67108864)
|
||||
#define FILE_FLAG_BACKUP_SEMANTICS (33554432)
|
||||
#define FILE_FLAG_POSIX_SEMANTICS (16777216)
|
||||
#define FILE_ATTRIBUTE_VALID_FLAGS (0x00007fb7)
|
||||
#define FILE_ATTRIBUTE_VALID_SET_FLAGS (0x000031a7)
|
||||
#define FILE_FLAG_WRITE_THROUGH (0x80000000)
|
||||
#define FILE_FLAG_OVERLAPPED (0x40000000)
|
||||
#define FILE_FLAG_NO_BUFFERING (0x20000000)
|
||||
#define FILE_FLAG_RANDOM_ACCESS (0x10000000)
|
||||
#define FILE_FLAG_SEQUENTIAL_SCAN (0x08000000)
|
||||
#define FILE_FLAG_DELETE_ON_CLOSE (0x04000000)
|
||||
#define FILE_FLAG_BACKUP_SEMANTICS (0x02000000)
|
||||
#define FILE_FLAG_POSIX_SEMANTICS (0x01000000)
|
||||
|
||||
/* GetVolumeInformation */
|
||||
#define FS_CASE_IS_PRESERVED (2)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mailslot.c,v 1.1 2001/03/31 01:17:29 dwelch Exp $
|
||||
/* $Id: mailslot.c,v 1.2 2001/05/02 22:29:18 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -11,67 +11,112 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <kernel32/kernel32.h>
|
||||
#include <kernel32/error.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
CreateMailslotA (
|
||||
LPCSTR lpName,
|
||||
DWORD nMaxMessageSize,
|
||||
DWORD lReadTimeout,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes
|
||||
)
|
||||
HANDLE STDCALL
|
||||
CreateMailslotA(LPCSTR lpName,
|
||||
DWORD nMaxMessageSize,
|
||||
DWORD lReadTimeout,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
HANDLE MailslotHandle;
|
||||
UNICODE_STRING NameU;
|
||||
ANSI_STRING NameA;
|
||||
|
||||
RtlInitAnsiString(&NameA, (LPSTR)lpName);
|
||||
RtlAnsiStringToUnicodeString(&NameU, &NameA, TRUE);
|
||||
|
||||
MailslotHandle = CreateMailslotW(NameU.Buffer,
|
||||
nMaxMessageSize,
|
||||
lReadTimeout,
|
||||
lpSecurityAttributes);
|
||||
|
||||
RtlFreeUnicodeString(&NameU);
|
||||
|
||||
return(MailslotHandle);
|
||||
}
|
||||
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
CreateMailslotW (
|
||||
LPCWSTR lpName,
|
||||
DWORD nMaxMessageSize,
|
||||
DWORD lReadTimeout,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes
|
||||
)
|
||||
HANDLE STDCALL
|
||||
CreateMailslotW(LPCWSTR lpName,
|
||||
DWORD nMaxMessageSize,
|
||||
DWORD lReadTimeout,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING MailslotName;
|
||||
HANDLE MailslotHandle;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Result;
|
||||
LARGE_INTEGER DefaultTimeOut;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
|
||||
Result = RtlDosPathNameToNtPathName_U((LPWSTR)lpName,
|
||||
&MailslotName,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!Result)
|
||||
{
|
||||
SetLastError(ERROR_PATH_NOT_FOUND);
|
||||
return(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
DPRINT("Mailslot name: %wZ\n", &MailslotName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&MailslotName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
DefaultTimeOut.QuadPart = lReadTimeout * 10000;
|
||||
|
||||
Status = NtCreateMailslotFile(&MailslotHandle,
|
||||
GENERIC_READ | SYNCHRONIZE | WRITE_DAC,
|
||||
&ObjectAttributes,
|
||||
&Iosb,
|
||||
FILE_WRITE_THROUGH,
|
||||
0,
|
||||
nMaxMessageSize,
|
||||
&DefaultTimeOut);
|
||||
|
||||
RtlFreeUnicodeString(&MailslotName);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtCreateMailslot failed (Status %x)!\n", Status);
|
||||
SetLastErrorByStatus (Status);
|
||||
return(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
return(MailslotHandle);
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetMailslotInfo (
|
||||
HANDLE hMailslot,
|
||||
LPDWORD lpMaxMessageSize,
|
||||
LPDWORD lpNextSize,
|
||||
LPDWORD lpMessageCount,
|
||||
LPDWORD lpReadTimeout
|
||||
)
|
||||
|
||||
WINBOOL STDCALL
|
||||
GetMailslotInfo(HANDLE hMailslot,
|
||||
LPDWORD lpMaxMessageSize,
|
||||
LPDWORD lpNextSize,
|
||||
LPDWORD lpMessageCount,
|
||||
LPDWORD lpReadTimeout)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetMailslotInfo (
|
||||
HANDLE hMailslot,
|
||||
DWORD lReadTimeout
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL
|
||||
SetMailslotInfo(HANDLE hMailslot,
|
||||
DWORD lReadTimeout)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue