我一直在搜索互联网,我不知道为什么发生这种情况,这不是一个明显的数组问题。运行时检查失败#2 - 变量'osvi'周围的堆栈在mfc应用程序中被破坏
这里的功能:
BOOL IsOsCompatible()
{
BOOL retVal = 0;
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(&osvi);
if(osvi.dwMajorVersion == 6)
{
if(osvi.dwMinorVersion == 0)
{
if(SendErrorM("This program has not been tested on Windows Vista(TM).\nAre you sure you want to use it?",MB_YESNO) == IDYES)
retVal = 1;
}
else if(osvi.dwMinorVersion == 1)
{
retVal = 1;
}
else if(osvi.dwMinorVersion == 2)
{
if(SendErrorM("This program has not been tested on Windows 8(TM).\nAre you sure you want to use it?",MB_YESNO) == IDYES)
retVal = 1;
}
}
else
SendErrorM("Your windows verison is incompatible with the minimum requirements of this application.",NULL);
return retVal;
}
任何想法?
我完全同意这一点,当我试图清理代码并将'OSVERSIONINFOEX'改为他的小弟弟时出现问题...... – Nutterz