Fixed the issue that PingPlugin crashes Rainmeter after refresh if offline (no network) or ping timed out in Vista/7.

This commit is contained in:
spx 2010-06-09 09:21:51 +00:00
parent e0ea862d72
commit 0ffbb7e901

View File

@ -200,7 +200,8 @@ DWORD WINAPI NetworkThreadProc(LPVOID pParam)
{
pingData* pData = (pingData*)pParam;
BYTE reply[sizeof(ICMP_ECHO_REPLY) + 32];
const DWORD replySize = sizeof(ICMP_ECHO_REPLY) + 32;
BYTE* reply = new BYTE[replySize];
HANDLE hIcmpFile;
hIcmpFile = g_IcmpCreateFile();
@ -214,7 +215,7 @@ DWORD WINAPI NetworkThreadProc(LPVOID pParam)
0,
NULL,
reply,
sizeof(reply),
replySize,
pData->timeout);
g_IcmpCloseHandle(hIcmpFile);
@ -231,6 +232,7 @@ DWORD WINAPI NetworkThreadProc(LPVOID pParam)
pData->value = pReply->RoundTripTime;
}
delete [] reply;
CloseHandle(pData->threadHandle);
pData->threadHandle = 0;
LeaveCriticalSection(&g_CriticalSection);