• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revision700b7eb9066c105aaf9b42ad67ba43ee8c030f0b (tree)
Zeit2011-11-14 21:12:33
Autors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Fix bugs of routines for IPv6.
Fix bugs of opening wrong files when they contain no extensions.
Fix bugs of UTF-8 to UTF-16 API bridge.
Fix bugs of treating local filenames.
Modify documents.

Ändern Zusammenfassung

Diff

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/bookmark.c
+++ b/bookmark.c
@@ -31,6 +31,8 @@
3131 //#define WINVER 0x400
3232
3333 #define STRICT
34+// IPv6対応
35+#include <winsock2.h>
3436 #include <windows.h>
3537 #include <stdio.h>
3638 #include <stdlib.h>
--- a/cache.c
+++ b/cache.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/clipboard.c
+++ b/clipboard.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/codecnv.c
+++ b/codecnv.c
@@ -31,7 +31,9 @@
3131 #include <stdio.h>
3232 #include <stdlib.h>
3333 #include <string.h>
34-#include <winsock.h>
34+// IPv6対応
35+//#include <winsock.h>
36+#include <winsock2.h>
3537 #include <mbstring.h>
3638 #include <windowsx.h>
3739
--- a/common.h
+++ b/common.h
@@ -1695,6 +1695,8 @@ int ConvertNum(int x, int Dir, const INTCONVTBL *Tbl, int Num);
16951695 int MoveFileToTrashCan(char *Path);
16961696 LONGLONG MakeLongLong(DWORD High, DWORD Low);
16971697 char *MakeNumString(LONGLONG Num, char *Buf, BOOL Comma);
1698+// 異なるファイルが表示されるバグ修正
1699+char* MakeDistinguishableFileName(char* Out, char* In);
16981700
16991701 /*===== dlgsize.c =====*/
17001702
@@ -1751,10 +1753,6 @@ int do_send(SOCKET s, const char *buf, int len, int flags, int *TimeOutErr, int
17511753 void RemoveReceivedData(SOCKET s);
17521754 int CheckClosedAndReconnect(void);
17531755 void CheckAllEventClosed(void);
1754-// IPv6対応
1755-char* AddressToStringIPv6(char* str, void* in6);
1756-char* inet6_ntoa(struct in6_addr in6);
1757-struct in6_addr inet6_addr(const char* cp);
17581756
17591757 /*===== updatebell.c =====*/
17601758
--- a/connect.c
+++ b/connect.c
@@ -37,7 +37,7 @@
3737 #include <time.h>
3838 // IPv6対応
3939 //#include <winsock.h>
40-#include <ws2tcpip.h>
40+#include <winsock2.h>
4141 #include <windowsx.h>
4242 #include <commctrl.h>
4343
--- a/diskfree.c
+++ b/diskfree.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -35,7 +37,8 @@
3537 #include <mbstring.h>
3638 #include <malloc.h>
3739 #include <windowsx.h>
38-#include <winsock.h>
40+// IPv6対応
41+//#include <winsock.h>
3942
4043 #include "common.h"
4144 #include "resource.h"
--- a/dlgsize.c
+++ b/dlgsize.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/doc/eng/FFFTP.txt
+++ b/doc/eng/FFFTP.txt
@@ -49,6 +49,10 @@ Changes in Ver.1.99
4949
5050 -- Changed to detect encoding of strings in INI file automatically.
5151
52+-- Added settings to reuse connection of the main window for transfer threads.
53+ This may allow to transfer files successfully as with 1.97b or earlier,
54+ but sometimes may cause some errors.
55+
5256
5357 Outline
5458 -------
--- a/doc/eng/history.txt
+++ b/doc/eng/history.txt
@@ -47,6 +47,10 @@ Changes in Ver.1.98c
4747
4848 -- Changed size and layout of the window at the first run.
4949
50+-- Added settings to reuse connection of the main window for transfer threads.
51+ This may allow to transfer files successfully as with 1.97b or earlier,
52+ but sometimes may cause some errors.
53+
5054 Changes in Ver.1.98b
5155 --------------------
5256
--- a/doc/jpn/FFFTP.txt
+++ b/doc/jpn/FFFTP.txt
@@ -51,6 +51,10 @@ Ver 1.99
5151
5252 ・INIファイルの文字列の文字コードを自動判別するように変更しました。
5353
54+・メインウィンドウが使用している接続を転送用に再使用するための設定を
55+ 追加しました。これにより1.97b以前で転送可能だったが1.98で転送不能に
56+ なるという症状が改善されますが、不具合が発生する可能性があります。
57+
5458
5559 Ver 1.96d以前へ戻す場合
5660 -----------------------
--- a/doc/jpn/history.txt
+++ b/doc/jpn/history.txt
@@ -23,6 +23,10 @@ FFFTP
2323
2424 ・INIファイルの文字列の文字コードを自動判別するように変更しました。
2525
26+・メインウィンドウが使用している接続を転送用に再使用するための設定を
27+ 追加しました。これにより1.97b以前で転送可能だったが1.98で転送不能に
28+ なるという症状が改善されますが、不具合が発生する可能性があります。
29+
2630 ■Ver 1.98c
2731
2832 ・日本語ドメイン名のホストへの接続時にアドレスをPunycodeへ変換してから
--- a/filelist.c
+++ b/filelist.c
@@ -31,6 +31,8 @@
3131 //#define _WIN32_WINNT 0x400
3232
3333 #define STRICT
34+// IPv6対応
35+#include <winsock2.h>
3436 #include <windows.h>
3537 #include <stdio.h>
3638 #include <stdlib.h>
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -2098,7 +2100,9 @@ static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDi
20982100 {
20992101 sprintf(TmpString, "%s", Path);
21002102
2101- if(AskHostType() == HTYPE_VMS)
2103+ // ローカルのファイルのパスの最後の'\\'が消えるバグ修正
2104+// if(AskHostType() == HTYPE_VMS)
2105+ if(Win == WIN_REMOTE && AskHostType() == HTYPE_VMS)
21022106 ReformToVMSstylePathName(TmpString);
21032107
21042108 CurWin = Win;
--- a/getput.c
+++ b/getput.c
@@ -43,7 +43,7 @@
4343 #include <time.h>
4444 // IPv6対応
4545 //#include <winsock.h>
46-#include <ws2tcpip.h>
46+#include <winsock2.h>
4747 #include <windowsx.h>
4848 #include <commctrl.h>
4949 #include <process.h>
--- a/history.c
+++ b/history.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -37,7 +39,8 @@
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <stdarg.h>
40-#include <winsock.h>
42+// IPv6対応
43+//#include <winsock.h>
4144
4245 #include "common.h"
4346 #include "resource.h"
--- a/hostman.c
+++ b/hostman.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/local.c
+++ b/local.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -182,8 +184,6 @@ void DispFileProperty(char *Fname)
182184 {
183185 SHELLEXECUTEINFO sInfo;
184186 // 異なるファイルが表示されるバグ修正
185- // UNCでない場合に末尾に半角スペースを置くと拡張子の補完がされなくなる
186- // 現在UNC対応の予定は無い
187187 char Fname2[FMAX_PATH+1];
188188
189189 memset(&sInfo, NUL, sizeof(SHELLEXECUTEINFO));
@@ -193,9 +193,7 @@ void DispFileProperty(char *Fname)
193193 sInfo.lpVerb = "Properties";
194194 // 異なるファイルが表示されるバグ修正
195195 // sInfo.lpFile = Fname;
196- strcpy(Fname2, Fname);
197- strcat(Fname2, " ");
198- sInfo.lpFile = Fname2;
196+ sInfo.lpFile = MakeDistinguishableFileName(Fname2, Fname);
199197 sInfo.lpParameters = NULL;
200198 sInfo.lpDirectory = NULL;
201199 sInfo.nShow = SW_NORMAL;
--- a/lvtips.c
+++ b/lvtips.c
@@ -30,6 +30,8 @@
3030 /* このソースは MFC Programmer's SourceBook (http://www.codeguru.com/)を参考にしました */
3131
3232 #define STRICT
33+// IPv6対応
34+#include <winsock2.h>
3335 #include <windows.h>
3436 #include <stdio.h>
3537 #include <stdlib.h>
--- a/main.c
+++ b/main.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -37,7 +39,8 @@
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <stdarg.h>
40-#include <winsock.h>
42+// IPv6対応
43+//#include <winsock.h>
4144
4245 #include "common.h"
4346 #include "resource.h"
@@ -2476,7 +2479,7 @@ void ExecViewer(char *Fname, int App)
24762479 // 任意のコードが実行されるバグ修正
24772480 // 拡張子が無いと補完されるため
24782481 // if((App == -1) && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))
2479- if((App == -1) && strrchr(Fname, '.') > strrchr(Fname, '\\') && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))
2482+ if((App == -1) && (strlen(GetFileExt(GetFileName(Fname))) > 0) && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))
24802483 {
24812484 DoPrintf("ShellExecute - %s", Fname);
24822485 ShellExecute(NULL, "open", Fname, NULL, CurDir, SW_SHOW);
--- a/mbswrapper.c
+++ b/mbswrapper.c
@@ -7,6 +7,7 @@
77 #define UNICODE
88 #define _UNICODE
99
10+#include <stdio.h>
1011 #include <tchar.h>
1112 #include <direct.h>
1213 #include <windows.h>
@@ -2149,12 +2150,11 @@ START_ROUTINE
21492150 while((c = GetNextCharM(_Str, &p)) > 0)
21502151 {
21512152 if(c == _Ch)
2152- {
2153- r = (unsigned char*)_Str;
21542153 break;
2155- }
21562154 _Str = p;
21572155 }
2156+ if(c == _Ch)
2157+ r = (unsigned char*)_Str;
21582158 END_ROUTINE
21592159 return r;
21602160 }
@@ -2171,6 +2171,8 @@ START_ROUTINE
21712171 r = (unsigned char*)_Str;
21722172 _Str = p;
21732173 }
2174+ if(c == _Ch)
2175+ r = (unsigned char*)_Str;
21742176 END_ROUTINE
21752177 return r;
21762178 }
--- a/misc.c
+++ b/misc.c
@@ -33,7 +33,9 @@
3333 #include <stdarg.h>
3434 #include <string.h>
3535 #include <mbstring.h>
36-#include <winsock.h>
36+// IPv6対応
37+//#include <winsock.h>
38+#include <winsock2.h>
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <shlobj.h>
@@ -1724,3 +1726,44 @@ char *MakeNumString(LONGLONG Num, char *Buf, BOOL Comma)
17241726 }
17251727
17261728
1729+// 異なるファイルが表示されるバグ修正
1730+
1731+// ShellExecute等で使用されるファイル名を修正
1732+// UNCでない場合に末尾の半角スペースは無視されるため拡張子が補完されなくなるまで半角スペースを追加
1733+// 現在UNC対応の予定は無い
1734+char* MakeDistinguishableFileName(char* Out, char* In)
1735+{
1736+ char Tmp[FMAX_PATH+1];
1737+ char Tmp2[FMAX_PATH+3];
1738+ HANDLE hFind;
1739+ WIN32_FIND_DATA Find;
1740+ if(strlen(GetFileExt(GetFileName(In))) > 0)
1741+ strcpy(Out, In);
1742+ else
1743+ {
1744+ strcpy(Tmp, In);
1745+ strcpy(Tmp2, Tmp);
1746+ strcat(Tmp2, ".*");
1747+ while(strlen(Tmp) < FMAX_PATH && (hFind = FindFirstFile(Tmp2, &Find)) != INVALID_HANDLE_VALUE)
1748+ {
1749+ do
1750+ {
1751+ if(strchr(Find.cFileName, '.'))
1752+ break;
1753+ }
1754+ while(FindNextFile(hFind, &Find));
1755+ FindClose(hFind);
1756+ if(strchr(Find.cFileName, '.'))
1757+ {
1758+ strcat(Tmp, " ");
1759+ strcpy(Tmp2, Tmp);
1760+ strcat(Tmp2, ".*");
1761+ }
1762+ else
1763+ break;
1764+ }
1765+ strcpy(Out, Tmp);
1766+ }
1767+ return Out;
1768+}
1769+
--- a/option.c
+++ b/option.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/ras.c
+++ b/ras.c
@@ -32,6 +32,8 @@
3232 // UTF-8対応
3333 //#define WINVER 0x400
3434
35+// IPv6対応
36+#include <winsock2.h>
3537 #include <windows.h>
3638 #include <stdio.h>
3739 #include <stdlib.h>
@@ -39,7 +41,8 @@
3941 #include <mbstring.h>
4042 #include <malloc.h>
4143 #include <windowsx.h>
42-#include <winsock.h>
44+// IPv6対応
45+//#include <winsock.h>
4346 #include <ras.h>
4447 #include <rasdlg.h>
4548 #include <raserror.h>
--- a/regexp.c
+++ b/regexp.c
@@ -30,7 +30,9 @@
3030 #define STRICT
3131 #include <stdio.h>
3232 #include <stdlib.h>
33-#include <winsock.h>
33+// IPv6対応
34+//#include <winsock.h>
35+#include <winsock2.h>
3436 #include <windowsx.h>
3537
3638 #include "common.h"
--- a/registry.c
+++ b/registry.c
@@ -33,6 +33,8 @@
3333 #endif
3434
3535 #define STRICT
36+// IPv6対応
37+#include <winsock2.h>
3638 #include <windows.h>
3739 #include <stdio.h>
3840 #include <stdlib.h>
--- a/remote.c
+++ b/remote.c
@@ -36,7 +36,9 @@
3636 #include <string.h>
3737 #include <mbstring.h>
3838 #include <time.h>
39-#include <winsock.h>
39+// IPv6対応
40+//#include <winsock.h>
41+#include <winsock2.h>
4042 #include <windowsx.h>
4143 #include <commctrl.h>
4244
--- a/skey.c
+++ b/skey.c
@@ -32,7 +32,9 @@
3232 #define STRICT
3333 #include <stdlib.h>
3434 #include <string.h>
35-#include <winsock.h>
35+// IPv6対応
36+//#include <winsock.h>
37+#include <winsock2.h>
3638 #include <windowsx.h>
3739
3840 #include "common.h"
--- a/socket.c
+++ b/socket.c
@@ -29,7 +29,7 @@
2929
3030 #define STRICT
3131 // IPv6対応
32-#include <ws2tcpip.h>
32+#include <winsock2.h>
3333 #include <windows.h>
3434 #include <stdio.h>
3535 #include <stdlib.h>
@@ -40,8 +40,6 @@
4040
4141 #include "common.h"
4242 #include "resource.h"
43-// UTF-8対応
44-#include "punycode.h"
4543
4644 #define USE_THIS 1
4745 #define DBG_MSG 0
@@ -97,10 +95,6 @@ static int RegistAsyncTable(SOCKET s);
9795 static int RegistAsyncTableDbase(HANDLE Async);
9896 static int UnRegistAsyncTable(SOCKET s);
9997 static int UnRegistAsyncTableDbase(HANDLE Async);
100-// UTF-8対応
101-static HANDLE WSAAsyncGetHostByNameM(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen);
102-// IPv6対応
103-static HANDLE WSAAsyncGetHostByNameIPv6M(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family);
10498
10599
106100 /*===== 外部参照 =====*/
@@ -1231,357 +1225,3 @@ int CheckClosedAndReconnect(void)
12311225
12321226
12331227
1234-// IPv6対応
1235-
1236-typedef struct
1237-{
1238- HANDLE h;
1239- HWND hWnd;
1240- u_int wMsg;
1241- char * name;
1242- char * buf;
1243- int buflen;
1244- short Family;
1245-} GETHOSTBYNAMEDATA;
1246-
1247-static DWORD WINAPI WSAAsyncGetHostByNameIPv6ThreadProc(LPVOID lpParameter)
1248-{
1249- GETHOSTBYNAMEDATA* pData;
1250- struct hostent* pHost;
1251- struct addrinfo* pAddr;
1252- struct addrinfo* p;
1253- pHost = NULL;
1254- pData = (GETHOSTBYNAMEDATA*)lpParameter;
1255- if(getaddrinfo(pData->name, NULL, NULL, &pAddr) == 0)
1256- {
1257- p = pAddr;
1258- while(p)
1259- {
1260- if(p->ai_family == pData->Family)
1261- {
1262- switch(p->ai_family)
1263- {
1264- case AF_INET:
1265- pHost = (struct hostent*)pData->buf;
1266- if((size_t)pData->buflen >= sizeof(struct hostent) + sizeof(char*) * 2 + sizeof(struct in_addr)
1267- && p->ai_addrlen >= sizeof(struct sockaddr_in))
1268- {
1269- pHost->h_name = NULL;
1270- pHost->h_aliases = NULL;
1271- pHost->h_addrtype = p->ai_family;
1272- pHost->h_length = sizeof(struct in_addr);
1273- pHost->h_addr_list = (char**)(&pHost[1]);
1274- pHost->h_addr_list[0] = (char*)(&pHost->h_addr_list[2]);
1275- pHost->h_addr_list[1] = NULL;
1276- memcpy(pHost->h_addr_list[0], &((struct sockaddr_in*)p->ai_addr)->sin_addr, sizeof(struct in_addr));
1277- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(sizeof(struct hostent) + sizeof(char*) * 2 + p->ai_addrlen));
1278- }
1279- else
1280- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(WSAENOBUFS << 16));
1281- break;
1282- case AF_INET6:
1283- pHost = (struct hostent*)pData->buf;
1284- if((size_t)pData->buflen >= sizeof(struct hostent) + sizeof(char*) * 2 + sizeof(struct in6_addr)
1285- && p->ai_addrlen >= sizeof(struct sockaddr_in6))
1286- {
1287- pHost->h_name = NULL;
1288- pHost->h_aliases = NULL;
1289- pHost->h_addrtype = p->ai_family;
1290- pHost->h_length = sizeof(struct in6_addr);
1291- pHost->h_addr_list = (char**)(&pHost[1]);
1292- pHost->h_addr_list[0] = (char*)(&pHost->h_addr_list[2]);
1293- pHost->h_addr_list[1] = NULL;
1294- memcpy(pHost->h_addr_list[0], &((struct sockaddr_in6*)p->ai_addr)->sin6_addr, sizeof(struct in6_addr));
1295- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(sizeof(struct hostent) + sizeof(char*) * 2 + p->ai_addrlen));
1296- }
1297- else
1298- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(WSAENOBUFS << 16));
1299- break;
1300- }
1301- }
1302- if(pHost)
1303- break;
1304- p = p->ai_next;
1305- }
1306- if(!p)
1307- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(ERROR_INVALID_FUNCTION << 16));
1308- freeaddrinfo(pAddr);
1309- }
1310- else
1311- PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(ERROR_INVALID_FUNCTION << 16));
1312- free(pData->name);
1313- free(pData);
1314- // CreateThreadが返すハンドルが重複するのを回避
1315- Sleep(10000);
1316- return 0;
1317-}
1318-
1319-// IPv6対応のWSAAsyncGetHostByName相当の関数
1320-// FamilyにはAF_INETまたはAF_INET6を指定可能
1321-// ただしANSI用
1322-static HANDLE WSAAsyncGetHostByNameIPv6(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family)
1323-{
1324- HANDLE hResult;
1325- GETHOSTBYNAMEDATA* pData;
1326- hResult = NULL;
1327- if(pData = malloc(sizeof(GETHOSTBYNAMEDATA)))
1328- {
1329- pData->hWnd = hWnd;
1330- pData->wMsg = wMsg;
1331- if(pData->name = malloc(sizeof(char) * (strlen(name) + 1)))
1332- {
1333- strcpy(pData->name, name);
1334- pData->buf = buf;
1335- pData->buflen = buflen;
1336- pData->Family = Family;
1337- if(pData->h = CreateThread(NULL, 0, WSAAsyncGetHostByNameIPv6ThreadProc, pData, CREATE_SUSPENDED, NULL))
1338- {
1339- ResumeThread(pData->h);
1340- hResult = pData->h;
1341- }
1342- }
1343- }
1344- if(!hResult)
1345- {
1346- if(pData)
1347- {
1348- if(pData->name)
1349- free(pData->name);
1350- free(pData);
1351- }
1352- }
1353- return hResult;
1354-}
1355-
1356-// WSAAsyncGetHostByNameIPv6用のWSACancelAsyncRequest相当の関数
1357-int WSACancelAsyncRequestIPv6(HANDLE hAsyncTaskHandle)
1358-{
1359- int Result;
1360- Result = SOCKET_ERROR;
1361- if(TerminateThread(hAsyncTaskHandle, 0))
1362- Result = 0;
1363- return Result;
1364-}
1365-
1366-char* AddressToStringIPv6(char* str, void* in6)
1367-{
1368- char* pResult;
1369- unsigned char* p;
1370- int MaxZero;
1371- int MaxZeroLen;
1372- int i;
1373- int j;
1374- char Tmp[5];
1375- pResult = str;
1376- p = (unsigned char*)in6;
1377- MaxZero = 8;
1378- MaxZeroLen = 1;
1379- for(i = 0; i < 8; i++)
1380- {
1381- for(j = i; j < 8; j++)
1382- {
1383- if(p[j * 2] != 0 || p[j * 2 + 1] != 0)
1384- break;
1385- }
1386- if(j - i > MaxZeroLen)
1387- {
1388- MaxZero = i;
1389- MaxZeroLen = j - i;
1390- }
1391- }
1392- strcpy(str, "");
1393- for(i = 0; i < 8; i++)
1394- {
1395- if(i == MaxZero)
1396- {
1397- if(i == 0)
1398- strcat(str, ":");
1399- strcat(str, ":");
1400- }
1401- else if(i < MaxZero || i >= MaxZero + MaxZeroLen)
1402- {
1403- sprintf(Tmp, "%x", (((int)p[i * 2] & 0xff) << 8) | ((int)p[i * 2 + 1] & 0xff));
1404- strcat(str, Tmp);
1405- if(i < 7)
1406- strcat(str, ":");
1407- }
1408- }
1409- return pResult;
1410-}
1411-
1412-// IPv6対応のinet_ntoa相当の関数
1413-// ただしANSI用
1414-char* inet6_ntoa(struct in6_addr in6)
1415-{
1416- char* pResult;
1417- static char Adrs[40];
1418- pResult = NULL;
1419- memset(Adrs, 0, sizeof(Adrs));
1420- pResult = AddressToStringIPv6(Adrs, &in6);
1421- return pResult;
1422-}
1423-
1424-// IPv6対応のinet_addr相当の関数
1425-// ただしANSI用
1426-struct in6_addr inet6_addr(const char* cp)
1427-{
1428- struct in6_addr Result;
1429- int AfterZero;
1430- int i;
1431- char* p;
1432- memset(&Result, 0, sizeof(Result));
1433- AfterZero = 0;
1434- for(i = 0; i < 8; i++)
1435- {
1436- if(!cp)
1437- {
1438- memset(&Result, 0xff, sizeof(Result));
1439- break;
1440- }
1441- if(i >= AfterZero)
1442- {
1443- if(strncmp(cp, ":", 1) == 0)
1444- {
1445- cp = cp + 1;
1446- if(i == 0 && strncmp(cp, ":", 1) == 0)
1447- cp = cp + 1;
1448- p = (char*)cp;
1449- AfterZero = 7;
1450- while(p = strstr(p, ":"))
1451- {
1452- p = p + 1;
1453- AfterZero--;
1454- }
1455- }
1456- else
1457- {
1458- Result.u.Word[i] = (USHORT)strtol(cp, &p, 16);
1459- Result.u.Word[i] = ((Result.u.Word[i] & 0xff00) >> 8) | ((Result.u.Word[i] & 0x00ff) << 8);
1460- if(strncmp(p, ":", 1) != 0 && strlen(p) > 0)
1461- {
1462- memset(&Result, 0xff, sizeof(Result));
1463- break;
1464- }
1465- if(cp = strstr(cp, ":"))
1466- cp = cp + 1;
1467- }
1468- }
1469- }
1470- return Result;
1471-}
1472-
1473-// UTF-8対応
1474-
1475-static BOOL ConvertStringToPunycode(LPSTR Output, DWORD Count, LPCSTR Input)
1476-{
1477- BOOL bResult;
1478- punycode_uint* pUnicode;
1479- punycode_uint* p;
1480- BOOL bNeeded;
1481- LPCSTR InputString;
1482- punycode_uint Length;
1483- punycode_uint OutputLength;
1484- bResult = FALSE;
1485- if(pUnicode = malloc(sizeof(punycode_uint) * strlen(Input)))
1486- {
1487- p = pUnicode;
1488- bNeeded = FALSE;
1489- InputString = Input;
1490- Length = 0;
1491- while(*InputString != '\0')
1492- {
1493- *p = (punycode_uint)GetNextCharM(InputString, &InputString);
1494- if(*p >= 0x80)
1495- bNeeded = TRUE;
1496- p++;
1497- Length++;
1498- }
1499- if(bNeeded)
1500- {
1501- if(Count >= strlen("xn--") + 1)
1502- {
1503- strcpy(Output, "xn--");
1504- OutputLength = Count - strlen("xn--");
1505- if(punycode_encode(Length, pUnicode, NULL, (punycode_uint*)&OutputLength, Output + strlen("xn--")) == punycode_success)
1506- {
1507- Output[strlen("xn--") + OutputLength] = '\0';
1508- bResult = TRUE;
1509- }
1510- }
1511- }
1512- free(pUnicode);
1513- }
1514- if(!bResult)
1515- {
1516- if(Count >= strlen(Input) + 1)
1517- {
1518- strcpy(Output, Input);
1519- bResult = TRUE;
1520- }
1521- }
1522- return bResult;
1523-}
1524-
1525-static BOOL ConvertNameToPunycode(LPSTR Output, LPCSTR Input)
1526-{
1527- BOOL bResult;
1528- DWORD Length;
1529- char* pm0;
1530- char* pm1;
1531- char* p;
1532- char* pNext;
1533- bResult = FALSE;
1534- Length = strlen(Input);
1535- if(pm0 = AllocateStringM(Length + 1))
1536- {
1537- if(pm1 = AllocateStringM(Length * 4 + 1))
1538- {
1539- strcpy(pm0, Input);
1540- p = pm0;
1541- while(p)
1542- {
1543- if(pNext = strchr(p, '.'))
1544- {
1545- *pNext = '\0';
1546- pNext++;
1547- }
1548- if(ConvertStringToPunycode(pm1, Length * 4, p))
1549- strcat(Output, pm1);
1550- if(pNext)
1551- strcat(Output, ".");
1552- p = pNext;
1553- }
1554- bResult = TRUE;
1555- FreeDuplicatedString(pm1);
1556- }
1557- FreeDuplicatedString(pm0);
1558- }
1559- return bResult;
1560-}
1561-
1562-static HANDLE WSAAsyncGetHostByNameM(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen)
1563-{
1564- HANDLE r = NULL;
1565- char* pa0 = NULL;
1566- if(pa0 = AllocateStringA(strlen(name) * 4))
1567- {
1568- if(ConvertNameToPunycode(pa0, name))
1569- r = WSAAsyncGetHostByName(hWnd, wMsg, pa0, buf, buflen);
1570- }
1571- FreeDuplicatedString(pa0);
1572- return r;
1573-}
1574-
1575-static HANDLE WSAAsyncGetHostByNameIPv6M(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family)
1576-{
1577- HANDLE r = NULL;
1578- char* pa0 = NULL;
1579- if(pa0 = AllocateStringA(strlen(name) * 4))
1580- {
1581- if(ConvertNameToPunycode(pa0, name))
1582- r = WSAAsyncGetHostByNameIPv6(hWnd, wMsg, pa0, buf, buflen, Family);
1583- }
1584- FreeDuplicatedString(pa0);
1585- return r;
1586-}
1587-
--- a/socketwrapper.c
+++ b/socketwrapper.c
@@ -2,15 +2,19 @@
22 // Copyright (C) 2011 Suguru Kawamoto
33 // ソケットラッパー
44 // socket関連関数をOpenSSL用に置換
5+// socket関連関数のIPv6対応
56 // コンパイルにはOpenSSLのヘッダーファイルが必要
67 // 実行にはOpenSSLのDLLが必要
78
9+#include <ws2tcpip.h>
810 #include <windows.h>
911 #include <mmsystem.h>
1012 #include <openssl/ssl.h>
1113
1214 #include "socketwrapper.h"
1315 #include "protectprocess.h"
16+#include "mbswrapper.h"
17+#include "punycode.h"
1418
1519 typedef void (__cdecl* _SSL_load_error_strings)();
1620 typedef int (__cdecl* _SSL_library_init)();
@@ -581,3 +585,355 @@ int recvS(SOCKET s, char * buf, int len, int flags)
581585 return p_SSL_read(*ppSSL, buf, len);
582586 }
583587
588+// IPv6対応
589+
590+typedef struct
591+{
592+ HANDLE h;
593+ HWND hWnd;
594+ u_int wMsg;
595+ char * name;
596+ char * buf;
597+ int buflen;
598+ short Family;
599+} GETHOSTBYNAMEDATA;
600+
601+DWORD WINAPI WSAAsyncGetHostByNameIPv6ThreadProc(LPVOID lpParameter)
602+{
603+ GETHOSTBYNAMEDATA* pData;
604+ struct hostent* pHost;
605+ struct addrinfo* pAddr;
606+ struct addrinfo* p;
607+ pHost = NULL;
608+ pData = (GETHOSTBYNAMEDATA*)lpParameter;
609+ if(getaddrinfo(pData->name, NULL, NULL, &pAddr) == 0)
610+ {
611+ p = pAddr;
612+ while(p)
613+ {
614+ if(p->ai_family == pData->Family)
615+ {
616+ switch(p->ai_family)
617+ {
618+ case AF_INET:
619+ pHost = (struct hostent*)pData->buf;
620+ if((size_t)pData->buflen >= sizeof(struct hostent) + sizeof(char*) * 2 + sizeof(struct in_addr)
621+ && p->ai_addrlen >= sizeof(struct sockaddr_in))
622+ {
623+ pHost->h_name = NULL;
624+ pHost->h_aliases = NULL;
625+ pHost->h_addrtype = p->ai_family;
626+ pHost->h_length = sizeof(struct in_addr);
627+ pHost->h_addr_list = (char**)(&pHost[1]);
628+ pHost->h_addr_list[0] = (char*)(&pHost->h_addr_list[2]);
629+ pHost->h_addr_list[1] = NULL;
630+ memcpy(pHost->h_addr_list[0], &((struct sockaddr_in*)p->ai_addr)->sin_addr, sizeof(struct in_addr));
631+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(sizeof(struct hostent) + sizeof(char*) * 2 + p->ai_addrlen));
632+ }
633+ else
634+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(WSAENOBUFS << 16));
635+ break;
636+ case AF_INET6:
637+ pHost = (struct hostent*)pData->buf;
638+ if((size_t)pData->buflen >= sizeof(struct hostent) + sizeof(char*) * 2 + sizeof(struct in6_addr)
639+ && p->ai_addrlen >= sizeof(struct sockaddr_in6))
640+ {
641+ pHost->h_name = NULL;
642+ pHost->h_aliases = NULL;
643+ pHost->h_addrtype = p->ai_family;
644+ pHost->h_length = sizeof(struct in6_addr);
645+ pHost->h_addr_list = (char**)(&pHost[1]);
646+ pHost->h_addr_list[0] = (char*)(&pHost->h_addr_list[2]);
647+ pHost->h_addr_list[1] = NULL;
648+ memcpy(pHost->h_addr_list[0], &((struct sockaddr_in6*)p->ai_addr)->sin6_addr, sizeof(struct in6_addr));
649+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(sizeof(struct hostent) + sizeof(char*) * 2 + p->ai_addrlen));
650+ }
651+ else
652+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(WSAENOBUFS << 16));
653+ break;
654+ }
655+ }
656+ if(pHost)
657+ break;
658+ p = p->ai_next;
659+ }
660+ if(!p)
661+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(ERROR_INVALID_FUNCTION << 16));
662+ freeaddrinfo(pAddr);
663+ }
664+ else
665+ PostMessage(pData->hWnd, pData->wMsg, (WPARAM)pData->h, (LPARAM)(ERROR_INVALID_FUNCTION << 16));
666+ free(pData->name);
667+ free(pData);
668+ // CreateThreadが返すハンドルが重複するのを回避
669+ Sleep(10000);
670+ return 0;
671+}
672+
673+// IPv6対応のWSAAsyncGetHostByName相当の関数
674+// FamilyにはAF_INETまたはAF_INET6を指定可能
675+// ただしANSI用
676+HANDLE WSAAsyncGetHostByNameIPv6(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family)
677+{
678+ HANDLE hResult;
679+ GETHOSTBYNAMEDATA* pData;
680+ hResult = NULL;
681+ if(pData = malloc(sizeof(GETHOSTBYNAMEDATA)))
682+ {
683+ pData->hWnd = hWnd;
684+ pData->wMsg = wMsg;
685+ if(pData->name = malloc(sizeof(char) * (strlen(name) + 1)))
686+ {
687+ strcpy(pData->name, name);
688+ pData->buf = buf;
689+ pData->buflen = buflen;
690+ pData->Family = Family;
691+ if(pData->h = CreateThread(NULL, 0, WSAAsyncGetHostByNameIPv6ThreadProc, pData, CREATE_SUSPENDED, NULL))
692+ {
693+ ResumeThread(pData->h);
694+ hResult = pData->h;
695+ }
696+ }
697+ }
698+ if(!hResult)
699+ {
700+ if(pData)
701+ {
702+ if(pData->name)
703+ free(pData->name);
704+ free(pData);
705+ }
706+ }
707+ return hResult;
708+}
709+
710+// WSAAsyncGetHostByNameIPv6用のWSACancelAsyncRequest相当の関数
711+int WSACancelAsyncRequestIPv6(HANDLE hAsyncTaskHandle)
712+{
713+ int Result;
714+ Result = SOCKET_ERROR;
715+ if(TerminateThread(hAsyncTaskHandle, 0))
716+ Result = 0;
717+ return Result;
718+}
719+
720+char* AddressToStringIPv6(char* str, void* in6)
721+{
722+ char* pResult;
723+ unsigned char* p;
724+ int MaxZero;
725+ int MaxZeroLen;
726+ int i;
727+ int j;
728+ char Tmp[5];
729+ pResult = str;
730+ p = (unsigned char*)in6;
731+ MaxZero = 8;
732+ MaxZeroLen = 1;
733+ for(i = 0; i < 8; i++)
734+ {
735+ for(j = i; j < 8; j++)
736+ {
737+ if(p[j * 2] != 0 || p[j * 2 + 1] != 0)
738+ break;
739+ }
740+ if(j - i > MaxZeroLen)
741+ {
742+ MaxZero = i;
743+ MaxZeroLen = j - i;
744+ }
745+ }
746+ strcpy(str, "");
747+ for(i = 0; i < 8; i++)
748+ {
749+ if(i == MaxZero)
750+ {
751+ if(i == 0)
752+ strcat(str, ":");
753+ strcat(str, ":");
754+ }
755+ else if(i < MaxZero || i >= MaxZero + MaxZeroLen)
756+ {
757+ sprintf(Tmp, "%x", (((int)p[i * 2] & 0xff) << 8) | ((int)p[i * 2 + 1] & 0xff));
758+ strcat(str, Tmp);
759+ if(i < 7)
760+ strcat(str, ":");
761+ }
762+ }
763+ return pResult;
764+}
765+
766+// IPv6対応のinet_ntoa相当の関数
767+// ただしANSI用
768+char* inet6_ntoa(struct in6_addr in6)
769+{
770+ char* pResult;
771+ static char Adrs[40];
772+ pResult = NULL;
773+ memset(Adrs, 0, sizeof(Adrs));
774+ pResult = AddressToStringIPv6(Adrs, &in6);
775+ return pResult;
776+}
777+
778+// IPv6対応のinet_addr相当の関数
779+// ただしANSI用
780+struct in6_addr inet6_addr(const char* cp)
781+{
782+ struct in6_addr Result;
783+ int AfterZero;
784+ int i;
785+ char* p;
786+ memset(&Result, 0, sizeof(Result));
787+ AfterZero = 0;
788+ for(i = 0; i < 8; i++)
789+ {
790+ if(!cp)
791+ {
792+ memset(&Result, 0xff, sizeof(Result));
793+ break;
794+ }
795+ if(i >= AfterZero)
796+ {
797+ if(strncmp(cp, ":", 1) == 0)
798+ {
799+ cp = cp + 1;
800+ if(i == 0 && strncmp(cp, ":", 1) == 0)
801+ cp = cp + 1;
802+ p = (char*)cp;
803+ AfterZero = 7;
804+ while(p = strstr(p, ":"))
805+ {
806+ p = p + 1;
807+ AfterZero--;
808+ }
809+ }
810+ else
811+ {
812+ Result.u.Word[i] = (USHORT)strtol(cp, &p, 16);
813+ Result.u.Word[i] = ((Result.u.Word[i] & 0xff00) >> 8) | ((Result.u.Word[i] & 0x00ff) << 8);
814+ if(strncmp(p, ":", 1) != 0 && strlen(p) > 0)
815+ {
816+ memset(&Result, 0xff, sizeof(Result));
817+ break;
818+ }
819+ if(cp = strstr(cp, ":"))
820+ cp = cp + 1;
821+ }
822+ }
823+ }
824+ return Result;
825+}
826+
827+BOOL ConvertDomainNameToPunycode(LPSTR Output, DWORD Count, LPCSTR Input)
828+{
829+ BOOL bResult;
830+ punycode_uint* pUnicode;
831+ punycode_uint* p;
832+ BOOL bNeeded;
833+ LPCSTR InputString;
834+ punycode_uint Length;
835+ punycode_uint OutputLength;
836+ bResult = FALSE;
837+ if(pUnicode = malloc(sizeof(punycode_uint) * strlen(Input)))
838+ {
839+ p = pUnicode;
840+ bNeeded = FALSE;
841+ InputString = Input;
842+ Length = 0;
843+ while(*InputString != '\0')
844+ {
845+ *p = (punycode_uint)GetNextCharM(InputString, &InputString);
846+ if(*p >= 0x80)
847+ bNeeded = TRUE;
848+ p++;
849+ Length++;
850+ }
851+ if(bNeeded)
852+ {
853+ if(Count >= strlen("xn--") + 1)
854+ {
855+ strcpy(Output, "xn--");
856+ OutputLength = Count - strlen("xn--");
857+ if(punycode_encode(Length, pUnicode, NULL, (punycode_uint*)&OutputLength, Output + strlen("xn--")) == punycode_success)
858+ {
859+ Output[strlen("xn--") + OutputLength] = '\0';
860+ bResult = TRUE;
861+ }
862+ }
863+ }
864+ free(pUnicode);
865+ }
866+ if(!bResult)
867+ {
868+ if(Count >= strlen(Input) + 1)
869+ {
870+ strcpy(Output, Input);
871+ bResult = TRUE;
872+ }
873+ }
874+ return bResult;
875+}
876+
877+BOOL ConvertNameToPunycode(LPSTR Output, LPCSTR Input)
878+{
879+ BOOL bResult;
880+ DWORD Length;
881+ char* pm0;
882+ char* pm1;
883+ char* p;
884+ char* pNext;
885+ bResult = FALSE;
886+ Length = strlen(Input);
887+ if(pm0 = AllocateStringM(Length + 1))
888+ {
889+ if(pm1 = AllocateStringM(Length * 4 + 1))
890+ {
891+ strcpy(pm0, Input);
892+ p = pm0;
893+ while(p)
894+ {
895+ if(pNext = strchr(p, '.'))
896+ {
897+ *pNext = '\0';
898+ pNext++;
899+ }
900+ if(ConvertDomainNameToPunycode(pm1, Length * 4, p))
901+ strcat(Output, pm1);
902+ if(pNext)
903+ strcat(Output, ".");
904+ p = pNext;
905+ }
906+ bResult = TRUE;
907+ FreeDuplicatedString(pm1);
908+ }
909+ FreeDuplicatedString(pm0);
910+ }
911+ return bResult;
912+}
913+
914+HANDLE WSAAsyncGetHostByNameM(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen)
915+{
916+ HANDLE r = NULL;
917+ char* pa0 = NULL;
918+ if(pa0 = AllocateStringA(strlen(name) * 4))
919+ {
920+ if(ConvertNameToPunycode(pa0, name))
921+ r = WSAAsyncGetHostByName(hWnd, wMsg, pa0, buf, buflen);
922+ }
923+ FreeDuplicatedString(pa0);
924+ return r;
925+}
926+
927+HANDLE WSAAsyncGetHostByNameIPv6M(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family)
928+{
929+ HANDLE r = NULL;
930+ char* pa0 = NULL;
931+ if(pa0 = AllocateStringA(strlen(name) * 4))
932+ {
933+ if(ConvertNameToPunycode(pa0, name))
934+ r = WSAAsyncGetHostByNameIPv6(hWnd, wMsg, pa0, buf, buflen, Family);
935+ }
936+ FreeDuplicatedString(pa0);
937+ return r;
938+}
939+
--- a/socketwrapper.h
+++ b/socketwrapper.h
@@ -5,6 +5,9 @@
55 #ifndef __SOCKETWRAPPER_H__
66 #define __SOCKETWRAPPER_H__
77
8+#include <ws2tcpip.h>
9+#include <windows.h>
10+
811 #define USE_OPENSSL
912
1013 typedef BOOL (__stdcall* LPSSLTIMEOUTCALLBACK)(BOOL*);
@@ -29,5 +32,13 @@ int closesocketS(SOCKET s);
2932 int sendS(SOCKET s, const char * buf, int len, int flags);
3033 int recvS(SOCKET s, char * buf, int len, int flags);
3134
35+HANDLE WSAAsyncGetHostByNameIPv6(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family);
36+int WSACancelAsyncRequestIPv6(HANDLE hAsyncTaskHandle);
37+char* AddressToStringIPv6(char* str, void* in6);
38+char* inet6_ntoa(struct in6_addr in6);
39+struct in6_addr inet6_addr(const char* cp);
40+HANDLE WSAAsyncGetHostByNameM(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen);
41+HANDLE WSAAsyncGetHostByNameIPv6M(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen, short Family);
42+
3243 #endif
3344
--- a/statuswin.c
+++ b/statuswin.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -37,7 +39,8 @@
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <stdarg.h>
40-#include <winsock.h>
42+// IPv6対応
43+//#include <winsock.h>
4144
4245 #include "common.h"
4346 #include "resource.h"
--- a/taskwin.c
+++ b/taskwin.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -37,7 +39,8 @@
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <stdarg.h>
40-#include <winsock.h>
42+// IPv6対応
43+//#include <winsock.h>
4144
4245 #include "common.h"
4346 #include "resource.h"
--- a/tool.c
+++ b/tool.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
--- a/toolmenu.c
+++ b/toolmenu.c
@@ -28,6 +28,8 @@
2828 /============================================================================*/
2929
3030 #define STRICT
31+// IPv6対応
32+#include <winsock2.h>
3133 #include <windows.h>
3234 #include <stdio.h>
3335 #include <stdlib.h>
@@ -37,7 +39,8 @@
3739 #include <windowsx.h>
3840 #include <commctrl.h>
3941 #include <stdarg.h>
40-#include <winsock.h>
42+// IPv6対応
43+//#include <winsock.h>
4144
4245 #include "common.h"
4346 #include "resource.h"
--- a/updatebell.c
+++ b/updatebell.c
@@ -27,6 +27,8 @@
2727 /============================================================================*/
2828
2929 #define STRICT
30+// IPv6対応
31+#include <winsock2.h>
3032 #include <windows.h>
3133 #include <stdio.h>
3234 #include <stdlib.h>
--- a/wildcard.c
+++ b/wildcard.c
@@ -30,7 +30,9 @@
3030 #define STRICT
3131 #include <stdio.h>
3232 #include <stdlib.h>
33-#include <winsock.h>
33+// IPv6対応
34+//#include <winsock.h>
35+#include <winsock2.h>
3436 #include <windowsx.h>
3537
3638 #include "common.h"