26 PKSOBJECT_CREATE_ITEM CreateItem;
35 CreateItem = KSCREATE_ITEM_IRP_STORAGE(
Irp);
37 if (!CreateItem || !CreateItem->SecurityDescriptor)
52 DPRINT(
"SeQuerySecurityDescriptorInfo Status %x\n",
Status);
71 PKSOBJECT_CREATE_ITEM CreateItem;
81 CreateItem = KSCREATE_ITEM_IRP_STORAGE(
Irp);
83 if (!CreateItem || !CreateItem->SecurityDescriptor)
101 &CreateItem->SecurityDescriptor,
111 CreateItem->Flags |= KSCREATE_ITEM_SECURITYCHANGED;
182 DPRINT1(
"Invalid user buffer provided\n");
221 Irp->RequestorMode = RequestorMode;
222 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
293 DPRINT1(
"Invalid user buffer provided\n");
303 DeviceObject->DriverObject->FastIoDispatch->FastIoWrite)
332 Irp->RequestorMode = RequestorMode;
333 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
534 Irp->AssociatedIrp.SystemBuffer =
Buffer;
601 if (
Flags == KSSTREAM_READ)
616 else if (
Flags == KSSTREAM_WRITE)
650 Irp->RequestorMode = RequestorMode;
651 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
653 Irp->UserBuffer = StreamHeaders;
704 Irp->AssociatedIrp.SystemBuffer =
Irp->UserBuffer;
708 if (!(ProbeFlags & KSPROBE_ALLOCATEMDL))
716 if (ProbeFlags & KSPROBE_PROBEANDLOCK)
720 if (ProbeFlags & KSPROBE_SYSTEMADDRESS)
769 if (!(ProbeFlags & KSPROBE_STREAMWRITE) || (ProbeFlags & KSPROBE_MODIFY))
785 if (ProbeFlags & KSPROBE_SYSTEMADDRESS)
850 if (Length < StreamHeader->
Size)
856 if (ProbeFlags & KSPROBE_STREAMWRITE)
873 if (!(ProbeFlags & KSPROBE_ALLOWFORMATCHANGE))
949 if (!
Irp->AssociatedIrp.SystemBuffer)
960 if (ProbeFlags & KSPROBE_STREAMWRITE)
962 if (ProbeFlags & KSPROBE_MODIFY)
991 if (ProbeFlags & KSPROBE_ALLOCATEMDL)
1023 if (Length < StreamHeader->
Size)
1029 if (ProbeFlags & KSPROBE_STREAMWRITE)
1046 if (!(ProbeFlags & KSPROBE_ALLOWFORMATCHANGE))
1166 *ExtraBuffer = BufferOrg;
1305 Entry = QueueHead->Flink;
1307 while(
Entry != QueueHead)
1313 NextEntry =
Entry->Flink;
1320 if (OldDriverCancel)
1384 if (
Irp->Cancel && OldDriverCancel ==
NULL)
1418 DPRINT(
"KsRemoveIrpFromCancelableQueue ListHead %p SpinLock %p ListLocation %x RemovalOperation %x\n", QueueHead,
SpinLock, ListLocation, RemovalOperation);
1432 CurEntry = QueueHead;
1441 CurEntry = CurEntry->
Flink;
1443 CurEntry = CurEntry->
Blink;
1446 if (CurEntry == QueueHead)
1461 if (
Irp->CancelRoutine)
1519 IN PFNKSIRPLISTCALLBACK ListCallback,
1527 if (!DestinationLock)
1553 SrcEntry = SrcEntry->
Flink;
1558 SrcEntry = SrcEntry->
Blink;
1591 if (DestinationLock)
1594 KSQUEUE_SPINLOCK_IRP_STORAGE(
Irp) = DestinationLock;
1610 if (!DestinationLock)
1644 DPRINT(
"KsRemoveSpecificIrpFromCancelableQueue %p\n",
Irp);
1684 DPRINT(
"KsAddIrpToCancelableQueue QueueHead %p SpinLock %p Irp %p ListLocation %x DriverCancel %p\n", QueueHead,
SpinLock,
Irp, ListLocation, DriverCancel);
1725 if (
Irp->Cancel && OldDriverCancel ==
NULL)
1798 if (
String->Buffer[0] ==
L'\\')
1809 while ((
Count > 0) && (*pStr !=
L'\\'))
1826 while (
Entry != ListHead)
1835 if(CreateItemEntry->
CreateItem->Flags & KSCREATE_ITEM_WILDCARD)
1838 *OutCreateItem = CreateItemEntry;
1849 DPRINT(
"CreateItem %S Length %u Request %wZ %u\n",
1850 CreateItemEntry->
CreateItem->ObjectClass.Buffer,
1851 CreateItemEntry->
CreateItem->ObjectClass.Length,
1868 *OutCreateItem = CreateItemEntry;
1898 DeviceHeader = DeviceExtension->DeviceHeader;
1904 DPRINT(
"Using reference string hack\n");
1905 Irp->IoStatus.Information = 0;
1936 KSCREATE_ITEM_IRP_STORAGE(
Irp) = CreateItemEntry->
CreateItem;
1949 Irp->IoStatus.Information = 0;
1986 Irp->IoStatus.Information = 0;
2098 DeviceHeader = DeviceExtension->DeviceHeader;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
#define InterlockedIncrement
_In_ PFCB _In_ LONGLONG FileOffset
#define NT_SUCCESS(StatCode)
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsDefaultForwardIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI IKsDevice_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI IKsDevice_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI IKsDevice_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI VOID NTAPI KsCancelIo(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock)
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI VOID NTAPI KsAddIrpToCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN PIRP Irp, IN KSLIST_ENTRY_LOCATION ListLocation, IN PDRIVER_CANCEL DriverCancel OPTIONAL)
KSDDKAPI NTSTATUS NTAPI KsQueryInformationFile(IN PFILE_OBJECT FileObject, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass)
NTSTATUS NTAPI KspCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsStreamIo(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL, IN PVOID CompletionContext OPTIONAL, IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN OUT PVOID StreamHeaders, IN ULONG Length, IN ULONG Flags, IN KPROCESSOR_MODE RequestorMode)
KSDDKAPI NTSTATUS NTAPI KsSetMajorFunctionHandler(IN PDRIVER_OBJECT DriverObject, IN ULONG MajorFunction)
KSDDKAPI NTSTATUS NTAPI KsDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI VOID NTAPI KsRemoveSpecificIrpFromCancelableQueue(IN PIRP Irp)
NTSTATUS FindMatchingCreateItem(PLIST_ENTRY ListHead, PUNICODE_STRING String, OUT PCREATE_ITEM_ENTRY *OutCreateItem)
KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(IN PIRP Irp, IN ULONG ProbeFlags, IN ULONG HeaderSize)
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
KSDDKAPI ULONG NTAPI KsGetNodeIdFromIrp(IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsDefaultDeviceIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsWriteFile(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PVOID Buffer, IN ULONG Length, IN ULONG Key OPTIONAL, IN KPROCESSOR_MODE RequestorMode)
KSDDKAPI NTSTATUS NTAPI KsAllocateExtraData(IN PIRP Irp, IN ULONG ExtraSize, OUT PVOID *ExtraBuffer)
KSDDKAPI NTSTATUS NTAPI KsReadFile(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID Buffer, IN ULONG Length, IN ULONG Key OPTIONAL, IN KPROCESSOR_MODE RequestorMode)
KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsMoveIrpsOnCancelableQueue(IN OUT PLIST_ENTRY SourceList, IN PKSPIN_LOCK SourceLock, IN OUT PLIST_ENTRY DestinationList, IN PKSPIN_LOCK DestinationLock OPTIONAL, IN KSLIST_ENTRY_LOCATION ListLocation, IN PFNKSIRPLISTCALLBACK ListCallback, IN PVOID Context)
KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI VOID NTAPI KsNullDriverUnload(IN PDRIVER_OBJECT DriverObject)
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI KspDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI VOID NTAPI KsCancelRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
KSDDKAPI NTSTATUS NTAPI KsSetInformationFile(IN PFILE_OBJECT FileObject, IN PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass)
KSDDKAPI NTSTATUS NTAPI KsDispatchSpecificMethod(IN PIRP Irp, IN PFNKSHANDLER Handler)
KSDDKAPI VOID NTAPI KsReleaseIrpOnCancelableQueue(IN PIRP Irp, IN PDRIVER_CANCEL DriverCancel OPTIONAL)
KSDDKAPI PIRP NTAPI KsRemoveIrpFromCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN KSLIST_ENTRY_LOCATION ListLocation, IN KSIRP_REMOVAL_OPERATION RemovalOperation)
static PVOID Mapping[EMS_PHYSICAL_PAGES]
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeReleaseSpinLock(sl, irql)
#define KeAcquireSpinLock(sl, irql)
#define KeGetCurrentIrql()
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)
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
__in WDFDEVICE __in CONST GUID __in_opt PCUNICODE_STRING RefString
#define EXCEPTION_EXECUTE_HANDLER
IoSetCancelRoutine(Irp, CancelRoutine)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
#define IOCTL_KS_RESET_STATE
#define IOCTL_KS_PROPERTY
#define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED
@ KsAcquireOnlySingleItem
@ KsAcquireAndRemoveOnlySingleItem
#define IOCTL_KS_READ_STREAM
#define IOCTL_KS_ENABLE_EVENT
#define IOCTL_KS_WRITE_STREAM
#define IOCTL_KS_DISABLE_EVENT
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
VOID FreeItem(IN PVOID Item)
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
struct CREATE_ITEM_ENTRY * PCREATE_ITEM_ENTRY
PVOID NTAPI MmMapLockedPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode)
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
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
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
#define STATUS_INVALID_BUFFER_SIZE
#define STATUS_PROPSET_NOT_FOUND
#define STATUS_NO_SECURITY_ON_OBJECT
FAST_IO_DISPATCH FastIoDispatch
#define FileStandardInformation
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define IRP_MJ_DEVICE_CONTROL
#define IRP_MJ_SET_INFORMATION
#define IRP_MJ_QUERY_INFORMATION
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
PULONG MinorVersion OPTIONAL
PKSOBJECT_CREATE_ITEM CreateItem
base of all file and directory entries
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
struct _IO_STACK_LOCATION::@3974::@3992 QuerySecurity
struct _IO_STACK_LOCATION::@3974::@3979 Write
struct _IO_STACK_LOCATION::@3974::@3993 SetSecurity
PDEVICE_OBJECT DeviceObject
struct _IO_STACK_LOCATION::@3974::@3984 SetFile
struct _IO_STACK_LOCATION::@3974::@3978 Read
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
struct _IO_STACK_LOCATION::@3974::@3983 QueryFile
union _IO_STACK_LOCATION::@1575 Parameters
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
#define RtlMoveMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ WDFDPC _In_ BOOLEAN Wait
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Must_inspect_result_ _In_ ULONG Flags
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IRP_DEALLOCATE_BUFFER
#define IRP_INPUT_OPERATION
IO_COMPLETION_ROUTINE * PIO_COMPLETION_ROUTINE
DRIVER_CANCEL * PDRIVER_CANCEL
DRIVER_DISPATCH * PDRIVER_DISPATCH
#define IRP_MJ_QUERY_SECURITY
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_FLUSH_BUFFERS
#define FO_SYNCHRONOUS_IO
#define IRP_MJ_SET_SECURITY
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
enum _LOCK_OPERATION LOCK_OPERATION
#define MDL_MAPPING_CAN_FAIL
#define MDL_SOURCE_IS_NONPAGED_POOL
#define MDL_MAPPED_TO_SYSTEM_VA
NTKERNELAPI NTSTATUS NTAPI SeSetSecurityDescriptorInfo(_In_opt_ PVOID Object, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
NTKERNELAPI NTSTATUS NTAPI SeQuerySecurityDescriptorInfo(_In_ PSECURITY_INFORMATION SecurityInformation, _Out_writes_bytes_(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG Length, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor)