在 2025-12-26 07:08, Pali Rohár 写道:
PEXCEPTION_ROUTINE is a SEH handler function in which callee does not pop passed arguments, so it should have __cdecl keyword.In MS DDK this PEXCEPTION_ROUTINE type definition in ntdef.h was without an explicit calling convention up to the (including) DDK 3790.1830 (Windows Server 2003 with Service Pack 1 DDK), which correspondents to __cdecl.
The default calling convention is not always __cdecl. It can be changed to __stdcall with `-mrtd` (or `/Gz` for MSVC).
Starting from WDK 6000 (Windows Driver Kit for Windows Vista) there is NTAPI marker (which is __stdcall calling convention). MS probably added it here because no one was defined and most NT functions are using __stdcall. This is fine for AMD64 where both __stdcall and __cdecl are aliases, but it is incorrect for I386.
This inconsistency is known. Exception handlers in Microsoft CRT are __cdecl. But despite that, it actually work with either __cdecl or __stdcall.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
