Commit 7a07a5e3 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

kernel32: Return a non-empty username from GetNamedPipeHandleState.

parent e5bed7c2
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "winioctl.h" #include "winioctl.h"
#include "ddk/wdm.h" #include "ddk/wdm.h"
#include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "kernel_private.h" #include "kernel_private.h"
...@@ -1784,16 +1785,22 @@ BOOL WINAPI GetNamedPipeHandleStateA( ...@@ -1784,16 +1785,22 @@ BOOL WINAPI GetNamedPipeHandleStateA(
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPSTR lpUsername, DWORD nUsernameMaxSize) LPSTR lpUsername, DWORD nUsernameMaxSize)
{ {
WARN("%p %p %p %p %p %p %d: semi-stub\n", WCHAR *username = NULL;
hNamedPipe, lpState, lpCurInstances, BOOL ret;
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
if (lpUsername && nUsernameMaxSize) WARN("%p %p %p %p %p %p %d: semi-stub\n", hNamedPipe, lpState, lpCurInstances,
*lpUsername = 0; lpMaxCollectionCount, lpCollectDataTimeout, lpUsername, nUsernameMaxSize);
if (lpUsername && nUsernameMaxSize &&
!(username = HeapAlloc(GetProcessHeap(), 0, nUsernameMaxSize * sizeof(WCHAR)))) return FALSE;
ret = GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount,
lpCollectDataTimeout, username, nUsernameMaxSize);
if (ret && username)
WideCharToMultiByte(CP_ACP, 0, username, -1, lpUsername, nUsernameMaxSize, NULL, NULL);
return GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances, HeapFree(GetProcessHeap(), 0, username);
lpMaxCollectionCount, lpCollectDataTimeout, NULL, 0); return ret;
} }
/*********************************************************************** /***********************************************************************
...@@ -1807,10 +1814,8 @@ BOOL WINAPI GetNamedPipeHandleStateW( ...@@ -1807,10 +1814,8 @@ BOOL WINAPI GetNamedPipeHandleStateW(
IO_STATUS_BLOCK iosb; IO_STATUS_BLOCK iosb;
NTSTATUS status; NTSTATUS status;
FIXME("%p %p %p %p %p %p %d: semi-stub\n", FIXME("%p %p %p %p %p %p %d: semi-stub\n", hNamedPipe, lpState, lpCurInstances,
hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUsername, nUsernameMaxSize);
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
if (lpMaxCollectionCount) if (lpMaxCollectionCount)
*lpMaxCollectionCount = 0; *lpMaxCollectionCount = 0;
...@@ -1819,7 +1824,11 @@ BOOL WINAPI GetNamedPipeHandleStateW( ...@@ -1819,7 +1824,11 @@ BOOL WINAPI GetNamedPipeHandleStateW(
*lpCollectDataTimeout = 0; *lpCollectDataTimeout = 0;
if (lpUsername && nUsernameMaxSize) if (lpUsername && nUsernameMaxSize)
*lpUsername = 0; {
const char *username = wine_get_user_name();
int len = MultiByteToWideChar(CP_UNIXCP, 0, username, -1, lpUsername, nUsernameMaxSize);
if (!len) *lpUsername = 0;
}
if (lpState) if (lpState)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment