gpt4 book ai didi

c - __security_init_cookie 和 PI

转载 作者:太空宇宙 更新时间:2023-11-04 03:36:51 25 4
gpt4 key购买 nike

<分区>

我在C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\gs_support.c中找到了这个函数

  1. 0xBB40E64E=3141592654=PI - 当平台不是 win64 时,为什么 DEFAULT_SECURITY_COOKIE 设置为此值?

  2. 为什么systemtimeProcessIdThreadIdTickCount之间有很多异或运算,等等

  3. 数字 0x00002B992DDFA232 是什么意思?

#ifdef _WIN64
#define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232
#else
#define DEFAULT_SECURITY_COOKIE 0xBB40E64E
#endif

extern UINT_PTR __security_cookie;
extern UINT_PTR __security_cookie_complement;

typedef union {
unsigned __int64 ft_scalar;
FILETIME ft_struct;
} FT;
void __cdecl __security_init_cookie(void)
{
UINT_PTR cookie;
FT systime={0};
LARGE_INTEGER perfctr;

if (__security_cookie != DEFAULT_SECURITY_COOKIE
#if defined (_X86_)
&& (__security_cookie & 0xFFFF0000) != 0
#endif
)
{
__security_cookie_complement = ~__security_cookie;
return;
}


GetSystemTimeAsFileTime(&systime.ft_struct);
#if defined (_WIN64)
cookie = systime.ft_scalar;
#else
cookie = systime.ft_struct.dwLowDateTime;
cookie ^= systime.ft_struct.dwHighDateTime;
#endif
cookie ^= GetCurrentProcessId();
cookie ^= GetCurrentThreadId();
cookie ^= GetTickCount();
QueryPerformanceCounter(&perfctr);
#if defined (_WIN64)
cookie ^= perfctr.QuadPart;
#else
cookie ^= perfctr.LowPart;
cookie ^= perfctr.HighPart;
#endif
#if defined (_WIN64)

cookie &= 0x0000FFFFffffFFFFi64;
#endif

if (cookie == DEFAULT_SECURITY_COOKIE)
{
cookie = DEFAULT_SECURITY_COOKIE + 1;
}
#if defined (_X86_)
else if ((cookie & 0xFFFF0000) == 0)
{
cookie |= ( (cookie|0x4711) << 16);
}
#endif
__security_cookie = cookie;
__security_cookie_complement = ~cookie;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com