mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-01 04:13:35 +00:00
* lib/kernel32/debug/break.c: Add @implemented and @unimplemented to APIs. * lib/kernel32/debug/debugger.c: Ditto. * lib/kernel32/debug/output.c: Ditto. * lib/kernel32/except/except.c: Ditto. * lib/kernel32/file/backup.c: Ditto. * lib/kernel32/file/cnotify.c: Ditto. * lib/kernel32/file/copy.c: Ditto. * lib/kernel32/file/create.c: Ditto. * lib/kernel32/file/curdir.c: Ditto. * lib/kernel32/file/delete.c: Ditto. * lib/kernel32/file/deviceio.c: Ditto. * lib/kernel32/file/dir.c: Ditto. * lib/kernel32/file/dosdev.c: Ditto. * lib/kernel32/file/file.c: Ditto. * lib/kernel32/file/find.c: Ditto. * lib/kernel32/file/iocompl.c: Ditto. * lib/kernel32/file/lfile.c: Ditto. * lib/kernel32/file/lock.c: Ditto. * lib/kernel32/file/mailslot.c: Ditto. * lib/kernel32/file/move.c: Ditto. * lib/kernel32/file/npipe.c: Ditto. * lib/kernel32/file/pipe.c: Ditto. * lib/kernel32/file/rw.c: Ditto. * lib/kernel32/file/tape.c: Ditto. * lib/kernel32/file/volume.c: Ditto. * lib/kernel32/mem/global.c: Ditto. * lib/kernel32/mem/heap.c: Ditto. * lib/kernel32/mem/isbad.c: Ditto. * lib/kernel32/mem/local.c: Ditto. * lib/kernel32/mem/procmem.c: Ditto. * lib/kernel32/mem/section.c: Ditto. * lib/kernel32/mem/virtual.c: Ditto. * lib/kernel32/misc/atom.c: Ditto. * lib/kernel32/misc/comm.c: Ditto. * lib/kernel32/misc/computername.c: Ditto. * lib/kernel32/misc/console.c: Ditto. * lib/kernel32/misc/env.c: Ditto. * lib/kernel32/misc/error.c: Ditto. * lib/kernel32/misc/errormsg.c: Ditto. * lib/kernel32/misc/handle.c: Ditto. * lib/kernel32/misc/ldr.c: Ditto. * lib/kernel32/misc/mbchars.c: Ditto. * lib/kernel32/misc/muldiv.c: Ditto. * lib/kernel32/misc/perfcnt.c: Ditto. * lib/kernel32/misc/profile.c: Ditto. * lib/kernel32/misc/res.c: Ditto. * lib/kernel32/misc/stubs.c: Ditto. * lib/kernel32/misc/sysinfo.c: Ditto. * lib/kernel32/misc/time.c: Ditto. * lib/kernel32/misc/toolhelp.c: Ditto. * lib/kernel32/process/cmdline.c: Ditto. * lib/kernel32/process/create.c: Ditto. * lib/kernel32/process/proc.c: Ditto. * lib/kernel32/process/session.c: Ditto. * lib/kernel32/string/lstring.c: Ditto. * lib/kernel32/synch/critical.c: Ditto. * lib/kernel32/synch/event.c: Ditto. * lib/kernel32/synch/intrlck.c: Ditto. * lib/kernel32/synch/mutex.c: Ditto. * lib/kernel32/synch/sem.c: Ditto. * lib/kernel32/synch/timer.c: Ditto. * lib/kernel32/synch/wait.c: Ditto. * lib/kernel32/thread/fiber.c: Ditto. * lib/kernel32/thread/fls.c: Ditto. * lib/kernel32/thread/thread.c: Ditto. * lib/kernel32/thread/tls.c: Ditto. svn path=/trunk/; revision=5045
182 lines
3.8 KiB
C
182 lines
3.8 KiB
C
/* $Id: mailslot.c,v 1.8 2003/07/10 18:50:51 chorns Exp $
|
|
*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS system libraries
|
|
* FILE: lib/kernel32/file/mailslot.c
|
|
* PURPOSE: Mailslot functions
|
|
* PROGRAMMER: Ariadne ( [email protected])
|
|
* UPDATE HISTORY:
|
|
*/
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
#include <k32.h>
|
|
|
|
#define NDEBUG
|
|
#include <kernel32/kernel32.h>
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
HANDLE STDCALL
|
|
CreateMailslotA(LPCSTR lpName,
|
|
DWORD nMaxMessageSize,
|
|
DWORD lReadTimeout,
|
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
|
{
|
|
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);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
HANDLE STDCALL
|
|
CreateMailslotW(LPCWSTR lpName,
|
|
DWORD nMaxMessageSize,
|
|
DWORD lReadTimeout,
|
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
|
{
|
|
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,
|
|
OBJ_CASE_INSENSITIVE,
|
|
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);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
WINBOOL STDCALL
|
|
GetMailslotInfo(HANDLE hMailslot,
|
|
LPDWORD lpMaxMessageSize,
|
|
LPDWORD lpNextSize,
|
|
LPDWORD lpMessageCount,
|
|
LPDWORD lpReadTimeout)
|
|
{
|
|
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);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
WINBOOL STDCALL
|
|
SetMailslotInfo(HANDLE hMailslot,
|
|
DWORD lReadTimeout)
|
|
{
|
|
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 */
|