Loweynet
Revision | 98a8ff5f501726ce2f71296138ab21e98eb68173 (tree) |
---|---|
Zeit | 2011-10-13 19:16:56 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix bugs of file deletion code on transfer thread (but it is unused).
Fix bugs on trying encrypted connection.
Remove log size limit for Windows 9x.
@@ -921,6 +921,7 @@ typedef struct { | ||
921 | 921 | char DialEntry[RAS_NAME_LEN+1]; /* ダイアルアップエントリ */ |
922 | 922 | // 暗号化通信対応 |
923 | 923 | int CryptMode; /* 暗号化通信モード (CRYPT_xxx) */ |
924 | + int UseNoEncryption; /* 暗号化なしで接続する (YES/NO) */ | |
924 | 925 | int UseFTPES; /* FTPESで接続する (YES/NO) */ |
925 | 926 | int UseFTPIS; /* FTPISで接続する (YES/NO) */ |
926 | 927 | int UseSFTP; /* SFTPで接続する (YES/NO) */ |
@@ -57,7 +57,10 @@ static int SendInitCommand(char *Cmd); | ||
57 | 57 | static void AskUseFireWall(char *Host, int *Fire, int *Pasv, int *List); |
58 | 58 | static void SaveCurrentSetToHistory(void); |
59 | 59 | static int ReConnectSkt(SOCKET *Skt); |
60 | -static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security); | |
60 | +// 暗号化通信対応 | |
61 | +//static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security); | |
62 | +static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security); | |
63 | +static SOCKET DoConnect(HOSTDATA* HostData, char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security); | |
61 | 64 | static int CheckOneTimePassword(char *Pass, char *Reply, int Type); |
62 | 65 | static BOOL CALLBACK BlkHookFnc(void); |
63 | 66 | static int Socks5MakeCmdPacket(SOCKS5REQUEST *Packet, char Cmd, int ValidIP, ulong IP, char *Host, ushort Port); |
@@ -159,7 +162,9 @@ void ConnectProc(int Type, int Num) | ||
159 | 162 | Save = YES; |
160 | 163 | |
161 | 164 | DisableUserOpe(); |
162 | - CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, Save, CurHost.Security); | |
165 | + // 暗号化通信対応 | |
166 | +// CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, Save, CurHost.Security); | |
167 | + CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, Save, CurHost.Security); | |
163 | 168 | TrnCtrlSocket = CmdCtrlSocket; |
164 | 169 | |
165 | 170 | if(CmdCtrlSocket != INVALID_SOCKET) |
@@ -238,7 +243,9 @@ void QuickConnectProc(void) | ||
238 | 243 | SetSyncMoveMode(CurHost.SyncMove); |
239 | 244 | |
240 | 245 | DisableUserOpe(); |
241 | - CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
246 | + // 暗号化通信対応 | |
247 | +// CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
248 | + CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
242 | 249 | TrnCtrlSocket = CmdCtrlSocket; |
243 | 250 | |
244 | 251 | if(CmdCtrlSocket != INVALID_SOCKET) |
@@ -410,7 +417,9 @@ void DirectConnectProc(char *unc, int Kanji, int Kana, int Fkanji, int TrMode) | ||
410 | 417 | } |
411 | 418 | |
412 | 419 | DisableUserOpe(); |
413 | - CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
420 | + // 暗号化通信対応 | |
421 | +// CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
422 | + CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
414 | 423 | TrnCtrlSocket = CmdCtrlSocket; |
415 | 424 | |
416 | 425 | if(CmdCtrlSocket != INVALID_SOCKET) |
@@ -486,7 +495,9 @@ void HistoryConnectProc(int MenuCmd) | ||
486 | 495 | DispTransferType(); |
487 | 496 | |
488 | 497 | DisableUserOpe(); |
489 | - CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
498 | + // 暗号化通信対応 | |
499 | +// CmdCtrlSocket = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
500 | + CmdCtrlSocket = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security); | |
490 | 501 | TrnCtrlSocket = CmdCtrlSocket; |
491 | 502 | |
492 | 503 | if(CmdCtrlSocket != INVALID_SOCKET) |
@@ -959,6 +970,8 @@ int ReConnectTrnSkt(SOCKET *Skt) | ||
959 | 970 | { |
960 | 971 | // char Path[FMAX_PATH+1]; |
961 | 972 | int Sts; |
973 | + // 暗号化通信対応 | |
974 | + HOSTDATA HostData; | |
962 | 975 | |
963 | 976 | Sts = FFFTP_FAIL; |
964 | 977 |
@@ -969,7 +982,18 @@ int ReConnectTrnSkt(SOCKET *Skt) | ||
969 | 982 | if(*Skt != INVALID_SOCKET) |
970 | 983 | do_closesocket(*Skt); |
971 | 984 | /* 再接続 */ |
972 | - if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
985 | + // 暗号化通信対応 | |
986 | + HostData = CurHost; | |
987 | + if(HostData.CryptMode != CRYPT_NONE) | |
988 | + HostData.UseNoEncryption = NO; | |
989 | + if(HostData.CryptMode != CRYPT_FTPES) | |
990 | + HostData.UseFTPES = NO; | |
991 | + if(HostData.CryptMode != CRYPT_FTPIS) | |
992 | + HostData.UseFTPIS = NO; | |
993 | + if(HostData.CryptMode != CRYPT_SFTP) | |
994 | + HostData.UseSFTP = NO; | |
995 | +// if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
996 | + if((*Skt = DoConnect(&HostData, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
973 | 997 | { |
974 | 998 | // AskRemoteCurDir(Path, FMAX_PATH); |
975 | 999 | // DoCWD(Path, YES, YES, YES); |
@@ -1007,7 +1031,9 @@ static int ReConnectSkt(SOCKET *Skt) | ||
1007 | 1031 | if(*Skt != INVALID_SOCKET) |
1008 | 1032 | do_closesocket(*Skt); |
1009 | 1033 | /* 再接続 */ |
1010 | - if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
1034 | + // 暗号化通信対応 | |
1035 | +// if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
1036 | + if((*Skt = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) | |
1011 | 1037 | { |
1012 | 1038 | AskRemoteCurDir(Path, FMAX_PATH); |
1013 | 1039 | DoCWD(Path, YES, YES, YES); |
@@ -1216,7 +1242,8 @@ int AskConnecting(void) | ||
1216 | 1242 | * none Connect host → USER user(h) → PASS pass(h) → ACCT acct |
1217 | 1243 | *----------------------------------------------------------------------------*/ |
1218 | 1244 | |
1219 | -static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security) | |
1245 | +// 暗号化通信対応 | |
1246 | +static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security) | |
1220 | 1247 | { |
1221 | 1248 | int Sts; |
1222 | 1249 | int Flg; |
@@ -1232,143 +1259,173 @@ static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port | ||
1232 | 1259 | char TmpBuf[ONELINE_BUF_SIZE]; |
1233 | 1260 | struct linger LingerOpt; |
1234 | 1261 | |
1235 | - if(Fwall == YES) | |
1236 | - Fwall = FwallType; | |
1237 | - else | |
1238 | - Fwall = FWALL_NONE; | |
1262 | + // 暗号化通信対応 | |
1263 | + ContSock = INVALID_SOCKET; | |
1239 | 1264 | |
1240 | - TryConnect = YES; | |
1241 | - CancelFlg = NO; | |
1265 | + if(CryptMode == CRYPT_NONE || CryptMode == CRYPT_FTPES || CryptMode == CRYPT_FTPIS) | |
1266 | + { | |
1267 | + if(Fwall == YES) | |
1268 | + Fwall = FwallType; | |
1269 | + else | |
1270 | + Fwall = FWALL_NONE; | |
1271 | + | |
1272 | + TryConnect = YES; | |
1273 | + CancelFlg = NO; | |
1242 | 1274 | #if 0 |
1243 | -// WSASetBlockingHook(BlkHookFnc); | |
1275 | +// WSASetBlockingHook(BlkHookFnc); | |
1244 | 1276 | #endif |
1245 | 1277 | |
1246 | - ContSock = INVALID_SOCKET; | |
1278 | + ContSock = INVALID_SOCKET; | |
1247 | 1279 | |
1248 | - HostPort = Port; | |
1249 | - Tmp = Host; | |
1250 | - if(((Fwall >= FWALL_FU_FP_SITE) && (Fwall <= FWALL_OPEN)) || | |
1251 | - (Fwall == FWALL_SIDEWINDER) || | |
1252 | - (Fwall == FWALL_FU_FP)) | |
1253 | - { | |
1254 | - Tmp = FwallHost; | |
1255 | - Port = FwallPort; | |
1256 | - } | |
1280 | + HostPort = Port; | |
1281 | + Tmp = Host; | |
1282 | + if(((Fwall >= FWALL_FU_FP_SITE) && (Fwall <= FWALL_OPEN)) || | |
1283 | + (Fwall == FWALL_SIDEWINDER) || | |
1284 | + (Fwall == FWALL_FU_FP)) | |
1285 | + { | |
1286 | + Tmp = FwallHost; | |
1287 | + Port = FwallPort; | |
1288 | + } | |
1257 | 1289 | |
1258 | - if(strlen(Tmp) != 0) | |
1259 | - { | |
1260 | - if((ContSock = connectsock(Tmp, Port, "", &CancelFlg)) != INVALID_SOCKET) | |
1290 | + if(strlen(Tmp) != 0) | |
1261 | 1291 | { |
1262 | - // バッファを無効 | |
1292 | + if((ContSock = connectsock(Tmp, Port, "", &CancelFlg)) != INVALID_SOCKET) | |
1293 | + { | |
1294 | + // バッファを無効 | |
1263 | 1295 | #ifdef DISABLE_CONTROL_NETWORK_BUFFERS |
1264 | - int BufferSize = 0; | |
1265 | - setsockopt(ContSock, SOL_SOCKET, SO_SNDBUF, (char*)&BufferSize, sizeof(int)); | |
1266 | - setsockopt(ContSock, SOL_SOCKET, SO_RCVBUF, (char*)&BufferSize, sizeof(int)); | |
1296 | + int BufferSize = 0; | |
1297 | + setsockopt(ContSock, SOL_SOCKET, SO_SNDBUF, (char*)&BufferSize, sizeof(int)); | |
1298 | + setsockopt(ContSock, SOL_SOCKET, SO_RCVBUF, (char*)&BufferSize, sizeof(int)); | |
1267 | 1299 | #endif |
1268 | - while((Sts = ReadReplyMessage(ContSock, Buf, 1024, &CancelFlg, TmpBuf) / 100) == FTP_PRELIM) | |
1269 | - ; | |
1300 | + // FTPIS対応 | |
1301 | +// while((Sts = ReadReplyMessage(ContSock, Buf, 1024, &CancelFlg, TmpBuf) / 100) == FTP_PRELIM) | |
1302 | +// ; | |
1303 | + if(CryptMode == CRYPT_FTPIS) | |
1304 | + { | |
1305 | + if(AttachSSL(ContSock)) | |
1306 | + { | |
1307 | + while((Sts = ReadReplyMessage(ContSock, Buf, 1024, &CancelFlg, TmpBuf) / 100) == FTP_PRELIM) | |
1308 | + ; | |
1309 | + if((Sts = command(ContSock, Reply, &CancelFlg, "PBSZ 0")) == 200) | |
1310 | + { | |
1311 | + if((Sts = command(ContSock, Reply, &CancelFlg, "PROT P")) == 200) | |
1312 | + { | |
1313 | + } | |
1314 | + else | |
1315 | + Sts = FTP_ERROR; | |
1316 | + } | |
1317 | + else | |
1318 | + Sts = FTP_ERROR; | |
1319 | + } | |
1320 | + else | |
1321 | + Sts = FTP_ERROR; | |
1322 | + } | |
1323 | + else | |
1324 | + { | |
1325 | + while((Sts = ReadReplyMessage(ContSock, Buf, 1024, &CancelFlg, TmpBuf) / 100) == FTP_PRELIM) | |
1326 | + ; | |
1327 | + } | |
1270 | 1328 | |
1271 | - if(Sts == FTP_COMPLETE) | |
1272 | - { | |
1273 | - Flg = 1; | |
1274 | - if(setsockopt(ContSock, SOL_SOCKET, SO_OOBINLINE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1275 | - ReportWSError("setsockopt", WSAGetLastError()); | |
1276 | - // データ転送用ソケットのTCP遅延転送が無効されているので念のため | |
1277 | - if(setsockopt(ContSock, IPPROTO_TCP, TCP_NODELAY, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1278 | - ReportWSError("setsockopt", WSAGetLastError()); | |
1329 | + if(Sts == FTP_COMPLETE) | |
1330 | + { | |
1331 | + Flg = 1; | |
1332 | + if(setsockopt(ContSock, SOL_SOCKET, SO_OOBINLINE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1333 | + ReportWSError("setsockopt", WSAGetLastError()); | |
1334 | + // データ転送用ソケットのTCP遅延転送が無効されているので念のため | |
1335 | + if(setsockopt(ContSock, IPPROTO_TCP, TCP_NODELAY, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1336 | + ReportWSError("setsockopt", WSAGetLastError()); | |
1279 | 1337 | //#pragma aaa |
1280 | - Flg = 1; | |
1281 | - if(setsockopt(ContSock, SOL_SOCKET, SO_KEEPALIVE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1282 | - ReportWSError("setsockopt", WSAGetLastError()); | |
1283 | - LingerOpt.l_onoff = 1; | |
1284 | - LingerOpt.l_linger = 90; | |
1285 | - if(setsockopt(ContSock, SOL_SOCKET, SO_LINGER, (LPSTR)&LingerOpt, sizeof(LingerOpt)) == SOCKET_ERROR) | |
1286 | - ReportWSError("setsockopt", WSAGetLastError()); | |
1338 | + Flg = 1; | |
1339 | + if(setsockopt(ContSock, SOL_SOCKET, SO_KEEPALIVE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR) | |
1340 | + ReportWSError("setsockopt", WSAGetLastError()); | |
1341 | + LingerOpt.l_onoff = 1; | |
1342 | + LingerOpt.l_linger = 90; | |
1343 | + if(setsockopt(ContSock, SOL_SOCKET, SO_LINGER, (LPSTR)&LingerOpt, sizeof(LingerOpt)) == SOCKET_ERROR) | |
1344 | + ReportWSError("setsockopt", WSAGetLastError()); | |
1287 | 1345 | /////// |
1288 | 1346 | |
1289 | 1347 | |
1290 | - /*===== 認証を行なう =====*/ | |
1348 | + /*===== 認証を行なう =====*/ | |
1291 | 1349 | |
1292 | - Sts = FTP_COMPLETE; | |
1293 | - if((Fwall == FWALL_FU_FP_SITE) || | |
1294 | - (Fwall == FWALL_FU_FP_USER) || | |
1295 | - (Fwall == FWALL_FU_FP)) | |
1296 | - { | |
1297 | - if((Sts = command(ContSock, Reply, &CancelFlg, "USER %s", FwallUser) / 100) == FTP_CONTINUE) | |
1350 | + Sts = FTP_COMPLETE; | |
1351 | + if((Fwall == FWALL_FU_FP_SITE) || | |
1352 | + (Fwall == FWALL_FU_FP_USER) || | |
1353 | + (Fwall == FWALL_FU_FP)) | |
1298 | 1354 | { |
1299 | - CheckOneTimePassword(FwallPass, Reply, FwallSecurity); | |
1300 | - Sts = command(ContSock, NULL, &CancelFlg, "PASS %s", Reply) / 100; | |
1355 | + if((Sts = command(ContSock, Reply, &CancelFlg, "USER %s", FwallUser) / 100) == FTP_CONTINUE) | |
1356 | + { | |
1357 | + CheckOneTimePassword(FwallPass, Reply, FwallSecurity); | |
1358 | + Sts = command(ContSock, NULL, &CancelFlg, "PASS %s", Reply) / 100; | |
1359 | + } | |
1301 | 1360 | } |
1302 | - } | |
1303 | - else if(Fwall == FWALL_SIDEWINDER) | |
1304 | - { | |
1305 | - Sts = command(ContSock, Reply, &CancelFlg, "USER %s:%s%c%s", FwallUser, FwallPass, FwallDelimiter, Host) / 100; | |
1306 | - } | |
1307 | - if((Sts != FTP_COMPLETE) && (Sts != FTP_CONTINUE)) | |
1308 | - { | |
1309 | - SetTaskMsg(MSGJPN006); | |
1310 | - DoClose(ContSock); | |
1311 | - ContSock = INVALID_SOCKET; | |
1312 | - } | |
1313 | - else | |
1314 | - { | |
1315 | - if((Fwall == FWALL_FU_FP_SITE) || (Fwall == FWALL_OPEN)) | |
1361 | + else if(Fwall == FWALL_SIDEWINDER) | |
1316 | 1362 | { |
1317 | - Flg = 0; | |
1318 | - if(Fwall == FWALL_OPEN) | |
1319 | - Flg = 2; | |
1320 | - if(FwallLower == YES) | |
1321 | - Flg++; | |
1322 | - | |
1323 | - if(HostPort == PORT_NOR) | |
1324 | - Sts = command(ContSock, NULL, &CancelFlg, "%s %s", SiteTbl[Flg], Host) / 100; | |
1325 | - else | |
1326 | - Sts = command(ContSock, NULL, &CancelFlg, "%s %s %d", SiteTbl[Flg], Host, HostPort) / 100; | |
1363 | + Sts = command(ContSock, Reply, &CancelFlg, "USER %s:%s%c%s", FwallUser, FwallPass, FwallDelimiter, Host) / 100; | |
1327 | 1364 | } |
1328 | - | |
1329 | 1365 | if((Sts != FTP_COMPLETE) && (Sts != FTP_CONTINUE)) |
1330 | 1366 | { |
1331 | - SetTaskMsg(MSGJPN007, Host); | |
1367 | + SetTaskMsg(MSGJPN006); | |
1332 | 1368 | DoClose(ContSock); |
1333 | 1369 | ContSock = INVALID_SOCKET; |
1334 | 1370 | } |
1335 | 1371 | else |
1336 | 1372 | { |
1337 | - Anony = NO; | |
1338 | - if((strlen(User) != 0) || | |
1339 | - (InputDialogBox(username_dlg, GetMainHwnd(), NULL, User, USER_NAME_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1373 | + if((Fwall == FWALL_FU_FP_SITE) || (Fwall == FWALL_OPEN)) | |
1340 | 1374 | { |
1341 | - if(Anony == YES) | |
1342 | - { | |
1343 | - strcpy(User, "anonymous"); | |
1344 | - strcpy(Pass, UserMailAdrs); | |
1345 | - } | |
1375 | + Flg = 0; | |
1376 | + if(Fwall == FWALL_OPEN) | |
1377 | + Flg = 2; | |
1378 | + if(FwallLower == YES) | |
1379 | + Flg++; | |
1380 | + | |
1381 | + if(HostPort == PORT_NOR) | |
1382 | + Sts = command(ContSock, NULL, &CancelFlg, "%s %s", SiteTbl[Flg], Host) / 100; | |
1383 | + else | |
1384 | + Sts = command(ContSock, NULL, &CancelFlg, "%s %s %d", SiteTbl[Flg], Host, HostPort) / 100; | |
1385 | + } | |
1346 | 1386 | |
1347 | - if((Fwall == FWALL_FU_FP_USER) || (Fwall == FWALL_USER)) | |
1387 | + if((Sts != FTP_COMPLETE) && (Sts != FTP_CONTINUE)) | |
1388 | + { | |
1389 | + SetTaskMsg(MSGJPN007, Host); | |
1390 | + DoClose(ContSock); | |
1391 | + ContSock = INVALID_SOCKET; | |
1392 | + } | |
1393 | + else | |
1394 | + { | |
1395 | + Anony = NO; | |
1396 | + if((strlen(User) != 0) || | |
1397 | + (InputDialogBox(username_dlg, GetMainHwnd(), NULL, User, USER_NAME_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1348 | 1398 | { |
1349 | - if(HostPort == PORT_NOR) | |
1350 | - sprintf(Buf, "%s%c%s", User, FwallDelimiter, Host); | |
1399 | + if(Anony == YES) | |
1400 | + { | |
1401 | + strcpy(User, "anonymous"); | |
1402 | + strcpy(Pass, UserMailAdrs); | |
1403 | + } | |
1404 | + | |
1405 | + if((Fwall == FWALL_FU_FP_USER) || (Fwall == FWALL_USER)) | |
1406 | + { | |
1407 | + if(HostPort == PORT_NOR) | |
1408 | + sprintf(Buf, "%s%c%s", User, FwallDelimiter, Host); | |
1409 | + else | |
1410 | + sprintf(Buf, "%s%c%s %d", User, FwallDelimiter, Host, HostPort); | |
1411 | + } | |
1351 | 1412 | else |
1352 | - sprintf(Buf, "%s%c%s %d", User, FwallDelimiter, Host, HostPort); | |
1353 | - } | |
1354 | - else | |
1355 | - strcpy(Buf, User); | |
1413 | + strcpy(Buf, User); | |
1356 | 1414 | |
1357 | - // FTPES対応 | |
1358 | - // 2回以上呼ばれる事があるため既にFTPESで接続していても再確認 | |
1359 | - if(CurHost.CryptMode == CRYPT_NONE || CurHost.CryptMode == CRYPT_FTPES) | |
1360 | - { | |
1361 | - if(IsOpenSSLLoaded() && CurHost.UseFTPES == YES && (Sts = command(ContSock, Reply, &CancelFlg, "AUTH TLS")) == 234) | |
1415 | + // FTPES対応 | |
1416 | + if(CryptMode == CRYPT_FTPES) | |
1362 | 1417 | { |
1363 | - // SSLに切り替え | |
1364 | - SetTaskMsg(MSGJPN315); | |
1365 | - CurHost.CryptMode = CRYPT_FTPES; | |
1366 | - if(AttachSSL(ContSock)) | |
1418 | + if(IsOpenSSLLoaded() && (Sts = command(ContSock, Reply, &CancelFlg, "AUTH TLS")) == 234) | |
1367 | 1419 | { |
1368 | - if((Sts = command(ContSock, Reply, &CancelFlg, "PBSZ 0")) == 200) | |
1420 | + if(AttachSSL(ContSock)) | |
1369 | 1421 | { |
1370 | - if((Sts = command(ContSock, Reply, &CancelFlg, "PROT P")) == 200) | |
1422 | + if((Sts = command(ContSock, Reply, &CancelFlg, "PBSZ 0")) == 200) | |
1371 | 1423 | { |
1424 | + if((Sts = command(ContSock, Reply, &CancelFlg, "PROT P")) == 200) | |
1425 | + { | |
1426 | + } | |
1427 | + else | |
1428 | + Sts = FTP_ERROR; | |
1372 | 1429 | } |
1373 | 1430 | else |
1374 | 1431 | Sts = FTP_ERROR; |
@@ -1379,129 +1436,160 @@ static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port | ||
1379 | 1436 | else |
1380 | 1437 | Sts = FTP_ERROR; |
1381 | 1438 | } |
1382 | - else | |
1383 | - { | |
1384 | - // 暗号化なし | |
1385 | - CurHost.CryptMode = CRYPT_NONE; | |
1386 | - SetTaskMsg(MSGJPN314); | |
1387 | - } | |
1388 | - } | |
1389 | 1439 | |
1390 | - ReInPass = NO; | |
1391 | - do | |
1392 | - { | |
1393 | - Continue = NO; | |
1394 | - if((Sts = command(ContSock, Reply, &CancelFlg, "USER %s", Buf) / 100) == FTP_CONTINUE) | |
1440 | + ReInPass = NO; | |
1441 | + do | |
1395 | 1442 | { |
1396 | - if((strlen(Pass) != 0) || | |
1397 | - (InputDialogBox(passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1443 | + // FTPES対応 | |
1444 | + if(Sts == FTP_ERROR) | |
1445 | + break; | |
1446 | + Continue = NO; | |
1447 | + if((Sts = command(ContSock, Reply, &CancelFlg, "USER %s", Buf) / 100) == FTP_CONTINUE) | |
1398 | 1448 | { |
1399 | - CheckOneTimePassword(Pass, Reply, Security); | |
1449 | + if((strlen(Pass) != 0) || | |
1450 | + (InputDialogBox(passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1451 | + { | |
1452 | + CheckOneTimePassword(Pass, Reply, Security); | |
1400 | 1453 | |
1401 | - /* パスワードがスペース1個の時はパスワードの実体なしとする */ | |
1402 | - if(strcmp(Reply, " ") == 0) | |
1403 | - strcpy(Reply, ""); | |
1454 | + /* パスワードがスペース1個の時はパスワードの実体なしとする */ | |
1455 | + if(strcmp(Reply, " ") == 0) | |
1456 | + strcpy(Reply, ""); | |
1404 | 1457 | |
1405 | - Sts = command(ContSock, NULL, &CancelFlg, "PASS %s", Reply) / 100; | |
1406 | - if(Sts == FTP_ERROR) | |
1407 | - { | |
1408 | - strcpy(Pass, ""); | |
1409 | - if(InputDialogBox(re_passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES) | |
1410 | - Continue = YES; | |
1411 | - else | |
1412 | - DoPrintf("No password specified."); | |
1413 | - ReInPass = YES; | |
1414 | - } | |
1415 | - else if(Sts == FTP_CONTINUE) | |
1416 | - { | |
1417 | - if((strlen(Acct) != 0) || | |
1418 | - (InputDialogBox(account_dlg, GetMainHwnd(), NULL, Acct, ACCOUNT_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1458 | + Sts = command(ContSock, NULL, &CancelFlg, "PASS %s", Reply) / 100; | |
1459 | + if(Sts == FTP_ERROR) | |
1419 | 1460 | { |
1420 | - Sts = command(ContSock, NULL, &CancelFlg, "ACCT %s", Acct) / 100; | |
1461 | + strcpy(Pass, ""); | |
1462 | + if(InputDialogBox(re_passwd_dlg, GetMainHwnd(), NULL, Pass, PASSWORD_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES) | |
1463 | + Continue = YES; | |
1464 | + else | |
1465 | + DoPrintf("No password specified."); | |
1466 | + ReInPass = YES; | |
1467 | + } | |
1468 | + else if(Sts == FTP_CONTINUE) | |
1469 | + { | |
1470 | + if((strlen(Acct) != 0) || | |
1471 | + (InputDialogBox(account_dlg, GetMainHwnd(), NULL, Acct, ACCOUNT_LEN+1, &Anony, IDH_HELP_TOPIC_0000001) == YES)) | |
1472 | + { | |
1473 | + Sts = command(ContSock, NULL, &CancelFlg, "ACCT %s", Acct) / 100; | |
1474 | + } | |
1475 | + else | |
1476 | + DoPrintf("No account specified"); | |
1421 | 1477 | } |
1422 | - else | |
1423 | - DoPrintf("No account specified"); | |
1424 | 1478 | } |
1425 | - } | |
1426 | - else | |
1427 | - { | |
1428 | - Sts = FTP_ERROR; | |
1429 | - DoPrintf("No password specified."); | |
1479 | + else | |
1480 | + { | |
1481 | + Sts = FTP_ERROR; | |
1482 | + DoPrintf("No password specified."); | |
1483 | + } | |
1430 | 1484 | } |
1431 | 1485 | } |
1486 | + while(Continue == YES); | |
1487 | + } | |
1488 | + else | |
1489 | + { | |
1490 | + Sts = FTP_ERROR; | |
1491 | + DoPrintf("No user name specified"); | |
1432 | 1492 | } |
1433 | - while(Continue == YES); | |
1434 | - } | |
1435 | - else | |
1436 | - { | |
1437 | - Sts = FTP_ERROR; | |
1438 | - DoPrintf("No user name specified"); | |
1439 | - } | |
1440 | 1493 | |
1441 | - if(Sts != FTP_COMPLETE) | |
1442 | - { | |
1443 | - SetTaskMsg(MSGJPN008, Host); | |
1444 | - DoClose(ContSock); | |
1445 | - ContSock = INVALID_SOCKET; | |
1446 | - } | |
1447 | - else if((SavePass == YES) && (ReInPass == YES)) | |
1448 | - { | |
1449 | - if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savepass_dlg), GetMainHwnd(), ExeEscDialogProc) == YES) | |
1450 | - SetHostPassword(AskCurrentHost(), Pass); | |
1494 | + if(Sts != FTP_COMPLETE) | |
1495 | + { | |
1496 | + SetTaskMsg(MSGJPN008, Host); | |
1497 | + DoClose(ContSock); | |
1498 | + ContSock = INVALID_SOCKET; | |
1499 | + } | |
1500 | + else if((SavePass == YES) && (ReInPass == YES)) | |
1501 | + { | |
1502 | + if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(savepass_dlg), GetMainHwnd(), ExeEscDialogProc) == YES) | |
1503 | + SetHostPassword(AskCurrentHost(), Pass); | |
1504 | + } | |
1451 | 1505 | } |
1452 | 1506 | } |
1453 | 1507 | } |
1454 | - } | |
1455 | - else | |
1456 | - { | |
1508 | + else | |
1509 | + { | |
1457 | 1510 | //#pragma aaa |
1458 | - SetTaskMsg(MSGJPN009/*"接続できません(1) %x", ContSock*/); | |
1459 | - DoClose(ContSock); | |
1460 | - ContSock = INVALID_SOCKET; | |
1511 | + SetTaskMsg(MSGJPN009/*"接続できません(1) %x", ContSock*/); | |
1512 | + DoClose(ContSock); | |
1513 | + ContSock = INVALID_SOCKET; | |
1514 | + } | |
1461 | 1515 | } |
1462 | 1516 | } |
1463 | - } | |
1464 | - else | |
1465 | - { | |
1466 | - | |
1467 | - if(((Fwall >= FWALL_FU_FP_SITE) && (Fwall <= FWALL_OPEN)) || | |
1468 | - (Fwall == FWALL_FU_FP)) | |
1469 | - SetTaskMsg(MSGJPN010); | |
1470 | 1517 | else |
1471 | - SetTaskMsg(MSGJPN011); | |
1472 | - } | |
1518 | + { | |
1519 | + | |
1520 | + if(((Fwall >= FWALL_FU_FP_SITE) && (Fwall <= FWALL_OPEN)) || | |
1521 | + (Fwall == FWALL_FU_FP)) | |
1522 | + SetTaskMsg(MSGJPN010); | |
1523 | + else | |
1524 | + SetTaskMsg(MSGJPN011); | |
1525 | + } | |
1473 | 1526 | |
1474 | 1527 | #if 0 |
1475 | -// WSAUnhookBlockingHook(); | |
1528 | +// WSAUnhookBlockingHook(); | |
1476 | 1529 | #endif |
1477 | - TryConnect = NO; | |
1530 | + TryConnect = NO; | |
1478 | 1531 | |
1479 | - // FEAT対応 | |
1480 | - // ホストの機能を確認 | |
1481 | - if(ContSock != INVALID_SOCKET) | |
1482 | - { | |
1483 | - if((Sts = command(ContSock, Reply, &CancelFlg, "FEAT")) == 211) | |
1532 | + // FEAT対応 | |
1533 | + // ホストの機能を確認 | |
1534 | + if(ContSock != INVALID_SOCKET) | |
1484 | 1535 | { |
1485 | - // 改行文字はReadReplyMessageで消去されるため区切り文字に空白を使用 | |
1536 | + if((Sts = command(ContSock, Reply, &CancelFlg, "FEAT")) == 211) | |
1537 | + { | |
1538 | + // 改行文字はReadReplyMessageで消去されるため区切り文字に空白を使用 | |
1539 | + // UTF-8対応 | |
1540 | + if(strstr(Reply, " UTF8 ")) | |
1541 | + HostData->Feature |= FEATURE_UTF8; | |
1542 | + // MLST対応 | |
1543 | + if(strstr(Reply, " MLST ") || strstr(Reply, " MLSD ")) | |
1544 | + HostData->Feature |= FEATURE_MLSD; | |
1545 | + } | |
1486 | 1546 | // UTF-8対応 |
1487 | - if(strstr(Reply, " UTF8 ")) | |
1488 | - CurHost.Feature |= FEATURE_UTF8; | |
1489 | - // MLST対応 | |
1490 | - if(strstr(Reply, " MLST ") || strstr(Reply, " MLSD ")) | |
1491 | - CurHost.Feature |= FEATURE_MLSD; | |
1492 | - } | |
1493 | - // UTF-8対応 | |
1494 | - if(CurHost.NameKanjiCode == KANJI_AUTO && (CurHost.Feature & FEATURE_UTF8)) | |
1495 | - { | |
1496 | - if((Sts = command(ContSock, Reply, &CancelFlg, "OPTS UTF8 ON")) == 200) | |
1547 | + if(HostData->NameKanjiCode == KANJI_AUTO && (HostData->Feature & FEATURE_UTF8)) | |
1497 | 1548 | { |
1549 | + if((Sts = command(ContSock, Reply, &CancelFlg, "OPTS UTF8 ON")) == 200) | |
1550 | + { | |
1551 | + } | |
1498 | 1552 | } |
1499 | 1553 | } |
1500 | 1554 | } |
1555 | + else if(CryptMode == CRYPT_SFTP) | |
1556 | + { | |
1557 | + } | |
1501 | 1558 | |
1502 | 1559 | return(ContSock); |
1503 | 1560 | } |
1504 | 1561 | |
1562 | +static SOCKET DoConnect(HOSTDATA* HostData, char *Host, char *User, char *Pass, char *Acct, int Port, int Fwall, int SavePass, int Security) | |
1563 | +{ | |
1564 | + SOCKET ContSock; | |
1565 | + ContSock = INVALID_SOCKET; | |
1566 | + if(ContSock == INVALID_SOCKET && HostData->UseSFTP == YES) | |
1567 | + { | |
1568 | + SetTaskMsg(MSGJPN317); | |
1569 | + if((ContSock = DoConnectCrypt(CRYPT_SFTP, HostData, Host, User, Pass, Acct, Port, Fwall, SavePass, Security)) != INVALID_SOCKET) | |
1570 | + HostData->CryptMode = CRYPT_SFTP; | |
1571 | + } | |
1572 | +// if(ContSock == INVALID_SOCKET && HostData->UseFTPIS == YES) | |
1573 | +// { | |
1574 | +// SetTaskMsg(MSGJPN316); | |
1575 | +// if((ContSock = DoConnectCrypt(CRYPT_FTPIS, HostData, Host, User, Pass, Acct, Port, Fwall, SavePass, Security)) != INVALID_SOCKET) | |
1576 | +// HostData->CryptMode = CRYPT_FTPIS; | |
1577 | +// } | |
1578 | + if(ContSock == INVALID_SOCKET && HostData->UseFTPES == YES) | |
1579 | + { | |
1580 | + SetTaskMsg(MSGJPN315); | |
1581 | + if((ContSock = DoConnectCrypt(CRYPT_FTPES, HostData, Host, User, Pass, Acct, Port, Fwall, SavePass, Security)) != INVALID_SOCKET) | |
1582 | + HostData->CryptMode = CRYPT_FTPES; | |
1583 | + } | |
1584 | + if(ContSock == INVALID_SOCKET && HostData->UseNoEncryption == YES) | |
1585 | + { | |
1586 | + SetTaskMsg(MSGJPN314); | |
1587 | + if((ContSock = DoConnectCrypt(CRYPT_NONE, HostData, Host, User, Pass, Acct, Port, Fwall, SavePass, Security)) != INVALID_SOCKET) | |
1588 | + HostData->CryptMode = CRYPT_NONE; | |
1589 | + } | |
1590 | + return ContSock; | |
1591 | +} | |
1592 | + | |
1505 | 1593 | |
1506 | 1594 | /*----- ワンタイムパスワードのチェック ---------------------------------------- |
1507 | 1595 | * |
@@ -2240,6 +2328,11 @@ int AskCryptMode(void) | ||
2240 | 2328 | return(CurHost.CryptMode); |
2241 | 2329 | } |
2242 | 2330 | |
2331 | +int AskUseNoEncryption(void) | |
2332 | +{ | |
2333 | + return(CurHost.UseNoEncryption); | |
2334 | +} | |
2335 | + | |
2243 | 2336 | int AskUseFTPES(void) |
2244 | 2337 | { |
2245 | 2338 | return(CurHost.UseFTPES); |
@@ -900,7 +900,6 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
900 | 900 | // else if(strncmp(TransPacketBase->Cmd, "R-DELE", 6) == 0) |
901 | 901 | else if(strncmp(Pos->Cmd, "R-DELE", 6) == 0) |
902 | 902 | { |
903 | - ReleaseMutex(hListAccMutex); | |
904 | 903 | // DispTransFileInfo(TransPacketBase, MSGJPN081, FALSE, YES); |
905 | 904 | DispTransFileInfo(Pos, MSGJPN081, FALSE, YES); |
906 | 905 |
@@ -917,6 +916,7 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
917 | 916 | CommandProcTrn(TrnSkt, NULL, "%s%s", Pos->Cmd+2, Pos->RemoteFile); |
918 | 917 | } |
919 | 918 | } |
919 | + ReleaseMutex(hListAccMutex); | |
920 | 920 | } |
921 | 921 | /* ディレクトリ作成(常にローカル側) */ |
922 | 922 | // else if(strncmp(TransPacketBase->Cmd, "L-MKD", 5) == 0) |
@@ -1312,6 +1312,7 @@ void CopyDefaultHost(HOSTDATA *Set) | ||
1312 | 1312 | strcpy(Set->DialEntry, ""); |
1313 | 1313 | // 暗号化通信対応 |
1314 | 1314 | Set->CryptMode = CRYPT_NONE; |
1315 | + Set->UseNoEncryption = YES; | |
1315 | 1316 | Set->UseFTPES = YES; |
1316 | 1317 | Set->UseFTPIS = YES; |
1317 | 1318 | Set->UseSFTP = YES; |
@@ -740,10 +740,7 @@ int do_closesocket(SOCKET s) | ||
740 | 740 | |
741 | 741 | // FTPS対応 |
742 | 742 | // Ret = closesocket(s); |
743 | - if(AskCryptMode() == CRYPT_FTPES || AskCryptMode() == CRYPT_FTPIS) | |
744 | - Ret = closesocketS(s); | |
745 | - else | |
746 | - Ret = closesocketS(s); | |
743 | + Ret = closesocketS(s); | |
747 | 744 | if(Ret == SOCKET_ERROR) |
748 | 745 | { |
749 | 746 | Error = 0; |
@@ -970,7 +967,7 @@ int do_recv(SOCKET s, char *buf, int len, int flags, int *TimeOutErr, int *Cance | ||
970 | 967 | // FTPS対応 |
971 | 968 | // OpenSSLでは受信確認はFD_READが複数回受信される可能性がある |
972 | 969 | // while((*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_READ_BIT) != YES)) |
973 | - while(AskCryptMode() == CRYPT_NONE && (*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_READ_BIT) != YES)) | |
970 | + while(!IsSSLAttached(s) && (*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_READ_BIT) != YES)) | |
974 | 971 | { |
975 | 972 | if(AskAsyncDone(s, &Error, FD_CLOSE_BIT) == YES) |
976 | 973 | { |
@@ -1003,10 +1000,7 @@ int do_recv(SOCKET s, char *buf, int len, int flags, int *TimeOutErr, int *Cance | ||
1003 | 1000 | |
1004 | 1001 | // FTPS対応 |
1005 | 1002 | // Ret = recv(s, buf, len, flags); |
1006 | - if(AskCryptMode() == CRYPT_FTPES || AskCryptMode() == CRYPT_FTPIS) | |
1007 | - Ret = recvS(s, buf, len, flags); | |
1008 | - else | |
1009 | - Ret = recv(s, buf, len, flags); | |
1003 | + Ret = recvS(s, buf, len, flags); | |
1010 | 1004 | if(Ret != SOCKET_ERROR) |
1011 | 1005 | break; |
1012 | 1006 | Error = WSAGetLastError(); |
@@ -1015,11 +1009,8 @@ int do_recv(SOCKET s, char *buf, int len, int flags, int *TimeOutErr, int *Cance | ||
1015 | 1009 | break; |
1016 | 1010 | // FTPS対応 |
1017 | 1011 | // 受信確認をバイパスしたためここでタイムアウトの確認 |
1018 | - if(AskCryptMode() == CRYPT_FTPES || AskCryptMode() == CRYPT_FTPIS) | |
1019 | - { | |
1020 | - if(BackgrndMessageProc() == YES) | |
1021 | - *CancelCheckWork = YES; | |
1022 | - } | |
1012 | + if(BackgrndMessageProc() == YES) | |
1013 | + *CancelCheckWork = YES; | |
1023 | 1014 | else if(TimeOut != 0) |
1024 | 1015 | { |
1025 | 1016 | time(&ElapseTime); |
@@ -1080,7 +1071,7 @@ int do_send(SOCKET s, const char *buf, int len, int flags, int *TimeOutErr, int | ||
1080 | 1071 | // FTPS対応 |
1081 | 1072 | // 送信バッファの空き確認には影響しないが念のため |
1082 | 1073 | // while((*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_WRITE_BIT) != YES)) |
1083 | - while(AskCryptMode() == CRYPT_NONE && (*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_WRITE_BIT) != YES)) | |
1074 | + while(!IsSSLAttached(s) && (*CancelCheckWork == NO) && (AskAsyncDone(s, &Error, FD_WRITE_BIT) != YES)) | |
1084 | 1075 | { |
1085 | 1076 | if(AskAsyncDone(s, &Error, FD_CLOSE_BIT) == YES) |
1086 | 1077 | { |
@@ -1114,10 +1105,7 @@ int do_send(SOCKET s, const char *buf, int len, int flags, int *TimeOutErr, int | ||
1114 | 1105 | |
1115 | 1106 | // FTPS対応 |
1116 | 1107 | // Ret = send(s, buf, len, flags); |
1117 | - if(AskCryptMode() == CRYPT_FTPES || AskCryptMode() == CRYPT_FTPIS) | |
1118 | - Ret = sendS(s, buf, len, flags); | |
1119 | - else | |
1120 | - Ret = send(s, buf, len, flags); | |
1108 | + Ret = sendS(s, buf, len, flags); | |
1121 | 1109 | if(Ret != SOCKET_ERROR) |
1122 | 1110 | { |
1123 | 1111 | #if DBG_MSG |
@@ -1131,11 +1119,8 @@ int do_send(SOCKET s, const char *buf, int len, int flags, int *TimeOutErr, int | ||
1131 | 1119 | break; |
1132 | 1120 | // FTPS対応 |
1133 | 1121 | // 送信バッファ確認をバイパスしたためここでタイムアウトの確認 |
1134 | - if(AskCryptMode() == CRYPT_FTPES || AskCryptMode() == CRYPT_FTPIS) | |
1135 | - { | |
1136 | - if(BackgrndMessageProc() == YES) | |
1137 | - *CancelCheckWork = YES; | |
1138 | - } | |
1122 | + if(BackgrndMessageProc() == YES) | |
1123 | + *CancelCheckWork = YES; | |
1139 | 1124 | else if(TimeOut != 0) |
1140 | 1125 | { |
1141 | 1126 | time(&ElapseTime); |
@@ -42,7 +42,8 @@ | ||
42 | 42 | #include "common.h" |
43 | 43 | #include "resource.h" |
44 | 44 | |
45 | -#define TASK_BUFSIZE (16*1024) | |
45 | +// Windows 9x系をサポートしないため不要 | |
46 | +//#define TASK_BUFSIZE (16*1024) | |
46 | 47 | |
47 | 48 | |
48 | 49 |
@@ -90,7 +91,9 @@ int MakeTaskWindow(HWND hWnd, HINSTANCE hInst) | ||
90 | 91 | |
91 | 92 | if(hWndTask != NULL) |
92 | 93 | { |
93 | - SendMessage(hWndTask, EM_LIMITTEXT, TASK_BUFSIZE, 0); | |
94 | + // Windows 9x系をサポートしないため不要 | |
95 | +// SendMessage(hWndTask, EM_LIMITTEXT, TASK_BUFSIZE, 0); | |
96 | + SendMessage(hWndTask, EM_LIMITTEXT, 0x7fffffff, 0); | |
94 | 97 | |
95 | 98 | if(ListFont != NULL) |
96 | 99 | SendMessage(hWndTask, WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0)); |
@@ -177,16 +180,17 @@ void SetTaskMsg(char *szFormat, ...) | ||
177 | 180 | Pos = SendMessage(GetTaskWnd(), WM_GETTEXTLENGTH, 0, 0); |
178 | 181 | |
179 | 182 | /* テキストサイズのリミット値をチェック */ |
180 | - if((Pos + strlen(szBuf)) >= TASK_BUFSIZE) | |
181 | - { | |
182 | - /* リミットを越えそうなら、先頭部分を切り捨てる */ | |
183 | - Pos = SendMessage(GetTaskWnd(), EM_LINEFROMCHAR, TASK_BUFSIZE/10, 0) + 1; | |
184 | - Pos = SendMessage(GetTaskWnd(), EM_LINEINDEX, Pos, 0); | |
185 | - SendMessage(GetTaskWnd(), EM_SETSEL, 0, Pos); | |
186 | - SendMessage(GetTaskWnd(), EM_REPLACESEL, FALSE, (LPARAM)""); | |
187 | - | |
188 | - Pos = SendMessage(GetTaskWnd(), WM_GETTEXTLENGTH, 0, 0); | |
189 | - } | |
183 | + // Windows 9x系をサポートしないため不要 | |
184 | +// if((Pos + strlen(szBuf)) >= TASK_BUFSIZE) | |
185 | +// { | |
186 | +// /* リミットを越えそうなら、先頭部分を切り捨てる */ | |
187 | +// Pos = SendMessage(GetTaskWnd(), EM_LINEFROMCHAR, TASK_BUFSIZE/10, 0) + 1; | |
188 | +// Pos = SendMessage(GetTaskWnd(), EM_LINEINDEX, Pos, 0); | |
189 | +// SendMessage(GetTaskWnd(), EM_SETSEL, 0, Pos); | |
190 | +// SendMessage(GetTaskWnd(), EM_REPLACESEL, FALSE, (LPARAM)""); | |
191 | +// | |
192 | +// Pos = SendMessage(GetTaskWnd(), WM_GETTEXTLENGTH, 0, 0); | |
193 | +// } | |
190 | 194 | |
191 | 195 | SendMessage(GetTaskWnd(), EM_SETSEL, Pos, Pos); |
192 | 196 | SendMessage(GetTaskWnd(), EM_REPLACESEL, FALSE, (LPARAM)szBuf); |