Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fileinfo.c File Reference

#include "UdfProcs.h"

Go to the source code of this file.

Defines

#define BugCheckFileId   (UDFS_BUG_CHECK_FILEINFO)
#define Dbg   (UDFS_DEBUG_LEVEL_FILEINFO)

Functions

INLINE ULONG UdfGetExtraFileAttributes (IN PCCB Ccb)
VOID UdfQueryBasicInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PCCB Ccb, IN OUT PFILE_BASIC_INFORMATION Buffer, IN OUT PULONG Length)
VOID UdfQueryStandardInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN OUT PFILE_STANDARD_INFORMATION Buffer, IN OUT PULONG Length)
VOID UdfQueryInternalInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN OUT PFILE_INTERNAL_INFORMATION Buffer, IN OUT PULONG Length)
VOID UdfQueryEaInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN OUT PFILE_EA_INFORMATION Buffer, IN OUT PULONG Length)
VOID UdfQueryPositionInfo (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject, IN OUT PFILE_POSITION_INFORMATION Buffer, IN OUT PULONG Length)
NTSTATUS UdfQueryNameInfo (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject, IN OUT PFILE_NAME_INFORMATION Buffer, IN OUT PULONG Length)
NTSTATUS UdfQueryAlternateNameInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PCCB Ccb, IN OUT PFILE_NAME_INFORMATION Buffer, IN OUT PULONG Length)
VOID UdfQueryNetworkInfo (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PCCB Ccb, IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, IN OUT PULONG Length)
NTSTATUS UdfCommonQueryInfo (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
NTSTATUS UdfCommonSetInfo (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
BOOLEAN UdfFastQueryBasicInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN UdfFastQueryStdInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN UdfFastQueryNetworkInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)


Define Documentation

#define BugCheckFileId   (UDFS_BUG_CHECK_FILEINFO)
 

Definition at line 28 of file fileinfo.c.

#define Dbg   (UDFS_DEBUG_LEVEL_FILEINFO)
 

Definition at line 34 of file fileinfo.c.


Function Documentation

NTSTATUS UdfCommonQueryInfo IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp
 

Definition at line 156 of file fileinfo.c.

References ASSERT, _IRP::AssociatedIrp, Buffer, CCB_FLAG_OPEN_BY_ID, FALSE, FCB_STATE_INITIALIZED, _FCB::FcbState, _IO_STACK_LOCATION::FileObject, FlagOn, _CCB::Flags, IoGetCurrentIrpStackLocation, _IRP::IoStatus, Irp, NTSTATUS(), PAGED_CODE, _IO_STACK_LOCATION::Parameters, Status, TRUE, TYPE_OF_OPEN, UdfAcquireFileShared, UdfCompleteRequest(), UdfDecodeFileObject(), UdfQueryAlternateNameInfo(), UdfQueryBasicInfo(), UdfQueryEaInfo(), UdfQueryInternalInfo(), UdfQueryNameInfo(), UdfQueryNetworkInfo(), UdfQueryPositionInfo(), UdfQueryStandardInfo(), UdfReleaseFile, UdfVerifyFcbOperation(), UserDirectoryOpen, and UserFileOpen.

Referenced by UdfFsdDispatch(), and UdfFspDispatch().

00163 : 00164 00165 This is the common routine for query file information called by both the 00166 fsd and fsp threads. 00167 00168 Arguments: 00169 00170 Irp - Supplies the Irp to process. 00171 00172 Return Value: 00173 00174 NTSTATUS - The return status for this operation. 00175 00176 --*/ 00177 00178 { 00179 NTSTATUS Status = STATUS_SUCCESS; 00180 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); 00181 00182 ULONG Length; 00183 FILE_INFORMATION_CLASS FileInformationClass; 00184 PFILE_ALL_INFORMATION Buffer; 00185 00186 TYPE_OF_OPEN TypeOfOpen; 00187 PFCB Fcb; 00188 PCCB Ccb; 00189 00190 BOOLEAN ReleaseFcb = FALSE; 00191 00192 PAGED_CODE(); 00193 00194 // 00195 // Reference our input parameters to make things easier 00196 // 00197 00198 Length = IrpSp->Parameters.QueryFile.Length; 00199 FileInformationClass = IrpSp->Parameters.QueryFile.FileInformationClass; 00200 Buffer = Irp->AssociatedIrp.SystemBuffer; 00201 00202 // 00203 // Decode the file object 00204 // 00205 00206 TypeOfOpen = UdfDecodeFileObject( IrpSp->FileObject, &Fcb, &Ccb ); 00207 00208 // 00209 // Use a try-finally to facilitate cleanup. 00210 // 00211 00212 try { 00213 00214 // 00215 // We only support query on file and directory handles. 00216 // 00217 00218 switch (TypeOfOpen) { 00219 00220 case UserDirectoryOpen : 00221 case UserFileOpen : 00222 00223 // 00224 // Acquire shared access to this file. 00225 // 00226 00227 UdfAcquireFileShared( IrpContext, Fcb ); 00228 ReleaseFcb = TRUE; 00229 00230 ASSERT( FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED )); 00231 00232 // 00233 // Make sure the Fcb is in a usable condition. This will raise 00234 // an error condition if the volume is unusable 00235 // 00236 00237 UdfVerifyFcbOperation( IrpContext, Fcb ); 00238 00239 // 00240 // Based on the information class we'll do different 00241 // actions. Each of hte procedures that we're calling fills 00242 // up the output buffer, if possible. They will raise the 00243 // status STATUS_BUFFER_OVERFLOW for an insufficient buffer. 00244 // This is considered a somewhat unusual case and is handled 00245 // more cleanly with the exception mechanism rather than 00246 // testing a return status value for each call. 00247 // 00248 00249 switch (FileInformationClass) { 00250 00251 case FileAllInformation: 00252 00253 // 00254 // We don't allow this operation on a file opened by file Id. 00255 // 00256 00257 if (FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) { 00258 00259 Status = STATUS_INVALID_PARAMETER; 00260 break; 00261 } 00262 00263 // 00264 // In this case go ahead and call the individual routines to 00265 // fill in the buffer. Only the name routine will 00266 // pointer to the output buffer and then call the 00267 // individual routines to fill in the buffer. 00268 // 00269 00270 Length -= (sizeof( FILE_ACCESS_INFORMATION ) + 00271 sizeof( FILE_MODE_INFORMATION ) + 00272 sizeof( FILE_ALIGNMENT_INFORMATION )); 00273 00274 UdfQueryBasicInfo( IrpContext, Fcb, Ccb, &Buffer->BasicInformation, &Length ); 00275 UdfQueryStandardInfo( IrpContext, Fcb, &Buffer->StandardInformation, &Length ); 00276 UdfQueryInternalInfo( IrpContext, Fcb, &Buffer->InternalInformation, &Length ); 00277 UdfQueryEaInfo( IrpContext, Fcb, &Buffer->EaInformation, &Length ); 00278 UdfQueryPositionInfo( IrpContext, IrpSp->FileObject, &Buffer->PositionInformation, &Length ); 00279 Status = UdfQueryNameInfo( IrpContext, IrpSp->FileObject, &Buffer->NameInformation, &Length ); 00280 00281 break; 00282 00283 case FileBasicInformation: 00284 00285 UdfQueryBasicInfo( IrpContext, Fcb, Ccb, (PFILE_BASIC_INFORMATION) Buffer, &Length ); 00286 break; 00287 00288 case FileStandardInformation: 00289 00290 UdfQueryStandardInfo( IrpContext, Fcb, (PFILE_STANDARD_INFORMATION) Buffer, &Length ); 00291 break; 00292 00293 case FileInternalInformation: 00294 00295 UdfQueryInternalInfo( IrpContext, Fcb, (PFILE_INTERNAL_INFORMATION) Buffer, &Length ); 00296 break; 00297 00298 case FileEaInformation: 00299 00300 UdfQueryEaInfo( IrpContext, Fcb, (PFILE_EA_INFORMATION) Buffer, &Length ); 00301 break; 00302 00303 case FilePositionInformation: 00304 00305 UdfQueryPositionInfo( IrpContext, IrpSp->FileObject, (PFILE_POSITION_INFORMATION) Buffer, &Length ); 00306 break; 00307 00308 case FileNameInformation: 00309 00310 // 00311 // We don't allow this operation on a file opened by file Id. 00312 // 00313 00314 if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) { 00315 00316 Status = UdfQueryNameInfo( IrpContext, IrpSp->FileObject, (PFILE_NAME_INFORMATION) Buffer, &Length ); 00317 00318 } else { 00319 00320 Status = STATUS_INVALID_PARAMETER; 00321 } 00322 00323 break; 00324 00325 case FileAlternateNameInformation: 00326 00327 if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) { 00328 00329 Status = UdfQueryAlternateNameInfo( IrpContext, Fcb, Ccb, (PFILE_NAME_INFORMATION) Buffer, &Length ); 00330 00331 } else { 00332 00333 Status = STATUS_INVALID_PARAMETER; 00334 } 00335 00336 break; 00337 00338 case FileNetworkOpenInformation: 00339 00340 UdfQueryNetworkInfo( IrpContext, Fcb, Ccb, (PFILE_NETWORK_OPEN_INFORMATION) Buffer, &Length ); 00341 break; 00342 00343 default : 00344 00345 Status = STATUS_INVALID_PARAMETER; 00346 } 00347 00348 break; 00349 00350 default : 00351 00352 Status = STATUS_INVALID_PARAMETER; 00353 } 00354 00355 // 00356 // Set the information field to the number of bytes actually filled in 00357 // and then complete the request 00358 // 00359 00360 Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length; 00361 00362 } finally { 00363 00364 // 00365 // Release the file. 00366 // 00367 00368 if (ReleaseFcb) { 00369 00370 UdfReleaseFile( IrpContext, Fcb ); 00371 } 00372 } 00373 00374 // 00375 // Complete the request if we didn't raise. 00376 // 00377 00378 UdfCompleteRequest( IrpContext, Irp, Status ); 00379 00380 return Status; 00381 }

NTSTATUS UdfCommonSetInfo IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp
 

Definition at line 385 of file fileinfo.c.

References _DEVICE_OBJECT::AlignmentRequirement, _IRP::AssociatedIrp, Buffer, _FILE_OBJECT::CurrentByteOffset, _IO_STACK_LOCATION::DeviceObject, _IO_STACK_LOCATION::FileObject, FlagOn, _FILE_OBJECT::Flags, FO_NO_INTERMEDIATE_BUFFERING, IoGetCurrentIrpStackLocation, Irp, NTSTATUS(), PAGED_CODE, _IO_STACK_LOCATION::Parameters, Status, try_leave, TYPE_OF_OPEN, UdfAcquireFileShared, UdfCompleteRequest(), UdfDecodeFileObject(), UdfLockFcb, UdfReleaseFile, UdfUnlockFcb, UdfVerifyFcbOperation(), and UserFileOpen.

Referenced by UdfFsdDispatch(), and UdfFspDispatch().

00392 : 00393 00394 This is the common routine for set file information called by both the 00395 fsd and fsp threads. We only support operations which set the file position. 00396 00397 Arguments: 00398 00399 Irp - Supplies the Irp to process. 00400 00401 Return Value: 00402 00403 NTSTATUS - The return status for this operation. 00404 00405 --*/ 00406 00407 { 00408 NTSTATUS Status = STATUS_INVALID_PARAMETER; 00409 00410 TYPE_OF_OPEN TypeOfOpen; 00411 PFCB Fcb; 00412 PCCB Ccb; 00413 00414 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); 00415 00416 PFILE_POSITION_INFORMATION Buffer; 00417 00418 PAGED_CODE(); 00419 00420 // 00421 // Decode the file object 00422 // 00423 00424 TypeOfOpen = UdfDecodeFileObject( IrpSp->FileObject, &Fcb, &Ccb ); 00425 00426 // 00427 // We only support a SetPositionInformation on a user file. 00428 // 00429 00430 if ((TypeOfOpen != UserFileOpen) || 00431 (IrpSp->Parameters.QueryFile.FileInformationClass != FilePositionInformation)) { 00432 00433 UdfCompleteRequest( IrpContext, Irp, Status ); 00434 return Status; 00435 } 00436 00437 // 00438 // Acquire shared access to this file. 00439 // 00440 00441 UdfAcquireFileShared( IrpContext, Fcb ); 00442 00443 try { 00444 00445 // 00446 // Make sure the Fcb is in a usable condition. This 00447 // will raise an error condition if the fcb is unusable 00448 // 00449 00450 UdfVerifyFcbOperation( IrpContext, Fcb ); 00451 00452 Buffer = Irp->AssociatedIrp.SystemBuffer; 00453 00454 // 00455 // Check if the file does not use intermediate buffering. If it 00456 // does not use intermediate buffering then the new position we're 00457 // supplied must be aligned properly for the device 00458 // 00459 00460 if (FlagOn( IrpSp->FileObject->Flags, FO_NO_INTERMEDIATE_BUFFERING ) && 00461 ((Buffer->CurrentByteOffset.LowPart & IrpSp->DeviceObject->AlignmentRequirement) != 0)) { 00462 00463 try_leave( NOTHING ); 00464 } 00465 00466 // 00467 // The input parameter is fine so set the current byte offset and 00468 // complete the request 00469 // 00470 00471 // 00472 // Lock the Fcb to provide synchronization. 00473 // 00474 00475 UdfLockFcb( IrpContext, Fcb ); 00476 IrpSp->FileObject->CurrentByteOffset = Buffer->CurrentByteOffset; 00477 UdfUnlockFcb( IrpContext, Fcb ); 00478 00479 Status = STATUS_SUCCESS; 00480 00481 } finally { 00482 00483 UdfReleaseFile( IrpContext, Fcb ); 00484 } 00485 00486 // 00487 // Complete the request if there was no raise. 00488 // 00489 00490 UdfCompleteRequest( IrpContext, Irp, Status ); 00491 return Status; 00492 }

BOOLEAN UdfFastQueryBasicInfo IN PFILE_OBJECT  FileObject,
IN BOOLEAN  Wait,
IN OUT PFILE_BASIC_INFORMATION  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject
 

Definition at line 496 of file fileinfo.c.

References _TIMESTAMP_BUNDLE::AccessTime, ASSERT, ASSERT_FILE_OBJECT, Buffer, _TIMESTAMP_BUNDLE::CreationTime, ExAcquireResourceShared, ExReleaseResource, FALSE, FCB_STATE_INITIALIZED, _FCB::FcbState, _FCB::FileAttributes, FlagOn, FsRtlEnterFileSystem, FsRtlExitFileSystem, _TIMESTAMP_BUNDLE::ModificationTime, NULL, PAGED_CODE, _FCB::Timestamps, TRUE, TYPE_OF_OPEN, UdfDecodeFileObject(), UdfGetExtraFileAttributes(), UdfVerifyFcbOperation(), UserDirectoryOpen, and UserFileOpen.

00506 : 00507 00508 This routine is for the fast query call for basic file information. 00509 00510 Arguments: 00511 00512 FileObject - Supplies the file object used in this operation 00513 00514 Wait - Indicates if we are allowed to wait for the information 00515 00516 Buffer - Supplies the output buffer to receive the basic information 00517 00518 IoStatus - Receives the final status of the operation 00519 00520 Return Value: 00521 00522 BOOLEAN - TRUE if the operation succeeded and FALSE if the caller 00523 needs to take the long route. 00524 00525 --*/ 00526 00527 { 00528 BOOLEAN Result = FALSE; 00529 TYPE_OF_OPEN TypeOfOpen; 00530 00531 PFCB Fcb; 00532 PCCB Ccb; 00533 00534 PAGED_CODE(); 00535 00536 ASSERT_FILE_OBJECT( FileObject ); 00537 00538 FsRtlEnterFileSystem(); 00539 00540 // 00541 // Decode the file object to find the type of open and the data 00542 // structures. 00543 // 00544 00545 TypeOfOpen = UdfDecodeFileObject( FileObject, &Fcb, &Ccb ); 00546 00547 // 00548 // We only support this request on user file or directory objects. 00549 // 00550 00551 ASSERT( FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED )); 00552 00553 if (TypeOfOpen != UserFileOpen && TypeOfOpen != UserDirectoryOpen) { 00554 00555 FsRtlExitFileSystem(); 00556 return FALSE; 00557 } 00558 00559 // 00560 // Acquire the file shared to access the Fcb. 00561 // 00562 00563 if (!ExAcquireResourceShared( Fcb->Resource, Wait )) { 00564 00565 FsRtlExitFileSystem(); 00566 return FALSE; 00567 } 00568 00569 // 00570 // Use a try-finally to facilitate cleanup. 00571 // 00572 00573 try { 00574 00575 // 00576 // Only deal with 'good' Fcb's. 00577 // 00578 00579 if (UdfVerifyFcbOperation( NULL, Fcb )) { 00580 00581 // 00582 // Fill in the input buffer from the Fcb fields. 00583 // 00584 00585 Buffer->CreationTime = Fcb->Timestamps.CreationTime; 00586 Buffer->LastWriteTime = 00587 Buffer->ChangeTime = Fcb->Timestamps.ModificationTime; 00588 Buffer->LastAccessTime = Fcb->Timestamps.AccessTime; 00589 00590 Buffer->FileAttributes = Fcb->FileAttributes | UdfGetExtraFileAttributes( Ccb ); 00591 00592 // 00593 // Update the IoStatus block with the size of this data. 00594 // 00595 00596 IoStatus->Status = STATUS_SUCCESS; 00597 IoStatus->Information = sizeof( FILE_BASIC_INFORMATION ); 00598 00599 Result = TRUE; 00600 } 00601 00602 } finally { 00603 00604 ExReleaseResource( Fcb->Resource ); 00605 00606 FsRtlExitFileSystem(); 00607 } 00608 00609 return Result; 00610 }

BOOLEAN UdfFastQueryNetworkInfo IN PFILE_OBJECT  FileObject,
IN BOOLEAN  Wait,
OUT PFILE_NETWORK_OPEN_INFORMATION  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject
 

Definition at line 740 of file fileinfo.c.

References _TIMESTAMP_BUNDLE::AccessTime, ASSERT_FILE_OBJECT, Buffer, _TIMESTAMP_BUNDLE::CreationTime, ExAcquireResourceShared, ExReleaseResource, FALSE, _FCB::FileAttributes, FlagOn, FsRtlEnterFileSystem, FsRtlExitFileSystem, _TIMESTAMP_BUNDLE::ModificationTime, NULL, PAGED_CODE, _FCB::Timestamps, TRUE, TYPE_OF_OPEN, UdfDecodeFileObject(), UdfGetExtraFileAttributes(), UdfVerifyFcbOperation(), UserDirectoryOpen, and UserFileOpen.

00750 : 00751 00752 This routine is for the fast query call for network file information. 00753 00754 Arguments: 00755 00756 FileObject - Supplies the file object used in this operation 00757 00758 Wait - Indicates if we are allowed to wait for the information 00759 00760 Buffer - Supplies the output buffer to receive the basic information 00761 00762 IoStatus - Receives the final status of the operation 00763 00764 Return Value: 00765 00766 BOOLEAN - TRUE if the operation succeeded and FALSE if the caller 00767 needs to take the long route. 00768 00769 --*/ 00770 00771 { 00772 BOOLEAN Result = FALSE; 00773 TYPE_OF_OPEN TypeOfOpen; 00774 00775 PFCB Fcb; 00776 PCCB Ccb; 00777 00778 PAGED_CODE(); 00779 00780 ASSERT_FILE_OBJECT( FileObject ); 00781 00782 FsRtlEnterFileSystem(); 00783 00784 // 00785 // Decode the file object to find the type of open and the data 00786 // structures. 00787 // 00788 00789 TypeOfOpen = UdfDecodeFileObject( FileObject, &Fcb, &Ccb ); 00790 00791 // 00792 // We only support this request on user file or directory objects. 00793 // 00794 00795 if (TypeOfOpen != UserFileOpen && TypeOfOpen != UserDirectoryOpen) { 00796 00797 FsRtlExitFileSystem(); 00798 return FALSE; 00799 } 00800 00801 // 00802 // Acquire the file shared to access the Fcb. 00803 // 00804 00805 if (!ExAcquireResourceShared( Fcb->Resource, Wait )) { 00806 00807 FsRtlExitFileSystem(); 00808 return FALSE; 00809 } 00810 00811 // 00812 // Use a try-finally to facilitate cleanup. 00813 // 00814 00815 try { 00816 00817 // 00818 // Only deal with 'good' Fcb's. 00819 // 00820 00821 if (UdfVerifyFcbOperation( NULL, Fcb )) { 00822 00823 // 00824 // Fill in the input buffer from the Fcb fields. 00825 // 00826 00827 Buffer->CreationTime = Fcb->Timestamps.CreationTime; 00828 Buffer->LastWriteTime = 00829 Buffer->ChangeTime = Fcb->Timestamps.ModificationTime; 00830 Buffer->LastAccessTime = Fcb->Timestamps.AccessTime; 00831 00832 Buffer->FileAttributes = Fcb->FileAttributes | UdfGetExtraFileAttributes( Ccb ); 00833 00834 // 00835 // Check whether this is a directory. 00836 // 00837 00838 if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) { 00839 00840 Buffer->AllocationSize.QuadPart = 00841 Buffer->EndOfFile.QuadPart = 0; 00842 00843 } else { 00844 00845 Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart; 00846 Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart; 00847 } 00848 00849 // 00850 // Update the IoStatus block with the size of this data. 00851 // 00852 00853 IoStatus->Status = STATUS_SUCCESS; 00854 IoStatus->Information = sizeof( FILE_NETWORK_OPEN_INFORMATION ); 00855 00856 Result = TRUE; 00857 } 00858 00859 } finally { 00860 00861 ExReleaseResource( Fcb->Resource ); 00862 00863 FsRtlExitFileSystem(); 00864 } 00865 00866 return Result; 00867 }

BOOLEAN UdfFastQueryStdInfo IN PFILE_OBJECT  FileObject,
IN BOOLEAN  Wait,
IN OUT PFILE_STANDARD_INFORMATION  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject
 

Definition at line 614 of file fileinfo.c.

References ASSERT_FILE_OBJECT, Buffer, ExAcquireResourceShared, ExReleaseResource, FALSE, _FCB::FileAttributes, FlagOn, FsRtlEnterFileSystem, FsRtlExitFileSystem, _FCB::LinkCount, NULL, PAGED_CODE, TRUE, TYPE_OF_OPEN, UdfFastDecodeFileObject(), UdfVerifyFcbOperation(), UserDirectoryOpen, and UserFileOpen.

00624 : 00625 00626 This routine is for the fast query call for standard file information. 00627 00628 Arguments: 00629 00630 FileObject - Supplies the file object used in this operation 00631 00632 Wait - Indicates if we are allowed to wait for the information 00633 00634 Buffer - Supplies the output buffer to receive the basic information 00635 00636 IoStatus - Receives the final status of the operation 00637 00638 Return Value: 00639 00640 BOOLEAN - TRUE if the operation succeeded and FALSE if the caller 00641 needs to take the long route. 00642 00643 --*/ 00644 00645 { 00646 BOOLEAN Result = FALSE; 00647 TYPE_OF_OPEN TypeOfOpen; 00648 00649 PFCB Fcb; 00650 00651 PAGED_CODE(); 00652 00653 ASSERT_FILE_OBJECT( FileObject ); 00654 00655 FsRtlEnterFileSystem(); 00656 00657 // 00658 // Decode the file object to find the type of open and the data 00659 // structures. 00660 // 00661 00662 TypeOfOpen = UdfFastDecodeFileObject( FileObject, &Fcb ); 00663 00664 // 00665 // We only support this request on initialized user file or directory objects. 00666 // 00667 00668 if (TypeOfOpen != UserFileOpen && TypeOfOpen != UserDirectoryOpen) { 00669 00670 FsRtlExitFileSystem(); 00671 return FALSE; 00672 } 00673 00674 // 00675 // Acquire the file shared to access the Fcb. 00676 // 00677 00678 if (!ExAcquireResourceShared( Fcb->Resource, Wait )) { 00679 00680 FsRtlExitFileSystem(); 00681 return FALSE; 00682 } 00683 00684 // 00685 // Use a try-finally to facilitate cleanup. 00686 // 00687 00688 try { 00689 00690 // 00691 // Only deal with 'good' Fcb's. 00692 // 00693 00694 if (UdfVerifyFcbOperation( NULL, Fcb )) { 00695 00696 // 00697 // Check whether this is a directory. 00698 // 00699 00700 if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) { 00701 00702 Buffer->AllocationSize.QuadPart = 00703 Buffer->EndOfFile.QuadPart = 0; 00704 00705 Buffer->Directory = TRUE; 00706 00707 } else { 00708 00709 Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart; 00710 Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart; 00711 00712 Buffer->Directory = FALSE; 00713 } 00714 00715 Buffer->NumberOfLinks = Fcb->LinkCount; 00716 Buffer->DeletePending = FALSE; 00717 00718 // 00719 // Update the IoStatus block with the size of this data. 00720 // 00721 00722 IoStatus->Status = STATUS_SUCCESS; 00723 IoStatus->Information = sizeof( FILE_STANDARD_INFORMATION ); 00724 00725 Result = TRUE; 00726 } 00727 00728 } finally { 00729 00730 ExReleaseResource( Fcb->Resource ); 00731 00732 FsRtlExitFileSystem(); 00733 } 00734 00735 return Result; 00736 }

INLINE ULONG UdfGetExtraFileAttributes IN PCCB  Ccb  ) 
 

Definition at line 42 of file fileinfo.c.

References NULL.

Referenced by UdfFastQueryBasicInfo(), UdfFastQueryNetworkInfo(), UdfQueryBasicInfo(), and UdfQueryNetworkInfo().

00048 : 00049 00050 Safely figure out extra name-based file attributes given a context block. 00051 00052 Arguments: 00053 00054 Ccb - a context block to examine. 00055 00056 Return Value: 00057 00058 ULONG - file attributes for a file based on how it was opened (seperate from 00059 those based on the object that was opened). 00060 00061 --*/ 00062 00063 { 00064 return ( Ccb->Lcb != NULL? Ccb->Lcb->FileAttributes : 0 ); 00065 }

NTSTATUS UdfQueryAlternateNameInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN PCCB  Ccb,
IN OUT PFILE_NAME_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1232 of file fileinfo.c.

References ASSERT, BooleanFlagOn, Buffer, BYTE_COUNT_8_DOT_3, _DIR_ENUM_CONTEXT::CaseObjectName, FALSE, _LCB::FileName, FlagOn, _LCB::Flags, LCB_FLAG_IGNORE_CASE, LCB_FLAG_SHORT_NAME, NTSTATUS(), NULL, PAGED_CODE, _LCB::ParentFcb, Status, TRUE, try_leave, UdfAcquireFileShared, UdfCleanupDirContext(), UdfFindDirEntry(), UdfGenerate8dot3Name(), UdfInitializeDirContext(), UdfIs8dot3Name(), and UdfReleaseFile.

Referenced by UdfCommonQueryInfo().

01242 : 01243 01244 This routine performs the query alternate name information function. 01245 We lookup the dirent for this file and then check if there is a 01246 short name. 01247 01248 Arguments: 01249 01250 Fcb - Supplies the Fcb being queried, it has been verified. 01251 01252 Ccb - Ccb for this open handle. 01253 01254 Buffer - Supplies a pointer to the buffer where the information is to 01255 be returned. 01256 01257 Length - Supplies the length of the buffer in bytes, and receives the 01258 remaining bytes free in the buffer upon return. 01259 01260 Return Value: 01261 01262 NTSTATUS - STATUS_SUCCESS if the whole name would fit into the user buffer, 01263 STATUS_OBJECT_NAME_NOT_FOUND if we can't return the name, 01264 STATUS_BUFFER_OVERFLOW otherwise. 01265 01266 --*/ 01267 01268 { 01269 NTSTATUS Status = STATUS_SUCCESS; 01270 01271 DIR_ENUM_CONTEXT DirContext; 01272 01273 PLCB Lcb; 01274 01275 PFCB ParentFcb; 01276 BOOLEAN ReleaseParentFcb = FALSE; 01277 01278 BOOLEAN CleanupDirContext = FALSE; 01279 BOOLEAN Result; 01280 01281 PUNICODE_STRING ShortName; 01282 01283 UNICODE_STRING LocalShortName; 01284 WCHAR LocalShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof(WCHAR) ]; 01285 01286 PAGED_CODE(); 01287 01288 // 01289 // Initialize the buffer length to zero. 01290 // 01291 01292 Buffer->FileNameLength = 0; 01293 01294 // 01295 // If there was no associated Lcb then there is no short name. 01296 // 01297 01298 Lcb = Ccb->Lcb; 01299 01300 if (Lcb == NULL) { 01301 01302 return STATUS_OBJECT_NAME_NOT_FOUND; 01303 } 01304 01305 // 01306 // Use a try-finally to cleanup the structures. 01307 // 01308 01309 try { 01310 01311 if (FlagOn( Lcb->Flags, LCB_FLAG_SHORT_NAME )) { 01312 01313 // 01314 // This caller opened the file by a generated short name, so simply hand it back. 01315 // 01316 01317 ShortName = &Lcb->FileName; 01318 01319 } else { 01320 01321 // 01322 // The open occured by a regular name. Now, if this name is already 8.3 legal then 01323 // there is no short name. 01324 // 01325 01326 if (UdfIs8dot3Name( IrpContext, Lcb->FileName )) { 01327 01328 try_leave( Status = STATUS_OBJECT_NAME_NOT_FOUND ); 01329 } 01330 01331 // 01332 // This name has a generated short name. In order to calculate this name we have to 01333 // retrieve the FID for this file, since UDF specifies that a short name is uniquified 01334 // with a CRC of the original in-FID byte representation of the filename. 01335 // 01336 // N.B.: if this is a common operation, we may wish to cache the CRC in the Lcb. 01337 // 01338 01339 ParentFcb = Lcb->ParentFcb; 01340 UdfAcquireFileShared( IrpContext, ParentFcb ); 01341 ReleaseParentFcb = TRUE; 01342 01343 // 01344 // Now go find the FID for this filename in the parent. 01345 // 01346 01347 UdfInitializeDirContext( IrpContext, &DirContext ); 01348 CleanupDirContext = TRUE; 01349 01350 Result = UdfFindDirEntry( IrpContext, 01351 ParentFcb, 01352 &Lcb->FileName, 01353 BooleanFlagOn( Lcb->Flags, LCB_FLAG_IGNORE_CASE ), 01354 FALSE, 01355 &DirContext ); 01356 01357 // 01358 // We should always be able to find this entry, but don't bugcheck because 01359 // we screwed this up. 01360 // 01361 01362 ASSERT( Result ); 01363 01364 if (!Result) { 01365 01366 try_leave( Status = STATUS_OBJECT_NAME_NOT_FOUND ); 01367 } 01368 01369 // 01370 // Build the local unicode string to use and fill it in. 01371 // 01372 01373 ShortName = &LocalShortName; 01374 01375 LocalShortName.Buffer = LocalShortNameBuffer; 01376 LocalShortName.Length = 0; 01377 LocalShortName.MaximumLength = sizeof( LocalShortNameBuffer ); 01378 01379 UdfGenerate8dot3Name( IrpContext, 01380 &DirContext.CaseObjectName, 01381 ShortName ); 01382 } 01383 01384 // 01385 // We now have the short name. We have left it in Unicode form so copy it directly. 01386 // 01387 01388 Buffer->FileNameLength = ShortName->Length; 01389 01390 if (Buffer->FileNameLength + sizeof( ULONG ) > *Length) { 01391 01392 Buffer->FileNameLength = *Length - sizeof( ULONG ); 01393 Status = STATUS_BUFFER_OVERFLOW; 01394 } 01395 01396 RtlCopyMemory( Buffer->FileName, ShortName->Buffer, Buffer->FileNameLength ); 01397 01398 } finally { 01399 01400 if (CleanupDirContext) { 01401 01402 UdfCleanupDirContext( IrpContext, &DirContext ); 01403 } 01404 01405 if (ReleaseParentFcb) { 01406 01407 UdfReleaseFile( IrpContext, ParentFcb ); 01408 } 01409 } 01410 01411 // 01412 // Reduce the available bytes by the amount stored into this buffer. 01413 // 01414 01415 if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { 01416 01417 *Length -= sizeof( ULONG ) + Buffer->FileNameLength; 01418 } 01419 01420 return Status; 01421 }

VOID UdfQueryBasicInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN PCCB  Ccb,
IN OUT PFILE_BASIC_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 875 of file fileinfo.c.

References Buffer, PAGED_CODE, and UdfGetExtraFileAttributes().

Referenced by UdfCommonQueryInfo().

00885 : 00886 00887 This routine performs the query basic information function for Udfs 00888 00889 Arguments: 00890 00891 Fcb - Supplies the Fcb being queried, it has been verified 00892 00893 Ccb - Supplies the Ccb associated with the fileobject being queried 00894 00895 Buffer - Supplies a pointer to the buffer where the information is to 00896 be returned 00897 00898 Length - Supplies the length of the buffer in bytes, and receives the 00899 remaining bytes free in the buffer upon return. 00900 00901 Return Value: 00902 00903 None 00904 00905 --*/ 00906 00907 { 00908 PAGED_CODE(); 00909 00910 // 00911 // We support all times on Udfs. 00912 // 00913 00914 Buffer->CreationTime = Fcb->Timestamps.CreationTime; 00915 Buffer->LastWriteTime = 00916 Buffer->ChangeTime = Fcb->Timestamps.ModificationTime; 00917 Buffer->LastAccessTime = Fcb->Timestamps.AccessTime; 00918 00919 Buffer->FileAttributes = Fcb->FileAttributes | UdfGetExtraFileAttributes( Ccb ); 00920 00921 // 00922 // Update the length and status output variables 00923 // 00924 00925 *Length -= sizeof( FILE_BASIC_INFORMATION ); 00926 00927 return; 00928 }

VOID UdfQueryEaInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN OUT PFILE_EA_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1057 of file fileinfo.c.

References Buffer, and PAGED_CODE.

Referenced by UdfCommonQueryInfo().

01066 : 01067 01068 This routine performs the query Ea information function for Udfs. 01069 01070 Arguments: 01071 01072 Fcb - Supplies the Fcb being queried, it has been verified 01073 01074 Buffer - Supplies a pointer to the buffer where the information is to 01075 be returned 01076 01077 Length - Supplies the length of the buffer in bytes, and receives the 01078 remaining bytes free in the buffer upon return. 01079 01080 Return Value: 01081 01082 None 01083 01084 --*/ 01085 01086 { 01087 PAGED_CODE(); 01088 01089 // 01090 // No Ea's on Udfs volumes. At least not that our EA support would understand. 01091 // 01092 01093 Buffer->EaSize = 0; 01094 *Length -= sizeof( FILE_EA_INFORMATION ); 01095 01096 return; 01097 }

VOID UdfQueryInternalInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN OUT PFILE_INTERNAL_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1009 of file fileinfo.c.

References Buffer, and PAGED_CODE.

Referenced by UdfCommonQueryInfo().

01018 : 01019 01020 This routine performs the query internal information function for Udfs. 01021 01022 Arguments: 01023 01024 Fcb - Supplies the Fcb being queried, it has been verified 01025 01026 Buffer - Supplies a pointer to the buffer where the information is to 01027 be returned 01028 01029 Length - Supplies the length of the buffer in bytes, and receives the 01030 remaining bytes free in the buffer upon return. 01031 01032 Return Value: 01033 01034 None 01035 01036 --*/ 01037 01038 { 01039 PAGED_CODE(); 01040 01041 // 01042 // Index number is the file Id number in the Fcb. 01043 // 01044 01045 Buffer->IndexNumber = Fcb->FileId; 01046 *Length -= sizeof( FILE_INTERNAL_INFORMATION ); 01047 01048 return; 01049 }

NTSTATUS UdfQueryNameInfo IN PIRP_CONTEXT  IrpContext,
IN PFILE_OBJECT  FileObject,
IN OUT PFILE_NAME_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1158 of file fileinfo.c.

References ASSERT, Buffer, NTSTATUS(), PAGED_CODE, and Status.

Referenced by UdfCommonQueryInfo().

01167 : 01168 01169 This routine performs the query name information function for Udfs. 01170 01171 Arguments: 01172 01173 FileObject - Supplies the file object containing the name. 01174 01175 Buffer - Supplies a pointer to the buffer where the information is to 01176 be returned 01177 01178 Length - Supplies the length of the buffer in bytes, and receives the 01179 remaining bytes free in the buffer upon return. 01180 01181 Return Value: 01182 01183 NTSTATUS - STATUS_BUFFER_OVERFLOW if the entire name can't be copied. 01184 01185 --*/ 01186 01187 { 01188 NTSTATUS Status = STATUS_SUCCESS; 01189 ULONG LengthToCopy; 01190 01191 PAGED_CODE(); 01192 01193 ASSERT(*Length >= sizeof(ULONG)); 01194 01195 // 01196 // Simply copy the name in the file object to the user's buffer. 01197 // 01198 01199 // 01200 // Place the size of the filename in the user's buffer and reduce the remaining 01201 // size to match. 01202 // 01203 01204 Buffer->FileNameLength = LengthToCopy = FileObject->FileName.Length; 01205 *Length -= sizeof(ULONG); 01206 01207 if (LengthToCopy > *Length) { 01208 01209 LengthToCopy = *Length; 01210 Status = STATUS_BUFFER_OVERFLOW; 01211 } 01212 01213 RtlCopyMemory( Buffer->FileName, FileObject->FileName.Buffer, LengthToCopy ); 01214 01215 // 01216 // Reduce the available bytes by the amount stored into this buffer. In the overflow 01217 // case, this simply drops to zero. The returned filenamelength will indicate to the 01218 // caller how much space is required. 01219 // 01220 01221 *Length -= LengthToCopy; 01222 01223 return Status; 01224 }

VOID UdfQueryNetworkInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN PCCB  Ccb,
IN OUT PFILE_NETWORK_OPEN_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1429 of file fileinfo.c.

References Buffer, FlagOn, PAGED_CODE, and UdfGetExtraFileAttributes().

Referenced by UdfCommonQueryInfo().

01439 : 01440 01441 This routine performs the query network open information function for Udfs. 01442 01443 Arguments: 01444 01445 Fcb - Supplies the Fcb being queried, it has been verified 01446 01447 Buffer - Supplies a pointer to the buffer where the information is to 01448 be returned 01449 01450 Length - Supplies the length of the buffer in bytes, and receives the 01451 remaining bytes free in the buffer upon return. 01452 01453 Return Value: 01454 01455 None 01456 01457 --*/ 01458 01459 { 01460 PAGED_CODE(); 01461 01462 // 01463 // We support all times on Udfs. 01464 // 01465 01466 Buffer->CreationTime = Fcb->Timestamps.CreationTime; 01467 Buffer->LastWriteTime = 01468 Buffer->ChangeTime = Fcb->Timestamps.ModificationTime; 01469 Buffer->LastAccessTime = Fcb->Timestamps.AccessTime; 01470 01471 Buffer->FileAttributes = Fcb->FileAttributes | UdfGetExtraFileAttributes( Ccb ); 01472 01473 // 01474 // We get the sizes from the header. Return a size of zero 01475 // for all directories. 01476 // 01477 01478 if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) { 01479 01480 Buffer->AllocationSize.QuadPart = 01481 Buffer->EndOfFile.QuadPart = 0; 01482 01483 } else { 01484 01485 Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart; 01486 Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart; 01487 } 01488 01489 // 01490 // Update the length and status output variables 01491 // 01492 01493 *Length -= sizeof( FILE_NETWORK_OPEN_INFORMATION ); 01494 01495 return; 01496 } }

VOID UdfQueryPositionInfo IN PIRP_CONTEXT  IrpContext,
IN PFILE_OBJECT  FileObject,
IN OUT PFILE_POSITION_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 1105 of file fileinfo.c.

References Buffer, and PAGED_CODE.

Referenced by UdfCommonQueryInfo().

01114 : 01115 01116 This routine performs the query position information function for Udfs. 01117 01118 Arguments: 01119 01120 FileObject - Supplies the File object being queried 01121 01122 Buffer - Supplies a pointer to the buffer where the information is to 01123 be returned 01124 01125 Length - Supplies the length of the buffer in bytes, and receives the 01126 remaining bytes free in the buffer upon return. 01127 01128 Return Value: 01129 01130 None 01131 01132 --*/ 01133 01134 { 01135 PAGED_CODE(); 01136 01137 // 01138 // Get the current position found in the file object. 01139 // 01140 01141 Buffer->CurrentByteOffset = FileObject->CurrentByteOffset; 01142 01143 // 01144 // Update the length and status output variables 01145 // 01146 01147 *Length -= sizeof( FILE_POSITION_INFORMATION ); 01148 01149 return; 01150 }

VOID UdfQueryStandardInfo IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb,
IN OUT PFILE_STANDARD_INFORMATION  Buffer,
IN OUT PULONG  Length
 

Definition at line 936 of file fileinfo.c.

References Buffer, FALSE, FlagOn, PAGED_CODE, and TRUE.

Referenced by UdfCommonQueryInfo().

00944 : 00945 00946 This routine performs the query standard information function for Udfs. 00947 00948 Arguments: 00949 00950 Fcb - Supplies the Fcb being queried, it has been verified 00951 00952 Buffer - Supplies a pointer to the buffer where the information is to 00953 be returned 00954 00955 Length - Supplies the length of the buffer in bytes, and receives the 00956 remaining bytes free in the buffer upon return. 00957 00958 Return Value: 00959 00960 None 00961 00962 --*/ 00963 00964 { 00965 PAGED_CODE(); 00966 00967 // 00968 // Delete is never pending on a readonly file. 00969 // 00970 00971 Buffer->NumberOfLinks = Fcb->LinkCount; 00972 Buffer->DeletePending = FALSE; 00973 00974 // 00975 // We get the sizes from the header. Return a size of zero 00976 // for all directories. 00977 // 00978 00979 if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) { 00980 00981 Buffer->AllocationSize.QuadPart = 00982 Buffer->EndOfFile.QuadPart = 0; 00983 00984 Buffer->Directory = TRUE; 00985 00986 } else { 00987 00988 Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart; 00989 Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart; 00990 00991 Buffer->Directory = FALSE; 00992 } 00993 00994 // 00995 // Update the length and status output variables 00996 // 00997 00998 *Length -= sizeof( FILE_STANDARD_INFORMATION ); 00999 01000 return; 01001 }


Generated on Sat May 15 19:43:39 2004 for test by doxygen 1.3.7