1 //////////////////////////////////////////////////////////////////// 2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine 3 // All rights reserved 4 // This file was released under the GPLv2 on June 2015. 5 //////////////////////////////////////////////////////////////////// 6 /************************************************************************* 7 * 8 * File: protos.h 9 * 10 * Module: UDF File System Driver (Kernel mode execution only) 11 * 12 * Description: 13 * Contains the prototypes for functions in UDF FSD. 14 * 15 *************************************************************************/ 16 17 #ifndef _UDF_PROTOS_H_ 18 #define _UDF_PROTOS_H_ 19 20 #include "mem.h" 21 22 /************************************************************************* 23 * Prototypes for the file create.cpp 24 *************************************************************************/ 25 extern NTSTATUS NTAPI UDFCreate( 26 IN PDEVICE_OBJECT DeviceObject, // the logical volume device object 27 IN PIRP Irp); // I/O Request Packet 28 29 extern NTSTATUS UDFCommonCreate( 30 IN PtrUDFIrpContext PtrIrpContext, 31 IN PIRP Irp); 32 33 extern NTSTATUS UDFFirstOpenFile( 34 IN PVCB Vcb, // volume control block 35 IN PFILE_OBJECT PtrNewFileObject, // I/O Mgr. created file object 36 OUT PtrUDFFCB* PtrNewFcb, 37 IN PUDF_FILE_INFO RelatedFileInfo, 38 IN PUDF_FILE_INFO NewFileInfo, 39 IN PUNICODE_STRING LocalPath, 40 IN PUNICODE_STRING CurName); 41 42 extern NTSTATUS UDFOpenFile( 43 IN PVCB Vcb, // volume control block 44 IN PFILE_OBJECT PtrNewFileObject, // I/O Mgr. created file object 45 IN PtrUDFFCB PtrNewFcb); 46 47 extern NTSTATUS UDFInitializeFCB( 48 IN PtrUDFFCB PtrNewFcb, // FCB structure to be initialized 49 IN PVCB Vcb, // logical volume (VCB) pointer 50 IN PtrUDFObjectName PtrObjectName, // name of the object 51 IN ULONG Flags, // is this a file/directory, etc. 52 IN PFILE_OBJECT FileObject); // optional file object to be initialized 53 54 /************************************************************************* 55 * Prototypes for the file cleanup.cpp 56 *************************************************************************/ 57 extern NTSTATUS NTAPI UDFCleanup( 58 PDEVICE_OBJECT DeviceObject, // the logical volume device object 59 PIRP Irp); // I/O Request Packet 60 61 extern NTSTATUS UDFCommonCleanup( 62 PtrUDFIrpContext PtrIrpContext, 63 PIRP Irp); 64 65 extern NTSTATUS UDFCloseFileInfoChain(IN PVCB Vcb, 66 IN PUDF_FILE_INFO fi, 67 IN ULONG TreeLength, 68 IN BOOLEAN VcbAcquired); 69 /************************************************************************* 70 * Prototypes for the file close.cpp 71 *************************************************************************/ 72 extern NTSTATUS NTAPI UDFClose( 73 PDEVICE_OBJECT DeviceObject, // the logical volume device object 74 PIRP Irp); // I/O Request Packet 75 76 extern NTSTATUS UDFCommonClose( 77 PtrUDFIrpContext PtrIrpContext, 78 PIRP Irp); 79 80 #define UDF_CLOSE_NTREQFCB_DELETED 0x01 81 #define UDF_CLOSE_FCB_DELETED 0x02 82 83 extern ULONG UDFCleanUpFcbChain(IN PVCB Vcb, 84 IN PUDF_FILE_INFO fi, 85 IN ULONG TreeLength, 86 IN BOOLEAN VcbAcquired); 87 88 extern VOID UDFCloseAllDelayed(PVCB Vcb); 89 90 extern VOID NTAPI UDFDelayedClose(PVOID unused = NULL); 91 92 extern NTSTATUS UDFCloseAllXXXDelayedInDir(IN PVCB Vcb, 93 IN PUDF_FILE_INFO FileInfo, 94 IN BOOLEAN System); 95 96 #define UDFCloseAllDelayedInDir(Vcb,FI) \ 97 UDFCloseAllXXXDelayedInDir(Vcb,FI,FALSE); 98 99 #define UDFCloseAllSystemDelayedInDir(Vcb,FI) \ 100 UDFCloseAllXXXDelayedInDir(Vcb,FI,TRUE); 101 102 extern NTSTATUS UDFQueueDelayedClose(PtrUDFIrpContext IrpContext, 103 PtrUDFFCB Fcb); 104 105 //extern VOID UDFRemoveFromDelayedQueue(PtrUDFFCB Fcb); 106 #define UDFRemoveFromDelayedQueue(Fcb) \ 107 UDFCloseAllDelayedInDir((Fcb)->Vcb, (Fcb)->FileInfo) 108 109 #define UDFRemoveFromSystemDelayedQueue(Fcb) \ 110 UDFCloseAllSystemDelayedInDir((Fcb)->Vcb, (Fcb)->FileInfo) 111 112 /************************************************************************* 113 * Prototypes for the file dircntrl.cpp 114 *************************************************************************/ 115 extern NTSTATUS NTAPI UDFDirControl( 116 PDEVICE_OBJECT DeviceObject, // the logical volume device object 117 PIRP Irp); // I/O Request Packet 118 119 extern NTSTATUS NTAPI UDFCommonDirControl( 120 PtrUDFIrpContext PtrIrpContext, 121 PIRP Irp); 122 123 extern NTSTATUS NTAPI UDFQueryDirectory( 124 PtrUDFIrpContext PtrIrpContext, 125 PIRP Irp, 126 PIO_STACK_LOCATION IrpSp, 127 PFILE_OBJECT FileObject, 128 PtrUDFFCB Fcb, 129 PtrUDFCCB Ccb); 130 131 extern NTSTATUS NTAPI UDFNotifyChangeDirectory( 132 PtrUDFIrpContext PtrIrpContext, 133 PIRP Irp, 134 PIO_STACK_LOCATION IrpSp, 135 PFILE_OBJECT FileObject, 136 PtrUDFFCB Fcb, 137 PtrUDFCCB Ccb); 138 139 /************************************************************************* 140 * Prototypes for the file devcntrl.cpp 141 *************************************************************************/ 142 extern NTSTATUS NTAPI UDFDeviceControl( 143 PDEVICE_OBJECT DeviceObject, // the logical volume device object 144 PIRP Irp); // I/O Request Packet 145 146 extern NTSTATUS NTAPI UDFCommonDeviceControl( 147 PtrUDFIrpContext PtrIrpContext, 148 PIRP Irp); 149 150 extern NTSTATUS NTAPI UDFDevIoctlCompletion( 151 PDEVICE_OBJECT PtrDeviceObject, 152 PIRP Irp, 153 PVOID Context); 154 155 extern NTSTATUS NTAPI UDFHandleQueryPath( 156 PVOID BufferPointer); 157 158 /************************************************************************* 159 * Prototypes for the file fastio.cpp 160 *************************************************************************/ 161 extern BOOLEAN NTAPI UDFFastIoCheckIfPossible( 162 IN PFILE_OBJECT FileObject, 163 IN PLARGE_INTEGER FileOffset, 164 IN ULONG Length, 165 IN BOOLEAN Wait, 166 IN ULONG LockKey, 167 IN BOOLEAN CheckForReadOperation, 168 OUT PIO_STATUS_BLOCK IoStatus, 169 IN PDEVICE_OBJECT DeviceObject); 170 171 extern FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible( 172 IN PtrUDFFCB Fcb); 173 174 extern BOOLEAN NTAPI UDFFastIoQueryBasicInfo( 175 IN PFILE_OBJECT FileObject, 176 IN BOOLEAN Wait, 177 OUT PFILE_BASIC_INFORMATION Buffer, 178 OUT PIO_STATUS_BLOCK IoStatus, 179 IN PDEVICE_OBJECT DeviceObject); 180 181 extern BOOLEAN NTAPI UDFFastIoQueryStdInfo( 182 IN PFILE_OBJECT FileObject, 183 IN BOOLEAN Wait, 184 OUT PFILE_STANDARD_INFORMATION Buffer, 185 OUT PIO_STATUS_BLOCK IoStatus, 186 IN PDEVICE_OBJECT DeviceObject); 187 188 extern VOID NTAPI UDFFastIoAcqCreateSec( 189 IN PFILE_OBJECT FileObject); 190 191 extern VOID NTAPI UDFFastIoRelCreateSec( 192 IN PFILE_OBJECT FileObject); 193 194 extern BOOLEAN NTAPI UDFAcqLazyWrite( 195 IN PVOID Context, 196 IN BOOLEAN Wait); 197 198 extern VOID NTAPI UDFRelLazyWrite( 199 IN PVOID Context); 200 201 extern BOOLEAN NTAPI UDFAcqReadAhead( 202 IN PVOID Context, 203 IN BOOLEAN Wait); 204 205 extern VOID NTAPI UDFRelReadAhead( 206 IN PVOID Context); 207 208 VOID NTAPI UDFDriverUnload( 209 IN PDRIVER_OBJECT DriverObject); 210 211 // the remaining are only valid under NT Version 4.0 and later 212 #if(_WIN32_WINNT >= 0x0400) 213 214 extern BOOLEAN NTAPI UDFFastIoQueryNetInfo( 215 IN PFILE_OBJECT FileObject, 216 IN BOOLEAN Wait, 217 OUT struct _FILE_NETWORK_OPEN_INFORMATION* Buffer, 218 OUT PIO_STATUS_BLOCK IoStatus, 219 IN PDEVICE_OBJECT DeviceObject); 220 221 extern BOOLEAN NTAPI UDFFastIoMdlRead( 222 IN PFILE_OBJECT FileObject, 223 IN PLARGE_INTEGER FileOffset, 224 IN ULONG Length, 225 IN ULONG LockKey, 226 OUT PMDL* MdlChain, 227 OUT PIO_STATUS_BLOCK IoStatus, 228 IN PDEVICE_OBJECT DeviceObject); 229 230 extern BOOLEAN UDFFastIoMdlReadComplete( 231 IN PFILE_OBJECT FileObject, 232 OUT PMDL MdlChain, 233 IN PDEVICE_OBJECT DeviceObject); 234 235 extern BOOLEAN NTAPI UDFFastIoPrepareMdlWrite( 236 IN PFILE_OBJECT FileObject, 237 IN PLARGE_INTEGER FileOffset, 238 IN ULONG Length, 239 IN ULONG LockKey, 240 OUT PMDL* MdlChain, 241 OUT PIO_STATUS_BLOCK IoStatus, 242 IN PDEVICE_OBJECT DeviceObject); 243 244 extern BOOLEAN NTAPI UDFFastIoMdlWriteComplete( 245 IN PFILE_OBJECT FileObject, 246 IN PLARGE_INTEGER FileOffset, 247 OUT PMDL MdlChain, 248 IN PDEVICE_OBJECT DeviceObject); 249 250 extern NTSTATUS NTAPI UDFFastIoAcqModWrite( 251 IN PFILE_OBJECT FileObject, 252 IN PLARGE_INTEGER EndingOffset, 253 OUT PERESOURCE* ResourceToRelease, 254 IN PDEVICE_OBJECT DeviceObject); 255 256 extern NTSTATUS NTAPI UDFFastIoRelModWrite( 257 IN PFILE_OBJECT FileObject, 258 IN PERESOURCE ResourceToRelease, 259 IN PDEVICE_OBJECT DeviceObject); 260 261 extern NTSTATUS NTAPI UDFFastIoAcqCcFlush( 262 IN PFILE_OBJECT FileObject, 263 IN PDEVICE_OBJECT DeviceObject); 264 265 extern NTSTATUS NTAPI UDFFastIoRelCcFlush( 266 IN PFILE_OBJECT FileObject, 267 IN PDEVICE_OBJECT DeviceObject); 268 269 extern BOOLEAN NTAPI UDFFastIoDeviceControl ( 270 IN PFILE_OBJECT FileObject, 271 IN BOOLEAN Wait, 272 IN PVOID InputBuffer OPTIONAL, 273 IN ULONG InputBufferLength, 274 OUT PVOID OutputBuffer OPTIONAL, 275 IN ULONG OutputBufferLength, 276 IN ULONG IoControlCode, 277 OUT PIO_STATUS_BLOCK IoStatus, 278 IN PDEVICE_OBJECT DeviceObject); 279 280 extern BOOLEAN 281 NTAPI 282 UDFFastIoCopyWrite ( 283 IN PFILE_OBJECT FileObject, 284 IN PLARGE_INTEGER FileOffset, 285 IN ULONG Length, 286 IN BOOLEAN Wait, 287 IN ULONG LockKey, 288 IN PVOID Buffer, 289 OUT PIO_STATUS_BLOCK IoStatus, 290 IN PDEVICE_OBJECT DeviceObject 291 ); 292 293 #endif // (_WIN32_WINNT >= 0x0400) 294 295 /************************************************************************* 296 * Prototypes for the file fileinfo.cpp 297 *************************************************************************/ 298 extern NTSTATUS NTAPI UDFFileInfo( 299 PDEVICE_OBJECT DeviceObject, // the logical volume device object 300 PIRP Irp); // I/O Request Packet 301 302 extern NTSTATUS UDFCommonFileInfo( 303 PtrUDFIrpContext PtrIrpContext, 304 PIRP Irp); 305 306 extern NTSTATUS UDFGetBasicInformation( 307 IN PFILE_OBJECT FileObject, 308 IN PtrUDFFCB Fcb, 309 IN PFILE_BASIC_INFORMATION PtrBuffer, 310 IN OUT LONG* PtrReturnedLength); 311 312 extern NTSTATUS UDFGetNetworkInformation( 313 IN PtrUDFFCB Fcb, 314 IN PFILE_NETWORK_OPEN_INFORMATION PtrBuffer, 315 IN OUT PLONG PtrReturnedLength); 316 317 extern NTSTATUS UDFGetStandardInformation( 318 IN PtrUDFFCB Fcb, 319 IN PFILE_STANDARD_INFORMATION PtrBuffer, 320 IN OUT PLONG PtrReturnedLength); 321 322 extern NTSTATUS UDFGetInternalInformation( 323 PtrUDFIrpContext PtrIrpContext, 324 IN PtrUDFFCB Fcb, 325 IN PtrUDFCCB Ccb, 326 IN PFILE_INTERNAL_INFORMATION PtrBuffer, 327 IN OUT PLONG PtrReturnedLength); 328 329 extern NTSTATUS UDFGetEaInformation( 330 PtrUDFIrpContext PtrIrpContext, 331 IN PtrUDFFCB Fcb, 332 IN PFILE_EA_INFORMATION PtrBuffer, 333 IN OUT PLONG PtrReturnedLength); 334 335 extern NTSTATUS UDFGetFullNameInformation( 336 IN PFILE_OBJECT FileObject, 337 IN PFILE_NAME_INFORMATION PtrBuffer, 338 IN OUT PLONG PtrReturnedLength); 339 340 extern NTSTATUS UDFGetAltNameInformation( 341 IN PtrUDFFCB Fcb, 342 IN PFILE_NAME_INFORMATION PtrBuffer, 343 IN OUT PLONG PtrReturnedLength); 344 345 extern NTSTATUS UDFGetPositionInformation( 346 IN PFILE_OBJECT FileObject, 347 IN PFILE_POSITION_INFORMATION PtrBuffer, 348 IN OUT PLONG PtrReturnedLength); 349 350 extern NTSTATUS UDFGetFileStreamInformation( 351 IN PtrUDFFCB Fcb, 352 IN PFILE_STREAM_INFORMATION PtrBuffer, 353 IN OUT PLONG PtrReturnedLength); 354 355 extern NTSTATUS UDFSetBasicInformation( 356 IN PtrUDFFCB Fcb, 357 IN PtrUDFCCB Ccb, 358 IN PFILE_OBJECT FileObject, 359 IN PFILE_BASIC_INFORMATION PtrBuffer); 360 361 extern NTSTATUS UDFMarkStreamsForDeletion( 362 IN PVCB Vcb, 363 IN PtrUDFFCB Fcb, 364 IN BOOLEAN ForDel); 365 366 extern NTSTATUS UDFSetDispositionInformation( 367 IN PtrUDFFCB Fcb, 368 IN PtrUDFCCB Ccb, 369 IN PVCB Vcb, 370 IN PFILE_OBJECT FileObject, 371 IN BOOLEAN Delete); 372 373 extern NTSTATUS UDFSetAllocationInformation( 374 IN PtrUDFFCB Fcb, 375 IN PtrUDFCCB Ccb, 376 IN PVCB Vcb, 377 IN PFILE_OBJECT FileObject, 378 IN PtrUDFIrpContext PtrIrpContext, 379 IN PIRP Irp, 380 IN PFILE_ALLOCATION_INFORMATION PtrBuffer); 381 382 extern NTSTATUS UDFSetEOF( 383 IN PIO_STACK_LOCATION PtrSp, 384 IN PtrUDFFCB Fcb, 385 IN PtrUDFCCB Ccb, 386 IN PVCB Vcb, 387 IN PFILE_OBJECT FileObject, 388 IN PIRP Irp, 389 IN PFILE_END_OF_FILE_INFORMATION PtrBuffer); 390 391 extern NTSTATUS UDFRename(IN PIO_STACK_LOCATION IrpSp, 392 IN PtrUDFFCB Fcb, 393 IN PtrUDFCCB Ccb, 394 IN PFILE_OBJECT FileObject, 395 IN PFILE_RENAME_INFORMATION PtrBuffer); 396 397 extern NTSTATUS UDFStoreFileId( 398 IN PVCB Vcb, 399 IN PtrUDFCCB Ccb, 400 IN PUDF_FILE_INFO fi, 401 IN LONGLONG Id); 402 403 extern NTSTATUS UDFRemoveFileId( 404 IN PVCB Vcb, 405 IN LONGLONG Id); 406 407 #define UDFRemoveFileId__(Vcb, fi) \ 408 UDFRemoveFileId(Vcb, UDFGetNTFileId(Vcb, fi, &(fi->Fcb->FCBName->ObjectName))); 409 410 extern VOID UDFReleaseFileIdCache( 411 IN PVCB Vcb); 412 413 extern NTSTATUS UDFGetOpenParamsByFileId( 414 IN PVCB Vcb, 415 IN LONGLONG Id, 416 OUT PUNICODE_STRING* FName, 417 OUT BOOLEAN* CaseSens); 418 419 extern NTSTATUS UDFHardLink( 420 IN PIO_STACK_LOCATION PtrSp, 421 IN PtrUDFFCB Fcb1, 422 IN PtrUDFCCB Ccb1, 423 IN PFILE_OBJECT FileObject1, // Source File 424 IN PFILE_LINK_INFORMATION PtrBuffer); 425 /************************************************************************* 426 * Prototypes for the file flush.cpp 427 *************************************************************************/ 428 extern NTSTATUS NTAPI UDFFlush( 429 PDEVICE_OBJECT DeviceObject, // the logical volume device object 430 PIRP Irp); // I/O Request Packet 431 432 extern NTSTATUS UDFCommonFlush( 433 PtrUDFIrpContext PtrIrpContext, 434 PIRP Irp); 435 436 extern ULONG UDFFlushAFile( 437 PtrUDFFCB Fcb, 438 PtrUDFCCB Ccb, 439 PIO_STATUS_BLOCK PtrIoStatus, 440 IN ULONG FlushFlags = 0); 441 442 extern ULONG UDFFlushADirectory( 443 IN PVCB Vcb, 444 IN PUDF_FILE_INFO FI, 445 OUT PIO_STATUS_BLOCK PtrIoStatus, 446 ULONG FlushFlags = 0); 447 448 extern ULONG UDFFlushLogicalVolume( 449 PtrUDFIrpContext PtrIrpContext, 450 PIRP Irp, 451 PVCB Vcb, 452 ULONG FlushFlags = 0); 453 454 extern NTSTATUS NTAPI UDFFlushCompletion( 455 PDEVICE_OBJECT PtrDeviceObject, 456 PIRP Irp, 457 PVOID Context); 458 459 extern BOOLEAN UDFFlushIsBreaking( 460 IN PVCB Vcb, 461 IN ULONG FlushFlags = 0); 462 463 extern VOID UDFFlushTryBreak( 464 IN PVCB Vcb); 465 466 /************************************************************************* 467 * Prototypes for the file fscntrl.cpp 468 *************************************************************************/ 469 470 extern NTSTATUS NTAPI UDFFSControl( 471 PDEVICE_OBJECT DeviceObject, 472 PIRP Irp); 473 474 extern NTSTATUS NTAPI UDFCommonFSControl( 475 PtrUDFIrpContext PtrIrpContext, 476 PIRP Irp); // I/O Request Packet 477 478 extern NTSTATUS NTAPI UDFUserFsCtrlRequest( 479 PtrUDFIrpContext PtrIrpContext, 480 PIRP Irp); 481 482 extern NTSTATUS NTAPI UDFMountVolume( 483 PtrUDFIrpContext PtrIrpContext, 484 PIRP Irp); 485 486 extern NTSTATUS UDFStartEjectWaiter(IN PVCB Vcb); 487 488 extern VOID UDFScanForDismountedVcb (IN PtrUDFIrpContext IrpContext); 489 490 extern NTSTATUS UDFCompleteMount(IN PVCB Vcb); 491 492 extern VOID UDFCloseResidual(IN PVCB Vcb); 493 494 extern VOID UDFCleanupVCB(IN PVCB Vcb); 495 496 extern NTSTATUS UDFIsVolumeMounted(IN PtrUDFIrpContext IrpContext, 497 IN PIRP Irp); 498 499 extern NTSTATUS UDFIsVolumeDirty(IN PtrUDFIrpContext IrpContext, 500 IN PIRP Irp); 501 502 extern NTSTATUS UDFGetStatistics(IN PtrUDFIrpContext IrpContext, 503 IN PIRP Irp); 504 505 extern NTSTATUS UDFLockVolume (IN PtrUDFIrpContext IrpContext, 506 IN PIRP Irp, 507 IN ULONG PID = -1); 508 509 extern NTSTATUS UDFUnlockVolume (IN PtrUDFIrpContext IrpContext, 510 IN PIRP Irp, 511 IN ULONG PID = -1); 512 513 extern NTSTATUS UDFIsPathnameValid(IN PtrUDFIrpContext IrpContext, 514 IN PIRP Irp); 515 516 extern NTSTATUS UDFDismountVolume(IN PtrUDFIrpContext IrpContext, 517 IN PIRP Irp); 518 519 extern NTSTATUS UDFGetVolumeBitmap(IN PtrUDFIrpContext IrpContext, 520 IN PIRP Irp); 521 522 extern NTSTATUS UDFGetRetrievalPointers(IN PtrUDFIrpContext IrpContext, 523 IN PIRP Irp, 524 IN ULONG Special); 525 526 extern NTSTATUS UDFInvalidateVolumes(IN PtrUDFIrpContext IrpContext, 527 IN PIRP Irp); 528 529 /************************************************************************* 530 * Prototypes for the file LockCtrl.cpp 531 *************************************************************************/ 532 533 extern NTSTATUS NTAPI UDFLockControl( 534 IN PDEVICE_OBJECT DeviceObject, // the logical volume device object 535 IN PIRP Irp); // I/O Request Packet 536 537 extern NTSTATUS NTAPI UDFCommonLockControl( 538 IN PtrUDFIrpContext PtrIrpContext, 539 IN PIRP Irp); 540 541 extern BOOLEAN NTAPI UDFFastLock( 542 IN PFILE_OBJECT FileObject, 543 IN PLARGE_INTEGER FileOffset, 544 IN PLARGE_INTEGER Length, 545 PEPROCESS ProcessId, 546 ULONG Key, 547 BOOLEAN FailImmediately, 548 BOOLEAN ExclusiveLock, 549 OUT PIO_STATUS_BLOCK IoStatus, 550 IN PDEVICE_OBJECT DeviceObject); 551 552 extern BOOLEAN NTAPI UDFFastUnlockSingle( 553 IN PFILE_OBJECT FileObject, 554 IN PLARGE_INTEGER FileOffset, 555 IN PLARGE_INTEGER Length, 556 PEPROCESS ProcessId, 557 ULONG Key, 558 OUT PIO_STATUS_BLOCK IoStatus, 559 IN PDEVICE_OBJECT DeviceObject); 560 561 extern BOOLEAN NTAPI UDFFastUnlockAll( 562 IN PFILE_OBJECT FileObject, 563 PEPROCESS ProcessId, 564 OUT PIO_STATUS_BLOCK IoStatus, 565 IN PDEVICE_OBJECT DeviceObject); 566 567 extern BOOLEAN NTAPI UDFFastUnlockAllByKey( 568 IN PFILE_OBJECT FileObject, 569 PEPROCESS ProcessId, 570 ULONG Key, 571 OUT PIO_STATUS_BLOCK IoStatus, 572 IN PDEVICE_OBJECT DeviceObject); 573 574 /************************************************************************* 575 * Prototypes for the file misc.cpp 576 *************************************************************************/ 577 extern NTSTATUS UDFInitializeZones( 578 VOID); 579 580 extern VOID UDFDestroyZones( 581 VOID); 582 583 extern BOOLEAN __fastcall UDFIsIrpTopLevel( 584 PIRP Irp); // the IRP sent to our dispatch routine 585 586 extern long UDFExceptionFilter( 587 PtrUDFIrpContext PtrIrpContext, 588 PEXCEPTION_POINTERS PtrExceptionPointers); 589 590 extern NTSTATUS UDFExceptionHandler( 591 PtrUDFIrpContext PtrIrpContext, 592 PIRP Irp); 593 594 extern VOID UDFLogEvent( 595 NTSTATUS UDFEventLogId, // the UDF private message id 596 NTSTATUS RC); // any NT error code we wish to log ... 597 598 extern PtrUDFObjectName UDFAllocateObjectName( 599 VOID); 600 601 extern VOID __fastcall UDFReleaseObjectName( 602 PtrUDFObjectName PtrObjectName); 603 604 extern PtrUDFCCB UDFAllocateCCB( 605 VOID); 606 607 extern VOID __fastcall UDFReleaseCCB( 608 PtrUDFCCB Ccb); 609 610 extern VOID __fastcall UDFCleanUpCCB( 611 PtrUDFCCB Ccb); 612 613 extern PtrUDFFCB UDFAllocateFCB( 614 VOID); 615 616 /*extern VOID __fastcall UDFReleaseFCB( 617 PtrUDFFCB Fcb);*/ 618 __inline 619 VOID 620 UDFReleaseFCB( 621 PtrUDFFCB Fcb 622 ) 623 { 624 ASSERT(Fcb); 625 626 MyFreePool__(Fcb); 627 628 return; 629 } 630 631 extern VOID __fastcall UDFCleanUpFCB( 632 PtrUDFFCB Fcb) ; 633 634 extern PtrUDFIrpContext UDFAllocateIrpContext( 635 PIRP Irp, 636 PDEVICE_OBJECT PtrTargetDeviceObject); 637 638 extern VOID UDFReleaseIrpContext( 639 PtrUDFIrpContext PtrIrpContext); 640 641 extern NTSTATUS UDFPostRequest( 642 PtrUDFIrpContext PtrIrpContext, 643 PIRP Irp); 644 645 extern VOID NTAPI UDFCommonDispatch( 646 VOID *Context); // actually an IRPContext structure 647 648 extern NTSTATUS UDFInitializeVCB( 649 PDEVICE_OBJECT PtrVolumeDeviceObject, 650 PDEVICE_OBJECT PtrTargetDeviceObject, 651 PVPB PtrVPB); 652 653 extern VOID 654 UDFReadRegKeys( 655 PVCB Vcb, 656 BOOLEAN Update, 657 BOOLEAN UseCfg); 658 659 extern ULONG UDFGetRegParameter( 660 IN PVCB Vcb, 661 IN PCWSTR Name, 662 IN ULONG DefValue = 0); 663 664 extern ULONG 665 UDFGetCfgParameter( 666 IN PVCB Vcb, 667 IN PCWSTR Name, 668 IN ULONG DefValue 669 ); 670 671 extern VOID UDFReleaseVCB( 672 PVCB Vcb); 673 674 extern ULONG UDFRegCheckParameterValue( 675 IN PUNICODE_STRING RegistryPath, 676 IN PCWSTR Name, 677 IN PUNICODE_STRING PtrVolumePath, 678 IN PCWSTR DefaultPath, 679 IN ULONG DefValue = 0); 680 681 extern VOID UDFInitializeIrpContextFromLite ( 682 OUT PtrUDFIrpContext *IrpContext, 683 IN PtrUDFIrpContextLite IrpContextLite); 684 685 extern NTSTATUS UDFInitializeIrpContextLite ( 686 OUT PtrUDFIrpContextLite *IrpContextLite, 687 IN PtrUDFIrpContext IrpContext, 688 IN PtrUDFFCB Fcb); 689 690 691 extern NTSTATUS NTAPI UDFQuerySetEA( 692 PDEVICE_OBJECT DeviceObject, // the logical volume device object 693 PIRP Irp // I/O Request Packet 694 ); 695 696 extern ULONG 697 UDFIsResourceAcquired( 698 IN PERESOURCE Resource 699 ); 700 701 extern BOOLEAN UDFAcquireResourceExclusiveWithCheck( 702 IN PERESOURCE Resource 703 ); 704 705 extern BOOLEAN UDFAcquireResourceSharedWithCheck( 706 IN PERESOURCE Resource 707 ); 708 709 extern NTSTATUS UDFWCacheErrorHandler( 710 IN PVOID Context, 711 IN PWCACHE_ERROR_CONTEXT ErrorInfo 712 ); 713 714 /************************************************************************* 715 * Prototypes for the file NameSup.cpp 716 *************************************************************************/ 717 718 #include "namesup.h" 719 720 /************************************************************************* 721 * Prototypes for the file Udf_info\physical.cpp 722 *************************************************************************/ 723 #if 0 724 725 extern OSSTATUS UDFTRead(PVOID _Vcb, 726 PVOID Buffer, // Target buffer 727 ULONG Length, 728 ULONG LBA, 729 PULONG ReadBytes, 730 ULONG Flags = 0); 731 732 extern OSSTATUS UDFTWrite(IN PVOID _Vcb, 733 IN PVOID Buffer, // Target buffer 734 IN ULONG Length, 735 IN ULONG LBA, 736 OUT PULONG WrittenBytes, 737 IN ULONG Flags = 0); 738 739 extern OSSTATUS UDFPrepareForWriteOperation( 740 IN PVCB Vcb, 741 IN ULONG Lba, 742 IN ULONG BCount); 743 744 extern OSSTATUS UDFReadDiscTrackInfo(PDEVICE_OBJECT DeviceObject, // the target device object 745 PVCB Vcb); // Volume Control Block for ^ DevObj 746 747 extern OSSTATUS UDFReadAndProcessFullToc(PDEVICE_OBJECT DeviceObject, // the target device object 748 PVCB Vcb); 749 750 extern OSSTATUS UDFUseStandard(PDEVICE_OBJECT DeviceObject, // the target device object 751 PVCB Vcb); // Volume control block fro this DevObj 752 753 extern OSSTATUS UDFGetBlockSize(PDEVICE_OBJECT DeviceObject, // the target device object 754 PVCB Vcb); // Volume control block fro this DevObj 755 756 extern OSSTATUS UDFGetDiskInfo(IN PDEVICE_OBJECT DeviceObject, // the target device object 757 IN PVCB Vcb); // Volume control block from this DevObj 758 759 extern VOID NTAPI UDFEjectReqWaiter(IN PVOID Context); 760 761 extern VOID UDFStopEjectWaiter(PVCB Vcb); 762 763 //extern OSSTATUS UDFPrepareForReadOperation(IN PVCB Vcb, 764 // IN ULONG Lba); 765 //#define UDFPrepareForReadOperation(a,b) (STATUS_SUCCESS) 766 767 extern VOID UDFUpdateNWA(PVCB Vcb, 768 ULONG LBA, 769 ULONG BCount, 770 OSSTATUS RC); 771 772 extern OSSTATUS UDFDoDismountSequence(IN PVCB Vcb, 773 IN PPREVENT_MEDIA_REMOVAL_USER_IN Buf, 774 IN BOOLEAN Eject); 775 776 // read physical sectors 777 /*OSSTATUS UDFReadSectors(IN PVCB Vcb, 778 IN BOOLEAN Translate,// Translate Logical to Physical 779 IN ULONG Lba, 780 IN ULONG BCount, 781 IN BOOLEAN Direct, 782 OUT PCHAR Buffer, 783 OUT PULONG ReadBytes);*/ 784 #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \ 785 (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \ 786 (WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \ 787 (UDFTRead(Vcb, Buffer, ((SIZE_T)(BCount))<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0))) 788 789 790 // read data inside physical sector 791 extern OSSTATUS UDFReadInSector(IN PVCB Vcb, 792 IN BOOLEAN Translate, // Translate Logical to Physical 793 IN ULONG Lba, 794 IN ULONG i, // offset in sector 795 IN ULONG l, // transfer length 796 IN BOOLEAN Direct, 797 OUT PCHAR Buffer, 798 OUT PULONG ReadBytes); 799 // read unaligned data 800 extern OSSTATUS UDFReadData(IN PVCB Vcb, 801 IN BOOLEAN Translate, // Translate Logical to Physical 802 IN LONGLONG Offset, 803 IN ULONG Length, 804 IN BOOLEAN Direct, 805 OUT PCHAR Buffer, 806 OUT PULONG ReadBytes); 807 808 // write physical sectors 809 OSSTATUS UDFWriteSectors(IN PVCB Vcb, 810 IN BOOLEAN Translate, // Translate Logical to Physical 811 IN ULONG Lba, 812 IN ULONG WBCount, 813 IN BOOLEAN Direct, // setting this flag delays flushing of given 814 // data to indefinite term 815 IN PCHAR Buffer, 816 OUT PULONG WrittenBytes); 817 // write directly to cached sector 818 OSSTATUS UDFWriteInSector(IN PVCB Vcb, 819 IN BOOLEAN Translate, // Translate Logical to Physical 820 IN ULONG Lba, 821 IN ULONG i, // offset in sector 822 IN ULONG l, // transfer length 823 IN BOOLEAN Direct, 824 OUT PCHAR Buffer, 825 OUT PULONG WrittenBytes); 826 // write data at unaligned offset & length 827 OSSTATUS UDFWriteData(IN PVCB Vcb, 828 IN BOOLEAN Translate, // Translate Logical to Physical 829 IN LONGLONG Offset, 830 IN ULONG Length, 831 IN BOOLEAN Direct, // setting this flag delays flushing of given 832 // data to indefinite term 833 IN PCHAR Buffer, 834 OUT PULONG WrittenBytes); 835 836 OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb. 837 IN PDEVICE_OBJECT TargetDeviceObject, 838 IN BOOLEAN Unlock); 839 #endif 840 /************************************************************************* 841 * Prototypes for the file Pnp.cpp 842 *************************************************************************/ 843 NTSTATUS 844 UDFPnp ( 845 IN PDEVICE_OBJECT DeviceObject, 846 IN PIRP Irp 847 ); 848 849 /************************************************************************* 850 * Prototypes for the file read.cpp 851 *************************************************************************/ 852 extern OSSTATUS NTAPI UDFRead( 853 PDEVICE_OBJECT DeviceObject, // the logical volume device object 854 PIRP Irp); // I/O Request Packet 855 856 extern NTSTATUS UDFPostStackOverflowRead( 857 IN PtrUDFIrpContext PtrIrpContext, 858 IN PIRP Irp, 859 IN PtrUDFFCB Fcb); 860 861 extern VOID NTAPI UDFStackOverflowRead( 862 IN PVOID Context, 863 IN PKEVENT Event); 864 865 extern NTSTATUS UDFCommonRead( 866 PtrUDFIrpContext PtrIrpContext, 867 PIRP Irp); 868 869 extern PVOID UDFGetCallersBuffer( 870 PtrUDFIrpContext PtrIrpContext, 871 PIRP Irp); 872 873 extern NTSTATUS UDFLockCallersBuffer( 874 PtrUDFIrpContext PtrIrpContext, 875 PIRP Irp, 876 BOOLEAN IsReadOperation, 877 uint32 Length); 878 879 extern NTSTATUS UDFUnlockCallersBuffer( 880 PtrUDFIrpContext PtrIrpContext, 881 PIRP Irp, 882 PVOID SystemBuffer); 883 884 extern VOID UDFMdlComplete( 885 PtrUDFIrpContext PtrIrpContext, 886 PIRP Irp, 887 PIO_STACK_LOCATION IrpSp, 888 BOOLEAN ReadCompletion); 889 890 /************************************************************************* 891 * Prototypes for the file SecurSup.cpp 892 *************************************************************************/ 893 extern NTSTATUS UDFGetSecurity( 894 PDEVICE_OBJECT DeviceObject, // the logical volume device object 895 PIRP Irp); // I/O Request Packet 896 897 extern NTSTATUS UDFSetSecurity( 898 PDEVICE_OBJECT DeviceObject, // the logical volume device object 899 PIRP Irp); // I/O Request Packet 900 901 extern NTSTATUS UDFCommonGetSecurity( 902 PtrUDFIrpContext PtrIrpContext, 903 PIRP Irp); 904 905 extern NTSTATUS UDFCommonSetSecurity( 906 PtrUDFIrpContext PtrIrpContext, 907 PIRP Irp); 908 909 extern NTSTATUS 910 UDFReadSecurity( 911 IN PVCB Vcb, 912 IN PtrUDFFCB Fcb, 913 IN PSECURITY_DESCRIPTOR* SecurityDesc); 914 915 extern NTSTATUS 916 UDFAssignAcl( 917 IN PVCB Vcb, 918 IN PFILE_OBJECT FileObject, // OPTIONAL 919 IN PtrUDFFCB Fcb, 920 IN PtrUDFNTRequiredFCB NtReqFcb); 921 922 extern VOID 923 UDFDeassignAcl( 924 IN PtrUDFNTRequiredFCB NtReqFcb, 925 IN BOOLEAN AutoInherited); 926 927 extern NTSTATUS 928 UDFWriteSecurity( 929 IN PVCB Vcb, 930 IN PtrUDFFCB Fcb, 931 IN PSECURITY_DESCRIPTOR* SecurityDesc); 932 933 extern NTSTATUS 934 UDFCheckAccessRights( 935 PFILE_OBJECT FileObject, 936 PACCESS_STATE AccessState, 937 PtrUDFFCB Fcb, 938 PtrUDFCCB Ccb, 939 ACCESS_MASK DesiredAccess, 940 USHORT ShareAccess); 941 942 extern NTSTATUS 943 UDFSetAccessRights( 944 PFILE_OBJECT FileObject, 945 PACCESS_STATE AccessState, 946 PtrUDFFCB Fcb, 947 PtrUDFCCB Ccb, 948 ACCESS_MASK DesiredAccess, 949 USHORT ShareAccess); 950 951 /************************************************************************* 952 * Prototypes for the file Shutdown.cpp 953 *************************************************************************/ 954 extern NTSTATUS NTAPI UDFShutdown( 955 PDEVICE_OBJECT DeviceObject, // the logical volume device object 956 PIRP Irp); // I/O Request Packet 957 958 extern NTSTATUS UDFCommonShutdown( 959 PtrUDFIrpContext PtrIrpContext, 960 PIRP Irp); 961 962 /************************************************************************* 963 * Prototypes for the file Udf_dbg.cpp 964 *************************************************************************/ 965 extern BOOLEAN 966 UDFDebugAcquireResourceSharedLite( 967 IN PERESOURCE Resource, 968 IN BOOLEAN Wait, 969 ULONG BugCheckId, 970 ULONG Line); 971 972 extern BOOLEAN 973 UDFDebugAcquireSharedStarveExclusive( 974 IN PERESOURCE Resource, 975 IN BOOLEAN Wait, 976 ULONG BugCheckId, 977 ULONG Line); 978 979 extern BOOLEAN 980 UDFDebugAcquireResourceExclusiveLite( 981 IN PERESOURCE Resource, 982 IN BOOLEAN Wait, 983 ULONG BugCheckId, 984 ULONG Line); 985 986 extern VOID 987 UDFDebugReleaseResourceForThreadLite( 988 IN PERESOURCE Resource, 989 IN ERESOURCE_THREAD ResourceThreadId, 990 ULONG BugCheckId, 991 ULONG Line); 992 993 extern VOID 994 UDFDebugDeleteResource( 995 IN PERESOURCE Resource, 996 IN ERESOURCE_THREAD ResourceThreadId, 997 ULONG BugCheckId, 998 ULONG Line); 999 1000 extern NTSTATUS 1001 UDFDebugInitializeResourceLite( 1002 IN PERESOURCE Resource, 1003 IN ERESOURCE_THREAD ResourceThreadId, 1004 ULONG BugCheckId, 1005 ULONG Line); 1006 1007 extern VOID 1008 UDFDebugConvertExclusiveToSharedLite( 1009 IN PERESOURCE Resource, 1010 IN ERESOURCE_THREAD ResourceThreadId, 1011 ULONG BugCheckId, 1012 ULONG Line); 1013 1014 extern BOOLEAN 1015 UDFDebugAcquireSharedWaitForExclusive( 1016 IN PERESOURCE Resource, 1017 IN BOOLEAN Wait, 1018 ULONG BugCheckId, 1019 ULONG Line); 1020 1021 extern LONG 1022 UDFDebugInterlockedIncrement( 1023 IN PLONG addr, 1024 ULONG BugCheckId, 1025 ULONG Line); 1026 1027 extern LONG 1028 UDFDebugInterlockedDecrement( 1029 IN PLONG addr, 1030 ULONG BugCheckId, 1031 ULONG Line); 1032 1033 extern LONG 1034 UDFDebugInterlockedExchangeAdd( 1035 IN PLONG addr, 1036 IN LONG i, 1037 ULONG BugCheckId, 1038 ULONG Line); 1039 1040 /************************************************************************* 1041 * Prototypes for the file UDFinit.cpp 1042 *************************************************************************/ 1043 extern "C" NTSTATUS NTAPI DriverEntry( 1044 PDRIVER_OBJECT DriverObject, // created by the I/O sub-system 1045 PUNICODE_STRING RegistryPath); // path to the registry key 1046 1047 extern VOID NTAPI UDFInitializeFunctionPointers( 1048 PDRIVER_OBJECT DriverObject); // created by the I/O sub-system 1049 1050 extern VOID NTAPI 1051 UDFFsNotification(IN PDEVICE_OBJECT DeviceObject, 1052 IN BOOLEAN FsActive); 1053 1054 #ifndef WIN64 1055 //extern ptrFsRtlNotifyVolumeEvent FsRtlNotifyVolumeEvent; 1056 #endif //WIN64 1057 1058 extern BOOLEAN 1059 UDFGetInstallVersion(PULONG iVer); 1060 1061 extern BOOLEAN 1062 UDFGetInstallTime(PULONG iTime); 1063 1064 extern BOOLEAN 1065 UDFGetTrialEnd(PULONG iTrial); 1066 1067 /************************************************************************* 1068 * Prototypes for the file verify.cpp 1069 *************************************************************************/ 1070 1071 extern NTSTATUS UDFVerifyVcb ( 1072 IN PtrUDFIrpContext IrpContext, 1073 IN PVCB Vcb 1074 ); 1075 1076 extern NTSTATUS UDFVerifyVolume ( 1077 IN PIRP Irp); 1078 1079 extern NTSTATUS UDFPerformVerify ( 1080 IN PtrUDFIrpContext IrpContext, 1081 IN PIRP Irp, 1082 IN PDEVICE_OBJECT DeviceToVerify 1083 ); 1084 1085 extern BOOLEAN UDFCheckForDismount ( 1086 IN PtrUDFIrpContext IrpContext, 1087 IN PVCB Vcb, 1088 IN BOOLEAN VcbAcquired 1089 ); 1090 1091 extern BOOLEAN UDFDismountVcb ( 1092 IN PVCB Vcb, 1093 IN BOOLEAN VcbAcquired); 1094 1095 extern NTSTATUS UDFCompareVcb(IN PVCB OldVcb, 1096 IN PVCB NewVcb, 1097 IN BOOLEAN PhysicalOnly); 1098 1099 /************************************************************************* 1100 * Prototypes for the file VolInfo.cpp 1101 *************************************************************************/ 1102 extern NTSTATUS NTAPI UDFQueryVolInfo(PDEVICE_OBJECT DeviceObject, 1103 PIRP Irp); 1104 1105 extern NTSTATUS UDFCommonQueryVolInfo (PtrUDFIrpContext PtrIrpContext, 1106 PIRP Irp); 1107 1108 extern NTSTATUS NTAPI UDFSetVolInfo(PDEVICE_OBJECT DeviceObject, // the logical volume device object 1109 PIRP Irp); // I/O Request Packet 1110 1111 extern NTSTATUS UDFCommonSetVolInfo(PtrUDFIrpContext PtrIrpContext, 1112 PIRP Irp); 1113 1114 /************************************************************************* 1115 * Prototypes for the file write.cpp 1116 *************************************************************************/ 1117 extern NTSTATUS NTAPI UDFWrite( 1118 PDEVICE_OBJECT DeviceObject, // the logical volume device object 1119 PIRP Irp); // I/O Request Packet 1120 1121 extern NTSTATUS UDFCommonWrite( 1122 PtrUDFIrpContext PtrIrpContext, 1123 PIRP Irp); 1124 1125 extern VOID NTAPI UDFDeferredWriteCallBack ( 1126 VOID *Context1, // Should be PtrIrpContext 1127 VOID *Context2); // Should be Irp 1128 1129 extern VOID UDFPurgeCacheEx_( 1130 PtrUDFNTRequiredFCB NtReqFcb, 1131 LONGLONG Offset, 1132 LONGLONG Length, 1133 //#ifndef ALLOW_SPARSE 1134 BOOLEAN CanWait, 1135 //#endif ALLOW_SPARSE 1136 PVCB Vcb, 1137 PFILE_OBJECT FileObject 1138 ); 1139 1140 /*#ifdef ALLOW_SPARSE 1141 #define UDFZeroDataEx(NtReqFcb, Offset, Length, CanWait) \ 1142 UDFPurgeCacheEx_(NtReqFcb, Offset, Length) 1143 #define UDFPurgeCacheEx(NtReqFcb, Offset, Length, CanWait) \ 1144 UDFPurgeCacheEx_(NtReqFcb, Offset, Length) 1145 #else // ALLOW_SPARSE*/ 1146 #define UDFZeroDataEx(NtReqFcb, Offset, Length, CanWait, Vcb, FileObject) \ 1147 UDFPurgeCacheEx_(NtReqFcb, Offset, Length, CanWait, Vcb, FileObject) 1148 #define UDFPurgeCacheEx(NtReqFcb, Offset, Length, CanWait, Vcb, FileObject) \ 1149 UDFPurgeCacheEx_(NtReqFcb, Offset, Length, CanWait, Vcb, FileObject) 1150 //#endif //ALLOW_SPARSE 1151 1152 1153 1154 #endif // _UDF_PROTOS_H_ 1155