开发者

SystemTimeToTzSpecificLocalTime crash on windows xp

The time function in the same code crashes on xp but runs fine on windows 2003 machine. Any ideas?

    TIME_ZONE_INFORMATION   tzi;

    SYSTEMTIME              stStartUTC;

    SYSTEMTIME              stStart;

    LPCSTR                  lpszZone;

    BOOL                    bStatus;

    FILETIME*                pFT;开发者_如何学编程

    DWORD  dReturn;

    pFT = new FILETIME;

if (pFT)

{

    pFT->dwHighDateTime = 4294967295ul;
    pFT->dwLowDateTime = 4294962295ul;

    if (pFT)
    {
        FileTimeToSystemTime (pFT, &stStartUTC);
    }
    else
    {
        GetSystemTime (&stStartUTC);
    }


    dReturn = GetTimeZoneInformation (&tzi);

    bStatus = SystemTimeToTzSpecificLocalTime (&tzi, &stStartUTC, &stStart);

}

Stack from the crash dump is :

0816e968 7c85a6f2 00000000 00000024 7c85a6f8 kernel32!__report_gsfailure+0xda

0816ebf8 7c85a788 0816ec10 0816ec70 0000a8f0 kernel32!FindRegTziForCurrentYear+0x1a5

0816ec3c 7c85a7bd 0816ec70 0000a8f0 0816eec4 kernel32!CheckDynamicTimeZoneInformation+0x29

0816ec54 7c85a834 0816ec70 0000a8f0 0816eec4 kernel32!GetDynamicTimeZoneInfoForTimeZone+0x17

0816ee7c 7c83b11c 0000a8f0 00000000 0816eec4 kernel32!GetTimeZoneInformationForYear+0x58

0816f020 14f27e38 0816f05c 0816f03c 0816f04c kernel32!SystemTimeToTzSpecificLocalTime+0x3c

Thanks, Mithuna


Try adding a GetLastError call to check if every function upto the SystemTimeToTzSpecificLocalTime succeeds or not. That should give you some hint.


The __report_gsfailure on the stack frame is significant. That's a CRT function that's called when a security error was detected. Review the /GS command line options for the MSVC compiler. The most common cause is a corrupted stack frame.

I see no obvious reason in your code snippet for this mishap, it is already deeply nested inside Windows. Maybe corruption in the registry that in turn causes a buffer overflow. You should be able to find out where by using SysInternals' ProcMon utility.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜