Skip to content

Commit 6367f66

Browse files
committed
[NDK] Add _KNSOFT_NDK_NTDDI_MIN macro to specify the minimum support NT version
1 parent 624237c commit 6367f66

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Source/Include/KNSoft/NDK/NT/MinDef.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,22 @@
44

55
#include <SdkDdkVer.h>
66

7+
/* Patch undocumented NTDDI versions */
8+
#define NTDDI_WIN10_GE NTDDI_WIN11_ZN /* Introduced in Windows SDK 10.0.26100.1 (Win11), later than all NTDDI_WIN10_* */
9+
#define NTDDI_WIN11_DT NTDDI_WIN11_GE /* Introduced in Windows SDK 10.0.26100.3916, later than NTDDI_WIN11_GE */
10+
11+
/* Minimum support NT6.0 by default */
12+
#ifndef _KNSOFT_NDK_NTDDI_MIN
13+
#define _KNSOFT_NDK_NTDDI_MIN NTDDI_VISTA
14+
#endif
15+
716
// MS-Spec: Nonstandard extension used: zero-sized array in struct/union
817
#pragma warning(disable: 4200)
918

1019
#if defined(_DEBUG) && !defined(DBG)
1120
#define DBG 1
1221
#endif
1322

14-
/* Patch undocumented NTDDI versions */
15-
#define NTDDI_WIN10_GE NTDDI_WIN11_ZN /* Introduced in Windows SDK 10.0.26100.1 (Win11), later than all NTDDI_WIN10_* */
16-
#define NTDDI_WIN11_DT NTDDI_WIN11_GE /* Introduced in Windows SDK 10.0.26100.3916, later than NTDDI_WIN11_GE */
17-
1823
#pragma region Define architecture
1924

2025
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && !defined(_ARM_) && !defined(_ARM64_) && !defined(_ARM64EC_) && defined(_M_IX86)

Source/Include/KNSoft/NDK/Win32/API/Kernel32.inl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ _Inline_InitializeCriticalSectionAndSpinCount(
313313
_Out_ LPCRITICAL_SECTION lpCriticalSection,
314314
_In_ DWORD dwSpinCount)
315315
{
316-
#if NTDDI_VERSION >= NTDDI_VISTA
316+
#if _KNSOFT_NDK_NTDDI_MIN >= NTDDI_VISTA
317317
RtlInitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount);
318318
return TRUE;
319319
#else
@@ -1122,8 +1122,6 @@ _Inline_InterlockedPushListSList(
11221122
return RtlInterlockedPushListSList(ListHead, List, ListEnd, Count);
11231123
}
11241124

1125-
#if NTDDI_VERSION >= NTDDI_WIN8
1126-
11271125
__inline
11281126
PSLIST_ENTRY
11291127
WINAPI
@@ -1133,10 +1131,15 @@ _Inline_InterlockedPushListSListEx(
11331131
_Inout_ PSLIST_ENTRY ListEnd,
11341132
_In_ ULONG Count)
11351133
{
1136-
return RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count);
1137-
}
1138-
1134+
return
1135+
#if _KNSOFT_NDK_NTDDI_MIN >= NTDDI_WIN8
1136+
RtlInterlockedPushListSListEx
1137+
#else
1138+
RtlInterlockedPushListSList
11391139
#endif
1140+
(ListHead, List, ListEnd, Count);
1141+
1142+
}
11401143

11411144
__inline
11421145
USHORT

0 commit comments

Comments
 (0)