https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5429771b9936a6d8aee6ff...
commit 5429771b9936a6d8aee6ffb3860310673f467e93 Author: David Quintana gigaherz@gmail.com AuthorDate: Thu Nov 23 21:05:28 2017 +0100
[CDFS_NEW] Re-apply many of the reactos-specific changes and fix build. - Also, get rid of the old diff file. --- drivers/filesystems/cdfs_new/allocsup.c | 10 +- drivers/filesystems/cdfs_new/cachesup.c | 8 +- drivers/filesystems/cdfs_new/cddata.c | 40 +- drivers/filesystems/cdfs_new/cdinit.c | 78 +- drivers/filesystems/cdfs_new/cdprocs.h | 59 +- drivers/filesystems/cdfs_new/cdstruc.h | 18 +- drivers/filesystems/cdfs_new/cleanup.c | 18 +- drivers/filesystems/cdfs_new/close.c | 8 +- drivers/filesystems/cdfs_new/create.c | 52 +- drivers/filesystems/cdfs_new/devctrl.c | 4 +- drivers/filesystems/cdfs_new/deviosup.c | 45 +- drivers/filesystems/cdfs_new/dirctrl.c | 27 +- drivers/filesystems/cdfs_new/dirsup.c | 2 +- drivers/filesystems/cdfs_new/fieldoff.c | 2 +- drivers/filesystems/cdfs_new/fileinfo.c | 45 +- drivers/filesystems/cdfs_new/filobsup.c | 10 +- drivers/filesystems/cdfs_new/fsctrl.c | 91 +- drivers/filesystems/cdfs_new/fspdisp.c | 11 +- drivers/filesystems/cdfs_new/lockctrl.c | 34 +- drivers/filesystems/cdfs_new/namesup.c | 16 +- drivers/filesystems/cdfs_new/pathsup.c | 2 +- drivers/filesystems/cdfs_new/pnp.c | 6 +- drivers/filesystems/cdfs_new/prefxsup.c | 2 +- drivers/filesystems/cdfs_new/read.c | 28 +- drivers/filesystems/cdfs_new/resrcsup.c | 11 +- drivers/filesystems/cdfs_new/shutdown.c | 2 +- drivers/filesystems/cdfs_new/strucsup.c | 54 +- drivers/filesystems/cdfs_new/verfysup.c | 21 +- drivers/filesystems/cdfs_new/volinfo.c | 15 +- drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 985 ---------------------- drivers/filesystems/cdfs_new/workque.c | 10 +- drivers/filesystems/cdfs_new/write.c | 25 +- 32 files changed, 541 insertions(+), 1198 deletions(-)
diff --git a/drivers/filesystems/cdfs_new/allocsup.c b/drivers/filesystems/cdfs_new/allocsup.c index 6a92817cb5..44a330111e 100755 --- a/drivers/filesystems/cdfs_new/allocsup.c +++ b/drivers/filesystems/cdfs_new/allocsup.c @@ -44,7 +44,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -86,8 +86,10 @@ CdDiskOffsetFromMcbEntry ( _Requires_lock_held_(_Global_critical_region_) VOID +#ifdef _MSC_VER // PREFast currently has no way to express the Fcb==Fcb->Vcb->VolumeDasdFcb early return #pragma warning(suppress: 6001 6101) +#endif CdLookupAllocation ( _In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, @@ -164,7 +166,7 @@ Return Value: // Use a try finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // We use a loop to perform the lookup. If we don't find the mapping in the @@ -308,7 +310,7 @@ Return Value: FirstPass = FALSE; }
- } finally { + } _SEH2_FINALLY {
if (CleanupParent) {
@@ -323,7 +325,7 @@ Return Value: }
if (UnlockFcb) { CdUnlockFcb( IrpContext, Fcb ); } - } + } _SEH2_END;
return; } diff --git a/drivers/filesystems/cdfs_new/cachesup.c b/drivers/filesystems/cdfs_new/cachesup.c index eea1fd28da..37ac74437a 100755 --- a/drivers/filesystems/cdfs_new/cachesup.c +++ b/drivers/filesystems/cdfs_new/cachesup.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -95,7 +95,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Create the internal stream. The Vpb should be pointing at our volume @@ -281,7 +281,7 @@ Return Value: } }
- } finally { + } _SEH2_FINALLY {
// // Cleanup any dirent structures we may have used. @@ -323,7 +323,7 @@ Return Value: }
CdUnlockFcb( IrpContext, Fcb ); - } + } _SEH2_END;
return; } diff --git a/drivers/filesystems/cdfs_new/cddata.c b/drivers/filesystems/cdfs_new/cddata.c index 15cfe2d5db..ff2c61cfaf 100755 --- a/drivers/filesystems/cdfs_new/cddata.c +++ b/drivers/filesystems/cdfs_new/cddata.c @@ -17,7 +17,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
#ifdef CD_SANITY BOOLEAN CdTestTopLevel = TRUE; @@ -287,7 +287,7 @@ Return Value: // Use a try-except to handle the exception cases. //
- try { + _SEH2_TRY {
// // If the IrpContext is NULL then this is the first pass through @@ -436,10 +436,10 @@ Return Value: CdCompleteRequest( IrpContext, Irp, Status ); }
- } except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) { + } _SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
- Status = CdProcessException( IrpContext, Irp, GetExceptionCode() ); - } + Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() ); + } _SEH2_END;
} while (Status == STATUS_CANT_WAIT);
@@ -597,7 +597,9 @@ Return Value:
if (TestStatus && !FsRtlIsNtstatusExpected( ExceptionCode )) {
-#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "We're corrupted." ) +#ifdef _MSC_VER +#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "We're corrupted." ) +#endif CdBugCheck( (ULONG_PTR) ExceptionPointer->ExceptionRecord, (ULONG_PTR) ExceptionPointer->ContextRecord, (ULONG_PTR) ExceptionPointer->ExceptionRecord->ExceptionAddress ); @@ -686,7 +688,7 @@ Return Value: // Note that (children of) CdFsdPostRequest can raise (Mdl allocation). //
- try { + _SEH2_TRY {
if (ExceptionCode == STATUS_CANT_WAIT) {
@@ -702,11 +704,10 @@ Return Value: ExceptionCode = CdFsdPostRequest( IrpContext, Irp ); } } - except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) { - - ExceptionCode = GetExceptionCode(); - } + _SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
+ ExceptionCode = _SEH2_GetExceptionCode(); + } _SEH2_END; // // If we posted the request or our caller will retry then just return here. // @@ -1009,6 +1010,10 @@ Return Value:
{ PTHREAD_CONTEXT CurrentThreadContext; +#ifdef __REACTOS__ + ULONG_PTR StackTop; + ULONG_PTR StackBottom; +#endif
PAGED_CODE();
@@ -1040,9 +1045,21 @@ Return Value: // If this is not a valid Cdfs context then use the input thread // context and store it in the top level context. // + +#ifdef __REACTOS__ + IoGetStackLimits( &StackTop, &StackBottom); +#endif + +#ifdef _MSC_VER #pragma warning(suppress: 6011) // Bug in PREFast around bitflag operations +#endif if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) || +#ifndef __REACTOS__ (!IoWithinStackLimits( (ULONG_PTR)CurrentThreadContext, sizeof( THREAD_CONTEXT ) ) || +#else + (((ULONG_PTR) CurrentThreadContext > StackBottom - sizeof( THREAD_CONTEXT )) || + ((ULONG_PTR) CurrentThreadContext <= StackTop) || +#endif FlagOn( (ULONG_PTR) CurrentThreadContext, 0x3 ) || (CurrentThreadContext->Cdfs != 0x53464443))) {
@@ -1073,6 +1090,7 @@ _Function_class_(FAST_IO_CHECK_IF_POSSIBLE) _IRQL_requires_same_ _Success_(return != FALSE) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastIoCheckIfPossible ( _In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, diff --git a/drivers/filesystems/cdfs_new/cdinit.c b/drivers/filesystems/cdfs_new/cdinit.c index 5ec9d50324..871419ac57 100755 --- a/drivers/filesystems/cdfs_new/cdinit.c +++ b/drivers/filesystems/cdfs_new/cdinit.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -25,6 +25,7 @@ Abstract: DRIVER_INITIALIZE DriverEntry;
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ DriverEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath @@ -35,6 +36,7 @@ DriverEntry( DRIVER_UNLOAD CdUnload;
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdUnload( _In_ PDRIVER_OBJECT DriverObject ); @@ -43,6 +45,10 @@ NTSTATUS CdInitializeGlobalData ( _In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT FileSystemDeviceObject +#ifdef __REACTOS__ + , + IN PDEVICE_OBJECT HddFileSystemDeviceObject +#endif );
#ifdef ALLOC_PRAGMA @@ -57,6 +63,7 @@ CdInitializeGlobalData ( //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ DriverEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath @@ -86,6 +93,9 @@ Return Value: UNICODE_STRING UnicodeString; PDEVICE_OBJECT CdfsFileSystemDeviceObject; FS_FILTER_CALLBACKS FilterCallbacks; +#ifdef __REACTOS__ + PDEVICE_OBJECT HddFileSystemDeviceObject; +#endif
UNREFERENCED_PARAMETER( RegistryPath );
@@ -107,11 +117,34 @@ Return Value: return Status; }
+#ifdef __REACTOS__ + // + // Create the HDD device object. + // + + RtlInitUnicodeString( &UnicodeString, L"\CdfsHdd" ); + + Status = IoCreateDevice( DriverObject, + 0, + &UnicodeString, + FILE_DEVICE_DISK_FILE_SYSTEM, + 0, + FALSE, + &HddFileSystemDeviceObject ); + + if (!NT_SUCCESS( Status )) { + IoDeleteDevice (CdfsFileSystemDeviceObject); + return Status; + } +#endif + +#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(disable: 28155, "the dispatch routine has the correct type, prefast is just being paranoid.") #pragma prefast(disable: 28168, "the dispatch routine has the correct type, prefast is just being paranoid.") #pragma prefast(disable: 28169, "the dispatch routine has the correct type, prefast is just being paranoid.") #pragma prefast(disable: 28175, "we're allowed to change these.") +#endif
DriverObject->DriverUnload = CdUnload;
@@ -143,9 +176,11 @@ Return Value: DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DriverObject->MajorFunction[IRP_MJ_PNP] = DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH) CdFsdDispatch; +#ifdef _MSC_VER #pragma prefast(pop)
#pragma prefast(suppress: 28175, "this is a file system driver, we're allowed to touch FastIoDispatch.") +#endif DriverObject->FastIoDispatch = &CdFastIoDispatch;
// @@ -164,6 +199,9 @@ Return Value: if (!NT_SUCCESS( Status )) {
IoDeleteDevice( CdfsFileSystemDeviceObject ); +#ifdef __REACTOS__ + IoDeleteDevice (HddFileSystemDeviceObject); +#endif return Status; }
@@ -171,9 +209,16 @@ Return Value: // Initialize the global data structures //
+#ifndef __REACTOS__ Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject ); +#else + Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject, HddFileSystemDeviceObject ); +#endif if (!NT_SUCCESS (Status)) { IoDeleteDevice (CdfsFileSystemDeviceObject); +#ifdef __REACTOS__ + IoDeleteDevice (HddFileSystemDeviceObject); +#endif return Status; }
@@ -184,9 +229,16 @@ Return Value: //
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM; +#ifdef __REACTOS__ + HddFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM; +#endif
IoRegisterFileSystem( CdfsFileSystemDeviceObject ); ObReferenceObject (CdfsFileSystemDeviceObject); +#ifdef __REACTOS__ + IoRegisterFileSystem( HddFileSystemDeviceObject ); + ObReferenceObject (HddFileSystemDeviceObject); +#endif
#ifdef CDFS_TELEMETRY_DATA // @@ -206,6 +258,7 @@ Return Value:
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdUnload( _In_ PDRIVER_OBJECT DriverObject ) @@ -245,6 +298,9 @@ Return Value: IoFreeWorkItem (CdData.CloseItem); ExDeleteResourceLite( &CdData.DataResource ); ObDereferenceObject (CdData.FileSystemDeviceObject); +#ifdef __REACTOS__ + ObDereferenceObject (CdData.HddFileSystemDeviceObject); +#endif } // @@ -255,6 +311,10 @@ NTSTATUS CdInitializeGlobalData ( _In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT FileSystemDeviceObject +#ifdef __REACTOS__ + , + IN PDEVICE_OBJECT HddFileSystemDeviceObject +#endif )
/*++ @@ -284,8 +344,10 @@ Return Value:
CdFastIoDispatch.SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH);
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(disable:28155, "these are all correct") +#endif
CdFastIoDispatch.FastIoCheckIfPossible = CdFastIoCheckIfPossible; // CheckForFastIo CdFastIoDispatch.FastIoRead = FsRtlCopyRead; // Read @@ -295,7 +357,6 @@ Return Value: CdFastIoDispatch.FastIoUnlockSingle = CdFastUnlockSingle; // UnlockSingle CdFastIoDispatch.FastIoUnlockAll = CdFastUnlockAll; // UnlockAll CdFastIoDispatch.FastIoUnlockAllByKey = CdFastUnlockAllByKey; // UnlockAllByKey - // // This callback has been replaced by CdFilterCallbackAcquireForCreateSection. // @@ -309,7 +370,9 @@ Return Value: CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev; CdFastIoDispatch.MdlWriteComplete = FsRtlMdlWriteCompleteDev;
+#ifdef _MSC_VER #pragma prefast(pop) +#endif
// // Initialize the CdData structure. @@ -322,6 +385,9 @@ Return Value:
CdData.DriverObject = DriverObject; CdData.FileSystemDeviceObject = FileSystemDeviceObject; +#ifdef __REACTOS__ + CdData.HddFileSystemDeviceObject = HddFileSystemDeviceObject; +#endif
InitializeListHead( &CdData.VcbQueue );
@@ -331,10 +397,10 @@ Return Value: // Initialize the cache manager callback routines //
- CdData.CacheManagerCallbacks.AcquireForLazyWrite = &CdAcquireForCache; - CdData.CacheManagerCallbacks.ReleaseFromLazyWrite = &CdReleaseFromCache; - CdData.CacheManagerCallbacks.AcquireForReadAhead = &CdAcquireForCache; - CdData.CacheManagerCallbacks.ReleaseFromReadAhead = &CdReleaseFromCache; + CdData.CacheManagerCallbacks.AcquireForLazyWrite = (PVOID)&CdAcquireForCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ + CdData.CacheManagerCallbacks.ReleaseFromLazyWrite = (PVOID)&CdReleaseFromCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ + CdData.CacheManagerCallbacks.AcquireForReadAhead = (PVOID)&CdAcquireForCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ + CdData.CacheManagerCallbacks.ReleaseFromReadAhead = (PVOID)&CdReleaseFromCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */
CdData.CacheManagerVolumeCallbacks.AcquireForLazyWrite = &CdNoopAcquire; CdData.CacheManagerVolumeCallbacks.ReleaseFromLazyWrite = &CdNoopRelease; diff --git a/drivers/filesystems/cdfs_new/cdprocs.h b/drivers/filesystems/cdfs_new/cdprocs.h index d2f7db0b4b..6c957aebba 100755 --- a/drivers/filesystems/cdfs_new/cdprocs.h +++ b/drivers/filesystems/cdfs_new/cdprocs.h @@ -17,26 +17,31 @@ Abstract: #ifndef _CDPROCS_ #define _CDPROCS_
+#ifdef _MSC_VER #pragma warning( disable: 4127 ) // conditional expression is constant
#pragma warning( push ) #pragma warning( disable: 4201 ) // nonstandard extension used : nameless struct/union #pragma warning( disable: 4214 ) // nonstandard extension used : bit field types +#endif
#include <ntifs.h>
#include <ntddcdrm.h> #include <ntdddisk.h> #include <ntddscsi.h> +#ifdef __REACTOS__ +#include <pseh/pseh2.h> +#endif
#ifndef INLINE #define INLINE __inline #endif
#include "nodetype.h" -#include "Cd.h" -#include "CdStruc.h" -#include "CdData.h" +#include "cd.h" +#include "cdstruc.h" +#include "cddata.h"
#ifdef CDFS_TELEMETRY_DATA
@@ -46,7 +51,9 @@ Abstract:
#endif // CDFS_TELEMETRY_DATA
+#ifdef _MSC_VER #pragma warning( pop ) +#endif
//**** x86 compiler bug ****
@@ -221,8 +228,9 @@ CdPurgeVolume ( _In_ BOOLEAN DismountUnderway );
+static /* ReactOS Change: GCC "multiple definition" */ +INLINE /* GCC only accepts __inline as the first modifier */ VOID -INLINE CdVerifyOrCreateDirStreamFile ( _In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb @@ -364,6 +372,7 @@ CdHijackIrpAndFlushDevice ( // ); //
+#ifndef __REACTOS__ #define CdMapUserBuffer(IC, UB) { \ *(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \ (IC)->Irp->UserBuffer : \ @@ -373,6 +382,18 @@ CdHijackIrpAndFlushDevice ( } \ }
+#else +#define CdMapUserBuffer(IC, UB) { \ + *(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \ + (IC)->Irp->UserBuffer : \ + (MmGetSystemAddressForMdlSafe( (IC)->Irp->MdlAddress, NormalPagePriority))); \ + if (NULL == *(UB)) { \ + CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \ + } \ + } + +#endif +
#define CdLockUserBuffer(IC,BL,OP) { \ if ((IC)->Irp->MdlAddress == NULL) { \ @@ -1071,12 +1092,14 @@ BOOLEAN DummyRestoreIrql(_Inout_ PFAST_MUTEX FastMutex); #endif
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdNoopAcquire ( _In_ PVOID Fcb, _In_ BOOLEAN Wait );
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdNoopRelease ( _In_ PVOID Fcb ); @@ -1084,6 +1107,7 @@ CdNoopRelease ( _Requires_lock_held_(_Global_critical_region_) _When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource)) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdAcquireForCache ( _Inout_ PFCB Fcb, _In_ BOOLEAN Wait @@ -1092,12 +1116,14 @@ CdAcquireForCache ( _Requires_lock_held_(_Global_critical_region_) _Releases_lock_(*Fcb->Resource) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdReleaseFromCache ( _Inout_ PFCB Fcb );
_Requires_lock_held_(_Global_critical_region_) NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFilterCallbackAcquireForCreateSection ( _In_ PFS_FILTER_CALLBACK_DATA CallbackData, _Unreferenced_parameter_ PVOID *CompletionContext @@ -1106,6 +1132,7 @@ CdFilterCallbackAcquireForCreateSection ( _Function_class_(FAST_IO_RELEASE_FILE) _Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdReleaseForCreateSection ( _In_ PFILE_OBJECT FileObject ); @@ -1324,7 +1351,7 @@ CdTeardownStructures ( sizeof( CD_IO_CONTEXT ), \ TAG_IO_CONTEXT )
-#define CdFreeIoContext(IO) CdFreePool( &(IO) ) +#define CdFreeIoContext(IO) CdFreePool( (PVOID) &(IO) ) /* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
PFCB CdLookupFcbTable ( @@ -1356,15 +1383,20 @@ CdProcessToc ( //
#define CdPagedPool PagedPool +#ifndef __REACTOS__ #define CdNonPagedPool NonPagedPoolNx #define CdNonPagedPoolCacheAligned NonPagedPoolNxCacheAligned +#else +#define CdNonPagedPool NonPagedPool +#define CdNonPagedPoolCacheAligned NonPagedPoolCacheAligned +#endif
// // Verification support routines. Contained in verfysup.c //
- +static /* ReactOS Change: GCC "multiple definition" */ INLINE BOOLEAN CdOperationIsDasdOpen ( @@ -1461,6 +1493,7 @@ CdFsdPostRequest (
_Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdPrePostIrp ( _Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp @@ -1468,6 +1501,7 @@ CdPrePostIrp (
_Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdOplockComplete ( _Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp @@ -1483,6 +1517,7 @@ CdOplockComplete ( // otherwise //
+/* GCC complains about multi-line comments. //#ifndef BooleanFlagOn //#define BooleanFlagOn(F,SF) ( \ // (BOOLEAN)(((F) & (SF)) != 0) \ @@ -1500,6 +1535,7 @@ CdOplockComplete ( // (Flags) &= ~(SingleFlag); \ //} //#endif +*/
// // CAST @@ -1575,6 +1611,7 @@ CdOplockComplete ( ((ULONG) (L)) >> SECTOR_SHIFT \ )
+static /* ReactOS Change: GCC "multiple definition" */ INLINE ULONG SectorsFromLlBytes( @@ -2144,16 +2181,24 @@ CdCommonShutdown ( // Implemented in Shutdown.c // #define try_return(S) { S; goto try_exit; } //
+#ifndef __REACTOS__ #define try_return(S) { S; goto try_exit; } #define try_leave(S) { S; leave; } +#else +#define try_return(S) { S; goto try_exit; } +#define try_leave(S) { S; _SEH2_LEAVE; } +#endif
// // Encapsulate safe pool freeing // +/* ReactOS Change: GCC "passing argument 1 of CdFreePool from incompatible pointer type" */ +#define CdFreePool(x) _CdFreePool((PVOID*)(x))
+static /* ReactOS Change: GCC "multiple definition" */ INLINE VOID -CdFreePool( +_CdFreePool( _Inout_ _At_(*Pool, __drv_freesMem(Mem) _Post_null_) PVOID *Pool ) { diff --git a/drivers/filesystems/cdfs_new/cdstruc.h b/drivers/filesystems/cdfs_new/cdstruc.h index 72abe0a1c3..8a5c02d534 100755 --- a/drivers/filesystems/cdfs_new/cdstruc.h +++ b/drivers/filesystems/cdfs_new/cdstruc.h @@ -170,6 +170,12 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module
#define BYTE_COUNT_EMBEDDED_NAME (32)
+#ifdef __REACTOS__ +#define __volatile +#define _Unreferenced_parameter_ +#define __field_range(a,b) +#define __analysis_assert(x) +#endif // // The CD_MCB is used to store the mapping of logical file offset to @@ -349,6 +355,10 @@ typedef struct _CD_DATA {
PDEVICE_OBJECT FileSystemDeviceObject;
+#ifdef __REACTOS__ + PDEVICE_OBJECT HddFileSystemDeviceObject; +#endif + // // Following are used to manage the async and delayed close queue. // @@ -545,8 +555,8 @@ typedef struct _VCB { //
ULONG VcbCleanup; - __volatile ULONG VcbReference; - __volatile ULONG VcbUserReference; + __volatile LONG VcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */ + __volatile LONG VcbUserReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
// // Fcb for the Volume Dasd file, root directory and the Path Table. @@ -732,7 +742,7 @@ typedef struct _VOLUME_DEVICE_OBJECT { // executed later. //
- __volatile ULONG PostedRequestCount; + __volatile LONG PostedRequestCount; /* ReactOS Change: GCC "pointer targets in passing argument 1 of 'InterlockedDecrement' differ in signedness" */
// // The following field indicates the number of IRP's waiting @@ -957,7 +967,7 @@ typedef struct _FCB { //
ULONG FcbCleanup; - __volatile ULONG FcbReference; + __volatile LONG FcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */ ULONG FcbUserReference;
// diff --git a/drivers/filesystems/cdfs_new/cleanup.c b/drivers/filesystems/cdfs_new/cleanup.c index a0d8ce43fc..0cdda166f5 100755 --- a/drivers/filesystems/cdfs_new/cleanup.c +++ b/drivers/filesystems/cdfs_new/cleanup.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -190,7 +190,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Case on the type of open that we are trying to cleanup. @@ -258,7 +258,9 @@ Return Value:
default :
+#ifdef _MSC_VER #pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" ) +#endif CdBugCheck( TypeOfOpen, 0, 0 ); }
@@ -311,15 +313,15 @@ Return Value:
IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );
- } finally { + } _SEH2_FINALLY {
- CdReleaseFcb( IrpContext, Fcb ); + CdReleaseFcb( IrpContext, Fcb );
if (SendUnlockNotification) {
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK ); } - } + } _SEH2_END;
// // If appropriate, try to spark teardown by purging the volume. Should @@ -337,19 +339,19 @@ Return Value:
CdAcquireCdData( IrpContext);
- try { + _SEH2_TRY {
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE ); VcbAcquired = TRUE;
CdPurgeVolume( IrpContext, Vcb, FALSE );
- } finally { + } _SEH2_FINALLY {
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
CdReleaseCdData( IrpContext); - } + } _SEH2_END; }
// diff --git a/drivers/filesystems/cdfs_new/close.c b/drivers/filesystems/cdfs_new/close.c index 5e45587544..fecb1e6dbf 100755 --- a/drivers/filesystems/cdfs_new/close.c +++ b/drivers/filesystems/cdfs_new/close.c @@ -42,7 +42,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -81,6 +81,7 @@ CdRemoveClose ( IO_WORKITEM_ROUTINE CdCloseWorker;
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdCloseWorker ( _In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PVOID Context @@ -170,7 +171,7 @@ Return Value: // Free the IrpContextLite. //
- CdFreeIrpContextLite( (PIRP_CONTEXT_LITE) IrpContext ); + CdFreeIrpContextLite( *(PVOID*)&IrpContext ); /* ReactOS Change: GCC "error: invalid lvalue in unary '&'" */
// // Remember we have the IrpContext from the stack. @@ -318,7 +319,9 @@ Return Value:
}
+#ifdef _MSC_VER #pragma prefast(suppress:26165, "Esp:1153") +#endif FsRtlExitFileSystem(); }
@@ -650,6 +653,7 @@ Return Value: }
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdCloseWorker ( _In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PVOID Context diff --git a/drivers/filesystems/cdfs_new/create.c b/drivers/filesystems/cdfs_new/create.c index 695121df0f..1fb744139e 100755 --- a/drivers/filesystems/cdfs_new/create.c +++ b/drivers/filesystems/cdfs_new/create.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -119,7 +119,9 @@ CdCompleteFcbOpen ( _Requires_lock_held_(_Global_critical_region_) NTSTATUS +#ifdef _MSC_VER #pragma prefast(suppress:26165, "Esp:1153") +#endif CdCommonCreate ( _Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp @@ -168,7 +170,7 @@ Return Value:
PFILE_OBJECT FileObject;
- COMPOUND_PATH_ENTRY CompoundPathEntry = {0}; + COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */ BOOLEAN CleanupCompoundPathEntry = FALSE;
FILE_ENUM_CONTEXT FileContext = {0}; @@ -229,7 +231,7 @@ Return Value: PUNICODE_STRING FileName; PUNICODE_STRING RelatedFileName = NULL;
- CD_NAME RemainingName = {0}; + CD_NAME RemainingName = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */ CD_NAME FinalName; PCD_NAME MatchingName = NULL;
@@ -382,7 +384,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify that the Vcb is not in an unusable condition. This routine @@ -926,7 +928,7 @@ Return Value: RelatedCcb ));
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
// // Cleanup the PathEntry if initialized. @@ -951,7 +953,7 @@ Return Value: // condition. //
- if (AbnormalTermination()) { + if (_SEH2_AbnormalTermination()) {
// @@ -1011,7 +1013,7 @@ Return Value: //
CdCompleteRequest( IrpContext, Irp, Status ); - } + } _SEH2_END;
return Status; } @@ -1348,10 +1350,14 @@ Return Value: // // Do a quick check to make sure there are no wildcards. // +#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(suppress:26000, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).") +#endif if (FsRtlDoesNameContainWildCards( &RemainingName->FileName )) { +#ifdef _MSC_VER #pragma prefast(pop) +#endif
return STATUS_OBJECT_NAME_INVALID; } @@ -1453,10 +1459,14 @@ Return Value: } }
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(suppress:26030, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).") +#endif return STATUS_SUCCESS; +#ifdef _MSC_VER #pragma prefast(pop) +#endif }
@@ -1528,7 +1538,7 @@ Return Value: FILE_ENUM_CONTEXT FileContext; BOOLEAN CleanupFileContext = FALSE;
- COMPOUND_PATH_ENTRY CompoundPathEntry = {0}; + COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */ BOOLEAN CleanupCompoundPathEntry = FALSE;
FILE_ID FileId; @@ -1548,7 +1558,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Go ahead and figure out the TypeOfOpen and NodeType. We can @@ -1942,7 +1952,7 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
if (UnlockVcb) {
@@ -1958,7 +1968,7 @@ Return Value:
CdCleanupCompoundPathEntry( IrpContext, &CompoundPathEntry ); } - } + } _SEH2_END;
return Status; } @@ -2166,7 +2176,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Check the related Ccb to see if this was an OpenByFileId. @@ -2324,7 +2334,7 @@ Return Value: IrpSp->Parameters.Create.SecurityContext->DesiredAccess ); }
- } finally { + } _SEH2_FINALLY {
// // Unlock the Vcb if held. @@ -2343,7 +2353,7 @@ Return Value:
CdReleaseFcb( IrpContext, ParentFcb ); } - } + } _SEH2_END;
return Status; } @@ -2443,7 +2453,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Check if a version number was used to open this file. @@ -2614,7 +2624,7 @@ Return Value: CcbFlags, IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
- } finally { + } _SEH2_FINALLY {
// // Unlock the Vcb if held. @@ -2633,7 +2643,7 @@ Return Value:
CdReleaseFcb( IrpContext, ParentFcb ); } - } + } _SEH2_END;
return Status; } @@ -2803,8 +2813,8 @@ Return Value: OplockStatus = FsRtlCheckOplock( CdGetFcbOplock(Fcb), IrpContext->Irp, IrpContext, - CdOplockComplete, - CdPrePostIrp ); + (PVOID)CdOplockComplete, /* ReactOS Change: GCC "assignment from incompatible pointer type" */ + (PVOID)CdPrePostIrp ); /* ReactOS Change: GCC "assignment from incompatible pointer type" */
if (OplockStatus == STATUS_PENDING) {
@@ -2835,8 +2845,8 @@ Return Value: OplockStatus = FsRtlCheckOplock( CdGetFcbOplock(Fcb), IrpContext->Irp, IrpContext, - CdOplockComplete, - CdPrePostIrp ); + (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ + (PVOID)CdPrePostIrp );/* ReactOS Change: GCC "assignment from incompatible pointer type" */
if (OplockStatus == STATUS_PENDING) {
diff --git a/drivers/filesystems/cdfs_new/devctrl.c b/drivers/filesystems/cdfs_new/devctrl.c index ce120f56ae..4d0a70ad55 100755 --- a/drivers/filesystems/cdfs_new/devctrl.c +++ b/drivers/filesystems/cdfs_new/devctrl.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -30,6 +30,7 @@ Abstract: IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine;
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdDevCtrlCompletionRoutine ( _In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, @@ -172,6 +173,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdDevCtrlCompletionRoutine ( _In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, diff --git a/drivers/filesystems/cdfs_new/deviosup.c b/drivers/filesystems/cdfs_new/deviosup.c index b2f9467b51..a0bb2b7ffd 100755 --- a/drivers/filesystems/cdfs_new/deviosup.c +++ b/drivers/filesystems/cdfs_new/deviosup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -407,7 +407,7 @@ Return Value: // Use a try-finally to perform the final cleanup. //
- try { + _SEH2_TRY {
// // Loop while there are more bytes to transfer. @@ -568,7 +568,7 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
// // Perform final cleanup on the IoRuns if necessary. @@ -578,7 +578,7 @@ Return Value:
CdFinishBuffers( IrpContext, IoRuns, CleanupRunCount, TRUE, FALSE ); } - } + } _SEH2_END;
return Status; } @@ -677,7 +677,7 @@ Return Value: // Use a try-finally to perform the final cleanup. //
- try { + _SEH2_TRY {
// // If the initial offset lies within the RIFF header then copy the @@ -979,7 +979,7 @@ Return Value: KeFlushIoBuffers( IrpContext->Irp->MdlAddress, TRUE, FALSE );
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
// // Perform final cleanup on the IoRuns if necessary. @@ -989,7 +989,7 @@ Return Value:
CdFinishBuffers( IrpContext, IoRuns, CleanupRunCount, TRUE, FALSE ); } - } + } _SEH2_END;
return Status; } @@ -1282,16 +1282,18 @@ Return Value: // deallocate the Mdl and return the appropriate "expected" status. //
- try { + _SEH2_TRY {
MmProbeAndLockPages( Mdl, IrpContext->Irp->RequestorMode, IoWriteAccess );
Status = STATUS_SUCCESS;
+#ifdef _MSC_VER #pragma warning(suppress: 6320) - } except(EXCEPTION_EXECUTE_HANDLER) { +#endif + } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
- Status = GetExceptionCode(); + Status = _SEH2_GetExceptionCode();
IoFreeMdl( Mdl ); IrpContext->Irp->MdlAddress = NULL; @@ -1300,7 +1302,7 @@ Return Value:
Status = STATUS_INVALID_USER_BUFFER; } - } + } _SEH2_END; }
// @@ -1890,7 +1892,9 @@ Return Value:
CurrentRawOffset = (LONGLONG) ((ULONG) CurrentRawOffset / RAW_SECTOR_SIZE);
+#ifdef _MSC_VER #pragma prefast( suppress: __WARNING_RESULTOFSHIFTCASTTOLARGERSIZE, "This is fine beacuse raw sector size > sector shift" ) +#endif CurrentCookedOffset = (LONGLONG) ((ULONG) CurrentRawOffset << SECTOR_SHIFT );
CurrentRawOffset = (LONGLONG) ((ULONG) CurrentRawOffset * RAW_SECTOR_SIZE); @@ -2384,6 +2388,7 @@ Return Value: IO_COMPLETION_ROUTINE CdSyncCompletionRoutine;
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdSyncCompletionRoutine ( PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -2514,7 +2519,7 @@ Return Value:
CdAcquireCacheForRead( IrpContext);
- try { + _SEH2_TRY {
// // Check the cache hasn't gone away due to volume verify failure (which @@ -2656,18 +2661,20 @@ Return Value: // pages and update the MDL with physical page information. //
- try { + _SEH2_TRY {
MmProbeAndLockPages( Vcb->SectorCacheIrp->MdlAddress, KernelMode, (LOCK_OPERATION) IoWriteAccess ); } +#ifdef _MSC_VER #pragma warning(suppress: 6320) - except(EXCEPTION_EXECUTE_HANDLER) { +#endif + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
IoFreeMdl( Vcb->SectorCacheIrp->MdlAddress ); Vcb->SectorCacheIrp->MdlAddress = NULL; - } + } _SEH2_END;
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
@@ -2738,10 +2745,10 @@ Return Value:
Result = TRUE; } - finally { + _SEH2_FINALLY {
CdReleaseCache( IrpContext); - } + } _SEH2_END;
return Result; } @@ -3418,6 +3425,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdMultiSyncCompletionRoutine ( PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -3505,6 +3513,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdMultiAsyncCompletionRoutine ( PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -3624,6 +3633,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdSingleSyncCompletionRoutine ( PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -3687,6 +3697,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdSingleAsyncCompletionRoutine ( PDEVICE_OBJECT DeviceObject, PIRP Irp, diff --git a/drivers/filesystems/cdfs_new/dirctrl.c b/drivers/filesystems/cdfs_new/dirctrl.c index 71cfccb6ba..08e8317f94 100755 --- a/drivers/filesystems/cdfs_new/dirctrl.c +++ b/drivers/filesystems/cdfs_new/dirctrl.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -292,7 +292,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify the Fcb is still good. @@ -504,7 +504,7 @@ Return Value: // such trickery. //
- try { + _SEH2_TRY {
// // Zero and initialize the base part of the current entry. @@ -579,6 +579,9 @@ Return Value: NamesInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
break; + + /* ReactOS Change: GCC "enumeration value not handled in switch" */ + default: break; }
// @@ -712,8 +715,10 @@ Return Value: LastEntry = NextEntry; NextEntry = QuadAlign( Information );
+#ifdef _MSC_VER #pragma warning(suppress: 6320) - } except (EXCEPTION_EXECUTE_HANDLER) { +#endif + } _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
// // We had a problem filling in the user's buffer, so stop and @@ -722,13 +727,13 @@ Return Value: //
Information = 0; - try_leave( Status = GetExceptionCode()); - } + try_leave( Status = _SEH2_GetExceptionCode()); + } _SEH2_END; }
DoCcbUpdate = TRUE;
- } finally { + } _SEH2_FINALLY {
// // Cleanup our search context - *before* aquiring the FCB mutex exclusive, @@ -767,7 +772,7 @@ Return Value: //
CdReleaseFile( IrpContext, Fcb ); - } + } _SEH2_END;
// // Complete the request here. @@ -836,7 +841,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify the Vcb. @@ -861,14 +866,14 @@ Return Value: NULL, NULL );
- } finally { + } _SEH2_FINALLY {
// // Release the Vcb. //
CdReleaseVcb( IrpContext, IrpContext->Vcb ); - } + } _SEH2_END;
// // Cleanup the IrpContext. diff --git a/drivers/filesystems/cdfs_new/dirsup.c b/drivers/filesystems/cdfs_new/dirsup.c index b1667d3d3f..364b78e8e9 100755 --- a/drivers/filesystems/cdfs_new/dirsup.c +++ b/drivers/filesystems/cdfs_new/dirsup.c @@ -65,7 +65,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module diff --git a/drivers/filesystems/cdfs_new/fieldoff.c b/drivers/filesystems/cdfs_new/fieldoff.c index 0aecc39288..b9d457521f 100755 --- a/drivers/filesystems/cdfs_new/fieldoff.c +++ b/drivers/filesystems/cdfs_new/fieldoff.c @@ -1,4 +1,4 @@ -#include "CdProcs.h" +#include "cdprocs.h" #include <stdio.h>
#define doit(a,b) { printf("%s %04lx %4lx %s\n", #a, FIELD_OFFSET(a,b), sizeof(d.b), #b); } diff --git a/drivers/filesystems/cdfs_new/fileinfo.c b/drivers/filesystems/cdfs_new/fileinfo.c index cd9f1af38a..62c929bac4 100755 --- a/drivers/filesystems/cdfs_new/fileinfo.c +++ b/drivers/filesystems/cdfs_new/fileinfo.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -167,7 +167,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // We only support query on file and directory handles. @@ -327,7 +327,7 @@ Return Value:
Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length;
- } finally { + } _SEH2_FINALLY {
// // Release the file. @@ -337,7 +337,7 @@ Return Value:
CdReleaseFile( IrpContext, Fcb ); } - } + } _SEH2_END;
// // Complete the request if we didn't raise. @@ -409,7 +409,7 @@ Return Value:
CdAcquireFileShared( IrpContext, Fcb );
- try { + _SEH2_TRY {
// // Make sure the Fcb is in a usable condition. This @@ -448,10 +448,10 @@ Return Value: Status = STATUS_SUCCESS;
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
CdReleaseFile( IrpContext, Fcb ); - } + } _SEH2_END;
// // Complete the request if there was no raise. @@ -466,6 +466,7 @@ _Function_class_(FAST_IO_QUERY_BASIC_INFO) _IRQL_requires_same_ _Success_(return != FALSE) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastQueryBasicInfo ( _In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, @@ -543,7 +544,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Only deal with 'good' Fcb's. @@ -573,12 +574,12 @@ Return Value: Result = TRUE; }
- } finally { + } _SEH2_FINALLY {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Result; } @@ -588,6 +589,7 @@ _Function_class_(FAST_IO_QUERY_STANDARD_INFO) _IRQL_requires_same_ _Success_(return != FALSE) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastQueryStdInfo ( _In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, @@ -665,7 +667,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Only deal with 'good' Fcb's. @@ -705,12 +707,12 @@ Return Value: Result = TRUE; }
- } finally { + } _SEH2_FINALLY {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Result; } @@ -720,6 +722,7 @@ _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO) _IRQL_requires_same_ _Success_(return != FALSE) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastQueryNetworkInfo ( _In_ PFILE_OBJECT FileObject, _In_ BOOLEAN Wait, @@ -797,7 +800,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Only deal with 'good' Fcb's. @@ -842,12 +845,12 @@ Return Value: Result = TRUE; }
- } finally { + } _SEH2_FINALLY {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Result; } @@ -1272,7 +1275,7 @@ Return Value: PUNICODE_STRING NameToUse; ULONG DirentOffset;
- COMPOUND_PATH_ENTRY CompoundPathEntry = {0}; + COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */ FILE_ENUM_CONTEXT FileContext;
PFCB ParentFcb = NULL; @@ -1307,7 +1310,7 @@ Return Value: // Use a try-finally to cleanup the structures. //
- try { + _SEH2_TRY {
ParentFcb = Fcb->ParentFcb; CdAcquireFileShared( IrpContext, ParentFcb ); @@ -1418,12 +1421,12 @@ Return Value: RtlCopyMemory( Buffer->FileName, ShortNameBuffer, Buffer->FileNameLength );
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
if (CleanupFileLookup) {
CdCleanupDirContext( IrpContext, &DirContext ); - CdCleanupDirent( IrpContext, &Dirent ); + CdCleanupDirent( IrpContext, &Dirent );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
} else if (CleanupDirectoryLookup) {
@@ -1435,7 +1438,7 @@ Return Value:
CdReleaseFile( IrpContext, ParentFcb ); } - } + } _SEH2_END;
// // Reduce the available bytes by the amount stored into this buffer. diff --git a/drivers/filesystems/cdfs_new/filobsup.c b/drivers/filesystems/cdfs_new/filobsup.c index 1354bc1152..d957a795c4 100755 --- a/drivers/filesystems/cdfs_new/filobsup.c +++ b/drivers/filesystems/cdfs_new/filobsup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -109,8 +109,10 @@ Return Value: FileObject->FsContext = Fcb; FileObject->FsContext2 = Ccb;
+#ifdef _MSC_VER #pragma warning( suppress: 4213 ) - SetFlag( ((ULONG_PTR) FileObject->FsContext2), TypeOfOpen ); +#endif + SetFlag( (*(PULONG_PTR)&FileObject->FsContext2), TypeOfOpen ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
// // Set the Vpb field in the file object. @@ -186,8 +188,10 @@ Return Value: *Fcb = FileObject->FsContext; *Ccb = FileObject->FsContext2;
+#ifdef _MSC_VER #pragma warning( suppress: 4213 ) - ClearFlag( (ULONG_PTR) *Ccb, TYPE_OF_OPEN_MASK ); +#endif + ClearFlag( (*(PULONG_PTR)Ccb), TYPE_OF_OPEN_MASK ); /* ReactOS Change: GCC "invalid lvalue in assignment" */ }
// diff --git a/drivers/filesystems/cdfs_new/fsctrl.c b/drivers/filesystems/cdfs_new/fsctrl.c index 8a113f04ec..8e039ef54b 100755 --- a/drivers/filesystems/cdfs_new/fsctrl.c +++ b/drivers/filesystems/cdfs_new/fsctrl.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -532,7 +532,9 @@ CdReMountOldVcb (
IoAcquireVpbSpinLock( &SavedIrql );
+#ifdef _MSC_VER #pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif NewVcb->Vpb->RealDevice->Vpb = OldVcb->Vpb;
OldVcb->Vpb->RealDevice = NewVcb->Vpb->RealDevice; @@ -639,6 +641,10 @@ Return Value: ULONG TocDiskFlags = 0; ULONG MediaChangeCount = 0;
+#ifdef __REACTOS__ + DEVICE_TYPE FilesystemDeviceType; +#endif + #ifdef CDFS_TELEMETRY_DATA GUID VolumeGuid; GUID VolumeCorrelationId = { 0 }; @@ -651,7 +657,16 @@ Return Value: // always be waitable. //
+#ifdef __REACTOS__ + if (IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) { + FilesystemDeviceType = FILE_DEVICE_DISK_FILE_SYSTEM; + } else { +#endif NT_ASSERT( Vpb->RealDevice->DeviceType == FILE_DEVICE_CD_ROM ); +#ifdef __REACTOS__ + FilesystemDeviceType = FILE_DEVICE_CD_ROM_FILE_SYSTEM; + } +#endif NT_ASSERT( FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ));
#ifdef CDFS_TELEMETRY_DATA @@ -697,7 +712,11 @@ Return Value: //
Status = CdPerformDevIoCtrl( IrpContext, +#ifndef __REACTOS__ IOCTL_CDROM_CHECK_VERIFY, +#else + (FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_CHECK_VERIFY : IOCTL_CDROM_CHECK_VERIFY), +#endif DeviceObjectWeTalkTo, &MediaChangeCount, sizeof(ULONG), @@ -726,7 +745,11 @@ Return Value: //
Status = CdPerformDevIoCtrl( IrpContext, +#ifndef __REACTOS__ IOCTL_CDROM_GET_DRIVE_GEOMETRY, +#else + (FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_GET_DRIVE_GEOMETRY : IOCTL_CDROM_GET_DRIVE_GEOMETRY), +#endif DeviceObjectWeTalkTo, &DiskGeometry, sizeof( DISK_GEOMETRY ), @@ -769,7 +792,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Allocate a buffer to query the TOC. @@ -794,7 +817,11 @@ Return Value: Status = IoCreateDevice( CdData.DriverObject, sizeof( VOLUME_DEVICE_OBJECT ) - sizeof( DEVICE_OBJECT ), NULL, +#ifndef __REACTOS__ FILE_DEVICE_CD_ROM_FILE_SYSTEM, +#else + FilesystemDeviceType, +#endif 0, FALSE, (PDEVICE_OBJECT *) &VolDo ); @@ -848,7 +875,21 @@ Return Value:
if (Status != STATUS_SUCCESS) {
+#ifdef __REACTOS__ + + // + // Don't bail out if that was a disk based ISO image, it is legit + // + + if (FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) { + CdFreePool( &CdromToc ); + Status = STATUS_SUCCESS; + } else { +#endif try_leave( Status ); +#ifdef __REACTOS__ + } +#endif }
// @@ -1164,7 +1205,7 @@ Return Value:
Status = STATUS_SUCCESS;
- } finally { + } _SEH2_FINALLY {
// // Free the TOC buffer if not in the Vcb. @@ -1188,7 +1229,7 @@ Return Value: // If we are not mounting the device, then set the verify bit again. //
- if ((AbnormalTermination() || (Status != STATUS_SUCCESS)) && + if ((_SEH2_AbnormalTermination() || (Status != STATUS_SUCCESS)) && SetDoVerifyOnFail) {
CdMarkRealDevForVerify( IrpContext->RealDevice); @@ -1225,7 +1266,7 @@ Return Value: //
CdReleaseCdData( IrpContext ); - } + } _SEH2_END;
// // Now send mount notification. @@ -1338,7 +1379,7 @@ Return Value:
CdAcquireCdData( IrpContext );
- try { + _SEH2_TRY {
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE ); ReleaseVcb = TRUE; @@ -1682,8 +1723,7 @@ Return Value: } }
- } - finally { + } _SEH2_FINALLY {
// // Free the TOC buffer if allocated. @@ -1708,7 +1748,7 @@ Return Value: }
CdReleaseCdData( IrpContext ); - } + } _SEH2_END;
// // Now send mount notification. @@ -1838,7 +1878,7 @@ Return Value: // Use a try finally to free the Fcb. //
- try { + _SEH2_TRY {
// // Verify the Fcb. @@ -1868,14 +1908,14 @@ Return Value:
Irp = NULL;
- } finally { + } _SEH2_FINALLY {
// // Release all of our resources //
CdReleaseFcb( IrpContext, Fcb ); - } + } _SEH2_END;
// // Complete the request if there was no exception. @@ -1951,7 +1991,7 @@ Return Value: Vcb = Fcb->Vcb; CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
- try { + _SEH2_TRY {
// // Verify the Vcb. @@ -1961,7 +2001,7 @@ Return Value:
Status = CdLockVolumeInternal( IrpContext, Vcb, IrpSp->FileObject );
- } finally { + } _SEH2_FINALLY {
// // Release the Vcb. @@ -1969,11 +2009,11 @@ Return Value:
CdReleaseVcb( IrpContext, Vcb );
- if (AbnormalTermination() || !NT_SUCCESS( Status )) { + if (_SEH2_AbnormalTermination() || !NT_SUCCESS( Status )) {
FsRtlNotifyVolumeEvent( IrpSp->FileObject, FSRTL_VOLUME_LOCK_FAILED ); } - } + } _SEH2_END;
// // Complete the request if there haven't been any exceptions. @@ -2454,7 +2494,12 @@ Return Value: // We only allow the invalidate call to come in on our file system devices. //
+#ifndef __REACTOS__ if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) { +#else + if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject && + IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) { +#endif
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST );
@@ -2507,7 +2552,7 @@ Return Value: 0, *IoFileObjectType, KernelMode, - &FileToMarkBad, + (PVOID*)&FileToMarkBad, /* ReactOS Change: GCC "passing argument 5 of 'ObReferenceObjectByHandle' from incompatible pointer type" */ NULL );
if (!NT_SUCCESS(Status)) { @@ -2578,7 +2623,9 @@ Return Value:
IoAcquireVpbSpinLock( &SavedIrql );
+#ifdef _MSC_VER #pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif if (DeviceToMarkBad->Vpb == Vcb->Vpb) {
PVPB NewVpb = Vcb->SwapVpb; @@ -2592,11 +2639,15 @@ Return Value: NewVpb->Size = sizeof( VPB ); NewVpb->RealDevice = DeviceToMarkBad;
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(disable: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif NewVpb->Flags = FlagOn( DeviceToMarkBad->Vpb->Flags, VPB_REMOVE_PENDING ); DeviceToMarkBad->Vpb = NewVpb; +#ifdef _MSC_VER #pragma prefast(pop) +#endif
Vcb->SwapVpb = NULL; } @@ -2871,7 +2922,7 @@ Return Value: // Check for whether this device supports XA and multi-session. //
- try { + _SEH2_TRY {
// // Allocate a buffer for the last session information. @@ -2949,10 +3000,10 @@ Return Value: ThisPass += 1; }
- } finally { + } _SEH2_FINALLY {
if (CdromToc != NULL) { CdFreePool( &CdromToc ); } - } + } _SEH2_END; }
// diff --git a/drivers/filesystems/cdfs_new/fspdisp.c b/drivers/filesystems/cdfs_new/fspdisp.c index b38548d6b2..e119b117e8 100755 --- a/drivers/filesystems/cdfs_new/fspdisp.c +++ b/drivers/filesystems/cdfs_new/fspdisp.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -24,6 +24,7 @@ Abstract:
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFspDispatch ( _In_ PVOID Context ) @@ -95,7 +96,7 @@ Return Value:
while (TRUE) {
- try { + _SEH2_TRY {
// // Reinitialize for the next try at completing this @@ -185,10 +186,10 @@ Return Value: CdCompleteRequest( IrpContext, Irp, Status ); }
- } except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) { + } _SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
- Status = CdProcessException( IrpContext, Irp, GetExceptionCode() ); - } + Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() ); + } _SEH2_END;
// // Break out of the loop if we didn't get CANT_WAIT. diff --git a/drivers/filesystems/cdfs_new/lockctrl.c b/drivers/filesystems/cdfs_new/lockctrl.c index edf0d07af1..6c0352c9ab 100755 --- a/drivers/filesystems/cdfs_new/lockctrl.c +++ b/drivers/filesystems/cdfs_new/lockctrl.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -89,7 +89,7 @@ Return Value: Status = FsRtlCheckOplock( CdGetFcbOplock(Fcb), Irp, IrpContext, - CdOplockComplete, + (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ NULL );
// @@ -138,6 +138,7 @@ Return Value:
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastLock ( _In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, @@ -225,7 +226,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // We check whether we can proceed based on the state of the file oplocks. @@ -249,7 +250,9 @@ Return Value: // Now call the FsRtl routine to perform the lock request. //
+#ifdef _MSC_VER #pragma prefast(suppress: 28159, "prefast thinks this is an obsolete routine, but it is ok for CDFS to use it") +#endif if ((Results = FsRtlFastLock( Fcb->FileLock, FileObject, FileOffset, @@ -277,16 +280,17 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Results; }
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastUnlockSingle ( _In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, @@ -369,7 +373,7 @@ Return Value:
FsRtlEnterFileSystem();
- try { + _SEH2_TRY {
// // We check whether we can proceed based on the state of the file oplocks. @@ -419,16 +423,17 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Results; }
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastUnlockAll ( _In_ PFILE_OBJECT FileObject, _In_ PEPROCESS ProcessId, @@ -502,7 +507,7 @@ Return Value:
FsRtlEnterFileSystem();
- try { + _SEH2_TRY {
// // We check whether we can proceed based on the state of the file oplocks. @@ -543,16 +548,17 @@ Return Value: CdUnlockFcb( IrpContext, Fcb );
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Results; }
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFastUnlockAllByKey ( _In_ PFILE_OBJECT FileObject, _In_ PVOID ProcessId, @@ -629,7 +635,7 @@ Return Value:
FsRtlEnterFileSystem();
- try { + _SEH2_TRY {
// // We check whether we can proceed based on the state of the file oplocks. @@ -671,10 +677,10 @@ Return Value: CdUnlockFcb( IrpContext, Fcb );
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
FsRtlExitFileSystem(); - } + } _SEH2_END;
return Results; } diff --git a/drivers/filesystems/cdfs_new/namesup.c b/drivers/filesystems/cdfs_new/namesup.c index dc3ed319c1..96e3aa3d3e 100755 --- a/drivers/filesystems/cdfs_new/namesup.c +++ b/drivers/filesystems/cdfs_new/namesup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -171,10 +171,14 @@ Return Value:
while (RemainingByteCount != 0) {
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(suppress:26014, "RemainingByteCount is even") +#endif *Destination = *Source; +#ifdef _MSC_VER #pragma prefast(pop) +#endif
Source += 2; Destination += 2; @@ -251,7 +255,9 @@ Return Value: // copy the data. //
+#ifdef _MSC_VER #pragma prefast( suppress:26015, "CD_NAME structures have two UNICODE_STRING structures pointing to the same allocation. there is no way to tell prefast this is the case and that the allocation is always big enough."); +#endif *(UpcaseName->VersionString.Buffer) = L';';
UpcaseName->VersionString.Buffer += 1; @@ -759,10 +765,14 @@ Return Value: // may use 2 bytes as DBCS characters. //
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(suppress:26014, "OemNameOffset <= BaseNameOffset throughout this loop; OemName buffer previously allocated based on ShortName's length.") +#endif if (FsRtlIsLeadDbcsCharacter(OemName.Buffer[OemNameOffset])) { +#ifdef _MSC_VER #pragma prefast(pop) +#endif
OemNameOffset += 2;
@@ -796,11 +806,15 @@ Return Value: // Now copy the dirent string into the biased name buffer. //
+#ifdef _MSC_VER #pragma prefast(push) +#endif RtlCopyMemory( NextWchar, BiasedShortName.Buffer, BiasedShortName.Length ); +#ifdef _MSC_VER #pragma prefast(pop) +#endif
Length += BiasedShortName.Length; NextWchar += (BiasedShortName.Length / sizeof( WCHAR )); diff --git a/drivers/filesystems/cdfs_new/pathsup.c b/drivers/filesystems/cdfs_new/pathsup.c index bd5d1dcfd7..97d3468598 100755 --- a/drivers/filesystems/cdfs_new/pathsup.c +++ b/drivers/filesystems/cdfs_new/pathsup.c @@ -73,7 +73,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module diff --git a/drivers/filesystems/cdfs_new/pnp.c b/drivers/filesystems/cdfs_new/pnp.c index b3237df35c..02609e72f1 100755 --- a/drivers/filesystems/cdfs_new/pnp.c +++ b/drivers/filesystems/cdfs_new/pnp.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -62,6 +62,7 @@ CdPnpCancelRemove ( IO_COMPLETION_ROUTINE CdPnpCompletionRoutine;
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdPnpCompletionRoutine ( _In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, @@ -142,7 +143,9 @@ Return Value: // field that takes us past the end of an ordinary device object. //
+#ifdef _MSC_VER #pragma prefast(suppress: 28175, "this is a filesystem driver, touching the size member is allowed") +#endif if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) || NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
@@ -812,6 +815,7 @@ Return Value: //
NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdPnpCompletionRoutine ( _In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, diff --git a/drivers/filesystems/cdfs_new/prefxsup.c b/drivers/filesystems/cdfs_new/prefxsup.c index 6a7b6c590d..2acb2bc62c 100755 --- a/drivers/filesystems/cdfs_new/prefxsup.c +++ b/drivers/filesystems/cdfs_new/prefxsup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module diff --git a/drivers/filesystems/cdfs_new/read.c b/drivers/filesystems/cdfs_new/read.c index 43e8f9cecb..4e3046d444 100755 --- a/drivers/filesystems/cdfs_new/read.c +++ b/drivers/filesystems/cdfs_new/read.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -34,14 +34,24 @@ Abstract: // This macro just puts a nice little try-except around RtlZeroMemory //
+#ifndef __REACTOS__ #define SafeZeroMemory(IC,AT,BYTE_COUNT) { \ - try { \ + _SEH2_TRY { \ RtlZeroMemory( (AT), (BYTE_COUNT) ); \ __pragma(warning(suppress: 6320)) \ - } except( EXCEPTION_EXECUTE_HANDLER ) { \ + } _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \ CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \ - } \ + } _SEH2_END; \ } +#else +#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \ + _SEH2_TRY { \ + RtlZeroMemory( (AT), (BYTE_COUNT) ); \ + } _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \ + CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \ + } _SEH2_END; \ +} +#endif
// // Read ahead amount used for normal data files @@ -186,7 +196,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify the Fcb. Allow reads if this is a DASD handle that is @@ -231,8 +241,8 @@ Return Value: Status = FsRtlCheckOplock( CdGetFcbOplock(Fcb), Irp, IrpContext, - CdOplockComplete, - CdPrePostIrp ); + (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ + (PVOID)CdPrePostIrp );/* ReactOS Change: GCC "assignment from incompatible pointer type" */
// // If the result is not STATUS_SUCCESS then the Irp was completed @@ -530,7 +540,7 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
// // Release the Fcb. @@ -540,7 +550,7 @@ Return Value:
CdReleaseFile( IrpContext, Fcb ); } - } + } _SEH2_END;
// // Post the request if we got CANT_WAIT. diff --git a/drivers/filesystems/cdfs_new/resrcsup.c b/drivers/filesystems/cdfs_new/resrcsup.c index 86b2b91aa8..c9eaa7be26 100755 --- a/drivers/filesystems/cdfs_new/resrcsup.c +++ b/drivers/filesystems/cdfs_new/resrcsup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -96,7 +96,9 @@ Return Value: switch (Type) { case AcquireExclusive:
+#ifdef _MSC_VER #pragma prefast( suppress:28137, "prefast believes Wait should be a constant, but this is ok for CDFS" ) +#endif Acquired = ExAcquireResourceExclusiveLite( Resource, Wait ); break;
@@ -133,6 +135,7 @@ Return Value: _Requires_lock_held_(_Global_critical_region_) _When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource)) BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdAcquireForCache ( _Inout_ PFCB Fcb, _In_ BOOLEAN Wait @@ -171,6 +174,7 @@ Return Value: _Requires_lock_held_(_Global_critical_region_) _Releases_lock_(*Fcb->Resource) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdReleaseFromCache ( _Inout_ PFCB Fcb ) @@ -205,6 +209,7 @@ Return Value:
BOOLEAN +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdNoopAcquire ( _In_ PVOID Fcb, _In_ BOOLEAN Wait @@ -240,6 +245,7 @@ Return Value:
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdNoopRelease ( _In_ PVOID Fcb ) @@ -267,10 +273,10 @@ Return Value: UNREFERENCED_PARAMETER( Fcb ); }
-
_Requires_lock_held_(_Global_critical_region_) NTSTATUS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFilterCallbackAcquireForCreateSection ( _In_ PFS_FILTER_CALLBACK_DATA CallbackData, _Unreferenced_parameter_ PVOID *CompletionContext @@ -355,6 +361,7 @@ Return Value: _Function_class_(FAST_IO_RELEASE_FILE) _Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdReleaseForCreateSection ( _In_ PFILE_OBJECT FileObject ) diff --git a/drivers/filesystems/cdfs_new/shutdown.c b/drivers/filesystems/cdfs_new/shutdown.c index ca42635afd..d6c70580a6 100644 --- a/drivers/filesystems/cdfs_new/shutdown.c +++ b/drivers/filesystems/cdfs_new/shutdown.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module diff --git a/drivers/filesystems/cdfs_new/strucsup.c b/drivers/filesystems/cdfs_new/strucsup.c index 5f354ac213..8082d5f1fb 100755 --- a/drivers/filesystems/cdfs_new/strucsup.c +++ b/drivers/filesystems/cdfs_new/strucsup.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -167,6 +167,7 @@ CdDeleteFcbNonpaged ( RTL_GENERIC_COMPARE_ROUTINE CdFcbTableCompare;
RTL_GENERIC_COMPARE_RESULTS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFcbTableCompare ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ PVOID Fid1, @@ -177,6 +178,7 @@ CdFcbTableCompare ( RTL_GENERIC_ALLOCATE_ROUTINE CdAllocateFcbTable;
PVOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdAllocateFcbTable ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ CLONG ByteSize @@ -186,6 +188,7 @@ CdAllocateFcbTable ( RTL_GENERIC_FREE_ROUTINE CdDeallocateFcbTable;
VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdDeallocateFcbTable ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer @@ -318,19 +321,19 @@ Return Value: // uninitialize the notify structures before returning. //
- try { + _SEH2_TRY {
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( CdNonPagedPool, sizeof( VPB ), TAG_VPB ); } - finally { + _SEH2_FINALLY {
- if (AbnormalTermination()) { + if (_SEH2_AbnormalTermination()) {
FsRtlNotifyUninitializeSync( &Vcb->NotifySync ); } - } + } _SEH2_END;
// // Nothing beyond this point should raise. @@ -475,7 +478,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Copy the block size and compute the various block masks. @@ -862,10 +865,10 @@ Return Value: SetFlag( Vcb->VcbState, VCB_STATE_ISO ); }
- } finally { + } _SEH2_FINALLY {
if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); } - } + } _SEH2_END; }
@@ -968,7 +971,9 @@ Return Value: // // Now delete the volume device object. // +#ifdef _MSC_VER #pragma prefast( suppress: __WARNING_BUFFER_UNDERFLOW, "This is ok, the Vcb is embedded in our volume device object, and that is what we are really deleting." ) +#endif IoDeleteDevice( (PDEVICE_OBJECT) CONTAINING_RECORD( Vcb, VOLUME_DEVICE_OBJECT, Vcb )); @@ -1069,7 +1074,9 @@ Return Value:
default:
+#ifdef _MSC_VER #pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "This is a bug." ) +#endif CdBugCheck( 0, 0, 0 ); }
@@ -1262,7 +1269,7 @@ Return Value:
CdLockFcb( IrpContext, Fcb );
- try { + _SEH2_TRY {
// // Initialize the common header in the Fcb. The node type is already @@ -1385,10 +1392,10 @@ Return Value: CdInsertFcbTable( IrpContext, Fcb ); SetFlag( Fcb->FcbState, FCB_STATE_IN_FCB_TABLE );
- } finally { + } _SEH2_FINALLY {
CdUnlockFcb( IrpContext, Fcb ); - } + } _SEH2_END;
return; } @@ -1600,7 +1607,12 @@ Return Value: // occur in the context of fileobjects (i.e., mount). //
+#ifndef __REACTOS__ if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject) { +#else + if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject || + IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) { +#endif
if (IrpSp->FileObject != NULL && IrpSp->MajorFunction != IRP_MJ_CREATE && @@ -1678,7 +1690,12 @@ Return Value: // the Vcb field. //
+#ifndef __REACTOS__ if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) { +#else + if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject && + IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) { +#endif
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
@@ -1959,7 +1976,7 @@ Return Value: // Use a try-finally to safely clear the top-level field. //
- try { + _SEH2_TRY {
// // Loop until we find an Fcb we can't remove. @@ -2063,7 +2080,7 @@ Return Value:
} while (CurrentFcb != NULL);
- } finally { + } _SEH2_FINALLY {
// // Release the current Fcb if we have acquired it. @@ -2079,7 +2096,7 @@ Return Value: //
ClearFlag( IrpContext->TopLevel->Flags, IRP_CONTEXT_FLAG_IN_TEARDOWN ); - } + } _SEH2_END;
*RemovedStartingFcb = (CurrentFcb != StartingFcb); return; @@ -2493,7 +2510,7 @@ Return Value: Vcb->PathTableFcb = NULL; }
- CdDeallocateFcbIndex( IrpContext, Fcb ); + CdDeallocateFcbIndex( IrpContext, *(PVOID*)&Fcb );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */ break;
case CDFS_NTC_FCB_DATA : @@ -2511,7 +2528,7 @@ Return Value: Vcb->VolumeDasdFcb = NULL; }
- CdDeallocateFcbData( IrpContext, Fcb ); + CdDeallocateFcbData( IrpContext, *(PVOID*)&Fcb );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */ }
// @@ -2615,7 +2632,7 @@ Return Value:
ExDeleteResourceLite( &FcbNonpaged->FcbResource );
- CdDeallocateFcbNonpaged( IrpContext, FcbNonpaged ); + CdDeallocateFcbNonpaged( IrpContext, *(PVOID*)&FcbNonpaged );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
return; } @@ -2626,6 +2643,7 @@ Return Value: //
RTL_GENERIC_COMPARE_RESULTS +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdFcbTableCompare ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ PVOID Fid1, @@ -2683,6 +2701,7 @@ Return Value: //
PVOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdAllocateFcbTable ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ CLONG ByteSize @@ -2719,6 +2738,7 @@ Return Value: // Local support routine // VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdDeallocateFcbTable ( _In_ PRTL_GENERIC_TABLE FcbTable, _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer diff --git a/drivers/filesystems/cdfs_new/verfysup.c b/drivers/filesystems/cdfs_new/verfysup.c index 015b367b1d..f53769a215 100755 --- a/drivers/filesystems/cdfs_new/verfysup.c +++ b/drivers/filesystems/cdfs_new/verfysup.c @@ -13,7 +13,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -92,7 +92,7 @@ Return Value: Vcb = &CONTAINING_RECORD( IrpSp->DeviceObject, VOLUME_DEVICE_OBJECT, DeviceObject )->Vcb; - try { + _SEH2_TRY {
// // Send down the verify FSCTL. Note that this is sent to the @@ -206,7 +206,7 @@ Return Value: Status = CdFsdPostRequest( IrpContext, Irp ); }
- } except(CdExceptionFilter( IrpContext, GetExceptionInformation() )) { + } _SEH2_EXCEPT(CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
// // We had some trouble trying to perform the verify or raised @@ -214,8 +214,8 @@ Return Value: // the error status that we get back from the execption code. //
- Status = CdProcessException( IrpContext, Irp, GetExceptionCode() ); - } + Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() ); + } _SEH2_END;
return Status; } @@ -384,7 +384,9 @@ Return Value:
IoAcquireVpbSpinLock( &SavedIrql );
+#ifdef _MSC_VER #pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif if (Vcb->Vpb->RealDevice->Vpb == Vcb->Vpb) {
CdMarkRealDevForVerify( Vcb->Vpb->RealDevice); @@ -602,6 +604,9 @@ Return Value: CdRaiseStatus( IrpContext, STATUS_FILE_INVALID ); } break; + + /* ReactOS Change: GCC "enumeration value not handled in switch" */ + default: break; } }
@@ -881,7 +886,9 @@ Return Value: // mount request. //
+#ifdef _MSC_VER #pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif if (OldVpb->RealDevice->Vpb == OldVpb) {
// @@ -897,11 +904,15 @@ Return Value: Vcb->SwapVpb->Type = IO_TYPE_VPB; Vcb->SwapVpb->Size = sizeof( VPB );
+#ifdef _MSC_VER #pragma prefast(push) #pragma prefast(disable: 28175, "this is a filesystem driver, touching the vpb is allowed") +#endif Vcb->SwapVpb->RealDevice = OldVpb->RealDevice; Vcb->SwapVpb->RealDevice->Vpb = Vcb->SwapVpb; +#ifdef _MSC_VER #pragma prefast(pop) +#endif
Vcb->SwapVpb->Flags = FlagOn( OldVpb->Flags, VPB_REMOVE_PENDING );
diff --git a/drivers/filesystems/cdfs_new/volinfo.c b/drivers/filesystems/cdfs_new/volinfo.c index 6640fd8aeb..7448dd5850 100755 --- a/drivers/filesystems/cdfs_new/volinfo.c +++ b/drivers/filesystems/cdfs_new/volinfo.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -59,6 +59,10 @@ CdQueryFsAttributeInfo ( _Inout_ PULONG Length );
+#ifdef __REACTOS__ +#define PFILE_FS_SECTOR_SIZE_INFORMATION PVOID +#endif + NTSTATUS CdQueryFsSectorSizeInfo ( _In_ PIRP_CONTEXT IrpContext, @@ -141,7 +145,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify the Vcb. @@ -184,6 +188,9 @@ Return Value: Status = CdQueryFsSectorSizeInfo( IrpContext, Fcb->Vcb, Irp->AssociatedIrp.SystemBuffer, &Length ); break; #endif + + /* ReactOS Change: GCC "enumeration value not handled in switch" */ + default: break; }
// @@ -192,14 +199,14 @@ Return Value:
Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
- } finally { + } _SEH2_FINALLY {
// // Release the Vcb. //
CdReleaseVcb( IrpContext, Fcb->Vcb ); - } + } _SEH2_END;
// // Complete the request if we didn't raise. diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff deleted file mode 100644 index f6144dd1d9..0000000000 --- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff +++ /dev/null @@ -1,985 +0,0 @@ -Index: drivers/filesystems/cdfs_new/deviosup.c -=================================================================== ---- drivers/filesystems/cdfs_new/deviosup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/deviosup.c (working copy) -@@ -165,6 +165,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdMultiSyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -172,6 +173,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdMultiAsyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -179,6 +181,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdSingleSyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -186,6 +189,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdSingleAsyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -2943,6 +2947,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdMultiSyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -3029,6 +3034,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdMultiAsyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -3066,7 +3072,8 @@ - - { - PCD_IO_CONTEXT IoContext = Context; -- PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); -+ /* ReactOS Change: GCC Unused Variable */ -+ //PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); - - AssertVerifyDeviceIrp( Irp ); - -@@ -3148,6 +3155,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdSingleSyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -3207,6 +3215,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdSingleAsyncCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -3267,7 +3276,7 @@ - // and finally, free the context record. - // - -- CdFreeIoContext( (PCD_IO_CONTEXT) Context ); -+ CdFreeIoContext( Context ); /* ReactOS Change: GCC "error: invalid lvalue in unary '&'" */ - return STATUS_SUCCESS; - - UNREFERENCED_PARAMETER( DeviceObject ); -Index: drivers/filesystems/cdfs_new/dirctrl.c -=================================================================== ---- drivers/filesystems/cdfs_new/dirctrl.c (revision 34615) -+++ drivers/filesystems/cdfs_new/dirctrl.c (working copy) -@@ -209,7 +209,7 @@ - - ULONG BaseLength; - -- PFILE_BOTH_DIR_INFORMATION DirInfo; -+ PFILE_BOTH_DIR_INFORMATION DirInfo = NULL; /* ReactOS Change: GCC Uninit var */ - PFILE_NAMES_INFORMATION NamesInfo; - PFILE_ID_FULL_DIR_INFORMATION IdFullDirInfo; - PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo; -@@ -579,6 +579,9 @@ - NamesInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes; - - break; -+ -+ /* ReactOS Change: GCC "enumeration value not handled in switch" */ -+ default: break; - } - - // -Index: drivers/filesystems/cdfs_new/create.c -=================================================================== ---- drivers/filesystems/cdfs_new/create.c (revision 34615) -+++ drivers/filesystems/cdfs_new/create.c (working copy) -@@ -2106,7 +2106,7 @@ - PFCB NextFcb; - PFCB ParentFcb = NULL; - -- NTSTATUS Status; -+ NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC uninitialized variable */ - - PAGED_CODE(); - -@@ -2757,8 +2757,8 @@ - OplockStatus = FsRtlCheckOplock( &Fcb->Oplock, - IrpContext->Irp, - IrpContext, -- CdOplockComplete, -- CdPrePostIrp ); -+ (PVOID)CdOplockComplete, /* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ (PVOID)CdPrePostIrp ); /* ReactOS Change: GCC "assignment from incompatible pointer type" */ - - if (OplockStatus == STATUS_PENDING) { - -@@ -2789,8 +2789,8 @@ - OplockStatus = FsRtlCheckOplock( &Fcb->Oplock, - IrpContext->Irp, - IrpContext, -- CdOplockComplete, -- CdPrePostIrp ); -+ (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ (PVOID)CdPrePostIrp );/* ReactOS Change: GCC "assignment from incompatible pointer type" */ - - if (OplockStatus == STATUS_PENDING) { - -Index: drivers/filesystems/cdfs_new/devctrl.c -=================================================================== ---- drivers/filesystems/cdfs_new/devctrl.c (revision 34615) -+++ drivers/filesystems/cdfs_new/devctrl.c (working copy) -@@ -27,6 +27,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdDevCtrlCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -64,7 +64,7 @@ - PIO_STACK_LOCATION IrpSp; - PIO_STACK_LOCATION NextIrpSp; - -- PVOID TargetBuffer = NULL; -+// PVOID TargetBuffer = NULL; /* ReactOS Change: GCC unused variable */ - - PAGED_CODE(); - -@@ -171,6 +172,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdDevCtrlCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -Index: drivers/filesystems/cdfs_new/close.c -=================================================================== ---- drivers/filesystems/cdfs_new/close.c (revision 34615) -+++ drivers/filesystems/cdfs_new/close.c (working copy) -@@ -77,6 +77,7 @@ - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdCloseWorker ( - IN PDEVICE_OBJECT DeviceObject, - IN PVOID Context -@@ -136,9 +137,9 @@ - // - // Continue processing until there are no more closes to process. - // -+ /* ReactOS Change: "GCC suggest parentheses around assignment used as truth value" */ -+ while ((IrpContext = CdRemoveClose( Vcb ))) { - -- while (IrpContext = CdRemoveClose( Vcb )) { -- - // - // If we don't have an IrpContext then use the one on the stack. - // Initialize it for this request. -@@ -165,7 +166,7 @@ - // Free the IrpContextLite. - // - -- CdFreeIrpContextLite( (PIRP_CONTEXT_LITE) IrpContext ); -+ CdFreeIrpContextLite( IrpContext ); /* ReactOS Change: GCC "error: invalid lvalue in unary '&'" */ - - // - // Remember we have the IrpContext from the stack. -@@ -662,6 +663,7 @@ - } - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdCloseWorker ( - IN PDEVICE_OBJECT DeviceObject, - IN PVOID Context -Index: drivers/filesystems/cdfs_new/dirsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/dirsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/dirsup.c (working copy) -@@ -465,7 +465,7 @@ - // Save a pointer to the time stamps. - // - -- Dirent->CdTime = RawDirent->RecordTime; -+ Dirent->CdTime = (PCHAR)RawDirent->RecordTime; /* ReactOS change: GCC "pointer targets in assignment differ in signedness" */ - - // - // Copy the dirent flags. -@@ -501,7 +501,7 @@ - } - - Dirent->FileNameLen = RawDirent->FileIdLen; -- Dirent->FileName = RawDirent->FileId; -+ Dirent->FileName = (PCHAR)RawDirent->FileId; /* ReactOS change: GCC "pointer targets in assignment differ in signedness" */ - - // - // If there are any remaining bytes at the end of the dirent then -@@ -1457,7 +1457,7 @@ - --*/ - - { -- XA_EXTENT_TYPE ExtentType; -+ XA_EXTENT_TYPE ExtentType = 0; /* ReactOS Change: GCC Uninit var */ - PCOMPOUND_DIRENT CurrentCompoundDirent; - PDIRENT CurrentDirent; - -Index: drivers/filesystems/cdfs_new/read.c -=================================================================== ---- drivers/filesystems/cdfs_new/read.c (revision 34615) -+++ drivers/filesystems/cdfs_new/read.c (working copy) -@@ -79,7 +79,7 @@ - --*/ - - { -- NTSTATUS Status; -+ NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC Uninit var */ - PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); - - TYPE_OF_OPEN TypeOfOpen; -@@ -225,8 +225,8 @@ - Status = FsRtlCheckOplock( &Fcb->Oplock, - Irp, - IrpContext, -- CdOplockComplete, -- CdPrePostIrp ); -+ (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ (PVOID)CdPrePostIrp );/* ReactOS Change: GCC "assignment from incompatible pointer type" */ - - // - // If the result is not STATUS_SUCCESS then the Irp was completed -Index: drivers/filesystems/cdfs_new/volinfo.c -=================================================================== ---- drivers/filesystems/cdfs_new/volinfo.c (revision 34615) -+++ drivers/filesystems/cdfs_new/volinfo.c (working copy) -@@ -166,8 +166,11 @@ - - Status = CdQueryFsAttributeInfo( IrpContext, Fcb->Vcb, Irp->AssociatedIrp.SystemBuffer, &Length ); - break; -+ -+ /* ReactOS Change: GCC "enumeration value not handled in switch" */ -+ default: break; - } -- -+ - // - // Set the information field to the number of bytes actually filled in - // -Index: drivers/filesystems/cdfs_new/cddata.c -=================================================================== ---- drivers/filesystems/cdfs_new/cddata.c (revision 34615) -+++ drivers/filesystems/cdfs_new/cddata.c (working copy) -@@ -417,7 +417,6 @@ - return Status; - } - -- - #ifdef CD_SANITY - - VOID -@@ -481,7 +480,6 @@ - - #endif - -- - LONG - CdExceptionFilter ( - IN PIRP_CONTEXT IrpContext, -@@ -1006,6 +1004,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastIoCheckIfPossible ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -Index: drivers/filesystems/cdfs_new/allocsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/allocsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/allocsup.c (working copy) -@@ -128,7 +128,7 @@ - { - BOOLEAN FirstPass = TRUE; - ULONG McbEntryOffset; -- PFCB ParentFcb; -+ PFCB ParentFcb = NULL; /* ReactOS Change: GCC uninitialized variable bug */ - BOOLEAN CleanupParent = FALSE; - - BOOLEAN UnlockFcb = FALSE; -Index: drivers/filesystems/cdfs_new/verfysup.c -=================================================================== ---- drivers/filesystems/cdfs_new/verfysup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/verfysup.c (working copy) -@@ -431,7 +431,7 @@ - ULONG MediaChangeCount = 0; - BOOLEAN ForceVerify = FALSE; - BOOLEAN DevMarkedForVerify; -- KIRQL SavedIrql; -+ //KIRQL SavedIrql; /* ReactOS Change: GCC Unused variable */ - - PAGED_CODE(); - -@@ -581,6 +581,9 @@ - - CdRaiseStatus( IrpContext, STATUS_FILE_INVALID ); - break; -+ -+ /* ReactOS Change: GCC "enumeration value not handled in switch" */ -+ default: break; - } - } - -@@ -613,7 +616,7 @@ - --*/ - - { -- NTSTATUS Status = STATUS_SUCCESS; -+ //NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC Unused variable */ - PVCB Vcb = Fcb->Vcb; - PDEVICE_OBJECT RealDevice = Vcb->Vpb->RealDevice; - PIRP Irp; -Index: drivers/filesystems/cdfs_new/filobsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/filobsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/filobsup.c (working copy) -@@ -105,7 +105,7 @@ - FileObject->FsContext = Fcb; - FileObject->FsContext2 = Ccb; - -- SetFlag( ((ULONG_PTR) FileObject->FsContext2), TypeOfOpen ); -+ SetFlag( (*(PULONG_PTR)&FileObject->FsContext2), TypeOfOpen ); /* ReactOS Change: GCC "invalid lvalue in assignment" */ - - // - // Set the Vpb field in the file object. -@@ -176,7 +176,7 @@ - *Fcb = FileObject->FsContext; - *Ccb = FileObject->FsContext2; - -- ClearFlag( (ULONG_PTR) *Ccb, TYPE_OF_OPEN_MASK ); -+ ClearFlag( (*(PULONG_PTR)Ccb), TYPE_OF_OPEN_MASK ); /* ReactOS Change: GCC "invalid lvalue in assignment" */ - } - - // -Index: drivers/filesystems/cdfs_new/pathsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/pathsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/pathsup.c (working copy) -@@ -764,7 +764,7 @@ - - PathEntry->PathEntryLength = WordAlign( PathEntry->PathEntryLength ); - -- PathEntry->DirName = RawPathEntry->DirId; -+ PathEntry->DirName = (PCHAR)RawPathEntry->DirId; /* ReactOS Change: GCC "assignment makes pointer from integer without a cast" */ - - return TRUE; - } -Index: drivers/filesystems/cdfs_new/cdprocs.h -=================================================================== ---- drivers/filesystems/cdfs_new/cdprocs.h (revision 34615) -+++ drivers/filesystems/cdfs_new/cdprocs.h (working copy) -@@ -902,33 +904,39 @@ - } - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdNoopAcquire ( - IN PVOID Fcb, - IN BOOLEAN Wait - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdNoopRelease ( - IN PVOID Fcb - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdAcquireForCache ( - IN PFCB Fcb, - IN BOOLEAN Wait - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdReleaseFromCache ( - IN PFCB Fcb - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdAcquireForCreateSection ( - IN PFILE_OBJECT FileObject - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdReleaseForCreateSection ( - IN PFILE_OBJECT FileObject - ); -@@ -1184,8 +1192,8 @@ - // Verification support routines. Contained in verfysup.c - // - -- --INLINE -+/* ReactOS Change: "LD multiple definition of `_CdOperationIsDasdOpen'" */ -+static inline - BOOLEAN - CdOperationIsDasdOpen( - IN PIRP_CONTEXT IrpContext -@@ -1272,12 +1280,14 @@ - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdPrePostIrp ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdOplockComplete ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp -@@ -1293,7 +1303,9 @@ - // otherwise - // - --//#ifndef BooleanFlagOn -+/* ReactOS Change: GCC doesn't understand the comment style */ -+/* -+ //#ifndef BooleanFlagOn - //#define BooleanFlagOn(F,SF) ( \ - // (BOOLEAN)(((F) & (SF)) != 0) \ - //) -@@ -1310,6 +1322,7 @@ - // (Flags) &= ~(SingleFlag); \ - //} - //#endif -+*/ - - // - // CAST -@@ -1598,6 +1611,7 @@ - // - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryBasicInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -@@ -1607,6 +1621,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryStdInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -@@ -1616,6 +1631,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastLock ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -@@ -1629,6 +1645,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockSingle ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -@@ -1640,6 +1657,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockAll ( - IN PFILE_OBJECT FileObject, - PEPROCESS ProcessId, -@@ -1648,6 +1666,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockAllByKey ( - IN PFILE_OBJECT FileObject, - PVOID ProcessId, -@@ -1657,6 +1676,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastIoCheckIfPossible ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -@@ -1669,6 +1689,7 @@ - ); - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryNetworkInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -@@ -1862,17 +1883,26 @@ - // - // #define try_return(S) { S; goto try_exit; } - // -+/* ReactOS Change: Remove SEH */ -+#define try -+#define leave goto exitLabel; -+#define finally if (0) goto exitLabel; exitLabel: -+#define except(x) while (0) -+#define GetExceptionCode() 0 -+#define AbnormalTermination() 0 - - #define try_return(S) { S; goto try_exit; } - #define try_leave(S) { S; leave; } - -+ - // - // Encapsulate safe pool freeing - // -+/* ReactOS Change: GCC "passing argument 1 of CdFreePool from incompatible pointer type" */ -+#define CdFreePool(x) _CdFreePool((PVOID*)(x)) - --INLINE --VOID --CdFreePool( -+/* ReactOS Change: "LD multiple definition of `_CdOperationIsDasdOpen'" */ -+static inline void _CdFreePool( - IN PVOID *Pool - ) - { -Index: drivers/filesystems/cdfs_new/resrcsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/resrcsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/resrcsup.c (working copy) -@@ -123,6 +123,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdAcquireForCache ( - IN PFCB Fcb, - IN BOOLEAN Wait -@@ -159,6 +160,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdReleaseFromCache ( - IN PFCB Fcb - ) -@@ -193,6 +195,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdNoopAcquire ( - IN PVOID Fcb, - IN BOOLEAN Wait -@@ -224,6 +227,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdNoopRelease ( - IN PVOID Fcb - ) -@@ -251,6 +255,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdAcquireForCreateSection ( - IN PFILE_OBJECT FileObject - ) -@@ -298,6 +303,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdReleaseForCreateSection ( - IN PFILE_OBJECT FileObject - ) -Index: drivers/filesystems/cdfs_new/namesup.c -=================================================================== ---- drivers/filesystems/cdfs_new/namesup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/namesup.c (working copy) -@@ -206,7 +206,7 @@ - - { - NTSTATUS Status; -- PVOID NewBuffer; -+ //PVOID NewBuffer; /* ReactOS Change: GCC Uninitialized variable */ - - PAGED_CODE(); - -Index: drivers/filesystems/cdfs_new/cdinit.c -=================================================================== ---- drivers/filesystems/cdfs_new/cdinit.c (revision 34615) -+++ drivers/filesystems/cdfs_new/cdinit.c (working copy) -@@ -22,12 +22,14 @@ - #define BugCheckFileId (CDFS_BUG_CHECK_CDINIT) - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ); - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdUnload( - IN PDRIVER_OBJECT DriverObject - ); -@@ -39,6 +41,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdShutdown ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp -@@ -57,6 +60,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath -@@ -169,6 +173,7 @@ - } - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdShutdown ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp -@@ -200,6 +205,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdUnload( - IN PDRIVER_OBJECT DriverObject - ) -@@ -310,10 +316,10 @@ - // Initialize the cache manager callback routines - // - -- CdData.CacheManagerCallbacks.AcquireForLazyWrite = &CdAcquireForCache; -- CdData.CacheManagerCallbacks.ReleaseFromLazyWrite = &CdReleaseFromCache; -- CdData.CacheManagerCallbacks.AcquireForReadAhead = &CdAcquireForCache; -- CdData.CacheManagerCallbacks.ReleaseFromReadAhead = &CdReleaseFromCache; -+ CdData.CacheManagerCallbacks.AcquireForLazyWrite = (PVOID)&CdAcquireForCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ CdData.CacheManagerCallbacks.ReleaseFromLazyWrite = (PVOID)&CdReleaseFromCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ CdData.CacheManagerCallbacks.AcquireForReadAhead = (PVOID)&CdAcquireForCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ -+ CdData.CacheManagerCallbacks.ReleaseFromReadAhead = (PVOID)&CdReleaseFromCache;/* ReactOS Change: GCC "assignment from incompatible pointer type" */ - - CdData.CacheManagerVolumeCallbacks.AcquireForLazyWrite = &CdNoopAcquire; - CdData.CacheManagerVolumeCallbacks.ReleaseFromLazyWrite = &CdNoopRelease; -Index: drivers/filesystems/cdfs_new/cdstruc.h -=================================================================== ---- drivers/filesystems/cdfs_new/cdstruc.h (revision 34615) -+++ drivers/filesystems/cdfs_new/cdstruc.h (working copy) -@@ -504,8 +504,8 @@ - // - - ULONG VcbCleanup; -- ULONG VcbReference; -- ULONG VcbUserReference; -+ LONG VcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */ -+ LONG VcbUserReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */ - - // - // Fcb for the Volume Dasd file, root directory and the Path Table. -@@ -655,7 +655,7 @@ - // executed later. - // - -- ULONG PostedRequestCount; -+ LONG PostedRequestCount; /* ReactOS Change: GCC "pointer targets in passing argument 1 of 'InterlockedDecrement' differ in signedness" */ - - // - // The following field indicates the number of IRP's waiting -@@ -878,7 +878,7 @@ - // - - ULONG FcbCleanup; -- ULONG FcbReference; -+ LONG FcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */ - ULONG FcbUserReference; - - // -Index: drivers/filesystems/cdfs_new/lockctrl.c -=================================================================== ---- drivers/filesystems/cdfs_new/lockctrl.c (revision 34615) -+++ drivers/filesystems/cdfs_new/lockctrl.c (working copy) -@@ -89,7 +89,7 @@ - Status = FsRtlCheckOplock( &Fcb->Oplock, - Irp, - IrpContext, -- CdOplockComplete, -+ (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ - NULL ); - - // -@@ -138,6 +138,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastLock ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -@@ -246,8 +247,8 @@ - // - // Now call the FsRtl routine to perform the lock request. - // -- -- if (Results = FsRtlFastLock( Fcb->FileLock, -+ /* ReactOS Change: GCC "suggest parentheses around assignment used as truth value" */ -+ if ((Results = FsRtlFastLock( Fcb->FileLock, - FileObject, - FileOffset, - Length, -@@ -257,7 +258,7 @@ - ExclusiveLock, - IoStatus, - NULL, -- FALSE )) { -+ FALSE ))) { - - // - // Set the flag indicating if Fast I/O is questionable. We -@@ -284,6 +285,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockSingle ( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, -@@ -424,6 +426,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockAll ( - IN PFILE_OBJECT FileObject, - PEPROCESS ProcessId, -@@ -546,6 +549,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastUnlockAllByKey ( - IN PFILE_OBJECT FileObject, - PVOID ProcessId, -Index: drivers/filesystems/cdfs_new/strucsup.c -=================================================================== ---- drivers/filesystems/cdfs_new/strucsup.c (revision 34615) -+++ drivers/filesystems/cdfs_new/strucsup.c (working copy) -@@ -438,7 +438,7 @@ - --*/ - - { -- ULONG Shift; -+ //ULONG Shift; /* ReactOS Change: GCC Unused variable */ - ULONG StartingBlock; - ULONG ByteCount; - -Index: drivers/filesystems/cdfs_new/fileinfo.c -=================================================================== ---- drivers/filesystems/cdfs_new/fileinfo.c (revision 34615) -+++ drivers/filesystems/cdfs_new/fileinfo.c (working copy) -@@ -460,6 +460,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryBasicInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -@@ -577,6 +578,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryStdInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -@@ -704,6 +706,7 @@ - - - BOOLEAN -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdFastQueryNetworkInfo ( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, -Index: drivers/filesystems/cdfs_new/fsctrl.c -=================================================================== ---- drivers/filesystems/cdfs_new/fsctrl.c (revision 34615) -+++ drivers/filesystems/cdfs_new/fsctrl.c (working copy) -@@ -82,7 +82,8 @@ - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp - ); -- -+ -+NTSTATUS /* ReactOS Change: Function did not have a type??? */ - CdIsVolumeDirty ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp -@@ -918,7 +919,7 @@ - - if (CdIsRemount( IrpContext, Vcb, &OldVcb )) { - -- KIRQL SavedIrql; -+ //KIRQL SavedIrql; /* ReactOS Change: GCC Unused variable */ - - ASSERT( NULL != OldVcb->SwapVpb ); - -@@ -1374,7 +1375,7 @@ - // Compute the length of the volume name - // - -- AnsiLabel.Buffer = CdRvdVolId( RawIsoVd, Vcb->VcbState ); -+ AnsiLabel.Buffer = (PCHAR)CdRvdVolId( RawIsoVd, Vcb->VcbState ); /* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ - AnsiLabel.MaximumLength = AnsiLabel.Length = VOLUME_ID_LENGTH; - - UnicodeLabel.MaximumLength = VOLUME_ID_LENGTH * sizeof( WCHAR ); -@@ -1401,7 +1402,7 @@ - } else { - - CdConvertBigToLittleEndian( IrpContext, -- CdRvdVolId( RawIsoVd, Vcb->VcbState ), -+ (PCHAR)CdRvdVolId( RawIsoVd, Vcb->VcbState ),/* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ - VOLUME_ID_LENGTH, - (PCHAR) VolumeLabel ); - -@@ -2005,7 +2006,7 @@ - // - // Local support routine - // -- -+NTSTATUS /* ReactOS Change: Function did not have a type??? */ - CdIsVolumeDirty ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp -@@ -2296,9 +2297,9 @@ - 0, - *IoFileObjectType, - KernelMode, -- &FileToMarkBad, -+ (PVOID*)&FileToMarkBad, /* ReactOS Change: GCC "passing argument 5 of 'ObReferenceObjectByHandle' from incompatible pointer type" */ - NULL ); - - if (!NT_SUCCESS(Status)) { -@@ -2642,8 +2643,8 @@ - // The track address is BigEndian, we need to flip the bytes. - // - -- Source = (PUCHAR) &CdromToc->TrackData[0].Address[3]; -- Dest = (PUCHAR) &BaseSector; -+ Source = (PCHAR) &CdromToc->TrackData[0].Address[3];/* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ -+ Dest = (PCHAR) &BaseSector; /* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ - - do { - -@@ -3118,7 +3119,7 @@ - if (NT_SUCCESS( RtlOemToUnicodeN( &Vcb->Vpb->VolumeLabel[0], - MAXIMUM_VOLUME_LABEL_LENGTH, - &Length, -- CdRvdVolId( RawIsoVd, Vcb->VcbState ), -+ (PCHAR)CdRvdVolId( RawIsoVd, Vcb->VcbState ),/* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ - VOLUME_ID_LENGTH ))) { - - Vcb->Vpb->VolumeLabelLength = (USHORT) Length; -@@ -3131,7 +3132,7 @@ - } else { - - CdConvertBigToLittleEndian( IrpContext, -- CdRvdVolId( RawIsoVd, Vcb->VcbState ), -+ (PCHAR)CdRvdVolId( RawIsoVd, Vcb->VcbState ),/* ReactOS Change: GCC "pointer targets in assignment differ in signedness" */ - VOLUME_ID_LENGTH, - (PCHAR) Vcb->Vpb->VolumeLabel ); - -Index: drivers/filesystems/cdfs_new/pnp.c -=================================================================== ---- drivers/filesystems/cdfs_new/pnp.c (revision 34615) -+++ drivers/filesystems/cdfs_new/pnp.c (working copy) -@@ -51,6 +51,7 @@ - ); - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdPnpCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -@@ -774,6 +775,7 @@ - // - - NTSTATUS -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdPnpCompletionRoutine ( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, -Index: drivers/filesystems/cdfs_new/workque.c -=================================================================== ---- drivers/filesystems/cdfs_new/workque.c (revision 34615) -+++ drivers/filesystems/cdfs_new/workque.c (working copy) -@@ -97,6 +97,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdPrePostIrp ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp -@@ -209,6 +210,7 @@ - - - VOID -+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ - CdOplockComplete ( - IN PIRP_CONTEXT IrpContext, - IN PIRP Irp -@@ -386,7 +388,7 @@ - // - - ExInitializeWorkItem( &IrpContext->WorkQueueItem, -- CdFspDispatch, -+ (PVOID)CdFspDispatch,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ - IrpContext ); - - ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue ); diff --git a/drivers/filesystems/cdfs_new/workque.c b/drivers/filesystems/cdfs_new/workque.c index ee548826ba..e3975a8c47 100755 --- a/drivers/filesystems/cdfs_new/workque.c +++ b/drivers/filesystems/cdfs_new/workque.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -100,6 +100,7 @@ Return Value:
_Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdPrePostIrp ( _Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp @@ -224,6 +225,7 @@ Return Value:
_Requires_lock_held_(_Global_critical_region_) VOID +NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ CdOplockComplete ( _Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp @@ -401,12 +403,16 @@ Return Value: // Send it off..... //
+#ifdef _MSC_VER #pragma prefast(suppress:28155, "the function prototype is correct") +#endif ExInitializeWorkItem( &IrpContext->WorkQueueItem, - CdFspDispatch, + (PVOID)CdFspDispatch,/* ReactOS Change: GCC "assignment from incompatible pointer type" */ IrpContext );
+#ifdef _MSC_VER #pragma prefast(suppress: 28159, "prefast believes this routine is obsolete, but it is ok for CDFS to continue using it") +#endif ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue );
return; diff --git a/drivers/filesystems/cdfs_new/write.c b/drivers/filesystems/cdfs_new/write.c index 36a41a7cd3..70c8494e08 100644 --- a/drivers/filesystems/cdfs_new/write.c +++ b/drivers/filesystems/cdfs_new/write.c @@ -14,7 +14,7 @@ Abstract:
--*/
-#include "CdProcs.h" +#include "cdprocs.h"
// // The Bug check file id for this module @@ -34,15 +34,24 @@ Abstract: // This macro just puts a nice little try-except around RtlZeroMemory //
+#ifndef __REACTOS__ #define SafeZeroMemory(IC,AT,BYTE_COUNT) { \ - try { \ + _SEH2_TRY { \ RtlZeroMemory( (AT), (BYTE_COUNT) ); \ __pragma(warning(suppress: 6320)) \ - } except( EXCEPTION_EXECUTE_HANDLER ) { \ + } _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \ CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \ - } \ + } _SEH2_END; \ } - +#else +#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \ + _SEH2_TRY { \ + RtlZeroMemory( (AT), (BYTE_COUNT) ); \ + } _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \ + CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \ + } _SEH2_END; \ +} +#endif
#ifdef ALLOC_PRAGMA #pragma alloc_text(PAGE, CdCommonWrite) @@ -153,7 +162,7 @@ Return Value: // Use a try-finally to facilitate cleanup. //
- try { + _SEH2_TRY {
// // Verify the Fcb. Allow writes if this is a DASD handle that is @@ -346,7 +355,7 @@ Return Value: }
try_exit: NOTHING; - } finally { + } _SEH2_FINALLY {
// // Release the Fcb. @@ -356,7 +365,7 @@ Return Value:
CdReleaseFile( IrpContext, Fcb ); } - } + } _SEH2_END;
// // Post the request if we got CANT_WAIT.