I am trying to learn software reverse engineering with Ghidra, though I have never used Visual Studio Compilers or the C runtime (CRT). I have a piece of decompiled C code:
<typeName> <functionName>(<typeName>)
{
ulonglong myVar;
__security_init_cookie();
myVar = __scrt_initialize_crt(1);
if ((char)myVar == '\0') {
// some code
}
}
where ulonglong
is Unsigned Long Long Integer
with a length of 8
according to Ghidra Decompiler.
I tried reading the __security_init_cookie()
documentation here, to no avail. And there is not much documentation about the __scrt_initialize_crt()
function.
I would appreciate it if you could help me understand what the above piece of code does.
P.S.1. More information about the __scrt_initialize_crt()
function here, and its input type __scrt_module_type
here.
P.S.2. I posted a follow-up question here on SO.