libwinpr-pipe: implement WaitNamedPipe

This commit is contained in:
Marc-André Moreau 2013-09-23 18:10:21 -04:00
parent 3d2754e8ed
commit 979ed1b756

View File

@ -225,7 +225,36 @@ BOOL TransactNamedPipe(HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize
BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
{
return TRUE;
BOOL status;
DWORD nWaitTime;
char* lpFilePath;
DWORD dwSleepInterval;
if (!lpNamedPipeName)
return FALSE;
lpFilePath = GetNamedPipeUnixDomainSocketFilePathA(lpNamedPipeName);
if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT)
nTimeOut = 50;
nWaitTime = 0;
status = TRUE;
dwSleepInterval = 10;
while (!PathFileExistsA(lpFilePath))
{
Sleep(dwSleepInterval);
nWaitTime += dwSleepInterval;
if (nWaitTime >= nTimeOut)
{
status = FALSE;
break;
}
}
return status;
}
BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)