Commit aab12f5f authored by Ivan Leo Puoti's avatar Ivan Leo Puoti Committed by Alexandre Julliard

Implement FSCTL_PIPE_DISCONNECT in NtFsControlFile and make

DisconnectNamedPipe call it.
parent 7f6554b7
......@@ -50,6 +50,7 @@
#include "winerror.h"
#include "winnls.h"
#include "winternl.h"
#include "winioctl.h"
#include "wine/server.h"
#include "wine/unicode.h"
......@@ -1357,22 +1358,28 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped)
/***********************************************************************
* DisconnectNamedPipe (KERNEL32.@)
*
* Disconnects from a named pipe
*
* Parameters
* hPipe: A handle to a named pipe returned by CreateNamedPipe
*
* Return values
* TRUE: Success
* FALSE: Failure, GetLastError can be called for further details
*/
BOOL WINAPI DisconnectNamedPipe(HANDLE hPipe)
{
BOOL ret;
NTSTATUS status;
IO_STATUS_BLOCK io_block;
TRACE("(%p)\n",hPipe);
SERVER_START_REQ( disconnect_named_pipe )
{
req->handle = hPipe;
ret = !wine_server_call_err( req );
if (ret && reply->fd != -1) close( reply->fd );
}
SERVER_END_REQ;
return ret;
status = NtFsControlFile(hPipe, 0, NULL, NULL, &io_block, FSCTL_PIPE_DISCONNECT,
NULL, 0, NULL, 0);
if (status == STATUS_SUCCESS) return TRUE;
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
/***********************************************************************
......
......@@ -866,22 +866,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE DeviceHandle, HANDLE hEvent,
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
*/
NTSTATUS WINAPI NtFsControlFile(
IN HANDLE DeviceHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ULONG IoControlCode,
IN PVOID InputBuffer,
IN ULONG InputBufferSize,
OUT PVOID OutputBuffer,
IN ULONG OutputBufferSize)
NTSTATUS WINAPI NtFsControlFile(HANDLE DeviceHandle, HANDLE Event OPTIONAL, PIO_APC_ROUTINE ApcRoutine,
PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG IoControlCode,
PVOID InputBuffer, ULONG InputBufferSize, PVOID OutputBuffer, ULONG OutputBufferSize)
{
FIXME("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): stub\n",
NTSTATUS ret;
TRACE("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx)\n",
DeviceHandle,Event,ApcRoutine,ApcContext,IoStatusBlock,IoControlCode,
InputBuffer,InputBufferSize,OutputBuffer,OutputBufferSize);
return 0;
if(!IoStatusBlock) return STATUS_INVALID_PARAMETER;
switch(IoControlCode)
{
case FSCTL_PIPE_DISCONNECT :
SERVER_START_REQ(disconnect_named_pipe)
{
req->handle = DeviceHandle;
ret = wine_server_call(req);
if (!ret && reply->fd != -1) close(reply->fd);
}
SERVER_END_REQ;
return ret;
default :
FIXME("Unsupported IoControlCode %lx\n", IoControlCode);
return STATUS_NOT_SUPPORTED;
}
}
/******************************************************************************
......
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