Hello, in attachment I'm sending few small changes for 32-bit x86
kernel32.def and ntdll.def files.
>From a30d95935cf77baf36c1447e3dc984b30ba881ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
Date: Fri, 21 Nov 2025 18:37:53 +0100
Subject: [PATCH 1/4] crt: Fix kernel32 BaseAttachCompleteThunk symbol
 decoration

Function BaseAttachCompleteThunk() takes one CONTEXT pointer argument and
on WinNT it "jumps" to address specified in the CONTEXT pointer argument.
So it does not return to the caller. On Win32s it sets win32 error to
ERROR_CALL_NOT_IMPLEMENTED, returns zero and does not touch stack pointer.

So gendef detects decoration for BaseAttachCompleteThunk incorrectly. It is
not stdcall @16 (detected for WinNT versions) and neither stdcall @0
(detected for Win32s versions). The correct decoration should be cdecl
calling convention to match above description.

BaseAttachCompleteThunk is mostly used as a callsite pointer argument
for RtlRemoteCall() function call, called by debuggers.

Some useful information:
https://famellee.wordpress.com/2010/10/29/reading-notes-of-software-debug/
https://www.alex-ionescu.com/rtlremotecall/
---
 mingw-w64-crt/lib32/kernel32.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/lib32/kernel32.def b/mingw-w64-crt/lib32/kernel32.def
index 3d8dc40a668f..998232e2ac75 100644
--- a/mingw-w64-crt/lib32/kernel32.def
+++ b/mingw-w64-crt/lib32/kernel32.def
@@ -567,7 +567,7 @@ lstrlen@4
 
 ; This is list of symbols added in Win32s 1.20, available since Windows NT 
3.1, but not available in Win9x
 AddConsoleAliasW@12
-BaseAttachCompleteThunk@0 ; FIXME: All WinNT versions have ABI 
"BaseAttachCompleteThunk@16", removed in Windows XP
+BaseAttachCompleteThunk ; really cdecl, takes one CONTEXT pointer argument, 
WinNT version does not return, Win32s version returns zero and sets error, 
removed in Windows XP
 ; BasepDebugDump@4 ; removed in Windows NT 3.51
 CloseConsoleHandle@4
 CmdBatNotification@4
-- 
2.20.1


>From 4d133e6676862a462de2cdab7373c8d0b24f4c18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
Date: Fri, 21 Nov 2025 18:48:00 +0100
Subject: [PATCH 2/4] crt: Fix version order note in kernel32.def

---
 mingw-w64-crt/lib32/kernel32.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/lib32/kernel32.def b/mingw-w64-crt/lib32/kernel32.def
index 998232e2ac75..0ff3fce70368 100644
--- a/mingw-w64-crt/lib32/kernel32.def
+++ b/mingw-w64-crt/lib32/kernel32.def
@@ -6,7 +6,7 @@ EXPORTS
 ; from native kernel32.dll libraries on 32-bit Windows systems and also from
 ; 32-bit WoW64 kernel32.dll libraries on 64-bit Windows systems. Symbols in 
this
 ; file are ordered by increasing Windows version in which they were introduced.
-; For example symbols added in Windows 98 (which is version 4.10) are before
+; For example symbols added in Windows 98 (which is version 4.10) are after
 ; Windows NT 4.0 symbols. Note that some symbols are available in Windows NT 
3.1,
 ; missing in Windows 98 (4.10), but are again available in Windows 2000 (5.0).
 ; This is always mentioned in the header of section which lists symbols.
-- 
2.20.1


>From fa9ec728ebd3dd89425df426c1debefd65d51126 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
Date: Fri, 21 Nov 2025 18:48:17 +0100
Subject: [PATCH 3/4] crt: Fix style in kernel32.def

---
 mingw-w64-crt/lib32/kernel32.def | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mingw-w64-crt/lib32/kernel32.def b/mingw-w64-crt/lib32/kernel32.def
index 0ff3fce70368..955ef620fa6d 100644
--- a/mingw-w64-crt/lib32/kernel32.def
+++ b/mingw-w64-crt/lib32/kernel32.def
@@ -1377,10 +1377,10 @@ Wow64EnableWow64FsRedirection@4
 
 ; This is list of symbols added in Windows Server 2003 SP1 and Windows XP x64 
SP1 (WoW64 version)
 AddVectoredContinueHandler@8
-BaseCheckRunApp@52 ; FIXME: Windows Server 2003 has ABI "BaseCheckRunApp@40", 
Windows Vista and 7 has ABI "BaseCheckRunApp@52", Windows 8 has ABI 
"BaseCheckRunApp@56", Windows 8.1 has ABI "BaseCheckRunApp@60" ; removed in 
Windows 10
-; BaseProcessStartThunk@0 ; available only in 32-bit WoW64 version on 64-bit 
system ; removed in Windows Vista
-; BaseThreadStartThunk@0 ; available only in 32-bit WoW64 version on 64-bit 
system ; removed in Windows Vista
-BasepCheckBadapp@56 ; FIXME: Windows Server 2003 has ABI 
"BasepCheckBadapp@36", Windows Vista has ABI "BasepCheckBadapp@56", Windows 7 
has ABI "BasepCheckBadapp@60", Windows 8 and Windows 8.1 has ABI 
"BasepCheckBadapp@72" ; removed in Windows 10
+BaseCheckRunApp@52 ; FIXME: Windows Server 2003 has ABI "BaseCheckRunApp@40", 
Windows Vista and 7 has ABI "BaseCheckRunApp@52", Windows 8 has ABI 
"BaseCheckRunApp@56", Windows 8.1 has ABI "BaseCheckRunApp@60", removed in 
Windows 10
+; BaseProcessStartThunk@0 ; available only in 32-bit WoW64 version on 64-bit 
system, removed in Windows Vista
+; BaseThreadStartThunk@0 ; available only in 32-bit WoW64 version on 64-bit 
system, removed in Windows Vista
+BasepCheckBadapp@56 ; FIXME: Windows Server 2003 has ABI 
"BasepCheckBadapp@36", Windows Vista has ABI "BasepCheckBadapp@56", Windows 7 
has ABI "BasepCheckBadapp@60", Windows 8 and Windows 8.1 has ABI 
"BasepCheckBadapp@72", removed in Windows 10
 BasepFreeAppCompatData@12 ; FIXME: Windows Server 2003 has ABI 
"BasepFreeAppCompatData@8", Windows Vista and new has ABI 
"BasepFreeAppCompatData@12"
 ConsoleIMERoutine@4 ; available only in 32-bit WoW64 version on 64-bit system
 CtrlRoutine@4 ; available only in 32-bit WoW64 version on 64-bit system, since 
Windows 7 available also on 32-bit system
@@ -2018,7 +2018,7 @@ WerRegisterRuntimeExceptionModuleWorker@8
 WerUnregisterFileWorker@4
 WerUnregisterMemoryBlockWorker@4
 WerUnregisterRuntimeExceptionModuleWorker@8
-WerpGetDebugger@8 ; FIXME: Windows 8 and Windows 8.1 has ABI 
WerpGetDebugger@20, Windows 10 has ABI WerpGetDebugger@8
+WerpGetDebugger@8 ; FIXME: Windows 8 and Windows 8.1 has ABI 
"WerpGetDebugger@20", Windows 10 has ABI "WerpGetDebugger@8"
 ; WerpLaunchAeDebug@24
 ; WerpNotifyLoadStringResourceWorker@16
 ; WerpNotifyUseStringResourceWorker@4
-- 
2.20.1


>From d2fdcef9e0f387c07f5798715fd8e3d23718b328 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
Date: Sat, 25 Oct 2025 18:36:53 +0200
Subject: [PATCH 4/4] crt: Move unsorted non-i386 symbols in file
 ntdllcrt.def.in to appropriate section

All of those symbols are available since the first x64 version of ntdll.dll 
which is Windows XP x64.
---
 mingw-w64-crt/lib-common/ntdllcrt.def.in | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/mingw-w64-crt/lib-common/ntdllcrt.def.in 
b/mingw-w64-crt/lib-common/ntdllcrt.def.in
index f83cdd072fd1..ab140a28e8e7 100644
--- a/mingw-w64-crt/lib-common/ntdllcrt.def.in
+++ b/mingw-w64-crt/lib-common/ntdllcrt.def.in
@@ -159,6 +159,15 @@ bsearch
 _vscwprintf
 _wcstoui64
 
+; This is list of symbols added in Windows Server 2003 SP1 / Windows XP x64 SP1
+F_NON_I386(__C_specific_handler)
+; F_NON_I386(__chkstk)
+F_X64(__misaligned_access)
+F64(_local_unwind)
+F_NON_I386(F_NON_ARM64(_setjmp))
+F_NON_I386(_setjmpex)
+F_NON_I386(longjmp)
+
 ; This is list of symbols added in Windows Vista
 F_I386(_alloca_probe_16)
 F_I386(_alloca_probe_8)
@@ -211,6 +220,7 @@ wcsncpy_s
 wcsnlen
 
 ; This is list of symbols added in Windows 8
+F_ARM32(__jump_unwind)
 _errno
 F_I386(_except_handler4_common)
 F_I386(_ftol2)
@@ -241,16 +251,3 @@ _vscprintf
 ; _libm_sse2_cos_precise
 ; _libm_sse2_sin_precise
 ; _libm_sse2_sqrt_precise
-
-
-
-; Unsorted list of symbols not available in any 32-bit x86 version of 
ntdll.dll library
-F_NON_I386(__C_specific_handler)
-; F_NON_I386(__chkstk)
-F_X64(__misaligned_access)
-F_ARM32(__jump_unwind)
-F64(_local_unwind)
-F_X64(_setjmp)
-F_ARM32(_setjmp)
-F_NON_I386(_setjmpex)
-F_NON_I386(longjmp)
-- 
2.20.1

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to