Author: pschweitzer
Date: Mon Jul 14 04:56:24 2008
New Revision: 34502
URL:
http://svn.reactos.org/svn/reactos?rev=34502&view=rev
Log:
- Switched more files to PSEH use
- Also fixed some warnings
Modified:
branches/pierre-fsd/drivers/filesystems/ext3fsd/devctl.c
branches/pierre-fsd/drivers/filesystems/ext3fsd/dirctl.c
branches/pierre-fsd/drivers/filesystems/ext3fsd/dispatch.c
branches/pierre-fsd/drivers/filesystems/ext3fsd/except.c
branches/pierre-fsd/drivers/filesystems/ext3fsd/fastio.c
Modified: branches/pierre-fsd/drivers/filesystems/ext3fsd/devctl.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/ext3fsd/devctl.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/ext3fsd/devctl.c [iso-8859-1] Mon Jul 14
04:56:24 2008
@@ -4,7 +4,9 @@
* FILE: devctl.c
* PROGRAMMER: Matt Wu <mattwu(a)163.com>
* HOMEPAGE:
http://ext2.yeah.net
- * UPDATE HISTORY:
+ * UPDATE HISTORY: 13 Jul 2008 (Pierre Schweitzer <heis_spiter(a)hotmail.com>)
+ * Replaced SEH support with PSEH support
+ * Fixed some warnings under GCC
*/
/* INCLUDES *****************************************************************/
@@ -23,6 +25,23 @@
IN PIRP Irp,
IN PVOID Context);
+VOID
+Ext2DeviceControlNormalFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN BOOLEAN CompleteRequest,
+ IN PNTSTATUS pStatus);
+
+/* Also used by Ex2ProcessMountPoint() */
+VOID
+Ext2ProcessUserPropertyFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus);
+
+VOID
+Ex2ProcessUserPerfStatFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus,
+ IN BOOLEAN GlobalDataResourceAcquired);
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, Ext2DeviceControl)
@@ -38,6 +57,9 @@
#endif
+/* FUNCTIONS ***************************************************************/
+
+
NTSTATUS
Ext2DeviceControlCompletion (
IN PDEVICE_OBJECT DeviceObject,
@@ -52,12 +74,42 @@
return STATUS_SUCCESS;
}
+_SEH_DEFINE_LOCALS(Ext2DeviceControlNormalFinal)
+{
+ IN PEXT2_IRP_CONTEXT IrpContext;
+ IN BOOLEAN CompleteRequest;
+ IN PNTSTATUS pStatus;
+};
+
+_SEH_FINALLYFUNC(Ext2DeviceControlNormalFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2DeviceControlNormalFinal);
+ Ext2DeviceControlNormalFinal(_SEH_VAR(IrpContext), _SEH_VAR(CompleteRequest),
+ _SEH_VAR(pStatus));
+}
+
+VOID
+Ext2DeviceControlNormalFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN BOOLEAN CompleteRequest,
+ IN PNTSTATUS pStatus
+ )
+{
+ if (!IrpContext->ExceptionInProgress) {
+ if (IrpContext) {
+ if (!CompleteRequest) {
+ IrpContext->Irp = NULL;
+ }
+
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+ }
+}
NTSTATUS
Ext2DeviceControlNormal (IN PEXT2_IRP_CONTEXT IrpContext)
{
PDEVICE_OBJECT DeviceObject;
- BOOLEAN CompleteRequest = TRUE;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
PEXT2_VCB Vcb;
@@ -68,20 +120,25 @@
PDEVICE_OBJECT TargetDeviceObject;
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2DeviceControlNormalFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(CompleteRequest) = TRUE;
+ _SEH_VAR(pStatus) = &Status;
ASSERT(IrpContext != NULL);
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
(IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
- CompleteRequest = TRUE;
+ _SEH_VAR(CompleteRequest) = TRUE;
DeviceObject = IrpContext->DeviceObject;
if (IsExt2FsDevice(DeviceObject)) {
Status = STATUS_INVALID_DEVICE_REQUEST;
- __leave;
+ _SEH_LEAVE;
}
Irp = IrpContext->Irp;
@@ -92,7 +149,7 @@
if (!((Vcb) && (Vcb->Identifier.Type == EXT2VCB) &&
(Vcb->Identifier.Size == sizeof(EXT2_VCB)))) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
TargetDeviceObject = Vcb->TargetDeviceObject;
@@ -101,7 +158,7 @@
// Pass on the IOCTL to the driver below
//
- CompleteRequest = FALSE;
+ _SEH_VAR(CompleteRequest) = FALSE;
NextIrpSp = IoGetNextIrpStackLocation( Irp );
*NextIrpSp = *IrpSp;
@@ -116,18 +173,9 @@
Status = IoCallDriver(TargetDeviceObject, Irp);
- } __finally {
-
- if (!IrpContext->ExceptionInProgress) {
- if (IrpContext) {
- if (!CompleteRequest) {
- IrpContext->Irp = NULL;
- }
-
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- }
- }
+ }
+ _SEH_FINALLY(Ext2DeviceControlNormalFinal_PSEH)
+ _SEH_END;
return Status;
}
@@ -438,6 +486,29 @@
return Status;
}
+_SEH_DEFINE_LOCALS(Ext2ProcessUserPropertyFinal)
+{
+ IN PEXT2_IRP_CONTEXT IrpContext;
+ IN PNTSTATUS pStatus;
+};
+
+_SEH_FINALLYFUNC(Ext2ProcessUserPropertyFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2DeviceControlNormalFinal);
+ Ext2ProcessUserPropertyFinal(_SEH_VAR(IrpContext), _SEH_VAR(pStatus));
+}
+
+VOID
+Ext2ProcessUserPropertyFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus
+ )
+{
+ if (!IrpContext->ExceptionInProgress) {
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+}
+
NTSTATUS
Ext2ProcessUserProperty(
IN PEXT2_IRP_CONTEXT IrpContext,
@@ -449,7 +520,11 @@
PEXT2_VCB Vcb = NULL;
PDEVICE_OBJECT DeviceObject = NULL;
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2ProcessUserPropertyFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(pStatus) = &Status;
ASSERT(IrpContext != NULL);
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
@@ -457,7 +532,7 @@
if (Property->Magic != EXT2_VOLUME_PROPERTY_MAGIC) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
DeviceObject = IrpContext->DeviceObject;
@@ -468,7 +543,7 @@
if (!((Vcb) && (Vcb->Identifier.Type == EXT2VCB) &&
(Vcb->Identifier.Size == sizeof(EXT2_VCB)))) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
Status = Ext2ProcessVolumeProperty(Vcb, Property);
}
@@ -477,14 +552,41 @@
IrpContext->Irp->IoStatus.Information = Length;
}
- } __finally {
-
- if (!IrpContext->ExceptionInProgress) {
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- }
+ }
+ _SEH_FINALLY(Ext2ProcessUserPropertyFinal_PSEH)
+ _SEH_END;
return Status;
+}
+
+_SEH_DEFINE_LOCALS(Ex2ProcessUserPerfStatFinal)
+{
+ IN PEXT2_IRP_CONTEXT IrpContext;
+ IN PNTSTATUS pStatus;
+ IN BOOLEAN GlobalDataResourceAcquired;
+};
+
+_SEH_FINALLYFUNC(Ex2ProcessUserPerfStatFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ex2ProcessUserPerfStatFinal);
+ Ex2ProcessUserPerfStatFinal(_SEH_VAR(IrpContext), _SEH_VAR(pStatus),
+ _SEH_VAR(GlobalDataResourceAcquired));
+}
+
+VOID
+Ex2ProcessUserPerfStatFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus,
+ IN BOOLEAN GlobalDataResourceAcquired
+ )
+{
+ if (GlobalDataResourceAcquired) {
+ ExReleaseResourceLite(&Ext2Global->Resource);
+ }
+
+ if (!IrpContext->ExceptionInProgress) {
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
}
NTSTATUS
@@ -495,12 +597,15 @@
)
{
NTSTATUS Status = STATUS_SUCCESS;
- PEXT2_VCB Vcb = NULL;
- BOOLEAN GlobalDataResourceAcquired = FALSE;
PDEVICE_OBJECT DeviceObject = NULL;
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ex2ProcessUserPerfStatFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(pStatus) = &Status;
+ _SEH_VAR(GlobalDataResourceAcquired) = FALSE;
ASSERT(IrpContext != NULL);
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
@@ -511,45 +616,51 @@
if (QueryPerf->Magic != EXT2_QUERY_PERFSTAT_MAGIC) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
if (QueryPerf->Command != IOCTL_APP_QUERY_PERFSTAT) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
if (Length < sizeof(EXT2_QUERY_PERFSTAT)) {
Status = STATUS_BUFFER_OVERFLOW;
- __leave;
+ _SEH_LEAVE;
}
ExAcquireResourceSharedLite(&Ext2Global->Resource, TRUE);
- GlobalDataResourceAcquired = TRUE;
+ _SEH_VAR(GlobalDataResourceAcquired) = TRUE;
QueryPerf->PerfStat = Ext2Global->PerfStat;
} else {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
if (NT_SUCCESS(Status)) {
IrpContext->Irp->IoStatus.Information = Length;
}
- } __finally {
-
- if (GlobalDataResourceAcquired) {
- ExReleaseResourceLite(&Ext2Global->Resource);
- }
-
- if (!IrpContext->ExceptionInProgress) {
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- }
+ }
+ _SEH_FINALLY(Ex2ProcessUserPerfStatFinal_PSEH)
+ _SEH_END;
return Status;
+}
+
+_SEH_DEFINE_LOCALS(Ex2ProcessMountPointFinal)
+{
+ IN PEXT2_IRP_CONTEXT IrpContext;
+ IN PNTSTATUS pStatus;
+};
+
+/* Use Ext2ProcessUserProperty() PSEH final function */
+_SEH_FINALLYFUNC(Ex2ProcessMountPointFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ex2ProcessMountPointFinal);
+ Ext2ProcessUserPropertyFinal(_SEH_VAR(IrpContext), _SEH_VAR(pStatus));
}
NTSTATUS
@@ -566,7 +677,11 @@
PDEVICE_OBJECT DeviceObject = NULL;
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ex2ProcessMountPointFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(pStatus) = &status;
ASSERT(IrpContext != NULL);
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
@@ -575,13 +690,13 @@
DeviceObject = IrpContext->DeviceObject;
if (!IsExt2FsDevice(DeviceObject)) {
status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
if (Length != sizeof(EXT2_MOUNT_POINT) ||
MountPoint->Magic != EXT2_APP_MOUNTPOINT_MAGIC) {
status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
RtlInitUnicodeString(&Link, Buffer);
@@ -602,12 +717,9 @@
status = STATUS_INVALID_PARAMETER;
}
- } __finally {
-
- if (!IrpContext->ExceptionInProgress) {
- Ext2CompleteIrpContext(IrpContext, status);
- }
- }
+ }
+ _SEH_FINALLY(Ex2ProcessMountPointFinal_PSEH)
+ _SEH_END;
return status;
}
Modified: branches/pierre-fsd/drivers/filesystems/ext3fsd/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/ext3fsd/dirctl.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/ext3fsd/dirctl.c [iso-8859-1] Mon Jul 14
04:56:24 2008
@@ -4,7 +4,9 @@
* FILE: dirctl.c
* PROGRAMMER: Matt Wu <mattwu(a)163.com>
* HOMEPAGE:
http://ext2.yeah.net
- * UPDATE HISTORY:
+ * UPDATE HISTORY: 14 Jul 2008 (Pierre Schweitzer <heis_spiter(a)hotmail.com>)
+ * Replaced SEH support with PSEH support
+ * Fixed some warnings under GCC
*/
/* INCLUDES *****************************************************************/
@@ -16,6 +18,29 @@
extern PEXT2_GLOBAL Ext2Global;
/* DEFINITIONS *************************************************************/
+
+VOID
+Ext2QueryDirectoryFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus,
+ IN PEXT2_FCB Fcb,
+ IN ULONG Length,
+ IN BOOLEAN FcbResourceAcquired,
+ IN ULONG UsedLength,
+ IN PUNICODE_STRING InodeFileName,
+ IN PEXT2_DIR_ENTRY2 pDir );
+
+VOID
+Ext2NotifyChangeDirectoryFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN BOOLEAN CompleteRequest,
+ IN PNTSTATUS pStatus,
+ IN PEXT2_FCB Fcb,
+ IN BOOLEAN bFcbAcquired );
+
+VOID
+Ext2IsDirectoryEmptyFinal (
+ IN PEXT2_DIR_ENTRY2 pTarget );
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, Ext2GetInfoLength)
@@ -25,6 +50,10 @@
#pragma alloc_text(PAGE, Ext2DirectoryControl)
#pragma alloc_text(PAGE, Ext2IsDirectoryEmpty)
#endif
+
+
+/* FUNCTIONS ***************************************************************/
+
ULONG
Ext2GetInfoLength(IN FILE_INFORMATION_CLASS FileInformationClass)
@@ -81,7 +110,6 @@
ULONG InfoLength = 0;
ULONG NameLength = 0;
- ULONG dwBytes = 0;
LONGLONG FileSize = 0;
LONGLONG AllocationSize;
ULONG FileAttributes = 0;
@@ -504,6 +532,77 @@
return FALSE;
}
+_SEH_DEFINE_LOCALS(Ext2QueryDirectoryFinal)
+{
+ PEXT2_IRP_CONTEXT IrpContext;
+ PNTSTATUS pStatus;
+ PEXT2_FCB Fcb;
+ ULONG Length;
+ BOOLEAN FcbResourceAcquired;
+ ULONG UsedLength;
+ PUNICODE_STRING InodeFileName;
+ PEXT2_DIR_ENTRY2 pDir;
+};
+
+_SEH_FINALLYFUNC(Ext2QueryDirectoryFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2QueryDirectoryFinal);
+ Ext2QueryDirectoryFinal(_SEH_VAR(IrpContext), _SEH_VAR(pStatus),
+ _SEH_VAR(Fcb), _SEH_VAR(Length),
+ _SEH_VAR(FcbResourceAcquired),
+ _SEH_VAR(UsedLength), _SEH_VAR(InodeFileName),
+ _SEH_VAR(pDir));
+}
+
+VOID
+Ext2QueryDirectoryFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN PNTSTATUS pStatus,
+ IN PEXT2_FCB Fcb,
+ IN ULONG Length,
+ IN BOOLEAN FcbResourceAcquired,
+ IN ULONG UsedLength,
+ IN PUNICODE_STRING InodeFileName,
+ IN PEXT2_DIR_ENTRY2 pDir
+ )
+{
+ if (FcbResourceAcquired) {
+ ExReleaseResourceLite(&Fcb->MainResource);
+ }
+
+ if (pDir != NULL) {
+ ExFreePoolWithTag(pDir, EXT2_DENTRY_MAGIC);
+ DEC_MEM_COUNT(PS_DIR_ENTRY, pDir, sizeof(EXT2_DIR_ENTRY2));
+ }
+
+ if (InodeFileName->Buffer != NULL) {
+ DEC_MEM_COUNT(PS_INODE_NAME, InodeFileName->Buffer,
+ InodeFileName->MaximumLength );
+ ExFreePoolWithTag(InodeFileName->Buffer, EXT2_INAME_MAGIC);
+ }
+
+ if (!IrpContext->ExceptionInProgress) {
+
+ if ( *pStatus == STATUS_PENDING ||
+ *pStatus == STATUS_CANT_WAIT) {
+
+ *pStatus = Ext2LockUserBuffer(
+ IrpContext->Irp,
+ Length,
+ IoWriteAccess );
+
+ if (NT_SUCCESS(*pStatus)) {
+ *pStatus = Ext2QueueRequest(IrpContext);
+ } else {
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+ } else {
+ IrpContext->Irp->IoStatus.Information = UsedLength;
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+ }
+}
+
NTSTATUS
Ext2QueryDirectory (IN PEXT2_IRP_CONTEXT IrpContext)
{
@@ -516,7 +615,6 @@
PIRP Irp;
PIO_STACK_LOCATION IoStackLocation;
- ULONG Length;
ULONG FileIndex;
PUNICODE_STRING FileName;
PUCHAR Buffer;
@@ -525,11 +623,9 @@
BOOLEAN ReturnSingleEntry;
BOOLEAN IndexSpecified;
BOOLEAN FirstQuery;
- BOOLEAN FcbResourceAcquired = FALSE;
USHORT InodeFileNameLength;
FILE_INFORMATION_CLASS FileInformationClass;
- ULONG UsedLength = 0;
OEM_STRING OemName;
UNICODE_STRING InodeFileName;
@@ -542,7 +638,15 @@
InodeFileName.Buffer = NULL;
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2QueryDirectoryFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(pStatus) = &Status;
+ _SEH_VAR(FcbResourceAcquired) = FALSE;
+ _SEH_VAR(UsedLength) = 0;
+ _SEH_VAR(InodeFileName) = &InodeFileName;
+ _SEH_VAR(pDir) = NULL;
ASSERT(IrpContext);
@@ -556,7 +660,7 @@
//
if (IsExt2FsDevice(DeviceObject)) {
Status = STATUS_INVALID_DEVICE_REQUEST;
- __leave;
+ _SEH_LEAVE;
}
Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension;
@@ -571,10 +675,11 @@
FileObject = IrpContext->FileObject;
Fcb = (PEXT2_FCB) FileObject->FsContext;
+ _SEH_VAR(Fcb) = Fcb;
if (Fcb == NULL) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
//
@@ -582,7 +687,7 @@
//
if (Fcb->Identifier.Type == EXT2VCB) {
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -590,7 +695,7 @@
if (!IsDirectory(Fcb)) {
Status = STATUS_NOT_A_DIRECTORY;
- __leave;
+ _SEH_LEAVE;
}
Ccb = (PEXT2_CCB) FileObject->FsContext2;
@@ -620,7 +725,7 @@
FileInformationClass = ((PEXTENDED_IO_STACK_LOCATION)
IoStackLocation)->Parameters.QueryDirectory.FileInformationClass;
- Length = ((PEXTENDED_IO_STACK_LOCATION)
+ _SEH_VAR(Length) = ((PEXTENDED_IO_STACK_LOCATION)
IoStackLocation)->Parameters.QueryDirectory.Length;
FileName = ((PEXTENDED_IO_STACK_LOCATION)
@@ -643,21 +748,21 @@
if (Buffer == NULL) {
DbgBreak();
Status = STATUS_INVALID_USER_BUFFER;
- __leave;
+ _SEH_LEAVE;
}
if (!IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
Status = STATUS_PENDING;
- __leave;
+ _SEH_LEAVE;
}
if (!ExAcquireResourceSharedLite(
&Fcb->MainResource,
IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) )) {
Status = STATUS_PENDING;
- __leave;
- }
- FcbResourceAcquired = TRUE;
+ _SEH_LEAVE;
+ }
+ _SEH_VAR(FcbResourceAcquired) = TRUE;
if (FileName != NULL) {
@@ -680,7 +785,7 @@
if (Ccb->DirectorySearchPattern.Buffer == NULL) {
DEBUG(DL_ERR, ( "Ex2QueryDirectory: failed to allocate
SerarchPattern.\n"));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
INC_MEM_COUNT( PS_DIR_PATTERN,
@@ -693,7 +798,7 @@
FALSE);
if (!NT_SUCCESS(Status)) {
- __leave;
+ _SEH_LEAVE;
}
}
@@ -715,7 +820,7 @@
if (Ccb->DirectorySearchPattern.Buffer == NULL) {
DEBUG(DL_ERR, ( "Ex2QueryDirectory: failed to allocate
SerarchPattern (1st).\n"));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
INC_MEM_COUNT( PS_DIR_PATTERN,
@@ -736,11 +841,11 @@
}
}
- RtlZeroMemory(Buffer, Length);
+ RtlZeroMemory(Buffer, _SEH_VAR(Length));
if (Fcb->Inode->i_size <= FileIndex) {
Status = STATUS_NO_MORE_FILES;
- __leave;
+ _SEH_LEAVE;
}
pDir = ExAllocatePoolWithTag(
@@ -748,11 +853,12 @@
sizeof(EXT2_DIR_ENTRY2),
EXT2_DENTRY_MAGIC
);
+ _SEH_VAR(pDir) = pDir;
if (!pDir) {
DEBUG(DL_ERR, ( "Ex2QueryDirectory: failed to allocate pDir.\n"));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
INC_MEM_COUNT(PS_DIR_ENTRY, pDir, sizeof(EXT2_DIR_ENTRY2));
@@ -764,7 +870,7 @@
&Fcb->Mcb->FullName, FileIndex,
&Ccb->DirectorySearchPattern));
while ((ByteOffset < Fcb->Inode->i_size) &&
- (CEILING_ALIGNED(ULONG, UsedLength, 8) < Length)) {
+ (CEILING_ALIGNED(ULONG, _SEH_VAR(UsedLength), 8) < _SEH_VAR(Length)))
{
RtlZeroMemory(pDir, sizeof(EXT2_DIR_ENTRY2));
@@ -779,7 +885,7 @@
&EntrySize);
if (!NT_SUCCESS(Status)) {
- __leave;
+ _SEH_LEAVE;
}
if (pDir->rec_len == 0) {
@@ -833,7 +939,7 @@
DEBUG(DL_ERR, ( "Ex2QueryDirectory: failed to "
"allocate InodeFileName.\n"));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
INC_MEM_COUNT(PS_INODE_NAME, InodeFileName.Buffer,
InodeFileName.MaximumLength);
@@ -846,7 +952,7 @@
if (!NT_SUCCESS(Status)) {
DEBUG(DL_ERR, ( "Ex2QueryDirectory: Ext2OEMtoUnicode failed with
%xh.\n", Status));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
DEBUG(DL_CP, ( "Ex2QueryDirectory: process inode: %xh / %wZ
(%d).\n",
@@ -871,8 +977,8 @@
FileInformationClass,
pDir->inode,
Buffer,
- CEILING_ALIGNED(ULONG, UsedLength, 8),
- Length - CEILING_ALIGNED(ULONG, UsedLength, 8),
+ CEILING_ALIGNED(ULONG, _SEH_VAR(UsedLength), 8),
+ _SEH_VAR(Length) - CEILING_ALIGNED(ULONG,
_SEH_VAR(UsedLength), 8),
ByteOffset,
&InodeFileName,
&EntrySize,
@@ -881,14 +987,14 @@
if (NT_SUCCESS(Status)) {
if (EntrySize > 0) {
- PrevEntry = CEILING_ALIGNED(ULONG, UsedLength, 8);
- UsedLength = PrevEntry + EntrySize;
+ PrevEntry = CEILING_ALIGNED(ULONG, _SEH_VAR(UsedLength), 8);
+ _SEH_VAR(UsedLength) = PrevEntry + EntrySize;
} else {
DbgBreak();
}
} else {
if (Status != STATUS_BUFFER_OVERFLOW) {
- __leave;
+ _SEH_LEAVE;
}
break;
}
@@ -899,16 +1005,16 @@
ByteOffset += RecLen;
Ccb->CurrentByteOffset = ByteOffset;
- if (UsedLength && ReturnSingleEntry) {
+ if (_SEH_VAR(UsedLength) && ReturnSingleEntry) {
Status = STATUS_SUCCESS;
- __leave;
+ _SEH_LEAVE;
}
}
FileIndex = ByteOffset;
((PULONG)((PUCHAR)Buffer + PrevEntry))[0] = 0;
- if (!UsedLength) {
+ if (!_SEH_VAR(UsedLength)) {
if (NT_SUCCESS(Status)) {
if (FirstQuery) {
Status = STATUS_NO_SUCH_FILE;
@@ -917,52 +1023,61 @@
}
} else {
ASSERT(Status == STATUS_BUFFER_OVERFLOW);
- UsedLength = EntrySize;
+ _SEH_VAR(UsedLength) = EntrySize;
}
} else {
Status = STATUS_SUCCESS;
}
- } __finally {
-
- if (FcbResourceAcquired) {
- ExReleaseResourceLite(&Fcb->MainResource);
- }
-
- if (pDir != NULL) {
- ExFreePoolWithTag(pDir, EXT2_DENTRY_MAGIC);
- DEC_MEM_COUNT(PS_DIR_ENTRY, pDir, sizeof(EXT2_DIR_ENTRY2));
- }
-
- if (InodeFileName.Buffer != NULL) {
- DEC_MEM_COUNT(PS_INODE_NAME, InodeFileName.Buffer,
- InodeFileName.MaximumLength );
- ExFreePoolWithTag(InodeFileName.Buffer, EXT2_INAME_MAGIC);
- }
-
- if (!IrpContext->ExceptionInProgress) {
-
- if ( Status == STATUS_PENDING ||
- Status == STATUS_CANT_WAIT) {
-
- Status = Ext2LockUserBuffer(
- IrpContext->Irp,
- Length,
- IoWriteAccess );
-
- if (NT_SUCCESS(Status)) {
- Status = Ext2QueueRequest(IrpContext);
- } else {
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- } else {
- IrpContext->Irp->IoStatus.Information = UsedLength;
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- }
- }
+ }
+ _SEH_FINALLY(Ext2QueryDirectoryFinal_PSEH)
+ _SEH_END;
return Status;
+}
+
+_SEH_DEFINE_LOCALS(Ext2NotifyChangeDirectoryFinal)
+{
+ PEXT2_IRP_CONTEXT IrpContext;
+ BOOLEAN CompleteRequest;
+ PNTSTATUS pStatus;
+ PEXT2_FCB Fcb;
+ BOOLEAN bFcbAcquired;
+};
+
+_SEH_FINALLYFUNC(Ext2NotifyChangeDirectoryFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2NotifyChangeDirectoryFinal);
+ Ext2NotifyChangeDirectoryFinal(_SEH_VAR(IrpContext), _SEH_VAR(CompleteRequest),
+ _SEH_VAR(pStatus), _SEH_VAR(Fcb),
+ _SEH_VAR(bFcbAcquired));
+}
+
+VOID
+Ext2NotifyChangeDirectoryFinal (
+ IN PEXT2_IRP_CONTEXT IrpContext,
+ IN BOOLEAN CompleteRequest,
+ IN PNTSTATUS pStatus,
+ IN PEXT2_FCB Fcb,
+ IN BOOLEAN bFcbAcquired
+ )
+{
+ if (bFcbAcquired) {
+ ExReleaseResourceLite(&Fcb->MainResource);
+ }
+
+ if (!IrpContext->ExceptionInProgress) {
+ if (CompleteRequest) {
+ if (*pStatus == STATUS_PENDING) {
+ Ext2QueueRequest(IrpContext);
+ } else {
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+ } else {
+ IrpContext->Irp = NULL;
+ Ext2CompleteIrpContext(IrpContext, *pStatus);
+ }
+ }
}
NTSTATUS
@@ -971,7 +1086,6 @@
)
{
PDEVICE_OBJECT DeviceObject;
- BOOLEAN CompleteRequest = TRUE;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
PEXT2_VCB Vcb;
PFILE_OBJECT FileObject;
@@ -981,9 +1095,13 @@
ULONG CompletionFilter;
BOOLEAN WatchTree;
- BOOLEAN bFcbAcquired = FALSE;
-
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2NotifyChangeDirectoryFinal);
+ _SEH_VAR(IrpContext) = IrpContext;
+ _SEH_VAR(CompleteRequest) = TRUE;
+ _SEH_VAR(pStatus) = &Status;
+ _SEH_VAR(bFcbAcquired) = FALSE;
ASSERT(IrpContext);
@@ -1000,7 +1118,7 @@
if (IsExt2FsDevice(DeviceObject)) {
Status = STATUS_INVALID_DEVICE_REQUEST;
- __leave;
+ _SEH_LEAVE;
}
Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension;
@@ -1021,7 +1139,7 @@
if (Fcb->Identifier.Type == EXT2VCB) {
DbgBreak();
Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -1030,16 +1148,16 @@
if (!IsDirectory(Fcb)) {
DbgBreak();
Status = STATUS_NOT_A_DIRECTORY;
- __leave;
+ _SEH_LEAVE;
}
if (ExAcquireResourceExclusiveLite(
&Fcb->MainResource,
TRUE )) {
- bFcbAcquired = TRUE;
+ _SEH_VAR(bFcbAcquired) = TRUE;
} else {
Status = STATUS_PENDING;
- __leave;
+ _SEH_LEAVE;
}
Irp = IrpContext->Irp;
@@ -1062,7 +1180,7 @@
if (FlagOn(Fcb->Flags, FCB_DELETE_PENDING)) {
Status = STATUS_DELETE_PENDING;
- __leave;
+ _SEH_LEAVE;
}
FsRtlNotifyFullChangeDirectory( Vcb->NotifySync,
@@ -1076,7 +1194,7 @@
NULL,
NULL );
- CompleteRequest = FALSE;
+ _SEH_VAR(CompleteRequest) = FALSE;
Status = STATUS_PENDING;
@@ -1118,25 +1236,9 @@
);
*/
- } __finally {
-
- if (bFcbAcquired) {
- ExReleaseResourceLite(&Fcb->MainResource);
- }
-
- if (!IrpContext->ExceptionInProgress) {
- if (CompleteRequest) {
- if (Status == STATUS_PENDING) {
- Ext2QueueRequest(IrpContext);
- } else {
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- } else {
- IrpContext->Irp = NULL;
- Ext2CompleteIrpContext(IrpContext, Status);
- }
- }
- }
+ }
+ _SEH_FINALLY(Ext2NotifyChangeDirectoryFinal_PSEH)
+ _SEH_END;
return Status;
}
@@ -1196,6 +1298,26 @@
return Status;
}
+_SEH_DEFINE_LOCALS(Ext2IsDirectoryEmptyFinal)
+{
+ PEXT2_DIR_ENTRY2 pTarget;
+};
+
+_SEH_FINALLYFUNC(Ext2IsDirectoryEmptyFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2IsDirectoryEmptyFinal);
+ Ext2IsDirectoryEmptyFinal(_SEH_VAR(pTarget));
+}
+
+VOID
+Ext2IsDirectoryEmptyFinal (
+ IN PEXT2_DIR_ENTRY2 pTarget
+ )
+{
+ if (pTarget != NULL) {
+ ExFreePoolWithTag(pTarget, EXT2_DENTRY_MAGIC);
+ }
+}
BOOLEAN
Ext2IsDirectoryEmpty (
@@ -1217,7 +1339,10 @@
return TRUE;
}
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2IsDirectoryEmptyFinal);
+ _SEH_VAR(pTarget) = NULL;
pTarget = (PEXT2_DIR_ENTRY2)
ExAllocatePoolWithTag(
@@ -1225,10 +1350,11 @@
EXT2_DIR_REC_LEN(EXT2_NAME_LEN),
EXT2_DENTRY_MAGIC
);
+ _SEH_VAR(pTarget) = pTarget;
if (!pTarget) {
DEBUG(DL_ERR, ( "Ex2isDirectoryEmpty: failed to allocate
pTarget.\n"));
Status = STATUS_INSUFFICIENT_RESOURCES;
- __leave;
+ _SEH_LEAVE;
}
ByteOffset = 0;
@@ -1249,7 +1375,7 @@
if (!NT_SUCCESS(Status)) {
DEBUG(DL_ERR, ( "Ext2IsDirectoryEmpty: Reading Directory Content
error.\n"));
- __leave;
+ _SEH_LEAVE;
}
if (pTarget->inode) {
@@ -1266,12 +1392,9 @@
bEmpty = (ByteOffset >= Mcb->Inode->i_size);
- } __finally {
-
- if (pTarget != NULL) {
- ExFreePoolWithTag(pTarget, EXT2_DENTRY_MAGIC);
- }
- }
+ }
+ _SEH_FINALLY(Ext2IsDirectoryEmptyFinal_PSEH)
+ _SEH_END;
return bEmpty;
}
Modified: branches/pierre-fsd/drivers/filesystems/ext3fsd/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/ext3fsd/dispatch.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/ext3fsd/dispatch.c [iso-8859-1] Mon Jul 14
04:56:24 2008
@@ -4,7 +4,8 @@
* FILE: dispatch.c
* PROGRAMMER: Matt Wu <mattwu(a)163.com>
* HOMEPAGE:
http://ext2.yeah.net
- * UPDATE HISTORY:
+ * UPDATE HISTORY: 14 Jul 2008 (Pierre Schweitzer <heis_spiter(a)hotmail.com>)
+ * Replaced SEH support with PSEH support
*/
/* INCLUDES *****************************************************************/
@@ -16,6 +17,11 @@
extern PEXT2_GLOBAL Ext2Global;
/* DEFINITIONS *************************************************************/
+
+VOID
+Ext2BuildRequestFinal (
+ IN PBOOLEAN pAtIrqlPassiveLevel,
+ IN PBOOLEAN pIsTopLevelIrp );
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, Ext2QueueRequest)
@@ -23,6 +29,10 @@
#pragma alloc_text(PAGE, Ext2DispatchRequest)
#pragma alloc_text(PAGE, Ext2BuildRequest)
#endif
+
+
+/* FUNCTIONS ***************************************************************/
+
/*
* Ext2OplockComplete
@@ -174,6 +184,23 @@
return STATUS_PENDING;
}
+_SEH_DEFINE_LOCALS(Ext2ExceptionFilter)
+{
+ PEXT2_IRP_CONTEXT IrpContext;
+};
+
+_SEH_FILTER(Ext2ExceptionFilter_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2ExceptionFilter);
+ return Ext2ExceptionFilter(_SEH_VAR(IrpContext), _SEH_GetExceptionPointers());
+}
+
+_SEH_FINALLYFUNC(Ext2DeQueueRequestFinal_PSEH)
+{
+ IoSetTopLevelIrp(NULL);
+
+ FsRtlExitFileSystem();
+}
VOID
Ext2DeQueueRequest (IN PVOID Context)
@@ -187,9 +214,12 @@
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
(IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
- __try {
-
- __try {
+ _SEH_TRY {
+
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2ExceptionFilter);
+ _SEH_VAR(IrpContext) = IrpContext;
FsRtlEnterFileSystem();
@@ -199,17 +229,16 @@
Ext2DispatchRequest(IrpContext);
- } __except (Ext2ExceptionFilter(IrpContext, GetExceptionInformation())) {
+ }
+ _SEH_EXCEPT(Ext2ExceptionFilter_PSEH) {
Ext2ExceptionHandler(IrpContext);
}
-
- } __finally {
-
- IoSetTopLevelIrp(NULL);
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(Ext2DeQueueRequestFinal_PSEH)
+ _SEH_END;
}
@@ -282,6 +311,32 @@
}
}
+_SEH_DEFINE_LOCALS(Ext2BuildRequestFinal)
+{
+ PBOOLEAN pAtIrqlPassiveLevel;
+ PBOOLEAN pIsTopLevelIrp;
+};
+
+_SEH_FINALLYFUNC(Ext2BuildRequestFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2BuildRequestFinal);
+ Ext2BuildRequestFinal(_SEH_VAR(pAtIrqlPassiveLevel), _SEH_VAR(pIsTopLevelIrp));
+}
+
+VOID
+Ext2BuildRequestFinal (
+ IN PBOOLEAN pAtIrqlPassiveLevel,
+ IN PBOOLEAN pIsTopLevelIrp
+ )
+{
+ if (*pIsTopLevelIrp) {
+ IoSetTopLevelIrp(NULL);
+ }
+
+ if (*pAtIrqlPassiveLevel) {
+ FsRtlExitFileSystem();
+ }
+}
NTSTATUS
Ext2BuildRequest (PDEVICE_OBJECT DeviceObject, PIRP Irp)
@@ -291,9 +346,16 @@
PEXT2_IRP_CONTEXT IrpContext = NULL;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
- __try {
-
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2BuildRequestFinal);
+ _SEH_VAR(pAtIrqlPassiveLevel) = &AtIrqlPassiveLevel;
+ _SEH_VAR(pIsTopLevelIrp) = &IsTopLevelIrp;
+
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2ExceptionFilter);
+ _SEH_VAR(IrpContext) = IrpContext;
#if EXT2_DEBUG
Ext2DbgPrintCall(DeviceObject, Irp);
@@ -329,21 +391,16 @@
Status = Ext2DispatchRequest(IrpContext);
}
- } __except (Ext2ExceptionFilter(IrpContext, GetExceptionInformation())) {
-
- Status = Ext2ExceptionHandler(IrpContext);
- }
-
- } __finally {
-
- if (IsTopLevelIrp) {
- IoSetTopLevelIrp(NULL);
- }
-
- if (AtIrqlPassiveLevel) {
- FsRtlExitFileSystem();
- }
- }
+ }
+ _SEH_EXCEPT(Ext2ExceptionFilter_PSEH) {
+
+ Ext2ExceptionHandler(IrpContext);
+ }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(Ext2BuildRequestFinal_PSEH)
+ _SEH_END;
return Status;
}
Modified: branches/pierre-fsd/drivers/filesystems/ext3fsd/except.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/ext3fsd/except.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/ext3fsd/except.c [iso-8859-1] Mon Jul 14
04:56:24 2008
@@ -254,4 +254,3 @@
return Status;
}
-
Modified: branches/pierre-fsd/drivers/filesystems/ext3fsd/fastio.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/ext3fsd/fastio.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/ext3fsd/fastio.c [iso-8859-1] Mon Jul 14
04:56:24 2008
@@ -4,7 +4,8 @@
* FILE: fastio.c
* PROGRAMMER: Matt Wu <mattwu(a)163.com>
* HOMEPAGE:
http://ext2.yeah.net
- * UPDATE HISTORY:
+ * UPDATE HISTORY: 14 Jul 2008 (Pierre Schweitzer <heis_spiter(a)hotmail.com>)
+ * Replaced SEH support with PSEH support
*/
/* INCLUDES *****************************************************************/
@@ -16,6 +17,13 @@
extern PEXT2_GLOBAL Ext2Global;
/* DEFINITIONS *************************************************************/
+
+/* Also used by Ext2FastIoQueryStandardInfo() */
+/* Also used by Ext2FastIoQueryNetworkOpenInfo() */
+VOID
+Ext2FastIoQueryBasicInfoFinal (
+ IN PEXT2_FCB Fcb,
+ IN BOOLEAN FcbMainResourceAcquired );
#ifdef ALLOC_PRAGMA
#if EXT2_DEBUG
@@ -32,6 +40,10 @@
#pragma alloc_text(PAGE, Ext2FastIoUnlockAll)
#endif
+
+/* FUNCTIONS ***************************************************************/
+
+
FAST_IO_POSSIBLE
Ext2IsFastIoPossible(
IN PEXT2_FCB Fcb
@@ -53,6 +65,7 @@
return IsPossible;
}
+_SEH_WRAP_FINALLY(FsRtlExitFileSystem_PSEH_finally, FsRtlExitFileSystem);
BOOLEAN
Ext2FastIoCheckIfPossible (
@@ -73,36 +86,36 @@
lLength.QuadPart = Length;
- __try {
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
if (IsExt2FsDevice(DeviceObject)) {
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
(Fcb->Identifier.Size == sizeof(EXT2_FCB)));
if (IsDirectory(Fcb)) {
- __leave;
+ _SEH_LEAVE;
}
Ccb = (PEXT2_CCB) FileObject->FsContext2;
if (Ccb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (CheckForReadOperation) {
@@ -146,14 +159,15 @@
(bPossible ? "Succeeded" : "Failed")));
#endif
- } __except (EXCEPTION_EXECUTE_HANDLER) {
+ }
+ _SEH_HANDLE {
bPossible = FastIoIsNotPossible;
}
-
- } __finally {
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(FsRtlExitFileSystem_PSEH_finally)
+ _SEH_END;
return bPossible;
}
@@ -247,6 +261,30 @@
#endif /* EXT2_DEBUG */
+_SEH_DEFINE_LOCALS(Ext2FastIoQueryBasicInfoFinal)
+{
+ PEXT2_FCB Fcb;
+ BOOLEAN FcbMainResourceAcquired;
+};
+
+_SEH_FINALLYFUNC(Ext2FastIoQueryBasicInfoFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2FastIoQueryBasicInfoFinal);
+ Ext2FastIoQueryBasicInfoFinal(_SEH_VAR(Fcb), _SEH_VAR(FcbMainResourceAcquired));
+}
+
+VOID
+Ext2FastIoQueryBasicInfoFinal (
+ IN PEXT2_FCB Fcb,
+ IN BOOLEAN FcbMainResourceAcquired
+ )
+{
+ if (FcbMainResourceAcquired) {
+ ExReleaseResourceLite(&Fcb->MainResource);
+ }
+
+ FsRtlExitFileSystem();
+}
BOOLEAN
Ext2FastIoQueryBasicInfo (
@@ -258,30 +296,34 @@
{
PEXT2_FCB Fcb = NULL;
BOOLEAN Status = FALSE;
- BOOLEAN FcbMainResourceAcquired = FALSE;
-
- __try {
+
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2FastIoQueryBasicInfoFinal);
+ _SEH_VAR(Fcb) = NULL;
+ _SEH_VAR(FcbMainResourceAcquired) = FALSE;
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
+ _SEH_VAR(Fcb) = Fcb;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -299,9 +341,9 @@
&Fcb->MainResource,
Wait)) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
- FcbMainResourceAcquired = TRUE;
+ _SEH_VAR(FcbMainResourceAcquired) = TRUE;
}
RtlZeroMemory(Buffer, sizeof(FILE_BASIC_INFORMATION));
@@ -337,20 +379,17 @@
IoStatus->Status = STATUS_SUCCESS;
Status = TRUE;
- } __except (EXCEPTION_EXECUTE_HANDLER) {
-
- IoStatus->Status = GetExceptionCode();
+ }
+ _SEH_HANDLE {
+
+ IoStatus->Status = _SEH_GetExceptionCode();
Status = TRUE;
}
-
- } __finally {
-
- if (FcbMainResourceAcquired) {
- ExReleaseResourceLite(&Fcb->MainResource);
- }
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(Ext2FastIoQueryBasicInfoFinal_PSEH)
+ _SEH_END;
#if EXT2_DEBUG
@@ -372,6 +411,19 @@
#endif
return Status;
+}
+
+_SEH_DEFINE_LOCALS(Ext2FastIoQueryStandardInfoFinal)
+{
+ PEXT2_FCB Fcb;
+ BOOLEAN FcbMainResourceAcquired;
+};
+
+/* Use Ext2FastIoQueryBasicInfo() PSEH final function */
+_SEH_FINALLYFUNC(Ext2FastIoQueryStandardInfoFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2FastIoQueryStandardInfoFinal);
+ Ext2FastIoQueryBasicInfoFinal(_SEH_VAR(Fcb), _SEH_VAR(FcbMainResourceAcquired));
}
BOOLEAN
@@ -387,30 +439,33 @@
BOOLEAN Status = FALSE;
PEXT2_VCB Vcb;
PEXT2_FCB Fcb;
- BOOLEAN FcbMainResourceAcquired = FALSE;
-
- __try {
+
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2FastIoQueryStandardInfoFinal);
+ _SEH_VAR(FcbMainResourceAcquired) = FALSE;
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
+ _SEH_VAR(Fcb) = Fcb;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -430,9 +485,9 @@
&Fcb->MainResource,
Wait )) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
- FcbMainResourceAcquired = TRUE;
+ _SEH_VAR(FcbMainResourceAcquired) = TRUE;
}
RtlZeroMemory(Buffer, sizeof(FILE_STANDARD_INFORMATION));
@@ -473,20 +528,17 @@
#endif
Status = TRUE;
- } __except (EXCEPTION_EXECUTE_HANDLER) {
-
- IoStatus->Status = GetExceptionCode();
+ }
+ _SEH_HANDLE {
+
+ IoStatus->Status = _SEH_GetExceptionCode();
Status = TRUE;
}
-
- } __finally {
-
- if (FcbMainResourceAcquired) {
- ExReleaseResourceLite(&Fcb->MainResource);
- }
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(Ext2FastIoQueryStandardInfoFinal_PSEH)
+ _SEH_END;
#if EXT2_DEBUG
if (Status == FALSE) {
@@ -522,29 +574,29 @@
BOOLEAN Status = FALSE;
PEXT2_FCB Fcb;
- __try {
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -554,7 +606,7 @@
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
#if EXT2_DEBUG
DEBUG(DL_INF, (
@@ -574,7 +626,7 @@
if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
Status = FsRtlFastLock(
@@ -594,15 +646,16 @@
Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
}
- } __except (EXCEPTION_EXECUTE_HANDLER) {
- IoStatus->Status = GetExceptionCode();
+ }
+ _SEH_HANDLE {
+ IoStatus->Status = _SEH_GetExceptionCode();
Status = FALSE;
}
-
- } __finally {
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(FsRtlExitFileSystem_PSEH_finally)
+ _SEH_END;
#if EXT2_DEBUG
if (Status == FALSE) {
@@ -639,29 +692,29 @@
BOOLEAN Status = FALSE;
PEXT2_FCB Fcb;
- __try {
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -672,7 +725,7 @@
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
#if EXT2_DEBUG
@@ -691,7 +744,7 @@
if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
IoStatus->Status = FsRtlFastUnlockSingle(
@@ -709,15 +762,16 @@
Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
- } __except (EXCEPTION_EXECUTE_HANDLER) {
- IoStatus->Status = GetExceptionCode();
+ }
+ _SEH_HANDLE {
+ IoStatus->Status = _SEH_GetExceptionCode();
Status = FALSE;
}
-
- } __finally {
-
- FsRtlExitFileSystem();
- }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(FsRtlExitFileSystem_PSEH_finally)
+ _SEH_END;
#if EXT2_DEBUG
if (Status == FALSE) {
@@ -749,29 +803,29 @@
BOOLEAN Status = FALSE;
PEXT2_FCB Fcb;
- __try {
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -781,7 +835,7 @@
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
#if EXT2_DEBUG
DEBUG(DL_INF, (
@@ -794,7 +848,7 @@
if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
IoStatus->Status = FsRtlFastUnlockAll(
@@ -808,15 +862,16 @@
Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
- } __except (EXCEPTION_EXECUTE_HANDLER) {
- IoStatus->Status = GetExceptionCode();
- Status = TRUE;
- }
-
- } __finally {
-
- FsRtlExitFileSystem();
- }
+ }
+ _SEH_HANDLE {
+ IoStatus->Status = _SEH_GetExceptionCode();
+ Status = FALSE;
+ }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(FsRtlExitFileSystem_PSEH_finally)
+ _SEH_END;
#if EXT2_DEBUG
if (Status == FALSE) {
@@ -852,29 +907,29 @@
BOOLEAN Status = FALSE;
PEXT2_FCB Fcb;
- __try {
+ _SEH_TRY {
FsRtlEnterFileSystem();
- __try {
+ _SEH_TRY {
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -885,7 +940,7 @@
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
Status = TRUE;
- __leave;
+ _SEH_LEAVE;
}
#if EXT2_DEBUG
@@ -904,7 +959,7 @@
if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
Status = FALSE;
- __leave;
+ _SEH_LEAVE;
}
IoStatus->Status = FsRtlFastUnlockAllByKey(
@@ -920,16 +975,16 @@
Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
- } __except (EXCEPTION_EXECUTE_HANDLER) {
-
- IoStatus->Status = GetExceptionCode();
- Status = TRUE;
- }
-
- } __finally {
-
- FsRtlExitFileSystem();
- }
+ }
+ _SEH_HANDLE {
+ IoStatus->Status = _SEH_GetExceptionCode();
+ Status = FALSE;
+ }
+ _SEH_END;
+
+ }
+ _SEH_FINALLY(FsRtlExitFileSystem_PSEH_finally)
+ _SEH_END;
#if EXT2_DEBUG
if (Status == FALSE) {
@@ -954,6 +1009,18 @@
return Status;
}
+_SEH_DEFINE_LOCALS(Ext2FastIoQueryNetworkOpenInfoFinal)
+{
+ PEXT2_FCB Fcb;
+ BOOLEAN FcbMainResourceAcquired;
+};
+
+/* Use Ext2FastIoQueryBasicInfo() PSEH final function */
+_SEH_FINALLYFUNC(Ext2FastIoQueryNetworkOpenInfoFinal_PSEH)
+{
+ _SEH_ACCESS_LOCALS(Ext2FastIoQueryNetworkOpenInfoFinal);
+ Ext2FastIoQueryBasicInfoFinal(_SEH_VAR(Fcb), _SEH_VAR(FcbMainResourceAcquired));
+}
BOOLEAN
Ext2FastIoQueryNetworkOpenInfo (
@@ -968,27 +1035,30 @@
PEXT2_FCB Fcb = NULL;
- BOOLEAN FcbResourceAcquired = FALSE;
-
- __try {
+ _SEH_TRY {
+
+ _SEH_DECLARE_LOCALS(Ext2FastIoQueryNetworkOpenInfoFinal);
+ _SEH_VAR(Fcb) = NULL;
+ _SEH_VAR(FcbMainResourceAcquired) = FALSE;
FsRtlEnterFileSystem();
if (IsExt2FsDevice(DeviceObject)) {
IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
- __leave;
+ _SEH_LEAVE;
}
Fcb = (PEXT2_FCB) FileObject->FsContext;
+ _SEH_VAR(Fcb) = Fcb;
if (Fcb == NULL) {
- __leave;
+ _SEH_LEAVE;
}
if (Fcb->Identifier.Type == EXT2VCB) {
DbgBreak();
IoStatus->Status = STATUS_INVALID_PARAMETER;
- __leave;
+ _SEH_LEAVE;
}
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
@@ -1003,7 +1073,7 @@
#endif
if (FileObject->FsContext2) {
- __leave;
+ _SEH_LEAVE;
}
if (!IsFlagOn(Fcb->Flags, FCB_PAGE_FILE)) {
@@ -1012,10 +1082,10 @@
&Fcb->MainResource,
Wait
)) {
- __leave;
- }
-
- FcbResourceAcquired = TRUE;
+ _SEH_LEAVE;
+ }
+
+ _SEH_VAR(FcbMainResourceAcquired) = TRUE;
}
if (IsDirectory(Fcb)) {
@@ -1048,14 +1118,9 @@
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof(FILE_NETWORK_OPEN_INFORMATION);
- } __finally {
-
- if (FcbResourceAcquired) {
- ExReleaseResourceLite(&Fcb->MainResource);
- }
-
- FsRtlExitFileSystem();
- }
+ }
+ _SEH_FINALLY(Ext2FastIoQueryNetworkOpenInfoFinal_PSEH)
+ _SEH_END;
return bResult;
}