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 @@ ...@@ -50,6 +50,7 @@
#include "winerror.h" #include "winerror.h"
#include "winnls.h" #include "winnls.h"
#include "winternl.h" #include "winternl.h"
#include "winioctl.h"
#include "wine/server.h" #include "wine/server.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -1357,22 +1358,28 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped) ...@@ -1357,22 +1358,28 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped)
/*********************************************************************** /***********************************************************************
* DisconnectNamedPipe (KERNEL32.@) * 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 WINAPI DisconnectNamedPipe(HANDLE hPipe)
{ {
BOOL ret; NTSTATUS status;
IO_STATUS_BLOCK io_block;
TRACE("(%p)\n",hPipe); TRACE("(%p)\n",hPipe);
SERVER_START_REQ( disconnect_named_pipe ) status = NtFsControlFile(hPipe, 0, NULL, NULL, &io_block, FSCTL_PIPE_DISCONNECT,
{ NULL, 0, NULL, 0);
req->handle = hPipe; if (status == STATUS_SUCCESS) return TRUE;
ret = !wine_server_call_err( req ); SetLastError( RtlNtStatusToDosError(status) );
if (ret && reply->fd != -1) close( reply->fd ); return FALSE;
}
SERVER_END_REQ;
return ret;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -866,22 +866,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE DeviceHandle, HANDLE hEvent, ...@@ -866,22 +866,33 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE DeviceHandle, HANDLE hEvent,
* NtFsControlFile [NTDLL.@] * NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@] * ZwFsControlFile [NTDLL.@]
*/ */
NTSTATUS WINAPI NtFsControlFile( NTSTATUS WINAPI NtFsControlFile(HANDLE DeviceHandle, HANDLE Event OPTIONAL, PIO_APC_ROUTINE ApcRoutine,
IN HANDLE DeviceHandle, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG IoControlCode,
IN HANDLE Event OPTIONAL, PVOID InputBuffer, ULONG InputBufferSize, PVOID OutputBuffer, ULONG OutputBufferSize)
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)
{ {
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, DeviceHandle,Event,ApcRoutine,ApcContext,IoStatusBlock,IoControlCode,
InputBuffer,InputBufferSize,OutputBuffer,OutputBufferSize); 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