break;
}
}
- __except( AFSExceptionFilter( GetExceptionCode(), GetExceptionInformation()) )
+ __except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation()) )
{
AFSDbgLogMsg( 0,
0,
"EXCEPTION - AFSDirControl\n");
+
+ AFSDumpTraceFilesFnc();
}
if( ntStatus != STATUS_PENDING)
ULONG ulBytesConverted;
AFSDirectoryCB *pDirEntry = NULL;
BOOLEAN bReleaseMain = FALSE;
+ BOOLEAN bReleaseFcb = FALSE;
ULONG ulTargetFileType = AFS_FILE_TYPE_UNKNOWN;
AFSFileInfoCB stFileInfo;
BOOLEAN bUseFileInfo = TRUE;
AFSObjectInfoCB *pObjectInfo = NULL;
ULONG ulAdditionalAttributes = 0;
+ LONG lCount;
__Enter
{
bReturnSingleEntry = BooleanFlagOn( pIrpSp->Flags, SL_RETURN_SINGLE_ENTRY);
bIndexSpecified = BooleanFlagOn( pIrpSp->Flags, SL_INDEX_SPECIFIED);
- bInitialQuery = (BOOLEAN)( !BooleanFlagOn( pCcb->Flags, CCB_FLAGS_DIRECTORY_QUERY_MAPPED));
+ bInitialQuery = (BOOLEAN)( !BooleanFlagOn( pCcb->Flags, CCB_FLAG_DIRECTORY_QUERY_MAPPED));
if( bInitialQuery)
{
AFSAcquireExcl( &pFcb->NPFcb->Resource,
TRUE);
- //
- // Tell the service to prime the cache of the directory content
- //
-
- ntStatus = AFSEnumerateDirectoryNoResponse( &pFcb->AuthGroup,
- &pFcb->ObjectInformation->FileId);
-
- if( !NT_SUCCESS( ntStatus))
- {
-
- AFSReleaseResource( &pFcb->NPFcb->Resource);
-
- AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
- AFS_TRACE_LEVEL_ERROR,
- "AFSQueryDirectory Enumerate directory failure for parent %wZ Mask %wZ Status %08lX\n",
- &pCcb->DirectoryCB->NameInformation.FileName,
- &pCcb->MaskName,
- ntStatus);
-
- try_return( ntStatus);
- }
+ bReleaseFcb = TRUE;
}
else
{
AFSAcquireShared( &pFcb->NPFcb->Resource,
TRUE);
+
+ bReleaseFcb = TRUE;
}
//
pFcb->ObjectInformation->FileId.Vnode,
pFcb->ObjectInformation->FileId.Unique);
- ntStatus = AFSVerifyEntry( &pFcb->AuthGroup,
+ ntStatus = AFSVerifyEntry( &pCcb->AuthGroup,
pCcb->DirectoryCB);
if( !NT_SUCCESS( ntStatus))
AFSReleaseResource( &pFcb->NPFcb->Resource);
+ bReleaseFcb = FALSE;
+
//
// Start processing the data
//
try_return( ntStatus);
}
- SetFlag( pCcb->Flags, CCB_FLAGS_DIRECTORY_QUERY_MAPPED);
+ SetFlag( pCcb->Flags, CCB_FLAG_DIRECTORY_QUERY_MAPPED);
ClearFlag( pCcb->Flags, CCB_FLAG_DIR_OF_DIRS_ONLY);
BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_DELETED))
{
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
continue;
}
if( !FlagOn( pObjectInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY))
{
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
continue;
}
NULL))
{
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
continue;
}
TRUE))
{
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
continue;
}
//
AFSValidateEntry( pDirEntry,
- &pFcb->AuthGroup,
- FALSE,
+ &pCcb->AuthGroup,
FALSE);
pObjectInfo = pDirEntry->ObjectInformation;
pDirEntry,
&pCcb->FullFileName,
pCcb->NameArray,
+ &pCcb->AuthGroup,
&stFileInfo)))
{
+ ulAdditionalAttributes = FILE_ATTRIBUTE_REPARSE_POINT;
+
bUseFileInfo = TRUE;
}
}
pCcb->CurrentDirIndex--;
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
try_return( ntStatus = STATUS_SUCCESS);
}
// Now fill the base parts of the structure that are applicable.
case FileIdBothDirectoryInformation:
case FileBothDirectoryInformation:
-
+ {
pBothDirInfo = (PFILE_BOTH_DIR_INFORMATION)&pBuffer[ ulNextEntry];
pBothDirInfo->ShortNameLength = (CHAR)pDirEntry->NameInformation.ShortNameLength;
&pDirEntry->NameInformation.ShortName[ 0],
pBothDirInfo->ShortNameLength);
}
+ }
case FileIdFullDirectoryInformation:
case FileFullDirectoryInformation:
-
+ {
pFullDirInfo = (PFILE_FULL_DIR_INFORMATION)&pBuffer[ ulNextEntry];
pFullDirInfo->EaSize = 0;
-
+ }
case FileDirectoryInformation:
-
+ {
pDirInfo = (PFILE_DIRECTORY_INFORMATION)&pBuffer[ ulNextEntry];
if( bUseFileInfo)
pDirInfo->EndOfFile = stFileInfo.EndOfFile;
pDirInfo->AllocationSize = stFileInfo.AllocationSize;
- pDirInfo->FileAttributes = stFileInfo.FileAttributes;
+ pDirInfo->FileAttributes = stFileInfo.FileAttributes | ulAdditionalAttributes;
}
else if( BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_FAKE))
{
pDirInfo->FileNameLength = pDirEntry->NameInformation.FileName.Length;
break;
+ }
case FileNamesInformation:
-
+ {
pNamesInfo = (PFILE_NAMES_INFORMATION)&pBuffer[ ulNextEntry];
pNamesInfo->FileIndex = pDirEntry->FileIndex;
pNamesInfo->FileNameLength = pDirEntry->NameInformation.FileName.Length;
break;
-
+ }
default:
-
+ {
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_ERROR,
"AFSQueryDirectory (%08lX) Unknown FileInformationClass %u\n",
Irp,
FileInformationClass);
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
try_return( ntStatus = STATUS_INVALID_INFO_CLASS);
break;
+ }
}
ulBytesConverted = ulBytesRemainingInBuffer - ulBaseLength >= pDirEntry->NameInformation.FileName.Length ?
if( ulBytesConverted < pDirEntry->NameInformation.FileName.Length)
{
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
try_return( ntStatus = STATUS_BUFFER_OVERFLOW);
}
- InterlockedDecrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedDecrement( &pDirEntry->OpenReferenceCount);
dStatus = STATUS_SUCCESS;
AFSReleaseResource( pFcb->ObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
}
+ if ( bReleaseFcb)
+ {
+
+ AFSReleaseResource( &pFcb->NPFcb->Resource);
+ }
+
if( pFcb != NULL)
{
AFSSnapshotHdr *pSnapshotHdr = NULL;
AFSSnapshotEntry *pSnapshotEntry = NULL;
ULONG ulCount = 0;
+ LONG lCount;
__Enter
{
pDirEntry = ObjectInfo->Specific.Directory.PIOCtlDirectoryCB;
+ if( pDirEntry != NULL)
+ {
+
+ lCount = InterlockedIncrement( &pDirEntry->OpenReferenceCount);
+ }
+
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSLocateNextDirEntry Returning PIOctl entry %wZ in parent FID %08lX-%08lX-%08lX-%08lX\n",
pDirEntry = AFSGlobalDotDirEntry;
+ if( pDirEntry != NULL)
+ {
+
+ lCount = InterlockedIncrement( &pDirEntry->OpenReferenceCount);
+ }
+
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSLocateNextDirEntry Returning1 snapshot entry %wZ in parent FID %08lX-%08lX-%08lX-%08lX\n",
pDirEntry = AFSGlobalDotDotDirEntry;
+ if( pDirEntry != NULL)
+ {
+
+ lCount = InterlockedIncrement( &pDirEntry->OpenReferenceCount);
+ }
+
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSLocateNextDirEntry Returning2 snapshot entry %wZ in parent FID %08lX-%08lX-%08lX-%08lX\n",
ObjectInfo->FileId.Vnode,
ObjectInfo->FileId.Unique);
- InterlockedIncrement( &pDirEntry->OpenReferenceCount);
+ lCount = InterlockedIncrement( &pDirEntry->OpenReferenceCount);
}
else
{