On 6/2/20 10:33 AM, Liu Hao wrote:
> 在 2020/6/2 23:01, Zebediah Figura 写道:
>>
>> My understanding is that NTAPI is necessary even where not present in
>> Microsoft's headers, in order to add a calling-convention attribute to
>> functions that do not otherwise have it. See e.g. KdDisableDebugger()
>> and PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE, to pick two examples at
>> random.
> 
> Without a calling convention specification the default one is `__cdecl`,
> and will probably cause crashes if they don't match.  MSVC has an option
> to set default calling convention to `__stdcall`, but I am not sure
> about whether it is the default for kernel-mode libraries.
> 
> 
I don't know the details of MSVC, but the default is definitely stdcall
for kernel-mode libraries (and I believe user-mode as well). For a
clearer example, see IoCreateDevice(), which has no calling-convention
decoration in Microsoft's headers, but is definitely stdcall, or else
Wine's ntoskrnl unit tests would surely crash.


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

Reply via email to