[HAL] Define _NTHALDLL_ for WDK header compatibility, get rif of DECLSPEC_IMPORT header hack
[NDK/RTL] Fix some Rtl prototypes (PCHAR -> PCCH)
[NDK] Fix ZwOpenEvent prototype
[NTIFS] Fix definition of NTKERNELAPI, move some types, fix PRTL_ALLOCATE_STRING_ROUTINE, PRTL_REALLOCATE_STRING_ROUTINE, PRTL_FREE_STRING_ROUTINE, define CTL_CODE, DEVICE_TYPE_FROM_CTL_CODE, FILE_ANY_ACCESS, FILE_SPECIAL_ACCESS, FILE_READ_ACCESS, FILE_WRITE_ACCESS identical to wdm.h, remove duplicate RtlGenerate8dot3Name, remove ZwOpenEvent
[NTPOAPI] Guard some types with #ifndef _PO_DDK_
[WDM] Create reactos compatible definition of NTKERNELAPI, add KDPC_WATCHDOG_INFORMATION, BATTERY_REPORTING_SCALE, fix ALIGN_UP_POINTER_BY, guard some types with #ifndef _PO_DDK_, update POWER_INFORMATION_LEVEL, make some FILE_DEVICE_ definitions identical to ntifs.h, fix HalAllocateCommonBuffer
svn path=/branches/header-work/; revision=46050
<include base="ntoskrnl">include</include>
<include base="ReactOS">include/reactos/libs</include>
<include base="ReactOS">include/reactos/elf</include>
+ <define name="_BLDR_" />
<define name="_NTHAL_" />
<define name="_NTSYSTEM_" />
<directory name="arch">
<include base="freeldr_base">cache</include>
<include base="cmlib">.</include>
<include base="ntoskrnl">include</include>
+ <define name="_BLDR_" />
<define name="_NTHAL_" />
<define name="_NTSYSTEM_" />
<directory name="arcemul">
<bootstrap installbase="$(CDOUTPUT)" />
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<library>hal_generic</library>
<library>hal_generic_up</library>
<module name="hal_generic" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<directory name="generic">
<directory name="bus">
<module name="mini_hal" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
- <define name="_NTSYSTEM_" />
+ <define name="_BLDR_" />
<define name="_MINIHAL_" />
<directory name="generic">
<directory name="bus">
<module name="hal_generic_mp" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<define name="CONFIG_SMP" />
<directory name="mp">
<module name="hal_generic_up" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<directory name="generic">
<file>pic.c</file>
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="CONFIG_SMP" />
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<library>hal_generic</library>
<library>hal_generic_mp</library>
<importlibrary base="hal" definition="../hal.pspec" />
<include>include</include>
<include base="ntoskrnl">include</include>
+ <define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<define name="SARCH_XBOX" />
<library>hal_generic</library>
/* WDK HAL Compilation hack */
#include <excpt.h>
#include <ntdef.h>
-#undef _NTHAL_
-#undef DECLSPEC_IMPORT
-#define DECLSPEC_IMPORT
#ifndef _MINIHAL_
#undef NTSYSAPI
#define NTSYSAPI __declspec(dllimport)
#else
-#undef _NTSYSTEM_
+#undef NTSYSAPI
+#define NTSYSAPI
#endif
/* IFS/DDK/NDK Headers */
#define NTHALAPI
#endif
-#if !defined(_NTOSKRNL_) /* For ReactOS */
+/* For ReactOS */
+#if !defined(_NTOSKRNL_) && !defined(_BLDR_)
#define NTKERNELAPI DECLSPEC_IMPORT
#else
#define NTKERNELAPI
IN PCWCH UnicodeString,
IN ULONG BytesInUnicodeString);
+typedef struct _GENERATE_NAME_CONTEXT {
+ USHORT Checksum;
+ BOOLEAN CheckSumInserted;
+ UCHAR NameLength;
+ WCHAR NameBuffer[8];
+ ULONG ExtensionLength;
+ WCHAR ExtensionBuffer[4];
+ ULONG LastIndexValue;
+} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
+
#if (NTDDI_VERSION >= NTDDI_VISTASP1)
NTSYSAPI
NTSTATUS
RtlIsValidOemCharacter(
IN OUT PWCHAR Char);
+typedef struct _RTL_SPLAY_LINKS {
+ struct _RTL_SPLAY_LINKS *Parent;
+ struct _RTL_SPLAY_LINKS *LeftChild;
+ struct _RTL_SPLAY_LINKS *RightChild;
+} RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
+
+typedef struct _PREFIX_TABLE_ENTRY {
+ CSHORT NodeTypeCode;
+ CSHORT NameLength;
+ struct _PREFIX_TABLE_ENTRY *NextPrefixTree;
+ RTL_SPLAY_LINKS Links;
+ PSTRING Prefix;
+} PREFIX_TABLE_ENTRY, *PPREFIX_TABLE_ENTRY;
+
+typedef struct _PREFIX_TABLE {
+ CSHORT NodeTypeCode;
+ CSHORT NameLength;
+ PPREFIX_TABLE_ENTRY NextPrefixTree;
+} PREFIX_TABLE, *PPREFIX_TABLE;
+
NTSYSAPI
VOID
NTAPI
IN PPREFIX_TABLE PrefixTable,
IN PSTRING FullName);
+typedef struct _UNICODE_PREFIX_TABLE_ENTRY {
+ CSHORT NodeTypeCode;
+ CSHORT NameLength;
+ struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
+ struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
+ RTL_SPLAY_LINKS Links;
+ PUNICODE_STRING Prefix;
+} UNICODE_PREFIX_TABLE_ENTRY, *PUNICODE_PREFIX_TABLE_ENTRY;
+
+typedef struct _UNICODE_PREFIX_TABLE {
+ CSHORT NodeTypeCode;
+ CSHORT NameLength;
+ PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
+ PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
+} UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
+
NTSYSAPI
VOID
NTAPI
OUT PUCHAR *ChunkBuffer,
IN ULONG ChunkSize);
+typedef struct _COMPRESSED_DATA_INFO {
+ USHORT CompressionFormatAndEngine;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved;
+ USHORT NumberOfChunks;
+ ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
+} COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
+
NTSYSAPI
NTSTATUS
NTAPI
IN ULONG TagBase,
IN ULONG Tag)
{
- __assume_bound(TagBase);
+ //__assume_bound(TagBase); // FIXME
return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT)));
}
)
typedef PVOID
-(NTAPI *PRTL_ALLOCATE_STRING_ROUTINE (
+(NTAPI *PRTL_ALLOCATE_STRING_ROUTINE)(
IN SIZE_T NumberOfBytes);
#if _WIN32_WINNT >= 0x0600
typedef PVOID
-(NTAPI *PRTL_REALLOCATE_STRING_ROUTINE (
+(NTAPI *PRTL_REALLOCATE_STRING_ROUTINE)(
IN SIZE_T NumberOfBytes,
IN PVOID Buffer);
#endif
typedef VOID
-(NTAPI *PRTL_FREE_STRING_ROUTINE (
+(NTAPI *PRTL_FREE_STRING_ROUTINE)(
IN PVOID Buffer);
extern const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine;
extern const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine;
#endif
-typedef struct _GENERATE_NAME_CONTEXT {
- USHORT Checksum;
- BOOLEAN CheckSumInserted;
- UCHAR NameLength;
- WCHAR NameBuffer[8];
- ULONG ExtensionLength;
- WCHAR ExtensionBuffer[4];
- ULONG LastIndexValue;
-} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
-
-typedef struct _PREFIX_TABLE_ENTRY {
- CSHORT NodeTypeCode;
- CSHORT NameLength;
- struct _PREFIX_TABLE_ENTRY *NextPrefixTree;
- RTL_SPLAY_LINKS Links;
- PSTRING Prefix;
-} PREFIX_TABLE_ENTRY, *PPREFIX_TABLE_ENTRY;
-
-typedef struct _PREFIX_TABLE {
- CSHORT NodeTypeCode;
- CSHORT NameLength;
- PPREFIX_TABLE_ENTRY NextPrefixTree;
-} PREFIX_TABLE, *PPREFIX_TABLE;
-
-typedef struct _UNICODE_PREFIX_TABLE_ENTRY {
- CSHORT NodeTypeCode;
- CSHORT NameLength;
- struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
- struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
- RTL_SPLAY_LINKS Links;
- PUNICODE_STRING Prefix;
-} UNICODE_PREFIX_TABLE_ENTRY, *PUNICODE_PREFIX_TABLE_ENTRY;
-
-typedef struct _UNICODE_PREFIX_TABLE {
- CSHORT NodeTypeCode;
- CSHORT NameLength;
- PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
- PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
-} UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
-
#define COMPRESSION_FORMAT_NONE (0x0000)
#define COMPRESSION_FORMAT_DEFAULT (0x0001)
#define COMPRESSION_FORMAT_LZNT1 (0x0002)
#define COMPRESSION_ENGINE_MAXIMUM (0x0100)
#define COMPRESSION_ENGINE_HIBER (0x0200)
-typedef struct _COMPRESSED_DATA_INFO {
- USHORT CompressionFormatAndEngine;
- UCHAR CompressionUnitShift;
- UCHAR ChunkShift;
- UCHAR ClusterShift;
- UCHAR Reserved;
- USHORT NumberOfChunks;
- ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
-} COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
-
#define RtlOffsetToPointer(B,O) ((PCHAR)( ((PCHAR)(B)) + ((ULONG_PTR)(O)) ))
#define RtlPointerToOffset(B,P) ((ULONG)( ((PCHAR)(P)) - ((PCHAR)(B)) ))
#define FILE_DEVICE_BIOMETRIC 0x00000044
#define FILE_DEVICE_PMI 0x00000045
-#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
- ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
-)
-#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0xffff0000)) >> 16)
+#define CTL_CODE(DeviceType, Function, Method, Access) \
+ (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
+
+#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
+
#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
#define METHOD_BUFFERED 0
#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
-#define FILE_ANY_ACCESS 0
-#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS)
-#define FILE_READ_ACCESS ( 0x0001 )
-#define FILE_WRITE_ACCESS ( 0x0002 )
+#define FILE_ANY_ACCESS 0x00000000
+#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
+#define FILE_READ_ACCESS 0x00000001
+#define FILE_WRITE_ACCESS 0x00000002
typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
ULONG LengthAccepted;
} QUERY_PATH_RESPONSE, *PQUERY_PATH_RESPONSE;
-typedef struct _RTL_SPLAY_LINKS {
- struct _RTL_SPLAY_LINKS *Parent;
- struct _RTL_SPLAY_LINKS *LeftChild;
- struct _RTL_SPLAY_LINKS *RightChild;
-} RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
-
typedef struct _RTL_BALANCED_LINKS
{
struct _RTL_BALANCED_LINKS *Parent;
VOID
);
-NTSYSAPI
-VOID
-NTAPI
-RtlGenerate8dot3Name (
- IN PUNICODE_STRING Name,
- IN BOOLEAN AllowExtendedCharacters,
- IN OUT PGENERATE_NAME_CONTEXT Context,
- OUT PUNICODE_STRING Name8dot3
-);
-
NTSYSAPI
VOID
NTAPI
IN POBJECT_ATTRIBUTES ObjectAttributes
);
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwOpenEvent (
- OUT PHANDLE EventHandle,
- IN ACCESS_MASK DesiredAccess,
- IN POBJECT_ATTRIBUTES ObjectAttributes
-);
-
NTSYSAPI
NTSTATUS
NTAPI
extern "C" {
#endif
-#define POWER_PERF_SCALE 100
-#define PERF_LEVEL_TO_PERCENT(x) (((x) * 1000) / (POWER_PERF_SCALE * 10))
-#define PERCENT_TO_PERF_LEVEL(x) (((x) * POWER_PERF_SCALE * 10) / 1000)
+#ifndef _PO_DDK_
+#define _PO_DDK_
+/* Power States/Levels */
+typedef enum _SYSTEM_POWER_STATE {
+ PowerSystemUnspecified,
+ PowerSystemWorking,
+ PowerSystemSleeping1,
+ PowerSystemSleeping2,
+ PowerSystemSleeping3,
+ PowerSystemHibernate,
+ PowerSystemShutdown,
+ PowerSystemMaximum
+} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
+#define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
+
+typedef enum _DEVICE_POWER_STATE {
+ PowerDeviceUnspecified,
+ PowerDeviceD0,
+ PowerDeviceD1,
+ PowerDeviceD2,
+ PowerDeviceD3,
+ PowerDeviceMaximum
+} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
+
+typedef union _POWER_STATE {
+ SYSTEM_POWER_STATE SystemState;
+ DEVICE_POWER_STATE DeviceState;
+} POWER_STATE, *PPOWER_STATE;
+
+typedef enum _POWER_STATE_TYPE {
+ SystemPowerState = 0,
+ DevicePowerState
+} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
+
+typedef enum _POWER_INFORMATION_LEVEL {
+ SystemPowerPolicyAc,
+ SystemPowerPolicyDc,
+ VerifySystemPolicyAc,
+ VerifySystemPolicyDc,
+ SystemPowerCapabilities,
+ SystemBatteryState,
+ SystemPowerStateHandler,
+ ProcessorStateHandler,
+ SystemPowerPolicyCurrent,
+ AdministratorPowerPolicy,
+ SystemReserveHiberFile,
+ ProcessorInformation,
+ SystemPowerInformation,
+ ProcessorStateHandler2,
+ LastWakeTime,
+ LastSleepTime,
+ SystemExecutionState,
+ SystemPowerStateNotifyHandler,
+ ProcessorPowerPolicyAc,
+ ProcessorPowerPolicyDc,
+ VerifyProcessorPowerPolicyAc,
+ VerifyProcessorPowerPolicyDc,
+ ProcessorPowerPolicyCurrent,
+ SystemPowerStateLogging,
+ SystemPowerLoggingEntry,
+ SetPowerSettingValue,
+ NotifyUserPowerSetting,
+ PowerInformationLevelUnused0,
+ PowerInformationLevelUnused1,
+ SystemVideoState,
+ TraceApplicationPowerMessage,
+ TraceApplicationPowerMessageEnd,
+ ProcessorPerfStates,
+ ProcessorIdleStates,
+ ProcessorCap,
+ SystemWakeSource,
+ SystemHiberFileInformation,
+ TraceServicePowerMessage,
+ ProcessorLoad,
+ PowerShutdownNotification,
+ MonitorCapabilities,
+ SessionPowerInit,
+ SessionDisplayState,
+ PowerRequestCreate,
+ PowerRequestAction,
+ GetPowerRequestList,
+ ProcessorInformationEx,
+ NotifyUserModeLegacyPowerEvent,
+ GroupPark,
+ ProcessorIdleDomains,
+ WakeTimerList,
+ SystemHiberFileSize,
+ PowerInformationLevelMaximum
+} POWER_INFORMATION_LEVEL;
+
+typedef enum {
+ PowerActionNone,
+ PowerActionReserved,
+ PowerActionSleep,
+ PowerActionHibernate,
+ PowerActionShutdown,
+ PowerActionShutdownReset,
+ PowerActionShutdownOff,
+ PowerActionWarmEject
+} POWER_ACTION, *PPOWER_ACTION;
+
+#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_)
typedef struct {
- ULONG Granularity;
- ULONG Capacity;
+ ULONG Granularity;
+ ULONG Capacity;
} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
+#endif /* (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) */
+
+
+#endif /* _PO_DDK_ */
+
+#define POWER_PERF_SCALE 100
+#define PERF_LEVEL_TO_PERCENT(x) (((x) * 1000) / (POWER_PERF_SCALE * 10))
+#define PERCENT_TO_PERF_LEVEL(x) (((x) * POWER_PERF_SCALE * 10) / 1000)
typedef struct _PROCESSOR_IDLE_TIMES {
ULONGLONG StartTime;
PROCESSOR_PERF_LEVEL PerfLevel[1];
} PROCESSOR_STATE_HANDLER2, *PPROCESSOR_STATE_HANDLER2;
-/* Power States/Levels */
-typedef enum _SYSTEM_POWER_STATE {
- PowerSystemUnspecified,
- PowerSystemWorking,
- PowerSystemSleeping1,
- PowerSystemSleeping2,
- PowerSystemSleeping3,
- PowerSystemHibernate,
- PowerSystemShutdown,
- PowerSystemMaximum
-} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
-#define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
-
-typedef enum _DEVICE_POWER_STATE {
- PowerDeviceUnspecified,
- PowerDeviceD0,
- PowerDeviceD1,
- PowerDeviceD2,
- PowerDeviceD3,
- PowerDeviceMaximum
-} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
-
-typedef union _POWER_STATE {
- SYSTEM_POWER_STATE SystemState;
- DEVICE_POWER_STATE DeviceState;
-} POWER_STATE, *PPOWER_STATE;
-
-typedef enum _POWER_STATE_TYPE {
- SystemPowerState = 0,
- DevicePowerState
-} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
-
-
-typedef enum _POWER_INFORMATION_LEVEL {
- SystemPowerPolicyAc,
- SystemPowerPolicyDc,
- VerifySystemPolicyAc,
- VerifySystemPolicyDc,
- SystemPowerCapabilities,
- SystemBatteryState,
- SystemPowerStateHandler,
- ProcessorStateHandler,
- SystemPowerPolicyCurrent,
- AdministratorPowerPolicy,
- SystemReserveHiberFile,
- ProcessorInformation,
- SystemPowerInformation,
- ProcessorStateHandler2,
- LastWakeTime,
- LastSleepTime,
- SystemExecutionState,
- SystemPowerStateNotifyHandler,
- ProcessorPowerPolicyAc,
- ProcessorPowerPolicyDc,
- VerifyProcessorPowerPolicyAc,
- VerifyProcessorPowerPolicyDc,
- ProcessorPowerPolicyCurrent,
- SystemPowerStateLogging,
- SystemPowerLoggingEntry,
- SetPowerSettingValue,
- NotifyUserPowerSetting,
- PowerInformationLevelUnused0,
- PowerInformationLevelUnused1,
- SystemVideoState,
- TraceApplicationPowerMessage,
- TraceApplicationPowerMessageEnd,
- ProcessorPerfStates,
- ProcessorIdleStates,
- ProcessorCap,
- SystemWakeSource,
- SystemHiberFileInformation,
- TraceServicePowerMessage,
- ProcessorLoad,
- PowerShutdownNotification,
- MonitorCapabilities,
- SessionPowerInit,
- SessionDisplayState,
- PowerRequestCreate,
- PowerRequestAction,
- GetPowerRequestList,
- ProcessorInformationEx,
- NotifyUserModeLegacyPowerEvent,
- GroupPark,
- ProcessorIdleDomains,
- WakeTimerList,
- SystemHiberFileSize,
- PowerInformationLevelMaximum
-} POWER_INFORMATION_LEVEL;
-
-typedef enum {
- PowerActionNone,
- PowerActionReserved,
- PowerActionSleep,
- PowerActionHibernate,
- PowerActionShutdown,
- PowerActionShutdownReset,
- PowerActionShutdownOff,
- PowerActionWarmEject
-} POWER_ACTION, *PPOWER_ACTION;
-
-
-
NTSYSCALLAPI
NTSTATUS
NTAPI
#define NTHALAPI
#endif
-#if !defined(_NTOSKRNL_) /* For ReactOS */
+/* For ReactOS */
+#if !defined(_NTOSKRNL_) && !defined(_BLDR_)
#define NTKERNELAPI DECLSPEC_IMPORT
#else
#define NTKERNELAPI
volatile PVOID DpcData;
} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
+typedef struct _KDPC_WATCHDOG_INFORMATION {
+ ULONG DpcTimeLimit;
+ ULONG DpcTimeCount;
+ ULONG DpcWatchdogLimit;
+ ULONG DpcWatchdogCount;
+ ULONG Reserved;
+} KDPC_WATCHDOG_INFORMATION, *PKDPC_WATCHDOG_INFORMATION;
+
typedef struct _KDEVICE_QUEUE {
CSHORT Type;
CSHORT Size;
#define ALIGN_DOWN_POINTER_BY(ptr, align) \
((PVOID)ALIGN_DOWN_BY(ptr, align))
-#define ALIGN_UP_POINTER_BY(ptr, alignment) \
+#define ALIGN_UP_POINTER_BY(ptr, align) \
((PVOID)ALIGN_UP_BY(ptr, align))
#define ALIGN_DOWN(size, type) \
#define ALIGN_UP(size, type) \
ALIGN_UP_BY(size, sizeof(type))
-#define ALIGN_DOWN_POINTER(p, type) \
- ALIGN_DOWN_POINTER_BY(p, sizeof(type))
+#define ALIGN_DOWN_POINTER(ptr, type) \
+ ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
#define ALIGN_UP_POINTER(ptr, type) \
ALIGN_UP_POINTER_BY(ptr, sizeof(type))
#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
+
+#if 1
/******************************************************************************
* Power Management Support Types *
******************************************************************************/
+#ifndef _PO_DDK_
+#define _PO_DDK_
+
/* Power States/Levels */
typedef enum _SYSTEM_POWER_STATE {
PowerSystemUnspecified,
ProcessorPowerPolicyDc,
VerifyProcessorPowerPolicyAc,
VerifyProcessorPowerPolicyDc,
- ProcessorPowerPolicyCurrent
+ ProcessorPowerPolicyCurrent,
+ SystemPowerStateLogging,
+ SystemPowerLoggingEntry,
+ SetPowerSettingValue,
+ NotifyUserPowerSetting,
+ PowerInformationLevelUnused0,
+ PowerInformationLevelUnused1,
+ SystemVideoState,
+ TraceApplicationPowerMessage,
+ TraceApplicationPowerMessageEnd,
+ ProcessorPerfStates,
+ ProcessorIdleStates,
+ ProcessorCap,
+ SystemWakeSource,
+ SystemHiberFileInformation,
+ TraceServicePowerMessage,
+ ProcessorLoad,
+ PowerShutdownNotification,
+ MonitorCapabilities,
+ SessionPowerInit,
+ SessionDisplayState,
+ PowerRequestCreate,
+ PowerRequestAction,
+ GetPowerRequestList,
+ ProcessorInformationEx,
+ NotifyUserModeLegacyPowerEvent,
+ GroupPark,
+ ProcessorIdleDomains,
+ WakeTimerList,
+ SystemHiberFileSize,
+ PowerInformationLevelMaximum
} POWER_INFORMATION_LEVEL;
typedef enum {
DevicePowerState
} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
+#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_)
+typedef struct {
+ ULONG Granularity;
+ ULONG Capacity;
+} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
+#endif /* (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) */
+
+#endif /* !_PO_DDK_ */
+
typedef VOID
(DDKAPI *PREQUEST_POWER_COMPLETE)(
IN struct _DEVICE_OBJECT *DeviceObject,
IN PVOID Context,
IN struct _IO_STATUS_BLOCK *IoStatus);
+
/******************************************************************************
* Power Management Support Functions *
******************************************************************************/
VOID
NTAPI
PoSetSystemWake(
- IN OUT PIRP Irp);
+ IN OUT struct _IRP *Irp);
NTKERNELAPI
BOOLEAN
NTAPI
PoGetSystemWake(
- IN PIRP Irp);
+ IN struct _IRP *Irp);
NTKERNELAPI
NTSTATUS
IN PCOUNTED_REASON_CONTEXT Context);
#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
-
+#endif
/******************************************************************************
* Configuration Manager Types *
#define FILE_DEVICE_SERENUM 0x00000037
#define FILE_DEVICE_TERMSRV 0x00000038
#define FILE_DEVICE_KSEC 0x00000039
-#define FILE_DEVICE_FIPS 0x0000003a
-#define FILE_DEVICE_INFINIBAND 0x0000003b
-#define FILE_DEVICE_VMBUS 0x0000003e
-#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003f
+#define FILE_DEVICE_FIPS 0x0000003A
+#define FILE_DEVICE_INFINIBAND 0x0000003B
+#define FILE_DEVICE_VMBUS 0x0000003E
+#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F
#define FILE_DEVICE_WPD 0x00000040
#define FILE_DEVICE_BLUETOOTH 0x00000041
#define FILE_DEVICE_MT_COMPOSITE 0x00000042
#define SL_ALLOW_RAW_MOUNT 0x01
-#define CTL_CODE(DeviceType, Function, Method, Access)( \
- ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
+#define CTL_CODE(DeviceType, Function, Method, Access) \
+ (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
PVOID
NTAPI
HalAllocateCommonBuffer(
- IN PADAPTER_OBJECT AdapterObject,
+ IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
pHalMirrorVerify HalMirrorVerify;
} HAL_DISPATCH, *PHAL_DISPATCH;
-#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTHAL_)
-extern NTSYSAPI PHAL_DISPATCH HalDispatchTable;
-#define HALDISPATCH ((PHAL_DISPATCH)&HalDispatchTable)
-#else
-extern __declspec(dllexport) HAL_DISPATCH HalDispatchTable;
+/* GCC/MSVC and WDK compatible declaration */
+extern NTKERNELAPI HAL_DISPATCH HalDispatchTable;
+
+#if defined(_NTOSKRNL_) || defined(_BLDR_)
#define HALDISPATCH (&HalDispatchTable)
+#else
+/* This is a WDK compatibility definition */
+#define HalDispatchTable (&HalDispatchTable)
+#define HALDISPATCH HalDispatchTable
#endif
#define HAL_DISPATCH_VERSION 3
IN PDEVICE_OBJECT DeviceObject,
IN struct _DRIVE_LAYOUT_INFORMATION_EX *PartitionBuffer);
+#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
+// nothing here
+#else
+
#if (NTDDI_VERSION >= NTDDI_WIN2K)
//DECLSPEC_DEPRECATED_DDK
NTHALAPI
HalReadDmaCounter(
IN PADAPTER_OBJECT AdapterObject);
-#endif
+NTHALAPI
+NTSTATUS
+NTAPI
+HalAllocateAdapterChannel(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN PWAIT_CONTEXT_BLOCK Wcb,
+ IN ULONG NumberOfMapRegisters,
+ IN PDRIVER_CONTROL ExecutionRoutine);
+
+#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
+#endif /* defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_) */
/** Kernel routines **/
HalAcquireDisplayOwnership(
IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
-NTHALAPI
-NTSTATUS
-NTAPI
-HalAllocateAdapterChannel(
- IN PADAPTER_OBJECT AdapterObject,
- IN PWAIT_CONTEXT_BLOCK Wcb,
- IN ULONG NumberOfMapRegisters,
- IN PDRIVER_CONTROL ExecutionRoutine);
-
NTHALAPI
NTSTATUS
NTAPI
OUT PRTL_ATOM Atom OPTIONAL
);
-NTSYSAPI
+NTSYSCALLAPI
NTSTATUS
NTAPI
ZwOpenEvent(
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize
);
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize
);
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize
);
NTAPI
RtlUnicodeToMultiByteSize(
PULONG MbSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize
);
PWSTR UnicodeString,
ULONG MaxBytesInUnicodeString,
PULONG BytesInUnicodeString,
- IN PCHAR OemString,
+ IN PCCH OemString,
ULONG BytesInOemString
);
RtlOemToUnicodeN (PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
- PCHAR OemString,
+ PCCH OemString,
ULONG OemSize)
{
ULONG Size = 0;
UCHAR Char;
USHORT OemLeadByteInfo;
- PCHAR OemEnd = OemString + OemSize;
+ PCCH OemEnd = OemString + OemSize;
for (i = 0; i < UnicodeSize / sizeof(WCHAR) && OemString < OemEnd; i++)
{
NTSTATUS
NTAPI
RtlUnicodeToMultiByteSize(PULONG MbSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize)
{
ULONG UnicodeLength = UnicodeSize / sizeof(WCHAR);
RtlUnicodeToOemN (PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize)
{
ULONG Size = 0;
RtlUpcaseUnicodeToMultiByteN (PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize)
{
WCHAR UpcaseChar;
RtlUpcaseUnicodeToOemN (PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize)
{
WCHAR UpcaseChar;