21#include "..\..\FxTargetsShared.hpp"
24#include "FxIoTargetRemoteUm.tmh"
37 IWudfDeviceStack* devStack;
39 devStack =
Device->GetDeviceObject()->GetDeviceStackInterface();
49 "Failed to initialize m_OpenedEvent, %!STATUS!",
status);
61 hr = devStack->CreateRemoteDispatcher(&m_pIoDispatcher,
62 &m_pRemoteDispatcher);
68 "Failed to Create RemoteDispatcher, %!STATUS!",
status);
84 if (m_NotificationCallback !=
NULL) {
85 delete m_NotificationCallback;
86 m_NotificationCallback =
NULL;
102 ULONG flagsAndAttributes;
123 hTarget =
CreateFile(pParams->TargetDeviceName.Buffer,
124 pParams->DesiredAccess,
125 pParams->ShareAccess,
127 pParams->CreateDisposition,
137 "CreateFile for WDFIOTARGET %p returned status %!STATUS!",
163 "WDFIOTARGET %p has no target file object, could not get handle",
189FxIoTargetRemote::BindToHandle(
204 "WDFIOTARGET %p could not bind remote dispatcher to new handle, "
214FxIoTargetRemote::UnbindHandle(
218 if (
NULL != m_pRemoteDispatcher) {
228 "WDFIOTARGET %p Unbinding RemoteDispatcher %p to handle %p on close",
231 m_pRemoteDispatcher->CloseHandle();
237 TargetPointers->TargetHandle =
NULL;
270 if (m_NotificationCallback ==
NULL) {
278 "WDFIOTARGET %p could not allocate resources for "
279 "notification registration, %!STATUS!",
294 static_cast<IWudfTargetCallbackDeviceChange *
> (m_NotificationCallback),
299 if (m_NotificationCallback !=
NULL) {
300 delete m_NotificationCallback;
301 m_NotificationCallback =
NULL;
307 "WDFIOTARGET %p failed to register for Pnp notification, %!STATUS!",
315 "WDFIOTARGET %p registered for Pnp notification, %!STATUS!",
329 if (NotifyHandle == WUDF_TARGET_CONTEXT_INVALID) {
337 pDevStack->UnregisterTargetDeviceNotification(NotifyHandle);
370 "Failed to create WDF File Object, %!STATUS!",
status);
393FxIoTargetRemote::CreateWdfFileObject(
425FxIoTargetRemote::CloseWdfFileObject(
436 _In_ WUDF_TARGET_CONTEXT RegistrationID
468 "QueryRemove callback was for an old registration, ignoring.");
476 "WDFIOTARGET %p: query remove notification",
493 "WDFIOTARGET %p: query remove, default action (close for QR)",
516 _In_ WUDF_TARGET_CONTEXT RegistrationID
536 "RemoveComplete callback was for an old registration, ignoring.");
543 "WDFIOTARGET %p: remove complete notification", pThis->
GetObjectHandle());
555 "WDFIOTARGET %p: remove complete, default action (close)",
572 _In_ WUDF_TARGET_CONTEXT RegistrationID
594 "RemoveCanceled callback was for an old registration, ignoring.");
601 "WDFIOTARGET %p: remove canceled notification", pThis->
GetObjectHandle());
611 "WDFIOTARGET %p: remove canceled, default action (reopen)",
638 _In_ WUDF_TARGET_CONTEXT RegistrationID,
MdDeviceObject __inline GetAttachedDevice(VOID)
MdDeviceObject __inline GetDeviceObject(VOID)
static NTSTATUS NtStatusFromHr(_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
IWudfDeviceStack * GetDeviceStack(VOID)
VOID __stdcall OnRemoveComplete(_In_ WUDF_TARGET_CONTEXT RegistrationID)
VOID __stdcall OnCustomEvent(_In_ WUDF_TARGET_CONTEXT RegistrationID, _In_ REFGUID Event, _In_reads_bytes_(DataSize) BYTE *Data, _In_ DWORD DataSize, _In_ DWORD NameBufferOffset)
FxIoTargetRemote * m_RemoteTarget
WUDF_TARGET_CONTEXT GetRegistrationId(VOID)
BOOL __stdcall OnQueryRemove(_In_ WUDF_TARGET_CONTEXT RegistrationID)
VOID __stdcall OnRemoveCanceled(_In_ WUDF_TARGET_CONTEXT RegistrationID)
FxIoTargetRemoveComplete m_EvtRemoveComplete
_Must_inspect_result_ NTSTATUS OpenLocalTargetByFile(_In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
_Must_inspect_result_ NTSTATUS Open(__in PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
HANDLE GetTargetHandle(VOID)
__inline WDFIOTARGET GetHandle(VOID)
FxIoTargetQueryRemove m_EvtQueryRemove
FxIoTargetRemoveOpenParams m_OpenParams
NTSTATUS GetTargetDeviceRelations(_Out_ BOOLEAN *Close)
VOID UnregisterForPnpNotification(_In_ MdTargetNotifyHandle Handle)
MdTargetNotifyHandle m_TargetNotifyHandle
VOID Close(__in FxIoTargetRemoteCloseReason Reason)
NTSTATUS RegisterForPnpNotification(VOID)
NTSTATUS InitRemoteModeSpecific(__in FxDeviceBase *Device)
VOID RemoveModeSpecific(VOID)
FxIoTargetRemoveCanceled m_EvtRemoveCanceled
NTSTATUS OpenTargetHandle(_In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams, _Inout_ FxIoTargetRemoveOpenParams *pParams)
MdFileObject m_TargetFileObject
PVOID __inline GetObjectHandle(VOID)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
static __inline VOID MxReferenceObject(__in PVOID Object)
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
return pObject GetObjectHandle()
IWudfDeviceStack * pDevStack
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
@ FxIoTargetRemoteCloseReasonPlainClose
@ FxIoTargetRemoteCloseReasonQueryRemove
GLenum const GLfloat * params
#define FILE_FLAG_OVERLAPPED
static IPrintDialogCallback callback
PFILE_OBJECT MdFileObject
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
#define _In_reads_bytes_(s)
#define UNREFERENCED_PARAMETER(P)
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
CHECK_RETURN_IF_USER_MODE NTSTATUS Initialize(__in BOOLEAN InitialState=FALSE)
PFN_WDF_IO_TARGET_QUERY_REMOVE m_Method
_Must_inspect_result_ NTSTATUS Invoke(__in WDFIOTARGET IoTarget)
VOID Invoke(__in WDFIOTARGET Target)
PFN_WDF_IO_TARGET_REMOVE_CANCELED m_Method
PFN_WDF_IO_TARGET_REMOVE_COMPLETE m_Method
VOID Invoke(__in WDFIOTARGET Target)
WDF_IO_TARGET_OPEN_TYPE OpenType
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
@ WdfIoTargetOpenLocalTargetByFile
_Must_inspect_result_ _In_ WDFIOTARGET _In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams
FORCEINLINE VOID WDF_IO_TARGET_OPEN_PARAMS_INIT_REOPEN(_Out_ PWDF_IO_TARGET_OPEN_PARAMS Params)
DWORD WINAPI GetLastError(void)
#define HRESULT_FROM_WIN32(x)