// Local support routines
//
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
CdQueryDirectory (
- IN PIRP_CONTEXT IrpContext,
- IN PIRP Irp,
- IN PIO_STACK_LOCATION IrpSp,
- IN PFCB Fcb,
- IN PCCB Ccb
+ _Inout_ PIRP_CONTEXT IrpContext,
+ _Inout_ PIRP Irp,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PFCB Fcb,
+ _In_ PCCB Ccb
);
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
CdNotifyChangeDirectory (
- IN PIRP_CONTEXT IrpContext,
- IN PIRP Irp,
- IN PIO_STACK_LOCATION IrpSp,
- IN PCCB Ccb
+ _Inout_ PIRP_CONTEXT IrpContext,
+ _Inout_ PIRP Irp,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PCCB Ccb
);
VOID
CdInitializeEnumeration (
- IN PIRP_CONTEXT IrpContext,
- IN PIO_STACK_LOCATION IrpSp,
- IN PFCB Fcb,
- IN OUT PCCB Ccb,
- IN OUT PFILE_ENUM_CONTEXT FileContext,
- OUT PBOOLEAN ReturnNextEntry,
- OUT PBOOLEAN ReturnSingleEntry,
- OUT PBOOLEAN InitialQuery
+ _In_ PIRP_CONTEXT IrpContext,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PFCB Fcb,
+ _Inout_ PCCB Ccb,
+ _Inout_ PFILE_ENUM_CONTEXT FileContext,
+ _Out_ PBOOLEAN ReturnNextEntry,
+ _Out_ PBOOLEAN ReturnSingleEntry,
+ _Out_ PBOOLEAN InitialQuery
);
BOOLEAN
CdEnumerateIndex (
- IN PIRP_CONTEXT IrpContext,
- IN PCCB Ccb,
- IN OUT PFILE_ENUM_CONTEXT FileContext,
- IN BOOLEAN ReturnNextEntry
+ _In_ PIRP_CONTEXT IrpContext,
+ _In_ PCCB Ccb,
+ _Inout_ PFILE_ENUM_CONTEXT FileContext,
+ _In_ BOOLEAN ReturnNextEntry
);
#ifdef ALLOC_PRAGMA
#endif
\f
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
CdCommonDirControl (
- IN PIRP_CONTEXT IrpContext,
- IN PIRP Irp
+ _Inout_ PIRP_CONTEXT IrpContext,
+ _Inout_ PIRP Irp
)
/*++
// Local support routines
//
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
CdQueryDirectory (
- IN PIRP_CONTEXT IrpContext,
- IN PIRP Irp,
- IN PIO_STACK_LOCATION IrpSp,
- IN PFCB Fcb,
- IN PCCB Ccb
+ _Inout_ PIRP_CONTEXT IrpContext,
+ _Inout_ PIRP Irp,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PFCB Fcb,
+ _In_ PCCB Ccb
)
/*++
ULONG VersionStringBytes;
FILE_ENUM_CONTEXT FileContext;
- PDIRENT ThisDirent;
+ PDIRENT ThisDirent = NULL;
BOOLEAN InitialQuery;
- BOOLEAN ReturnNextEntry;
+ BOOLEAN ReturnNextEntry = FALSE;
BOOLEAN ReturnSingleEntry;
BOOLEAN Found;
BOOLEAN DoCcbUpdate = FALSE;
ULONG BaseLength;
- PFILE_BOTH_DIR_INFORMATION DirInfo = NULL; /* ReactOS Change: GCC Uninit var */
+ PFILE_BOTH_DIR_INFORMATION DirInfo = NULL;
PFILE_NAMES_INFORMATION NamesInfo;
PFILE_ID_FULL_DIR_INFORMATION IdFullDirInfo;
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
// Use a try-finally to facilitate cleanup.
//
- try {
+ _SEH2_TRY {
//
// Verify the Fcb is still good.
//
// Here are the rules concerning filling up the buffer:
//
- // 1. The Io system guarantees that there will always be
+ // 1. The Io system garentees that there will always be
// enough room for at least one base record.
//
// 2. If the full first record (including file name) cannot
// such trickery.
//
- try {
+ _SEH2_TRY {
//
// Zero and initialize the base part of the current entry.
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
- SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY );
-
+ SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY);
+
} else {
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
+
+ SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY);
}
-
- //
- // All Cdrom files are readonly. We also copy the existence
- // bit to the hidden attribute.
- //
-
- SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY );
-
+
if (FlagOn( ThisDirent->DirentFlags,
CD_ATTRIBUTE_HIDDEN )) {
LastEntry = NextEntry;
NextEntry = QuadAlign( Information );
- } except (EXCEPTION_EXECUTE_HANDLER) {
+#ifdef _MSC_VER
+#pragma warning(suppress: 6320)
+#endif
+ } _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
//
// We had a problem filling in the user's buffer, so stop and
//
Information = 0;
- try_leave( Status = GetExceptionCode());
- }
+ try_leave( Status = _SEH2_GetExceptionCode());
+ } _SEH2_END;
}
DoCcbUpdate = TRUE;
- } finally {
+ } _SEH2_FINALLY {
//
- // Cleanup our search context - *before* acquiring the FCB mutex exclusive,
+ // Cleanup our search context - *before* aquiring the FCB mutex exclusive,
// else can block on threads in cdcreateinternalstream/purge which
// hold the FCB but are waiting for all maps in this stream to be released.
//
CdCleanupFileContext( IrpContext, &FileContext );
//
- // Now we can safely acquire the FCB mutex if we need to.
+ // Now we can safely aqure the FCB mutex if we need to.
//
if (DoCcbUpdate && !NT_ERROR( Status )) {
//
CdReleaseFile( IrpContext, Fcb );
- }
+ } _SEH2_END;
//
// Complete the request here.
// Local support routines
//
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
CdNotifyChangeDirectory (
- IN PIRP_CONTEXT IrpContext,
- IN PIRP Irp,
- IN PIO_STACK_LOCATION IrpSp,
- IN PCCB Ccb
+ _Inout_ PIRP_CONTEXT IrpContext,
+ _Inout_ PIRP Irp,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PCCB Ccb
)
/*++
// Use a try-finally to facilitate cleanup.
//
- try {
+ _SEH2_TRY {
//
// Verify the Vcb.
NULL,
NULL );
- } finally {
+ } _SEH2_FINALLY {
//
// Release the Vcb.
//
CdReleaseVcb( IrpContext, IrpContext->Vcb );
- }
+ } _SEH2_END;
//
// Cleanup the IrpContext.
VOID
CdInitializeEnumeration (
- IN PIRP_CONTEXT IrpContext,
- IN PIO_STACK_LOCATION IrpSp,
- IN PFCB Fcb,
- IN OUT PCCB Ccb,
- IN OUT PFILE_ENUM_CONTEXT FileContext,
- OUT PBOOLEAN ReturnNextEntry,
- OUT PBOOLEAN ReturnSingleEntry,
- OUT PBOOLEAN InitialQuery
+ _In_ PIRP_CONTEXT IrpContext,
+ _In_ PIO_STACK_LOCATION IrpSp,
+ _In_ PFCB Fcb,
+ _Inout_ PCCB Ccb,
+ _Inout_ PFILE_ENUM_CONTEXT FileContext,
+ _Out_ PBOOLEAN ReturnNextEntry,
+ _Out_ PBOOLEAN ReturnSingleEntry,
+ _Out_ PBOOLEAN InitialQuery
)
/*++
PAGED_CODE();
+ //
+ // If the user has specified that the scan be restarted, and has specicified
+ // a new query pattern, reinitialize the CCB.
+ //
+
+ if (FlagOn( IrpSp->Flags, SL_RESTART_SCAN )) {
+
+ CdLockFcb( IrpContext, Fcb );
+
+ FileName = (PUNICODE_STRING) IrpSp->Parameters.QueryDirectory.FileName;
+ if (FileName && FileName->Length > 0) {
+
+ if (!FlagOn( Ccb->Flags, CCB_FLAG_ENUM_MATCH_ALL )) {
+
+ CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
+ }
+
+ ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_MATCH_ALL);
+ ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_INITIALIZED);
+ ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_NAME_EXP_HAS_WILD);
+ }
+
+ CdUnlockFcb( IrpContext, Fcb );
+ }
+
//
// If this is the initial query then build a search expression from the input
// file name.
//
// This should never fail.
//
-
- ASSERT( Status == STATUS_SUCCESS );
+ __analysis_assert( Status == STATUS_SUCCESS );
+ NT_ASSERT( Status == STATUS_SUCCESS );
} else {
// If there is no file object then create it now.
//
- if (Fcb->FileObject == NULL) {
-
- CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
- }
+ CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
//
// Determine the offset in the stream to position the FileContext and
BOOLEAN
CdEnumerateIndex (
- IN PIRP_CONTEXT IrpContext,
- IN PCCB Ccb,
- IN OUT PFILE_ENUM_CONTEXT FileContext,
- IN BOOLEAN ReturnNextEntry
+ _In_ PIRP_CONTEXT IrpContext,
+ _In_ PCCB Ccb,
+ _Inout_ PFILE_ENUM_CONTEXT FileContext,
+ _In_ BOOLEAN ReturnNextEntry
)
/*++
PAGED_CODE();
//
- // Loop until we find a match or exhaust the directory.
+ // Loop until we find a match or exaust the directory.
//
while (TRUE) {