mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 19:37:10 +00:00
Return unique IndexNumber.
Minor cleanup. svn path=/trunk/; revision=8586
This commit is contained in:
parent
17ad90f8d0
commit
11cc5733d3
5 changed files with 113 additions and 68 deletions
|
@ -41,7 +41,11 @@ struct _DIR_RECORD
|
|||
|
||||
typedef struct _DIR_RECORD DIR_RECORD, *PDIR_RECORD;
|
||||
|
||||
|
||||
/* DIR_RECORD.FileFlags */
|
||||
#define FILE_FLAG_HIDDEN 0x01
|
||||
#define FILE_FLAG_DIRECTORY 0x02
|
||||
#define FILE_FLAG_SYSTEM 0x04
|
||||
#define FILE_FLAG_READONLY 0x10
|
||||
|
||||
|
||||
/* Volume Descriptor header*/
|
||||
|
@ -182,12 +186,13 @@ typedef struct _FCB
|
|||
|
||||
ULONG DirIndex;
|
||||
|
||||
LARGE_INTEGER IndexNumber; /* HighPart: Parent directory start sector */
|
||||
/* LowPart: Directory record offset in the parent directory file */
|
||||
|
||||
LONG RefCount;
|
||||
ULONG Flags;
|
||||
|
||||
DIR_RECORD Entry;
|
||||
|
||||
|
||||
} FCB, *PFCB;
|
||||
|
||||
|
||||
|
@ -312,15 +317,26 @@ CdfsMakeRootFCB(PDEVICE_EXTENSION Vcb);
|
|||
PFCB
|
||||
CdfsOpenRootFCB(PDEVICE_EXTENSION Vcb);
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
||||
PFCB DirectoryFCB,
|
||||
PWSTR LongName,
|
||||
PWSTR ShortName,
|
||||
PDIR_RECORD Record,
|
||||
ULONG DirectorySector,
|
||||
ULONG DirectoryOffset,
|
||||
PFCB * fileFCB);
|
||||
|
||||
NTSTATUS
|
||||
CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
PFCB Fcb,
|
||||
PFILE_OBJECT FileObject);
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFCB DirectoryFcb,
|
||||
PWSTR FileToFind,
|
||||
PFCB *FoundFCB);
|
||||
|
||||
NTSTATUS
|
||||
CdfsGetFCBForFile(PDEVICE_EXTENSION Vcb,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
* 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: fcb.c,v 1.17 2004/01/28 20:52:21 ekohl Exp $
|
||||
/* $Id: fcb.c,v 1.18 2004/03/08 08:51:26 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -111,8 +111,7 @@ CdfsDestroyFCB(PFCB Fcb)
|
|||
BOOLEAN
|
||||
CdfsFCBIsDirectory(PFCB Fcb)
|
||||
{
|
||||
// return(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY);
|
||||
return(Fcb->Entry.FileFlags & 0x02);
|
||||
return(Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY);
|
||||
}
|
||||
|
||||
|
||||
|
@ -268,7 +267,8 @@ CdfsMakeRootFCB(PDEVICE_EXTENSION Vcb)
|
|||
|
||||
Fcb->Entry.DataLengthL = Vcb->CdInfo.RootSize;
|
||||
Fcb->Entry.ExtentLocationL = Vcb->CdInfo.RootStart;
|
||||
Fcb->Entry.FileFlags = 0x02; // FILE_ATTRIBUTE_DIRECTORY;
|
||||
Fcb->Entry.FileFlags = FILE_FLAG_DIRECTORY;
|
||||
Fcb->IndexNumber.QuadPart = 0LL;
|
||||
Fcb->RefCount = 1;
|
||||
Fcb->DirIndex = 0;
|
||||
Fcb->RFCB.FileSize.QuadPart = Vcb->CdInfo.RootSize;
|
||||
|
@ -342,6 +342,8 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
|||
PWSTR LongName,
|
||||
PWSTR ShortName,
|
||||
PDIR_RECORD Record,
|
||||
ULONG DirectorySector,
|
||||
ULONG DirectoryOffset,
|
||||
PFCB * fileFCB)
|
||||
{
|
||||
WCHAR pathName[MAX_PATH];
|
||||
|
@ -388,6 +390,8 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
|||
{
|
||||
CdfsFCBInitializeCache(Vcb, rcFCB);
|
||||
}
|
||||
rcFCB->IndexNumber.u.HighPart = DirectorySector;
|
||||
rcFCB->IndexNumber.u.LowPart = DirectoryOffset;
|
||||
rcFCB->RefCount++;
|
||||
CdfsAddFCBToTable(Vcb, rcFCB);
|
||||
*fileFCB = rcFCB;
|
||||
|
@ -507,7 +511,9 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
||||
|
||||
CdfsGetDirEntryName(DeviceExt, Record, Name);
|
||||
DPRINT("Name '%S'\n", Name);
|
||||
DPRINT ("Name '%S'\n", Name);
|
||||
DPRINT ("Sector %lu\n", DirectoryFcb->Entry.ExtentLocationL);
|
||||
DPRINT ("Offset %lu\n", Offset);
|
||||
|
||||
RtlInitUnicodeString(&LongName, Name);
|
||||
ShortName.Length = 0;
|
||||
|
@ -542,6 +548,8 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
Name,
|
||||
ShortNameBuffer,
|
||||
Record,
|
||||
DirectoryFcb->Entry.ExtentLocationL,
|
||||
Offset,
|
||||
FoundFCB);
|
||||
|
||||
CcUnpinData(Context);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
* 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: finfo.c,v 1.8 2003/09/20 20:31:57 weiden Exp $
|
||||
/* $Id: finfo.c,v 1.9 2004/03/08 08:51:26 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -39,14 +39,14 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetStandardInformation(PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_STANDARD_INFORMATION StandardInfo,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
{
|
||||
DPRINT("CdfsGetStandardInformation() called\n");
|
||||
|
||||
|
@ -71,6 +71,9 @@ CdfsGetStandardInformation(PFCB Fcb,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file position information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo,
|
||||
|
@ -92,6 +95,9 @@ CdfsGetPositionInformation(PFILE_OBJECT FileObject,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the basic file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetBasicInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
|
@ -122,15 +128,15 @@ CdfsGetBasicInformation(PFILE_OBJECT FileObject,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetNameInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_NAME_INFORMATION NameInfo,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
{
|
||||
ULONG NameLength;
|
||||
|
||||
|
@ -155,6 +161,9 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the internal file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetInternalInformation(PFCB Fcb,
|
||||
PFILE_INTERNAL_INFORMATION InternalInfo,
|
||||
|
@ -168,8 +177,7 @@ CdfsGetInternalInformation(PFCB Fcb,
|
|||
if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
/* FIXME: get a real index, that can be used in a create operation */
|
||||
InternalInfo->IndexNumber.QuadPart = 0;
|
||||
InternalInfo->IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
|
||||
*BufferLength -= sizeof(FILE_INTERNAL_INFORMATION);
|
||||
|
||||
|
@ -177,13 +185,13 @@ CdfsGetInternalInformation(PFCB Fcb,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve the file network open information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetNetworkOpenInformation(PFCB Fcb,
|
||||
PFILE_NETWORK_OPEN_INFORMATION NetworkInfo,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the file network open information
|
||||
*/
|
||||
{
|
||||
assert(NetworkInfo);
|
||||
assert(Fcb);
|
||||
|
@ -210,14 +218,14 @@ CdfsGetNetworkOpenInformation(PFCB Fcb,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Retrieve all file information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsGetAllInformation(PFILE_OBJECT FileObject,
|
||||
PFCB Fcb,
|
||||
PFILE_ALL_INFORMATION Info,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the all file information
|
||||
*/
|
||||
{
|
||||
ULONG NameLength;
|
||||
|
||||
|
@ -245,11 +253,10 @@ CdfsGetAllInformation(PFILE_OBJECT FileObject,
|
|||
Info->StandardInformation.EndOfFile = Fcb->RFCB.FileSize;
|
||||
Info->StandardInformation.NumberOfLinks = 0;
|
||||
Info->StandardInformation.DeletePending = FALSE;
|
||||
Info->StandardInformation.Directory = Fcb->Entry.FileFlags & 0x02 ? TRUE : FALSE;
|
||||
Info->StandardInformation.Directory = Fcb->Entry.FileFlags & FILE_FLAG_DIRECTORY ? TRUE : FALSE;
|
||||
|
||||
/* Internal Information */
|
||||
/* FIXME: get a real index, that can be used in a create operation */
|
||||
Info->InternalInformation.IndexNumber.QuadPart = 0;
|
||||
Info->InternalInformation.IndexNumber.QuadPart = Fcb->IndexNumber.QuadPart;
|
||||
|
||||
/* EA Information */
|
||||
Info->EaInformation.EaSize = 0;
|
||||
|
@ -277,26 +284,13 @@ CdfsGetAllInformation(PFILE_OBJECT FileObject,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
CdfsSetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo)
|
||||
{
|
||||
DPRINT ("CdfsSetPositionInformation()\n");
|
||||
|
||||
DPRINT ("PositionInfo %x\n", PositionInfo);
|
||||
DPRINT ("Setting position %d\n", PositionInfo->CurrentByteOffset.u.LowPart);
|
||||
memcpy (&FileObject->CurrentByteOffset, &PositionInfo->CurrentByteOffset,
|
||||
sizeof (LARGE_INTEGER));
|
||||
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Retrieve the specified file information
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
|
@ -374,6 +368,7 @@ CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
default:
|
||||
DPRINT("Unimplemented information class %u\n", FileInformationClass);
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
@ -388,12 +383,32 @@ CdfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Set the file position information
|
||||
*/
|
||||
static NTSTATUS
|
||||
CdfsSetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo)
|
||||
{
|
||||
DPRINT ("CdfsSetPositionInformation()\n");
|
||||
|
||||
DPRINT ("PositionInfo %x\n", PositionInfo);
|
||||
DPRINT ("Setting position %I64u\n", PositionInfo->CurrentByteOffset.QuadPart);
|
||||
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
PositionInfo->CurrentByteOffset.QuadPart;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Set the specified file information
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
CdfsSetInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Retrieve the specified file information
|
||||
*/
|
||||
{
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
|
@ -414,16 +429,19 @@ CdfsSetInformation(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
switch (FileInformationClass)
|
||||
{
|
||||
case FilePositionInformation:
|
||||
Status = CdfsSetPositionInformation(FileObject,
|
||||
SystemBuffer);
|
||||
break;
|
||||
case FileBasicInformation:
|
||||
case FileRenameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
case FilePositionInformation:
|
||||
Status = CdfsSetPositionInformation(FileObject,
|
||||
SystemBuffer);
|
||||
break;
|
||||
|
||||
case FileBasicInformation:
|
||||
case FileRenameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
@ -431,7 +449,7 @@ CdfsSetInformation(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: fsctl.c,v 1.17 2003/11/13 15:25:08 ekohl Exp $
|
||||
/* $Id: fsctl.c,v 1.18 2004/03/08 08:51:26 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -95,6 +95,9 @@ CdfsGetPVDData(PUCHAR Buffer,
|
|||
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");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002 ReactOS Team
|
||||
* 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: misc.c,v 1.5 2002/10/03 18:28:22 sedwards Exp $
|
||||
/* $Id: misc.c,v 1.6 2004/03/08 08:51:26 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -128,10 +128,10 @@ CdfsFileFlagsToAttributes(PFCB Fcb,
|
|||
/* FIXME: Fix attributes */
|
||||
|
||||
*FileAttributes = // FILE_ATTRIBUTE_READONLY |
|
||||
(Fcb->Entry.FileFlags & 0x01) ? FILE_ATTRIBUTE_HIDDEN : 0 |
|
||||
(Fcb->Entry.FileFlags & 0x02) ? FILE_ATTRIBUTE_DIRECTORY : 0 |
|
||||
(Fcb->Entry.FileFlags & 0x04) ? FILE_ATTRIBUTE_SYSTEM : 0 |
|
||||
(Fcb->Entry.FileFlags & 0x10) ? FILE_ATTRIBUTE_READONLY : 0;
|
||||
(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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue