[FREELDR] Define _BLDR_ for WDK header compatibility
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 10 Mar 2010 04:16:52 +0000 (04:16 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 10 Mar 2010 04:16:52 +0000 (04:16 +0000)
[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

16 files changed:
boot/freeldr/freeldr/freeldr_arch.rbuild
boot/freeldr/freeldr/freeldr_base.rbuild
hal/halx86/hal.rbuild
hal/halx86/hal_generic.rbuild
hal/halx86/hal_generic_mp.rbuild
hal/halx86/hal_generic_up.rbuild
hal/halx86/halmps.rbuild
hal/halx86/halxbox.rbuild
hal/halx86/include/hal.h
include/ddk/ntifs.h
include/ddk/ntpoapi.h
include/ddk/wdm.h
include/ddk/winddk.h
include/ndk/exfuncs.h
include/ndk/rtlfuncs.h
lib/rtl/nls.c

index 2132587..05ca7b3 100644 (file)
@@ -6,6 +6,7 @@
        <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">
index fd3487f..8edcd8e 100644 (file)
@@ -5,6 +5,7 @@
        <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">
index d87973e..2c672c2 100644 (file)
@@ -6,6 +6,7 @@
                <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>
index 3980579..99528c9 100644 (file)
@@ -4,6 +4,7 @@
        <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">
@@ -38,8 +39,9 @@
        <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">
index 63c3912..5bf819c 100644 (file)
@@ -4,6 +4,7 @@
        <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">
index b2f605a..405da09 100644 (file)
@@ -4,6 +4,7 @@
        <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>
index 458a585..05bab41 100644 (file)
@@ -7,6 +7,7 @@
                <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>
index 3db5216..cee7f61 100644 (file)
@@ -5,6 +5,7 @@
                <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>
index 8d8f315..3eff1e7 100644 (file)
 /* 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 */
index 6c7e5c0..a5c20ac 100644 (file)
@@ -44,7 +44,8 @@ extern "C" {
 #define NTHALAPI
 #endif
 
-#if !defined(_NTOSKRNL_) /* For ReactOS */
+/* For ReactOS */
+#if !defined(_NTOSKRNL_) && !defined(_BLDR_)
 #define NTKERNELAPI DECLSPEC_IMPORT
 #else
 #define NTKERNELAPI
@@ -1484,6 +1485,16 @@ RtlUpcaseUnicodeToOemN(
   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
@@ -1518,6 +1529,26 @@ NTAPI
 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
@@ -1546,6 +1577,22 @@ PfxFindPrefix(
   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
@@ -1963,6 +2010,16 @@ RtlReserveChunk(
   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
@@ -2293,7 +2350,7 @@ HEAP_MAKE_TAG_FLAGS(
   IN ULONG TagBase,
   IN ULONG Tag)
 {
-  __assume_bound(TagBase);
+  //__assume_bound(TagBase); // FIXME
   return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT)));
 }
 
@@ -2316,20 +2373,20 @@ HEAP_MAKE_TAG_FLAGS(
 )
 
 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;
@@ -2339,46 +2396,6 @@ extern const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine;
 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)
@@ -2386,16 +2403,6 @@ typedef struct _UNICODE_PREFIX_TABLE {
 #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))  ))
 
@@ -2473,10 +2480,11 @@ typedef struct _COMPRESSED_DATA_INFO {
 #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
@@ -2486,10 +2494,10 @@ typedef struct _COMPRESSED_DATA_INFO {
 #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;
 
@@ -5624,12 +5632,6 @@ typedef struct _QUERY_PATH_RESPONSE {
     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;
@@ -8235,16 +8237,6 @@ PsRevertToSelf (
     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
@@ -8948,15 +8940,6 @@ ZwOpenDirectoryObject (
     IN POBJECT_ATTRIBUTES   ObjectAttributes
 );
 
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwOpenEvent (
-    OUT PHANDLE             EventHandle,
-    IN ACCESS_MASK          DesiredAccess,
-    IN POBJECT_ATTRIBUTES   ObjectAttributes
-);
-
 NTSYSAPI
 NTSTATUS
 NTAPI
index 12333f7..48f7107 100644 (file)
 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;
@@ -153,108 +260,6 @@ typedef struct _PROCESSOR_STATE_HANDLER2 {
        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
index cc28c4e..b025b7c 100644 (file)
@@ -55,7 +55,8 @@ extern "C" {
 #define NTHALAPI
 #endif
 
-#if !defined(_NTOSKRNL_) /* For ReactOS */
+/* For ReactOS */
+#if !defined(_NTOSKRNL_) && !defined(_BLDR_)
 #define NTKERNELAPI DECLSPEC_IMPORT
 #else
 #define NTKERNELAPI
@@ -848,6 +849,14 @@ typedef struct _KDPC
     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;
@@ -2138,7 +2147,7 @@ typedef enum _MM_SYSTEM_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) \
@@ -2147,8 +2156,8 @@ typedef enum _MM_SYSTEM_SIZE {
 #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))
@@ -2952,10 +2961,15 @@ SeGetWorldRights(
 
 #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,
@@ -2993,7 +3007,37 @@ typedef enum _POWER_INFORMATION_LEVEL {
     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 {
@@ -3026,6 +3070,15 @@ typedef enum _POWER_STATE_TYPE {
   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,
@@ -3034,6 +3087,7 @@ typedef VOID
   IN PVOID  Context,
   IN struct _IO_STATUS_BLOCK  *IoStatus);
 
+
 /******************************************************************************
  *                            Power Management Support Functions              *
  ******************************************************************************/
@@ -3110,13 +3164,13 @@ NTKERNELAPI
 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
@@ -3195,7 +3249,7 @@ PoCreatePowerRequest(
   IN PCOUNTED_REASON_CONTEXT Context);
 
 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
-
+#endif
 
 /******************************************************************************
  *                            Configuration Manager Types                     *
@@ -5486,10 +5540,10 @@ RtlCheckBit(
 #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
@@ -6639,8 +6693,8 @@ typedef struct _IO_COMPLETION_CONTEXT {
 
 #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)
 
@@ -11402,7 +11456,7 @@ FORCEINLINE
 PVOID
 NTAPI
 HalAllocateCommonBuffer(
-  IN PADAPTER_OBJECT  AdapterObject,
+  IN PDMA_ADAPTER DmaAdapter,
   IN ULONG  Length,
   OUT PPHYSICAL_ADDRESS  LogicalAddress,
   IN BOOLEAN  CacheEnabled)
index 25f93d4..c9c7f40 100644 (file)
@@ -1028,12 +1028,15 @@ typedef struct {
   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
@@ -2813,6 +2816,10 @@ IoWritePartitionTableEx(
   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
@@ -2882,7 +2889,17 @@ NTAPI
 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 **/
 
@@ -3751,15 +3768,6 @@ NTAPI
 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
index f65655b..0d40a3f 100644 (file)
@@ -732,7 +732,7 @@ ZwFindAtom(
     OUT PRTL_ATOM Atom OPTIONAL
 );
 
-NTSYSAPI
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 ZwOpenEvent(
index 5db3fc3..e7b50bd 100644 (file)
@@ -1478,7 +1478,7 @@ RtlUpcaseUnicodeToOemN(
     PCHAR OemString,
     ULONG OemSize,
     PULONG ResultSize,
-    PWCHAR UnicodeString,
+    PCWCH UnicodeString,
     ULONG UnicodeSize
 );
 
@@ -1508,7 +1508,7 @@ RtlUnicodeToOemN(
     PCHAR OemString,
     ULONG OemSize,
     PULONG ResultSize,
-    PWCHAR UnicodeString,
+    PCWCH UnicodeString,
     ULONG UnicodeSize
 );
 
@@ -1533,7 +1533,7 @@ RtlUpcaseUnicodeToMultiByteN(
     PCHAR MbString,
     ULONG MbSize,
     PULONG ResultSize,
-    PWCHAR UnicodeString,
+    PCWCH UnicodeString,
     ULONG UnicodeSize
 );
 
@@ -1542,7 +1542,7 @@ NTSTATUS
 NTAPI
 RtlUnicodeToMultiByteSize(
     PULONG MbSize,
-    PWCHAR UnicodeString,
+    PCWCH UnicodeString,
     ULONG UnicodeSize
 );
 
@@ -1570,7 +1570,7 @@ RtlOemToUnicodeN(
     PWSTR UnicodeString,
     ULONG MaxBytesInUnicodeString,
     PULONG BytesInUnicodeString,
-    IN PCHAR OemString,
+    IN PCCH OemString,
     ULONG BytesInOemString
 );
 
index 319cbcf..b719231 100644 (file)
@@ -345,7 +345,7 @@ NTSTATUS NTAPI
 RtlOemToUnicodeN (PWCHAR UnicodeString,
                   ULONG UnicodeSize,
                   PULONG ResultSize,
-                  PCHAR OemString,
+                  PCCH OemString,
                   ULONG OemSize)
 {
    ULONG Size = 0;
@@ -376,7 +376,7 @@ RtlOemToUnicodeN (PWCHAR UnicodeString,
 
       UCHAR Char;
       USHORT OemLeadByteInfo;
-      PCHAR OemEnd = OemString + OemSize;
+      PCCH OemEnd = OemString + OemSize;
 
       for (i = 0; i < UnicodeSize / sizeof(WCHAR) && OemString < OemEnd; i++)
       {
@@ -569,7 +569,7 @@ RtlUnicodeToMultiByteN (PCHAR MbString,
 NTSTATUS
 NTAPI
 RtlUnicodeToMultiByteSize(PULONG MbSize,
-                          PWCHAR UnicodeString,
+                          PCWCH UnicodeString,
                           ULONG UnicodeSize)
 {
     ULONG UnicodeLength = UnicodeSize / sizeof(WCHAR);
@@ -613,7 +613,7 @@ NTSTATUS NTAPI
 RtlUnicodeToOemN (PCHAR OemString,
                   ULONG OemSize,
                   PULONG ResultSize,
-                  PWCHAR UnicodeString,
+                  PCWCH UnicodeString,
                   ULONG UnicodeSize)
 {
    ULONG Size = 0;
@@ -762,7 +762,7 @@ NTSTATUS NTAPI
 RtlUpcaseUnicodeToMultiByteN (PCHAR MbString,
                               ULONG MbSize,
                               PULONG ResultSize,
-                              PWCHAR UnicodeString,
+                              PCWCH UnicodeString,
                               ULONG UnicodeSize)
 {
    WCHAR UpcaseChar;
@@ -806,7 +806,7 @@ NTSTATUS NTAPI
 RtlUpcaseUnicodeToOemN (PCHAR OemString,
                         ULONG OemSize,
                         PULONG ResultSize,
-                        PWCHAR UnicodeString,
+                        PCWCH UnicodeString,
                         ULONG UnicodeSize)
 {
    WCHAR UpcaseChar;