From 0ffbb7e90187b90e807a9083319c6ad790f283cf Mon Sep 17 00:00:00 2001 From: spx Date: Wed, 9 Jun 2010 09:21:51 +0000 Subject: [PATCH] Fixed the issue that PingPlugin crashes Rainmeter after refresh if offline (no network) or ping timed out in Vista/7. --- Plugins/PluginPing/Ping.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/PluginPing/Ping.cpp b/Plugins/PluginPing/Ping.cpp index c87dfd9e..b49a40ca 100644 --- a/Plugins/PluginPing/Ping.cpp +++ b/Plugins/PluginPing/Ping.cpp @@ -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);