[WDF] Add Windows Driver Framework files

Takern from Microsoft GitHub repo:
d9c6040fe9

Licensed under MIT
This commit is contained in:
Victor Perevertkin 2020-09-24 23:51:15 +03:00
parent 545df81502
commit 8a978a179f
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
475 changed files with 285099 additions and 0 deletions

View file

@ -0,0 +1,66 @@
/*++
Copyright (c) Microsoft Corporation
ModuleName:
MxWorkItemUm.cpp
Abstract:
Work item callback thunk implementation for user mode
We need this thunk to wire the um callback to a mode agnostic work item
callback.
Author:
Revision History:
--*/
#include "Mx.h"
VOID
CALLBACK
MxWorkItem::_WorkerThunk (
_Inout_ PTP_CALLBACK_INSTANCE Instance,
_Inout_opt_ PVOID Parameter,
_Inout_ PTP_WAIT Wait,
_In_ TP_WAIT_RESULT WaitResult
)
{
MdWorkItem workItem = (MdWorkItem) Parameter;
UNREFERENCED_PARAMETER(Instance);
UNREFERENCED_PARAMETER(Wait);
UNREFERENCED_PARAMETER(WaitResult);
(*workItem->Callback)(
workItem->DeviceObject,
workItem->Context
);
return;
}
VOID
MxWorkItem::WaitForCallbacksToComplete(
VOID
)
{
Mx::MxAssert(NULL != m_WorkItem->WaitBlock);
//
// Wait for outstanding callbacks to complete.
//
WaitForThreadpoolWaitCallbacks(m_WorkItem->WaitBlock,
FALSE // donot cancel pending waits
);
}