mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Fill lpcbAvail for PeekNamedPipe.
This commit is contained in:
parent
ebc6feb50b
commit
4072c64a1f
@ -21,6 +21,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
@ -28,6 +33,7 @@
|
||||
|
||||
#include "wine/server.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "file.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
@ -530,9 +536,28 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
||||
BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer,
|
||||
LPDWORD lpcbRead, LPDWORD lpcbAvail, LPDWORD lpcbMessage )
|
||||
{
|
||||
FIXME("(%08x, %p, %08lx, %p, %p, %p): stub\n",
|
||||
hPipe, lpvBuffer, cbBuffer, lpcbRead, lpcbAvail, lpcbMessage);
|
||||
int avail=0,fd;
|
||||
|
||||
fd = FILE_GetUnixHandle(hPipe, GENERIC_READ);
|
||||
if (fd == -1)
|
||||
return FALSE;
|
||||
/* On linux fstat on pipes doesn't work */
|
||||
if (ioctl(fd,FIONREAD, &avail ) != 0)
|
||||
{
|
||||
TRACE("FIONREAD failed reason: %s\n",strerror(errno));
|
||||
close(fd);
|
||||
return FALSE;
|
||||
}
|
||||
close(fd);
|
||||
TRACE(" 0x%08x bytes available\n", avail );
|
||||
if (!lpvBuffer && lpcbAvail)
|
||||
{
|
||||
*lpcbAvail= avail;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
FIXME("function not implemented\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -800,4 +825,3 @@ BOOL WINAPI CallNamedPipeW(
|
||||
lpOutput, lpOutputSize, lpBytesRead, nTimeout);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user