kernel32: Move GetNamedPipeHandleStateW() implementation to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-04-16 15:34:59 +02:00
parent f8fb43aaba
commit 99027aeaee
4 changed files with 41 additions and 63 deletions

View File

@ -731,8 +731,8 @@
# @ stub GetNamedPipeClientComputerNameW
@ stdcall GetNamedPipeClientProcessId(long ptr)
@ stdcall GetNamedPipeClientSessionId(long ptr)
@ stdcall GetNamedPipeHandleStateA(long ptr ptr ptr ptr str long)
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long)
@ stdcall GetNamedPipeHandleStateA(long ptr ptr ptr ptr ptr long)
@ stdcall -import GetNamedPipeHandleStateW(long ptr ptr ptr ptr ptr long)
@ stdcall -import GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNamedPipeServerProcessId(long ptr)
@ stdcall GetNamedPipeServerSessionId(long ptr)

View File

@ -42,7 +42,6 @@
#include "ddk/wdm.h"
#include "wine/asm.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "kernel_private.h"
@ -630,65 +629,6 @@ BOOL WINAPI GetNamedPipeHandleStateA(
return ret;
}
/***********************************************************************
* GetNamedPipeHandleStateW (KERNEL32.@)
*/
BOOL WINAPI GetNamedPipeHandleStateW(
HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances,
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPWSTR lpUsername, DWORD nUsernameMaxSize)
{
IO_STATUS_BLOCK iosb;
NTSTATUS status;
FIXME("%p %p %p %p %p %p %d: semi-stub\n", hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout, lpUsername, nUsernameMaxSize);
if (lpMaxCollectionCount)
*lpMaxCollectionCount = 0;
if (lpCollectDataTimeout)
*lpCollectDataTimeout = 0;
if (lpUsername && nUsernameMaxSize)
{
const char *username = wine_get_user_name();
int len = MultiByteToWideChar(CP_UNIXCP, 0, username, -1, lpUsername, nUsernameMaxSize);
if (!len) *lpUsername = 0;
}
if (lpState)
{
FILE_PIPE_INFORMATION fpi;
status = NtQueryInformationFile(hNamedPipe, &iosb, &fpi, sizeof(fpi),
FilePipeInformation);
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
*lpState = (fpi.ReadMode ? PIPE_READMODE_MESSAGE : PIPE_READMODE_BYTE) |
(fpi.CompletionMode ? PIPE_NOWAIT : PIPE_WAIT);
}
if (lpCurInstances)
{
FILE_PIPE_LOCAL_INFORMATION fpli;
status = NtQueryInformationFile(hNamedPipe, &iosb, &fpli, sizeof(fpli),
FilePipeLocalInformation);
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
*lpCurInstances = fpli.CurrentInstances;
}
return TRUE;
}
/***********************************************************************
* CallNamedPipeA (KERNEL32.@)
*/

View File

@ -570,7 +570,7 @@
@ stub GetNamedLocaleHashNode
@ stub GetNamedPipeAttribute
@ stub GetNamedPipeClientComputerNameW
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) kernel32.GetNamedPipeHandleStateW
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr ptr long)
@ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNativeSystemInfo(ptr)
# @ stub GetNextFgPolicyRefreshInfoInternal

View File

@ -1201,6 +1201,44 @@ BOOL WINAPI DECLSPEC_HOTPATCH DisconnectNamedPipe( HANDLE pipe )
}
/***********************************************************************
* GetNamedPipeHandleStateW (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetNamedPipeHandleStateW( HANDLE pipe, DWORD *state, DWORD *instances,
DWORD *max_count, DWORD *timeout,
WCHAR *user, DWORD size )
{
IO_STATUS_BLOCK io;
FIXME( "%p %p %p %p %p %p %d: semi-stub\n", pipe, state, instances, max_count, timeout, user, size );
if (max_count) *max_count = 0;
if (timeout) *timeout = 0;
if (user && size && !GetEnvironmentVariableW( L"WINEUSERNAME", user, size )) user[0] = 0;
if (state)
{
FILE_PIPE_INFORMATION info;
if (!set_ntstatus( NtQueryInformationFile( pipe, &io, &info, sizeof(info), FilePipeInformation )))
return FALSE;
*state = (info.ReadMode ? PIPE_READMODE_MESSAGE : PIPE_READMODE_BYTE) |
(info.CompletionMode ? PIPE_NOWAIT : PIPE_WAIT);
}
if (instances)
{
FILE_PIPE_LOCAL_INFORMATION info;
if (!set_ntstatus( NtQueryInformationFile( pipe, &io, &info, sizeof(info),
FilePipeLocalInformation)))
return FALSE;
*instances = info.CurrentInstances;
}
return TRUE;
}
/***********************************************************************
* GetNamedPipeInfo (kernelbase.@)
*/