Implement CreateMailslot using NtCreateMailslotFile.
This commit is contained in:
parent
a63c2eb30b
commit
6c42be25e7
|
@ -1576,10 +1576,48 @@ HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
|
|||
HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
|
||||
DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
|
||||
{
|
||||
FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
LARGE_INTEGER timeout;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
NTSTATUS status;
|
||||
|
||||
TRACE("%s %ld %ld %p\n", debugstr_w(lpName),
|
||||
nMaxMessageSize, lReadTimeout, sa);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U( lpName, &nameW, NULL, NULL ))
|
||||
{
|
||||
SetLastError( ERROR_PATH_NOT_FOUND );
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
if (nameW.Length >= MAX_PATH * sizeof(WCHAR) )
|
||||
{
|
||||
SetLastError( ERROR_FILENAME_EXCED_RANGE );
|
||||
RtlFreeUnicodeString( &nameW );
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
timeout.QuadPart = (ULONGLONG) lReadTimeout * -10000;
|
||||
|
||||
status = NtCreateMailslotFile( &handle, GENERIC_READ | GENERIC_WRITE, &attr,
|
||||
&iosb, 0, 0, nMaxMessageSize, &timeout );
|
||||
if (status)
|
||||
{
|
||||
SetLastError( RtlNtStatusToDosError(status) );
|
||||
handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
RtlFreeUnicodeString( &nameW );
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,21 +57,15 @@ static int mailslot_test()
|
|||
hSlot = CreateMailslot( "blah", 0, 0, NULL );
|
||||
ok( hSlot == INVALID_HANDLE_VALUE,
|
||||
"Created mailslot with invalid name\n");
|
||||
todo_wine
|
||||
{
|
||||
ok( GetLastError() == ERROR_INVALID_NAME,
|
||||
"error should be ERROR_INVALID_NAME\n");
|
||||
}
|
||||
ok( GetLastError() == ERROR_INVALID_NAME,
|
||||
"error should be ERROR_INVALID_NAME\n");
|
||||
|
||||
/* open a mailslot with a null name */
|
||||
hSlot = CreateMailslot( NULL, 0, 0, NULL );
|
||||
ok( hSlot == INVALID_HANDLE_VALUE,
|
||||
"Created mailslot with invalid name\n");
|
||||
todo_wine
|
||||
{
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
"error should be ERROR_PATH_NOT_FOUND\n");
|
||||
}
|
||||
|
||||
todo_wine
|
||||
{
|
||||
|
|
|
@ -1739,3 +1739,45 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
|
|||
timeout.u.LowPart = timeout.u.HighPart = 0;
|
||||
return io_status->u.Status = NtDelayExecution( TRUE, &timeout );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* NtCreateMailslotFile [NTDLL.@]
|
||||
* ZwCreateMailslotFile [NTDLL.@]
|
||||
*
|
||||
* PARAMS
|
||||
* pHandle [O] pointer to receive the handle created
|
||||
* DesiredAccess [I] access mode (read, write, etc)
|
||||
* ObjectAttributes [I] fully qualified NT path of the mailslot
|
||||
* IoStatusBlock [O] receives completion status and other info
|
||||
* CreateOptions [I]
|
||||
* MailslotQuota [I]
|
||||
* MaxMessageSize [I]
|
||||
* TimeOut [I]
|
||||
*
|
||||
* RETURNS
|
||||
* An NT status code
|
||||
*/
|
||||
NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
|
||||
POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK IoStatusBlock,
|
||||
ULONG CreateOptions, ULONG MailslotQuota, ULONG MaxMessageSize,
|
||||
PLARGE_INTEGER TimeOut)
|
||||
{
|
||||
static const WCHAR leadin[] = {
|
||||
'\\','?','?','\\','M','A','I','L','S','L','O','T','\\'};
|
||||
NTSTATUS ret;
|
||||
|
||||
FIXME("%p %08lx %p %p %08lx %08lx %08lx %p\n",
|
||||
pHandle, DesiredAccess, attr, IoStatusBlock,
|
||||
CreateOptions, MailslotQuota, MaxMessageSize, TimeOut);
|
||||
|
||||
if (attr->ObjectName->Length < sizeof(leadin) ||
|
||||
strncmpiW( attr->ObjectName->Buffer,
|
||||
leadin, sizeof(leadin)/sizeof(leadin[0]) ))
|
||||
{
|
||||
return STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
|
||||
ret = STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -539,16 +539,6 @@ NTSTATUS WINAPI NtQueryPerformanceCounter(
|
|||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* NtCreateMailslotFile [NTDLL.@]
|
||||
* ZwCreateMailslotFile [NTDLL.@]
|
||||
*/
|
||||
NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
|
||||
{
|
||||
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6,x7,x8);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* NtQuerySystemInformation [NTDLL.@]
|
||||
* ZwQuerySystemInformation [NTDLL.@]
|
||||
|
|
|
@ -1424,6 +1424,7 @@ NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOO
|
|||
NTSTATUS WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
|
||||
NTSTATUS WINAPI NtCreateIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,ULONG);
|
||||
NTSTATUS WINAPI NtCreateKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
|
||||
NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,PLARGE_INTEGER);
|
||||
NTSTATUS WINAPI NtCreateMutant(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,BOOLEAN);
|
||||
NTSTATUS WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
|
||||
NTSTATUS WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
|
||||
|
|
Loading…
Reference in New Issue