mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTFS]
Fix indentation and coding style. No code changes!!! svn path=/trunk/; revision=59229
This commit is contained in:
parent
67115c45ed
commit
78a3d923b6
17 changed files with 2162 additions and 2065 deletions
|
@ -36,16 +36,16 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
||||
|
||||
static ULONG
|
||||
static
|
||||
ULONG
|
||||
RunLength(PUCHAR run)
|
||||
{
|
||||
return(*run & 0x0f) + ((*run >> 4) & 0x0f) + 1;
|
||||
}
|
||||
|
||||
|
||||
static LONGLONG
|
||||
static
|
||||
LONGLONG
|
||||
RunLCN(PUCHAR run)
|
||||
{
|
||||
UCHAR n1 = *run & 0x0f;
|
||||
|
@ -59,8 +59,8 @@ RunLCN(PUCHAR run)
|
|||
}
|
||||
|
||||
|
||||
|
||||
static ULONGLONG
|
||||
static
|
||||
ULONGLONG
|
||||
RunCount(PUCHAR run)
|
||||
{
|
||||
UCHAR n = *run & 0xf;
|
||||
|
@ -74,13 +74,12 @@ RunCount(PUCHAR run)
|
|||
|
||||
|
||||
BOOLEAN
|
||||
FindRun (PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
FindRun(PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
ULONGLONG vcn,
|
||||
PULONGLONG lcn,
|
||||
PULONGLONG count)
|
||||
{
|
||||
PUCHAR run;
|
||||
|
||||
ULONGLONG base = NresAttr->StartVcn;
|
||||
|
||||
if (vcn < NresAttr->StartVcn || vcn > NresAttr->LastVcn)
|
||||
|
@ -111,7 +110,8 @@ FindRun (PNONRESIDENT_ATTRIBUTE NresAttr,
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static
|
||||
VOID
|
||||
NtfsDumpFileNameAttribute(PATTRIBUTE Attribute)
|
||||
{
|
||||
PRESIDENT_ATTRIBUTE ResAttr;
|
||||
|
@ -127,7 +127,8 @@ NtfsDumpFileNameAttribute(PATTRIBUTE Attribute)
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static
|
||||
VOID
|
||||
NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute)
|
||||
{
|
||||
PRESIDENT_ATTRIBUTE ResAttr;
|
||||
|
@ -143,7 +144,8 @@ NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute)
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static
|
||||
VOID
|
||||
NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute)
|
||||
{
|
||||
PRESIDENT_ATTRIBUTE ResAttr;
|
||||
|
@ -162,7 +164,8 @@ NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute)
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static
|
||||
VOID
|
||||
NtfsDumpAttribute (PATTRIBUTE Attribute)
|
||||
{
|
||||
PNONRESIDENT_ATTRIBUTE NresAttr;
|
||||
|
@ -260,18 +263,18 @@ NtfsDumpAttribute (PATTRIBUTE Attribute)
|
|||
{
|
||||
NresAttr = (PNONRESIDENT_ATTRIBUTE)Attribute;
|
||||
|
||||
FindRun (NresAttr,0,&lcn, &runcount);
|
||||
FindRun(NresAttr,0,&lcn, &runcount);
|
||||
|
||||
DbgPrint (" AllocatedSize %I64u DataSize %I64u\n",
|
||||
DbgPrint(" AllocatedSize %I64u DataSize %I64u\n",
|
||||
NresAttr->AllocatedSize, NresAttr->DataSize);
|
||||
DbgPrint (" logical clusters: %I64u - %I64u\n",
|
||||
DbgPrint(" logical clusters: %I64u - %I64u\n",
|
||||
lcn, lcn + runcount - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
NtfsDumpFileAttributes (PFILE_RECORD_HEADER FileRecord)
|
||||
NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord)
|
||||
{
|
||||
PATTRIBUTE Attribute;
|
||||
|
||||
|
@ -279,7 +282,7 @@ NtfsDumpFileAttributes (PFILE_RECORD_HEADER FileRecord)
|
|||
while (Attribute < (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) &&
|
||||
Attribute->AttributeType != (ATTRIBUTE_TYPE)-1)
|
||||
{
|
||||
NtfsDumpAttribute (Attribute);
|
||||
NtfsDumpAttribute(Attribute);
|
||||
|
||||
Attribute = (PATTRIBUTE)((ULONG_PTR)Attribute + Attribute->Length);
|
||||
}
|
||||
|
|
|
@ -36,12 +36,13 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject)
|
||||
/*
|
||||
* FUNCTION: Closes a file
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject)
|
||||
{
|
||||
PNTFS_CCB Ccb;
|
||||
|
||||
|
@ -54,7 +55,7 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("Ccb %p\n", Ccb);
|
||||
if (Ccb == NULL)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FileObject->FsContext2 = NULL;
|
||||
|
@ -71,9 +72,10 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
ExFreePool(Ccb->DirectorySearchPattern);
|
||||
}
|
||||
|
||||
ExFreePool(Ccb);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,5 +108,7 @@ ByeBye:
|
|||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
|
||||
PWSTR pRelativeFileName,
|
||||
PWSTR *pAbsoluteFilename)
|
||||
|
@ -52,16 +53,15 @@ NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
|
|||
if (NtfsFCBIsDirectory(Fcb) == FALSE ||
|
||||
pRelativeFileName[0] == L'\\')
|
||||
{
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* construct absolute path name */
|
||||
ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1
|
||||
<= MAX_PATH);
|
||||
ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1 <= MAX_PATH);
|
||||
rcName = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH * sizeof(WCHAR), TAG_NTFS);
|
||||
if (!rcName)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
wcscpy(rcName, Fcb->PathName);
|
||||
|
@ -70,17 +70,18 @@ NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
|
|||
wcscat (rcName, pRelativeFileName);
|
||||
*pAbsoluteFilename = rcName;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PWSTR FileName)
|
||||
/*
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PWSTR FileName)
|
||||
{
|
||||
PNTFS_FCB ParentFcb;
|
||||
PNTFS_FCB Fcb;
|
||||
|
@ -99,9 +100,10 @@ NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
|||
FileName = AbsFileName;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
//FIXME: Get cannonical path name (remove .'s, ..'s and extra separators)
|
||||
|
@ -132,7 +134,7 @@ NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
|||
if (AbsFileName)
|
||||
ExFreePool(AbsFileName);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,18 +144,19 @@ NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
|||
FileObject);
|
||||
|
||||
if (AbsFileName)
|
||||
ExFreePool (AbsFileName);
|
||||
ExFreePool(AbsFileName);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Opens a file
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
|
@ -185,7 +188,7 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
|||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||
RequestedDisposition == FILE_SUPERSEDE)
|
||||
{
|
||||
return(STATUS_ACCESS_DENIED);
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
Status = NtfsOpenFile(DeviceExt,
|
||||
|
@ -199,11 +202,12 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
|||
Irp->IoStatus.Information = (NT_SUCCESS(Status)) ? FILE_OPENED : 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdCreate(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -234,7 +238,7 @@ ByeBye:
|
|||
IoCompleteRequest(Irp,
|
||||
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -477,6 +477,7 @@ CdfsGetBothDirectoryInformation(PFCB Fcb,
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
|
@ -501,14 +502,14 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
|||
|
||||
ASSERT(IrpContext);
|
||||
Irp = IrpContext->Irp;
|
||||
//DeviceObject = IrpContext->DeviceObject;
|
||||
// DeviceObject = IrpContext->DeviceObject;
|
||||
|
||||
//DeviceExtension = DeviceObject->DeviceExtension;
|
||||
// DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
|
||||
Ccb = (PNTFS_CCB)FileObject->FsContext2;
|
||||
//Fcb = (PNTFS_FCB)FileObject->FsContext;
|
||||
// Fcb = (PNTFS_FCB)FileObject->FsContext;
|
||||
|
||||
/* Obtain the callers parameters */
|
||||
//BufferLength = Stack->Parameters.QueryDirectory.Length;
|
||||
|
@ -526,7 +527,7 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
|||
ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), TAG_NTFS);
|
||||
if (!Ccb->DirectorySearchPattern)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
memcpy(Ccb->DirectorySearchPattern,
|
||||
|
@ -541,11 +542,13 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
|||
Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
|
||||
if (!Ccb->DirectorySearchPattern)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Ccb->DirectorySearchPattern[0] = L'*';
|
||||
Ccb->DirectorySearchPattern[1] = 0;
|
||||
}
|
||||
|
||||
DPRINT("Search pattern '%S'\n", Ccb->DirectorySearchPattern);
|
||||
|
||||
/* Determine directory index */
|
||||
|
@ -567,7 +570,9 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
|||
{
|
||||
Buffer = Irp->UserBuffer;
|
||||
}
|
||||
|
||||
DPRINT("Buffer=%p tofind=%S\n", Buffer, Ccb->DirectorySearchPattern);
|
||||
|
||||
#if 0
|
||||
TempFcb.ObjectName = TempFcb.PathName;
|
||||
while (Status == STATUS_SUCCESS && BufferLength > 0)
|
||||
|
@ -666,13 +671,13 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
|
|||
//Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// return(Status);
|
||||
return(STATUS_NO_MORE_FILES);
|
||||
// return Status;
|
||||
return STATUS_NO_MORE_FILES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdDirectoryControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
* Irp = IRP to be passed to internal functions
|
||||
* RETURNS: Status of I/O Request
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -64,17 +65,14 @@ NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
|
|||
switch (IrpContext->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_QUERY_VOLUME_INFORMATION:
|
||||
{
|
||||
Status = NtfsQueryVolumeInformation(IrpContext);
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MJ_SET_VOLUME_INFORMATION:
|
||||
{
|
||||
Status = NtfsSetVolumeInformation(IrpContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -86,5 +84,6 @@ NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
IoSetTopLevelIrp(NULL);
|
||||
FsRtlExitFileSystem();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
BOOLEAN NTAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
NtfsAcqLazyWrite(PVOID Context,
|
||||
BOOLEAN Wait)
|
||||
{
|
||||
|
@ -43,13 +44,17 @@ NtfsAcqLazyWrite(PVOID Context,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsRelLazyWrite(PVOID Context)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
BOOLEAN NTAPI
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
NtfsAcqReadAhead(PVOID Context,
|
||||
BOOLEAN Wait)
|
||||
{
|
||||
|
@ -57,8 +62,12 @@ NtfsAcqReadAhead(PVOID Context,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsRelReadAhead(PVOID Context)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -42,12 +42,13 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static PWCHAR
|
||||
static
|
||||
PWCHAR
|
||||
NtfsGetNextPathElement(PWCHAR FileName)
|
||||
{
|
||||
if (*FileName == L'\0')
|
||||
{
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (*FileName != L'\0' && *FileName != L'\\')
|
||||
|
@ -55,20 +56,24 @@ NtfsGetNextPathElement(PWCHAR FileName)
|
|||
FileName++;
|
||||
}
|
||||
|
||||
return(FileName);
|
||||
return FileName;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
NtfsWSubString(PWCHAR pTarget, const PWCHAR pSource, size_t pLength)
|
||||
static
|
||||
VOID
|
||||
NtfsWSubString(PWCHAR pTarget,
|
||||
const PWCHAR pSource,
|
||||
size_t pLength)
|
||||
{
|
||||
wcsncpy (pTarget, pSource, pLength);
|
||||
pTarget [pLength] = L'\0';
|
||||
wcsncpy(pTarget, pSource, pLength);
|
||||
pTarget[pLength] = L'\0';
|
||||
}
|
||||
|
||||
|
||||
PNTFS_FCB
|
||||
NtfsCreateFCB(PCWSTR FileName, PNTFS_VCB Vcb)
|
||||
NtfsCreateFCB(PCWSTR FileName,
|
||||
PNTFS_VCB Vcb)
|
||||
{
|
||||
PNTFS_FCB Fcb;
|
||||
|
||||
|
@ -100,7 +105,7 @@ NtfsCreateFCB(PCWSTR FileName, PNTFS_VCB Vcb)
|
|||
|
||||
Fcb->RFCB.Resource = &(Fcb->MainResource);
|
||||
|
||||
return(Fcb);
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,14 +126,14 @@ NtfsFCBIsDirectory(PNTFS_FCB Fcb)
|
|||
{
|
||||
// return(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY);
|
||||
// return(Fcb->Entry.FileFlags & 0x02);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NtfsFCBIsRoot(PNTFS_FCB Fcb)
|
||||
{
|
||||
return(wcscmp(Fcb->PathName, L"\\") == 0);
|
||||
return (wcscmp(Fcb->PathName, L"\\") == 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,6 +173,7 @@ NtfsReleaseFCB(PNTFS_VCB Vcb,
|
|||
CcUninitializeCacheMap(Fcb->FileObject, NULL, NULL);
|
||||
NtfsDestroyFCB(Fcb);
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||
}
|
||||
|
||||
|
@ -201,7 +207,7 @@ NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
|
|||
Fcb = Vcb->StreamFileObject->FsContext;
|
||||
Fcb->RefCount++;
|
||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||
return(Fcb);
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
current_entry = Vcb->FcbListHead.Flink;
|
||||
|
@ -214,16 +220,17 @@ NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
|
|||
{
|
||||
Fcb->RefCount++;
|
||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||
return(Fcb);
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
//FIXME: need to compare against short name in FCB here
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -240,8 +247,9 @@ NtfsFCBInitializeCache(PNTFS_VCB Vcb,
|
|||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_CCB), TAG_CCB);
|
||||
if (newCCB == NULL)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory(newCCB, sizeof(NTFS_CCB));
|
||||
|
||||
newCCB->Identifier.Type = NTFS_TYPE_CCB;
|
||||
|
@ -264,7 +272,7 @@ NtfsFCBInitializeCache(PNTFS_VCB Vcb,
|
|||
ObDereferenceObject(FileObject);
|
||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,7 +298,7 @@ NtfsMakeRootFCB(PNTFS_VCB Vcb)
|
|||
NtfsAddFCBToTable(Vcb, Fcb);
|
||||
NtfsGrabFCB(Vcb, Fcb);
|
||||
|
||||
return(Fcb);
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
|
||||
|
@ -305,7 +313,7 @@ NtfsOpenRootFCB(PNTFS_VCB Vcb)
|
|||
Fcb = NtfsMakeRootFCB(Vcb);
|
||||
}
|
||||
|
||||
return(Fcb);
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,8 +418,9 @@ NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
|
|||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_CCB), TAG_CCB);
|
||||
if (newCCB == NULL)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory(newCCB, sizeof(NTFS_CCB));
|
||||
|
||||
newCCB->Identifier.Type = NTFS_TYPE_CCB;
|
||||
|
@ -436,7 +445,7 @@ NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
|
|||
|
||||
//DPRINT("file open: fcb:%x file size: %d\n", Fcb, Fcb->Entry.DataLengthL);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -547,7 +556,7 @@ NtfsDirFindFile(PNTFS_VCB Vcb,
|
|||
|
||||
CcUnpinData(Context);
|
||||
#endif
|
||||
return(STATUS_OBJECT_NAME_NOT_FOUND);
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
|
@ -585,7 +594,7 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
*pFCB = FCB;
|
||||
*pParentFCB = NULL;
|
||||
|
||||
return((FCB != NULL) ? STATUS_SUCCESS : STATUS_OBJECT_PATH_NOT_FOUND);
|
||||
return (FCB != NULL) ? STATUS_SUCCESS : STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -593,6 +602,7 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
wcscpy (pathName, L"\\");
|
||||
FCB = NtfsOpenRootFCB (Vcb);
|
||||
}
|
||||
|
||||
parentFCB = NULL;
|
||||
|
||||
/* Parse filename and check each path element for existance and access */
|
||||
|
@ -625,8 +635,9 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
*pParentFCB = NULL;
|
||||
*pFCB = NULL;
|
||||
|
||||
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
}
|
||||
|
||||
parentFCB = FCB;
|
||||
|
||||
/* Extract next directory level into dirName */
|
||||
|
@ -651,11 +662,11 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
currentElement = NtfsGetNextPathElement(currentElement);
|
||||
if (*currentElement == L'\0' || NtfsGetNextPathElement(currentElement + 1) == 0)
|
||||
{
|
||||
return(STATUS_OBJECT_NAME_NOT_FOUND);
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
else if (!NT_SUCCESS(Status))
|
||||
|
@ -664,9 +675,10 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
*pParentFCB = NULL;
|
||||
*pFCB = NULL;
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
currentElement = NtfsGetNextPathElement(currentElement);
|
||||
}
|
||||
|
||||
|
@ -674,7 +686,7 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
|||
*pFCB = FCB;
|
||||
#endif
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -35,19 +35,20 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
/*
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetStandardInformation(PNTFS_FCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_STANDARD_INFORMATION StandardInfo,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the standard file information
|
||||
*/
|
||||
{
|
||||
DPRINT("NtfsGetStandardInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
/* PRECONDITION */
|
||||
ASSERT(StandardInfo != NULL);
|
||||
|
@ -63,11 +64,13 @@ NtfsGetStandardInformation(PNTFS_FCB Fcb,
|
|||
StandardInfo->Directory = NtfsFCBIsDirectory(Fcb);
|
||||
|
||||
*BufferLength -= sizeof(FILE_STANDARD_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetPositionInformation(PFILE_OBJECT FileObject,
|
||||
PFILE_POSITION_INFORMATION PositionInfo,
|
||||
PULONG BufferLength)
|
||||
|
@ -75,21 +78,22 @@ NtfsGetPositionInformation(PFILE_OBJECT FileObject,
|
|||
DPRINT("NtfsGetPositionInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_POSITION_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
PositionInfo->CurrentByteOffset.QuadPart =
|
||||
0;
|
||||
PositionInfo->CurrentByteOffset.QuadPart = 0;
|
||||
// FileObject->CurrentByteOffset.QuadPart;
|
||||
|
||||
DPRINT("Getting position %I64x\n",
|
||||
PositionInfo->CurrentByteOffset.QuadPart);
|
||||
|
||||
*BufferLength -= sizeof(FILE_POSITION_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetBasicInformation(PFILE_OBJECT FileObject,
|
||||
PNTFS_FCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -99,7 +103,7 @@ NtfsGetBasicInformation(PFILE_OBJECT FileObject,
|
|||
DPRINT("NtfsGetBasicInformation() called\n");
|
||||
|
||||
if (*BufferLength < sizeof(FILE_BASIC_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
#if 0
|
||||
CdfsDateTimeToFileTime(Fcb,
|
||||
|
@ -117,19 +121,20 @@ NtfsGetBasicInformation(PFILE_OBJECT FileObject,
|
|||
|
||||
*BufferLength -= sizeof(FILE_BASIC_INFORMATION);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
/*
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetNameInformation(PFILE_OBJECT FileObject,
|
||||
PNTFS_FCB Fcb,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_NAME_INFORMATION NameInfo,
|
||||
PULONG BufferLength)
|
||||
/*
|
||||
* FUNCTION: Retrieve the file name information
|
||||
*/
|
||||
{
|
||||
ULONG NameLength;
|
||||
|
||||
|
@ -141,7 +146,7 @@ NtfsGetNameInformation(PFILE_OBJECT FileObject,
|
|||
NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
|
||||
// NameLength = 2;
|
||||
if (*BufferLength < sizeof(FILE_NAME_INFORMATION) + NameLength)
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
NameInfo->FileNameLength = NameLength;
|
||||
memcpy(NameInfo->FileName,
|
||||
|
@ -149,14 +154,14 @@ NtfsGetNameInformation(PFILE_OBJECT FileObject,
|
|||
NameLength + sizeof(WCHAR));
|
||||
// wcscpy(NameInfo->FileName, L"\\");
|
||||
|
||||
*BufferLength -=
|
||||
(sizeof(FILE_NAME_INFORMATION) + NameLength + sizeof(WCHAR));
|
||||
*BufferLength -= (sizeof(FILE_NAME_INFORMATION) + NameLength + sizeof(WCHAR));
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetInternalInformation(PNTFS_FCB Fcb,
|
||||
PFILE_INTERNAL_INFORMATION InternalInfo,
|
||||
PULONG BufferLength)
|
||||
|
@ -167,23 +172,24 @@ NtfsGetInternalInformation(PNTFS_FCB Fcb,
|
|||
ASSERT(Fcb);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
/* FIXME: get a real index, that can be used in a create operation */
|
||||
InternalInfo->IndexNumber.QuadPart = 0;
|
||||
|
||||
*BufferLength -= sizeof(FILE_INTERNAL_INFORMATION);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
/*
|
||||
* FUNCTION: Retrieve the specified file information
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
FILE_INFORMATION_CLASS FileInformationClass;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
|
@ -191,7 +197,6 @@ NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
PNTFS_FCB Fcb;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("NtfsQueryInformation() called\n");
|
||||
|
@ -252,6 +257,7 @@ NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryFile.Length - BufferLength;
|
||||
|
@ -260,7 +266,7 @@ NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -36,12 +36,13 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||
/*
|
||||
* FUNCTION: Tests if the device contains a filesystem that can be mounted
|
||||
* by this fsd
|
||||
* by this fsd.
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||
{
|
||||
PARTITION_INFORMATION PartitionInfo;
|
||||
DISK_GEOMETRY DiskGeometry;
|
||||
|
@ -62,7 +63,7 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtfsDeviceIoControl() failed (Status %lx)\n", Status);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (DiskGeometry.MediaType == FixedMedia)
|
||||
|
@ -79,25 +80,26 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtfsDeviceIoControl() failed (Status %lx)\n", Status);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (PartitionInfo.PartitionType != PARTITION_IFS)
|
||||
{
|
||||
DPRINT1("Invalid partition type\n");
|
||||
return(STATUS_UNRECOGNIZED_VOLUME);
|
||||
return STATUS_UNRECOGNIZED_VOLUME;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
||||
BootSector = ExAllocatePoolWithTag(NonPagedPool,
|
||||
DiskGeometry.BytesPerSector, TAG_NTFS);
|
||||
DiskGeometry.BytesPerSector,
|
||||
TAG_NTFS);
|
||||
if (BootSector == NULL)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = NtfsReadSectors (DeviceToMount,
|
||||
Status = NtfsReadSectors(DeviceToMount,
|
||||
0,
|
||||
1,
|
||||
DiskGeometry.BytesPerSector,
|
||||
|
@ -108,9 +110,11 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
goto ByeBye;
|
||||
}
|
||||
|
||||
/* Check values of different fields. If those fields have not expected
|
||||
/*
|
||||
* Check values of different fields. If those fields have not expected
|
||||
* values, we fail, to avoid mounting partitions that Windows won't mount.
|
||||
*/
|
||||
|
||||
/* OEMID: this field must be NTFS */
|
||||
if (RtlCompareMemory(BootSector->OEMID, "NTFS ", 8) != 8)
|
||||
{
|
||||
|
@ -118,8 +122,9 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
/* Unused0: this field must be COMPLETELY null */
|
||||
for (k=0; k<7; k++)
|
||||
for (k = 0; k < 7; k++)
|
||||
{
|
||||
if (BootSector->BPB.Unused0[k] != 0)
|
||||
{
|
||||
|
@ -128,8 +133,9 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
goto ByeBye;
|
||||
}
|
||||
}
|
||||
|
||||
/* Unused3: this field must be COMPLETELY null */
|
||||
for (k=0; k<4; k++)
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
if (BootSector->BPB.Unused3[k] != 0)
|
||||
{
|
||||
|
@ -138,6 +144,7 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
goto ByeBye;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check cluster size */
|
||||
ClusterSize = BootSector->BPB.BytesPerSector * BootSector->BPB.SectorsPerCluster;
|
||||
if (ClusterSize != 512 && ClusterSize != 1024 &&
|
||||
|
@ -145,7 +152,8 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
ClusterSize != 8192 && ClusterSize != 16384 &&
|
||||
ClusterSize != 32768 && ClusterSize != 65536)
|
||||
{
|
||||
DPRINT1("Cluster size failed: %hu, %hu, %hu\n", BootSector->BPB.BytesPerSector,
|
||||
DPRINT1("Cluster size failed: %hu, %hu, %hu\n",
|
||||
BootSector->BPB.BytesPerSector,
|
||||
BootSector->BPB.SectorsPerCluster,
|
||||
ClusterSize);
|
||||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
||||
|
@ -154,11 +162,13 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
|||
|
||||
ByeBye:
|
||||
ExFreePool(BootSector);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_EXTENSION DeviceExt)
|
||||
{
|
||||
|
@ -169,8 +179,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
PBOOT_SECTOR BootSector;
|
||||
PATTRIBUTE Attribute;
|
||||
ULONG Size;
|
||||
NTSTATUS Status;
|
||||
PNTFS_INFO NtfsInfo = &DeviceExt->NtfsInfo;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("NtfsGetVolumeData() called\n");
|
||||
|
||||
|
@ -185,15 +195,16 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtfsDeviceIoControl() failed (Status %lx)\n", Status);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
|
||||
BootSector = ExAllocatePoolWithTag(NonPagedPool,
|
||||
DiskGeometry.BytesPerSector, TAG_NTFS);
|
||||
DiskGeometry.BytesPerSector,
|
||||
TAG_NTFS);
|
||||
if (BootSector == NULL)
|
||||
{
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = NtfsReadSectors(DeviceObject,
|
||||
|
@ -235,7 +246,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
ExFreePool(BootSector);
|
||||
|
||||
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||
NtfsInfo->BytesPerFileRecord, TAG_NTFS);
|
||||
NtfsInfo->BytesPerFileRecord,
|
||||
TAG_NTFS);
|
||||
if (MftRecord == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -253,16 +265,21 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
return Status;
|
||||
}
|
||||
|
||||
VolumeRecord = ExAllocatePoolWithTag(NonPagedPool, NtfsInfo->BytesPerFileRecord, TAG_NTFS);
|
||||
VolumeRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||
NtfsInfo->BytesPerFileRecord,
|
||||
TAG_NTFS);
|
||||
if (VolumeRecord == NULL)
|
||||
{
|
||||
ExFreePool (MftRecord);
|
||||
ExFreePool(MftRecord);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Read Volume File (MFT index 3) */
|
||||
DeviceExt->StorageDevice = DeviceObject;
|
||||
Status = ReadFileRecord(DeviceExt, 3, VolumeRecord, MftRecord);
|
||||
Status = ReadFileRecord(DeviceExt,
|
||||
3,
|
||||
VolumeRecord,
|
||||
MftRecord);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(MftRecord);
|
||||
|
@ -284,7 +301,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
DPRINT("Data length %lu\n", AttributeDataLength (Attribute));
|
||||
NtfsInfo->VolumeLabelLength =
|
||||
min (((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength, MAXIMUM_VOLUME_LABEL_LENGTH);
|
||||
RtlCopyMemory (NtfsInfo->VolumeLabel,
|
||||
RtlCopyMemory(NtfsInfo->VolumeLabel,
|
||||
(PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset),
|
||||
NtfsInfo->VolumeLabelLength);
|
||||
}
|
||||
|
@ -314,7 +331,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -394,6 +412,7 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
|||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Ccb, sizeof(NTFS_CCB));
|
||||
|
||||
Ccb->Identifier.Type = NTFS_TYPE_CCB;
|
||||
|
@ -444,10 +463,13 @@ ByeBye:
|
|||
/* Cleanup */
|
||||
if (Vcb && Vcb->StreamFileObject)
|
||||
ObDereferenceObject(Vcb->StreamFileObject);
|
||||
|
||||
if (Fcb)
|
||||
ExFreePool(Fcb);
|
||||
|
||||
if (Ccb)
|
||||
ExFreePool(Ccb);
|
||||
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
}
|
||||
|
@ -458,17 +480,18 @@ ByeBye:
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsVerifyVolume(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
DPRINT1("NtfsVerifyVolume() called\n");
|
||||
|
||||
return STATUS_WRONG_VOLUME;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -508,7 +531,7 @@ NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
|
||||
NTSTATUS
|
||||
NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
||||
NtfsOpenMft(PDEVICE_EXTENSION Vcb)
|
||||
{
|
||||
// PVOID Bitmap;
|
||||
PFILE_RECORD_HEADER MftRecord;
|
||||
|
@ -57,7 +57,8 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
|||
BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
|
||||
|
||||
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||
BytesPerFileRecord, TAG_NTFS);
|
||||
BytesPerFileRecord,
|
||||
TAG_NTFS);
|
||||
if (MftRecord == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -75,29 +76,33 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
FixupUpdateSequenceArray(MftRecord);
|
||||
|
||||
// Attribute = FindAttribute(MftRecord, AttributeBitmap, 0);
|
||||
|
||||
/* Get number of file records*/
|
||||
n = AttributeDataLength (FindAttribute (MftRecord, AttributeData, 0))
|
||||
/ BytesPerFileRecord;
|
||||
n = AttributeDataLength(FindAttribute(MftRecord, AttributeData, 0)) / BytesPerFileRecord;
|
||||
|
||||
FileRecord = ExAllocatePoolWithTag(NonPagedPool, BytesPerFileRecord, TAG_NTFS);
|
||||
FileRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||
BytesPerFileRecord,
|
||||
TAG_NTFS);
|
||||
if (FileRecord == NULL)
|
||||
{
|
||||
ExFreePool(MftRecord);
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Enumerate MFT Records */
|
||||
DPRINT("Enumerate MFT records\n");
|
||||
for ( i=0; i < n; i++)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
ReadFileRecord(Vcb, i, FileRecord, MftRecord);
|
||||
ReadFileRecord(Vcb,
|
||||
i,
|
||||
FileRecord,
|
||||
MftRecord);
|
||||
|
||||
if (FileRecord->Ntfs.Type == NRH_FILE_TYPE && (FileRecord->Flags & FRH_IN_USE))
|
||||
if (FileRecord->Ntfs.Type == NRH_FILE_TYPE &&
|
||||
(FileRecord->Flags & FRH_IN_USE))
|
||||
{
|
||||
DPRINT("\nFile %lu\n\n", i);
|
||||
|
||||
|
@ -115,7 +120,7 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
|||
|
||||
|
||||
PATTRIBUTE
|
||||
FindAttribute (PFILE_RECORD_HEADER FileRecord,
|
||||
FindAttribute(PFILE_RECORD_HEADER FileRecord,
|
||||
ATTRIBUTE_TYPE Type,
|
||||
PWSTR name)
|
||||
{
|
||||
|
@ -138,7 +143,7 @@ FindAttribute (PFILE_RECORD_HEADER FileRecord,
|
|||
|
||||
|
||||
ULONG
|
||||
AttributeAllocatedLength (PATTRIBUTE Attribute)
|
||||
AttributeAllocatedLength(PATTRIBUTE Attribute)
|
||||
{
|
||||
if (Attribute->Nonresident)
|
||||
{
|
||||
|
@ -150,7 +155,7 @@ AttributeAllocatedLength (PATTRIBUTE Attribute)
|
|||
|
||||
|
||||
ULONG
|
||||
AttributeDataLength (PATTRIBUTE Attribute)
|
||||
AttributeDataLength(PATTRIBUTE Attribute)
|
||||
{
|
||||
if (Attribute->Nonresident)
|
||||
{
|
||||
|
@ -162,7 +167,7 @@ AttributeDataLength (PATTRIBUTE Attribute)
|
|||
|
||||
|
||||
VOID
|
||||
ReadAttribute (PATTRIBUTE attr,
|
||||
ReadAttribute(PATTRIBUTE attr,
|
||||
PVOID buffer,
|
||||
PDEVICE_EXTENSION Vcb,
|
||||
PDEVICE_OBJECT DeviceObject)
|
||||
|
@ -170,21 +175,21 @@ ReadAttribute (PATTRIBUTE attr,
|
|||
PNONRESIDENT_ATTRIBUTE NresAttr = (PNONRESIDENT_ATTRIBUTE)attr;
|
||||
if (attr->Nonresident == FALSE)
|
||||
{
|
||||
memcpy (buffer,
|
||||
memcpy(buffer,
|
||||
(PVOID)((ULONG_PTR)attr + ((PRESIDENT_ATTRIBUTE)attr)->ValueOffset),
|
||||
((PRESIDENT_ATTRIBUTE)attr)->ValueLength);
|
||||
}
|
||||
|
||||
ReadExternalAttribute(Vcb, NresAttr, 0, (ULONG)(NresAttr->LastVcn) + 1,
|
||||
ReadExternalAttribute(Vcb,
|
||||
NresAttr,
|
||||
0,
|
||||
(ULONG)(NresAttr->LastVcn) + 1,
|
||||
buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||
ReadFileRecord(PDEVICE_EXTENSION Vcb,
|
||||
ULONG index,
|
||||
PFILE_RECORD_HEADER file,
|
||||
PFILE_RECORD_HEADER Mft)
|
||||
|
@ -196,11 +201,15 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
|||
LONG m = (Vcb->NtfsInfo.BytesPerCluster / BytesPerFileRecord) - 1;
|
||||
ULONG n = m > 0 ? (index & m) : 0;
|
||||
|
||||
p = ExAllocatePoolWithTag(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster, TAG_NTFS);
|
||||
p = ExAllocatePoolWithTag(NonPagedPool,
|
||||
clusters * Vcb->NtfsInfo.BytesPerCluster,
|
||||
TAG_NTFS);
|
||||
|
||||
ReadVCN (Vcb, Mft, AttributeData, vcn, clusters, p);
|
||||
|
||||
memcpy(file, (PVOID)((ULONG_PTR)p + n * BytesPerFileRecord), BytesPerFileRecord);
|
||||
memcpy(file,
|
||||
(PVOID)((ULONG_PTR)p + n * BytesPerFileRecord),
|
||||
BytesPerFileRecord);
|
||||
|
||||
ExFreePool(p);
|
||||
|
||||
|
@ -210,9 +219,8 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
|||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
ReadExternalAttribute (PDEVICE_EXTENSION Vcb,
|
||||
ReadExternalAttribute(PDEVICE_EXTENSION Vcb,
|
||||
PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
ULONGLONG vcn,
|
||||
ULONG count,
|
||||
|
@ -226,12 +234,12 @@ ReadExternalAttribute (PDEVICE_EXTENSION Vcb,
|
|||
|
||||
PUCHAR bytes = (PUCHAR)buffer;
|
||||
|
||||
for (left = count; left>0; left -=readcount)
|
||||
for (left = count; left > 0; left -= readcount)
|
||||
{
|
||||
FindRun(NresAttr, vcn, &lcn, &runcount);
|
||||
|
||||
// readcount = (ULONG)(__min(runcount, left));
|
||||
readcount = (ULONG)min (runcount, left);
|
||||
readcount = (ULONG)min(runcount, left);
|
||||
|
||||
|
||||
n = readcount * Vcb->NtfsInfo.BytesPerCluster;
|
||||
|
@ -243,14 +251,12 @@ ReadExternalAttribute (PDEVICE_EXTENSION Vcb,
|
|||
|
||||
vcn += readcount;
|
||||
bytes += n;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ReadVCN (PDEVICE_EXTENSION Vcb,
|
||||
ReadVCN(PDEVICE_EXTENSION Vcb,
|
||||
PFILE_RECORD_HEADER file,
|
||||
ATTRIBUTE_TYPE type,
|
||||
ULONGLONG vcn,
|
||||
|
@ -283,24 +289,23 @@ BOOL bitset(PUCHAR bitmap, ULONG i)
|
|||
#endif
|
||||
|
||||
|
||||
VOID FixupUpdateSequenceArray(PFILE_RECORD_HEADER file)
|
||||
VOID
|
||||
FixupUpdateSequenceArray(PFILE_RECORD_HEADER file)
|
||||
{
|
||||
PUSHORT usa = (PUSHORT)((ULONG_PTR)file + file->Ntfs.UsaOffset);
|
||||
PUSHORT sector = (PUSHORT)file;
|
||||
ULONG i;
|
||||
|
||||
for( i =1; i < file->Ntfs.UsaCount; i++)
|
||||
for (i = 1; i < file->Ntfs.UsaCount; i++)
|
||||
{
|
||||
sector[255] = usa[i];
|
||||
sector += 256;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
ReadLCN (PDEVICE_EXTENSION Vcb,
|
||||
ReadLCN(PDEVICE_EXTENSION Vcb,
|
||||
ULONGLONG lcn,
|
||||
ULONG count,
|
||||
PVOID buffer)
|
||||
|
@ -309,7 +314,7 @@ ReadLCN (PDEVICE_EXTENSION Vcb,
|
|||
|
||||
DiskSector.QuadPart = lcn;
|
||||
|
||||
return NtfsReadSectors (Vcb->StorageDevice,
|
||||
return NtfsReadSectors(Vcb->StorageDevice,
|
||||
DiskSector.u.LowPart * Vcb->NtfsInfo.SectorsPerCluster,
|
||||
count * Vcb->NtfsInfo.SectorsPerCluster,
|
||||
Vcb->NtfsInfo.BytesPerSector,
|
||||
|
|
|
@ -74,15 +74,19 @@ NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
TRACE_(NTFS, "NtfsAllocateIrpContext()\n");
|
||||
|
||||
IrpContext = (PNTFS_IRP_CONTEXT)ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_IRP_CONTEXT), 'PRIN');
|
||||
IrpContext = (PNTFS_IRP_CONTEXT)ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(NTFS_IRP_CONTEXT),
|
||||
'PRIN');
|
||||
if (IrpContext == NULL)
|
||||
return NULL;
|
||||
|
||||
RtlZeroMemory(IrpContext, sizeof(NTFS_IRP_CONTEXT));
|
||||
|
||||
IrpContext->Identifier.Type = NTFS_TYPE_IRP_CONTEST;
|
||||
IrpContext->Identifier.Size = sizeof(NTFS_IRP_CONTEXT);
|
||||
IrpContext->Irp = Irp;
|
||||
IrpContext->DeviceObject = DeviceObject;
|
||||
|
||||
if (Irp)
|
||||
{
|
||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
@ -95,3 +99,5 @@ NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
return IrpContext;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -38,9 +38,6 @@ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
/*
|
||||
* FUNCTION: Called by the system to initialize the driver
|
||||
* ARGUMENTS:
|
||||
|
@ -48,9 +45,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(DEVICE_NAME);
|
||||
NTSTATUS Status;
|
||||
|
||||
TRACE_(NTFS, "DriverEntry(%p, '%wZ')\n", DriverObject, RegistryPath);
|
||||
|
||||
|
@ -61,6 +62,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto ErrorEnd;
|
||||
}
|
||||
|
||||
RtlZeroMemory(NtfsGlobalData, sizeof(NTFS_GLOBAL_DATA));
|
||||
NtfsGlobalData->Identifier.Type = NTFS_TYPE_GLOBAL_DATA;
|
||||
NtfsGlobalData->Identifier.Size = sizeof(NTFS_GLOBAL_DATA);
|
||||
|
@ -114,14 +116,16 @@ ErrorEnd:
|
|||
return Status;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
|
||||
|
||||
/*
|
||||
* FUNCTION: Called within the driver entry to initialize the IRP functions array
|
||||
* ARGUMENTS:
|
||||
* DriverObject = object describing this driver
|
||||
* RETURNS: Nothing
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsFsdCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsFsdClose;
|
||||
|
@ -136,3 +140,4 @@ NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
|
|||
return;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -56,10 +56,6 @@ typedef struct _BOOT_SECTOR
|
|||
|
||||
//typedef struct _BootSector BootSector;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _NTFS_INFO
|
||||
{
|
||||
ULONG BytesPerSector;
|
||||
|
@ -108,7 +104,6 @@ typedef struct
|
|||
|
||||
NTFS_INFO NtfsInfo;
|
||||
|
||||
|
||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;
|
||||
|
||||
|
||||
|
@ -143,7 +138,6 @@ typedef struct _FCB
|
|||
|
||||
// DIR_RECORD Entry;
|
||||
|
||||
|
||||
} NTFS_FCB, *PNTFS_FCB;
|
||||
|
||||
|
||||
|
@ -350,13 +344,14 @@ extern PNTFS_GLOBAL_DATA NtfsGlobalData;
|
|||
//ULONG RunLength(PUCHAR run);
|
||||
|
||||
BOOLEAN
|
||||
FindRun (PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
FindRun(PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
ULONGLONG vcn,
|
||||
PULONGLONG lcn,
|
||||
PULONGLONG count);
|
||||
|
||||
VOID
|
||||
NtfsDumpFileAttributes (PFILE_RECORD_HEADER FileRecord);
|
||||
NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
|
||||
|
||||
|
||||
/* blockdev.c */
|
||||
|
||||
|
@ -377,6 +372,7 @@ NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
IN OUT PULONG OutputBufferSize,
|
||||
IN BOOLEAN Override);
|
||||
|
||||
|
||||
/* close.c */
|
||||
|
||||
DRIVER_DISPATCH NtfsFsdClose;
|
||||
|
@ -384,6 +380,7 @@ NTSTATUS NTAPI
|
|||
NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
|
||||
/* create.c */
|
||||
|
||||
DRIVER_DISPATCH NtfsFsdCreate;
|
||||
|
@ -399,13 +396,17 @@ NTSTATUS NTAPI
|
|||
NtfsFsdDirectoryControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
|
||||
/* dispatch.c */
|
||||
|
||||
DRIVER_DISPATCH NtfsFsdDispatch;
|
||||
NTSTATUS NTAPI
|
||||
NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
|
||||
/* fastio.c */
|
||||
|
||||
BOOLEAN NTAPI
|
||||
NtfsAcqLazyWrite(PVOID Context,
|
||||
BOOLEAN Wait);
|
||||
|
@ -420,10 +421,12 @@ NtfsAcqReadAhead(PVOID Context,
|
|||
VOID NTAPI
|
||||
NtfsRelReadAhead(PVOID Context);
|
||||
|
||||
|
||||
/* fcb.c */
|
||||
|
||||
PNTFS_FCB
|
||||
NtfsCreateFCB(PCWSTR FileName, PNTFS_VCB Vcb);
|
||||
NtfsCreateFCB(PCWSTR FileName,
|
||||
PNTFS_VCB Vcb);
|
||||
|
||||
VOID
|
||||
NtfsDestroyFCB(PNTFS_FCB Fcb);
|
||||
|
@ -490,21 +493,23 @@ NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
/* mft.c */
|
||||
NTSTATUS
|
||||
NtfsOpenMft (PDEVICE_EXTENSION Vcb);
|
||||
NtfsOpenMft(PDEVICE_EXTENSION Vcb);
|
||||
|
||||
|
||||
VOID
|
||||
ReadAttribute(PATTRIBUTE attr, PVOID buffer, PDEVICE_EXTENSION Vcb,
|
||||
ReadAttribute(PATTRIBUTE attr,
|
||||
PVOID buffer,
|
||||
PDEVICE_EXTENSION Vcb,
|
||||
PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
ULONG
|
||||
AttributeDataLength(PATTRIBUTE attr);
|
||||
|
||||
ULONG
|
||||
AttributeAllocatedLength (PATTRIBUTE Attribute);
|
||||
AttributeAllocatedLength(PATTRIBUTE Attribute);
|
||||
|
||||
NTSTATUS
|
||||
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||
ReadFileRecord(PDEVICE_EXTENSION Vcb,
|
||||
ULONG index,
|
||||
PFILE_RECORD_HEADER file,
|
||||
PFILE_RECORD_HEADER Mft);
|
||||
|
@ -518,36 +523,37 @@ ULONG
|
|||
AttributeLengthAllocated(PATTRIBUTE attr);
|
||||
|
||||
VOID
|
||||
ReadVCN (PDEVICE_EXTENSION Vcb,
|
||||
ReadVCN(PDEVICE_EXTENSION Vcb,
|
||||
PFILE_RECORD_HEADER file,
|
||||
ATTRIBUTE_TYPE type,
|
||||
ULONGLONG vcn,
|
||||
ULONG count,
|
||||
PVOID buffer);
|
||||
|
||||
|
||||
VOID FixupUpdateSequenceArray(PFILE_RECORD_HEADER file);
|
||||
VOID
|
||||
FixupUpdateSequenceArray(PFILE_RECORD_HEADER file);
|
||||
|
||||
VOID
|
||||
ReadExternalAttribute (PDEVICE_EXTENSION Vcb,
|
||||
ReadExternalAttribute(PDEVICE_EXTENSION Vcb,
|
||||
PNONRESIDENT_ATTRIBUTE NresAttr,
|
||||
ULONGLONG vcn,
|
||||
ULONG count,
|
||||
PVOID buffer);
|
||||
|
||||
NTSTATUS
|
||||
ReadLCN (PDEVICE_EXTENSION Vcb,
|
||||
ReadLCN(PDEVICE_EXTENSION Vcb,
|
||||
ULONGLONG lcn,
|
||||
ULONG count,
|
||||
PVOID buffer);
|
||||
|
||||
|
||||
VOID
|
||||
EnumerAttribute(PFILE_RECORD_HEADER file,
|
||||
PDEVICE_EXTENSION Vcb,
|
||||
PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
|
||||
/* misc.c */
|
||||
|
||||
BOOLEAN
|
||||
NtfsIsIrpTopLevel(PIRP Irp);
|
||||
|
||||
|
@ -573,6 +579,7 @@ CdfsFileFlagsToAttributes(PFCB Fcb,
|
|||
PULONG FileAttributes);
|
||||
#endif
|
||||
|
||||
|
||||
/* rw.c */
|
||||
|
||||
DRIVER_DISPATCH NtfsFsdRead;
|
||||
|
@ -594,9 +601,13 @@ NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
|
|||
NTSTATUS
|
||||
NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
|
||||
|
||||
|
||||
/* ntfs.c */
|
||||
|
||||
DRIVER_INITIALIZE DriverEntry;
|
||||
|
||||
VOID NTAPI NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
|
||||
|
||||
#endif /* NTFS_H */
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/filesystem/ntfs/rw.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PURPOSE: NTFS filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
@ -27,12 +27,11 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ntddk.h>
|
||||
#include "ntfs.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#include "ntfs.h"
|
||||
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
|
@ -42,7 +41,11 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
/*
|
||||
* FUNCTION: Reads data from a file
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PUCHAR Buffer,
|
||||
|
@ -50,9 +53,6 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
ULONG ReadOffset,
|
||||
ULONG IrpFlags,
|
||||
PULONG LengthRead)
|
||||
/*
|
||||
* FUNCTION: Reads data from a file
|
||||
*/
|
||||
{
|
||||
#if 0
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
@ -129,7 +129,8 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -159,7 +160,6 @@ NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
|
|||
ReadOffset.u.LowPart,
|
||||
Irp->Flags,
|
||||
&ReturnedReadLength);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
|
@ -167,6 +167,7 @@ NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
|
|||
FileObject->CurrentByteOffset.QuadPart =
|
||||
ReadOffset.QuadPart + ReturnedReadLength;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = ReturnedReadLength;
|
||||
}
|
||||
else
|
||||
|
@ -177,11 +178,12 @@ NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
|
|||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtfsFsdWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
|
@ -189,7 +191,7 @@ NtfsFsdWrite(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_NOT_SUPPORTED);
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
|
||||
PULONG BufferLength)
|
||||
|
@ -77,7 +78,8 @@ NtfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
PULONG BufferLength)
|
||||
|
@ -88,10 +90,10 @@ NtfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("Required length %lu\n", (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8));
|
||||
|
||||
if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION))
|
||||
return(STATUS_INFO_LENGTH_MISMATCH);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
|
||||
if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
FsAttributeInfo->FileSystemAttributes =
|
||||
FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK;
|
||||
|
@ -105,11 +107,12 @@ NtfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
|
|||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
||||
PULONG BufferLength)
|
||||
|
@ -121,7 +124,7 @@ NtfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
|||
DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
|
||||
|
@ -134,11 +137,12 @@ NtfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
|
|||
if (NT_SUCCESS(Status))
|
||||
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
static
|
||||
NTSTATUS
|
||||
NtfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
|
@ -148,7 +152,7 @@ NtfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
|||
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_DISK;
|
||||
FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */
|
||||
|
@ -158,11 +162,10 @@ NtfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
|||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
DPRINT("BufferLength %lu\n", *BufferLength);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue