You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the events ApplicationData or Comment will fail in x86 due to stack corruption.
Root cause
The callback functions are marked _stdcall. This is the default calling convention .NET uses to interact with native code.
In .NET the user_context argument is not used as .NET has its own mechanism to forward the callback to a class member method.
The delegate definitions in C# are missing the user_context parameter, which means a mismatch between the C++ and the C# definition.
The _stdcall calling convention defines that the callee cleans up the stack. In x64 mode the arguments are passed in registers and the stack is correctly cleaned up. In x86 mode some parameters are passed on the stack and the clean-up will fail due to the mismatch in function pointer definitions.
The text was updated successfully, but these errors were encountered:
Using the events ApplicationData or Comment will fail in x86 due to stack corruption.
Root cause
The callback functions are marked _stdcall. This is the default calling convention .NET uses to interact with native code.
In .NET the user_context argument is not used as .NET has its own mechanism to forward the callback to a class member method.
The delegate definitions in C# are missing the user_context parameter, which means a mismatch between the C++ and the C# definition.
The _stdcall calling convention defines that the callee cleans up the stack. In x64 mode the arguments are passed in registers and the stack is correctly cleaned up. In x86 mode some parameters are passed on the stack and the clean-up will fail due to the mismatch in function pointer definitions.
The text was updated successfully, but these errors were encountered: