ReactOS 0.4.16-dev-91-g764881a
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 PAGED_CODE()
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define CanFsdWait(I)
Definition: cdprocs.h:2001
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define Dbg
Definition: dirctrl.c:29
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
Definition: fatdata.c:204
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
Definition: fatdata.c:817
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
Definition: fatprocs.h:2418
PIRP_CONTEXT FatCreateIrpContext(IN PIRP Irp, IN BOOLEAN Wait)
Definition: strucsup.c:2301
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164

◆ 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) ==
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}
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:427
#define UNALIGNED
Definition: crtdefs.h:144
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
LARGE_INTEGER FatJanOne1980
Definition: fatdata.c:73
FAT_DATA FatData
Definition: fatdata.c:56
LARGE_INTEGER FatFatTimeToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_TIME_STAMP FatTime, _In_ UCHAR TenMilliSeconds)
Definition: timesup.c:233
LARGE_INTEGER FatFatDateToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_DATE FatDate)
Definition: timesup.c:171
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
long LONG
Definition: pedump.c:60
BOOLEAN ChicagoMode
Definition: fatstruc.h:87
Definition: fat.h:265
USHORT Hour
Definition: fat.h:269
USHORT DoubleSeconds
Definition: fat.h:267
USHORT Minute
Definition: fat.h:268
LONGLONG CreationTime
Definition: cdstruc.h:1030
LARGE_INTEGER LastWriteTime
Definition: fatstruc.h:922
LARGE_INTEGER CreationTime
Definition: winternl.h:516
LARGE_INTEGER LastWriteTime
Definition: winternl.h:518
LARGE_INTEGER LastAccessTime
Definition: winternl.h:517
uint16_t * PUSHORT
Definition: typedefs.h:56
LONGLONG QuadPart
Definition: typedefs.h:114

Variable Documentation

◆ Fat8QMdot3QM

WCHAR Fat8QMdot3QM[12]
Initial value:
#define DOS_QM
Definition: env_spec_w32.h:913
#define L(x)
Definition: ntvdm.h:50

Definition at line 31 of file dirctrl.c.