vs2008程序再win7上运行出现无法解释的问题
公司最近将工作的电脑系统从xp换成了win7,新开发了一个程序,出现了很诡异的情况,程序不管是编译运行还是独立运行,偶尔会出现启动就出错。调试发现在调用_DllMainCRTStartup中调用__security_init_cookie出现错误。在代码没修改的情况下重新编译一下又正常了,过段时间又这样。有时还不需要编译,只需要把执行文件拷贝到其他目录也能运行,真是无语。
void __cdecl __security_init_cookie(void)
{
UINT_PTR cookie;
FT systime={0};
LARGE_INTEGER perfctr;
/*
* Do nothing if the global cookie has already been initialized. On x86,
* reinitialize the cookie if it has been previously initialized to a
* value with the high word 0x0000. Some versions of Windows will init
* the cookie in the loader, but using an older mechanism which forced the
* high word to zero.
*/
if (__security_cookie != DEFAULT_SECURITY_COOKIE
#if defined (_X86_)
&& (__security_cookie & 0xFFFF0000) != 0 //调试错误断点就再这里,高手们是啥原因
#endif /* defined (_X86_) */
)
{
__security_cookie_complement = ~__security_cookie;
return;
}
}