kernel32: Implement GetNamedPipeHandleState.

Based on a patch by Adam Martinson.
This commit is contained in:
Sebastian Lackner 2014-08-11 17:26:18 +02:00 committed by Alexandre Julliard
parent b765561b49
commit 9e66e97db8
2 changed files with 52 additions and 11 deletions

View file

@ -1712,12 +1712,16 @@ BOOL WINAPI GetNamedPipeHandleStateA(
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPSTR lpUsername, DWORD nUsernameMaxSize)
{
FIXME("%p %p %p %p %p %p %d\n",
hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
WARN("%p %p %p %p %p %p %d: semi-stub\n",
hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
return FALSE;
if (lpUsername && nUsernameMaxSize)
*lpUsername = 0;
return GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout, NULL, 0);
}
/***********************************************************************
@ -1728,12 +1732,53 @@ BOOL WINAPI GetNamedPipeHandleStateW(
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPWSTR lpUsername, DWORD nUsernameMaxSize)
{
FIXME("%p %p %p %p %p %p %d\n",
IO_STATUS_BLOCK iosb;
NTSTATUS status;
FIXME("%p %p %p %p %p %p %d: semi-stub\n",
hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
return FALSE;
if (lpMaxCollectionCount)
*lpMaxCollectionCount = 0;
if (lpCollectDataTimeout)
*lpCollectDataTimeout = 0;
if (lpUsername && nUsernameMaxSize)
*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;
}
/***********************************************************************

View file

@ -1662,11 +1662,9 @@ static void test_NamedPipeHandleState(void)
/* lpSecurityAttrib */ NULL);
ok(server != INVALID_HANDLE_VALUE, "cf failed\n");
ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0);
todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL,
0);
todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
if (ret)
{
@ -1719,11 +1717,9 @@ static void test_NamedPipeHandleState(void)
/* lpSecurityAttrib */ NULL);
ok(server != INVALID_HANDLE_VALUE, "cf failed\n");
ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0);
todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL,
0);
todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
if (ret)
{