From d60fbed343e32116dd85c4f756404a1be532a4fc Mon Sep 17 00:00:00 2001 From: Alexander Gluzsky Date: Wed, 17 Oct 2012 10:22:44 +0000 Subject: fixed startup crash git-svn-id: http://svn.miranda-ng.org/main/trunk@1968 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/!NotAdopted/Skype/skype.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/plugins/!NotAdopted/Skype/skype.c b/plugins/!NotAdopted/Skype/skype.c index 1210b503c4..39a8c0c47f 100755 --- a/plugins/!NotAdopted/Skype/skype.c +++ b/plugins/!NotAdopted/Skype/skype.c @@ -3290,7 +3290,7 @@ int __declspec(dllexport) Load() HKEY MyKey; BOOL SkypeInstalled; BOOL UseCustomCommand; - WSADATA wsaData; + WSADATA wsaData = {0}; char path[MAX_PATH]; mir_getLP(&pluginInfo); @@ -3345,24 +3345,35 @@ int __declspec(dllexport) Load() if (!UseSockets && !UseCustomCommand) { + BOOL is_key_opened = FALSE; if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS) { if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey)!=ERROR_SUCCESS) { SkypeInstalled=FALSE; } + else + is_key_opened = TRUE; } + else + is_key_opened = TRUE; Buffsize=sizeof(skype_path); - if (SkypeInstalled==FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS) + if(is_key_opened) { - //OUTPUT("Skype was not found installed :( \nMaybe you are using portable skype."); + if (SkypeInstalled==FALSE) + skype_path[0]=0; + else if (RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize)!=ERROR_SUCCESS) + { + //OUTPUT("Skype was not found installed :( \nMaybe you are using portable skype."); RegCloseKey(MyKey); skype_path[0]=0; //return 0; + } + else + RegCloseKey(MyKey); } - RegCloseKey(MyKey); } WSAStartup(MAKEWORD(2,2), &wsaData); -- cgit v1.2.3