[WDF] Fix KMDF so it can compile with ReactOS SDK

Not all files are included, but these are necessary to compile cdrom driver.
So far it can only be statically linked with drivers, a proper
implementation requires wdfldr helper driver
This commit is contained in:
Victor Perevertkin 2020-10-16 06:30:51 +03:00
parent 8a978a179f
commit 1f377076d7
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
258 changed files with 4047 additions and 2387 deletions

View file

@ -21,7 +21,7 @@ Revision History:
--*/
#include "..\FxTargetsShared.hpp"
#include "../fxtargetsshared.hpp"
extern "C" {
#if defined(EVENT_TRACING)
@ -308,12 +308,10 @@ FxIoTarget::GotoStartState(
__in BOOLEAN Lock
)
{
FxRequestBase* pRequest;
NTSTATUS status;
KIRQL irql;
irql = PASSIVE_LEVEL;
pRequest = NULL;
ADDREF(START_TAG);
@ -1110,7 +1108,7 @@ FxIoTarget::QueryInterface(
*Params->Object = (FxIoTarget*) this;
break;
default:
return __super::QueryInterface(Params);
return FxNonPagedObject::QueryInterface(Params); // __super call
}
return STATUS_SUCCESS;

View file

@ -20,10 +20,10 @@ Revision History:
--*/
#include "..\FxTargetsShared.hpp"
#include "../fxtargetsshared.hpp"
extern "C" {
#include "FxIoTargetAPI.tmh"
// #include "FxIoTargetAPI.tmh"
}
//
@ -34,6 +34,7 @@ extern "C" {
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetStart)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -69,6 +70,7 @@ Return Value:
__drv_when(Action == 3, __drv_maxIRQL(DISPATCH_LEVEL))
__drv_when(Action == 0 || Action == 1 || Action == 2, __drv_maxIRQL(PASSIVE_LEVEL))
VOID
STDCALL
WDFEXPORT(WdfIoTargetStop)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -128,6 +130,7 @@ Return Value:
__drv_when(Action == 2, __drv_maxIRQL(DISPATCH_LEVEL))
__drv_when(Action == 0 || Action == 1, __drv_maxIRQL(PASSIVE_LEVEL))
VOID
STDCALL
WDFEXPORT(WdfIoTargetPurge)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -185,6 +188,7 @@ Return Value:
__drv_maxIRQL(DISPATCH_LEVEL)
WDF_IO_TARGET_STATE
STDCALL
WDFEXPORT(WdfIoTargetGetState)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -364,6 +368,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetCreate)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -437,6 +442,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetOpen)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -543,6 +549,7 @@ Return Value:
__drv_maxIRQL(PASSIVE_LEVEL)
VOID
STDCALL
WDFEXPORT(WdfIoTargetCloseForQueryRemove)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -591,6 +598,7 @@ Return Value:
__drv_maxIRQL(PASSIVE_LEVEL)
VOID
STDCALL
WDFEXPORT(WdfIoTargetClose)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -636,6 +644,7 @@ Return Value:
__drv_maxIRQL(DISPATCH_LEVEL)
WDFDEVICE
STDCALL
WDFEXPORT(WdfIoTargetGetDevice)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -943,6 +952,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSendReadSynchronously)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -975,6 +985,7 @@ WDFEXPORT(WdfIoTargetSendReadSynchronously)(
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetFormatRequestForRead)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1005,6 +1016,7 @@ WDFEXPORT(WdfIoTargetFormatRequestForRead)(
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSendWriteSynchronously)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1037,6 +1049,7 @@ WDFEXPORT(WdfIoTargetSendWriteSynchronously)(
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetFormatRequestForWrite)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1386,6 +1399,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSendIoctlSynchronously)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1423,6 +1437,7 @@ WDFEXPORT(WdfIoTargetSendIoctlSynchronously)(
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetFormatRequestForIoctl)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1458,6 +1473,7 @@ WDFEXPORT(WdfIoTargetFormatRequestForIoctl)(
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSendInternalIoctlSynchronously)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1495,6 +1511,7 @@ WDFEXPORT(WdfIoTargetSendInternalIoctlSynchronously)(
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetFormatRequestForInternalIoctl)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1530,6 +1547,7 @@ WDFEXPORT(WdfIoTargetFormatRequestForInternalIoctl)(
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSendInternalIoctlOthersSynchronously)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1708,6 +1726,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetFormatRequestForInternalIoctlOthers)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1847,6 +1866,7 @@ Return Value:
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetSelfAssignDefaultIoQueue)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -1964,6 +1984,7 @@ Returns:
__drv_maxIRQL(DISPATCH_LEVEL)
HANDLE
STDCALL
WDFEXPORT(WdfIoTargetWdmGetTargetFileHandle)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,

View file

@ -18,10 +18,10 @@ Revision History:
--*/
#include "..\FxTargetsShared.hpp"
#include "../fxtargetsshared.hpp"
extern "C" {
#include "FxIoTargetRemote.tmh"
// #include "FxIoTargetRemote.tmh"
}
#include <initguid.h>
@ -55,7 +55,7 @@ FxIoTargetRemote::FxIoTargetRemote(
#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
m_TargetNotifyHandle = NULL;
#else (FX_CORE_MODE == FX_CORE_USER_MODE)
#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
m_TargetNotifyHandle = WUDF_TARGET_CONTEXT_INVALID;
m_pIoDispatcher = NULL;
@ -173,7 +173,7 @@ FxIoTargetRemote::InitRemote(
//
// do the base class mode-specific initialization
//
status = __super::InitModeSpecific(Device);
status = FxIoTarget::InitModeSpecific(Device); // __super call
if (!NT_SUCCESS(status)) {
return status;
}
@ -757,7 +757,7 @@ FxIoTargetRemote::ClearTargetPointers(
// canceled or completing. When we receive either of those notifications,
// m_TargetNotifyHandle will be freed then.
//
__super::ClearTargetPointers();
FxIoTarget::ClearTargetPointers(); // __super call
}
VOID

View file

@ -24,7 +24,7 @@ Revision History:
--*/
#include "..\FxTargetsShared.hpp"
#include "../fxtargetsshared.hpp"
extern "C" {
#if defined(EVENT_TRACING)

View file

@ -20,10 +20,10 @@ Revision History:
--*/
#include "..\..\FxTargetsShared.hpp"
#include "../../fxtargetsshared.hpp"
extern "C" {
#include "FxIoTargetAPIKm.tmh"
// #include "FxIoTargetAPIKm.tmh"
}
//
@ -33,6 +33,7 @@ extern "C" {
__drv_maxIRQL(DISPATCH_LEVEL)
PDEVICE_OBJECT
STDCALL
WDFEXPORT(WdfIoTargetWdmGetTargetDeviceObject)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -76,6 +77,7 @@ Return Value:
__drv_maxIRQL(DISPATCH_LEVEL)
PDEVICE_OBJECT
STDCALL
WDFEXPORT(WdfIoTargetWdmGetTargetPhysicalDevice)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -121,6 +123,7 @@ Return Value:
__drv_maxIRQL(DISPATCH_LEVEL)
PFILE_OBJECT
STDCALL
WDFEXPORT(WdfIoTargetWdmGetTargetFileObject)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -165,6 +168,7 @@ Return Value:
__drv_maxIRQL(PASSIVE_LEVEL)
_Must_inspect_result_
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetQueryForInterface)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -242,6 +246,7 @@ Return Value:
_Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetQueryTargetProperty)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
@ -254,7 +259,7 @@ WDFEXPORT(WdfIoTargetQueryTargetProperty)(
__drv_when(BufferLength != 0, __out_bcount_part_opt(BufferLength, *ResultLength))
__drv_when(BufferLength == 0, __out_opt)
PVOID PropertyBuffer,
__deref_out_range(<=,BufferLength)
__deref_out_range(<=,BufferLength)
PULONG ResultLength
)
/*++
@ -333,6 +338,7 @@ _Must_inspect_result_
__drv_maxIRQL(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
STDCALL
WDFEXPORT(WdfIoTargetAllocAndQueryTargetProperty)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,

View file

@ -21,7 +21,7 @@ Revision History:
--*/
#include "..\..\FxTargetsShared.hpp"
#include "../../fxtargetsshared.hpp"
extern "C" {
#if defined(EVENT_TRACING)

View file

@ -18,10 +18,10 @@ Revision History:
--*/
#include "..\..\FxTargetsShared.hpp"
#include "../../fxtargetsshared.hpp"
extern "C" {
#include "FxIoTargetRemoteKm.tmh"
// #include "FxIoTargetRemoteKm.tmh"
}
#include <initguid.h>
@ -48,7 +48,7 @@ FxIoTargetRemote::_PlugPlayNotification(
// If that is the case, we need to be able to return and deref the object until
// we are done.
//
pThis->ADDREF(_PlugPlayNotification);
pThis->ADDREF((PVOID)_PlugPlayNotification);
pFxDriverGlobals = pThis->GetDriverGlobals();
@ -133,7 +133,7 @@ FxIoTargetRemote::_PlugPlayNotification(
}
}
pThis->RELEASE(_PlugPlayNotification);
pThis->RELEASE((PVOID)_PlugPlayNotification);
return status;
}