gpt4 book ai didi

c++ - Windows xp 上的 SystemTimeToTzSpecificLocalTime 崩溃

转载 作者:行者123 更新时间:2023-11-28 01:12:12 25 4
gpt4 key购买 nike

同一代码中的时间函数在 xp 上崩溃但在 windows 2003 机器上运行良好。有什么想法吗?

    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);

}

故障转储中的堆栈是:

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

谢谢,米苏纳

最佳答案

尝试添加一个 GetLastError 调用来检查 SystemTimeToTzSpecificLocalTime 之前的每个函数是否成功。这应该会给你一些提示。

关于c++ - Windows xp 上的 SystemTimeToTzSpecificLocalTime 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2225602/

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