mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:51:37 +00:00
[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:
parent
8a978a179f
commit
1f377076d7
258 changed files with 4047 additions and 2387 deletions
|
@ -14,7 +14,7 @@ Abstract:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "MxDeviceObject.h"
|
||||
#include "mxdeviceobject.h"
|
||||
|
||||
__inline
|
||||
CCHAR
|
||||
|
@ -65,7 +65,9 @@ MxDeviceObject::GetFlags(
|
|||
VOID
|
||||
)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:28129)
|
||||
#endif
|
||||
return m_DeviceObject->Flags;
|
||||
}
|
||||
|
||||
|
@ -75,7 +77,9 @@ MxDeviceObject::SetFlags(
|
|||
ULONG Flags
|
||||
)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:28129)
|
||||
#endif
|
||||
m_DeviceObject->Flags = Flags;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ typedef DRIVER_ADD_DEVICE MdDriverAddDeviceType, *MdDriverAddDevice;
|
|||
typedef DRIVER_UNLOAD MdDriverUnloadType, *MdDriverUnload;
|
||||
typedef DRIVER_DISPATCH MdDriverDispatchType, *MdDriverDispatch;
|
||||
|
||||
#include "MxDriverObject.h"
|
||||
#include "mxdriverobject.h"
|
||||
|
||||
__inline
|
||||
PVOID
|
||||
PDRIVER_ADD_DEVICE
|
||||
MxDriverObject::GetDriverExtensionAddDevice(
|
||||
VOID
|
||||
)
|
||||
|
|
|
@ -25,7 +25,7 @@ Revision History:
|
|||
|
||||
typedef KEVENT MdEvent;
|
||||
|
||||
#include "MxEvent.h"
|
||||
#include "mxevent.h"
|
||||
|
||||
__inline
|
||||
MxEvent::MxEvent()
|
||||
|
@ -49,7 +49,9 @@ MxEvent::~MxEvent()
|
|||
|
||||
__inline
|
||||
NTSTATUS
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress:__WARNING_UNMATCHED_DECL_ANNO, "_Must_inspect_result_ not needed in kernel mode as the function always succeeds");
|
||||
#endif
|
||||
MxEvent::Initialize(
|
||||
__in EVENT_TYPE Type,
|
||||
__in BOOLEAN InitialState
|
||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "MxFileObject.h"
|
||||
#include "mxfileobject.h"
|
||||
|
||||
__inline
|
||||
PUNICODE_STRING
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef PKINTERRUPT MdInterrupt;
|
|||
typedef KSERVICE_ROUTINE MdInterruptServiceRoutineType, *MdInterruptServiceRoutine;
|
||||
typedef KSYNCHRONIZE_ROUTINE MdInterruptSynchronizeRoutineType, *MdInterruptSynchronizeRoutine;
|
||||
|
||||
#include "MxGeneral.h"
|
||||
#include "mxgeneral.h"
|
||||
#include <ntstrsafe.h>
|
||||
|
||||
__inline
|
||||
|
@ -138,7 +138,9 @@ Mx::MxBugCheckEx(
|
|||
__in ULONG_PTR BugCheckParameter4
|
||||
)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress:__WARNING_USE_OTHER_FUNCTION, "KeBugCheckEx is the intent.");
|
||||
#endif
|
||||
KeBugCheckEx(
|
||||
BugCheckCode,
|
||||
BugCheckParameter1,
|
||||
|
@ -146,6 +148,8 @@ Mx::MxBugCheckEx(
|
|||
BugCheckParameter3,
|
||||
BugCheckParameter4
|
||||
);
|
||||
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
||||
__inline
|
||||
|
@ -177,7 +181,9 @@ Mx::MxAssertMsg(
|
|||
UNREFERENCED_PARAMETER(Message);
|
||||
UNREFERENCED_PARAMETER(Condition);
|
||||
|
||||
ASSERTMSG(Message, Condition);
|
||||
ASSERT(Condition);
|
||||
|
||||
// ASSERTMSG(Message, Condition); TODO: wtf
|
||||
}
|
||||
|
||||
_Acquires_lock_(_Global_critical_region_)
|
||||
|
@ -524,6 +530,7 @@ Mx::MxCreateDeviceSecure(
|
|||
_Out_ MdDeviceObject *DeviceObject
|
||||
)
|
||||
{
|
||||
#ifndef __REACTOS__ // we don't have wdmsec.lib
|
||||
return IoCreateDeviceSecure(DriverObject,
|
||||
DeviceExtensionSize,
|
||||
DeviceName,
|
||||
|
@ -533,6 +540,16 @@ Mx::MxCreateDeviceSecure(
|
|||
DefaultSDDLString,
|
||||
DeviceClassGuid,
|
||||
DeviceObject);
|
||||
#else
|
||||
return IoCreateDevice(
|
||||
DriverObject,
|
||||
DeviceExtensionSize,
|
||||
DeviceName,
|
||||
DeviceType,
|
||||
DeviceCharacteristics,
|
||||
Exclusive,
|
||||
DeviceObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
__inline
|
||||
|
|
|
@ -26,24 +26,24 @@ Revision History:
|
|||
#pragma once
|
||||
|
||||
#include <ntddk.h>
|
||||
#include <procgrp.h>
|
||||
#include <wdmsec.h>
|
||||
// #include <procgrp.h>
|
||||
// #include <wdmsec.h>
|
||||
|
||||
#include <wmikm.h>
|
||||
#include <ntwmi.h>
|
||||
// #include <wmikm.h>
|
||||
// #include <ntwmi.h>
|
||||
|
||||
typedef KDEFERRED_ROUTINE MdDeferredRoutineType, *MdDeferredRoutine;
|
||||
typedef EXT_CALLBACK MdExtCallbackType, *MdExtCallback;
|
||||
#define FX_DEVICEMAP_PATH L"\\REGISTRY\\MACHINE\\HARDWARE\\DEVICEMAP\\"
|
||||
|
||||
#include "MxGeneralKm.h"
|
||||
#include "MxLockKm.h"
|
||||
#include "MxPagedLockKm.h"
|
||||
#include "MxEventKm.h"
|
||||
#include "MxMemoryKm.h"
|
||||
#include "MxTimerKm.h"
|
||||
#include "MxWorkItemKm.h"
|
||||
#include "MxDriverObjectKm.h"
|
||||
#include "MxDeviceObjectKm.h"
|
||||
#include "MxFileObjectKm.h"
|
||||
#include "mxgeneralkm.h"
|
||||
#include "mxlockkm.h"
|
||||
#include "mxpagedlockkm.h"
|
||||
#include "mxeventkm.h"
|
||||
#include "mxmemorykm.h"
|
||||
#include "mxtimerkm.h"
|
||||
#include "mxworkitemkm.h"
|
||||
#include "mxdriverobjectkm.h"
|
||||
#include "mxdeviceobjectkm.h"
|
||||
#include "mxfileobjectkm.h"
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "DbgMacros.h"
|
||||
#include "dbgmacros.h"
|
||||
|
||||
typedef KSPIN_LOCK MdLock;
|
||||
|
||||
#include "MxLock.h"
|
||||
#include "mxlock.h"
|
||||
|
||||
__inline
|
||||
MxLock::MxLock(
|
||||
|
|
|
@ -23,7 +23,7 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "MxMemory.h"
|
||||
#include "mxmemory.h"
|
||||
|
||||
__inline
|
||||
PVOID
|
||||
|
|
|
@ -23,11 +23,11 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "DbgMacros.h"
|
||||
#include "dbgmacros.h"
|
||||
|
||||
typedef FAST_MUTEX MdPagedLock;
|
||||
|
||||
#include "MxPagedLock.h"
|
||||
#include "mxpagedlock.h"
|
||||
|
||||
__inline
|
||||
MxPagedLock::MxPagedLock(
|
||||
|
@ -46,7 +46,9 @@ MxPagedLock::MxPagedLock(
|
|||
|
||||
__inline
|
||||
NTSTATUS
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress:__WARNING_UNMATCHED_DEFN, "_Must_inspect_result_ not needed in kernel mode as the function always succeeds");
|
||||
#endif
|
||||
MxPagedLockNoDynam::Initialize(
|
||||
)
|
||||
{
|
||||
|
|
|
@ -47,8 +47,8 @@ typedef struct _MdTimer {
|
|||
//
|
||||
BOOLEAN m_IsExtTimer;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning( disable: 4201 ) // nonstandard extension used : nameless struct/union
|
||||
// #pragma warning(push)
|
||||
// #pragma warning( disable: 4201 ) // nonstandard extension used : nameless struct/union
|
||||
|
||||
union {
|
||||
struct {
|
||||
|
@ -69,7 +69,7 @@ typedef struct _MdTimer {
|
|||
};
|
||||
};
|
||||
|
||||
#pragma warning(pop)
|
||||
// #pragma warning(pop)
|
||||
|
||||
//
|
||||
// Context to be passed in to the callback function
|
||||
|
@ -78,7 +78,7 @@ typedef struct _MdTimer {
|
|||
|
||||
} MdTimer;
|
||||
|
||||
#include "MxTimer.h"
|
||||
#include "mxtimer.h"
|
||||
|
||||
MxTimer::MxTimer(
|
||||
VOID
|
||||
|
@ -94,25 +94,28 @@ MxTimer::~MxTimer(
|
|||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN wasCancelled;
|
||||
// __REACTOS__ Ex timers are not supported
|
||||
// BOOLEAN wasCancelled;
|
||||
|
||||
if (m_Timer.m_IsExtTimer &&
|
||||
m_Timer.m_KernelExTimer) {
|
||||
wasCancelled = ExDeleteTimer(m_Timer.m_KernelExTimer,
|
||||
TRUE, // Cancel if pending. We don't expect
|
||||
// it to be pending though
|
||||
FALSE,// Wait
|
||||
NULL);
|
||||
//
|
||||
// Timer should not have been pending
|
||||
//
|
||||
ASSERT(wasCancelled == FALSE);
|
||||
m_Timer.m_KernelExTimer = NULL;
|
||||
}
|
||||
// if (m_Timer.m_IsExtTimer &&
|
||||
// m_Timer.m_KernelExTimer) {
|
||||
// wasCancelled = ExDeleteTimer(m_Timer.m_KernelExTimer,
|
||||
// TRUE, // Cancel if pending. We don't expect
|
||||
// // it to be pending though
|
||||
// FALSE,// Wait
|
||||
// NULL);
|
||||
// //
|
||||
// // Timer should not have been pending
|
||||
// //
|
||||
// ASSERT(wasCancelled == FALSE);
|
||||
// m_Timer.m_KernelExTimer = NULL;
|
||||
// }
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress:__WARNING_UNMATCHED_DECL_ANNO, "_Must_inspect_result_ not needed in kernel mode as the function always succeeds");
|
||||
#endif
|
||||
MxTimer::Initialize(
|
||||
__in_opt PVOID TimerContext,
|
||||
__in MdDeferredRoutine TimerCallback,
|
||||
|
@ -166,37 +169,38 @@ Returns:
|
|||
--*/
|
||||
|
||||
{
|
||||
NTSTATUS status;
|
||||
ULONG attributes = 0;
|
||||
// NTSTATUS status;
|
||||
// ULONG attributes = 0;
|
||||
|
||||
m_Timer.m_TimerContext = TimerContext;
|
||||
m_Timer.m_ExTimerCallback = TimerCallback;
|
||||
m_Timer.m_Period = Period;
|
||||
// m_Timer.m_TimerContext = TimerContext;
|
||||
// m_Timer.m_ExTimerCallback = TimerCallback;
|
||||
// m_Timer.m_Period = Period;
|
||||
|
||||
if (TolerableDelay != 0) {
|
||||
// if (TolerableDelay != 0) {
|
||||
|
||||
attributes |= EX_TIMER_NO_WAKE;
|
||||
// attributes |= EX_TIMER_NO_WAKE;
|
||||
|
||||
} else if (UseHighResolutionTimer) {
|
||||
// } else if (UseHighResolutionTimer) {
|
||||
|
||||
attributes |= EX_TIMER_HIGH_RESOLUTION;
|
||||
}
|
||||
// attributes |= EX_TIMER_HIGH_RESOLUTION;
|
||||
// }
|
||||
|
||||
m_Timer.m_KernelExTimer = ExAllocateTimer(m_Timer.m_ExTimerCallback,
|
||||
TimerContext,
|
||||
attributes);
|
||||
if (m_Timer.m_KernelExTimer) {
|
||||
// m_Timer.m_KernelExTimer = ExAllocateTimer(m_Timer.m_ExTimerCallback,
|
||||
// TimerContext,
|
||||
// attributes);
|
||||
// if (m_Timer.m_KernelExTimer) {
|
||||
|
||||
status = STATUS_SUCCESS;
|
||||
// status = STATUS_SUCCESS;
|
||||
|
||||
} else {
|
||||
// } else {
|
||||
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
// status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
// }
|
||||
|
||||
m_Timer.m_IsExtTimer = TRUE;
|
||||
// m_Timer.m_IsExtTimer = TRUE;
|
||||
|
||||
return status;
|
||||
// return status;
|
||||
return STATUS_NOT_IMPLEMENTED; // __REACTOS__ Ex timers are not supported
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,29 +212,29 @@ MxTimer::StartWithReturn(
|
|||
)
|
||||
{
|
||||
if (m_Timer.m_IsExtTimer) {
|
||||
// __REACTOS__ Ex timers are not supported
|
||||
// EXT_SET_PARAMETERS parameters;
|
||||
|
||||
EXT_SET_PARAMETERS parameters;
|
||||
// ExInitializeSetTimerParameters(¶meters);
|
||||
|
||||
ExInitializeSetTimerParameters(¶meters);
|
||||
|
||||
//
|
||||
// We get the delay in ms but the underlying API needs it in 100 ns
|
||||
// units. Convert tolerable delay from ms to 100 ns. However,
|
||||
// MAXULONG (TolerableDelayUnlimited) has a special meaning that the
|
||||
// system should never be woken up, so we assign the corresponding
|
||||
// special value for Ex timers
|
||||
//
|
||||
if (TolerableDelay == TolerableDelayUnlimited) {
|
||||
parameters.NoWakeTolerance = EX_TIMER_UNLIMITED_TOLERANCE;
|
||||
} else {
|
||||
parameters.NoWakeTolerance = ((LONGLONG) TolerableDelay) * 10 * 1000;
|
||||
}
|
||||
|
||||
return ExSetTimer(m_Timer.m_KernelExTimer,
|
||||
DueTime.QuadPart,
|
||||
(((LONGLONG) m_Timer.m_Period) * 10 * 1000),
|
||||
¶meters);
|
||||
// //
|
||||
// // We get the delay in ms but the underlying API needs it in 100 ns
|
||||
// // units. Convert tolerable delay from ms to 100 ns. However,
|
||||
// // MAXULONG (TolerableDelayUnlimited) has a special meaning that the
|
||||
// // system should never be woken up, so we assign the corresponding
|
||||
// // special value for Ex timers
|
||||
// //
|
||||
// if (TolerableDelay == TolerableDelayUnlimited) {
|
||||
// parameters.NoWakeTolerance = EX_TIMER_UNLIMITED_TOLERANCE;
|
||||
// } else {
|
||||
// parameters.NoWakeTolerance = ((LONGLONG) TolerableDelay) * 10 * 1000;
|
||||
// }
|
||||
|
||||
// return ExSetTimer(m_Timer.m_KernelExTimer,
|
||||
// DueTime.QuadPart,
|
||||
// (((LONGLONG) m_Timer.m_Period) * 10 * 1000),
|
||||
// ¶meters);
|
||||
return FALSE;
|
||||
} else {
|
||||
|
||||
return KeSetCoalescableTimer(&(m_Timer.KernelTimer),
|
||||
|
@ -273,7 +277,8 @@ MxTimer::Stop(
|
|||
BOOLEAN bRetVal;
|
||||
|
||||
if (m_Timer.m_IsExtTimer) {
|
||||
bRetVal = ExCancelTimer(m_Timer.m_KernelExTimer, NULL);
|
||||
bRetVal = FALSE;
|
||||
// bRetVal = ExCancelTimer(m_Timer.m_KernelExTimer, NULL); // __REACTOS__ Ex timers are not supported
|
||||
|
||||
} else {
|
||||
bRetVal = KeCancelTimer(&(m_Timer.KernelTimer));
|
||||
|
|
|
@ -26,7 +26,7 @@ Revision History:
|
|||
typedef IO_WORKITEM_ROUTINE MX_WORKITEM_ROUTINE, *PMX_WORKITEM_ROUTINE;
|
||||
typedef PIO_WORKITEM MdWorkItem;
|
||||
|
||||
#include "MxWorkItem.h"
|
||||
#include "mxworkitem.h"
|
||||
|
||||
__inline
|
||||
MxWorkItem::MxWorkItem(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue