https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19cef7806c43e34a00e1eb13dbb9444e722249a8
commit 19cef7806c43e34a00e1eb13dbb9444e722249a8 Author: Pierre Schweitzer <pie...@reactos.org> AuthorDate: Mon Oct 23 14:36:18 2017 +0200 [KERNEL32] Fix a FIXME in GetNamedPipeHandleStateW and stub a private function for a left unimplemented function --- dll/win32/kernel32/client/file/npipe.c | 36 ++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/dll/win32/kernel32/client/file/npipe.c b/dll/win32/kernel32/client/file/npipe.c index ee341580c2..3ed0c555e3 100644 --- a/dll/win32/kernel32/client/file/npipe.c +++ b/dll/win32/kernel32/client/file/npipe.c @@ -20,6 +20,20 @@ LONG ProcessPipeId; /* FUNCTIONS ******************************************************************/ +static +BOOL +NpGetUserNamep(HANDLE hNamedPipe, + LPWSTR lpUserName, + DWORD nMaxUserNameSize) +{ + /* FIXME - open the thread token, call ImpersonateNamedPipeClient() and + retrieve the user name with GetUserName(), revert the impersonation + and finally restore the thread token */ + UNIMPLEMENTED; + return TRUE; +} + + /* * @implemented */ @@ -935,18 +949,28 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, *lpMaxCollectionCount = RemoteInfo.MaximumCollectionCount; } - if(lpCollectDataTimeout != NULL) + if (lpCollectDataTimeout != NULL) { - /* FIXME */ - *lpCollectDataTimeout = 0; + LARGE_INTEGER CollectDataTime; + + /* Convert time and return it */ + RemoteInfo.CollectDataTime.QuadPart *= -1; + CollectDataTime = RtlExtendedLargeIntegerDivide(RemoteInfo.CollectDataTime, 10000, NULL); + /* In case of overflow, just return MAX - 1 */ + if (CollectDataTime.HighPart != 0) + { + *lpCollectDataTimeout = -2; + } + else + { + *lpCollectDataTimeout = CollectDataTime.LowPart; + } } } if (lpUserName != NULL) { - /* FIXME - open the thread token, call ImpersonateNamedPipeClient() and - retrieve the user name with GetUserName(), revert the impersonation - and finally restore the thread token */ + return NpGetUserNamep(hNamedPipe, lpUserName, nMaxUserNameSize); } return TRUE;