https://git.reactos.org/?p=reactos.git;a=commitdiff;h=be276dde282c2f14a9e73…
commit be276dde282c2f14a9e73e6ae65889062bd02af9
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Thu Sep 24 21:51:57 2020 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Thu Sep 24 21:51:57 2020 +0300
[XDK][NTOSKRNL_VISTA] Put NTKRNLVISTAAPI to XDK headers
for vista+ APIs implemented in ntoskrnl_vista.
Now if you statically link ntoskrnl_vista into a driver,
NTKERNELAPI will automatically be removed from an API definition
---
sdk/include/xdk/iofuncs.h | 12 ++++++------
sdk/include/xdk/kefuncs.h | 10 +++++-----
sdk/include/xdk/pofuncs.h | 6 +++---
sdk/include/xdk/wdm.template.h | 7 +++++++
sdk/include/xdk/wmifuncs.h | 6 +++---
sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt | 2 ++
sdk/lib/drivers/ntoskrnl_vista/etw.c | 6 +++---
sdk/lib/drivers/ntoskrnl_vista/io.c | 12 ++++++------
sdk/lib/drivers/ntoskrnl_vista/ke.c | 8 ++++----
sdk/lib/drivers/ntoskrnl_vista/po.c | 6 +++---
10 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/sdk/include/xdk/iofuncs.h b/sdk/include/xdk/iofuncs.h
index 271455eca81..ec364576e4f 100644
--- a/sdk/include/xdk/iofuncs.h
+++ b/sdk/include/xdk/iofuncs.h
@@ -2348,7 +2348,7 @@ IoUninitializeWorkItem(
_Inout_ PIO_WORKITEM IoWorkItem);
_IRQL_requires_max_(DISPATCH_LEVEL)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
VOID
NTAPI
IoQueueWorkItemEx(
@@ -2357,7 +2357,7 @@ IoQueueWorkItemEx(
_In_ WORK_QUEUE_TYPE QueueType,
_In_opt_ __drv_aliasesMem PVOID Context);
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
IO_PRIORITY_HINT
NTAPI
IoGetIoPriorityHint(
@@ -2416,7 +2416,7 @@ IoSetDevicePropertyData(
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
IoGetDevicePropertyData(
@@ -2475,7 +2475,7 @@ NTAPI
IoClearIrpExtraCreateParameter(
_Inout_ PIRP Irp);
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
IoGetIrpExtraCreateParameter(
@@ -2602,7 +2602,7 @@ $endif (_NTIFS_)
$if (_WDMDDK_)
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTSTATUS
IoSetDeviceInterfacePropertyData(
_In_ PUNICODE_STRING SymbolicLinkName,
@@ -2629,7 +2629,7 @@ IoGetDeviceInterfacePropertyData (
$endif (_WDMDDK_)
$if (_NTDDK_)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
VOID
IoSetMasterIrpStatus(
_Inout_ PIRP MasterIrp,
diff --git a/sdk/include/xdk/kefuncs.h b/sdk/include/xdk/kefuncs.h
index 6d459bbe60a..bb8c662b73a 100644
--- a/sdk/include/xdk/kefuncs.h
+++ b/sdk/include/xdk/kefuncs.h
@@ -1128,7 +1128,7 @@ NTAPI
KeRevertToUserAffinityThreadEx(
_In_ KAFFINITY Affinity);
-NTKERNELAPI
+NTKRNLVISTAAPI
ULONG
NTAPI
KeQueryActiveProcessorCount(
@@ -1140,7 +1140,7 @@ NTAPI
KeQueryMaximumProcessorCount(VOID);
$endif (_WDMDDK_)
$if (_NTDDK_)
-NTKERNELAPI
+NTKRNLVISTAAPI
ULONG
NTAPI
KeQueryActiveProcessorCount(
@@ -1249,12 +1249,12 @@ NTAPI
KeQueryNodeMaximumProcessorCount(
_In_ USHORT NodeNumber);
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
USHORT
NTAPI
KeQueryHighestNodeNumber(VOID);
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
USHORT
NTAPI
KeGetCurrentNodeNumber(VOID);
@@ -1316,7 +1316,7 @@ KeRevertToUserGroupAffinityThread(
_In_ PGROUP_AFFINITY PreviousAffinity);
_IRQL_requires_max_(DISPATCH_LEVEL)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
BOOLEAN
NTAPI
KeSetCoalescableTimer(
diff --git a/sdk/include/xdk/pofuncs.h b/sdk/include/xdk/pofuncs.h
index 37a0f9e76be..ff73e1b7500 100644
--- a/sdk/include/xdk/pofuncs.h
+++ b/sdk/include/xdk/pofuncs.h
@@ -112,7 +112,7 @@ PoGetSystemWake(
_In_ struct _IRP *Irp);
_IRQL_requires_max_(APC_LEVEL)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
PoRegisterPowerSettingCallback(
@@ -123,7 +123,7 @@ PoRegisterPowerSettingCallback(
_Outptr_opt_ PVOID *Handle);
_IRQL_requires_max_(APC_LEVEL)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
PoUnregisterPowerSettingCallback(
@@ -154,7 +154,7 @@ PoEndDeviceBusy(
_Inout_ PULONG IdlePointer);
_IRQL_requires_max_(DISPATCH_LEVEL)
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
BOOLEAN
NTAPI
PoQueryWatchdogTime(
diff --git a/sdk/include/xdk/wdm.template.h b/sdk/include/xdk/wdm.template.h
index 9893977c092..1623e00a081 100644
--- a/sdk/include/xdk/wdm.template.h
+++ b/sdk/include/xdk/wdm.template.h
@@ -96,6 +96,13 @@ $define(USHORT=USHORT)
#endif
#endif
+/* for statically-linked ntoskrnl_vista library */
+#if defined(NTKRNLVISTA)
+#define NTKRNLVISTAAPI
+#else
+#define NTKRNLVISTAAPI NTKERNELAPI
+#endif
+
#if defined(_X86_) && !defined(_NTHAL_)
#define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
#elif defined(_X86_)
diff --git a/sdk/include/xdk/wmifuncs.h b/sdk/include/xdk/wmifuncs.h
index bad09c35e1d..81f6754452b 100644
--- a/sdk/include/xdk/wmifuncs.h
+++ b/sdk/include/xdk/wmifuncs.h
@@ -69,7 +69,7 @@ WmiQueryTraceInformation(
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTAPI
EtwRegister(
_In_ LPCGUID ProviderId,
@@ -79,7 +79,7 @@ EtwRegister(
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTAPI
EtwUnregister(
_In_ REGHANDLE RegHandle);
@@ -112,7 +112,7 @@ EtwActivityIdControl(
_IRQL_requires_max_(HIGH_LEVEL)
NTSTATUS
-// NTKERNELAPI // HACK: ntoskrnl_vista functions are statically linked thus don't
need DECLSPEC_IMPORT
+NTKRNLVISTAAPI
NTAPI
EtwWrite(
_In_ REGHANDLE RegHandle,
diff --git a/sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt
b/sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt
index 5ce01354762..78658c54bd0 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt
+++ b/sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt
@@ -13,3 +13,5 @@ list(APPEND SOURCE
add_library(ntoskrnl_vista ${SOURCE})
add_dependencies(ntoskrnl_vista bugcodes xdk)
+
+target_compile_definitions(ntoskrnl_vista PUBLIC NTKRNLVISTA)
diff --git a/sdk/lib/drivers/ntoskrnl_vista/etw.c b/sdk/lib/drivers/ntoskrnl_vista/etw.c
index 903b0497297..81f599fb909 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/etw.c
+++ b/sdk/lib/drivers/ntoskrnl_vista/etw.c
@@ -10,7 +10,7 @@
_IRQL_requires_max_(HIGH_LEVEL)
NTSTATUS
-NTKERNELAPI
+NTKRNLVISTAAPI
NTAPI
EtwWrite(
_In_ REGHANDLE RegHandle,
@@ -24,7 +24,7 @@ EtwWrite(
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
-NTKERNELAPI
+NTKRNLVISTAAPI
NTAPI
EtwRegister(
_In_ LPCGUID ProviderId,
@@ -37,7 +37,7 @@ EtwRegister(
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
-NTKERNELAPI
+NTKRNLVISTAAPI
NTAPI
EtwUnregister(
_In_ REGHANDLE RegHandle)
diff --git a/sdk/lib/drivers/ntoskrnl_vista/io.c b/sdk/lib/drivers/ntoskrnl_vista/io.c
index 5008f7a981d..c295d63193f 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/io.c
+++ b/sdk/lib/drivers/ntoskrnl_vista/io.c
@@ -18,7 +18,7 @@ typedef struct _EX_WORKITEM_CONTEXT
#define TAG_IOWI 'IWOI'
-NTKERNELAPI
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
IoGetIrpExtraCreateParameter(IN PIRP Irp,
@@ -49,7 +49,7 @@ IopWorkItemExCallback(
ExFreePoolWithTag(context, TAG_IOWI);
}
-NTKERNELAPI
+NTKRNLVISTAAPI
VOID
NTAPI
IoQueueWorkItemEx(
@@ -68,7 +68,7 @@ IoQueueWorkItemEx(
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
-NTKERNELAPI
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
IoGetDevicePropertyData(
@@ -86,7 +86,7 @@ IoGetDevicePropertyData(
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
-NTKERNELAPI
+NTKRNLVISTAAPI
NTSTATUS
IoSetDeviceInterfacePropertyData(
_In_ PUNICODE_STRING SymbolicLinkName,
@@ -100,7 +100,7 @@ IoSetDeviceInterfacePropertyData(
return STATUS_NOT_IMPLEMENTED;
}
-NTKERNELAPI
+NTKRNLVISTAAPI
IO_PRIORITY_HINT
NTAPI
IoGetIoPriorityHint(
@@ -109,7 +109,7 @@ IoGetIoPriorityHint(
return IoPriorityNormal;
}
-NTKERNELAPI
+NTKRNLVISTAAPI
VOID
IoSetMasterIrpStatus(
_Inout_ PIRP MasterIrp,
diff --git a/sdk/lib/drivers/ntoskrnl_vista/ke.c b/sdk/lib/drivers/ntoskrnl_vista/ke.c
index 2f982659393..0abd392b87e 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/ke.c
+++ b/sdk/lib/drivers/ntoskrnl_vista/ke.c
@@ -9,7 +9,7 @@
#include <ntdef.h>
#include <ntifs.h>
-NTKERNELAPI
+NTKRNLVISTAAPI
ULONG
NTAPI
KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
@@ -26,7 +26,7 @@ KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
return RtlNumberOfSetBits(&Bitmap);
}
-NTKERNELAPI
+NTKRNLVISTAAPI
USHORT
NTAPI
KeQueryHighestNodeNumber()
@@ -34,7 +34,7 @@ KeQueryHighestNodeNumber()
return 0;
}
-NTKERNELAPI
+NTKRNLVISTAAPI
USHORT
NTAPI
KeGetCurrentNodeNumber()
@@ -43,7 +43,7 @@ KeGetCurrentNodeNumber()
}
_IRQL_requires_max_(DISPATCH_LEVEL)
-NTKERNELAPI
+NTKRNLVISTAAPI
BOOLEAN
NTAPI
KeSetCoalescableTimer(
diff --git a/sdk/lib/drivers/ntoskrnl_vista/po.c b/sdk/lib/drivers/ntoskrnl_vista/po.c
index 22d44bdd892..791a784273a 100644
--- a/sdk/lib/drivers/ntoskrnl_vista/po.c
+++ b/sdk/lib/drivers/ntoskrnl_vista/po.c
@@ -8,7 +8,7 @@
#include <ntdef.h>
#include <ntifs.h>
-NTKERNELAPI
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
PoRegisterPowerSettingCallback(
@@ -22,7 +22,7 @@ PoRegisterPowerSettingCallback(
}
_IRQL_requires_max_(APC_LEVEL)
-NTKERNELAPI
+NTKRNLVISTAAPI
NTSTATUS
NTAPI
PoUnregisterPowerSettingCallback(
@@ -32,7 +32,7 @@ PoUnregisterPowerSettingCallback(
}
_IRQL_requires_max_(DISPATCH_LEVEL)
-NTKERNELAPI
+NTKRNLVISTAAPI
BOOLEAN
NTAPI
PoQueryWatchdogTime(