From: Timo Kreuzer Date: Wed, 10 Mar 2010 04:16:52 +0000 (+0000) Subject: [FREELDR] Define _BLDR_ for WDK header compatibility X-Git-Tag: backups/header-work@57446~197 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=e0c972bf4e831b92918df7e7dbf3617388f4e9b3 [FREELDR] Define _BLDR_ for WDK header compatibility [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 --- diff --git a/boot/freeldr/freeldr/freeldr_arch.rbuild b/boot/freeldr/freeldr/freeldr_arch.rbuild index 2132587edcf..05ca7b327f1 100644 --- a/boot/freeldr/freeldr/freeldr_arch.rbuild +++ b/boot/freeldr/freeldr/freeldr_arch.rbuild @@ -6,6 +6,7 @@ include include/reactos/libs include/reactos/elf + diff --git a/boot/freeldr/freeldr/freeldr_base.rbuild b/boot/freeldr/freeldr/freeldr_base.rbuild index fd3487f3242..8edcd8ef4d0 100644 --- a/boot/freeldr/freeldr/freeldr_base.rbuild +++ b/boot/freeldr/freeldr/freeldr_base.rbuild @@ -5,6 +5,7 @@ cache . include + diff --git a/hal/halx86/hal.rbuild b/hal/halx86/hal.rbuild index d87973eb898..2c672c2f5f4 100644 --- a/hal/halx86/hal.rbuild +++ b/hal/halx86/hal.rbuild @@ -6,6 +6,7 @@ include include + hal_generic hal_generic_up diff --git a/hal/halx86/hal_generic.rbuild b/hal/halx86/hal_generic.rbuild index 3980579d589..99528c96975 100644 --- a/hal/halx86/hal_generic.rbuild +++ b/hal/halx86/hal_generic.rbuild @@ -4,6 +4,7 @@ include include + @@ -38,8 +39,9 @@ include include + - + diff --git a/hal/halx86/hal_generic_mp.rbuild b/hal/halx86/hal_generic_mp.rbuild index 63c39120ee5..5bf819c953e 100644 --- a/hal/halx86/hal_generic_mp.rbuild +++ b/hal/halx86/hal_generic_mp.rbuild @@ -4,6 +4,7 @@ include include + diff --git a/hal/halx86/hal_generic_up.rbuild b/hal/halx86/hal_generic_up.rbuild index b2f605aea47..405da09c949 100644 --- a/hal/halx86/hal_generic_up.rbuild +++ b/hal/halx86/hal_generic_up.rbuild @@ -4,6 +4,7 @@ include include + pic.c diff --git a/hal/halx86/halmps.rbuild b/hal/halx86/halmps.rbuild index 458a58506c1..05bab4161c1 100644 --- a/hal/halx86/halmps.rbuild +++ b/hal/halx86/halmps.rbuild @@ -7,6 +7,7 @@ include include + hal_generic hal_generic_mp diff --git a/hal/halx86/halxbox.rbuild b/hal/halx86/halxbox.rbuild index 3db5216aa71..cee7f614e90 100644 --- a/hal/halx86/halxbox.rbuild +++ b/hal/halx86/halxbox.rbuild @@ -5,6 +5,7 @@ include include + hal_generic diff --git a/hal/halx86/include/hal.h b/hal/halx86/include/hal.h index 8d8f3154b4d..3eff1e74b58 100644 --- a/hal/halx86/include/hal.h +++ b/hal/halx86/include/hal.h @@ -14,14 +14,12 @@ /* WDK HAL Compilation hack */ #include #include -#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 */ diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h index 6c7e5c0b312..a5c20acf1a6 100644 --- a/include/ddk/ntifs.h +++ b/include/ddk/ntifs.h @@ -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 diff --git a/include/ddk/ntpoapi.h b/include/ddk/ntpoapi.h index 12333f79481..48f71072ab6 100644 --- a/include/ddk/ntpoapi.h +++ b/include/ddk/ntpoapi.h @@ -27,14 +27,121 @@ 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 diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index cc28c4eb56e..b025b7c09b4 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -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) diff --git a/include/ddk/winddk.h b/include/ddk/winddk.h index 25f93d4fbb4..c9c7f400d60 100644 --- a/include/ddk/winddk.h +++ b/include/ddk/winddk.h @@ -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 diff --git a/include/ndk/exfuncs.h b/include/ndk/exfuncs.h index f65655b3b58..0d40a3fd0d4 100644 --- a/include/ndk/exfuncs.h +++ b/include/ndk/exfuncs.h @@ -732,7 +732,7 @@ ZwFindAtom( OUT PRTL_ATOM Atom OPTIONAL ); -NTSYSAPI +NTSYSCALLAPI NTSTATUS NTAPI ZwOpenEvent( diff --git a/include/ndk/rtlfuncs.h b/include/ndk/rtlfuncs.h index 5db3fc34daf..e7b50bd1771 100644 --- a/include/ndk/rtlfuncs.h +++ b/include/ndk/rtlfuncs.h @@ -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 ); diff --git a/lib/rtl/nls.c b/lib/rtl/nls.c index 319cbcf02c5..b7192319df2 100644 --- a/lib/rtl/nls.c +++ b/lib/rtl/nls.c @@ -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;