ReactOS 0.4.15-dev-8138-g1e75ea8
fxiotargetapi.cpp File Reference
Include dependency graph for fxiotargetapi.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) NTSTATUS STDCALL WDFEXPORT(WdfIoTargetStart)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtr (GetFxDriverGlobals(DriverGlobals), IoTarget, FX_TYPE_IO_TARGET,(PVOID *) &pTarget)
 
return pTarget Start ()
 
 __drv_when (Action==3, __drv_maxIRQL(DISPATCH_LEVEL)) __drv_when(Action
 
 __drv_maxIRQL (PASSIVE_LEVEL)) VOID STDCALL WDFEXPORT(WdfIoTargetStop)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
__in WDFIOTARGET __in __drv_strictTypeMatch (__drv_typeConst) WDF_IO_TARGET_SENT_IO_ACTION Action)
 
return pTarget GetState ()
 
_Must_inspect_result_ NTSTATUS FxIoTargetValidateOpenParams (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PWDFOBJECT) &pDevice, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, IoTarget)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFDEVICE 0x%p", Device)
 
 if (!NT_SUCCESS(status))
 
 if (NT_SUCCESS(status))
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), IoTarget, FX_TYPE_IO_TARGET_REMOTE,(PVOID *) &pTarget, &pFxDriverGlobals)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "enter WDFIOTARGET 0x%p", IoTarget)
 
 FxPointerNotNull (pFxDriverGlobals, OpenParams)
 
 if (OpenParams->Size !=sizeof(WDF_IO_TARGET_OPEN_PARAMS) &&OpenParams->Size !=sizeof(WDF_IO_TARGET_OPEN_PARAMS_V1_11))
 
 if (OpenParams->Size< sizeof(WDF_IO_TARGET_OPEN_PARAMS))
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "exit WDFIOTARGET 0x%p, %!STATUS!", IoTarget, status)
 
pTarget Close (FxIoTargetRemoteCloseReasonQueryRemove)
 
pTarget Close (FxIoTargetRemoteCloseReasonPlainClose)
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), IoTarget, FX_TYPE_IO_TARGET,(PVOID *) &pTarget, &pFxDriverGlobals)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "exit WDFIOTARGET 0x%p, WDFDEVICE 0x%p", IoTarget, device)
 
static _Must_inspect_result_ NTSTATUS FxIoTargetSendIo (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFIOTARGET IoTarget, __inout_opt WDFREQUEST Request, __in UCHAR MajorCode, __inout_opt PWDF_MEMORY_DESCRIPTOR IoBuffer, __in_opt PLONGLONG DeviceOffset, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions, __out_opt PULONG_PTR BytesReturned)
 
static _Must_inspect_result_ NTSTATUS FxIoTargetFormatIo (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFIOTARGET IoTarget, __inout WDFREQUEST Request, __in UCHAR MajorCode, __inout_opt WDFMEMORY IoBuffer, __in_opt PWDFMEMORY_OFFSET IoBufferOffsets, __in_opt PLONGLONG DeviceOffset)
 
return FxIoTargetSendIo (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, IRP_MJ_READ, OutputBuffer, DeviceOffset, RequestOptions, BytesRead)
 
return FxIoTargetFormatIo (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, IRP_MJ_READ, OutputBuffer, OutputBufferOffsets, DeviceOffset)
 
return FxIoTargetSendIo (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, IRP_MJ_WRITE, InputBuffer, DeviceOffset, RequestOptions, BytesWritten)
 
return FxIoTargetFormatIo (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, IRP_MJ_WRITE, InputBuffer, InputBufferOffsets, DeviceOffset)
 
_Must_inspect_result_ NTSTATUS FxIoTargetSendIoctl (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFIOTARGET IoTarget, __in_opt WDFREQUEST Request, __in ULONG Ioctl, __in BOOLEAN Internal, __in_opt PWDF_MEMORY_DESCRIPTOR InputBuffer, __in_opt PWDF_MEMORY_DESCRIPTOR OutputBuffer, __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions, __out_opt PULONG_PTR BytesReturned)
 
static _Must_inspect_result_ NTSTATUS FxIoTargetFormatIoctl (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFIOTARGET IoTarget, __in WDFREQUEST Request, __in ULONG Ioctl, __in BOOLEAN Internal, __in_opt WDFMEMORY InputBuffer, __in_opt PWDFMEMORY_OFFSET InputBufferOffsets, __in_opt WDFMEMORY OutputBuffer, __in_opt PWDFMEMORY_OFFSET OutputBufferOffsets)
 
return FxIoTargetSendIoctl (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, Ioctl, FALSE, InputBuffer, OutputBuffer, RequestOptions, BytesReturned)
 
return FxIoTargetFormatIoctl (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, Ioctl, FALSE, InputBuffer, InputBufferOffsets, OutputBuffer, OutputBufferOffsets)
 
return FxIoTargetSendIoctl (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, Ioctl, TRUE, InputBuffer, OutputBuffer, RequestOptions, BytesReturned)
 
return FxIoTargetFormatIoctl (GetFxDriverGlobals(DriverGlobals), IoTarget, Request, Ioctl, TRUE, InputBuffer, InputBufferOffsets, OutputBuffer, OutputBufferOffsets)
 
FxSyncRequest request (pFxDriverGlobals, &context, Request)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, IOCTL 0x%x, Args %p %p %p", IoTarget, Request, Ioctl, OtherArg1, OtherArg2, OtherArg4)
 
 if (OtherArg1 !=NULL)
 
 if (OtherArg2 !=NULL)
 
 if (OtherArg4 !=NULL)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "Enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, IOCTL 0x%x, " "WDFMEMORY 1 0x%p, 2 0x%p, 3 0x%p", IoTarget, Request, Ioctl, OtherArg1, OtherArg2, OtherArg4)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, Request, FX_TYPE_REQUEST,(PVOID *) &pRequest)
 
 for (i=0;i< FX_REQUEST_NUM_OTHER_PARAMS;i++)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "Exit: WDFIOTARGET %p, WDFREQUEST %p, IOCTL 0x%x, " "Arg Handles %p %p %p, status %!STATUS!", IoTarget, Request, Ioctl, OtherArg1, OtherArg2, OtherArg4, status)
 
_Must_inspect_result_ _IRQL_requires_max_ (DISPATCH_LEVEL) NTSTATUS STDCALL WDFEXPORT(WdfIoTargetSelfAssignDefaultIoQueue)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), IoTarget, FX_TYPE_IO_TARGET_SELF,(PVOID *) &pTargetSelf, &pGlobals)
 
 FxObjectHandleGetPtr (pGlobals, Queue, FX_TYPE_QUEUE,(PVOID *)&pFxIoQueue)
 
 if (pDevice !=pFxIoQueue->GetDevice())
 
 if (pDevice->IsLegacy())
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "exit WDFIOTARGET 0x%p, WDM file handle 0x%p", IoTarget, handle)
 

Variables

_Must_inspect_result_ __in WDFIOTARGET IoTarget
 
FxIoTargetpTarget
 
_Must_inspect_result_ __in WDFDEVICE Device
 
_Must_inspect_result_ __in WDFDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES IoTargetAttributes
 
PFX_DRIVER_GLOBALS pFxDriverGlobals = GetFxDriverGlobals(DriverGlobals)
 
FxDeviceBasepDevice = NULL
 
NTSTATUS status = FxVerifierCheckIrqlLevel(pFxDriverGlobals, PASSIVE_LEVEL)
 
_Must_inspect_result_ __in WDFIOTARGET __in PWDF_IO_TARGET_OPEN_PARAMS OpenParams
 
ULONG expectedConfigSize
 
WDF_IO_TARGET_OPEN_PARAMS openParams
 
WDFDEVICE device = pTarget->GetDeviceHandle()
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST Request
 
_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 __in_opt PLONGLONG DeviceOffset
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PLONGLONG __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PLONGLONG __in_opt PWDF_REQUEST_SEND_OPTIONS __out_opt PULONG_PTR BytesRead
 
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OutputBufferOffsets
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR InputBuffer
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PLONGLONG __in_opt PWDF_REQUEST_SEND_OPTIONS __out_opt PULONG_PTR BytesWritten
 
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET InputBufferOffsets
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG Ioctl
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PWDF_REQUEST_SEND_OPTIONS __out_opt PULONG_PTR BytesReturned
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG __in_opt PWDF_MEMORY_DESCRIPTOR OtherArg1
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PWDF_MEMORY_DESCRIPTOR OtherArg2
 
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PWDF_MEMORY_DESCRIPTOR __in_opt PWDF_MEMORY_DESCRIPTOR OtherArg4
 
FxRequestBuffer args [FX_REQUEST_NUM_OTHER_PARAMS]
 
FxInternalIoctlOthersContext context
 
ULONG i = 0
 
 else
 
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OtherArg1Offsets
 
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OtherArg2Offsets
 
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OtherArg4Offsets
 
FxRequestpRequest
 
IFxMemorypMemory [FX_REQUEST_NUM_OTHER_PARAMS]
 
WDFMEMORY memoryHandles [FX_REQUEST_NUM_OTHER_PARAMS]
 
PWDFMEMORY_OFFSET offsets [FX_REQUEST_NUM_OTHER_PARAMS] = OtherArg1Offsets
 
FxInternalIoctlParams InternalIoctlParams
 
InternalIoctlParams Argument1 = memoryHandles[i] = OtherArg1
 
InternalIoctlParams Argument2 = memoryHandles[++i] = OtherArg2
 
InternalIoctlParams Argument4 = memoryHandles[++i] = OtherArg4
 
_Must_inspect_result_ _In_ WDFIOTARGET _In_ WDFQUEUE Queue
 
PFX_DRIVER_GLOBALS pGlobals
 
FxIoTargetSelfpTargetSelf
 
FxIoQueuepFxIoQueue = NULL
 
return STATUS_SUCCESS
 
PVOID handle = pTarget->GetTargetHandle()
 

Function Documentation

◆ __drv_maxIRQL() [1/2]

◆ __drv_maxIRQL() [2/2]

__drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __drv_strictTypeMatch()

__in WDFIOTARGET __in __drv_strictTypeMatch ( __drv_typeConst  )

Definition at line 80 of file fxiotargetapi.cpp.

99{
100 DDI_ENTRY();
101
105
107 IoTarget,
109 (PVOID*) &pTarget,
111
115 "Action %d undefined or out of range", Action);
116 return;
117 }
118
122 if (!NT_SUCCESS(status)) {
123 return;
124 }
125 }
126
128}
LONG NTSTATUS
Definition: precomp.h:26
virtual VOID Stop(__in WDF_IO_TARGET_SENT_IO_ACTION Action)
Definition: fxiotarget.cpp:748
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE_BASE,(PWDFOBJECT) &pDevice, &pFxDriverGlobals)
FxIoTarget * pTarget
NTSTATUS status
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFDEVICE 0x%p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
@ FX_TYPE_IO_TARGET
Definition: fxtypes.h:100
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
@ WdfIoTargetCancelSentIo
Definition: wdfiotarget.h:71
@ WdfIoTargetWaitForSentIoToComplete
Definition: wdfiotarget.h:72
@ WdfIoTargetSentIoUndefined
Definition: wdfiotarget.h:70
@ WdfIoTargetLeaveSentIoPending
Definition: wdfiotarget.h:73
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIOTARGET * IoTarget
Definition: wdfiotarget.h:368
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

◆ __drv_when()

__drv_when ( Action  = = 3,
__drv_maxIRQL(DISPATCH_LEVEL  
)

◆ _IRQL_requires_max_()

_Must_inspect_result_ _IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 347 of file hardware.c.

1709{
1710 SendKey();
1712}
static VOID SendKey(VOID)
Definition: hardware.c:332
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:149
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
Definition: isapnp.h:399

◆ Close() [1/2]

◆ Close() [2/2]

◆ DoTraceLevelMessage() [1/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"enter WDFIOTARGET 0x%p"  ,
IoTarget   
)

◆ DoTraceLevelMessage() [2/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"enter: WDFIOTARGET 0x%  p,
WDFREQUEST 0x%  p,
IOCTL 0x%  x,
Args %p %p %p"  ,
IoTarget  ,
Request  ,
Ioctl  ,
OtherArg1  ,
OtherArg2  ,
OtherArg4   
)

◆ DoTraceLevelMessage() [3/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"Enter: WDFIOTARGET 0x%  p,
WDFREQUEST 0x%  p,
IOCTL 0x%  x,
" "WDFMEMORY 1 0x%  p,
2 0x%  p,
3 0x%p"  ,
IoTarget  ,
Request  ,
Ioctl  ,
OtherArg1  ,
OtherArg2  ,
OtherArg4   
)

◆ DoTraceLevelMessage() [4/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"exit WDFIOTARGET 0x%  p,
%!STATUS!"  ,
IoTarget  ,
status   
)

◆ DoTraceLevelMessage() [5/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"exit WDFIOTARGET 0x%  p,
WDFDEVICE 0x%p"  ,
IoTarget  ,
device   
)

◆ DoTraceLevelMessage() [6/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"exit WDFIOTARGET 0x%  p,
WDM file handle 0x%p"  ,
IoTarget  ,
handle   
)

◆ DoTraceLevelMessage() [7/8]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"Exit: WDFIOTARGET %  p,
WDFREQUEST %  p,
IOCTL 0x%  x,
" "Arg Handles %p %p p,
status %!STATUS!"  ,
IoTarget  ,
Request  ,
Ioctl  ,
OtherArg1  ,
OtherArg2  ,
OtherArg4  ,
status   
)

◆ DoTraceLevelMessage() [8/8]

◆ for()

for ( )

Definition at line 1829 of file fxiotargetapi.cpp.

1829 {
1830 if (memoryHandles[i] != NULL) {
1831
1835 (PVOID*) &pMemory[i]);
1836
1838 if (!NT_SUCCESS(status)) {
1840 "Invalid OtherArg%d memory offsets, %!STATUS!",
1841 i+1, status);
1842 return status;
1843 }
1844
1845 //
1846 // This transcribes the client union into a local structure which we
1847 // can change w/out altering the client's buffer.
1848 //
1849 args[i].SetMemory(pMemory[i], offsets[i]);
1850 }
1851 }
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
#define NULL
Definition: types.h:112
WDFMEMORY memoryHandles[FX_REQUEST_NUM_OTHER_PARAMS]
PWDFMEMORY_OFFSET offsets[FX_REQUEST_NUM_OTHER_PARAMS]
ULONG i
IFxMemory * pMemory[FX_REQUEST_NUM_OTHER_PARAMS]
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), IoTarget, FX_TYPE_IO_TARGET,(PVOID *) &pTarget)
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55
Definition: match.c:390

◆ FxIoTargetFormatIo() [1/3]

static _Must_inspect_result_ NTSTATUS FxIoTargetFormatIo ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFIOTARGET  IoTarget,
__inout WDFREQUEST  Request,
__in UCHAR  MajorCode,
__inout_opt WDFMEMORY  IoBuffer,
__in_opt PWDFMEMORY_OFFSET  IoBufferOffsets,
__in_opt PLONGLONG  DeviceOffset 
)
static

Definition at line 838 of file fxiotargetapi.cpp.

883{
886 IFxMemory* pIoMemory;
887 FxRequestBuffer ioBuf;
889
890 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
891 IoTarget,
893 (PVOID*) &pTarget,
894 &FxDriverGlobals);
895
896 DoTraceLevelMessage(FxDriverGlobals,
898 "enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, MJ code 0x%x, WDFMEMORY 0x%p",
899 IoTarget, Request, MajorCode, IoBuffer);
900
901 FxObjectHandleGetPtr(FxDriverGlobals,
902 Request,
904 (PVOID*) &pRequest);
905
906 if (IoBuffer != NULL) {
907 FxObjectHandleGetPtr(FxDriverGlobals,
908 IoBuffer,
910 (PVOID*) &pIoMemory);
911
912 status = pIoMemory->ValidateMemoryOffsets(IoBufferOffsets);
913 if (!NT_SUCCESS(status)) {
915 "invalid memory offsets, %!STATUS!",
916 status);
917 return status;
918 }
919
920 //
921 // This transcribes the client union into a local structure which we
922 // can change w/out altering the client's buffer.
923 //
924 ioBuf.SetMemory(pIoMemory, IoBufferOffsets);
925 }
926 else {
927 pIoMemory = NULL;
928 }
929
930 //
931 // Format the next stack locaiton in the PIRP
932 //
934 pRequest, MajorCode, &ioBuf, DeviceOffset, NULL);
935
936 if (NT_SUCCESS(status)) {
937 if (MajorCode == IRP_MJ_WRITE) {
938 pRequest->GetContext()->FormatWriteParams(pIoMemory, IoBufferOffsets);
939 }
940 else if (MajorCode == IRP_MJ_READ) {
941 pRequest->GetContext()->FormatReadParams(pIoMemory, IoBufferOffsets);
942 }
943 }
944
946 "exit WDFIOTARGET 0x%p, WDFREQUEST 0x%p, %!STATUS!",
948
949 return status;
950}
_Must_inspect_result_ NTSTATUS FormatIoRequest(__inout FxRequestBase *Request, __in UCHAR MajorCode, __in FxRequestBuffer *IoBuffer, __in_opt PLONGLONG StartingOffset, __in_opt FxFileObject *FileObject=NULL)
__inline FxRequestContext * GetContext(VOID)
FxRequest * pRequest
@ FX_TYPE_REQUEST
Definition: fxtypes.h:53
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
VOID SetMemory(__in IFxMemory *Memory, __in PWDFMEMORY_OFFSET Offsets)
VOID FormatReadParams(__in_opt IFxMemory *ReadMemory, __in_opt PWDFMEMORY_OFFSET ReadOffsets)
VOID FormatWriteParams(__in_opt IFxMemory *WriteMemory, __in_opt PWDFMEMORY_OFFSET WriteOffsets)
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG DeviceOffset
Definition: wdfiotarget.h:865

◆ FxIoTargetFormatIo() [2/3]

◆ FxIoTargetFormatIo() [3/3]

◆ FxIoTargetFormatIoctl() [1/3]

static _Must_inspect_result_ NTSTATUS FxIoTargetFormatIoctl ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFIOTARGET  IoTarget,
__in WDFREQUEST  Request,
__in ULONG  Ioctl,
__in BOOLEAN  Internal,
__in_opt WDFMEMORY  InputBuffer,
__in_opt PWDFMEMORY_OFFSET  InputBufferOffsets,
__in_opt WDFMEMORY  OutputBuffer,
__in_opt PWDFMEMORY_OFFSET  OutputBufferOffsets 
)
static

Definition at line 1233 of file fxiotargetapi.cpp.

1289{
1292 IFxMemory *pInputMemory, *pOutputMemory;
1293 FxRequestBuffer inputBuf, outputBuf;
1295
1296 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1297 IoTarget,
1299 (PVOID*) &pTarget,
1300 &FxDriverGlobals);
1301
1303 FxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET,
1304 "enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, IOCTL 0x%x, internal %d, input "
1305 "WDFMEMORY 0x%p, output WDFMEMORY 0x%p",
1307
1308 FxObjectHandleGetPtr(FxDriverGlobals,
1309 Request,
1311 (PVOID*) &pRequest);
1312
1313 if (InputBuffer != NULL) {
1314 FxObjectHandleGetPtr(FxDriverGlobals,
1317 (PVOID*) &pInputMemory);
1318
1320 if (!NT_SUCCESS(status)) {
1322 "Invalid input memory offsets, %!STATUS!",
1323 status);
1324 return status;
1325 }
1326
1327 //
1328 // This transcribes the client union into a local structure which we
1329 // can change w/out altering the client's buffer.
1330 //
1331 inputBuf.SetMemory(pInputMemory, InputBufferOffsets);
1332 }
1333
1334 if (OutputBuffer != NULL) {
1335 FxObjectHandleGetPtr(FxDriverGlobals,
1338 (PVOID*) &pOutputMemory);
1339
1341 if (!NT_SUCCESS(status)) {
1343 "Invalid output memory offsets, %!STATUS!",
1344 status);
1345 return status;
1346 }
1347
1348 //
1349 // This transcribes the client union into a local structure which we
1350 // can change w/out altering the client's buffer.
1351 //
1352 outputBuf.SetMemory(pOutputMemory, OutputBufferOffsets);
1353 }
1354
1355 //
1356 // format the next stack location
1357 //
1359 pRequest, Ioctl, Internal, &inputBuf, &outputBuf, NULL);
1360
1361 if (NT_SUCCESS(status)) {
1362 FxRequestContext* pContext;
1363
1364 //
1365 // Upon a successful format, a FxRequestContext will have been
1366 // associated with the FxRequest
1367 //
1368 pContext = pRequest->GetContext();
1369
1370 pContext->m_CompletionParams.Parameters.Ioctl.IoControlCode = Ioctl;
1371
1372 if (Internal) {
1374 }
1375 else {
1377 }
1378
1379 pContext->m_CompletionParams.Parameters.Ioctl.Input.Buffer = InputBuffer;
1380 if (InputBufferOffsets != NULL) {
1381 pContext->m_CompletionParams.Parameters.Ioctl.Input.Offset =
1383 }
1384
1385 pContext->m_CompletionParams.Parameters.Ioctl.Output.Buffer = OutputBuffer;
1386 if (OutputBufferOffsets != NULL) {
1387 pContext->m_CompletionParams.Parameters.Ioctl.Output.Offset =
1389 }
1390 }
1391
1393 "Exit WDFIOTARGET 0x%p, WDFREQUEST 0x%p, %!STATUS!",
1395
1396 return status;
1397}
_Must_inspect_result_ NTSTATUS FormatIoctlRequest(__in FxRequestBase *Request, __in ULONG Ioctl, __in BOOLEAN Internal, __in FxRequestBuffer *InputBuffer, __in FxRequestBuffer *OutputBuffer, __in_opt FxFileObject *FileObject=NULL)
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET InputBufferOffsets
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR InputBuffer
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in_opt PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ __in WDFIOTARGET __in_opt WDFREQUEST __in ULONG Ioctl
_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OutputBufferOffsets
@ Internal
Definition: hwresource.cpp:137
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
size_t BufferOffset
Definition: wdfmemory.h:65
union _WDF_REQUEST_COMPLETION_PARAMS::@3892 Parameters
struct _WDF_REQUEST_COMPLETION_PARAMS::@3892::@3895 Ioctl
@ WdfRequestTypeDeviceControlInternal
Definition: wdfdevice.h:518
@ WdfRequestTypeDeviceControl
Definition: wdfdevice.h:517
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953

◆ FxIoTargetFormatIoctl() [2/3]

◆ FxIoTargetFormatIoctl() [3/3]

◆ FxIoTargetSendIo() [1/3]

static _Must_inspect_result_ NTSTATUS FxIoTargetSendIo ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFIOTARGET  IoTarget,
__inout_opt WDFREQUEST  Request,
__in UCHAR  MajorCode,
__inout_opt PWDF_MEMORY_DESCRIPTOR  IoBuffer,
__in_opt PLONGLONG  DeviceOffset,
__in_opt PWDF_REQUEST_SEND_OPTIONS  RequestOptions,
__out_opt PULONG_PTR  BytesReturned 
)
static

Definition at line 695 of file fxiotargetapi.cpp.

744{
746 FxRequestBuffer ioBuf;
748
749 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
750 IoTarget,
752 (PVOID*) &pTarget,
753 &FxDriverGlobals);
754
755 //
756 // Minimize the points of failure by using the stack instead of allocating
757 // out of pool. For UMDF, request initialization can fail so we still need
758 // to call initialize for FxSyncRequest. Initialization always succeeds for
759 // KM.
760 //
762 FxSyncRequest request(FxDriverGlobals, &context, Request);
763
764 status = request.Initialize();
765 if (!NT_SUCCESS(status)) {
767 "Failed to initialize FxSyncRequest for WDFIOTARGET "
768 "0x%p", IoTarget);
769 return status;
770 }
771
773 "enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, MJ code 0x%x",
774 IoTarget, Request, MajorCode);
775
776 //
777 // Since we are synchronously waiting, we must be at passive level
778 //
780 if (!NT_SUCCESS(status)) {
781 return status;
782 }
783
785 if (!NT_SUCCESS(status)) {
787 "invalid options, %!STATUS!", status);
788 return status;
789 }
790
791 if (IoBuffer != NULL) {
792 //
793 // This transcribes the client union into a local structure which we
794 // can change w/out altering the client's buffer.
795 //
796 status = ioBuf.ValidateMemoryDescriptor(FxDriverGlobals, IoBuffer);
797 if (!NT_SUCCESS(status)) {
799 "invalid input buffer descriptor 0x%p, %!STATUS!",
800 IoBuffer, status);
801 return status;
802 }
803 }
804
805 //
806 // Format the next stack location in the PIRP
807 //
809 request.m_TrueRequest, MajorCode, &ioBuf, DeviceOffset, NULL);
810
811 if (NT_SUCCESS(status)) {
812 //
813 // And send it
814 //
816 "WDFIOTARGET 0x%p, WDFREQUEST 0x%p being submitted",
817 IoTarget, request.m_TrueRequest->GetTraceObjectHandle());
818
820
821 if (BytesReturned != NULL) {
822 *BytesReturned = request.m_TrueRequest->GetSubmitFxIrp()->GetInformation();
823
824 }
825 }
826 else {
828 "could not format MJ 0x%x request, %!STATUS!",
829 MajorCode, status);
830 }
831
832 return status;
833}
_Must_inspect_result_ NTSTATUS SubmitSync(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
FxInternalIoctlOthersContext context
NTSTATUS __inline FxValidateRequestOptions(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PWDF_REQUEST_SEND_OPTIONS Options, _In_opt_ FxRequestBase *Request=NULL)
NTSTATUS ValidateMemoryDescriptor(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_MEMORY_DESCRIPTOR Descriptor, __in ULONG Flags=0x0)
Definition: http.c:7252
Definition: tftpd.h:86
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS RequestOptions
Definition: wdfiotarget.h:867

◆ FxIoTargetSendIo() [2/3]

◆ FxIoTargetSendIo() [3/3]

◆ FxIoTargetSendIoctl() [1/3]

_Must_inspect_result_ NTSTATUS FxIoTargetSendIoctl ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFIOTARGET  IoTarget,
__in_opt WDFREQUEST  Request,
__in ULONG  Ioctl,
__in BOOLEAN  Internal,
__in_opt PWDF_MEMORY_DESCRIPTOR  InputBuffer,
__in_opt PWDF_MEMORY_DESCRIPTOR  OutputBuffer,
__in_opt PWDF_REQUEST_SEND_OPTIONS  RequestOptions,
__out_opt PULONG_PTR  BytesReturned 
)

Definition at line 1081 of file fxiotargetapi.cpp.

1128{
1130 FxRequestBuffer inputBuf, outputBuf;
1132
1133 FxObjectHandleGetPtrAndGlobals(FxDriverGlobals,
1134 IoTarget,
1136 (PVOID*) &pTarget,
1137 &FxDriverGlobals);
1138
1139 //
1140 // Minimize the points of failure by using the stack instead of allocating
1141 // out of pool. For UMDF, request initialization can fail so we still need
1142 // to call initialize for FxSyncRequest. Initialization always succeeds for
1143 // KM.
1144 //
1146 FxSyncRequest request(FxDriverGlobals, &context, Request);
1147
1148 status = request.Initialize();
1149 if (!NT_SUCCESS(status)) {
1151 "Failed to initialize FxSyncRequest for WDFIOTARGET "
1152 "0x%p", IoTarget);
1153 return status;
1154 }
1155
1157 "enter: WDFIOTARGET 0x%p, WDFREQUEST 0x%p, IOCTL 0x%x, "
1158 "internal %d", IoTarget, Request, Ioctl, Internal);
1159
1160 //
1161 // Since we are synchronously waiting, we must be at passive
1162 //
1163 status = FxVerifierCheckIrqlLevel(FxDriverGlobals, PASSIVE_LEVEL);
1164 if (!NT_SUCCESS(status)) {
1165 return status;
1166 }
1167
1169 if (!NT_SUCCESS(status)) {
1171 "invalid options, %!STATUS!", status);
1172 return status;
1173 }
1174
1175 if (InputBuffer != NULL) {
1176 //
1177 // This transcribes the client union into a local structure which we
1178 // can change w/out altering the client's buffer.
1179 //
1180 status = inputBuf.ValidateMemoryDescriptor(FxDriverGlobals, InputBuffer);
1181 if (!NT_SUCCESS(status)) {
1183 "invalid input buffer descriptor 0x%p, %!STATUS!",
1185 return status;
1186 }
1187 }
1188
1189 if (OutputBuffer != NULL) {
1190 //
1191 // This transcribes the client union into a local structure which we
1192 // can change w/out altering the client's buffer.
1193 //
1194 status = outputBuf.ValidateMemoryDescriptor(FxDriverGlobals, OutputBuffer);
1195 if (!NT_SUCCESS(status)) {
1197 "invalid output buffer descriptor 0x%p, %!STATUS!",
1199 return status;
1200 }
1201 }
1202
1203 //
1204 // Format the next stack location
1205 //
1207 request.m_TrueRequest, Ioctl, Internal, &inputBuf, &outputBuf, NULL);
1208
1209 if (NT_SUCCESS(status)) {
1211 "WDFIOTARGET 0x%p, WDFREQUEST 0x%p being submitted",
1212 IoTarget,
1213 request.m_TrueRequest->GetTraceObjectHandle());
1214
1215 status = pTarget->SubmitSync(request.m_TrueRequest, RequestOptions);
1216
1217 if (BytesReturned != NULL) {
1218 *BytesReturned = request.m_TrueRequest->GetSubmitFxIrp()->GetInformation();
1219 }
1220 }
1221 else {
1223 "could not format IOCTL 0x%x request, %!STATUS!",
1224 Ioctl, status);
1225 }
1226
1227 return status;
1228}

◆ FxIoTargetSendIoctl() [2/3]

◆ FxIoTargetSendIoctl() [3/3]

return FxIoTargetSendIoctl ( GetFxDriverGlobals(DriverGlobals ,
IoTarget  ,
Request  ,
Ioctl  ,
TRUE  ,
InputBuffer  ,
OutputBuffer  ,
RequestOptions  ,
BytesReturned   
)

◆ FxIoTargetValidateOpenParams()

_Must_inspect_result_ NTSTATUS FxIoTargetValidateOpenParams ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PWDF_IO_TARGET_OPEN_PARAMS  OpenParams 
)

Definition at line 225 of file fxiotargetapi.cpp.

244{
246
247 //
248 // Check specific fields based on Type
249 //
250 switch (OpenParams->Type) {
252 if (OpenParams->TargetDeviceObject == NULL) {
255 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
256 "Expected non NULL TargetDeviceObject in OpenParams, %!STATUS!",
257 status);
258 return status;
259 }
260
261 //
262 // This type is supported only in KMDF.
263 //
264 if (FxDriverGlobals->IsUserModeDriver) {
267 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
268 "The open type WdfIoTargetOpenUseExistingDevice is not "
269 "supported in UMDF drivers. It is supported in KMDF "
270 "drivers only, %!STATUS!",
271 status);
272 return status;
273 }
274
275 if (OpenParams->TargetFileObject == NULL &&
276 (OpenParams->EvtIoTargetQueryRemove != NULL ||
277 OpenParams->EvtIoTargetRemoveCanceled != NULL ||
278 OpenParams->EvtIoTargetRemoveComplete != NULL)) {
280
282 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
283 "OpenParams %p TargetFileObject is NULL but a state callback "
284 "(query remove %p, remove canceled %p, remove complete %p)"
285 " was specified, %!STATUS!",
286 OpenParams, OpenParams->EvtIoTargetQueryRemove,
287 OpenParams->EvtIoTargetRemoveCanceled,
288 OpenParams->EvtIoTargetRemoveComplete, status);
289
290 return status;
291 }
292 break;
293
295 if (OpenParams->TargetDeviceName.Buffer == NULL ||
296 OpenParams->TargetDeviceName.Length == 0 ||
297 OpenParams->TargetDeviceName.MaximumLength == 0) {
300 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
301 "Expected valid OpenParams TargetDeviceName string, %!STATUS!",
302 status);
303 return status;
304 }
305 break;
306
308 //
309 // This type is supported only in UMDF.
310 //
311 if (FxDriverGlobals->IsUserModeDriver == FALSE) {
314 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
315 "The open type WdfIoTargetOpenLocalTargetByFile is not "
316 "supported in KMDF drivers. It is supported in UMDF "
317 "drivers only, %!STATUS!",
318 status);
319 return status;
320 }
321
322 if ((OpenParams->EvtIoTargetQueryRemove != NULL ||
323 OpenParams->EvtIoTargetRemoveCanceled != NULL ||
324 OpenParams->EvtIoTargetRemoveComplete != NULL)) {
326
328 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIOTARGET,
329 "The open type is WdfIoTargetOpenLocalTargetByFile but a state"
330 " callback (query remove %p, remove canceled %p, remove"
331 " complete %p) was specified, %!STATUS!",
332 OpenParams->EvtIoTargetQueryRemove,
333 OpenParams->EvtIoTargetRemoveCanceled,
334 OpenParams->EvtIoTargetRemoveComplete, status);
335
336 return status;
337 }
338
339 if (OpenParams->FileName.Buffer != NULL ||
340 OpenParams->FileName.Length != 0 ||
341 OpenParams->FileName.MaximumLength != 0) {
342 status = FxValidateUnicodeString(FxDriverGlobals,
343 &OpenParams->FileName);
344 if (!NT_SUCCESS(status)) {
345 return status;
346 }
347 }
348
349
350 break;
351
353 break;
354
355 default:
358 "OpenParams Type (%d) incorrect, %!STATUS!",
359 OpenParams->Type, status);
360
361 return status;
362 }
363
364 return STATUS_SUCCESS;
365}
#define FALSE
Definition: types.h:117
return STATUS_SUCCESS
_Must_inspect_result_ NTSTATUS __inline FxValidateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING String)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
@ WdfIoTargetOpenLocalTargetByFile
Definition: wdfiotarget.h:66
@ WdfIoTargetOpenReopen
Definition: wdfiotarget.h:65
@ WdfIoTargetOpenUseExistingDevice
Definition: wdfiotarget.h:63
@ WdfIoTargetOpenByName
Definition: wdfiotarget.h:64
_Must_inspect_result_ _In_ WDFIOTARGET _In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams
Definition: wdfiotarget.h:401

◆ FxObjectHandleGetPtr() [1/3]

FxObjectHandleGetPtr ( GetFxDriverGlobals(DriverGlobals ,
IoTarget  ,
FX_TYPE_IO_TARGET  ,
(PVOID *) &  pTarget 
)

◆ FxObjectHandleGetPtr() [2/3]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
Request  ,
FX_TYPE_REQUEST  ,
(PVOID *) &  pRequest 
)

◆ FxObjectHandleGetPtr() [3/3]

FxObjectHandleGetPtr ( pGlobals  ,
Queue  ,
FX_TYPE_QUEUE  ,
(PVOID *)&  pFxIoQueue 
)

◆ FxObjectHandleGetPtrAndGlobals() [1/4]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
Device  ,
FX_TYPE_DEVICE_BASE  ,
(PWDFOBJECT) &  pDevice,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [2/4]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
IoTarget  ,
FX_TYPE_IO_TARGET  ,
(PVOID *) &  pTarget,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [3/4]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
IoTarget  ,
FX_TYPE_IO_TARGET_REMOTE  ,
(PVOID *) &  pTarget,
pFxDriverGlobals 
)

◆ FxObjectHandleGetPtrAndGlobals() [4/4]

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
IoTarget  ,
FX_TYPE_IO_TARGET_SELF  ,
(PVOID *) &  pTargetSelf,
pGlobals 
)

◆ FxPointerNotNull() [1/2]

FxPointerNotNull ( pFxDriverGlobals  ,
IoTarget   
)

◆ FxPointerNotNull() [2/2]

FxPointerNotNull ( pFxDriverGlobals  ,
OpenParams   
)

◆ GetState()

return pTarget GetState ( )

Referenced by DECLARE_INTERFACE_().

◆ if() [1/9]

if ( NT_SUCCESSstatus)

Definition at line 419 of file fxiotargetapi.cpp.

419 {
420 return status;
421 }

◆ if() [2/9]

if ( NT_SUCCESS(status )

Definition at line 435 of file fxiotargetapi.cpp.

435 {
437 }
WDFIOTARGET GetHandle(VOID)
Definition: fxiotarget.hpp:307

◆ if() [3/9]

Definition at line 507 of file fxiotargetapi.cpp.

508 {
511 "OpenParams size (%d) incorrect, expected %d, %!STATUS!",
513 return status;
514 }
ULONG expectedConfigSize
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

◆ if() [4/9]

if ( )

Definition at line 519 of file fxiotargetapi.cpp.

519 {
521
522 //
523 // Copy over existing fields and readjust the struct size.
524 //
526 openParams.Size = sizeof(openParams);
527
528 //
529 // Use new open params structure from now on.
530 //
532 }
WDF_IO_TARGET_OPEN_PARAMS openParams
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ if() [5/9]

if ( OtherArg1 = NULL)

Definition at line 1654 of file fxiotargetapi.cpp.

1654 {
1655 //
1656 // This transcribes the client union into a local structure which we
1657 // can change w/out altering the client's buffer.
1658 //
1659 status = args[i].ValidateMemoryDescriptor(pFxDriverGlobals, OtherArg1);
1660 if (!NT_SUCCESS(status)) {
1662 "invalid OtherArg1 buffer descriptor 0x%p, %!STATUS!",
1663 OtherArg1, status);
1664 return status;
1665 }
1666 }
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR OtherArg1
Definition: wdfiotarget.h:1249

◆ if() [6/9]

if ( OtherArg2 = NULL)

Definition at line 1669 of file fxiotargetapi.cpp.

1669 {
1670 //
1671 // This transcribes the client union into a local structure which we
1672 // can change w/out altering the client's buffer.
1673 //
1674 status = args[i].ValidateMemoryDescriptor(pFxDriverGlobals, OtherArg2);
1675 if (!NT_SUCCESS(status)) {
1677 "invalid OtherArg2 buffer descriptor 0x%p, %!STATUS!",
1678 OtherArg2, status);
1679 return status;
1680 }
1681 }
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR OtherArg2
Definition: wdfiotarget.h:1251

◆ if() [7/9]

if ( OtherArg4 = NULL)

Definition at line 1684 of file fxiotargetapi.cpp.

1684 {
1685 //
1686 // This transcribes the client union into a local structure which we
1687 // can change w/out altering the client's buffer.
1688 //
1689 status = args[i].ValidateMemoryDescriptor(pFxDriverGlobals, OtherArg4);
1690 if (!NT_SUCCESS(status)) {
1692 "invalid OtherArg4 buffer descriptor 0x%p, %!STATUS!",
1693 OtherArg4, status);
1694 return status;
1695 }
1696 }
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR OtherArg4
Definition: wdfiotarget.h:1253

◆ if() [8/9]

if ( pDevice = pFxIoQueue->GetDevice())

Definition at line 1933 of file fxiotargetapi.cpp.

1933 {
1935
1938 "Input WDFQUEUE 0x%p belongs to WDFDEVICE 0x%p, but "
1939 "Self Io Target 0x%p corresponds to the WDFDEVICE 0x%p, %!STATUS!",
1942
1943 return status;
1944 }
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
__inline CfxDevice * GetDevice(VOID)
Definition: fxioqueue.hpp:773
#define TRACINGIO
Definition: dbgtrace.h:66
PFX_DRIVER_GLOBALS pGlobals
FxIoQueue * pFxIoQueue
FxDeviceBase * pDevice
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2225

◆ if() [9/9]

if ( pDevice->  IsLegacy())

Definition at line 1946 of file fxiotargetapi.cpp.

1946 {
1947 //
1948 // This is a controldevice. Make sure the create is called after the device
1949 // is initialized and ready to accept I/O.
1950 //
1952 if ((deviceObject.GetFlags() & DO_DEVICE_INITIALIZING) == 0x0) {
1953
1957 "Queue cannot be configured for automatic dispatching"
1958 " after WdfControlDeviceFinishInitializing"
1959 "is called on the WDFDEVICE %p is called %!STATUS!",
1960 pDevice->GetHandle(),
1961 status);
1962 return status;
1963 }
1964 }
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
ULONG GetFlags(VOID)
#define TRACINGPNP
Definition: dbgtrace.h:67
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
MxDeviceObject deviceObject
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178

◆ request()

FxSyncRequest request ( pFxDriverGlobals  ,
context,
Request   
)

◆ Start()

return pTarget Start ( )

Variable Documentation

◆ args

◆ Argument1

Definition at line 1820 of file fxiotargetapi.cpp.

◆ Argument2

Definition at line 1823 of file fxiotargetapi.cpp.

◆ Argument4

◆ BytesRead

◆ BytesReturned

◆ BytesWritten

◆ context

◆ Device

Definition at line 376 of file fxiotargetapi.cpp.

◆ device

return device = pTarget->GetDeviceHandle()

Definition at line 673 of file fxiotargetapi.cpp.

◆ DeviceOffset

Initial value:

Definition at line 966 of file fxiotargetapi.cpp.

◆ else

else
Initial value:
{
"Could not format IOCTL 0x%x request, %!STATUS!",

Definition at line 1717 of file fxiotargetapi.cpp.

◆ expectedConfigSize

expectedConfigSize
Initial value:
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
Definition: globalskm.cpp:92
struct _WDF_IO_TARGET_OPEN_PARAMS WDF_IO_TARGET_OPEN_PARAMS

Definition at line 481 of file fxiotargetapi.cpp.

Referenced by if().

◆ handle

return handle = pTarget->GetTargetHandle()

Definition at line 2012 of file fxiotargetapi.cpp.

◆ i

i = 0

Definition at line 1651 of file fxiotargetapi.cpp.

Referenced by for(), and if().

◆ InputBuffer

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY InputBuffer

Definition at line 1028 of file fxiotargetapi.cpp.

Referenced by FxIoTargetFormatIoctl().

◆ InputBufferOffsets

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET InputBufferOffsets

Definition at line 1063 of file fxiotargetapi.cpp.

Referenced by FxIoTargetFormatIoctl().

◆ InternalIoctlParams

FxInternalIoctlParams InternalIoctlParams

Definition at line 1800 of file fxiotargetapi.cpp.

Referenced by FxRequestContext::FormatOtherParams().

◆ Ioctl

◆ IoTarget

__in WDFIOTARGET IoTarget
Initial value:

Definition at line 42 of file fxiotargetapi.cpp.

◆ IoTargetAttributes

◆ memoryHandles

WDFMEMORY memoryHandles[FX_REQUEST_NUM_OTHER_PARAMS]

Definition at line 1796 of file fxiotargetapi.cpp.

Referenced by for().

◆ offsets

offsets[i] = OtherArg1Offsets

Definition at line 1797 of file fxiotargetapi.cpp.

Referenced by for().

◆ OpenParams

Initial value:
{
#define DDI_ENTRY_IMPERSONATION_OK()
Definition: fxglobalskm.h:55

Definition at line 452 of file fxiotargetapi.cpp.

◆ openParams

Definition at line 482 of file fxiotargetapi.cpp.

Referenced by if().

◆ OtherArg1

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY OtherArg1

Definition at line 1561 of file fxiotargetapi.cpp.

◆ OtherArg1Offsets

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OtherArg1Offsets

Definition at line 1742 of file fxiotargetapi.cpp.

◆ OtherArg2

Definition at line 1563 of file fxiotargetapi.cpp.

◆ OtherArg2Offsets

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OtherArg2Offsets

Definition at line 1746 of file fxiotargetapi.cpp.

◆ OtherArg4

Definition at line 1565 of file fxiotargetapi.cpp.

◆ OtherArg4Offsets

Initial value:

Definition at line 1750 of file fxiotargetapi.cpp.

◆ OutputBuffer

Definition at line 964 of file fxiotargetapi.cpp.

Referenced by FxIoTargetFormatIoctl().

◆ OutputBufferOffsets

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST __in ULONG __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET OutputBufferOffsets
Initial value:

Definition at line 999 of file fxiotargetapi.cpp.

Referenced by FxIoTargetFormatIoctl().

◆ pDevice

pDevice = NULL

Definition at line 404 of file fxiotargetapi.cpp.

Referenced by if().

◆ pFxDriverGlobals

Definition at line 402 of file fxiotargetapi.cpp.

Referenced by __drv_strictTypeMatch(), for(), and if().

◆ pFxIoQueue

pFxIoQueue = NULL

Definition at line 1912 of file fxiotargetapi.cpp.

Referenced by if().

◆ pGlobals

◆ pMemory

Definition at line 1794 of file fxiotargetapi.cpp.

Referenced by for().

◆ pRequest

FxRequest* pRequest

Definition at line 1793 of file fxiotargetapi.cpp.

Referenced by FxIoTargetFormatIo(), and FxIoTargetFormatIoctl().

◆ pTarget

◆ pTargetSelf

FxIoTargetSelf* pTargetSelf

Definition at line 1910 of file fxiotargetapi.cpp.

◆ Queue

_Must_inspect_result_ _In_ WDFIOTARGET _In_ WDFQUEUE Queue
Initial value:

Definition at line 1876 of file fxiotargetapi.cpp.

◆ Request

_Must_inspect_result_ __in WDFIOTARGET __in WDFREQUEST Request

Definition at line 962 of file fxiotargetapi.cpp.

◆ RequestOptions

◆ status

◆ STATUS_SUCCESS

return STATUS_SUCCESS

Definition at line 1982 of file fxiotargetapi.cpp.

Referenced by FxIoTargetValidateOpenParams().