From a7ffdcff0ecf64f0caf9a143bf00c2f3700aa8cf Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 6 Nov 2004 13:44:57 +0000 Subject: [PATCH] - Replace TIME type by LARGE_INTEGER in FILE_*_INFORMATION structures. - Make sure that filesystem-specific data and time are converted to/from system time. - Replace assert() by ASSERT(). svn path=/trunk/; revision=11555 --- reactos/drivers/fs/cdfs/cdfs.h | 4 +- reactos/drivers/fs/cdfs/create.c | 10 +-- reactos/drivers/fs/cdfs/dirctl.c | 50 ++++++------- reactos/drivers/fs/cdfs/fcb.c | 8 +- reactos/drivers/fs/cdfs/finfo.c | 70 ++++++++--------- reactos/drivers/fs/cdfs/misc.c | 10 ++- reactos/drivers/fs/vfat/create.c | 12 +-- reactos/drivers/fs/vfat/dir.c | 61 ++++++++------- reactos/drivers/fs/vfat/dirwr.c | 23 +++--- reactos/drivers/fs/vfat/fcb.c | 10 +-- reactos/drivers/fs/vfat/finfo.c | 125 +++++++++++++++---------------- reactos/drivers/fs/vfat/flush.c | 4 +- reactos/drivers/fs/vfat/fsctl.c | 10 +-- reactos/drivers/fs/vfat/misc.c | 28 +++---- reactos/drivers/fs/vfat/rw.c | 63 ++++++++-------- reactos/drivers/fs/vfat/vfat.h | 14 ++-- reactos/drivers/fs/vfat/volume.c | 6 +- 17 files changed, 259 insertions(+), 249 deletions(-) diff --git a/reactos/drivers/fs/cdfs/cdfs.h b/reactos/drivers/fs/cdfs/cdfs.h index f13b76ff57b..e62d95adbb3 100644 --- a/reactos/drivers/fs/cdfs/cdfs.h +++ b/reactos/drivers/fs/cdfs/cdfs.h @@ -372,8 +372,8 @@ CdfsSwapString(PWCHAR Out, ULONG Count); VOID -CdfsDateTimeToFileTime(PFCB Fcb, - TIME *FileTime); +CdfsDateTimeToSystemTime(PFCB Fcb, + PLARGE_INTEGER SystemTime); VOID CdfsFileFlagsToAttributes(PFCB Fcb, diff --git a/reactos/drivers/fs/cdfs/create.c b/reactos/drivers/fs/cdfs/create.c index 9fed126d4ae..747003278d1 100644 --- a/reactos/drivers/fs/cdfs/create.c +++ b/reactos/drivers/fs/cdfs/create.c @@ -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: create.c,v 1.12 2004/09/14 21:46:39 ekohl Exp $ +/* $Id: create.c,v 1.13 2004/11/06 13:41:58 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -50,7 +50,7 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject, DPRINT("try related for %wZ\n", RelativeFileName); Fcb = FileObject->FsContext; - assert(Fcb); + ASSERT(Fcb); /* verify related object is a directory and target name don't start with \. */ @@ -65,7 +65,7 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject, sizeof(WCHAR) + RelativeFileName->Length + sizeof(WCHAR); -// assert(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1 +// ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1 // <= MAX_PATH); // rcName = ExAllocatePool(NonPagedPool, MAX_PATH * sizeof(WCHAR)); // if (!rcName) @@ -249,9 +249,9 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject, DPRINT("CdfsCreateFile() called\n"); DeviceExt = DeviceObject->DeviceExtension; - assert (DeviceExt); + ASSERT(DeviceExt); Stack = IoGetCurrentIrpStackLocation (Irp); - assert (Stack); + ASSERT(Stack); RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff); RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS; diff --git a/reactos/drivers/fs/cdfs/dirctl.c b/reactos/drivers/fs/cdfs/dirctl.c index 31ccefcf084..8acaf6b567e 100644 --- a/reactos/drivers/fs/cdfs/dirctl.c +++ b/reactos/drivers/fs/cdfs/dirctl.c @@ -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: dirctl.c,v 1.16 2004/09/14 21:46:39 ekohl Exp $ +/* $Id: dirctl.c,v 1.17 2004/11/06 13:41:58 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -414,14 +414,14 @@ CdfsGetDirectoryInformation(PFCB Fcb, memcpy(Info->FileName, Fcb->ObjectName, Length); /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->CreationTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastAccessTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastWriteTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->ChangeTime); /* Convert file flags */ CdfsFileFlagsToAttributes(Fcb, @@ -465,14 +465,14 @@ CdfsGetFullDirectoryInformation(PFCB Fcb, memcpy(Info->FileName, Fcb->ObjectName, Length); /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->CreationTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastAccessTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastWriteTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->ChangeTime); /* Convert file flags */ CdfsFileFlagsToAttributes(Fcb, @@ -518,14 +518,14 @@ CdfsGetBothDirectoryInformation(PFCB Fcb, memcpy(Info->FileName, Fcb->ObjectName, Length); /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->CreationTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastAccessTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->LastWriteTime); + CdfsDateTimeToSystemTime(Fcb, + &Info->ChangeTime); /* Convert file flags */ CdfsFileFlagsToAttributes(Fcb, diff --git a/reactos/drivers/fs/cdfs/fcb.c b/reactos/drivers/fs/cdfs/fcb.c index 99cc53af353..487ad13107c 100644 --- a/reactos/drivers/fs/cdfs/fcb.c +++ b/reactos/drivers/fs/cdfs/fcb.c @@ -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.19 2004/09/14 21:46:39 ekohl Exp $ +/* $Id: fcb.c,v 1.20 2004/11/06 13:41:58 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -474,9 +474,9 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt, GENERATE_NAME_CONTEXT NameContext; - assert(DeviceExt); - assert(DirectoryFcb); - assert(FileToFind); + ASSERT(DeviceExt); + ASSERT(DirectoryFcb); + ASSERT(FileToFind); DPRINT("CdfsDirFindFile(VCB:%p, dirFCB:%p, File:%wZ)\n", DeviceExt, diff --git a/reactos/drivers/fs/cdfs/finfo.c b/reactos/drivers/fs/cdfs/finfo.c index 708b78104ec..1588eee7038 100644 --- a/reactos/drivers/fs/cdfs/finfo.c +++ b/reactos/drivers/fs/cdfs/finfo.c @@ -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.11 2004/05/23 15:49:56 hbirr Exp $ +/* $Id: finfo.c,v 1.12 2004/11/06 13:41:58 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -54,8 +54,8 @@ CdfsGetStandardInformation(PFCB Fcb, return STATUS_BUFFER_OVERFLOW; /* PRECONDITION */ - assert(StandardInfo != NULL); - assert(Fcb != NULL); + ASSERT(StandardInfo != NULL); + ASSERT(Fcb != NULL); RtlZeroMemory(StandardInfo, sizeof(FILE_STANDARD_INFORMATION)); @@ -119,14 +119,14 @@ CdfsGetBasicInformation(PFILE_OBJECT FileObject, if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) return STATUS_BUFFER_OVERFLOW; - CdfsDateTimeToFileTime(Fcb, - (TIME *)&BasicInfo->CreationTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&BasicInfo->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&BasicInfo->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&BasicInfo->ChangeTime); + CdfsDateTimeToSystemTime(Fcb, + &BasicInfo->CreationTime); + CdfsDateTimeToSystemTime(Fcb, + &BasicInfo->LastAccessTime); + CdfsDateTimeToSystemTime(Fcb, + &BasicInfo->LastWriteTime); + CdfsDateTimeToSystemTime(Fcb, + &BasicInfo->ChangeTime); CdfsFileFlagsToAttributes(Fcb, &BasicInfo->FileAttributes); @@ -151,8 +151,8 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject, DPRINT("CdfsGetNameInformation() called\n"); - assert(NameInfo != NULL); - assert(Fcb != NULL); + ASSERT(NameInfo != NULL); + ASSERT(Fcb != NULL); NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); if (*BufferLength < sizeof(FILE_NAME_INFORMATION) + NameLength) @@ -180,8 +180,8 @@ CdfsGetInternalInformation(PFCB Fcb, { DPRINT("CdfsGetInternalInformation() called\n"); - assert(InternalInfo); - assert(Fcb); + ASSERT(InternalInfo); + ASSERT(Fcb); if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION)) return(STATUS_BUFFER_OVERFLOW); @@ -202,20 +202,20 @@ CdfsGetNetworkOpenInformation(PFCB Fcb, 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); - CdfsDateTimeToFileTime(Fcb, - &NetworkInfo->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &NetworkInfo->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &NetworkInfo->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &NetworkInfo->ChangeTime); + CdfsDateTimeToSystemTime(Fcb, + &NetworkInfo->CreationTime); + CdfsDateTimeToSystemTime(Fcb, + &NetworkInfo->LastAccessTime); + CdfsDateTimeToSystemTime(Fcb, + &NetworkInfo->LastWriteTime); + CdfsDateTimeToSystemTime(Fcb, + &NetworkInfo->ChangeTime); if (CdfsFCBIsDirectory(Fcb)) { NetworkInfo->AllocationSize.QuadPart = 0LL;; @@ -246,22 +246,22 @@ CdfsGetAllInformation(PFILE_OBJECT FileObject, { 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); /* Basic Information */ - CdfsDateTimeToFileTime(Fcb, - (TIME *)&Info->BasicInformation.CreationTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&Info->BasicInformation.LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&Info->BasicInformation.LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - (TIME *)&Info->BasicInformation.ChangeTime); + 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); diff --git a/reactos/drivers/fs/cdfs/misc.c b/reactos/drivers/fs/cdfs/misc.c index 38bf02d8fe4..dfa49181a44 100644 --- a/reactos/drivers/fs/cdfs/misc.c +++ b/reactos/drivers/fs/cdfs/misc.c @@ -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.8 2004/09/14 21:46:39 ekohl Exp $ +/* $Id: misc.c,v 1.9 2004/11/06 13:41:58 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -59,10 +59,11 @@ CdfsSwapString(PWCHAR Out, VOID -CdfsDateTimeToFileTime(PFCB Fcb, - TIME *FileTime) +CdfsDateTimeToSystemTime(PFCB Fcb, + PLARGE_INTEGER SystemTime) { TIME_FIELDS TimeFields; + LARGE_INTEGER LocalTime; TimeFields.Milliseconds = 0; TimeFields.Second = Fcb->Entry.Second; @@ -74,7 +75,8 @@ CdfsDateTimeToFileTime(PFCB Fcb, TimeFields.Year = Fcb->Entry.Year + 1900; RtlTimeFieldsToTime(&TimeFields, - (PLARGE_INTEGER)FileTime); + &LocalTime); + ExLocalTimeToSystemTime(&LocalTime, SystemTime); } diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index a3d2858e300..6cc872b21a5 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -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: create.c,v 1.74 2004/08/31 16:08:37 navaraf Exp $ +/* $Id: create.c,v 1.75 2004/11/06 13:44:56 ekohl Exp $ * * PROJECT: ReactOS kernel * FILE: drivers/fs/vfat/create.c @@ -721,9 +721,9 @@ NTSTATUS VfatCreate (PVFAT_IRP_CONTEXT IrpContext) */ { NTSTATUS Status; - - assert (IrpContext); - + + ASSERT(IrpContext); + if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject) { /* DeviceObject represents FileSystem instead of logical volume */ @@ -734,12 +734,12 @@ NTSTATUS VfatCreate (PVFAT_IRP_CONTEXT IrpContext) VfatFreeIrpContext(IrpContext); return(STATUS_SUCCESS); } - + if (!(IrpContext->Flags & IRPCONTEXT_CANWAIT)) { return(VfatQueueRequest (IrpContext)); } - + IrpContext->Irp->IoStatus.Information = 0; ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, TRUE); Status = VfatCreateFile (IrpContext->DeviceObject, IrpContext->Irp); diff --git a/reactos/drivers/fs/vfat/dir.c b/reactos/drivers/fs/vfat/dir.c index e7e99f23aba..58a8e007d01 100644 --- a/reactos/drivers/fs/vfat/dir.c +++ b/reactos/drivers/fs/vfat/dir.c @@ -1,5 +1,5 @@ /* - * $Id: dir.c,v 1.34 2004/05/23 13:34:32 hbirr Exp $ + * $Id: dir.c,v 1.35 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -20,13 +20,15 @@ // function like DosDateTimeToFileTime -BOOL FsdDosDateTimeToFileTime (WORD wDosDate, WORD wDosTime, TIME * FileTime) +BOOL +FsdDosDateTimeToSystemTime (WORD wDosDate, WORD wDosTime, PLARGE_INTEGER SystemTime) { PDOSTIME pdtime = (PDOSTIME) & wDosTime; PDOSDATE pddate = (PDOSDATE) & wDosDate; TIME_FIELDS TimeFields; + LARGE_INTEGER LocalTime; - if (FileTime == NULL) + if (SystemTime == NULL) return FALSE; TimeFields.Milliseconds = 0; @@ -38,7 +40,8 @@ BOOL FsdDosDateTimeToFileTime (WORD wDosDate, WORD wDosTime, TIME * FileTime) TimeFields.Month = pddate->Month; TimeFields.Year = 1980 + pddate->Year; - RtlTimeFieldsToTime (&TimeFields, (PLARGE_INTEGER) FileTime); + RtlTimeFieldsToTime (&TimeFields, &LocalTime); + ExLocalTimeToSystemTime(&LocalTime, SystemTime); return TRUE; } @@ -46,16 +49,18 @@ BOOL FsdDosDateTimeToFileTime (WORD wDosDate, WORD wDosTime, TIME * FileTime) // function like FileTimeToDosDateTime BOOL -FsdFileTimeToDosDateTime (TIME * FileTime, WORD * pwDosDate, WORD * pwDosTime) +FsdSystemTimeToDosDateTime (PLARGE_INTEGER SystemTime, WORD * pwDosDate, WORD * pwDosTime) { PDOSTIME pdtime = (PDOSTIME) pwDosTime; PDOSDATE pddate = (PDOSDATE) pwDosDate; TIME_FIELDS TimeFields; + LARGE_INTEGER LocalTime; - if (FileTime == NULL) + if (SystemTime == NULL) return FALSE; - RtlTimeToTimeFields ((PLARGE_INTEGER) FileTime, &TimeFields); + ExSystemTimeToLocalTime (SystemTime, &LocalTime); + RtlTimeToTimeFields (&LocalTime, &TimeFields); if (pdtime) { @@ -103,12 +108,14 @@ VfatGetFileDirectoryInformation (PVFAT_DIRENTRY_CONTEXT DirContext, DWORD_ROUND_UP (sizeof (FILE_DIRECTORY_INFORMATION) + DirContext->LongNameU.Length); memcpy (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); // pInfo->FileIndex=; - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.CreationDate, - DirContext->FatDirEntry.CreationTime, &pInfo->CreationTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.AccessDate, 0, - &pInfo->LastAccessTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.UpdateDate, - DirContext->FatDirEntry.UpdateTime, &pInfo->LastWriteTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.CreationDate, + DirContext->FatDirEntry.CreationTime, + &pInfo->CreationTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.AccessDate, 0, + &pInfo->LastAccessTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.UpdateDate, + DirContext->FatDirEntry.UpdateTime, + &pInfo->LastWriteTime); pInfo->ChangeTime = pInfo->LastWriteTime; if (DirContext->FatDirEntry.Attrib & FILE_ATTRIBUTE_DIRECTORY) { @@ -141,12 +148,14 @@ VfatGetFileFullDirectoryInformation (PVFAT_DIRENTRY_CONTEXT DirContext, DWORD_ROUND_UP (sizeof (FILE_FULL_DIRECTORY_INFORMATION) + DirContext->LongNameU.Length); memcpy (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); // pInfo->FileIndex=; - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.CreationDate, - DirContext->FatDirEntry.CreationTime, &pInfo->CreationTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.AccessDate, - 0, &pInfo->LastAccessTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.UpdateDate, - DirContext->FatDirEntry.UpdateTime, &pInfo->LastWriteTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.CreationDate, + DirContext->FatDirEntry.CreationTime, + &pInfo->CreationTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.AccessDate, + 0, &pInfo->LastAccessTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.UpdateDate, + DirContext->FatDirEntry.UpdateTime, + &pInfo->LastWriteTime); pInfo->ChangeTime = pInfo->LastWriteTime; pInfo->EndOfFile.u.HighPart = 0; pInfo->EndOfFile.u.LowPart = DirContext->FatDirEntry.FileSize; @@ -173,12 +182,14 @@ VfatGetFileBothInformation (PVFAT_DIRENTRY_CONTEXT DirContext, pInfo->ShortNameLength = DirContext->ShortNameU.Length; memcpy (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); // pInfo->FileIndex=; - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.CreationDate, - DirContext->FatDirEntry.CreationDate, &pInfo->CreationTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.AccessDate, 0, - &pInfo->LastAccessTime); - FsdDosDateTimeToFileTime (DirContext->FatDirEntry.UpdateDate, - DirContext->FatDirEntry.UpdateTime, &pInfo->LastWriteTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.CreationDate, + DirContext->FatDirEntry.CreationDate, + &pInfo->CreationTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.AccessDate, 0, + &pInfo->LastAccessTime); + FsdDosDateTimeToSystemTime (DirContext->FatDirEntry.UpdateDate, + DirContext->FatDirEntry.UpdateTime, + &pInfo->LastWriteTime); pInfo->ChangeTime = pInfo->LastWriteTime; if (DirContext->FatDirEntry.Attrib & FILE_ATTRIBUTE_DIRECTORY) { diff --git a/reactos/drivers/fs/vfat/dirwr.c b/reactos/drivers/fs/vfat/dirwr.c index bb511e9f327..60f1ab618af 100644 --- a/reactos/drivers/fs/vfat/dirwr.c +++ b/reactos/drivers/fs/vfat/dirwr.c @@ -1,4 +1,4 @@ -/* $Id: dirwr.c,v 1.41 2004/08/05 02:48:18 navaraf Exp $ +/* $Id: dirwr.c,v 1.42 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -29,8 +29,8 @@ VfatUpdateEntry (PVFATFCB pFcb) PFAT_DIR_ENTRY PinEntry; LARGE_INTEGER Offset; - assert (pFcb); - assert (pFcb->parentFcb); + ASSERT(pFcb); + ASSERT(pFcb->parentFcb); DPRINT ("updEntry PathName \'%wZ\'\n", &pFcb->PathNameU); @@ -174,7 +174,7 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt, BOOLEAN lCaseBase = FALSE, uCaseBase, lCaseExt = FALSE, uCaseExt; PVFATFCB newFCB; ULONG CurrentCluster; - LARGE_INTEGER SystemTime, LocalTime, FileOffset; + LARGE_INTEGER SystemTime, FileOffset; NTSTATUS Status = STATUS_SUCCESS; PVFATFCB pDirFcb; ULONG size; @@ -360,19 +360,18 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt, } /* set dates and times */ KeQuerySystemTime (&SystemTime); - ExSystemTimeToLocalTime (&SystemTime, &LocalTime); #if 0 { TIME_FIELDS tf; - RtlTimeToTimeFields (&LocalTime, &tf); + RtlTimeToTimeFields (&SystemTime, &tf); DPRINT1("%d.%d.%d %02d:%02d:%02d.%03d '%S'\n", tf.Day, tf.Month, tf.Year, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds, pFileObject->FileName.Buffer); } #endif - FsdFileTimeToDosDateTime ((TIME *) & LocalTime, &DirContext.FatDirEntry.CreationDate, - &DirContext.FatDirEntry.CreationTime); + FsdSystemTimeToDosDateTime (&SystemTime, &DirContext.FatDirEntry.CreationDate, + &DirContext.FatDirEntry.CreationTime); DirContext.FatDirEntry.UpdateDate = DirContext.FatDirEntry.CreationDate; DirContext.FatDirEntry.UpdateTime = DirContext.FatDirEntry.CreationTime; DirContext.FatDirEntry.AccessDate = DirContext.FatDirEntry.CreationDate; @@ -523,8 +522,8 @@ VfatDelEntry (PDEVICE_EXTENSION DeviceExt, PVFATFCB pFcb) LARGE_INTEGER Offset; FATDirEntry* pDirEntry; - assert (pFcb); - assert (pFcb->parentFcb); + ASSERT(pFcb); + ASSERT(pFcb->parentFcb); DPRINT ("delEntry PathName \'%wZ\'\n", &pFcb->PathNameU); DPRINT ("delete entry: %d to %d\n", pFcb->startIndex, pFcb->dirIndex); @@ -537,11 +536,11 @@ VfatDelEntry (PDEVICE_EXTENSION DeviceExt, PVFATFCB pFcb) { CcSetDirtyPinnedData(Context, NULL); CcUnpinData(Context); - } + } Offset.u.LowPart = (i * sizeof(FATDirEntry) / PAGE_SIZE) * PAGE_SIZE; CcMapData (pFcb->parentFcb->FileObject, &Offset, PAGE_SIZE, TRUE, &Context, (PVOID*)&pDirEntry); - } + } pDirEntry[i % (PAGE_SIZE / sizeof(FATDirEntry))].Filename[0] = 0xe5; if (i == pFcb->dirIndex) { diff --git a/reactos/drivers/fs/vfat/fcb.c b/reactos/drivers/fs/vfat/fcb.c index afb919f38d9..01a3031ab33 100644 --- a/reactos/drivers/fs/vfat/fcb.c +++ b/reactos/drivers/fs/vfat/fcb.c @@ -1,4 +1,4 @@ -/* $Id: fcb.c,v 1.41 2004/08/28 22:19:12 navaraf Exp $ +/* $Id: fcb.c,v 1.42 2004/11/06 13:44:57 ekohl Exp $ * * * FILE: drivers/fs/vfat/fcb.c @@ -59,7 +59,7 @@ vfatSplitPathName(PUNICODE_STRING PathNameU, PUNICODE_STRING DirNameU, PUNICODE_ { pName--; } - assert(*pName == L'\\'); + ASSERT(*pName == L'\\'); FileNameU->Buffer = pName + 1; DirNameU->Length = (FileNameU->Buffer - PathNameU->Buffer) * sizeof(WCHAR); DirNameU->MaximumLength = DirNameU->Length; @@ -522,9 +522,9 @@ vfatDirFindFile (PDEVICE_EXTENSION pDeviceExt, BOOLEAN FoundLong = FALSE; BOOLEAN FoundShort = FALSE; - assert (pDeviceExt); - assert (pDirectoryFCB); - assert (FileToFindU); + ASSERT(pDeviceExt); + ASSERT(pDirectoryFCB); + ASSERT(FileToFindU); DPRINT ("vfatDirFindFile(VCB:%08x, dirFCB:%08x, File:%wZ)\n", pDeviceExt, diff --git a/reactos/drivers/fs/vfat/finfo.c b/reactos/drivers/fs/vfat/finfo.c index 69c067dc75d..f46df86280a 100644 --- a/reactos/drivers/fs/vfat/finfo.c +++ b/reactos/drivers/fs/vfat/finfo.c @@ -1,4 +1,4 @@ -/* $Id: finfo.c,v 1.37 2004/08/28 22:19:12 navaraf Exp $ +/* $Id: finfo.c,v 1.38 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -34,8 +34,8 @@ VfatGetStandardInformation(PVFATFCB FCB, return STATUS_BUFFER_OVERFLOW; /* PRECONDITION */ - assert (StandardInfo != NULL); - assert (FCB != NULL); + ASSERT(StandardInfo != NULL); + ASSERT(FCB != NULL); if (vfatFCBIsDirectory(FCB)) { @@ -64,8 +64,9 @@ VfatSetPositionInformation(PFILE_OBJECT FileObject, DPRINT ("PositionInfo %x\n", PositionInfo); DPRINT ("Setting position %d\n", PositionInfo->CurrentByteOffset.u.LowPart); - memcpy (&FileObject->CurrentByteOffset, &PositionInfo->CurrentByteOffset, - sizeof (LARGE_INTEGER)); + + FileObject->CurrentByteOffset.QuadPart = + PositionInfo->CurrentByteOffset.QuadPart; return (STATUS_SUCCESS); } @@ -100,22 +101,22 @@ VfatSetBasicInformation(PFILE_OBJECT FileObject, { DPRINT("VfatSetBasicInformation()\n"); - assert (NULL != FileObject); - assert (NULL != FCB); - assert (NULL != DeviceExt); - assert (NULL != BasicInfo); + ASSERT(NULL != FileObject); + ASSERT(NULL != FCB); + ASSERT(NULL != DeviceExt); + ASSERT(NULL != BasicInfo); /* Check volume label bit */ - assert(0 == (FCB->entry.Attrib & 0x08)); + ASSERT(0 == (FCB->entry.Attrib & 0x08)); - FsdFileTimeToDosDateTime((TIME *)&(BasicInfo->CreationTime), - &(FCB->entry.CreationDate), - &(FCB->entry.CreationTime)); - FsdFileTimeToDosDateTime((TIME *)&(BasicInfo->LastAccessTime), - &(FCB->entry.AccessDate), - NULL); - FsdFileTimeToDosDateTime((TIME *)&(BasicInfo->LastWriteTime), - &(FCB->entry.UpdateDate), - &(FCB->entry.UpdateTime)); + FsdSystemTimeToDosDateTime(&BasicInfo->CreationTime, + &FCB->entry.CreationDate, + &FCB->entry.CreationTime); + FsdSystemTimeToDosDateTime(&BasicInfo->LastAccessTime, + &FCB->entry.AccessDate, + NULL); + FsdSystemTimeToDosDateTime(&BasicInfo->LastWriteTime, + &FCB->entry.UpdateDate, + &FCB->entry.UpdateTime); FCB->entry.Attrib = (unsigned char)((FCB->entry.Attrib & (FILE_ATTRIBUTE_DIRECTORY | 0x48)) | @@ -143,15 +144,15 @@ VfatGetBasicInformation(PFILE_OBJECT FileObject, if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) return STATUS_BUFFER_OVERFLOW; - FsdDosDateTimeToFileTime(FCB->entry.CreationDate, - FCB->entry.CreationTime, - (TIME *)&BasicInfo->CreationTime); - FsdDosDateTimeToFileTime(FCB->entry.AccessDate, - 0, - (TIME *)&BasicInfo->LastAccessTime); - FsdDosDateTimeToFileTime(FCB->entry.UpdateDate, - FCB->entry.UpdateTime, - (TIME *)&BasicInfo->LastWriteTime); + FsdDosDateTimeToSystemTime(FCB->entry.CreationDate, + FCB->entry.CreationTime, + &BasicInfo->CreationTime); + FsdDosDateTimeToSystemTime(FCB->entry.AccessDate, + 0, + &BasicInfo->LastAccessTime); + FsdDosDateTimeToSystemTime(FCB->entry.UpdateDate, + FCB->entry.UpdateTime, + &BasicInfo->LastWriteTime); BasicInfo->ChangeTime = BasicInfo->LastWriteTime; BasicInfo->FileAttributes = FCB->entry.Attrib & 0x3f; @@ -183,9 +184,9 @@ VfatSetDispositionInformation(PFILE_OBJECT FileObject, DPRINT ("FsdSetDispositionInformation()\n"); - assert (DeviceExt != NULL); - assert (DeviceExt->FatInfo.BytesPerCluster != 0); - assert (FCB != NULL); + ASSERT(DeviceExt != NULL); + ASSERT(DeviceExt->FatInfo.BytesPerCluster != 0); + ASSERT(FCB != NULL); if (FCB->entry.Attrib & FILE_ATTRIBUTE_READONLY) { @@ -251,9 +252,8 @@ VfatGetNameInformation(PFILE_OBJECT FileObject, * FUNCTION: Retrieve the file name information */ { - - assert (NameInfo != NULL); - assert (FCB != NULL); + ASSERT(NameInfo != NULL); + ASSERT(FCB != NULL); if (*BufferLength < sizeof(FILE_NAME_INFORMATION) + FCB->PathNameU.Length + sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW; @@ -272,8 +272,8 @@ VfatGetInternalInformation(PVFATFCB Fcb, PFILE_INTERNAL_INFORMATION InternalInfo, PULONG BufferLength) { - assert (InternalInfo); - assert (Fcb); + ASSERT(InternalInfo); + ASSERT(Fcb); if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION)) return STATUS_BUFFER_OVERFLOW; @@ -292,22 +292,22 @@ VfatGetNetworkOpenInformation(PVFATFCB Fcb, * FUNCTION: Retrieve the file network open information */ { - assert (NetworkInfo); - assert (Fcb); + ASSERT(NetworkInfo); + ASSERT(Fcb); if (*BufferLength < sizeof(FILE_NETWORK_OPEN_INFORMATION)) return(STATUS_BUFFER_OVERFLOW); - FsdDosDateTimeToFileTime(Fcb->entry.CreationDate, - Fcb->entry.CreationTime, - &NetworkInfo->CreationTime); - FsdDosDateTimeToFileTime(Fcb->entry.AccessDate, - 0, - &NetworkInfo->LastAccessTime); - FsdDosDateTimeToFileTime(Fcb->entry.UpdateDate, - Fcb->entry.UpdateTime, - &NetworkInfo->LastWriteTime); - NetworkInfo->ChangeTime = NetworkInfo->LastWriteTime; + FsdDosDateTimeToSystemTime(Fcb->entry.CreationDate, + Fcb->entry.CreationTime, + &NetworkInfo->CreationTime); + FsdDosDateTimeToSystemTime(Fcb->entry.AccessDate, + 0, + &NetworkInfo->LastAccessTime); + FsdDosDateTimeToSystemTime(Fcb->entry.UpdateDate, + Fcb->entry.UpdateTime, + &NetworkInfo->LastWriteTime); + NetworkInfo->ChangeTime.QuadPart = NetworkInfo->LastWriteTime.QuadPart; if (vfatFCBIsDirectory(Fcb)) { NetworkInfo->EndOfFile.QuadPart = 0L; @@ -334,24 +334,23 @@ VfatGetAllInformation(PFILE_OBJECT FileObject, * FUNCTION: Retrieve the all file information */ { - - assert (Info); - assert (Fcb); + ASSERT(Info); + ASSERT(Fcb); if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + Fcb->PathNameU.Length + sizeof(WCHAR)) return(STATUS_BUFFER_OVERFLOW); /* Basic Information */ - FsdDosDateTimeToFileTime(Fcb->entry.CreationDate, - Fcb->entry.CreationTime, - (TIME *)&Info->BasicInformation.CreationTime); - FsdDosDateTimeToFileTime(Fcb->entry.AccessDate, - 0, - (TIME *)&Info->BasicInformation.LastAccessTime); - FsdDosDateTimeToFileTime(Fcb->entry.UpdateDate, - Fcb->entry.UpdateTime, - (TIME *)&Info->BasicInformation.LastWriteTime); - Info->BasicInformation.ChangeTime = Info->BasicInformation.LastWriteTime; + FsdDosDateTimeToSystemTime(Fcb->entry.CreationDate, + Fcb->entry.CreationTime, + &Info->BasicInformation.CreationTime); + FsdDosDateTimeToSystemTime(Fcb->entry.AccessDate, + 0, + &Info->BasicInformation.LastAccessTime); + FsdDosDateTimeToSystemTime(Fcb->entry.UpdateDate, + Fcb->entry.UpdateTime, + &Info->BasicInformation.LastWriteTime); + Info->BasicInformation.ChangeTime.QuadPart = Info->BasicInformation.LastWriteTime.QuadPart; Info->BasicInformation.FileAttributes = Fcb->entry.Attrib & 0x3f; /* Standard Information */ @@ -587,7 +586,7 @@ NTSTATUS VfatQueryInformation(PVFAT_IRP_CONTEXT IrpContext) ULONG BufferLength; /* PRECONDITION */ - assert (IrpContext); + ASSERT(IrpContext); /* INITIALIZATION */ FileInformationClass = IrpContext->Stack->Parameters.QueryFile.FileInformationClass; @@ -686,7 +685,7 @@ NTSTATUS VfatSetInformation(PVFAT_IRP_CONTEXT IrpContext) BOOL CanWait = IrpContext->Flags & IRPCONTEXT_CANWAIT; /* PRECONDITION */ - assert(IrpContext); + ASSERT(IrpContext); DPRINT("VfatSetInformation(IrpContext %x)\n", IrpContext); diff --git a/reactos/drivers/fs/vfat/flush.c b/reactos/drivers/fs/vfat/flush.c index 1d91a339c86..9f1bd131e78 100644 --- a/reactos/drivers/fs/vfat/flush.c +++ b/reactos/drivers/fs/vfat/flush.c @@ -1,4 +1,4 @@ -/* $Id: flush.c,v 1.5 2003/10/11 17:51:56 hbirr Exp $ +/* $Id: flush.c,v 1.6 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -117,7 +117,7 @@ NTSTATUS VfatFlush(PVFAT_IRP_CONTEXT IrpContext) } Fcb = (PVFATFCB)IrpContext->FileObject->FsContext; - assert(Fcb); + ASSERT(Fcb); if (Fcb->Flags & FCB_IS_VOLUME) { diff --git a/reactos/drivers/fs/vfat/fsctl.c b/reactos/drivers/fs/vfat/fsctl.c index dad30d5e6b0..be67339d50c 100644 --- a/reactos/drivers/fs/vfat/fsctl.c +++ b/reactos/drivers/fs/vfat/fsctl.c @@ -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.35 2004/08/05 02:48:18 navaraf Exp $ +/* $Id: fsctl.c,v 1.36 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -308,7 +308,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext) DPRINT("VfatMount(IrpContext %x)\n", IrpContext); - assert (IrpContext); + ASSERT(IrpContext); if (IrpContext->DeviceObject != VfatGlobalData->DeviceObject) { @@ -688,9 +688,9 @@ NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext) DPRINT("VfatFileSystemControl(IrpContext %x)\n", IrpContext); - assert (IrpContext); - assert (IrpContext->Irp); - assert (IrpContext->Stack); + ASSERT(IrpContext); + ASSERT(IrpContext->Irp); + ASSERT(IrpContext->Stack); IrpContext->Irp->IoStatus.Information = 0; diff --git a/reactos/drivers/fs/vfat/misc.c b/reactos/drivers/fs/vfat/misc.c index fe2eb8fb853..be1a82b9c61 100644 --- a/reactos/drivers/fs/vfat/misc.c +++ b/reactos/drivers/fs/vfat/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.13 2004/05/15 23:00:02 hbirr Exp $ +/* $Id: misc.c,v 1.14 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -30,8 +30,8 @@ NTSTATUS VfatLockControl( NTSTATUS Status; DPRINT("VfatLockControl(IrpContext %x)\n", IrpContext); - - assert(IrpContext); + + ASSERT(IrpContext); Fcb = (PVFATFCB)IrpContext->FileObject->FsContext; @@ -67,7 +67,7 @@ NTSTATUS VfatDispatchRequest ( { DPRINT ("VfatDispatchRequest (IrpContext %x), MajorFunction %x\n", IrpContext, IrpContext->MajorFunction); - assert (IrpContext); + ASSERT(IrpContext); switch (IrpContext->MajorFunction) { @@ -115,8 +115,8 @@ NTSTATUS STDCALL VfatBuildRequest ( DPRINT ("VfatBuildRequest (DeviceObject %x, Irp %x)\n", DeviceObject, Irp); - assert (DeviceObject); - assert (Irp); + ASSERT(DeviceObject); + ASSERT(Irp); IrpContext = VfatAllocateIrpContext(DeviceObject, Irp); if (IrpContext == NULL) { @@ -147,7 +147,7 @@ NTSTATUS STDCALL VfatBuildRequest ( VOID VfatFreeIrpContext (PVFAT_IRP_CONTEXT IrpContext) { - assert (IrpContext); + ASSERT(IrpContext); ExFreeToNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList, IrpContext); } @@ -158,8 +158,8 @@ PVFAT_IRP_CONTEXT VfatAllocateIrpContext(PDEVICE_OBJECT DeviceObject, PIRP Irp) UCHAR MajorFunction; DPRINT ("VfatAllocateIrpContext(DeviceObject %x, Irp %x)\n", DeviceObject, Irp); - assert (DeviceObject); - assert (Irp); + ASSERT(DeviceObject); + ASSERT(Irp); IrpContext = ExAllocateFromNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList); if (IrpContext) @@ -169,7 +169,7 @@ PVFAT_IRP_CONTEXT VfatAllocateIrpContext(PDEVICE_OBJECT DeviceObject, PIRP Irp) IrpContext->DeviceObject = DeviceObject; IrpContext->DeviceExt = DeviceObject->DeviceExtension; IrpContext->Stack = IoGetCurrentIrpStackLocation(Irp); - assert (IrpContext->Stack); + ASSERT(IrpContext->Stack); MajorFunction = IrpContext->MajorFunction = IrpContext->Stack->MajorFunction; IrpContext->MinorFunction = IrpContext->Stack->MinorFunction; IrpContext->FileObject = IrpContext->Stack->FileObject; @@ -207,8 +207,8 @@ NTSTATUS VfatQueueRequest(PVFAT_IRP_CONTEXT IrpContext) InterlockedIncrement(&QueueCount); DPRINT ("VfatQueueRequest (IrpContext %x), %d\n", IrpContext, QueueCount); - assert (IrpContext != NULL); - assert (IrpContext->Irp != NULL); + ASSERT(IrpContext != NULL); + ASSERT(IrpContext->Irp != NULL); IrpContext->Flags |= IRPCONTEXT_CANWAIT; IoMarkIrpPending (IrpContext->Irp); @@ -219,7 +219,7 @@ NTSTATUS VfatQueueRequest(PVFAT_IRP_CONTEXT IrpContext) PVOID VfatGetUserBuffer(IN PIRP Irp) { - assert(Irp); + ASSERT(Irp); if (Irp->MdlAddress) { @@ -233,7 +233,7 @@ PVOID VfatGetUserBuffer(IN PIRP Irp) NTSTATUS VfatLockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation) { - assert(Irp); + ASSERT(Irp); if (Irp->MdlAddress) { diff --git a/reactos/drivers/fs/vfat/rw.c b/reactos/drivers/fs/vfat/rw.c index 412a57f47a0..219c95fc7af 100644 --- a/reactos/drivers/fs/vfat/rw.c +++ b/reactos/drivers/fs/vfat/rw.c @@ -1,5 +1,5 @@ -/* $Id: rw.c,v 1.70 2004/09/28 10:52:55 ekohl Exp $ +/* $Id: rw.c,v 1.71 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -142,12 +142,12 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, ULONG LastOffset; /* PRECONDITION */ - assert (IrpContext); + ASSERT(IrpContext); DeviceExt = IrpContext->DeviceExt; - assert (DeviceExt); - assert (DeviceExt->FatInfo.BytesPerCluster); - assert (IrpContext->FileObject); - assert (IrpContext->FileObject->FsContext2 != NULL); + ASSERT(DeviceExt); + ASSERT(DeviceExt->FatInfo.BytesPerCluster); + ASSERT(IrpContext->FileObject); + ASSERT(IrpContext->FileObject->FsContext2 != NULL); DPRINT("VfatReadFileData(DeviceExt %x, FileObject %x, " "Length %d, ReadOffset 0x%I64x)\n", DeviceExt, @@ -160,9 +160,9 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, BytesPerSector = DeviceExt->FatInfo.BytesPerSector; BytesPerCluster = DeviceExt->FatInfo.BytesPerCluster; - assert(ReadOffset.QuadPart + Length <= ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector)); - assert(ReadOffset.u.LowPart % BytesPerSector == 0); - assert(Length % BytesPerSector == 0); + ASSERT(ReadOffset.QuadPart + Length <= ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector)); + ASSERT(ReadOffset.u.LowPart % BytesPerSector == 0); + ASSERT(Length % BytesPerSector == 0); /* Is this a read of the FAT? */ if (Fcb->Flags & FCB_IS_FAT) @@ -356,12 +356,12 @@ VfatWriteFileData(PVFAT_IRP_CONTEXT IrpContext, ULONG LastOffset; /* PRECONDITION */ - assert (IrpContext); + ASSERT(IrpContext); DeviceExt = IrpContext->DeviceExt; - assert (DeviceExt); - assert (DeviceExt->FatInfo.BytesPerCluster); - assert (IrpContext->FileObject); - assert (IrpContext->FileObject->FsContext2 != NULL); + ASSERT(DeviceExt); + ASSERT(DeviceExt->FatInfo.BytesPerCluster); + ASSERT(IrpContext->FileObject); + ASSERT(IrpContext->FileObject->FsContext2 != NULL); Ccb = (PVFATCCB)IrpContext->FileObject->FsContext2; Fcb = IrpContext->FileObject->FsContext; @@ -373,9 +373,9 @@ VfatWriteFileData(PVFAT_IRP_CONTEXT IrpContext, IrpContext->FileObject, Length, WriteOffset, &Fcb->PathNameU); - assert(WriteOffset.QuadPart + Length <= Fcb->RFCB.AllocationSize.QuadPart); - assert(WriteOffset.u.LowPart % BytesPerSector == 0); - assert(Length % BytesPerSector == 0) + ASSERT(WriteOffset.QuadPart + Length <= Fcb->RFCB.AllocationSize.QuadPart); + ASSERT(WriteOffset.u.LowPart % BytesPerSector == 0); + ASSERT(Length % BytesPerSector == 0) // Is this a write of the volume ? if (Fcb->Flags & FCB_IS_VOLUME) @@ -422,7 +422,7 @@ VfatWriteFileData(PVFAT_IRP_CONTEXT IrpContext, if (FirstCluster == 1) { - assert(WriteOffset.u.LowPart + Length <= DeviceExt->FatInfo.rootDirectorySectors * BytesPerSector); + ASSERT(WriteOffset.u.LowPart + Length <= DeviceExt->FatInfo.rootDirectorySectors * BytesPerSector); // Directory of FAT12/16 needs a special handling WriteOffset.u.LowPart += DeviceExt->FatInfo.rootStart * BytesPerSector; // Fire up the write command @@ -555,11 +555,11 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) PDEVICE_OBJECT DeviceToVerify; ULONG BytesPerSector; - assert(IrpContext); + ASSERT(IrpContext); DPRINT("VfatRead(IrpContext %x)\n", IrpContext); - assert(IrpContext->DeviceObject); + ASSERT(IrpContext->DeviceObject); // This request is not allowed on the main device object if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject) @@ -569,10 +569,10 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) goto ByeBye; } - assert(IrpContext->DeviceExt); - assert(IrpContext->FileObject); + ASSERT(IrpContext->DeviceExt); + ASSERT(IrpContext->FileObject); Fcb = IrpContext->FileObject->FsContext; - assert(Fcb); + ASSERT(Fcb); DPRINT("<%wZ>\n", &Fcb->PathNameU); @@ -788,11 +788,11 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext) PVOID Buffer; ULONG BytesPerSector; - assert (IrpContext); + ASSERT(IrpContext); DPRINT("VfatWrite(IrpContext %x)\n", IrpContext); - assert(IrpContext->DeviceObject); + ASSERT(IrpContext->DeviceObject); // This request is not allowed on the main device object if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject) @@ -802,10 +802,10 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext) goto ByeBye; } - assert(IrpContext->DeviceExt); - assert(IrpContext->FileObject); + ASSERT(IrpContext->DeviceExt); + ASSERT(IrpContext->FileObject); Fcb = IrpContext->FileObject->FsContext; - assert(Fcb); + ASSERT(Fcb); DPRINT("<%wZ>\n", &Fcb->PathNameU); @@ -1022,12 +1022,11 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext) { if(!(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY)) { - LARGE_INTEGER SystemTime, LocalTime; + LARGE_INTEGER SystemTime; // set dates and times KeQuerySystemTime (&SystemTime); - ExSystemTimeToLocalTime (&SystemTime, &LocalTime); - FsdFileTimeToDosDateTime ((TIME*)&LocalTime, &Fcb->entry.UpdateDate, - &Fcb->entry.UpdateTime); + FsdSystemTimeToDosDateTime (&SystemTime, &Fcb->entry.UpdateDate, + &Fcb->entry.UpdateTime); Fcb->entry.AccessDate = Fcb->entry.UpdateDate; /* set date and times to dirty */ Fcb->Flags |= FCB_IS_DIRTY; diff --git a/reactos/drivers/fs/vfat/vfat.h b/reactos/drivers/fs/vfat/vfat.h index 4fa4834c5c3..c0e06ed951b 100644 --- a/reactos/drivers/fs/vfat/vfat.h +++ b/reactos/drivers/fs/vfat/vfat.h @@ -1,4 +1,4 @@ -/* $Id: vfat.h,v 1.68 2004/08/28 22:19:12 navaraf Exp $ */ +/* $Id: vfat.h,v 1.69 2004/11/06 13:44:57 ekohl Exp $ */ #include @@ -379,13 +379,13 @@ NTSTATUS VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, NTSTATUS VfatDirectoryControl (PVFAT_IRP_CONTEXT); -BOOL FsdDosDateTimeToFileTime (WORD wDosDate, - WORD wDosTime, - TIME *FileTime); +BOOL FsdDosDateTimeToSystemTime (WORD wDosDate, + WORD wDosTime, + PLARGE_INTEGER SystemTime); -BOOL FsdFileTimeToDosDateTime (TIME *FileTime, - WORD *pwDosDate, - WORD *pwDosTime); +BOOL FsdSystemTimeToDosDateTime (PLARGE_INTEGER SystemTime, + WORD *pwDosDate, + WORD *pwDosTime); /* -------------------------------------------------------- create.c */ diff --git a/reactos/drivers/fs/vfat/volume.c b/reactos/drivers/fs/vfat/volume.c index da5dffd79ee..ddf1aae7129 100644 --- a/reactos/drivers/fs/vfat/volume.c +++ b/reactos/drivers/fs/vfat/volume.c @@ -1,4 +1,4 @@ -/* $Id: volume.c,v 1.26 2004/08/01 21:57:18 navaraf Exp $ +/* $Id: volume.c,v 1.27 2004/11/06 13:44:57 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -179,7 +179,7 @@ NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext) ULONG BufferLength; /* PRECONDITION */ - assert(IrpContext); + ASSERT(IrpContext); DPRINT("VfatQueryVolumeInformation(IrpContext %x)\n", IrpContext); @@ -253,7 +253,7 @@ NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext) PEXTENDED_IO_STACK_LOCATION Stack = (PEXTENDED_IO_STACK_LOCATION) IrpContext->Stack; /* PRECONDITION */ - assert(IrpContext); + ASSERT(IrpContext); DPRINT1("VfatSetVolumeInformation(IrpContext %x)\n", IrpContext);