OSDN Git Service

Change behavior of automatic IPv4/IPv6 selection.
[ffftp/ffftp.git] / socketwrapper.c
index 6ebe36d..79fbee4 100644 (file)
@@ -717,10 +717,11 @@ DWORD WINAPI WSAAsyncGetHostByNameIPv6ThreadProc(LPVOID lpParameter)
        }\r
        else\r
                PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(ERROR_INVALID_FUNCTION << 16));\r
-       free(pData->name);\r
-       free(pData);\r
        // CreateThreadが返すハンドルが重複するのを回避\r
        Sleep(10000);\r
+       CloseHandle(pData->h);\r
+       free(pData->name);\r
+       free(pData);\r
        return 0;\r
 }\r
 \r
@@ -1046,8 +1047,16 @@ BOOL LoadPuTTY()
        RegisterTrustedModuleSHA1Hash("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");\r
 #endif\r
        // デバッグ用\r
-//     g_hPuTTY = LoadLibrary("putty.dll");\r
-       g_hPuTTY = LoadLibrary("C:\\SourceForge\\ffftp\\putty\\Debug\\PuTTY.dll");\r
+#ifdef _DEBUG\r
+       {\r
+               char Path[MAX_PATH];\r
+               GetModuleFileName(NULL, Path, MAX_PATH);\r
+               strcpy(strrchr(Path, '\\'), "\\..\\putty\\Debug\\PuTTY.dll");\r
+               g_hPuTTY = LoadLibrary(Path);\r
+       }\r
+#else\r
+       g_hPuTTY = LoadLibrary("putty.dll");\r
+#endif\r
        if(!g_hPuTTY\r
                || !(p_SFTP_Create = (_SFTP_Create)GetProcAddress(g_hPuTTY, "SFTP_Create"))\r
                || !(p_SFTP_Destroy = (_SFTP_Destroy)GetProcAddress(g_hPuTTY, "SFTP_Destroy"))\r