83 HaveBackupPriv =
TRUE;
116 HaveBackupPriv =
TRUE;
121 AccessState->RemainingDesiredAccess &= ~WriteAccess;
129 if (!HaveBackupPriv) *
CreateOptions &= ~FILE_OPEN_FOR_BACKUP_INTENT;
147 DPRINT1(
"You are seeing this because the following ROS driver: %wZ\n"
148 " sucks. Please fix it's AddDevice Routine\n",
154 !(OpenPacket->RelatedFileObject) &&
191 (DataBuffer->SymbolicLinkReparseBuffer.PrintNameLength +
192 DataBuffer->SymbolicLinkReparseBuffer.SubstituteNameLength +
203 DataBuffer->MountPointReparseBuffer.SubstituteNameOffset);
204 Length = DataBuffer->MountPointReparseBuffer.SubstituteNameLength;
225 if (NewBuffer ==
NULL)
237 if (DataBuffer->Reserved)
241 DataBuffer->Reserved);
312 if (OpenPacket->TraversedMountPoint)
314 OpenPacket->TraversedMountPoint =
FALSE;
345 BOOLEAN DirectOpen =
FALSE, OpenCancelled, UseDummyFile;
499 OriginalDeviceObject,
501 OriginalDeviceObject->SecurityDescriptor,
581 DPRINT1(
"Traverse access failed!\n");
631 if ((OriginalDeviceObject->Vpb) && !(DirectOpen))
635 OriginalDeviceObject,
725 OriginalDeviceObject->SecurityDescriptor,
767 Irp->Tail.Overlay.AuxiliaryBuffer =
NULL;
813 Irp->AssociatedIrp.SystemBuffer = OpenPacket->
EaBuffer;
922 FileObject->FileObjectExtension = FileObjectExtension;
947 FileObject->DeviceObject = OriginalDeviceObject;
1111 if (CompleteName->MaximumLength <
FileObject->FileName.Length)
1113 PWSTR NewCompleteName;
1117 if (NewCompleteName ==
NULL)
1124 if (CompleteName->Buffer !=
NULL)
1135 CompleteName->Buffer = NewCompleteName;
1136 CompleteName->MaximumLength =
FileObject->FileName.Length;
1189 KeBugCheckEx(DRIVER_RETURNED_STATUS_REPARSE_FOR_VOLUME_OPEN,
1264 sizeof(*FileBasicInfo),
1271 sizeof(*FileBasicInfo),
1403 Irp->UserIosb = &
Irp->IoStatus;
1429 DereferenceDone =
TRUE;
1476 if (!DereferenceDone)
1543 OldSecurityDescriptor =
DeviceObject->SecurityDescriptor;
1544 if (OldSecurityDescriptor !=
NULL)
1553 NewSecurityDescriptor = OldSecurityDescriptor;
1560 if (OldSecurityDescriptor !=
NULL)
1570 &CachedSecurityDescriptor, 1);
1581 if (
DeviceObject->SecurityDescriptor == OldSecurityDescriptor)
1584 DeviceObject->SecurityDescriptor = CachedSecurityDescriptor;
1631 if (CurrentDO == UpperDeviceObject)
1637 NextDevice = CurrentDO->AttachedDevice;
1645 CurrentDO = NextDevice;
1647 while (CurrentDO !=
NULL);
1705 if (OperationCode == QuerySecurityDescriptor)
1712 else if (OperationCode == DeleteSecurityDescriptor)
1717 else if (OperationCode == AssignSecurityDescriptor)
1734 DeviceObject->SecurityDescriptor = CachedSecurityDescriptor;
1744 else if (OperationCode == SetSecurityDescriptor)
1773 else if (OperationCode == DeleteSecurityDescriptor)
1817 Irp->Overlay.AsynchronousParameters.UserApcRoutine =
NULL;
1824 if (OperationCode == QuerySecurityDescriptor)
1889 if (OperationCode == QuerySecurityDescriptor)
1902 else if (OperationCode == QuerySecurityDescriptor)
1987 if (
Length < LocalReturnLength)
2015 &LocalReturnLength);
2030 p = (
PWCHAR)(ObjectNameInfo + 1);
2035 if (QueryDosName && NoObCall)
2056 (LocalReturnLength >
Length) ?
2057 Length : LocalReturnLength);
2061 ObjectNameInfo->Name.Buffer =
p;
2067 if (LocalReturnLength >
Length)
2072 LengthMismatch =
TRUE;
2092 &LocalReturnLength);
2100 &LocalReturnLength);
2164 ObjectNameInfo->Name.MaximumLength = (
USHORT)ObjectNameInfo->Name.Length +
2195 if (HandleCount != 1)
return;
2198 if ((
FileObject->LockOperation) && (SystemHandleCount != 1))
2232 Irp->UserIosb = &
Irp->IoStatus;
2237 Irp->Overlay.AsynchronousParameters.UserApcRoutine =
NULL;
2268 if (SystemHandleCount != 1)
return;
2301 Irp->UserIosb = &
Irp->IoStatus;
2304 Irp->Overlay.AsynchronousParameters.UserApcRoutine =
NULL;
2415 DPRINT(
"IopQueryAttributesFile failed for '%wZ' with 0x%lx\n",
2434 FileInformationSize);
2480 *LockFailed =
FALSE;
2502 FileObjectExtension =
FileObject->FileObjectExtension;
2523 FileObjectExtension =
FileObject->FileObjectExtension;
2577 ULONG EaErrorOffset;
2601 DPRINT1(
"File Create 'FileAttributes' Parameter contains invalid flags!\n");
2607 DPRINT1(
"File Create 'ShareAccess' Parameter contains invalid flags!\n");
2613 DPRINT1(
"File Create 'Disposition' Parameter is out of range!\n");
2619 DPRINT1(
"File Create 'CreateOptions' parameter contains invalid flags!\n");
2626 DPRINT1(
"File Create 'CreateOptions' parameter FILE_SYNCHRONOUS_IO_* requested, but 'DesiredAccess' does not have SYNCHRONIZE!\n");
2632 DPRINT1(
"File Create 'CreateOptions' parameter FILE_DELETE_ON_CLOSE requested, but 'DesiredAccess' does not have DELETE!\n");
2639 DPRINT1(
"File Create 'FileAttributes' parameter both FILE_SYNCHRONOUS_IO_NONALERT and FILE_SYNCHRONOUS_IO_ALERT specified!\n");
2656 DPRINT1(
"File Create 'CreateOptions' Parameter has flags incompatible with FILE_DIRECTORY_FILE!\n");
2663 DPRINT1(
"File Create 'CreateOptions' Parameter FILE_DIRECTORY_FILE requested, but 'Disposition' is not FILE_CREATE/FILE_OPEN/FILE_OPEN_IF!\n");
2669 DPRINT1(
"File Create 'CreateOptions' Parameter both FILE_COMPLETE_IF_OPLOCKED and FILE_RESERVE_OPFILTER specified!\n");
2675 DPRINT1(
"File Create 'CreateOptions' parameter FILE_NO_INTERMEDIATE_BUFFERING requested, but 'DesiredAccess' FILE_APPEND_DATA requires it!\n");
2683 if (!ExtraCreateParameters)
2685 DPRINT1(
"Invalid parameter: ExtraCreateParameters == 0!\n");
2690 NamedPipeCreateParameters = ExtraCreateParameters;
2699 DPRINT1(
"Invalid named pipe create\n");
2706 if (!ExtraCreateParameters)
2708 DPRINT1(
"Invalid parameter: ExtraCreateParameters == 0!\n");
2719 DPRINT1(
"Invalid mailslot create\n");
2750 if (SafeAllocationSize.
QuadPart < 0)
2775 DPRINT1(
"Invalid EA buffer\n");
2823 DPRINT1(
"Failed to allocate open packet EA buffer\n");
2838 DPRINT1(
"Invalid EA buffer\n");
2850 OpenPacket->
Size =
sizeof(*OpenPacket);
3039 ExtraCreateParameters,
3089 ExtraCreateParameters,
3127 (
PVOID*)&CreatedFileObject);
3150 (
PVOID*)&CreatedFileObject,
3179 return CreatedFileObject;
3224 (
PVOID*)&CreatedFileObject);
3259 return CreatedFileObject;
3623 Irp->UserIosb = &
Irp->IoStatus;
3624 Irp->Overlay.AsynchronousParameters.UserApcRoutine =
NULL;
3681 if (LocalInfo ==
NULL)
3733 if (Remote && !FlagSet)
3738 else if (!Remote && FlagSet)
3823 Buffer.ReadTimeout = *TimeOut;
3836 Buffer.MailslotQuota = MailslotQuota;
3837 Buffer.MaximumMessageSize = MaxMessageSize;
3899 Buffer.DefaultTimeout = *DefaultTimeout;
3912 Buffer.NamedPipeType = NamedPipeType;
3913 Buffer.ReadMode = ReadMode;
3914 Buffer.CompletionMode = CompletionMode;
3915 Buffer.MaximumInstances = MaximumInstances;
3916 Buffer.InboundQuota = InboundQuota;
3917 Buffer.OutboundQuota = OutboundQuota;
4071 NextEntry = ListHead->
Flink;
4072 while (ListHead != NextEntry)
4080 OurIrpsInList =
TRUE;
4084 NextEntry = NextEntry->
Flink;
4097 while (OurIrpsInList)
4101 OurIrpsInList =
FALSE;
4107 NextEntry = ListHead->
Flink;
4108 while (NextEntry != ListHead)
4115 OurIrpsInList =
TRUE;
4120 NextEntry = NextEntry->
Flink;
static GENERIC_MAPPING GenericMapping
BOOLEAN NTAPI SeAccessCheck(_In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, _In_ BOOLEAN SubjectContextLocked, _In_ ACCESS_MASK DesiredAccess, _In_ ACCESS_MASK PreviouslyGrantedAccess, _Out_ PPRIVILEGE_SET *Privileges, _In_ PGENERIC_MAPPING GenericMapping, _In_ KPROCESSOR_MODE AccessMode, _Out_ PACCESS_MASK GrantedAccess, _Out_ PNTSTATUS AccessStatus)
Determines whether security access rights can be given to an object depending on the security descrip...
#define OBJ_NAME_PATH_SEPARATOR
#define InterlockedIncrement
#define InterlockedExchange
#define InterlockedDecrement
#define FILE_DIRECTORY_FILE
#define FILE_NON_DIRECTORY_FILE
#define FILE_OPEN_FOR_FREE_SPACE_QUERY
#define FILE_COMPLETE_IF_OPLOCKED
#define FILE_DELETE_ON_CLOSE
PDEVICE_OBJECT PhysicalDeviceObject
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
#define FILE_DEVICE_SECURE_OPEN
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_IMPLEMENTED
#define STATUS_OBJECT_TYPE_MISMATCH
#define NT_SUCCESS(StatCode)
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
#define ExAllocatePoolWithTag(hernya, size, tag)
#define PsGetCurrentThread()
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
#define KeSetEvent(pEvt, foo, foo2)
#define ExAcquireResourceExclusiveLite(res, wait)
#define DO_DEVICE_INITIALIZING
#define KeDelayExecutionThread(mode, foo, t)
#define DO_NEVER_LAST_DEVICE
#define ExAcquireResourceSharedLite(res, wait)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
#define ExGetPreviousMode
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
#define BooleanFlagOn(F, SF)
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
IN PVCB IN PDIRENT OUT PULONG EaLength
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
VOID NTAPI FsRtlPTeardownPerFileObjectContexts(IN PFILE_OBJECT FileObject)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
#define FILE_OPEN_BY_FILE_ID
@ FileNetworkOpenInformation
#define FILE_MAXIMUM_DISPOSITION
#define FILE_NO_COMPRESSION
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
#define FILE_OPEN_REPARSE_POINT
#define FILE_RESERVE_OPFILTER
#define FILE_SYNCHRONOUS_IO_NONALERT
#define FILE_NO_INTERMEDIATE_BUFFERING
#define FILE_RANDOM_ACCESS
#define FILE_WRITE_THROUGH
#define FILE_SEQUENTIAL_ONLY
#define FILE_SYNCHRONOUS_IO_ALERT
#define FILE_OPEN_FOR_BACKUP_INTENT
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG _In_opt_ PVOID _In_opt_ PVOID FilterContext
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
VOID NTAPI KeFlushWriteBuffer(VOID)
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
__in WDFOBJECT __in PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo
HLOCAL NTAPI LocalHandle(LPCVOID pMem)
#define OBJ_CASE_INSENSITIVE
struct _FILE_NAME_INFORMATION * PFILE_NAME_INFORMATION
#define EXCEPTION_EXECUTE_HANDLER
#define InterlockedCompareExchangePointer
static __inline NTSTATUS IopLockFileObject(_In_ PFILE_OBJECT FileObject, _In_ KPROCESSOR_MODE WaitMode)
static __inline BOOLEAN IopValidateOpenPacket(IN POPEN_PACKET OpenPacket)
FORCEINLINE VOID IopQueueIrpToThread(IN PIRP Irp)
static __inline VOID IopUpdateOperationCount(IN IOP_TRANSFER_TYPE Type)
static __inline VOID IopUnlockFileObject(IN PFILE_OBJECT FileObject)
FORCEINLINE VOID IopUnQueueIrpFromThread(IN PIRP Irp)
NTSTATUS NTAPI IoQueryFileInformation(IN PFILE_OBJECT FileObject, IN FILE_INFORMATION_CLASS FileInformationClass, IN ULONG Length, OUT PVOID FileInformation, OUT PULONG ReturnedLength)
POBJECT_TYPE IoFileObjectType
#define KeLeaveCriticalRegion()
#define KeEnterCriticalRegion()
#define REPARSE_DATA_BUFFER_HEADER_SIZE
#define ExFreePoolWithTag(_P, _T)
#define FILE_BASIC_INFORMATION
static OUT PIO_STATUS_BLOCK IoStatusBlock
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
#define InitializeObjectAttributes(p, n, a, r, s)
DWORD * PSECURITY_INFORMATION
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
_Out_ PNDIS_HANDLE _Out_ PUINT FileLength
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT _In_ NDIS_HANDLE _In_ NDIS_HANDLE _In_ PNDIS_STRING _In_ UINT OpenOptions
#define KeGetPreviousMode()
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
_In_ PVOID _In_ BOOLEAN Alertable
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
#define DOE_DELETE_PENDING
#define FILE_PIPE_MESSAGE_TYPE
#define FO_FILE_OBJECT_HAS_EXTENSION
#define IO_ATTACH_DEVICE_API
#define DOE_REMOVE_PROCESSED
#define DOE_UNLOAD_PENDING