2002-04-15 20:39:49 +00:00
|
|
|
/*
|
2013-03-16 19:49:08 +00:00
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
2015-06-17 20:27:52 +00:00
|
|
|
* FILE: drivers/filesystems/cdfs/finfo.c
|
2013-03-16 19:49:08 +00:00
|
|
|
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
|
|
|
* PROGRAMMER: Art Yerkes
|
|
|
|
* Eric Kohl
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
*/
|
2002-04-15 20:39:49 +00:00
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2005-07-20 02:52:52 +00:00
|
|
|
#include "cdfs.h"
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2002-05-01 13:15:42 +00:00
|
|
|
#define NDEBUG
|
2002-04-15 20:39:49 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the standard file information
|
|
|
|
*/
|
2002-04-15 20:39:49 +00:00
|
|
|
static NTSTATUS
|
2002-05-01 13:15:42 +00:00
|
|
|
CdfsGetStandardInformation(PFCB Fcb,
|
2009-02-03 14:50:50 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PFILE_STANDARD_INFORMATION StandardInfo,
|
|
|
|
PULONG BufferLength)
|
2002-05-01 13:15:42 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsGetStandardInformation() called\n");
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2013-05-11 09:24:31 +00:00
|
|
|
UNREFERENCED_PARAMETER(DeviceObject);
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (*BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
|
|
|
return STATUS_BUFFER_OVERFLOW;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* PRECONDITION */
|
|
|
|
ASSERT(StandardInfo != NULL);
|
|
|
|
ASSERT(Fcb != NULL);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
RtlZeroMemory(StandardInfo,
|
|
|
|
sizeof(FILE_STANDARD_INFORMATION));
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (CdfsFCBIsDirectory(Fcb))
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
StandardInfo->AllocationSize.QuadPart = 0LL;
|
|
|
|
StandardInfo->EndOfFile.QuadPart = 0LL;
|
|
|
|
StandardInfo->Directory = TRUE;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
else
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
StandardInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
|
|
|
StandardInfo->EndOfFile = Fcb->RFCB.FileSize;
|
|
|
|
StandardInfo->Directory = FALSE;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
StandardInfo->NumberOfLinks = 0;
|
|
|
|
StandardInfo->DeletePending = FALSE;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= sizeof(FILE_STANDARD_INFORMATION);
|
|
|
|
return(STATUS_SUCCESS);
|
2002-05-01 13:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the file position information
|
|
|
|
*/
|
2002-05-01 13:15:42 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetPositionInformation(PFILE_OBJECT FileObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFILE_POSITION_INFORMATION PositionInfo,
|
|
|
|
PULONG BufferLength)
|
2002-05-01 13:15:42 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsGetPositionInformation() called\n");
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (*BufferLength < sizeof(FILE_POSITION_INFORMATION))
|
|
|
|
return STATUS_BUFFER_OVERFLOW;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
PositionInfo->CurrentByteOffset.QuadPart =
|
|
|
|
FileObject->CurrentByteOffset.QuadPart;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("Getting position %I64x\n",
|
|
|
|
PositionInfo->CurrentByteOffset.QuadPart);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= sizeof(FILE_POSITION_INFORMATION);
|
|
|
|
return(STATUS_SUCCESS);
|
2002-05-01 13:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the basic file information
|
|
|
|
*/
|
2002-05-01 13:15:42 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetBasicInformation(PFILE_OBJECT FileObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFCB Fcb,
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PFILE_BASIC_INFORMATION BasicInfo,
|
|
|
|
PULONG BufferLength)
|
2002-05-01 13:15:42 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsGetBasicInformation() called\n");
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2013-05-11 09:24:31 +00:00
|
|
|
UNREFERENCED_PARAMETER(FileObject);
|
|
|
|
UNREFERENCED_PARAMETER(DeviceObject);
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (*BufferLength < sizeof(FILE_BASIC_INFORMATION))
|
|
|
|
return STATUS_BUFFER_OVERFLOW;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
CdfsDateTimeToSystemTime(Fcb,
|
|
|
|
&BasicInfo->CreationTime);
|
|
|
|
CdfsDateTimeToSystemTime(Fcb,
|
|
|
|
&BasicInfo->LastAccessTime);
|
|
|
|
CdfsDateTimeToSystemTime(Fcb,
|
|
|
|
&BasicInfo->LastWriteTime);
|
|
|
|
CdfsDateTimeToSystemTime(Fcb,
|
|
|
|
&BasicInfo->ChangeTime);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
CdfsFileFlagsToAttributes(Fcb,
|
|
|
|
&BasicInfo->FileAttributes);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= sizeof(FILE_BASIC_INFORMATION);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return(STATUS_SUCCESS);
|
2002-05-01 13:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the file name information
|
|
|
|
*/
|
2002-05-01 13:15:42 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetNameInformation(PFILE_OBJECT FileObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFCB Fcb,
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PFILE_NAME_INFORMATION NameInfo,
|
|
|
|
PULONG BufferLength)
|
2002-04-15 20:39:49 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
ULONG NameLength;
|
|
|
|
ULONG BytesToCopy;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsGetNameInformation() called\n");
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
ASSERT(NameInfo != NULL);
|
|
|
|
ASSERT(Fcb != NULL);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2013-05-11 09:24:31 +00:00
|
|
|
UNREFERENCED_PARAMETER(FileObject);
|
|
|
|
UNREFERENCED_PARAMETER(DeviceObject);
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* If buffer can't hold at least the file name length, bail out */
|
2011-07-05 13:55:39 +00:00
|
|
|
if (*BufferLength < (ULONG)FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
|
2009-02-03 14:50:50 +00:00
|
|
|
return STATUS_BUFFER_OVERFLOW;
|
2008-11-17 11:25:36 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Calculate file name length in bytes */
|
2014-04-18 21:40:02 +00:00
|
|
|
NameLength = Fcb->PathName.Length;
|
2009-02-03 14:50:50 +00:00
|
|
|
NameInfo->FileNameLength = NameLength;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Calculate amount of bytes to copy not to overflow the buffer */
|
|
|
|
BytesToCopy = min(NameLength,
|
|
|
|
*BufferLength - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]));
|
2008-11-17 11:25:36 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Fill in the bytes */
|
2014-04-18 21:40:02 +00:00
|
|
|
RtlCopyMemory(NameInfo->FileName, Fcb->PathName.Buffer, BytesToCopy);
|
2008-11-17 11:25:36 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* 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;
|
|
|
|
}
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* We filled up as many bytes, as needed */
|
|
|
|
*BufferLength -= (FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + NameLength);
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return STATUS_SUCCESS;
|
2002-04-15 20:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the internal file information
|
|
|
|
*/
|
2002-05-01 13:15:42 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetInternalInformation(PFCB Fcb,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFILE_INTERNAL_INFORMATION InternalInfo,
|
|
|
|
PULONG BufferLength)
|
2002-05-01 13:15:42 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsGetInternalInformation() called\n");
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
ASSERT(InternalInfo);
|
|
|
|
ASSERT(Fcb);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION))
|
|
|
|
return(STATUS_BUFFER_OVERFLOW);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
InternalInfo->IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= sizeof(FILE_INTERNAL_INFORMATION);
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return(STATUS_SUCCESS);
|
2002-05-01 13:15:42 +00:00
|
|
|
}
|
|
|
|
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the file network open information
|
|
|
|
*/
|
2002-07-20 00:57:36 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetNetworkOpenInformation(PFCB Fcb,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFILE_NETWORK_OPEN_INFORMATION NetworkInfo,
|
|
|
|
PULONG BufferLength)
|
2002-07-20 00:57:36 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
ASSERT(NetworkInfo);
|
|
|
|
ASSERT(Fcb);
|
|
|
|
|
|
|
|
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))
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
NetworkInfo->AllocationSize.QuadPart = 0LL;
|
|
|
|
NetworkInfo->EndOfFile.QuadPart = 0LL;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
else
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
NetworkInfo->AllocationSize = Fcb->RFCB.AllocationSize;
|
|
|
|
NetworkInfo->EndOfFile = Fcb->RFCB.FileSize;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
CdfsFileFlagsToAttributes(Fcb,
|
|
|
|
&NetworkInfo->FileAttributes);
|
2002-07-20 00:57:36 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= sizeof(FILE_NETWORK_OPEN_INFORMATION);
|
2002-07-20 00:57:36 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return(STATUS_SUCCESS);
|
2002-07-20 00:57:36 +00:00
|
|
|
}
|
|
|
|
|
2002-05-01 13:15:42 +00:00
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve all file information
|
|
|
|
*/
|
2002-07-20 11:44:37 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsGetAllInformation(PFILE_OBJECT FileObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFCB Fcb,
|
|
|
|
PFILE_ALL_INFORMATION Info,
|
|
|
|
PULONG BufferLength)
|
2002-07-20 11:44:37 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
ULONG NameLength;
|
|
|
|
|
|
|
|
ASSERT(Info);
|
|
|
|
ASSERT(Fcb);
|
|
|
|
|
2014-04-18 21:40:02 +00:00
|
|
|
NameLength = Fcb->PathName.Length;
|
2009-02-03 14:50:50 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
/* Standard Information */
|
|
|
|
if (CdfsFCBIsDirectory(Fcb))
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
Info->StandardInformation.AllocationSize.QuadPart = 0LL;
|
|
|
|
Info->StandardInformation.EndOfFile.QuadPart = 0LL;
|
|
|
|
Info->StandardInformation.Directory = TRUE;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
else
|
2004-05-23 13:34:32 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
Info->StandardInformation.AllocationSize = Fcb->RFCB.AllocationSize;
|
|
|
|
Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize;
|
|
|
|
Info->StandardInformation.Directory = FALSE;
|
2004-05-23 13:34:32 +00:00
|
|
|
}
|
2009-02-03 14:50:50 +00:00
|
|
|
Info->StandardInformation.NumberOfLinks = 0;
|
|
|
|
Info->StandardInformation.DeletePending = FALSE;
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Internal Information */
|
|
|
|
Info->InternalInformation.IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* EA Information */
|
|
|
|
Info->EaInformation.EaSize = 0;
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Access Information */
|
|
|
|
/* The IO-Manager adds this information */
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Position Information */
|
|
|
|
Info->PositionInformation.CurrentByteOffset.QuadPart = FileObject->CurrentByteOffset.QuadPart;
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Mode Information */
|
|
|
|
/* The IO-Manager adds this information */
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Alignment Information */
|
|
|
|
/* The IO-Manager adds this information */
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Name Information */
|
|
|
|
Info->NameInformation.FileNameLength = NameLength;
|
|
|
|
RtlCopyMemory(Info->NameInformation.FileName,
|
2014-04-18 21:40:02 +00:00
|
|
|
Fcb->PathName.Buffer,
|
2009-02-03 14:50:50 +00:00
|
|
|
NameLength + sizeof(WCHAR));
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
*BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR));
|
2002-07-20 11:44:37 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return STATUS_SUCCESS;
|
2002-07-20 11:44:37 +00:00
|
|
|
}
|
|
|
|
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2002-04-15 20:39:49 +00:00
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Retrieve the specified file information
|
|
|
|
*/
|
2008-11-29 20:14:45 +00:00
|
|
|
NTSTATUS NTAPI
|
2015-06-01 13:13:18 +00:00
|
|
|
CdfsQueryInformation(
|
|
|
|
PCDFS_IRP_CONTEXT IrpContext)
|
2002-04-15 20:39:49 +00:00
|
|
|
{
|
2015-06-01 13:13:18 +00:00
|
|
|
PIRP Irp;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
2009-02-03 14:50:50 +00:00
|
|
|
FILE_INFORMATION_CLASS FileInformationClass;
|
|
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
PFCB Fcb;
|
|
|
|
PVOID SystemBuffer;
|
|
|
|
ULONG BufferLength;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsQueryInformation() called\n");
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2015-06-01 13:13:18 +00:00
|
|
|
Irp = IrpContext->Irp;
|
|
|
|
DeviceObject = IrpContext->DeviceObject;
|
|
|
|
Stack = IrpContext->Stack;
|
2009-02-03 14:50:50 +00:00
|
|
|
FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
|
|
|
|
FileObject = Stack->FileObject;
|
|
|
|
Fcb = FileObject->FsContext;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
|
|
|
BufferLength = Stack->Parameters.QueryFile.Length;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
switch (FileInformationClass)
|
2002-04-15 20:39:49 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
case FileStandardInformation:
|
|
|
|
Status = CdfsGetStandardInformation(Fcb,
|
|
|
|
DeviceObject,
|
|
|
|
SystemBuffer,
|
|
|
|
&BufferLength);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FilePositionInformation:
|
|
|
|
Status = CdfsGetPositionInformation(FileObject,
|
|
|
|
SystemBuffer,
|
|
|
|
&BufferLength);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileBasicInformation:
|
|
|
|
Status = CdfsGetBasicInformation(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 FileNetworkOpenInformation:
|
|
|
|
Status = CdfsGetNetworkOpenInformation(Fcb,
|
|
|
|
SystemBuffer,
|
|
|
|
&BufferLength);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileAllInformation:
|
|
|
|
Status = CdfsGetAllInformation(FileObject,
|
|
|
|
Fcb,
|
|
|
|
SystemBuffer,
|
|
|
|
&BufferLength);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileAlternateNameInformation:
|
|
|
|
Status = STATUS_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-05-11 09:24:31 +00:00
|
|
|
DPRINT("Unimplemented information class %x\n", FileInformationClass);
|
2009-02-03 14:50:50 +00:00
|
|
|
Status = STATUS_INVALID_PARAMETER;
|
|
|
|
break;
|
2002-04-15 20:39:49 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)
|
|
|
|
Irp->IoStatus.Information =
|
|
|
|
Stack->Parameters.QueryFile.Length - BufferLength;
|
|
|
|
else
|
|
|
|
Irp->IoStatus.Information = 0;
|
2002-04-15 20:39:49 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return(Status);
|
2002-04-15 20:39:49 +00:00
|
|
|
}
|
|
|
|
|
2004-03-08 08:51:26 +00:00
|
|
|
|
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Set the file position information
|
|
|
|
*/
|
2004-03-08 08:51:26 +00:00
|
|
|
static NTSTATUS
|
|
|
|
CdfsSetPositionInformation(PFILE_OBJECT FileObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFILE_POSITION_INFORMATION PositionInfo)
|
2004-03-08 08:51:26 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT ("CdfsSetPositionInformation()\n");
|
2004-03-08 08:51:26 +00:00
|
|
|
|
2013-05-11 09:24:31 +00:00
|
|
|
DPRINT ("PositionInfo %p\n", PositionInfo);
|
|
|
|
DPRINT ("Setting position %I64d\n", PositionInfo->CurrentByteOffset.QuadPart);
|
2004-03-08 08:51:26 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
FileObject->CurrentByteOffset.QuadPart =
|
|
|
|
PositionInfo->CurrentByteOffset.QuadPart;
|
2004-03-08 08:51:26 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return STATUS_SUCCESS;
|
2004-03-08 08:51:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-02-03 14:50:50 +00:00
|
|
|
* FUNCTION: Set the specified file information
|
|
|
|
*/
|
2008-11-29 20:14:45 +00:00
|
|
|
NTSTATUS NTAPI
|
2015-06-01 13:13:18 +00:00
|
|
|
CdfsSetInformation(
|
|
|
|
PCDFS_IRP_CONTEXT IrpContext)
|
2002-09-15 22:23:23 +00:00
|
|
|
{
|
2015-06-01 13:13:18 +00:00
|
|
|
PIRP Irp;
|
2009-02-03 14:50:50 +00:00
|
|
|
FILE_INFORMATION_CLASS FileInformationClass;
|
|
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
PVOID SystemBuffer;
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsSetInformation() called\n");
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2015-06-01 13:13:18 +00:00
|
|
|
Irp = IrpContext->Irp;
|
|
|
|
Stack = IrpContext->Stack;
|
2009-02-03 14:50:50 +00:00
|
|
|
FileInformationClass = Stack->Parameters.SetFile.FileInformationClass;
|
|
|
|
FileObject = Stack->FileObject;
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
switch (FileInformationClass)
|
2002-09-15 22:23:23 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
case FilePositionInformation:
|
|
|
|
Status = CdfsSetPositionInformation(FileObject,
|
|
|
|
SystemBuffer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileBasicInformation:
|
|
|
|
case FileRenameInformation:
|
|
|
|
Status = STATUS_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Status = STATUS_NOT_SUPPORTED;
|
|
|
|
break;
|
2002-09-15 22:23:23 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
Irp->IoStatus.Information = 0;
|
2002-09-15 22:23:23 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return Status;
|
2002-09-15 22:23:23 +00:00
|
|
|
}
|
|
|
|
|
2002-10-03 18:28:22 +00:00
|
|
|
/* EOF */
|