ReactOS  0.4.15-dev-509-g96a357b
dirctrl.c File Reference
#include "fatprocs.h"
Include dependency graph for dirctrl.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (FAT_BUG_CHECK_DIRCTRL)
 
#define Dbg   (DEBUG_TRACE_DIRCTRL)
 

Functions

 _Requires_lock_held_ (_Global_critical_region_)
 
VOID FatGetDirTimes (PIRP_CONTEXT IrpContext, PDIRENT Dirent, PFILE_DIRECTORY_INFORMATION DirInfo)
 

Variables

WCHAR Fat8QMdot3QM [12]
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (FAT_BUG_CHECK_DIRCTRL)

Definition at line 23 of file dirctrl.c.

◆ Dbg

#define Dbg   (DEBUG_TRACE_DIRCTRL)

Definition at line 29 of file dirctrl.c.

Function Documentation

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

Definition at line 38 of file dirctrl.c.

97 {
99  PIRP_CONTEXT IrpContext = NULL;
100 
102 
103  PAGED_CODE();
104 
105  DebugTrace(+1, Dbg, "FatFsdDirectoryControl\n", 0);
106 
107  //
108  // Call the common directory Control routine, with blocking allowed if
109  // synchronous
110  //
111 
113 
115 
116  _SEH2_TRY {
117 
118  IrpContext = FatCreateIrpContext( Irp, CanFsdWait( Irp ) );
119 
120  Status = FatCommonDirectoryControl( IrpContext, Irp );
121 
123 
124  //
125  // We had some trouble trying to perform the requested
126  // operation, so we'll abort the I/O request with
127  // the error status that we get back from the
128  // execption code
129  //
130 
131  Status = FatProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
132  } _SEH2_END;
133 
134  if (TopLevel) { IoSetTopLevelIrp( NULL ); }
135 
137 
138  //
139  // And return to our caller
140  //
141 
142  DebugTrace(-1, Dbg, "FatFsdDirectoryControl -> %08lx\n", Status);
143 
144  UNREFERENCED_PARAMETER( VolumeDeviceObject );
145 
146  return Status;
147 }
#define FsRtlEnterFileSystem
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
Definition: fatdata.c:817
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTSTATUS
Definition: precomp.h:26
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
_SEH2_TRY
Definition: create.c:4226
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
Definition: fatprocs.h:2410
#define Dbg
Definition: dirctrl.c:29
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
PIRP_CONTEXT FatCreateIrpContext(IN PIRP Irp, IN BOOLEAN Wait)
Definition: strucsup.c:2289
#define CanFsdWait(I)
Definition: cdprocs.h:2001
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4400
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
Definition: fatdata.c:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define PAGED_CODE()

◆ FatGetDirTimes()

VOID FatGetDirTimes ( PIRP_CONTEXT  IrpContext,
PDIRENT  Dirent,
PFILE_DIRECTORY_INFORMATION  DirInfo 
)

Definition at line 1330 of file dirctrl.c.

1355 {
1356  PAGED_CODE();
1357 
1358  //
1359  // Start with the Last Write Time.
1360  //
1361 
1362  DirInfo->LastWriteTime =
1363  FatFatTimeToNtTime( IrpContext,
1365  0 );
1366 
1367  //
1368  // These fields are only non-zero when in Chicago mode.
1369  //
1370 
1371  if (FatData.ChicagoMode) {
1372 
1373  //
1374  // Do a quick check here for Creation and LastAccess
1375  // times that are the same as the LastWriteTime.
1376  //
1377 
1378  if (*((UNALIGNED LONG *)&Dirent->CreationTime) ==
1379  *((UNALIGNED LONG *)&Dirent->LastWriteTime)) {
1380 
1381  DirInfo->CreationTime.QuadPart =
1382 
1383  DirInfo->LastWriteTime.QuadPart +
1384  Dirent->CreationMSec * 10 * 1000 * 10;
1385 
1386  } else {
1387 
1388  //
1389  // Only do the really hard work if this field is non-zero.
1390  //
1391 
1392  if (((PUSHORT)Dirent)[8] != 0) {
1393 
1394  DirInfo->CreationTime =
1395  FatFatTimeToNtTime( IrpContext,
1397  Dirent->CreationMSec );
1398 
1399  } else {
1400 
1402  &DirInfo->CreationTime );
1403  }
1404  }
1405 
1406  //
1407  // Do a quick check for LastAccessDate.
1408  //
1409 
1410  if (*((PUSHORT)&Dirent->LastAccessDate) ==
1411  *((PUSHORT)&Dirent->LastWriteTime.Date)) {
1412 
1413  PFAT_TIME WriteTime;
1414 
1415  WriteTime = &Dirent->LastWriteTime.Time;
1416 
1417  DirInfo->LastAccessTime.QuadPart =
1418  DirInfo->LastWriteTime.QuadPart -
1419  UInt32x32To64(((WriteTime->DoubleSeconds * 2) +
1420  (WriteTime->Minute * 60) +
1421  (WriteTime->Hour * 60 * 60)),
1422  1000 * 1000 * 10);
1423 
1424  } else {
1425 
1426  //
1427  // Only do the really hard work if this field is non-zero.
1428  //
1429 
1430  if (((PUSHORT)Dirent)[9] != 0) {
1431 
1432  DirInfo->LastAccessTime =
1433  FatFatDateToNtTime( IrpContext,
1434  Dirent->LastAccessDate );
1435 
1436  } else {
1437 
1439  &DirInfo->LastAccessTime );
1440  }
1441  }
1442  }
1443 }
LARGE_INTEGER LastAccessTime
Definition: winternl.h:517
LONGLONG CreationTime
Definition: cdstruc.h:1036
LARGE_INTEGER LastWriteTime
Definition: fatstruc.h:921
LARGE_INTEGER FatFatDateToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_DATE FatDate)
Definition: timesup.c:171
USHORT Hour
Definition: fat.h:269
Definition: fat.h:265
BOOLEAN ChicagoMode
Definition: fatstruc.h:86
LARGE_INTEGER FatFatTimeToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_TIME_STAMP FatTime, _In_ UCHAR TenMilliSeconds)
Definition: timesup.c:233
long LONG
Definition: pedump.c:60
LARGE_INTEGER FatJanOne1980
Definition: fatdata.c:73
USHORT DoubleSeconds
Definition: fat.h:267
#define UNALIGNED
Definition: crtdefs.h:132
FAT_DATA FatData
Definition: fatdata.c:56
LARGE_INTEGER LastWriteTime
Definition: winternl.h:518
USHORT Minute
Definition: fat.h:268
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
LARGE_INTEGER CreationTime
Definition: winternl.h:516
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:424
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
unsigned short * PUSHORT
Definition: retypes.h:2
LONGLONG QuadPart
Definition: typedefs.h:113
#define PAGED_CODE()

Variable Documentation

◆ Fat8QMdot3QM

WCHAR Fat8QMdot3QM[12]
Initial value:
#define DOS_QM
Definition: env_spec_w32.h:913
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 31 of file dirctrl.c.