I am trying to implement a c runtime in rust for msvc/windows.

But I don’t know how to implement
__GSHandlerCheck
__security_check_cookie

__security_cookie

when using msvc to compiling debug code.

Who knows how to implement these three functions or possible alternatives.

How fortunately I’ve been passing by and stumbled upon this thread. Here is my implementation:

uintptr_t __security_cookie = 0xAABBCCDD;

void __fastcall __security_check_cookie(uintptr_t cookie)
{
if (cookie != __security_cookie)
__debugbreak();
}

I think MSVC implements most of these in assembly. I’m not sure they all conform to any standard calling convention.