|
|
/*
Copyright (c) 1990-1996 Microsoft Corporation
Module Name:
cmddk.h
Abstract:
This module defines the structures, macros, and functions missing from ndis.h when you specify BINARY_COMPATIBLE=1 but do not include ntddk.h
Revision History:
Who When What -------- -------- ---------------------------------------------- alid 10-14-96 Created
--*/
#ifndef _CMDDK_INCLUDED_
#define _CMDDK_INCLUDED_
//
// needed by cxport.h taken from ntddk.h
//
typedef VOID (*PWORKER_THREAD_ROUTINE)( IN PVOID Parameter ); typedef struct _WORK_QUEUE_ITEM { LIST_ENTRY List; PWORKER_THREAD_ROUTINE WorkerRoutine; PVOID Parameter; } WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
NTKERNELAPI BOOLEAN KeCancelTimer ( IN PKTIMER );
//
// Spin Lock
//
// typedef ULONG KSPIN_LOCK; // winnt ntndis
// typedef KSPIN_LOCK *PKSPIN_LOCK;
#define ExInterlockedPopEntryList ExfInterlockedPopEntryList
#define ExInterlockedPushEntryList ExfInterlockedPushEntryList
NTKERNELAPI PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPopEntryList ( IN PSINGLE_LIST_ENTRY ListHead, IN PKSPIN_LOCK Lock );
NTKERNELAPI PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPushEntryList ( IN PSINGLE_LIST_ENTRY ListHead, IN PSINGLE_LIST_ENTRY ListEntry, IN PKSPIN_LOCK Lock );
NTKERNELAPI VOID NTAPI KeInitializeSpinLock ( IN PKSPIN_LOCK SpinLock );
#if defined(_X86_)
NTKERNELAPI VOID FASTCALL KefAcquireSpinLockAtDpcLevel ( IN PKSPIN_LOCK SpinLock );
NTKERNELAPI VOID FASTCALL KefReleaseSpinLockFromDpcLevel ( IN PKSPIN_LOCK SpinLock );
#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a)
#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a)
#else
NTKERNELAPI VOID KeAcquireSpinLockAtDpcLevel ( IN PKSPIN_LOCK SpinLock );
NTKERNELAPI VOID KeReleaseSpinLockFromDpcLevel ( IN PKSPIN_LOCK SpinLock );
#endif
#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || (defined(_X86_) && !defined(_NTHAL_))
// begin_wdm
#if defined(_X86_)
__declspec(dllimport) KIRQL FASTCALL KfAcquireSpinLock ( IN PKSPIN_LOCK SpinLock );
__declspec(dllimport) VOID FASTCALL KfReleaseSpinLock ( IN PKSPIN_LOCK SpinLock, IN KIRQL NewIrql );
__declspec(dllimport) KIRQL FASTCALL KeAcquireSpinLockRaiseToSynch ( IN PKSPIN_LOCK SpinLock );
#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
#else
__declspec(dllimport) KIRQL KeAcquireSpinLockRaiseToDpc ( IN PKSPIN_LOCK SpinLock );
#define KeAcquireSpinLock(SpinLock, OldIrql) \
*(OldIrql) = KeAcquireSpinLockRaiseToDpc(SpinLock)
__declspec(dllimport) VOID KeReleaseSpinLock ( IN PKSPIN_LOCK SpinLock, IN KIRQL NewIrql );
#endif
// end_wdm
#else
#if defined(_X86_)
KIRQL FASTCALL KfAcquireSpinLock ( IN PKSPIN_LOCK SpinLock );
VOID FASTCALL KfReleaseSpinLock ( IN PKSPIN_LOCK SpinLock, IN KIRQL NewIrql );
#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
KIRQL FASTCALL KeAcquireSpinLockRaiseToSynch ( IN PKSPIN_LOCK SpinLock );
#else
KIRQL KeAcquireSpinLockRaiseToDpc ( IN PKSPIN_LOCK SpinLock );
KIRQL KeAcquireSpinLockRaiseToSynch ( IN PKSPIN_LOCK SpinLock );
#define KeAcquireSpinLock(SpinLock, OldIrql) \
*(OldIrql) = KeAcquireSpinLockRaiseToDpc(SpinLock)
VOID KeReleaseSpinLock ( IN PKSPIN_LOCK SpinLock, IN KIRQL NewIrql );
#endif
#endif
#if defined(NT_UP) && !DBG && !defined(_NTDDK_) && !defined(_NTIFS_)
#if !defined(_NTDRIVER_)
#define ExAcquireSpinLock(Lock, OldIrql) (*OldIrql) = KeRaiseIrqlToDpcLevel();
#define ExReleaseSpinLock(Lock, OldIrql) KeLowerIrql((OldIrql))
#else
#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))
#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))
#endif
#define ExAcquireSpinLockAtDpcLevel(Lock)
#define ExReleaseSpinLockFromDpcLevel(Lock)
#else
// begin_wdm
#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))
#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))
#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock)
#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock)
// end_wdm
#endif
NTKERNELAPI KIRQL KfRaiseIrqlToDpcLevel ( VOID );
#define KeRaiseIrqlToDpcLevel(OldIrql) (*(OldIrql) = KfRaiseIrqlToDpcLevel())
NTKERNELAPI KIRQL KeRaiseIrqlToSynchLevel ( VOID );
// end_nthal end_wdm
#if defined(NT_UP) && !defined(_NTDDK_) && !defined(_NTIFS_)
#define ExAcquireSpinLock(Lock, OldIrql) KeRaiseIrqlToDpcLevel((OldIrql))
#define ExReleaseSpinLock(Lock, OldIrql) KeLowerIrql((OldIrql))
#define ExAcquireSpinLockAtDpcLevel(Lock)
#define ExReleaseSpinLockFromDpcLevel(Lock)
#else
// begin_wdm
#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))
#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))
#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock)
#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock)
// end_wdm
#endif
//
// Event type
//
typedef enum _EVENT_TYPE { NotificationEvent, SynchronizationEvent } EVENT_TYPE;
#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_)
// begin_wdm
NTKERNELAPI VOID KeInitializeEvent ( IN PRKEVENT Event, IN EVENT_TYPE Type, IN BOOLEAN State );
NTKERNELAPI VOID KeClearEvent ( IN PRKEVENT Event );
// end_wdm
#else
#define KeInitializeEvent(_Event, _Type, _State) \
(_Event)->Header.Type = (UCHAR)_Type; \ (_Event)->Header.Size = sizeof(KEVENT) / sizeof(LONG); \ (_Event)->Header.SignalState = _State; \ InitializeListHead(&(_Event)->Header.WaitListHead)
#define KeClearEvent(Event) (Event)->Header.SignalState = 0
#endif
LONG FASTCALL InterlockedIncrement( IN PLONG Addend );
#ifndef ATMARP_WIN98
NTSYSAPI ULONG NTAPI RtlCompareMemory ( PVOID Source1, PVOID Source2, ULONG Length ); #endif
NTKERNELAPI PVOID ExAllocatePool( IN POOL_TYPE PoolType, IN ULONG NumberOfBytes );
NTKERNELAPI VOID NTAPI ExFreePool( IN PVOID P );
#endif // _CMDDK_INCLUDED_
|