mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 10:01:43 +00:00
fix formatting
svn path=/trunk/; revision=39327
This commit is contained in:
parent
a9d8af1af6
commit
8517038812
12 changed files with 2637 additions and 2632 deletions
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/cdfs.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/cdfs.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -42,72 +42,72 @@ PCDFS_GLOBAL_DATA CdfsGlobalData;
|
|||
|
||||
NTSTATUS NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
/*
|
||||
* FUNCTION: Called by the system to initalize the driver
|
||||
* ARGUMENTS:
|
||||
* DriverObject = object describing this driver
|
||||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
PUNICODE_STRING RegistryPath)
|
||||
/*
|
||||
* FUNCTION: Called by the system to initalize the driver
|
||||
* ARGUMENTS:
|
||||
* DriverObject = object describing this driver
|
||||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Cdfs");
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Cdfs");
|
||||
|
||||
DPRINT("CDFS 0.0.3\n");
|
||||
DPRINT("CDFS 0.0.3\n");
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(CDFS_GLOBAL_DATA),
|
||||
&DeviceName,
|
||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||
0,
|
||||
FALSE,
|
||||
&DeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(CDFS_GLOBAL_DATA),
|
||||
&DeviceName,
|
||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||
0,
|
||||
FALSE,
|
||||
&DeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* Initialize global data */
|
||||
CdfsGlobalData = DeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(CdfsGlobalData,
|
||||
sizeof(CDFS_GLOBAL_DATA));
|
||||
CdfsGlobalData->DriverObject = DriverObject;
|
||||
CdfsGlobalData->DeviceObject = DeviceObject;
|
||||
/* Initialize global data */
|
||||
CdfsGlobalData = DeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(CdfsGlobalData,
|
||||
sizeof(CDFS_GLOBAL_DATA));
|
||||
CdfsGlobalData->DriverObject = DriverObject;
|
||||
CdfsGlobalData->DeviceObject = DeviceObject;
|
||||
|
||||
/* Initialize driver data */
|
||||
DeviceObject->Flags = DO_DIRECT_IO;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
||||
CdfsFileSystemControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
CdfsDirectoryControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||
CdfsQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
||||
CdfsSetInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
||||
CdfsQueryVolumeInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
|
||||
CdfsSetVolumeInformation;
|
||||
/* Initialize driver data */
|
||||
DeviceObject->Flags = DO_DIRECT_IO;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
||||
CdfsFileSystemControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
CdfsDirectoryControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||
CdfsQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
||||
CdfsSetInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
||||
CdfsQueryVolumeInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
|
||||
CdfsSetVolumeInformation;
|
||||
|
||||
DriverObject->DriverUnload = NULL;
|
||||
DriverObject->DriverUnload = NULL;
|
||||
|
||||
/* Cache manager */
|
||||
CdfsGlobalData->CacheMgrCallbacks.AcquireForLazyWrite = CdfsAcquireForLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.ReleaseFromLazyWrite = CdfsReleaseFromLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.AcquireForReadAhead = CdfsAcquireForLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.ReleaseFromReadAhead = CdfsReleaseFromLazyWrite;
|
||||
/* Cache manager */
|
||||
CdfsGlobalData->CacheMgrCallbacks.AcquireForLazyWrite = CdfsAcquireForLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.ReleaseFromLazyWrite = CdfsReleaseFromLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.AcquireForReadAhead = CdfsAcquireForLazyWrite;
|
||||
CdfsGlobalData->CacheMgrCallbacks.ReleaseFromReadAhead = CdfsReleaseFromLazyWrite;
|
||||
|
||||
IoRegisterFileSystem(DeviceObject);
|
||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
IoRegisterFileSystem(DeviceObject);
|
||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,24 +115,24 @@ BOOLEAN NTAPI
|
|||
CdfsAcquireForLazyWrite(IN PVOID Context,
|
||||
IN BOOLEAN Wait)
|
||||
{
|
||||
PFCB Fcb = (PFCB)Context;
|
||||
ASSERT(Fcb);
|
||||
DPRINT("CdfsAcquireForLazyWrite(): Fcb %p\n", Fcb);
|
||||
PFCB Fcb = (PFCB)Context;
|
||||
ASSERT(Fcb);
|
||||
DPRINT("CdfsAcquireForLazyWrite(): Fcb %p\n", Fcb);
|
||||
|
||||
if (!ExAcquireResourceExclusiveLite(&(Fcb->MainResource), Wait))
|
||||
{
|
||||
DPRINT("CdfsAcquireForLazyWrite(): ExReleaseResourceLite failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if (!ExAcquireResourceExclusiveLite(&(Fcb->MainResource), Wait))
|
||||
{
|
||||
DPRINT("CdfsAcquireForLazyWrite(): ExReleaseResourceLite failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
CdfsReleaseFromLazyWrite(IN PVOID Context)
|
||||
{
|
||||
PFCB Fcb = (PFCB)Context;
|
||||
ASSERT(Fcb);
|
||||
DPRINT("CdfsReleaseFromLazyWrite(): Fcb %p\n", Fcb);
|
||||
PFCB Fcb = (PFCB)Context;
|
||||
ASSERT(Fcb);
|
||||
DPRINT("CdfsReleaseFromLazyWrite(): Fcb %p\n", Fcb);
|
||||
|
||||
ExReleaseResourceLite(&(Fcb->MainResource));
|
||||
ExReleaseResourceLite(&(Fcb->MainResource));
|
||||
}
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/cleanup.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/cleanup.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,63 +37,63 @@
|
|||
|
||||
static NTSTATUS
|
||||
CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject)
|
||||
/*
|
||||
* FUNCTION: Cleans up after a file has been closed.
|
||||
*/
|
||||
PFILE_OBJECT FileObject)
|
||||
/*
|
||||
* FUNCTION: Cleans up after a file has been closed.
|
||||
*/
|
||||
{
|
||||
|
||||
DPRINT("CdfsCleanupFile(DeviceExt %x, FileObject %x)\n",
|
||||
DeviceExt,
|
||||
FileObject);
|
||||
DPRINT("CdfsCleanupFile(DeviceExt %x, FileObject %x)\n",
|
||||
DeviceExt,
|
||||
FileObject);
|
||||
|
||||
|
||||
/* Uninitialize file cache if initialized for this file object. */
|
||||
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
|
||||
/* Uninitialize file cache if initialized for this file object. */
|
||||
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
|
||||
{
|
||||
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
||||
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsCleanup(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsCleanup() called\n");
|
||||
DPRINT("CdfsCleanup() called\n");
|
||||
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
{
|
||||
DPRINT("Closing file system\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
DPRINT("Closing file system\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource, TRUE);
|
||||
KeEnterCriticalRegion();
|
||||
ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource, TRUE);
|
||||
|
||||
Status = CdfsCleanupFile(DeviceExtension, FileObject);
|
||||
Status = CdfsCleanupFile(DeviceExtension, FileObject);
|
||||
|
||||
ExReleaseResourceLite(&DeviceExtension->DirResource);
|
||||
KeLeaveCriticalRegion();
|
||||
ExReleaseResourceLite(&DeviceExtension->DirResource);
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/close.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/close.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,75 +37,75 @@
|
|||
|
||||
NTSTATUS
|
||||
CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject)
|
||||
/*
|
||||
* FUNCTION: Closes a file
|
||||
*/
|
||||
PFILE_OBJECT FileObject)
|
||||
/*
|
||||
* FUNCTION: Closes a file
|
||||
*/
|
||||
{
|
||||
PCCB Ccb;
|
||||
PCCB Ccb;
|
||||
|
||||
DPRINT("CdfsCloseFile(DeviceExt %x, FileObject %x)\n",
|
||||
DeviceExt,
|
||||
FileObject);
|
||||
DPRINT("CdfsCloseFile(DeviceExt %x, FileObject %x)\n",
|
||||
DeviceExt,
|
||||
FileObject);
|
||||
|
||||
Ccb = (PCCB)(FileObject->FsContext2);
|
||||
Ccb = (PCCB)(FileObject->FsContext2);
|
||||
|
||||
DPRINT("Ccb %x\n", Ccb);
|
||||
if (Ccb == NULL)
|
||||
DPRINT("Ccb %x\n", Ccb);
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
FileObject->FsContext2 = NULL;
|
||||
FileObject->FsContext2 = NULL;
|
||||
|
||||
if (FileObject->FileName.Buffer)
|
||||
if (FileObject->FileName.Buffer)
|
||||
{
|
||||
// This a FO, that was created outside from FSD.
|
||||
// Some FO's are created with IoCreateStreamFileObject() insid from FSD.
|
||||
// This FO's don't have a FileName.
|
||||
CdfsReleaseFCB(DeviceExt, FileObject->FsContext);
|
||||
// This a FO, that was created outside from FSD.
|
||||
// Some FO's are created with IoCreateStreamFileObject() insid from FSD.
|
||||
// This FO's don't have a FileName.
|
||||
CdfsReleaseFCB(DeviceExt, FileObject->FsContext);
|
||||
}
|
||||
|
||||
if (Ccb->DirectorySearchPattern.Buffer)
|
||||
if (Ccb->DirectorySearchPattern.Buffer)
|
||||
{
|
||||
ExFreePool(Ccb->DirectorySearchPattern.Buffer);
|
||||
ExFreePool(Ccb->DirectorySearchPattern.Buffer);
|
||||
}
|
||||
ExFreePool(Ccb);
|
||||
ExFreePool(Ccb);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsClose(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsClose() called\n");
|
||||
DPRINT("CdfsClose() called\n");
|
||||
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
{
|
||||
DPRINT("Closing file system\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
DPRINT("Closing file system\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
Status = CdfsCloseFile(DeviceExtension,FileObject);
|
||||
Status = CdfsCloseFile(DeviceExtension,FileObject);
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/common.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/common.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,173 +37,173 @@
|
|||
|
||||
NTSTATUS
|
||||
CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG DiskSector,
|
||||
IN ULONG SectorCount,
|
||||
IN OUT PUCHAR Buffer,
|
||||
IN BOOLEAN Override)
|
||||
IN ULONG DiskSector,
|
||||
IN ULONG SectorCount,
|
||||
IN OUT PUCHAR Buffer,
|
||||
IN BOOLEAN Override)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
LARGE_INTEGER Offset;
|
||||
ULONG BlockSize;
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
LARGE_INTEGER Offset;
|
||||
ULONG BlockSize;
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
|
||||
Offset.u.LowPart = DiskSector << 11;
|
||||
Offset.u.HighPart = DiskSector >> 21;
|
||||
Offset.u.LowPart = DiskSector << 11;
|
||||
Offset.u.HighPart = DiskSector >> 21;
|
||||
|
||||
BlockSize = BLOCKSIZE * SectorCount;
|
||||
BlockSize = BLOCKSIZE * SectorCount;
|
||||
|
||||
DPRINT("CdfsReadSectors(DeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
DeviceObject, DiskSector, Buffer);
|
||||
DPRINT("Offset %I64x BlockSize %ld\n",
|
||||
Offset.QuadPart,
|
||||
BlockSize);
|
||||
DPRINT("CdfsReadSectors(DeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
DeviceObject, DiskSector, Buffer);
|
||||
DPRINT("Offset %I64x BlockSize %ld\n",
|
||||
Offset.QuadPart,
|
||||
BlockSize);
|
||||
|
||||
DPRINT("Building synchronous FSD Request...\n");
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||
DeviceObject,
|
||||
Buffer,
|
||||
BlockSize,
|
||||
&Offset,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
DPRINT("Building synchronous FSD Request...\n");
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||
DeviceObject,
|
||||
Buffer,
|
||||
BlockSize,
|
||||
&Offset,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
{
|
||||
DPRINT("IoBuildSynchronousFsdRequest failed\n");
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
DPRINT("IoBuildSynchronousFsdRequest failed\n");
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
}
|
||||
|
||||
if (Override)
|
||||
if (Override)
|
||||
{
|
||||
Stack = IoGetNextIrpStackLocation(Irp);
|
||||
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
|
||||
Stack = IoGetNextIrpStackLocation(Irp);
|
||||
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
|
||||
}
|
||||
|
||||
DPRINT("Calling IO Driver... with irp %x\n", Irp);
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
DPRINT("Calling IO Driver... with irp %x\n", Irp);
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
DPRINT("Waiting for IO Operation for %x\n", Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
DPRINT("Waiting for IO Operation for %x\n", Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
DPRINT("Getting IO Status... for %x\n", Irp);
|
||||
Status = IoStatus.Status;
|
||||
DPRINT("Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
DPRINT("Getting IO Status... for %x\n", Irp);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Status == STATUS_VERIFY_REQUIRED)
|
||||
if (Status == STATUS_VERIFY_REQUIRED)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
NTSTATUS NewStatus;
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
NTSTATUS NewStatus;
|
||||
|
||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||
|
||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
||||
}
|
||||
|
||||
DPRINT("CdfsReadSectors() failed (Status %x)\n", Status);
|
||||
DPRINT("(DeviceObject %x, DiskSector %x, Buffer %x, Offset 0x%I64x)\n",
|
||||
DeviceObject, DiskSector, Buffer,
|
||||
Offset.QuadPart);
|
||||
return(Status);
|
||||
DPRINT("CdfsReadSectors() failed (Status %x)\n", Status);
|
||||
DPRINT("(DeviceObject %x, DiskSector %x, Buffer %x, Offset 0x%I64x)\n",
|
||||
DeviceObject, DiskSector, Buffer,
|
||||
Offset.QuadPart);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("Block request succeeded for %x\n", Irp);
|
||||
DPRINT("Block request succeeded for %x\n", Irp);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer,
|
||||
IN OUT PULONG OutputBufferSize,
|
||||
IN BOOLEAN Override)
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer,
|
||||
IN OUT PULONG OutputBufferSize,
|
||||
IN BOOLEAN Override)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsDeviceIoControl(DeviceObject %x, CtlCode %x, "
|
||||
"InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
|
||||
"POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
|
||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
||||
OutputBufferSize ? *OutputBufferSize : 0);
|
||||
DPRINT("CdfsDeviceIoControl(DeviceObject %x, CtlCode %x, "
|
||||
"InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
|
||||
"POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
|
||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
||||
OutputBufferSize ? *OutputBufferSize : 0);
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
||||
DPRINT("Building device I/O control request ...\n");
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
InputBufferSize,
|
||||
OutputBuffer,
|
||||
(OutputBufferSize != NULL) ? *OutputBufferSize : 0,
|
||||
FALSE,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
DPRINT("Building device I/O control request ...\n");
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
InputBufferSize,
|
||||
OutputBuffer,
|
||||
(OutputBufferSize != NULL) ? *OutputBufferSize : 0,
|
||||
FALSE,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
{
|
||||
DPRINT("IoBuildDeviceIoControlRequest failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("IoBuildDeviceIoControlRequest failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
if (Override)
|
||||
if (Override)
|
||||
{
|
||||
Stack = IoGetNextIrpStackLocation(Irp);
|
||||
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
|
||||
Stack = IoGetNextIrpStackLocation(Irp);
|
||||
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
|
||||
}
|
||||
|
||||
DPRINT ("Calling IO Driver... with irp %x\n", Irp);
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
DPRINT ("Calling IO Driver... with irp %x\n", Irp);
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
DPRINT ("Waiting for IO Operation for %x\n", Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
DPRINT ("Waiting for IO Operation for %x\n", Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT ("Operation pending\n");
|
||||
KeWaitForSingleObject (&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
DPRINT ("Getting IO Status... for %x\n", Irp);
|
||||
DPRINT ("Operation pending\n");
|
||||
KeWaitForSingleObject (&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
DPRINT ("Getting IO Status... for %x\n", Irp);
|
||||
|
||||
Status = IoStatus.Status;
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
if (OutputBufferSize != NULL)
|
||||
if (OutputBufferSize != NULL)
|
||||
{
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
}
|
||||
|
||||
if (Status == STATUS_VERIFY_REQUIRED)
|
||||
if (Status == STATUS_VERIFY_REQUIRED)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
NTSTATUS NewStatus;
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
NTSTATUS NewStatus;
|
||||
|
||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||
|
||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
||||
}
|
||||
|
||||
DPRINT("Returning Status %x\n", Status);
|
||||
DPRINT("Returning Status %x\n", Status);
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/cdfs.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/cdfs.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,260 +37,260 @@
|
|||
|
||||
static NTSTATUS
|
||||
CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject,
|
||||
PUNICODE_STRING RelativeFileName,
|
||||
PUNICODE_STRING AbsoluteFileName)
|
||||
PUNICODE_STRING RelativeFileName,
|
||||
PUNICODE_STRING AbsoluteFileName)
|
||||
{
|
||||
ULONG Length;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("try related for %wZ\n", RelativeFileName);
|
||||
Fcb = FileObject->FsContext;
|
||||
ASSERT(Fcb);
|
||||
DPRINT("try related for %wZ\n", RelativeFileName);
|
||||
Fcb = FileObject->FsContext;
|
||||
ASSERT(Fcb);
|
||||
|
||||
/* verify related object is a directory and target name
|
||||
don't start with \. */
|
||||
if ((Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY) == 0 ||
|
||||
RelativeFileName->Buffer[0] == L'\\')
|
||||
/* verify related object is a directory and target name
|
||||
don't start with \. */
|
||||
if ((Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY) == 0 ||
|
||||
RelativeFileName->Buffer[0] == L'\\')
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* construct absolute path name */
|
||||
Length = (wcslen(Fcb->PathName) * sizeof(WCHAR)) +
|
||||
sizeof(WCHAR) +
|
||||
RelativeFileName->Length +
|
||||
sizeof(WCHAR);
|
||||
AbsoluteFileName->Length = 0;
|
||||
AbsoluteFileName->MaximumLength = Length;
|
||||
AbsoluteFileName->Buffer = ExAllocatePool(NonPagedPool,
|
||||
Length);
|
||||
if (AbsoluteFileName->Buffer == NULL)
|
||||
/* construct absolute path name */
|
||||
Length = (wcslen(Fcb->PathName) * sizeof(WCHAR)) +
|
||||
sizeof(WCHAR) +
|
||||
RelativeFileName->Length +
|
||||
sizeof(WCHAR);
|
||||
AbsoluteFileName->Length = 0;
|
||||
AbsoluteFileName->MaximumLength = Length;
|
||||
AbsoluteFileName->Buffer = ExAllocatePool(NonPagedPool,
|
||||
Length);
|
||||
if (AbsoluteFileName->Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(AbsoluteFileName,
|
||||
Fcb->PathName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = RtlAppendUnicodeToString(AbsoluteFileName,
|
||||
Fcb->PathName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (!CdfsFCBIsRoot(Fcb))
|
||||
if (!CdfsFCBIsRoot(Fcb))
|
||||
{
|
||||
Status = RtlAppendUnicodeToString(AbsoluteFileName,
|
||||
L"\\");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
}
|
||||
Status = RtlAppendUnicodeToString(AbsoluteFileName,
|
||||
L"\\");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeStringToString(AbsoluteFileName,
|
||||
RelativeFileName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = RtlAppendUnicodeStringToString(AbsoluteFileName,
|
||||
RelativeFileName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
RtlFreeUnicodeString(AbsoluteFileName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PUNICODE_STRING FileName)
|
||||
PFILE_OBJECT FileObject,
|
||||
PUNICODE_STRING FileName)
|
||||
{
|
||||
PFCB ParentFcb;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING AbsFileName;
|
||||
PFCB ParentFcb;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING AbsFileName;
|
||||
|
||||
DPRINT("CdfsOpenFile(%08lx, %08lx, %wZ)\n", DeviceExt, FileObject, FileName);
|
||||
DPRINT("CdfsOpenFile(%08lx, %08lx, %wZ)\n", DeviceExt, FileObject, FileName);
|
||||
|
||||
if (FileObject->RelatedFileObject)
|
||||
if (FileObject->RelatedFileObject)
|
||||
{
|
||||
DPRINT("Converting relative filename to absolute filename\n");
|
||||
DPRINT("Converting relative filename to absolute filename\n");
|
||||
|
||||
Status = CdfsMakeAbsoluteFilename(FileObject->RelatedFileObject,
|
||||
FileName,
|
||||
&AbsFileName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
Status = CdfsMakeAbsoluteFilename(FileObject->RelatedFileObject,
|
||||
FileName,
|
||||
&AbsFileName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
FileName = &AbsFileName;
|
||||
FileName = &AbsFileName;
|
||||
}
|
||||
|
||||
Status = CdfsDeviceIoControl (DeviceExt->StorageDevice,
|
||||
IOCTL_CDROM_CHECK_VERIFY,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
FALSE);
|
||||
DPRINT ("Status %lx\n", Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = CdfsDeviceIoControl (DeviceExt->StorageDevice,
|
||||
IOCTL_CDROM_CHECK_VERIFY,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
FALSE);
|
||||
DPRINT ("Status %lx\n", Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Status == STATUS_NO_MEDIA_IN_DEVICE || Status == STATUS_VERIFY_REQUIRED)
|
||||
{
|
||||
DeviceExt->VolumeDevice->Flags |= DO_VERIFY_VOLUME;
|
||||
}
|
||||
DPRINT1 ("Status %lx\n", Status);
|
||||
return Status;
|
||||
if (Status == STATUS_NO_MEDIA_IN_DEVICE || Status == STATUS_VERIFY_REQUIRED)
|
||||
{
|
||||
DeviceExt->VolumeDevice->Flags |= DO_VERIFY_VOLUME;
|
||||
}
|
||||
DPRINT1 ("Status %lx\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("PathName to open: %wZ\n", FileName);
|
||||
DPRINT("PathName to open: %wZ\n", FileName);
|
||||
|
||||
/* try first to find an existing FCB in memory */
|
||||
DPRINT("Checking for existing FCB in memory\n");
|
||||
Fcb = CdfsGrabFCBFromTable(DeviceExt,
|
||||
FileName);
|
||||
if (Fcb == NULL)
|
||||
/* try first to find an existing FCB in memory */
|
||||
DPRINT("Checking for existing FCB in memory\n");
|
||||
Fcb = CdfsGrabFCBFromTable(DeviceExt,
|
||||
FileName);
|
||||
if (Fcb == NULL)
|
||||
{
|
||||
DPRINT("No existing FCB found, making a new one if file exists.\n");
|
||||
Status = CdfsGetFCBForFile(DeviceExt,
|
||||
&ParentFcb,
|
||||
&Fcb,
|
||||
FileName);
|
||||
if (ParentFcb != NULL)
|
||||
{
|
||||
CdfsReleaseFCB(DeviceExt,
|
||||
ParentFcb);
|
||||
}
|
||||
DPRINT("No existing FCB found, making a new one if file exists.\n");
|
||||
Status = CdfsGetFCBForFile(DeviceExt,
|
||||
&ParentFcb,
|
||||
&Fcb,
|
||||
FileName);
|
||||
if (ParentFcb != NULL)
|
||||
{
|
||||
CdfsReleaseFCB(DeviceExt,
|
||||
ParentFcb);
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT("Could not make a new FCB, status: %x\n", Status);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT("Could not make a new FCB, status: %x\n", Status);
|
||||
|
||||
if (FileName == &AbsFileName)
|
||||
RtlFreeUnicodeString(&AbsFileName);
|
||||
if (FileName == &AbsFileName)
|
||||
RtlFreeUnicodeString(&AbsFileName);
|
||||
|
||||
return Status;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("Attaching FCB to fileObject\n");
|
||||
Status = CdfsAttachFCBToFileObject(DeviceExt,
|
||||
Fcb,
|
||||
FileObject);
|
||||
DPRINT("Attaching FCB to fileObject\n");
|
||||
Status = CdfsAttachFCBToFileObject(DeviceExt,
|
||||
Fcb,
|
||||
FileObject);
|
||||
|
||||
if ((FileName == &AbsFileName) && AbsFileName.Buffer)
|
||||
ExFreePool(AbsFileName.Buffer);
|
||||
if ((FileName == &AbsFileName) && AbsFileName.Buffer)
|
||||
ExFreePool(AbsFileName.Buffer);
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
ULONG RequestedDisposition;
|
||||
ULONG RequestedOptions;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
ULONG RequestedDisposition;
|
||||
ULONG RequestedOptions;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsCreateFile() called\n");
|
||||
DPRINT("CdfsCreateFile() called\n");
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExt);
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
ASSERT(Stack);
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExt);
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
ASSERT(Stack);
|
||||
|
||||
RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff);
|
||||
RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
|
||||
DPRINT("RequestedDisposition %x, RequestedOptions %x\n",
|
||||
RequestedDisposition, RequestedOptions);
|
||||
RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff);
|
||||
RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
|
||||
DPRINT("RequestedDisposition %x, RequestedOptions %x\n",
|
||||
RequestedDisposition, RequestedOptions);
|
||||
|
||||
FileObject = Stack->FileObject;
|
||||
FileObject = Stack->FileObject;
|
||||
|
||||
if (RequestedDisposition == FILE_CREATE ||
|
||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||
RequestedDisposition == FILE_SUPERSEDE)
|
||||
if (RequestedDisposition == FILE_CREATE ||
|
||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||
RequestedDisposition == FILE_SUPERSEDE)
|
||||
{
|
||||
return STATUS_ACCESS_DENIED;
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
Status = CdfsOpenFile(DeviceExt,
|
||||
FileObject,
|
||||
&FileObject->FileName);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = CdfsOpenFile(DeviceExt,
|
||||
FileObject,
|
||||
&FileObject->FileName);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Fcb = FileObject->FsContext;
|
||||
Fcb = FileObject->FsContext;
|
||||
|
||||
/* Check whether the file has the requested attributes */
|
||||
if (RequestedOptions & FILE_NON_DIRECTORY_FILE && CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
CdfsCloseFile (DeviceExt, FileObject);
|
||||
return STATUS_FILE_IS_A_DIRECTORY;
|
||||
}
|
||||
/* Check whether the file has the requested attributes */
|
||||
if (RequestedOptions & FILE_NON_DIRECTORY_FILE && CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
CdfsCloseFile (DeviceExt, FileObject);
|
||||
return STATUS_FILE_IS_A_DIRECTORY;
|
||||
}
|
||||
|
||||
if (RequestedOptions & FILE_DIRECTORY_FILE && !CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
CdfsCloseFile (DeviceExt, FileObject);
|
||||
return STATUS_NOT_A_DIRECTORY;
|
||||
}
|
||||
}
|
||||
if (RequestedOptions & FILE_DIRECTORY_FILE && !CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
CdfsCloseFile (DeviceExt, FileObject);
|
||||
return STATUS_NOT_A_DIRECTORY;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the directory containing the file to open doesn't exist then
|
||||
* fail immediately
|
||||
*/
|
||||
Irp->IoStatus.Information = (NT_SUCCESS(Status)) ? FILE_OPENED : 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
/*
|
||||
* If the directory containing the file to open doesn't exist then
|
||||
* fail immediately
|
||||
*/
|
||||
Irp->IoStatus.Information = (NT_SUCCESS(Status)) ? FILE_OPENED : 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
||||
{
|
||||
/* DeviceObject represents FileSystem instead of logical volume */
|
||||
DPRINT("Opening file system\n");
|
||||
Irp->IoStatus.Information = FILE_OPENED;
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
/* DeviceObject represents FileSystem instead of logical volume */
|
||||
DPRINT("Opening file system\n");
|
||||
Irp->IoStatus.Information = FILE_OPENED;
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
|
||||
TRUE);
|
||||
Status = CdfsCreateFile(DeviceObject,
|
||||
Irp);
|
||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
|
||||
TRUE);
|
||||
Status = CdfsCreateFile(DeviceObject,
|
||||
Irp);
|
||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp,
|
||||
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp,
|
||||
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,31 +1,31 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/finfo.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/finfo.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,457 +37,457 @@
|
|||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetStandardInformation(PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_STANDARD_INFORMATION StandardInfo,
|
||||
PULONG BufferLength)
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_STANDARD_INFORMATION StandardInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetStandardInformation() called\n");
|
||||
DPRINT("CdfsGetStandardInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (*BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
/* PRECONDITION */
|
||||
ASSERT(StandardInfo != NULL);
|
||||
ASSERT(Fcb != NULL);
|
||||
/* PRECONDITION */
|
||||
ASSERT(StandardInfo != NULL);
|
||||
ASSERT(Fcb != NULL);
|
||||
|
||||
RtlZeroMemory(StandardInfo,
|
||||
sizeof(FILE_STANDARD_INFORMATION));
|
||||
RtlZeroMemory(StandardInfo,
|
||||
sizeof(FILE_STANDARD_INFORMATION));
|
||||
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
StandardInfo->AllocationSize.QuadPart = 0LL;
|
||||
StandardInfo->EndOfFile.QuadPart = 0LL;
|
||||
StandardInfo->Directory = TRUE;
|
||||
StandardInfo->AllocationSize.QuadPart = 0LL;
|
||||
StandardInfo->EndOfFile.QuadPart = 0LL;
|
||||
StandardInfo->Directory = TRUE;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
StandardInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
StandardInfo->EndOfFile = Fcb->RFCB.FileSize;
|
||||
StandardInfo->Directory = FALSE;
|
||||
StandardInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
StandardInfo->EndOfFile = Fcb->RFCB.FileSize;
|
||||
StandardInfo->Directory = FALSE;
|
||||
}
|
||||
StandardInfo->NumberOfLinks = 0;
|
||||
StandardInfo->DeletePending = FALSE;
|
||||
StandardInfo->NumberOfLinks = 0;
|
||||
StandardInfo->DeletePending = FALSE;
|
||||
|
||||
*BufferLength -= sizeof(FILE_STANDARD_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
*BufferLength -= sizeof(FILE_STANDARD_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file position information
|
||||
*/
|
||||
* FUNCTION: Retrieve the file position information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_POSITION_INFORMATION PositionInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetPositionInformation() called\n");
|
||||
DPRINT("CdfsGetPositionInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_POSITION_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (*BufferLength < sizeof(FILE_POSITION_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
PositionInfo->CurrentByteOffset.QuadPart =
|
||||
FileObject->CurrentByteOffset.QuadPart;
|
||||
PositionInfo->CurrentByteOffset.QuadPart =
|
||||
FileObject->CurrentByteOffset.QuadPart;
|
||||
|
||||
DPRINT("Getting position %I64x\n",
|
||||
PositionInfo->CurrentByteOffset.QuadPart);
|
||||
DPRINT("Getting position %I64x\n",
|
||||
PositionInfo->CurrentByteOffset.QuadPart);
|
||||
|
||||
*BufferLength -= sizeof(FILE_POSITION_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
*BufferLength -= sizeof(FILE_POSITION_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the basic file information
|
||||
*/
|
||||
* FUNCTION: Retrieve the basic file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetBasicInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_BASIC_INFORMATION BasicInfo,
|
||||
PULONG BufferLength)
|
||||
PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_BASIC_INFORMATION BasicInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetBasicInformation() called\n");
|
||||
DPRINT("CdfsGetBasicInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_BASIC_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (*BufferLength < sizeof(FILE_BASIC_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->ChangeTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&BasicInfo->ChangeTime);
|
||||
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&BasicInfo->FileAttributes);
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&BasicInfo->FileAttributes);
|
||||
|
||||
*BufferLength -= sizeof(FILE_BASIC_INFORMATION);
|
||||
*BufferLength -= sizeof(FILE_BASIC_INFORMATION);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetNameInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_NAME_INFORMATION NameInfo,
|
||||
PULONG BufferLength)
|
||||
PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_NAME_INFORMATION NameInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
ULONG NameLength;
|
||||
ULONG BytesToCopy;
|
||||
ULONG NameLength;
|
||||
ULONG BytesToCopy;
|
||||
|
||||
DPRINT("CdfsGetNameInformation() called\n");
|
||||
DPRINT("CdfsGetNameInformation() called\n");
|
||||
|
||||
ASSERT(NameInfo != NULL);
|
||||
ASSERT(Fcb != NULL);
|
||||
ASSERT(NameInfo != NULL);
|
||||
ASSERT(Fcb != NULL);
|
||||
|
||||
/* If buffer can't hold at least the file name length, bail out */
|
||||
if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
/* If buffer can't hold at least the file name length, bail out */
|
||||
if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
/* Calculate file name length in bytes */
|
||||
NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
|
||||
NameInfo->FileNameLength = NameLength;
|
||||
/* Calculate file name length in bytes */
|
||||
NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
|
||||
NameInfo->FileNameLength = NameLength;
|
||||
|
||||
/* Calculate amount of bytes to copy not to overflow the buffer */
|
||||
BytesToCopy = min(NameLength,
|
||||
*BufferLength - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]));
|
||||
/* Calculate amount of bytes to copy not to overflow the buffer */
|
||||
BytesToCopy = min(NameLength,
|
||||
*BufferLength - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]));
|
||||
|
||||
/* Fill in the bytes */
|
||||
RtlCopyMemory(NameInfo->FileName, Fcb->PathName, BytesToCopy);
|
||||
/* Fill in the bytes */
|
||||
RtlCopyMemory(NameInfo->FileName, Fcb->PathName, BytesToCopy);
|
||||
|
||||
/* Check if we could write more but are not able to */
|
||||
if (*BufferLength < NameLength + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
|
||||
{
|
||||
/* Return number of bytes written */
|
||||
*BufferLength -= FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + BytesToCopy;
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
/* Check if we could write more but are not able to */
|
||||
if (*BufferLength < NameLength + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
|
||||
{
|
||||
/* Return number of bytes written */
|
||||
*BufferLength -= FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + BytesToCopy;
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* We filled up as many bytes, as needed */
|
||||
*BufferLength -= (FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + NameLength);
|
||||
/* We filled up as many bytes, as needed */
|
||||
*BufferLength -= (FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + NameLength);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the internal file information
|
||||
*/
|
||||
* FUNCTION: Retrieve the internal file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetInternalInformation(PFCB Fcb,
|
||||
PFILE_INTERNAL_INFORMATION InternalInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_INTERNAL_INFORMATION InternalInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetInternalInformation() called\n");
|
||||
DPRINT("CdfsGetInternalInformation() called\n");
|
||||
|
||||
ASSERT(InternalInfo);
|
||||
ASSERT(Fcb);
|
||||
ASSERT(InternalInfo);
|
||||
ASSERT(Fcb);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
InternalInfo->IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
InternalInfo->IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
|
||||
*BufferLength -= sizeof(FILE_INTERNAL_INFORMATION);
|
||||
*BufferLength -= sizeof(FILE_INTERNAL_INFORMATION);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file network open information
|
||||
*/
|
||||
* FUNCTION: Retrieve the file network open information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetNetworkOpenInformation(PFCB Fcb,
|
||||
PFILE_NETWORK_OPEN_INFORMATION NetworkInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_NETWORK_OPEN_INFORMATION NetworkInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
ASSERT(NetworkInfo);
|
||||
ASSERT(Fcb);
|
||||
ASSERT(NetworkInfo);
|
||||
ASSERT(Fcb);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_NETWORK_OPEN_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
if (*BufferLength < sizeof(FILE_NETWORK_OPEN_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->ChangeTime);
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&NetworkInfo->ChangeTime);
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
NetworkInfo->AllocationSize.QuadPart = 0LL;
|
||||
NetworkInfo->EndOfFile.QuadPart = 0LL;
|
||||
NetworkInfo->AllocationSize.QuadPart = 0LL;
|
||||
NetworkInfo->EndOfFile.QuadPart = 0LL;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
NetworkInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
NetworkInfo->EndOfFile = Fcb->RFCB.FileSize;
|
||||
NetworkInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
NetworkInfo->EndOfFile = Fcb->RFCB.FileSize;
|
||||
}
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&NetworkInfo->FileAttributes);
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&NetworkInfo->FileAttributes);
|
||||
|
||||
*BufferLength -= sizeof(FILE_NETWORK_OPEN_INFORMATION);
|
||||
*BufferLength -= sizeof(FILE_NETWORK_OPEN_INFORMATION);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve all file information
|
||||
*/
|
||||
* FUNCTION: Retrieve all file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetAllInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
PFILE_ALL_INFORMATION Info,
|
||||
PULONG BufferLength)
|
||||
PFCB Fcb,
|
||||
PFILE_ALL_INFORMATION Info,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
ULONG NameLength;
|
||||
ULONG NameLength;
|
||||
|
||||
ASSERT(Info);
|
||||
ASSERT(Fcb);
|
||||
ASSERT(Info);
|
||||
ASSERT(Fcb);
|
||||
|
||||
NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
|
||||
if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength)
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
|
||||
if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength)
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
/* Basic Information */
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.ChangeTime);
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&Info->BasicInformation.FileAttributes);
|
||||
/* Basic Information */
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.CreationTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.LastAccessTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.LastWriteTime);
|
||||
CdfsDateTimeToSystemTime(Fcb,
|
||||
&Info->BasicInformation.ChangeTime);
|
||||
CdfsFileFlagsToAttributes(Fcb,
|
||||
&Info->BasicInformation.FileAttributes);
|
||||
|
||||
/* Standard Information */
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
/* Standard Information */
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
Info->StandardInformation.AllocationSize.QuadPart = 0LL;
|
||||
Info->StandardInformation.EndOfFile.QuadPart = 0LL;
|
||||
Info->StandardInformation.Directory = TRUE;
|
||||
Info->StandardInformation.AllocationSize.QuadPart = 0LL;
|
||||
Info->StandardInformation.EndOfFile.QuadPart = 0LL;
|
||||
Info->StandardInformation.Directory = TRUE;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize;
|
||||
Info->StandardInformation.Directory = FALSE;
|
||||
Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize;
|
||||
Info->StandardInformation.Directory = FALSE;
|
||||
}
|
||||
Info->StandardInformation.NumberOfLinks = 0;
|
||||
Info->StandardInformation.DeletePending = FALSE;
|
||||
Info->StandardInformation.NumberOfLinks = 0;
|
||||
Info->StandardInformation.DeletePending = FALSE;
|
||||
|
||||
/* Internal Information */
|
||||
Info->InternalInformation.IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
/* Internal Information */
|
||||
Info->InternalInformation.IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
|
||||
/* EA Information */
|
||||
Info->EaInformation.EaSize = 0;
|
||||
/* EA Information */
|
||||
Info->EaInformation.EaSize = 0;
|
||||
|
||||
/* Access Information */
|
||||
/* The IO-Manager adds this information */
|
||||
/* Access Information */
|
||||
/* The IO-Manager adds this information */
|
||||
|
||||
/* Position Information */
|
||||
Info->PositionInformation.CurrentByteOffset.QuadPart = FileObject->CurrentByteOffset.QuadPart;
|
||||
/* Position Information */
|
||||
Info->PositionInformation.CurrentByteOffset.QuadPart = FileObject->CurrentByteOffset.QuadPart;
|
||||
|
||||
/* Mode Information */
|
||||
/* The IO-Manager adds this information */
|
||||
/* Mode Information */
|
||||
/* The IO-Manager adds this information */
|
||||
|
||||
/* Alignment Information */
|
||||
/* The IO-Manager adds this information */
|
||||
/* Alignment Information */
|
||||
/* The IO-Manager adds this information */
|
||||
|
||||
/* Name Information */
|
||||
Info->NameInformation.FileNameLength = NameLength;
|
||||
RtlCopyMemory(Info->NameInformation.FileName,
|
||||
Fcb->PathName,
|
||||
NameLength + sizeof(WCHAR));
|
||||
/* Name Information */
|
||||
Info->NameInformation.FileNameLength = NameLength;
|
||||
RtlCopyMemory(Info->NameInformation.FileName,
|
||||
Fcb->PathName,
|
||||
NameLength + sizeof(WCHAR));
|
||||
|
||||
*BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR));
|
||||
*BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the specified file information
|
||||
*/
|
||||
* FUNCTION: Retrieve the specified file information
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PFCB Fcb;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PFCB Fcb;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("CdfsQueryInformation() called\n");
|
||||
DPRINT("CdfsQueryInformation() called\n");
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
|
||||
FileObject = Stack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
|
||||
FileObject = Stack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
BufferLength = Stack->Parameters.QueryFile.Length;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
BufferLength = Stack->Parameters.QueryFile.Length;
|
||||
|
||||
switch (FileInformationClass)
|
||||
switch (FileInformationClass)
|
||||
{
|
||||
case FileStandardInformation:
|
||||
Status = CdfsGetStandardInformation(Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileStandardInformation:
|
||||
Status = CdfsGetStandardInformation(Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FilePositionInformation:
|
||||
Status = CdfsGetPositionInformation(FileObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FilePositionInformation:
|
||||
Status = CdfsGetPositionInformation(FileObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileBasicInformation:
|
||||
Status = CdfsGetBasicInformation(FileObject,
|
||||
Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileBasicInformation:
|
||||
Status = CdfsGetBasicInformation(FileObject,
|
||||
Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileNameInformation:
|
||||
Status = CdfsGetNameInformation(FileObject,
|
||||
Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileNameInformation:
|
||||
Status = CdfsGetNameInformation(FileObject,
|
||||
Fcb,
|
||||
DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileInternalInformation:
|
||||
Status = CdfsGetInternalInformation(Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileInternalInformation:
|
||||
Status = CdfsGetInternalInformation(Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileNetworkOpenInformation:
|
||||
Status = CdfsGetNetworkOpenInformation(Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileNetworkOpenInformation:
|
||||
Status = CdfsGetNetworkOpenInformation(Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileAllInformation:
|
||||
Status = CdfsGetAllInformation(FileObject,
|
||||
Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileAllInformation:
|
||||
Status = CdfsGetAllInformation(FileObject,
|
||||
Fcb,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileAlternateNameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case FileAlternateNameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT("Unimplemented information class %u\n", FileInformationClass);
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
default:
|
||||
DPRINT("Unimplemented information class %u\n", FileInformationClass);
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryFile.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryFile.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Set the file position information
|
||||
*/
|
||||
* FUNCTION: Set the file position information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsSetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo)
|
||||
PFILE_POSITION_INFORMATION PositionInfo)
|
||||
{
|
||||
DPRINT ("CdfsSetPositionInformation()\n");
|
||||
DPRINT ("CdfsSetPositionInformation()\n");
|
||||
|
||||
DPRINT ("PositionInfo %x\n", PositionInfo);
|
||||
DPRINT ("Setting position %I64u\n", PositionInfo->CurrentByteOffset.QuadPart);
|
||||
DPRINT ("PositionInfo %x\n", PositionInfo);
|
||||
DPRINT ("Setting position %I64u\n", PositionInfo->CurrentByteOffset.QuadPart);
|
||||
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
PositionInfo->CurrentByteOffset.QuadPart;
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
PositionInfo->CurrentByteOffset.QuadPart;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Set the specified file information
|
||||
*/
|
||||
* FUNCTION: Set the specified file information
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
CdfsSetInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PFCB Fcb;
|
||||
PVOID SystemBuffer;
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PFCB Fcb;
|
||||
PVOID SystemBuffer;
|
||||
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("CdfsSetInformation() called\n");
|
||||
DPRINT("CdfsSetInformation() called\n");
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileInformationClass = Stack->Parameters.SetFile.FileInformationClass;
|
||||
FileObject = Stack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileInformationClass = Stack->Parameters.SetFile.FileInformationClass;
|
||||
FileObject = Stack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
switch (FileInformationClass)
|
||||
switch (FileInformationClass)
|
||||
{
|
||||
case FilePositionInformation:
|
||||
Status = CdfsSetPositionInformation(FileObject,
|
||||
SystemBuffer);
|
||||
break;
|
||||
case FilePositionInformation:
|
||||
Status = CdfsSetPositionInformation(FileObject,
|
||||
SystemBuffer);
|
||||
break;
|
||||
|
||||
case FileBasicInformation:
|
||||
case FileRenameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case FileBasicInformation:
|
||||
case FileRenameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/fsctl.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/fsctl.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,486 +37,486 @@
|
|||
static __inline
|
||||
int msf_to_lba (UCHAR m, UCHAR s, UCHAR f)
|
||||
{
|
||||
return (((m * 60) + s) * 75 + f) - 150;
|
||||
return (((m * 60) + s) * 75 + f) - 150;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
CdfsGetPVDData(PUCHAR Buffer,
|
||||
PCDINFO CdInfo)
|
||||
PCDINFO CdInfo)
|
||||
{
|
||||
PPVD Pvd;
|
||||
ULONG i;
|
||||
PUCHAR pc;
|
||||
PWCHAR pw;
|
||||
PPVD Pvd;
|
||||
ULONG i;
|
||||
PUCHAR pc;
|
||||
PWCHAR pw;
|
||||
|
||||
union
|
||||
union
|
||||
{
|
||||
ULONG Value;
|
||||
UCHAR Part[4];
|
||||
ULONG Value;
|
||||
UCHAR Part[4];
|
||||
} Serial;
|
||||
|
||||
Pvd = (PPVD)Buffer;
|
||||
Pvd = (PPVD)Buffer;
|
||||
|
||||
/* Calculate the volume serial number */
|
||||
Serial.Value = 0;
|
||||
for (i = 0; i < 2048; i += 4)
|
||||
/* Calculate the volume serial number */
|
||||
Serial.Value = 0;
|
||||
for (i = 0; i < 2048; i += 4)
|
||||
{
|
||||
/* DON'T optimize this to ULONG!!! (breaks overflow) */
|
||||
Serial.Part[0] += Buffer[i+3];
|
||||
Serial.Part[1] += Buffer[i+2];
|
||||
Serial.Part[2] += Buffer[i+1];
|
||||
Serial.Part[3] += Buffer[i+0];
|
||||
/* DON'T optimize this to ULONG!!! (breaks overflow) */
|
||||
Serial.Part[0] += Buffer[i+3];
|
||||
Serial.Part[1] += Buffer[i+2];
|
||||
Serial.Part[2] += Buffer[i+1];
|
||||
Serial.Part[3] += Buffer[i+0];
|
||||
}
|
||||
CdInfo->SerialNumber = Serial.Value;
|
||||
CdInfo->SerialNumber = Serial.Value;
|
||||
|
||||
/* Extract the volume label */
|
||||
pc = Pvd->VolumeId;
|
||||
pw = CdInfo->VolumeLabel;
|
||||
for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH && *pc != ' '; i++)
|
||||
/* Extract the volume label */
|
||||
pc = Pvd->VolumeId;
|
||||
pw = CdInfo->VolumeLabel;
|
||||
for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH && *pc != ' '; i++)
|
||||
{
|
||||
*pw++ = (WCHAR)*pc++;
|
||||
*pw++ = (WCHAR)*pc++;
|
||||
}
|
||||
*pw = 0;
|
||||
CdInfo->VolumeLabelLength = i * sizeof(WCHAR);
|
||||
*pw = 0;
|
||||
CdInfo->VolumeLabelLength = i * sizeof(WCHAR);
|
||||
|
||||
CdInfo->VolumeSpaceSize = Pvd->VolumeSpaceSizeL;
|
||||
CdInfo->RootStart = Pvd->RootDirRecord.ExtentLocationL;
|
||||
CdInfo->RootSize = Pvd->RootDirRecord.DataLengthL;
|
||||
CdInfo->VolumeSpaceSize = Pvd->VolumeSpaceSizeL;
|
||||
CdInfo->RootStart = Pvd->RootDirRecord.ExtentLocationL;
|
||||
CdInfo->RootSize = Pvd->RootDirRecord.DataLengthL;
|
||||
|
||||
DPRINT("VolumeSerial: %08lx\n", CdInfo->SerialNumber);
|
||||
DPRINT("VolumeLabel: '%S'\n", CdInfo->VolumeLabel);
|
||||
DPRINT("VolumeLabelLength: %lu\n", CdInfo->VolumeLabelLength);
|
||||
DPRINT("VolumeSize: %lu\n", Pvd->VolumeSpaceSizeL);
|
||||
DPRINT("RootStart: %lu\n", Pvd->RootDirRecord.ExtentLocationL);
|
||||
DPRINT("RootSize: %lu\n", Pvd->RootDirRecord.DataLengthL);
|
||||
DPRINT("PathTableSize: %lu\n", Pvd->PathTableSizeL);
|
||||
DPRINT("PathTablePos: %lu\n", Pvd->LPathTablePos);
|
||||
DPRINT("OptPathTablePos: %lu\n", Pvd->LOptPathTablePos);
|
||||
DPRINT("VolumeSerial: %08lx\n", CdInfo->SerialNumber);
|
||||
DPRINT("VolumeLabel: '%S'\n", CdInfo->VolumeLabel);
|
||||
DPRINT("VolumeLabelLength: %lu\n", CdInfo->VolumeLabelLength);
|
||||
DPRINT("VolumeSize: %lu\n", Pvd->VolumeSpaceSizeL);
|
||||
DPRINT("RootStart: %lu\n", Pvd->RootDirRecord.ExtentLocationL);
|
||||
DPRINT("RootSize: %lu\n", Pvd->RootDirRecord.DataLengthL);
|
||||
DPRINT("PathTableSize: %lu\n", Pvd->PathTableSizeL);
|
||||
DPRINT("PathTablePos: %lu\n", Pvd->LPathTablePos);
|
||||
DPRINT("OptPathTablePos: %lu\n", Pvd->LOptPathTablePos);
|
||||
|
||||
#if 0
|
||||
DbgPrint("******** PVD **********\n");
|
||||
DbgPrint("VdType: %d\n", Pvd->VdType);
|
||||
DbgPrint("StandardId: '%.*s'\n", 5, Pvd->StandardId);
|
||||
DbgPrint("VdVersion: %d\n", Pvd->VdVersion);
|
||||
DbgPrint("SystemId: '%.*s'\n", 32, Pvd->SystemId);
|
||||
DbgPrint("VolumeId: '%.*s'\n", 32, Pvd->VolumeId);
|
||||
DbgPrint("VolumeSpaceSizeL: %d (%x)\n", Pvd->VolumeSpaceSizeL, Pvd->VolumeSpaceSizeL);
|
||||
DbgPrint("VolumeSpaceSizeM: %d (%x)\n", Pvd->VolumeSpaceSizeM, Pvd->VolumeSpaceSizeM);
|
||||
DbgPrint("VolumeSetSize: %d (%x)\n", Pvd->VolumeSequenceNumber, Pvd->VolumeSequenceNumber);
|
||||
DbgPrint("VolumeSequenceNumber: %d (%x)\n", Pvd->VolumeSequenceNumber, Pvd->VolumeSequenceNumber);
|
||||
DbgPrint("LogicalBlockSize: %d (%x)\n", Pvd->LogicalBlockSize, Pvd->LogicalBlockSize);
|
||||
DbgPrint("PathTableSizeL: %d (%x)\n", Pvd->PathTableSizeL, Pvd->PathTableSizeL);
|
||||
DbgPrint("PathTableSizeM: %d (%x)\n", Pvd->PathTableSizeM, Pvd->PathTableSizeM);
|
||||
DbgPrint("LPathTablePos: %d (%x)\n", Pvd->LPathTablePos, Pvd->LPathTablePos);
|
||||
DbgPrint("LOptPathTablePos: %d (%x)\n", Pvd->LOptPathTablePos, Pvd->LOptPathTablePos);
|
||||
DbgPrint("MPathTablePos: %d (%x)\n", Pvd->MPathTablePos, Pvd->MPathTablePos);
|
||||
DbgPrint("MOptPathTablePos: %d (%x)\n", Pvd->MOptPathTablePos, Pvd->MOptPathTablePos);
|
||||
DbgPrint("VolumeSetIdentifier: '%.*s'\n", 128, Pvd->VolumeSetIdentifier);
|
||||
DbgPrint("PublisherIdentifier: '%.*s'\n", 128, Pvd->PublisherIdentifier);
|
||||
DbgPrint("******** Root *********\n");
|
||||
DbgPrint("RecordLength: %d\n", Pvd->RootDirRecord.RecordLength);
|
||||
DbgPrint("ExtAttrRecordLength: %d\n", Pvd->RootDirRecord.ExtAttrRecordLength);
|
||||
DbgPrint("ExtentLocationL: %d\n", Pvd->RootDirRecord.ExtentLocationL);
|
||||
DbgPrint("DataLengthL: %d\n", Pvd->RootDirRecord.DataLengthL);
|
||||
DbgPrint("Year: %d\n", Pvd->RootDirRecord.Year);
|
||||
DbgPrint("Month: %d\n", Pvd->RootDirRecord.Month);
|
||||
DbgPrint("Day: %d\n", Pvd->RootDirRecord.Day);
|
||||
DbgPrint("Hour: %d\n", Pvd->RootDirRecord.Hour);
|
||||
DbgPrint("Minute: %d\n", Pvd->RootDirRecord.Minute);
|
||||
DbgPrint("Second: %d\n", Pvd->RootDirRecord.Second);
|
||||
DbgPrint("TimeZone: %d\n", Pvd->RootDirRecord.TimeZone);
|
||||
DbgPrint("FileFlags: %d\n", Pvd->RootDirRecord.FileFlags);
|
||||
DbgPrint("FileUnitSize: %d\n", Pvd->RootDirRecord.FileUnitSize);
|
||||
DbgPrint("InterleaveGapSize: %d\n", Pvd->RootDirRecord.InterleaveGapSize);
|
||||
DbgPrint("VolumeSequenceNumber: %d\n", Pvd->RootDirRecord.VolumeSequenceNumber);
|
||||
DbgPrint("FileIdLength: %d\n", Pvd->RootDirRecord.FileIdLength);
|
||||
DbgPrint("FileId: '%.*s'\n", Pvd->RootDirRecord.FileId);
|
||||
DbgPrint("***********************\n");
|
||||
DbgPrint("******** PVD **********\n");
|
||||
DbgPrint("VdType: %d\n", Pvd->VdType);
|
||||
DbgPrint("StandardId: '%.*s'\n", 5, Pvd->StandardId);
|
||||
DbgPrint("VdVersion: %d\n", Pvd->VdVersion);
|
||||
DbgPrint("SystemId: '%.*s'\n", 32, Pvd->SystemId);
|
||||
DbgPrint("VolumeId: '%.*s'\n", 32, Pvd->VolumeId);
|
||||
DbgPrint("VolumeSpaceSizeL: %d (%x)\n", Pvd->VolumeSpaceSizeL, Pvd->VolumeSpaceSizeL);
|
||||
DbgPrint("VolumeSpaceSizeM: %d (%x)\n", Pvd->VolumeSpaceSizeM, Pvd->VolumeSpaceSizeM);
|
||||
DbgPrint("VolumeSetSize: %d (%x)\n", Pvd->VolumeSequenceNumber, Pvd->VolumeSequenceNumber);
|
||||
DbgPrint("VolumeSequenceNumber: %d (%x)\n", Pvd->VolumeSequenceNumber, Pvd->VolumeSequenceNumber);
|
||||
DbgPrint("LogicalBlockSize: %d (%x)\n", Pvd->LogicalBlockSize, Pvd->LogicalBlockSize);
|
||||
DbgPrint("PathTableSizeL: %d (%x)\n", Pvd->PathTableSizeL, Pvd->PathTableSizeL);
|
||||
DbgPrint("PathTableSizeM: %d (%x)\n", Pvd->PathTableSizeM, Pvd->PathTableSizeM);
|
||||
DbgPrint("LPathTablePos: %d (%x)\n", Pvd->LPathTablePos, Pvd->LPathTablePos);
|
||||
DbgPrint("LOptPathTablePos: %d (%x)\n", Pvd->LOptPathTablePos, Pvd->LOptPathTablePos);
|
||||
DbgPrint("MPathTablePos: %d (%x)\n", Pvd->MPathTablePos, Pvd->MPathTablePos);
|
||||
DbgPrint("MOptPathTablePos: %d (%x)\n", Pvd->MOptPathTablePos, Pvd->MOptPathTablePos);
|
||||
DbgPrint("VolumeSetIdentifier: '%.*s'\n", 128, Pvd->VolumeSetIdentifier);
|
||||
DbgPrint("PublisherIdentifier: '%.*s'\n", 128, Pvd->PublisherIdentifier);
|
||||
DbgPrint("******** Root *********\n");
|
||||
DbgPrint("RecordLength: %d\n", Pvd->RootDirRecord.RecordLength);
|
||||
DbgPrint("ExtAttrRecordLength: %d\n", Pvd->RootDirRecord.ExtAttrRecordLength);
|
||||
DbgPrint("ExtentLocationL: %d\n", Pvd->RootDirRecord.ExtentLocationL);
|
||||
DbgPrint("DataLengthL: %d\n", Pvd->RootDirRecord.DataLengthL);
|
||||
DbgPrint("Year: %d\n", Pvd->RootDirRecord.Year);
|
||||
DbgPrint("Month: %d\n", Pvd->RootDirRecord.Month);
|
||||
DbgPrint("Day: %d\n", Pvd->RootDirRecord.Day);
|
||||
DbgPrint("Hour: %d\n", Pvd->RootDirRecord.Hour);
|
||||
DbgPrint("Minute: %d\n", Pvd->RootDirRecord.Minute);
|
||||
DbgPrint("Second: %d\n", Pvd->RootDirRecord.Second);
|
||||
DbgPrint("TimeZone: %d\n", Pvd->RootDirRecord.TimeZone);
|
||||
DbgPrint("FileFlags: %d\n", Pvd->RootDirRecord.FileFlags);
|
||||
DbgPrint("FileUnitSize: %d\n", Pvd->RootDirRecord.FileUnitSize);
|
||||
DbgPrint("InterleaveGapSize: %d\n", Pvd->RootDirRecord.InterleaveGapSize);
|
||||
DbgPrint("VolumeSequenceNumber: %d\n", Pvd->RootDirRecord.VolumeSequenceNumber);
|
||||
DbgPrint("FileIdLength: %d\n", Pvd->RootDirRecord.FileIdLength);
|
||||
DbgPrint("FileId: '%.*s'\n", Pvd->RootDirRecord.FileId);
|
||||
DbgPrint("***********************\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
CdfsGetSVDData(PUCHAR Buffer,
|
||||
PCDINFO CdInfo)
|
||||
PCDINFO CdInfo)
|
||||
{
|
||||
PSVD Svd;
|
||||
ULONG JolietLevel = 0;
|
||||
PSVD Svd;
|
||||
ULONG JolietLevel = 0;
|
||||
|
||||
Svd = (PSVD)Buffer;
|
||||
Svd = (PSVD)Buffer;
|
||||
|
||||
DPRINT("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
||||
DPRINT("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
||||
|
||||
if (strncmp((PCHAR)Svd->EscapeSequences, "%/@", 3) == 0)
|
||||
if (strncmp((PCHAR)Svd->EscapeSequences, "%/@", 3) == 0)
|
||||
{
|
||||
DPRINT("Joliet extension found (UCS-2 Level 1)\n");
|
||||
JolietLevel = 1;
|
||||
DPRINT("Joliet extension found (UCS-2 Level 1)\n");
|
||||
JolietLevel = 1;
|
||||
}
|
||||
else if (strncmp((PCHAR)Svd->EscapeSequences, "%/C", 3) == 0)
|
||||
else if (strncmp((PCHAR)Svd->EscapeSequences, "%/C", 3) == 0)
|
||||
{
|
||||
DPRINT("Joliet extension found (UCS-2 Level 2)\n");
|
||||
JolietLevel = 2;
|
||||
DPRINT("Joliet extension found (UCS-2 Level 2)\n");
|
||||
JolietLevel = 2;
|
||||
}
|
||||
else if (strncmp((PCHAR)Svd->EscapeSequences, "%/E", 3) == 0)
|
||||
else if (strncmp((PCHAR)Svd->EscapeSequences, "%/E", 3) == 0)
|
||||
{
|
||||
DPRINT("Joliet extension found (UCS-2 Level 3)\n");
|
||||
JolietLevel = 3;
|
||||
DPRINT("Joliet extension found (UCS-2 Level 3)\n");
|
||||
JolietLevel = 3;
|
||||
}
|
||||
|
||||
CdInfo->JolietLevel = JolietLevel;
|
||||
CdInfo->JolietLevel = JolietLevel;
|
||||
|
||||
if (JolietLevel != 0)
|
||||
if (JolietLevel != 0)
|
||||
{
|
||||
CdInfo->RootStart = Svd->RootDirRecord.ExtentLocationL;
|
||||
CdInfo->RootSize = Svd->RootDirRecord.DataLengthL;
|
||||
CdInfo->RootStart = Svd->RootDirRecord.ExtentLocationL;
|
||||
CdInfo->RootSize = Svd->RootDirRecord.DataLengthL;
|
||||
|
||||
DPRINT("RootStart: %lu\n", Svd->RootDirRecord.ExtentLocationL);
|
||||
DPRINT("RootSize: %lu\n", Svd->RootDirRecord.DataLengthL);
|
||||
DPRINT("RootStart: %lu\n", Svd->RootDirRecord.ExtentLocationL);
|
||||
DPRINT("RootSize: %lu\n", Svd->RootDirRecord.DataLengthL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||
PCDINFO CdInfo)
|
||||
PCDINFO CdInfo)
|
||||
{
|
||||
PUCHAR Buffer;
|
||||
NTSTATUS Status;
|
||||
ULONG Sector;
|
||||
PVD_HEADER VdHeader;
|
||||
ULONG Size;
|
||||
ULONG Offset;
|
||||
ULONG i;
|
||||
struct
|
||||
{
|
||||
UCHAR Length[2];
|
||||
UCHAR FirstSession;
|
||||
UCHAR LastSession;
|
||||
TRACK_DATA TrackData;
|
||||
}
|
||||
Toc;
|
||||
|
||||
DPRINT("CdfsGetVolumeData\n");
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,
|
||||
CDFS_BASIC_SECTOR);
|
||||
if (Buffer == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
Size = sizeof(Toc);
|
||||
Status = CdfsDeviceIoControl(DeviceObject,
|
||||
IOCTL_CDROM_GET_LAST_SESSION,
|
||||
NULL,
|
||||
0,
|
||||
&Toc,
|
||||
&Size,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
PUCHAR Buffer;
|
||||
NTSTATUS Status;
|
||||
ULONG Sector;
|
||||
PVD_HEADER VdHeader;
|
||||
ULONG Size;
|
||||
ULONG Offset;
|
||||
ULONG i;
|
||||
struct
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return Status;
|
||||
UCHAR Length[2];
|
||||
UCHAR FirstSession;
|
||||
UCHAR LastSession;
|
||||
TRACK_DATA TrackData;
|
||||
}
|
||||
Toc;
|
||||
|
||||
DPRINT("CdfsGetVolumeData\n");
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,
|
||||
CDFS_BASIC_SECTOR);
|
||||
if (Buffer == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
Size = sizeof(Toc);
|
||||
Status = CdfsDeviceIoControl(DeviceObject,
|
||||
IOCTL_CDROM_GET_LAST_SESSION,
|
||||
NULL,
|
||||
0,
|
||||
&Toc,
|
||||
&Size,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("FirstSession %d, LastSession %d, FirstTrack %d\n",
|
||||
Toc.FirstSession, Toc.LastSession, Toc.TrackData.TrackNumber);
|
||||
DPRINT("FirstSession %d, LastSession %d, FirstTrack %d\n",
|
||||
Toc.FirstSession, Toc.LastSession, Toc.TrackData.TrackNumber);
|
||||
|
||||
Offset = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
Offset = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
Offset = (Offset << 8) + Toc.TrackData.Address[i];
|
||||
Offset = (Offset << 8) + Toc.TrackData.Address[i];
|
||||
}
|
||||
CdInfo->VolumeOffset = Offset;
|
||||
CdInfo->VolumeOffset = Offset;
|
||||
|
||||
DPRINT("Offset of first track in last session %d\n", Offset);
|
||||
DPRINT("Offset of first track in last session %d\n", Offset);
|
||||
|
||||
CdInfo->JolietLevel = 0;
|
||||
VdHeader = (PVD_HEADER)Buffer;
|
||||
Buffer[0] = 0;
|
||||
CdInfo->JolietLevel = 0;
|
||||
VdHeader = (PVD_HEADER)Buffer;
|
||||
Buffer[0] = 0;
|
||||
|
||||
for (Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION; Sector < 100 && Buffer[0] != 255; Sector++)
|
||||
for (Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION; Sector < 100 && Buffer[0] != 255; Sector++)
|
||||
{
|
||||
/* Read the Primary Volume Descriptor (PVD) */
|
||||
Status = CdfsReadSectors (DeviceObject,
|
||||
Sector + Offset,
|
||||
1,
|
||||
Buffer,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return Status;
|
||||
}
|
||||
/* Read the Primary Volume Descriptor (PVD) */
|
||||
Status = CdfsReadSectors (DeviceObject,
|
||||
Sector + Offset,
|
||||
1,
|
||||
Buffer,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Sector == CDFS_PRIMARY_DESCRIPTOR_LOCATION)
|
||||
{
|
||||
DPRINT("CD-identifier: [%.5s]\n", Buffer + 1);
|
||||
if (Sector == CDFS_PRIMARY_DESCRIPTOR_LOCATION)
|
||||
{
|
||||
DPRINT("CD-identifier: [%.5s]\n", Buffer + 1);
|
||||
|
||||
if (Buffer[0] != 1 || Buffer[1] != 'C' || Buffer[2] != 'D' ||
|
||||
Buffer[3] != '0' || Buffer[4] != '0' || Buffer[5] != '1')
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return STATUS_UNRECOGNIZED_VOLUME;
|
||||
}
|
||||
}
|
||||
if (Buffer[0] != 1 || Buffer[1] != 'C' || Buffer[2] != 'D' ||
|
||||
Buffer[3] != '0' || Buffer[4] != '0' || Buffer[5] != '1')
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
return STATUS_UNRECOGNIZED_VOLUME;
|
||||
}
|
||||
}
|
||||
|
||||
switch (VdHeader->VdType)
|
||||
{
|
||||
case 0:
|
||||
DPRINT("BootVolumeDescriptor found!\n");
|
||||
break;
|
||||
switch (VdHeader->VdType)
|
||||
{
|
||||
case 0:
|
||||
DPRINT("BootVolumeDescriptor found!\n");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
DPRINT("PrimaryVolumeDescriptor found!\n");
|
||||
CdfsGetPVDData(Buffer, CdInfo);
|
||||
break;
|
||||
case 1:
|
||||
DPRINT("PrimaryVolumeDescriptor found!\n");
|
||||
CdfsGetPVDData(Buffer, CdInfo);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
DPRINT("SupplementaryVolumeDescriptor found!\n");
|
||||
CdfsGetSVDData(Buffer, CdInfo);
|
||||
break;
|
||||
case 2:
|
||||
DPRINT("SupplementaryVolumeDescriptor found!\n");
|
||||
CdfsGetSVDData(Buffer, CdInfo);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
DPRINT("VolumePartitionDescriptor found!\n");
|
||||
break;
|
||||
case 3:
|
||||
DPRINT("VolumePartitionDescriptor found!\n");
|
||||
break;
|
||||
|
||||
case 255:
|
||||
DPRINT("VolumeDescriptorSetTerminator found!\n");
|
||||
break;
|
||||
case 255:
|
||||
DPRINT("VolumeDescriptorSetTerminator found!\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Unknown volume descriptor type %u found!\n", VdHeader->VdType);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DPRINT1("Unknown volume descriptor type %u found!\n", VdHeader->VdType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ExFreePool(Buffer);
|
||||
ExFreePool(Buffer);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt = NULL;
|
||||
PDEVICE_OBJECT NewDeviceObject = NULL;
|
||||
PDEVICE_OBJECT DeviceToMount;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFCB Fcb = NULL;
|
||||
PCCB Ccb = NULL;
|
||||
PVPB Vpb;
|
||||
NTSTATUS Status;
|
||||
CDINFO CdInfo;
|
||||
PDEVICE_EXTENSION DeviceExt = NULL;
|
||||
PDEVICE_OBJECT NewDeviceObject = NULL;
|
||||
PDEVICE_OBJECT DeviceToMount;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFCB Fcb = NULL;
|
||||
PCCB Ccb = NULL;
|
||||
PVPB Vpb;
|
||||
NTSTATUS Status;
|
||||
CDINFO CdInfo;
|
||||
|
||||
DPRINT("CdfsMountVolume() called\n");
|
||||
DPRINT("CdfsMountVolume() called\n");
|
||||
|
||||
if (DeviceObject != CdfsGlobalData->DeviceObject)
|
||||
if (DeviceObject != CdfsGlobalData->DeviceObject)
|
||||
{
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
goto ByeBye;
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceToMount = Stack->Parameters.MountVolume.DeviceObject;
|
||||
Vpb = Stack->Parameters.MountVolume.Vpb;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceToMount = Stack->Parameters.MountVolume.DeviceObject;
|
||||
Vpb = Stack->Parameters.MountVolume.Vpb;
|
||||
|
||||
Status = CdfsGetVolumeData(DeviceToMount, &CdInfo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = CdfsGetVolumeData(DeviceToMount, &CdInfo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto ByeBye;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Status = IoCreateDevice(CdfsGlobalData->DriverObject,
|
||||
sizeof(DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||
0,
|
||||
FALSE,
|
||||
&NewDeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
Status = IoCreateDevice(CdfsGlobalData->DriverObject,
|
||||
sizeof(DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||
0,
|
||||
FALSE,
|
||||
&NewDeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
NewDeviceObject->Flags = NewDeviceObject->Flags | DO_DIRECT_IO;
|
||||
NewDeviceObject->Flags &= ~DO_VERIFY_VOLUME;
|
||||
DeviceExt = (PVOID)NewDeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExt,
|
||||
sizeof(DEVICE_EXTENSION));
|
||||
NewDeviceObject->Flags = NewDeviceObject->Flags | DO_DIRECT_IO;
|
||||
NewDeviceObject->Flags &= ~DO_VERIFY_VOLUME;
|
||||
DeviceExt = (PVOID)NewDeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExt,
|
||||
sizeof(DEVICE_EXTENSION));
|
||||
|
||||
Vpb->SerialNumber = CdInfo.SerialNumber;
|
||||
Vpb->VolumeLabelLength = CdInfo.VolumeLabelLength;
|
||||
RtlCopyMemory(Vpb->VolumeLabel, CdInfo.VolumeLabel, CdInfo.VolumeLabelLength * sizeof(WCHAR));
|
||||
RtlCopyMemory(&DeviceExt->CdInfo, &CdInfo, sizeof(CDINFO));
|
||||
Vpb->SerialNumber = CdInfo.SerialNumber;
|
||||
Vpb->VolumeLabelLength = CdInfo.VolumeLabelLength;
|
||||
RtlCopyMemory(Vpb->VolumeLabel, CdInfo.VolumeLabel, CdInfo.VolumeLabelLength * sizeof(WCHAR));
|
||||
RtlCopyMemory(&DeviceExt->CdInfo, &CdInfo, sizeof(CDINFO));
|
||||
|
||||
NewDeviceObject->Vpb = DeviceToMount->Vpb;
|
||||
NewDeviceObject->Vpb = DeviceToMount->Vpb;
|
||||
|
||||
DeviceExt->VolumeDevice = NewDeviceObject;
|
||||
DeviceExt->StorageDevice = DeviceToMount;
|
||||
DeviceExt->StorageDevice->Vpb->DeviceObject = NewDeviceObject;
|
||||
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||
NewDeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||
NewDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
DeviceExt->VolumeDevice = NewDeviceObject;
|
||||
DeviceExt->StorageDevice = DeviceToMount;
|
||||
DeviceExt->StorageDevice->Vpb->DeviceObject = NewDeviceObject;
|
||||
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||
NewDeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||
NewDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
/* Close (and cleanup) might be called from IoCreateStreamFileObject
|
||||
* but we use this resource from CdfsCleanup, therefore it should be
|
||||
* initialized no later than this. */
|
||||
ExInitializeResourceLite(&DeviceExt->DirResource);
|
||||
/* Close (and cleanup) might be called from IoCreateStreamFileObject
|
||||
* but we use this resource from CdfsCleanup, therefore it should be
|
||||
* initialized no later than this. */
|
||||
ExInitializeResourceLite(&DeviceExt->DirResource);
|
||||
|
||||
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
||||
DeviceExt->StorageDevice);
|
||||
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
||||
DeviceExt->StorageDevice);
|
||||
|
||||
Fcb = CdfsCreateFCB(NULL);
|
||||
if (Fcb == NULL)
|
||||
Fcb = CdfsCreateFCB(NULL);
|
||||
if (Fcb == NULL)
|
||||
{
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ByeBye;
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(CCB),
|
||||
TAG_CCB);
|
||||
if (Ccb == NULL)
|
||||
Ccb = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(CCB),
|
||||
TAG_CCB);
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ByeBye;
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ByeBye;
|
||||
}
|
||||
RtlZeroMemory(Ccb,
|
||||
sizeof(CCB));
|
||||
RtlZeroMemory(Ccb,
|
||||
sizeof(CCB));
|
||||
|
||||
DeviceExt->StreamFileObject->FsContext = Fcb;
|
||||
DeviceExt->StreamFileObject->FsContext2 = Ccb;
|
||||
DeviceExt->StreamFileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
|
||||
DeviceExt->StreamFileObject->PrivateCacheMap = NULL;
|
||||
DeviceExt->StreamFileObject->Vpb = DeviceExt->Vpb;
|
||||
Ccb->PtrFileObject = DeviceExt->StreamFileObject;
|
||||
Fcb->FileObject = DeviceExt->StreamFileObject;
|
||||
Fcb->DevExt = (PDEVICE_EXTENSION)DeviceExt->StorageDevice;
|
||||
DeviceExt->StreamFileObject->FsContext = Fcb;
|
||||
DeviceExt->StreamFileObject->FsContext2 = Ccb;
|
||||
DeviceExt->StreamFileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
|
||||
DeviceExt->StreamFileObject->PrivateCacheMap = NULL;
|
||||
DeviceExt->StreamFileObject->Vpb = DeviceExt->Vpb;
|
||||
Ccb->PtrFileObject = DeviceExt->StreamFileObject;
|
||||
Fcb->FileObject = DeviceExt->StreamFileObject;
|
||||
Fcb->DevExt = (PDEVICE_EXTENSION)DeviceExt->StorageDevice;
|
||||
|
||||
Fcb->Flags = FCB_IS_VOLUME_STREAM;
|
||||
Fcb->Flags = FCB_IS_VOLUME_STREAM;
|
||||
|
||||
Fcb->RFCB.FileSize.QuadPart = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
|
||||
Fcb->RFCB.ValidDataLength = Fcb->RFCB.AllocationSize = Fcb->RFCB.FileSize;
|
||||
Fcb->RFCB.FileSize.QuadPart = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
|
||||
Fcb->RFCB.ValidDataLength = Fcb->RFCB.AllocationSize = Fcb->RFCB.FileSize;
|
||||
|
||||
Fcb->Entry.ExtentLocationL = 0;
|
||||
Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
|
||||
Fcb->Entry.ExtentLocationL = 0;
|
||||
Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
|
||||
|
||||
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
TRUE,
|
||||
&(CdfsGlobalData->CacheMgrCallbacks),
|
||||
Fcb);
|
||||
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
TRUE,
|
||||
&(CdfsGlobalData->CacheMgrCallbacks),
|
||||
Fcb);
|
||||
|
||||
ExInitializeResourceLite(&DeviceExt->VcbResource);
|
||||
ExInitializeResourceLite(&DeviceExt->VcbResource);
|
||||
|
||||
KeInitializeSpinLock(&DeviceExt->FcbListLock);
|
||||
InitializeListHead(&DeviceExt->FcbListHead);
|
||||
KeInitializeSpinLock(&DeviceExt->FcbListLock);
|
||||
InitializeListHead(&DeviceExt->FcbListHead);
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Cleanup */
|
||||
if (DeviceExt && DeviceExt->StreamFileObject)
|
||||
ObDereferenceObject(DeviceExt->StreamFileObject);
|
||||
if (Fcb)
|
||||
ExFreePool(Fcb);
|
||||
if (Ccb)
|
||||
ExFreePool(Ccb);
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
/* Cleanup */
|
||||
if (DeviceExt && DeviceExt->StreamFileObject)
|
||||
ObDereferenceObject(DeviceExt->StreamFileObject);
|
||||
if (Fcb)
|
||||
ExFreePool(Fcb);
|
||||
if (Ccb)
|
||||
ExFreePool(Ccb);
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
}
|
||||
|
||||
DPRINT("CdfsMountVolume() done (Status: %lx)\n", Status);
|
||||
DPRINT("CdfsMountVolume() done (Status: %lx)\n", Status);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status;
|
||||
CDINFO CdInfo;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PDEVICE_OBJECT DeviceToVerify;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status;
|
||||
CDINFO CdInfo;
|
||||
|
||||
PLIST_ENTRY Entry;
|
||||
PFCB Fcb;
|
||||
PLIST_ENTRY Entry;
|
||||
PFCB Fcb;
|
||||
|
||||
DPRINT1 ("CdfsVerifyVolume() called\n");
|
||||
DPRINT1 ("CdfsVerifyVolume() called\n");
|
||||
|
||||
#if 0
|
||||
if (DeviceObject != CdfsGlobalData->DeviceObject)
|
||||
if (DeviceObject != CdfsGlobalData->DeviceObject)
|
||||
{
|
||||
DPRINT1("DeviceObject != CdfsGlobalData->DeviceObject\n");
|
||||
return(STATUS_INVALID_DEVICE_REQUEST);
|
||||
DPRINT1("DeviceObject != CdfsGlobalData->DeviceObject\n");
|
||||
return(STATUS_INVALID_DEVICE_REQUEST);
|
||||
}
|
||||
#endif
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
DeviceToVerify = Stack->Parameters.VerifyVolume.DeviceObject;
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
DeviceToVerify = Stack->Parameters.VerifyVolume.DeviceObject;
|
||||
|
||||
ExAcquireResourceExclusiveLite (&DeviceExt->VcbResource,
|
||||
TRUE);
|
||||
ExAcquireResourceExclusiveLite (&DeviceExt->VcbResource,
|
||||
TRUE);
|
||||
|
||||
if (!(DeviceToVerify->Flags & DO_VERIFY_VOLUME))
|
||||
if (!(DeviceToVerify->Flags & DO_VERIFY_VOLUME))
|
||||
{
|
||||
DPRINT1 ("Volume has been verified!\n");
|
||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
||||
return STATUS_SUCCESS;
|
||||
DPRINT1 ("Volume has been verified!\n");
|
||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
DPRINT1 ("Device object %p Device to verify %p\n", DeviceObject, DeviceToVerify);
|
||||
DPRINT1 ("Device object %p Device to verify %p\n", DeviceObject, DeviceToVerify);
|
||||
|
||||
Status = CdfsGetVolumeData (DeviceToVerify,
|
||||
&CdInfo);
|
||||
if (NT_SUCCESS(Status) &&
|
||||
CdInfo.SerialNumber == DeviceToVerify->Vpb->SerialNumber &&
|
||||
CdInfo.VolumeLabelLength == DeviceToVerify->Vpb->VolumeLabelLength &&
|
||||
!wcsncmp (CdInfo.VolumeLabel, DeviceToVerify->Vpb->VolumeLabel, CdInfo.VolumeLabelLength))
|
||||
Status = CdfsGetVolumeData (DeviceToVerify,
|
||||
&CdInfo);
|
||||
if (NT_SUCCESS(Status) &&
|
||||
CdInfo.SerialNumber == DeviceToVerify->Vpb->SerialNumber &&
|
||||
CdInfo.VolumeLabelLength == DeviceToVerify->Vpb->VolumeLabelLength &&
|
||||
!wcsncmp (CdInfo.VolumeLabel, DeviceToVerify->Vpb->VolumeLabel, CdInfo.VolumeLabelLength))
|
||||
{
|
||||
DPRINT1 ("Same volume!\n");
|
||||
DPRINT1 ("Same volume!\n");
|
||||
|
||||
/* FIXME: Flush and purge metadata */
|
||||
/* FIXME: Flush and purge metadata */
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
DPRINT1 ("Different volume!\n");
|
||||
DPRINT1 ("Different volume!\n");
|
||||
|
||||
/* FIXME: force volume dismount */
|
||||
Entry = DeviceExt->FcbListHead.Flink;
|
||||
while (Entry != &DeviceExt->FcbListHead)
|
||||
{
|
||||
Fcb = (PFCB)CONTAINING_RECORD(Entry, FCB, FcbListEntry);
|
||||
DPRINT1("OpenFile %S RefCount %ld\n", Fcb->PathName, Fcb->RefCount);
|
||||
/* FIXME: force volume dismount */
|
||||
Entry = DeviceExt->FcbListHead.Flink;
|
||||
while (Entry != &DeviceExt->FcbListHead)
|
||||
{
|
||||
Fcb = (PFCB)CONTAINING_RECORD(Entry, FCB, FcbListEntry);
|
||||
DPRINT1("OpenFile %S RefCount %ld\n", Fcb->PathName, Fcb->RefCount);
|
||||
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
|
||||
Status = STATUS_WRONG_VOLUME;
|
||||
Status = STATUS_WRONG_VOLUME;
|
||||
}
|
||||
|
||||
DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME;
|
||||
DeviceToVerify->Flags &= ~DO_VERIFY_VOLUME;
|
||||
|
||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
||||
ExReleaseResourceLite (&DeviceExt->VcbResource);
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsSetCompression(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
USHORT CompressionState;
|
||||
|
@ -536,54 +536,54 @@ CdfsSetCompression(
|
|||
|
||||
NTSTATUS NTAPI
|
||||
CdfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsFileSystemControl() called\n");
|
||||
DPRINT("CdfsFileSystemControl() called\n");
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
switch (Stack->MinorFunction)
|
||||
switch (Stack->MinorFunction)
|
||||
{
|
||||
case IRP_MN_USER_FS_REQUEST:
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case FSCTL_SET_COMPRESSION:
|
||||
DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / FSCTL_SET_COMPRESSION\n");
|
||||
Status = CdfsSetCompression(DeviceObject, Irp);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("CDFS: IRP_MN_USER_FS_REQUEST / Unknown IoControlCode 0x%x\n",
|
||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
case IRP_MN_USER_FS_REQUEST:
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case FSCTL_SET_COMPRESSION:
|
||||
DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / FSCTL_SET_COMPRESSION\n");
|
||||
Status = CdfsSetCompression(DeviceObject, Irp);
|
||||
break;
|
||||
|
||||
case IRP_MN_MOUNT_VOLUME:
|
||||
DPRINT("CDFS: IRP_MN_MOUNT_VOLUME\n");
|
||||
Status = CdfsMountVolume(DeviceObject, Irp);
|
||||
break;
|
||||
default:
|
||||
DPRINT1("CDFS: IRP_MN_USER_FS_REQUEST / Unknown IoControlCode 0x%x\n",
|
||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
break;
|
||||
|
||||
case IRP_MN_VERIFY_VOLUME:
|
||||
DPRINT1("CDFS: IRP_MN_VERIFY_VOLUME\n");
|
||||
Status = CdfsVerifyVolume(DeviceObject, Irp);
|
||||
break;
|
||||
case IRP_MN_MOUNT_VOLUME:
|
||||
DPRINT("CDFS: IRP_MN_MOUNT_VOLUME\n");
|
||||
Status = CdfsMountVolume(DeviceObject, Irp);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("CDFS FSC: MinorFunction %d\n", Stack->MinorFunction);
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
break;
|
||||
case IRP_MN_VERIFY_VOLUME:
|
||||
DPRINT1("CDFS: IRP_MN_VERIFY_VOLUME\n");
|
||||
Status = CdfsVerifyVolume(DeviceObject, Irp);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("CDFS FSC: MinorFunction %d\n", Stack->MinorFunction);
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2004 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/misc.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/cdfs/misc.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,62 +37,62 @@
|
|||
|
||||
VOID
|
||||
CdfsSwapString(PWCHAR Out,
|
||||
PUCHAR In,
|
||||
ULONG Count)
|
||||
PUCHAR In,
|
||||
ULONG Count)
|
||||
{
|
||||
PUCHAR t = (PUCHAR)Out;
|
||||
ULONG i;
|
||||
PUCHAR t = (PUCHAR)Out;
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < Count; i += 2)
|
||||
for (i = 0; i < Count; i += 2)
|
||||
{
|
||||
t[i] = In[i+1];
|
||||
t[i+1] = In[i];
|
||||
if (t[i+1] == 0 && t[i] == ';')
|
||||
break;
|
||||
t[i] = In[i+1];
|
||||
t[i+1] = In[i];
|
||||
if (t[i+1] == 0 && t[i] == ';')
|
||||
break;
|
||||
}
|
||||
if ((i>2)&&(t[i-2] == '.'))
|
||||
{
|
||||
t[i-2] = 0;
|
||||
t[i-1] = 0;
|
||||
}
|
||||
t[i] = 0;
|
||||
t[i+1] = 0;
|
||||
if ((i>2)&&(t[i-2] == '.'))
|
||||
{
|
||||
t[i-2] = 0;
|
||||
t[i-1] = 0;
|
||||
}
|
||||
t[i] = 0;
|
||||
t[i+1] = 0;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
CdfsDateTimeToSystemTime(PFCB Fcb,
|
||||
PLARGE_INTEGER SystemTime)
|
||||
PLARGE_INTEGER SystemTime)
|
||||
{
|
||||
TIME_FIELDS TimeFields;
|
||||
LARGE_INTEGER LocalTime;
|
||||
TIME_FIELDS TimeFields;
|
||||
LARGE_INTEGER LocalTime;
|
||||
|
||||
TimeFields.Milliseconds = 0;
|
||||
TimeFields.Second = Fcb->Entry.Second;
|
||||
TimeFields.Minute = Fcb->Entry.Minute;
|
||||
TimeFields.Hour = Fcb->Entry.Hour;
|
||||
TimeFields.Milliseconds = 0;
|
||||
TimeFields.Second = Fcb->Entry.Second;
|
||||
TimeFields.Minute = Fcb->Entry.Minute;
|
||||
TimeFields.Hour = Fcb->Entry.Hour;
|
||||
|
||||
TimeFields.Day = Fcb->Entry.Day;
|
||||
TimeFields.Month = Fcb->Entry.Month;
|
||||
TimeFields.Year = Fcb->Entry.Year + 1900;
|
||||
TimeFields.Day = Fcb->Entry.Day;
|
||||
TimeFields.Month = Fcb->Entry.Month;
|
||||
TimeFields.Year = Fcb->Entry.Year + 1900;
|
||||
|
||||
RtlTimeFieldsToTime(&TimeFields,
|
||||
&LocalTime);
|
||||
ExLocalTimeToSystemTime(&LocalTime, SystemTime);
|
||||
RtlTimeFieldsToTime(&TimeFields,
|
||||
&LocalTime);
|
||||
ExLocalTimeToSystemTime(&LocalTime, SystemTime);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
CdfsFileFlagsToAttributes(PFCB Fcb,
|
||||
PULONG FileAttributes)
|
||||
PULONG FileAttributes)
|
||||
{
|
||||
/* FIXME: Fix attributes */
|
||||
/* FIXME: Fix attributes */
|
||||
|
||||
*FileAttributes = // FILE_ATTRIBUTE_READONLY |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_HIDDEN) ? FILE_ATTRIBUTE_HIDDEN : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY) ? FILE_ATTRIBUTE_DIRECTORY : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_SYSTEM) ? FILE_ATTRIBUTE_SYSTEM : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_READONLY) ? FILE_ATTRIBUTE_READONLY : 0);
|
||||
*FileAttributes = // FILE_ATTRIBUTE_READONLY |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_HIDDEN) ? FILE_ATTRIBUTE_HIDDEN : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY) ? FILE_ATTRIBUTE_DIRECTORY : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_SYSTEM) ? FILE_ATTRIBUTE_SYSTEM : 0) |
|
||||
((Fcb->Entry.FileFlags & FILE_FLAG_READONLY) ? FILE_ATTRIBUTE_READONLY : 0);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/rw.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/fs/cdfs/rw.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -43,201 +43,201 @@
|
|||
|
||||
static NTSTATUS
|
||||
CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PUCHAR Buffer,
|
||||
ULONG Length,
|
||||
ULONG ReadOffset,
|
||||
ULONG IrpFlags,
|
||||
PULONG LengthRead)
|
||||
/*
|
||||
* FUNCTION: Reads data from a file
|
||||
*/
|
||||
PFILE_OBJECT FileObject,
|
||||
PUCHAR Buffer,
|
||||
ULONG Length,
|
||||
ULONG ReadOffset,
|
||||
ULONG IrpFlags,
|
||||
PULONG LengthRead)
|
||||
/*
|
||||
* FUNCTION: Reads data from a file
|
||||
*/
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PCCB Ccb;
|
||||
PFCB Fcb;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PCCB Ccb;
|
||||
PFCB Fcb;
|
||||
|
||||
DPRINT("CdfsReadFile(ReadOffset %lu Length %lu)\n", ReadOffset, Length);
|
||||
DPRINT("CdfsReadFile(ReadOffset %lu Length %lu)\n", ReadOffset, Length);
|
||||
|
||||
*LengthRead = 0;
|
||||
*LengthRead = 0;
|
||||
|
||||
if (Length == 0)
|
||||
return(STATUS_SUCCESS);
|
||||
if (Length == 0)
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
Ccb = (PCCB)FileObject->FsContext2;
|
||||
Fcb = (PFCB)FileObject->FsContext;
|
||||
Ccb = (PCCB)FileObject->FsContext2;
|
||||
Fcb = (PFCB)FileObject->FsContext;
|
||||
|
||||
if (ReadOffset >= Fcb->Entry.DataLengthL)
|
||||
return(STATUS_END_OF_FILE);
|
||||
if (ReadOffset >= Fcb->Entry.DataLengthL)
|
||||
return(STATUS_END_OF_FILE);
|
||||
|
||||
DPRINT("Reading %d bytes at %d\n", Length, ReadOffset);
|
||||
DPRINT("Reading %d bytes at %d\n", Length, ReadOffset);
|
||||
|
||||
if (!(IrpFlags & (IRP_NOCACHE|IRP_PAGING_IO)))
|
||||
if (!(IrpFlags & (IRP_NOCACHE|IRP_PAGING_IO)))
|
||||
{
|
||||
LARGE_INTEGER FileOffset;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CC_FILE_SIZES FileSizes;
|
||||
LARGE_INTEGER FileOffset;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CC_FILE_SIZES FileSizes;
|
||||
|
||||
if (ReadOffset + Length > Fcb->Entry.DataLengthL)
|
||||
Length = Fcb->Entry.DataLengthL - ReadOffset;
|
||||
if (ReadOffset + Length > Fcb->Entry.DataLengthL)
|
||||
Length = Fcb->Entry.DataLengthL - ReadOffset;
|
||||
|
||||
if (FileObject->PrivateCacheMap == NULL)
|
||||
{
|
||||
FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
FileSizes.FileSize = Fcb->RFCB.FileSize;
|
||||
FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
|
||||
if (FileObject->PrivateCacheMap == NULL)
|
||||
{
|
||||
FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
|
||||
FileSizes.FileSize = Fcb->RFCB.FileSize;
|
||||
FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
|
||||
|
||||
DPRINT("Attach FCB to File: Size %08x%08x\n",
|
||||
Fcb->RFCB.ValidDataLength.HighPart,
|
||||
Fcb->RFCB.ValidDataLength.LowPart);
|
||||
DPRINT("Attach FCB to File: Size %08x%08x\n",
|
||||
Fcb->RFCB.ValidDataLength.HighPart,
|
||||
Fcb->RFCB.ValidDataLength.LowPart);
|
||||
|
||||
CcInitializeCacheMap(FileObject,
|
||||
&FileSizes,
|
||||
FALSE,
|
||||
&(CdfsGlobalData->CacheMgrCallbacks),
|
||||
Fcb);
|
||||
}
|
||||
CcInitializeCacheMap(FileObject,
|
||||
&FileSizes,
|
||||
FALSE,
|
||||
&(CdfsGlobalData->CacheMgrCallbacks),
|
||||
Fcb);
|
||||
}
|
||||
|
||||
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
||||
CcCopyRead(FileObject,
|
||||
&FileOffset,
|
||||
Length,
|
||||
TRUE,
|
||||
Buffer,
|
||||
&IoStatus);
|
||||
*LengthRead = IoStatus.Information;
|
||||
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
||||
CcCopyRead(FileObject,
|
||||
&FileOffset,
|
||||
Length,
|
||||
TRUE,
|
||||
Buffer,
|
||||
&IoStatus);
|
||||
*LengthRead = IoStatus.Information;
|
||||
|
||||
return(IoStatus.Status);
|
||||
return(IoStatus.Status);
|
||||
}
|
||||
|
||||
if ((ReadOffset % BLOCKSIZE) != 0 || (Length % BLOCKSIZE) != 0)
|
||||
if ((ReadOffset % BLOCKSIZE) != 0 || (Length % BLOCKSIZE) != 0)
|
||||
{
|
||||
/* Then we need to do a partial or misaligned read ... */
|
||||
PVOID PageBuf = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
PCHAR ReadInPage = (PCHAR)PageBuf + (ReadOffset & (BLOCKSIZE - 1));
|
||||
PCHAR TargetRead = (PCHAR)Buffer;
|
||||
ULONG ActualReadOffset, EndOfExtent, ReadLen;
|
||||
/* Then we need to do a partial or misaligned read ... */
|
||||
PVOID PageBuf = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
PCHAR ReadInPage = (PCHAR)PageBuf + (ReadOffset & (BLOCKSIZE - 1));
|
||||
PCHAR TargetRead = (PCHAR)Buffer;
|
||||
ULONG ActualReadOffset, EndOfExtent, ReadLen;
|
||||
|
||||
if (!PageBuf)
|
||||
if (!PageBuf)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ActualReadOffset = ReadOffset & ~(BLOCKSIZE - 1);
|
||||
EndOfExtent = ReadOffset + Length;
|
||||
ActualReadOffset = ReadOffset & ~(BLOCKSIZE - 1);
|
||||
EndOfExtent = ReadOffset + Length;
|
||||
|
||||
while (ActualReadOffset < EndOfExtent)
|
||||
while (ActualReadOffset < EndOfExtent)
|
||||
{
|
||||
Status = CdfsReadSectors
|
||||
(DeviceExt->StorageDevice,
|
||||
Fcb->Entry.ExtentLocationL + (ActualReadOffset / BLOCKSIZE),
|
||||
1,
|
||||
PageBuf,
|
||||
FALSE);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
break;
|
||||
|
||||
ReadLen = BLOCKSIZE - (ActualReadOffset & (BLOCKSIZE - 1));
|
||||
if (ReadLen > EndOfExtent - ActualReadOffset)
|
||||
{
|
||||
ReadLen = EndOfExtent - ActualReadOffset;
|
||||
}
|
||||
Status = CdfsReadSectors
|
||||
(DeviceExt->StorageDevice,
|
||||
Fcb->Entry.ExtentLocationL + (ActualReadOffset / BLOCKSIZE),
|
||||
1,
|
||||
PageBuf,
|
||||
FALSE);
|
||||
|
||||
RtlCopyMemory(TargetRead, ReadInPage, ReadLen);
|
||||
if (!NT_SUCCESS(Status))
|
||||
break;
|
||||
|
||||
ActualReadOffset += ReadLen;
|
||||
TargetRead += ReadLen;
|
||||
}
|
||||
ReadLen = BLOCKSIZE - (ActualReadOffset & (BLOCKSIZE - 1));
|
||||
if (ReadLen > EndOfExtent - ActualReadOffset)
|
||||
{
|
||||
ReadLen = EndOfExtent - ActualReadOffset;
|
||||
}
|
||||
|
||||
ExFreePool(PageBuf);
|
||||
RtlCopyMemory(TargetRead, ReadInPage, ReadLen);
|
||||
|
||||
ActualReadOffset += ReadLen;
|
||||
TargetRead += ReadLen;
|
||||
}
|
||||
|
||||
ExFreePool(PageBuf);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (ReadOffset + Length > ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE))
|
||||
Length = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE) - ReadOffset;
|
||||
if (ReadOffset + Length > ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE))
|
||||
Length = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE) - ReadOffset;
|
||||
|
||||
Status = CdfsReadSectors(DeviceExt->StorageDevice,
|
||||
Fcb->Entry.ExtentLocationL + (ReadOffset / BLOCKSIZE),
|
||||
Length / BLOCKSIZE,
|
||||
Buffer,
|
||||
FALSE);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = CdfsReadSectors(DeviceExt->StorageDevice,
|
||||
Fcb->Entry.ExtentLocationL + (ReadOffset / BLOCKSIZE),
|
||||
Length / BLOCKSIZE,
|
||||
Buffer,
|
||||
FALSE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*LengthRead = Length;
|
||||
if (Length + ReadOffset > Fcb->Entry.DataLengthL)
|
||||
{
|
||||
memset(Buffer + Fcb->Entry.DataLengthL - ReadOffset,
|
||||
0,
|
||||
Length + ReadOffset - Fcb->Entry.DataLengthL);
|
||||
}
|
||||
}
|
||||
*LengthRead = Length;
|
||||
if (Length + ReadOffset > Fcb->Entry.DataLengthL)
|
||||
{
|
||||
memset(Buffer + Fcb->Entry.DataLengthL - ReadOffset,
|
||||
0,
|
||||
Length + ReadOffset - Fcb->Entry.DataLengthL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PVOID Buffer = NULL;
|
||||
ULONG ReadLength;
|
||||
LARGE_INTEGER ReadOffset;
|
||||
ULONG ReturnedReadLength = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PVOID Buffer = NULL;
|
||||
ULONG ReadLength;
|
||||
LARGE_INTEGER ReadOffset;
|
||||
ULONG ReturnedReadLength = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("CdfsRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
DPRINT("CdfsRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
|
||||
ReadLength = Stack->Parameters.Read.Length;
|
||||
ReadOffset = Stack->Parameters.Read.ByteOffset;
|
||||
if (ReadLength) Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
ReadLength = Stack->Parameters.Read.Length;
|
||||
ReadOffset = Stack->Parameters.Read.ByteOffset;
|
||||
if (ReadLength) Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
|
||||
Status = CdfsReadFile(DeviceExt,
|
||||
FileObject,
|
||||
Buffer,
|
||||
ReadLength,
|
||||
ReadOffset.u.LowPart,
|
||||
Irp->Flags,
|
||||
&ReturnedReadLength);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = CdfsReadFile(DeviceExt,
|
||||
FileObject,
|
||||
Buffer,
|
||||
ReadLength,
|
||||
ReadOffset.u.LowPart,
|
||||
Irp->Flags,
|
||||
&ReturnedReadLength);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
ReadOffset.QuadPart + ReturnedReadLength;
|
||||
}
|
||||
Irp->IoStatus.Information = ReturnedReadLength;
|
||||
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
ReadOffset.QuadPart + ReturnedReadLength;
|
||||
}
|
||||
Irp->IoStatus.Information = ReturnedReadLength;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
DPRINT("CdfsWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
DPRINT("CdfsWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_NOT_SUPPORTED);
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/vfat/volume.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/vfat/volume.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
|
@ -37,203 +37,203 @@
|
|||
|
||||
static NTSTATUS
|
||||
CdfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetFsVolumeInformation() called\n");
|
||||
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("CdfsGetFsVolumeInformation() called\n");
|
||||
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
DPRINT("Vpb %p\n", DeviceObject->Vpb);
|
||||
DPRINT("Vpb %p\n", DeviceObject->Vpb);
|
||||
|
||||
DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength));
|
||||
DPRINT("LabelLength %hu\n", DeviceObject->Vpb->VolumeLabelLength);
|
||||
DPRINT("Label %*.S\n", DeviceObject->Vpb->VolumeLabelLength / sizeof(WCHAR), DeviceObject->Vpb->VolumeLabel);
|
||||
DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength));
|
||||
DPRINT("LabelLength %hu\n", DeviceObject->Vpb->VolumeLabelLength);
|
||||
DPRINT("Label %*.S\n", DeviceObject->Vpb->VolumeLabelLength / sizeof(WCHAR), DeviceObject->Vpb->VolumeLabel);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_VOLUME_INFORMATION))
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
if (*BufferLength < sizeof(FILE_FS_VOLUME_INFORMATION))
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
|
||||
if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
/* valid entries */
|
||||
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
|
||||
FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
|
||||
memcpy(FsVolumeInfo->VolumeLabel,
|
||||
DeviceObject->Vpb->VolumeLabel,
|
||||
DeviceObject->Vpb->VolumeLabelLength);
|
||||
/* valid entries */
|
||||
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
|
||||
FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
|
||||
memcpy(FsVolumeInfo->VolumeLabel,
|
||||
DeviceObject->Vpb->VolumeLabel,
|
||||
DeviceObject->Vpb->VolumeLabelLength);
|
||||
|
||||
/* dummy entries */
|
||||
FsVolumeInfo->VolumeCreationTime.QuadPart = 0;
|
||||
FsVolumeInfo->SupportsObjects = FALSE;
|
||||
/* dummy entries */
|
||||
FsVolumeInfo->VolumeCreationTime.QuadPart = 0;
|
||||
FsVolumeInfo->SupportsObjects = FALSE;
|
||||
|
||||
DPRINT("Finished FsdGetFsVolumeInformation()\n");
|
||||
DPRINT("Finished FsdGetFsVolumeInformation()\n");
|
||||
|
||||
*BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength);
|
||||
*BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength);
|
||||
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetFsAttributeInformation()\n");
|
||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("Required length %lu\n", (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8));
|
||||
DPRINT("CdfsGetFsAttributeInformation()\n");
|
||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("Required length %lu\n", (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8));
|
||||
|
||||
if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION))
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION))
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
|
||||
if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
FsAttributeInfo->FileSystemAttributes =
|
||||
FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK;
|
||||
FsAttributeInfo->MaximumComponentNameLength = 255;
|
||||
FsAttributeInfo->FileSystemNameLength = 8;
|
||||
FsAttributeInfo->FileSystemAttributes =
|
||||
FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK;
|
||||
FsAttributeInfo->MaximumComponentNameLength = 255;
|
||||
FsAttributeInfo->FileSystemNameLength = 8;
|
||||
|
||||
memcpy(FsAttributeInfo->FileSystemName, L"CDFS", 8);
|
||||
memcpy(FsAttributeInfo->FileSystemName, L"CDFS", 8);
|
||||
|
||||
DPRINT("Finished FsdGetFsAttributeInformation()\n");
|
||||
DPRINT("Finished FsdGetFsAttributeInformation()\n");
|
||||
|
||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
||||
PULONG BufferLength)
|
||||
PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("CdfsGetFsSizeInformation()\n");
|
||||
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
|
||||
DPRINT("CdfsGetFsSizeInformation()\n");
|
||||
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
|
||||
FsSizeInfo->AvailableAllocationUnits.QuadPart = 0;
|
||||
FsSizeInfo->TotalAllocationUnits.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize;
|
||||
FsSizeInfo->SectorsPerAllocationUnit = 1;
|
||||
FsSizeInfo->BytesPerSector = BLOCKSIZE;
|
||||
FsSizeInfo->AvailableAllocationUnits.QuadPart = 0;
|
||||
FsSizeInfo->TotalAllocationUnits.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize;
|
||||
FsSizeInfo->SectorsPerAllocationUnit = 1;
|
||||
FsSizeInfo->BytesPerSector = BLOCKSIZE;
|
||||
|
||||
DPRINT("Finished FsdGetFsSizeInformation()\n");
|
||||
if (NT_SUCCESS(Status))
|
||||
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
|
||||
DPRINT("Finished FsdGetFsSizeInformation()\n");
|
||||
if (NT_SUCCESS(Status))
|
||||
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
CdfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||
PULONG BufferLength)
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("CdfsGetFsDeviceInformation()\n");
|
||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
|
||||
DPRINT("CdfsGetFsDeviceInformation()\n");
|
||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
|
||||
FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM;
|
||||
FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */
|
||||
|
||||
DPRINT("FsdGetFsDeviceInformation() finished.\n");
|
||||
DPRINT("FsdGetFsDeviceInformation() finished.\n");
|
||||
|
||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
FS_INFORMATION_CLASS FsInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
FS_INFORMATION_CLASS FsInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
DPRINT("CdfsQueryVolumeInformation() called\n");
|
||||
DPRINT("CdfsQueryVolumeInformation() called\n");
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
|
||||
BufferLength = Stack->Parameters.QueryVolume.Length;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
|
||||
BufferLength = Stack->Parameters.QueryVolume.Length;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DPRINT("FsInformationClass %d\n", FsInformationClass);
|
||||
DPRINT("SystemBuffer %x\n", SystemBuffer);
|
||||
DPRINT("FsInformationClass %d\n", FsInformationClass);
|
||||
DPRINT("SystemBuffer %x\n", SystemBuffer);
|
||||
|
||||
switch (FsInformationClass)
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileFsVolumeInformation:
|
||||
Status = CdfsGetFsVolumeInformation(DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileFsVolumeInformation:
|
||||
Status = CdfsGetFsVolumeInformation(DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
Status = CdfsGetFsAttributeInformation(DeviceObject->DeviceExtension,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileFsAttributeInformation:
|
||||
Status = CdfsGetFsAttributeInformation(DeviceObject->DeviceExtension,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsSizeInformation:
|
||||
Status = CdfsGetFsSizeInformation(DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileFsSizeInformation:
|
||||
Status = CdfsGetFsSizeInformation(DeviceObject,
|
||||
SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsDeviceInformation:
|
||||
Status = CdfsGetFsDeviceInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
case FileFsDeviceInformation:
|
||||
Status = CdfsGetFsDeviceInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryVolume.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryVolume.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
CdfsSetVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
PIRP Irp)
|
||||
{
|
||||
DPRINT("CdfsSetVolumeInformation() called\n");
|
||||
DPRINT("CdfsSetVolumeInformation() called\n");
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(STATUS_NOT_SUPPORTED);
|
||||
return(STATUS_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue