87 lines
2.9 KiB
C
87 lines
2.9 KiB
C
![]() |
/*
|
||
|
* Mount manager service implementation
|
||
|
*
|
||
|
* Copyright 2008 Alexandre Julliard
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||
|
*/
|
||
|
|
||
|
#include <stdarg.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#define NONAMELESSUNION
|
||
|
#define NONAMELESSSTRUCT
|
||
|
|
||
|
#include "ntstatus.h"
|
||
|
#define WIN32_NO_STATUS
|
||
|
#include "windef.h"
|
||
|
#include "winbase.h"
|
||
|
#include "winternl.h"
|
||
|
#include "winioctl.h"
|
||
|
#include "ddk/wdm.h"
|
||
|
#include "ddk/mountmgr.h"
|
||
|
#include "wine/library.h"
|
||
|
#include "wine/unicode.h"
|
||
|
#include "wine/debug.h"
|
||
|
|
||
|
WINE_DEFAULT_DEBUG_CHANNEL(mountmgr);
|
||
|
|
||
|
/* handler for ioctls on the mount manager device */
|
||
|
static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp )
|
||
|
{
|
||
|
IO_STACK_LOCATION *irpsp = irp->Tail.Overlay.s.u.CurrentStackLocation;
|
||
|
|
||
|
TRACE( "ioctl %x insize %u outsize %u\n",
|
||
|
irpsp->Parameters.DeviceIoControl.IoControlCode,
|
||
|
irpsp->Parameters.DeviceIoControl.InputBufferLength,
|
||
|
irpsp->Parameters.DeviceIoControl.OutputBufferLength );
|
||
|
|
||
|
switch(irpsp->Parameters.DeviceIoControl.IoControlCode)
|
||
|
{
|
||
|
default:
|
||
|
FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
|
||
|
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
|
||
|
break;
|
||
|
}
|
||
|
return irp->IoStatus.u.Status;
|
||
|
}
|
||
|
|
||
|
/* main entry point for the mount point manager driver */
|
||
|
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
|
||
|
{
|
||
|
static const WCHAR device_mountmgrW[] = {'\\','D','e','v','i','c','e','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0};
|
||
|
static const WCHAR link_mountmgrW[] = {'\\','?','?','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0};
|
||
|
|
||
|
UNICODE_STRING nameW, linkW;
|
||
|
DEVICE_OBJECT *device;
|
||
|
NTSTATUS status;
|
||
|
|
||
|
TRACE( "%s\n", debugstr_w(path->Buffer) );
|
||
|
|
||
|
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = mountmgr_ioctl;
|
||
|
|
||
|
RtlInitUnicodeString( &nameW, device_mountmgrW );
|
||
|
RtlInitUnicodeString( &linkW, link_mountmgrW );
|
||
|
if (!(status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device )))
|
||
|
status = IoCreateSymbolicLink( &linkW, &nameW );
|
||
|
if (status)
|
||
|
{
|
||
|
FIXME( "failed to create device error %x\n", status );
|
||
|
return status;
|
||
|
}
|
||
|
|
||
|
return status;
|
||
|
}
|