Loweynet
リビジョン | c7302e73116a393e9a99f940d26b4c2bbe944f3e (tree) |
---|---|
日時 | 2011-10-04 19:37:48 |
作者 | s_kawamoto <s_kawamoto@user...> |
コミッター | s_kawamoto |
Update to c30cc851b60a7c4006cd02b4718d9738a6c4049a about bug fixes.
Fix bugs of UTF-8 to UTF-16 API bridge.
Fix bugs of simultaneous connection.
Add support for additional features of hosts.
Fix inconsistent WINVER, _WIN32_WINNT and _WIN32_IE.
@@ -47,7 +47,7 @@ | ||
47 | 47 | Name="VCCLCompilerTool" |
48 | 48 | Optimization="0" |
49 | 49 | AdditionalIncludeDirectories="Resource" |
50 | - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS" | |
50 | + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS" | |
51 | 51 | RuntimeLibrary="1" |
52 | 52 | PrecompiledHeaderFile=".\Debug\FFFTP.pch" |
53 | 53 | AssemblerListingLocation=".\Debug\" |
@@ -71,7 +71,7 @@ | ||
71 | 71 | <Tool |
72 | 72 | Name="VCLinkerTool" |
73 | 73 | AdditionalOptions="/MACHINE:I386" |
74 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
74 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
75 | 75 | OutputFile=".\Debug\FFFTP.exe" |
76 | 76 | LinkIncremental="2" |
77 | 77 | SuppressStartupBanner="true" |
@@ -137,7 +137,7 @@ | ||
137 | 137 | Name="VCCLCompilerTool" |
138 | 138 | InlineFunctionExpansion="1" |
139 | 139 | AdditionalIncludeDirectories="Resource" |
140 | - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS" | |
140 | + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS" | |
141 | 141 | StringPooling="true" |
142 | 142 | RuntimeLibrary="0" |
143 | 143 | EnableFunctionLevelLinking="true" |
@@ -163,7 +163,7 @@ | ||
163 | 163 | <Tool |
164 | 164 | Name="VCLinkerTool" |
165 | 165 | AdditionalOptions="/MACHINE:I386" |
166 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib RASAPI32.LIB htmlhelp.lib" | |
166 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
167 | 167 | OutputFile=".\Release\FFFTP.exe" |
168 | 168 | LinkIncremental="1" |
169 | 169 | SuppressStartupBanner="true" |
@@ -46,7 +46,7 @@ | ||
46 | 46 | Name="VCCLCompilerTool" |
47 | 47 | Optimization="0" |
48 | 48 | AdditionalIncludeDirectories="Resource" |
49 | - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS" | |
49 | + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS" | |
50 | 50 | RuntimeLibrary="1" |
51 | 51 | PrecompiledHeaderFile=".\Debug\FFFTP.pch" |
52 | 52 | AssemblerListingLocation=".\Debug\" |
@@ -70,7 +70,7 @@ | ||
70 | 70 | <Tool |
71 | 71 | Name="VCLinkerTool" |
72 | 72 | AdditionalOptions="/MACHINE:I386" |
73 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
73 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
74 | 74 | OutputFile=".\Debug\FFFTP.exe" |
75 | 75 | LinkIncremental="2" |
76 | 76 | SuppressStartupBanner="true" |
@@ -137,7 +137,7 @@ | ||
137 | 137 | Name="VCCLCompilerTool" |
138 | 138 | InlineFunctionExpansion="1" |
139 | 139 | AdditionalIncludeDirectories="Resource" |
140 | - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS" | |
140 | + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS" | |
141 | 141 | StringPooling="true" |
142 | 142 | RuntimeLibrary="0" |
143 | 143 | EnableFunctionLevelLinking="true" |
@@ -163,7 +163,7 @@ | ||
163 | 163 | <Tool |
164 | 164 | Name="VCLinkerTool" |
165 | 165 | AdditionalOptions="/MACHINE:I386" |
166 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib RASAPI32.LIB htmlhelp.lib" | |
166 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
167 | 167 | OutputFile=".\Release\FFFTP.exe" |
168 | 168 | LinkIncremental="1" |
169 | 169 | SuppressStartupBanner="true" |
@@ -48,7 +48,7 @@ | ||
48 | 48 | Name="VCCLCompilerTool" |
49 | 49 | Optimization="0" |
50 | 50 | AdditionalIncludeDirectories="Resource_eng" |
51 | - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
51 | + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
52 | 52 | BasicRuntimeChecks="3" |
53 | 53 | RuntimeLibrary="1" |
54 | 54 | PrecompiledHeaderFile=".\FFFTP_Eng_Debug\FFFTP_English.pch" |
@@ -73,7 +73,7 @@ | ||
73 | 73 | <Tool |
74 | 74 | Name="VCLinkerTool" |
75 | 75 | AdditionalOptions="/MACHINE:I386" |
76 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
76 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
77 | 77 | OutputFile=".\FFFTP_Eng_Debug\FFFTP.exe" |
78 | 78 | LinkIncremental="2" |
79 | 79 | SuppressStartupBanner="true" |
@@ -139,7 +139,7 @@ | ||
139 | 139 | Name="VCCLCompilerTool" |
140 | 140 | InlineFunctionExpansion="1" |
141 | 141 | AdditionalIncludeDirectories="Resource_eng" |
142 | - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
142 | + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
143 | 143 | StringPooling="true" |
144 | 144 | RuntimeLibrary="0" |
145 | 145 | EnableFunctionLevelLinking="true" |
@@ -164,7 +164,7 @@ | ||
164 | 164 | <Tool |
165 | 165 | Name="VCLinkerTool" |
166 | 166 | AdditionalOptions="/MACHINE:I386" |
167 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
167 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
168 | 168 | OutputFile=".\FFFTP_Eng_Release\FFFTP.exe" |
169 | 169 | LinkIncremental="1" |
170 | 170 | SuppressStartupBanner="true" |
@@ -47,7 +47,7 @@ | ||
47 | 47 | Name="VCCLCompilerTool" |
48 | 48 | Optimization="0" |
49 | 49 | AdditionalIncludeDirectories="Resource_eng" |
50 | - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
50 | + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
51 | 51 | BasicRuntimeChecks="3" |
52 | 52 | RuntimeLibrary="1" |
53 | 53 | PrecompiledHeaderFile=".\FFFTP_Eng_Debug\FFFTP_English.pch" |
@@ -72,7 +72,7 @@ | ||
72 | 72 | <Tool |
73 | 73 | Name="VCLinkerTool" |
74 | 74 | AdditionalOptions="/MACHINE:I386" |
75 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
75 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
76 | 76 | OutputFile=".\FFFTP_Eng_Debug\FFFTP.exe" |
77 | 77 | LinkIncremental="2" |
78 | 78 | SuppressStartupBanner="true" |
@@ -139,7 +139,7 @@ | ||
139 | 139 | Name="VCCLCompilerTool" |
140 | 140 | InlineFunctionExpansion="1" |
141 | 141 | AdditionalIncludeDirectories="Resource_eng" |
142 | - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x300,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
142 | + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINVER=0x0500,_WIN32_WINNT=0x0500,_WIN32_IE=0x0400,_CRT_SECURE_NO_WARNINGS,ENGLISH" | |
143 | 143 | StringPooling="true" |
144 | 144 | RuntimeLibrary="0" |
145 | 145 | EnableFunctionLevelLinking="true" |
@@ -164,7 +164,7 @@ | ||
164 | 164 | <Tool |
165 | 165 | Name="VCLinkerTool" |
166 | 166 | AdditionalOptions="/MACHINE:I386" |
167 | - AdditionalDependencies="wsock32.lib comctl32.lib winmm.lib htmlhelp.lib" | |
167 | + AdditionalDependencies="comctl32.lib htmlhelp.lib rasapi32.lib winmm.lib wsock32.lib" | |
168 | 168 | OutputFile=".\FFFTP_Eng_Release\FFFTP.exe" |
169 | 169 | LinkIncremental="1" |
170 | 170 | SuppressStartupBanner="true" |
@@ -27,7 +27,8 @@ | ||
27 | 27 | / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 | /============================================================================*/ |
29 | 29 | |
30 | -#define WINVER 0x400 | |
30 | +// UTF-8対応 | |
31 | +//#define WINVER 0x400 | |
31 | 32 | |
32 | 33 | #define STRICT |
33 | 34 | #include <windows.h> |
@@ -868,6 +868,10 @@ LIST_UNIX_70 | ||
868 | 868 | #define CRYPT_FTPIS 2 |
869 | 869 | #define CRYPT_SFTP 3 |
870 | 870 | |
871 | +// FEAT対応 | |
872 | +// UTF-8対応 | |
873 | +#define FEATURE_UTF8 0x00000001 | |
874 | + | |
871 | 875 | |
872 | 876 | /*================================================= |
873 | 877 | * ストラクチャ |
@@ -918,6 +922,8 @@ typedef struct { | ||
918 | 922 | int UseSFTP; /* SFTPで接続する (YES/NO) */ |
919 | 923 | // 同時接続対応 |
920 | 924 | int MaxThreadCount; /* 同時接続数 */ |
925 | + // FEAT対応 | |
926 | + int Feature; /* 利用可能な機能のフラグ (FEATURE_xxx) */ | |
921 | 927 | } HOSTDATA; |
922 | 928 | |
923 | 929 |
@@ -1383,6 +1389,8 @@ int AskUseFTPIS(void); | ||
1383 | 1389 | int AskUseSFTP(void); |
1384 | 1390 | // 同時接続対応 |
1385 | 1391 | int AskMaxThreadCount(void); |
1392 | +// FEAT対応 | |
1393 | +int AskHostFeature(void); | |
1386 | 1394 | |
1387 | 1395 | /*===== cache.c =====*/ |
1388 | 1396 |
@@ -957,7 +957,7 @@ int ReConnectCmdSkt(void) | ||
957 | 957 | // 同時接続対応 |
958 | 958 | int ReConnectTrnSkt(SOCKET *Skt) |
959 | 959 | { |
960 | - char Path[FMAX_PATH+1]; | |
960 | +// char Path[FMAX_PATH+1]; | |
961 | 961 | int Sts; |
962 | 962 | |
963 | 963 | Sts = FFFTP_FAIL; |
@@ -1092,8 +1092,8 @@ int AskShareProh(void) | ||
1092 | 1092 | int Sts; |
1093 | 1093 | |
1094 | 1094 | Sts = YES; |
1095 | - if(CmdCtrlSocket == TrnCtrlSocket) | |
1096 | - Sts = NO; | |
1095 | +// if(CmdCtrlSocket == TrnCtrlSocket) | |
1096 | +// Sts = NO; | |
1097 | 1097 | |
1098 | 1098 | return(Sts); |
1099 | 1099 | } |
@@ -1476,6 +1476,26 @@ static SOCKET DoConnect(char *Host, char *User, char *Pass, char *Acct, int Port | ||
1476 | 1476 | #endif |
1477 | 1477 | TryConnect = NO; |
1478 | 1478 | |
1479 | + // FEAT対応 | |
1480 | + // ホストの機能を確認 | |
1481 | + if(ContSock != INVALID_SOCKET) | |
1482 | + { | |
1483 | + if((Sts = command(ContSock, Reply, &CancelFlg, "FEAT")) == 211) | |
1484 | + { | |
1485 | + // 改行文字はReadReplyMessageで消去されるため区切り文字に空白を使用 | |
1486 | + // UTF-8対応 | |
1487 | + if(strstr(Reply, " UTF8 ")) | |
1488 | + CurHost.Feature |= FEATURE_UTF8; | |
1489 | + } | |
1490 | + // UTF-8対応 | |
1491 | + if(CurHost.NameKanjiCode == KANJI_AUTO && (CurHost.Feature & FEATURE_UTF8)) | |
1492 | + { | |
1493 | + if((Sts = command(ContSock, Reply, &CancelFlg, "OPTS UTF8 ON")) == 200) | |
1494 | + { | |
1495 | + } | |
1496 | + } | |
1497 | + } | |
1498 | + | |
1479 | 1499 | return(ContSock); |
1480 | 1500 | } |
1481 | 1501 |
@@ -2238,3 +2258,9 @@ int AskMaxThreadCount(void) | ||
2238 | 2258 | return(CurHost.MaxThreadCount); |
2239 | 2259 | } |
2240 | 2260 | |
2261 | +// FEAT対応 | |
2262 | +int AskHostFeature(void) | |
2263 | +{ | |
2264 | + return(CurHost.Feature); | |
2265 | +} | |
2266 | + |
@@ -27,7 +27,8 @@ | ||
27 | 27 | / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 | /============================================================================*/ |
29 | 29 | |
30 | -#define _WIN32_WINNT 0x400 | |
30 | +// UTF-8対応 | |
31 | +//#define _WIN32_WINNT 0x400 | |
31 | 32 | |
32 | 33 | #define STRICT |
33 | 34 | #include <windows.h> |
@@ -3593,7 +3594,6 @@ static int AnalizeFileInfo(char *Str) | ||
3593 | 3594 | } |
3594 | 3595 | } |
3595 | 3596 | } |
3596 | - | |
3597 | 3597 | } |
3598 | 3598 | |
3599 | 3599 | DoPrintf("ListType=%d", Ret); |
@@ -120,6 +120,8 @@ static HANDLE hListAccMutex; /* 転送ファイルアクセス用ミューテ | ||
120 | 120 | |
121 | 121 | static int TransFiles = 0; /* 転送待ちファイル数 */ |
122 | 122 | static TRANSPACKET *TransPacketBase = NULL; /* 転送ファイルリスト */ |
123 | +// 同時接続対応 | |
124 | +static TRANSPACKET *NextTransPacketBase = NULL; | |
123 | 125 | |
124 | 126 | // 同時接続対応 |
125 | 127 | //static int Canceled; /* 中止フラグ YES/NO */ |
@@ -373,6 +375,9 @@ void AddTransFileList(TRANSPACKET *Pkt) | ||
373 | 375 | PostMessage(GetMainHwnd(), WM_CHANGE_COND, 0, 0); |
374 | 376 | } |
375 | 377 | } |
378 | + // 同時接続対応 | |
379 | + if(NextTransPacketBase == NULL) | |
380 | + NextTransPacketBase = TransPacketBase; | |
376 | 381 | ReleaseMutex(hListAccMutex); |
377 | 382 | |
378 | 383 | return; |
@@ -413,6 +418,9 @@ void AppendTransFileList(TRANSPACKET *Pkt) | ||
413 | 418 | Pos = Pos->Next; |
414 | 419 | Pos->Next = Pkt; |
415 | 420 | } |
421 | + // 同時接続対応 | |
422 | + if(NextTransPacketBase == NULL) | |
423 | + NextTransPacketBase = TransPacketBase; | |
416 | 424 | |
417 | 425 | while(Pkt != NULL) |
418 | 426 | { |
@@ -494,19 +502,26 @@ static void EraseTransFileList(void) | ||
494 | 502 | if(strcmp(New->Cmd, "BACKCUR") == 0) |
495 | 503 | { |
496 | 504 | if(NotDel != NULL) |
497 | - free(NotDel); | |
505 | + // 同時接続対応 | |
506 | +// free(NotDel); | |
507 | + strcpy(NotDel->Cmd, ""); | |
498 | 508 | NotDel = New; |
499 | 509 | New = New->Next; |
500 | - NotDel->Next = NULL; | |
510 | + // 同時接続対応 | |
511 | +// NotDel->Next = NULL; | |
501 | 512 | } |
502 | 513 | else |
503 | 514 | { |
504 | 515 | Next = New->Next; |
505 | - free(New); | |
516 | + // 同時接続対応 | |
517 | +// free(New); | |
518 | + strcpy(New->Cmd, ""); | |
506 | 519 | New = Next; |
507 | 520 | } |
508 | 521 | } |
509 | 522 | TransPacketBase = NotDel; |
523 | + // 同時接続対応 | |
524 | + NextTransPacketBase = TransPacketBase; | |
510 | 525 | TransFiles = 0; |
511 | 526 | PostMessage(GetMainHwnd(), WM_CHANGE_COND, 0, 0); |
512 | 527 | ReleaseMutex(hListAccMutex); |
@@ -611,8 +626,10 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
611 | 626 | char Tmp[FMAX_PATH+1]; |
612 | 627 | int CwdSts; |
613 | 628 | int GoExit; |
614 | - int Down; | |
615 | - int Up; | |
629 | +// int Down; | |
630 | +// int Up; | |
631 | + static int Down; | |
632 | + static int Up; | |
616 | 633 | int DelNotify; |
617 | 634 | int ThreadCount; |
618 | 635 | SOCKET CmdSkt; |
@@ -650,6 +667,12 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
650 | 667 | // Canceled = NO; |
651 | 668 | Canceled[ThreadCount] = NO; |
652 | 669 | |
670 | + while(TransPacketBase != NULL && strcmp(TransPacketBase->Cmd, "") == 0) | |
671 | + { | |
672 | + Pos = TransPacketBase; | |
673 | + TransPacketBase = TransPacketBase->Next; | |
674 | + free(Pos); | |
675 | + } | |
653 | 676 | NewCmdSkt = AskCmdCtrlSkt(); |
654 | 677 | if(TransPacketBase && NewCmdSkt != INVALID_SOCKET && ThreadCount < AskMaxThreadCount()) |
655 | 678 | { |
@@ -682,10 +705,10 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
682 | 705 | } |
683 | 706 | CmdSkt = NewCmdSkt; |
684 | 707 | // if(TransPacketBase != NULL) |
685 | - if(TrnSkt != INVALID_SOCKET && TransPacketBase != NULL) | |
708 | + if(TrnSkt != INVALID_SOCKET && NextTransPacketBase != NULL) | |
686 | 709 | { |
687 | - Pos = TransPacketBase; | |
688 | - TransPacketBase = TransPacketBase->Next; | |
710 | + Pos = NextTransPacketBase; | |
711 | + NextTransPacketBase = NextTransPacketBase->Next; | |
689 | 712 | // ディレクトリ操作は非同期で行わない |
690 | 713 | // ReleaseMutex(hListAccMutex); |
691 | 714 | if(hWndTrans == NULL) |
@@ -1003,6 +1026,7 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
1003 | 1026 | for(i = 0; i < MAX_DATA_CONNECTION; i++) |
1004 | 1027 | Canceled[i] = YES; |
1005 | 1028 | EraseTransFileList(); |
1029 | + Pos = NULL; | |
1006 | 1030 | } |
1007 | 1031 | else |
1008 | 1032 | { |
@@ -1032,7 +1056,8 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
1032 | 1056 | } |
1033 | 1057 | if(hWndTrans != NULL) |
1034 | 1058 | SendMessage(hWndTrans, WM_SET_PACKET, 0, 0); |
1035 | - free(Pos); | |
1059 | + if(Pos != NULL) | |
1060 | + strcpy(Pos->Cmd, ""); | |
1036 | 1061 | } |
1037 | 1062 | // else |
1038 | 1063 | else if(TransPacketBase == NULL) |
@@ -1047,20 +1072,20 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
1047 | 1072 | DestroyWindow(hWndTrans); |
1048 | 1073 | hWndTrans = NULL; |
1049 | 1074 | |
1050 | - if(GoExit == YES) | |
1051 | - { | |
1052 | - SoundPlay(SND_TRANS); | |
1053 | - | |
1054 | - if(AskAutoExit() == NO) | |
1055 | - { | |
1056 | - if(Down == YES) | |
1057 | - PostMessage(GetMainHwnd(), WM_REFRESH_LOCAL_FLG, 0, 0); | |
1058 | - if(Up == YES) | |
1059 | - PostMessage(GetMainHwnd(), WM_REFRESH_REMOTE_FLG, 0, 0); | |
1060 | - } | |
1061 | - Down = NO; | |
1062 | - Up = NO; | |
1063 | - } | |
1075 | +// if(GoExit == YES) | |
1076 | +// { | |
1077 | +// SoundPlay(SND_TRANS); | |
1078 | +// | |
1079 | +// if(AskAutoExit() == NO) | |
1080 | +// { | |
1081 | +// if(Down == YES) | |
1082 | +// PostMessage(GetMainHwnd(), WM_REFRESH_LOCAL_FLG, 0, 0); | |
1083 | +// if(Up == YES) | |
1084 | +// PostMessage(GetMainHwnd(), WM_REFRESH_REMOTE_FLG, 0, 0); | |
1085 | +// } | |
1086 | +// Down = NO; | |
1087 | +// Up = NO; | |
1088 | +// } | |
1064 | 1089 | } |
1065 | 1090 | } |
1066 | 1091 | BackgrndMessageProc(); |
@@ -1068,6 +1093,16 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
1068 | 1093 | |
1069 | 1094 | if(GoExit == YES) |
1070 | 1095 | { |
1096 | + SoundPlay(SND_TRANS); | |
1097 | + if(AskAutoExit() == NO) | |
1098 | + { | |
1099 | + if(Down == YES) | |
1100 | + PostMessage(GetMainHwnd(), WM_REFRESH_LOCAL_FLG, 0, 0); | |
1101 | + if(Up == YES) | |
1102 | + PostMessage(GetMainHwnd(), WM_REFRESH_REMOTE_FLG, 0, 0); | |
1103 | + } | |
1104 | + Down = NO; | |
1105 | + Up = NO; | |
1071 | 1106 | PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_AUTO_EXIT, 0), 0); |
1072 | 1107 | GoExit = NO; |
1073 | 1108 | } |
@@ -1309,6 +1309,7 @@ void CopyDefaultHost(HOSTDATA *Set) | ||
1309 | 1309 | Set->UseSFTP = YES; |
1310 | 1310 | // 同時接続対応 |
1311 | 1311 | Set->MaxThreadCount = 1; |
1312 | + Set->Feature = 0; | |
1312 | 1313 | return; |
1313 | 1314 | } |
1314 | 1315 |
@@ -1526,6 +1527,10 @@ static int DispHostSetDlg(HWND hDlg) | ||
1526 | 1527 | PROPSHEETPAGE psp[7]; |
1527 | 1528 | PROPSHEETHEADER psh; |
1528 | 1529 | |
1530 | + // 変数が未初期化のバグ修正 | |
1531 | + memset(&psp, 0, sizeof(psp)); | |
1532 | + memset(&psh, 0, sizeof(psh)); | |
1533 | + | |
1529 | 1534 | psp[0].dwSize = sizeof(PROPSHEETPAGE); |
1530 | 1535 | psp[0].dwFlags = PSP_USETITLE | PSP_HASHELP; |
1531 | 1536 | psp[0].hInstance = GetFtpInst(); |
@@ -244,6 +244,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi | ||
244 | 244 | |
245 | 245 | InitCommonControls(); |
246 | 246 | |
247 | + // FTPS対応 | |
247 | 248 | #ifdef USE_OPENSSL |
248 | 249 | LoadOpenSSL(); |
249 | 250 | #endif |
@@ -277,6 +278,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi | ||
277 | 278 | Ret = Msg.wParam; |
278 | 279 | } |
279 | 280 | UnregisterClass(FtpClassStr, hInstFtp); |
281 | + // FTPS対応 | |
280 | 282 | #ifdef USE_OPENSSL |
281 | 283 | FreeOpenSSL(); |
282 | 284 | #endif |
@@ -1,4 +1,4 @@ | ||
1 | -// mbswrapper.cpp | |
1 | +// mbswrapper.c | |
2 | 2 | // Copyright (C) 2011 Suguru Kawamoto |
3 | 3 | // マルチバイト文字ワイド文字APIラッパー |
4 | 4 | // マルチバイト文字はUTF-8、ワイド文字はUTF-16であるものとする |
@@ -6,9 +6,6 @@ | ||
6 | 6 | |
7 | 7 | #define UNICODE |
8 | 8 | #define _UNICODE |
9 | -#define _WIN32_WINNT 0x0600 | |
10 | -#undef _WIN32_IE | |
11 | -#define _WIN32_IE 0x0400 | |
12 | 9 | |
13 | 10 | #include <tchar.h> |
14 | 11 | #include <direct.h> |
@@ -40,6 +37,16 @@ int WtoM(LPSTR pDst, int size, LPCWSTR pSrc, int count) | ||
40 | 37 | return WideCharToMultiByte(CP_UTF8, 0, pSrc, count, NULL, 0, NULL, NULL); |
41 | 38 | } |
42 | 39 | |
40 | +// Shift_JIS文字列からワイド文字列へ変換 | |
41 | +int AtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count) | |
42 | +{ | |
43 | + if(pSrc < (LPCSTR)0x00010000 || pSrc == (LPCSTR)~0) | |
44 | + return 0; | |
45 | + if(pDst) | |
46 | + return MultiByteToWideChar(CP_ACP, 0, pSrc, count, pDst, size); | |
47 | + return MultiByteToWideChar(CP_ACP, 0, pSrc, count, NULL, 0); | |
48 | +} | |
49 | + | |
43 | 50 | // ワイド文字列からShift_JIS文字列へ変換 |
44 | 51 | int WtoA(LPSTR pDst, int size, LPCWSTR pSrc, int count) |
45 | 52 | { |
@@ -179,6 +186,24 @@ int WtoMMultiString(LPSTR pDst, int size, LPCWSTR pSrc) | ||
179 | 186 | return i; |
180 | 187 | } |
181 | 188 | |
189 | +// NULL区切りShift_JIS文字列からワイド文字列へ変換 | |
190 | +int AtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc) | |
191 | +{ | |
192 | + int i; | |
193 | + if(pSrc < (LPCSTR)0x00010000 || pSrc == (LPCSTR)~0) | |
194 | + return 0; | |
195 | + if(!pDst) | |
196 | + return GetMultiStringLengthA(pSrc); | |
197 | + i = 0; | |
198 | + while(*pSrc != '\0') | |
199 | + { | |
200 | + i += MultiByteToWideChar(CP_ACP, 0, pSrc, -1, pDst + i, size - i - 1); | |
201 | + pSrc += strlen(pSrc) + 1; | |
202 | + } | |
203 | + pDst[i] = L'\0'; | |
204 | + return i; | |
205 | +} | |
206 | + | |
182 | 207 | // NULL区切りワイド文字列からShift_JIS文字列へ変換 |
183 | 208 | int WtoAMultiString(LPSTR pDst, int size, LPCWSTR pSrc) |
184 | 209 | { |
@@ -234,6 +259,7 @@ char* AllocateStringA(int size) | ||
234 | 259 | } |
235 | 260 | |
236 | 261 | // メモリを確保してマルチバイト文字列からワイド文字列へ変換 |
262 | +// リソースIDならば元の値を返す | |
237 | 263 | wchar_t* DuplicateMtoW(LPCSTR lpString, int c) |
238 | 264 | { |
239 | 265 | wchar_t* p; |
@@ -252,6 +278,7 @@ wchar_t* DuplicateMtoW(LPCSTR lpString, int c) | ||
252 | 278 | } |
253 | 279 | |
254 | 280 | // 指定したサイズのメモリを確保してマルチバイト文字列からワイド文字列へ変換 |
281 | +// リソースIDならば元の値を返す | |
255 | 282 | wchar_t* DuplicateMtoWBuffer(LPCSTR lpString, int c, int size) |
256 | 283 | { |
257 | 284 | wchar_t* p; |
@@ -270,6 +297,7 @@ wchar_t* DuplicateMtoWBuffer(LPCSTR lpString, int c, int size) | ||
270 | 297 | } |
271 | 298 | |
272 | 299 | // メモリを確保してNULL区切りマルチバイト文字列からワイド文字列へ変換 |
300 | +// リソースIDならば元の値を返す | |
273 | 301 | wchar_t* DuplicateMtoWMultiString(LPCSTR lpString) |
274 | 302 | { |
275 | 303 | int count; |
@@ -284,6 +312,7 @@ wchar_t* DuplicateMtoWMultiString(LPCSTR lpString) | ||
284 | 312 | } |
285 | 313 | |
286 | 314 | // 指定したサイズのメモリを確保してNULL区切りマルチバイト文字列からワイド文字列へ変換 |
315 | +// リソースIDならば元の値を返す | |
287 | 316 | wchar_t* DuplicateMtoWMultiStringBuffer(LPCSTR lpString, int size) |
288 | 317 | { |
289 | 318 | int count; |
@@ -302,6 +331,7 @@ wchar_t* DuplicateMtoWMultiStringBuffer(LPCSTR lpString, int size) | ||
302 | 331 | } |
303 | 332 | |
304 | 333 | // メモリを確保してワイド文字列からマルチバイト文字列へ変換 |
334 | +// リソースIDならば元の値を返す | |
305 | 335 | char* DuplicateWtoM(LPCWSTR lpString, int c) |
306 | 336 | { |
307 | 337 | char* p; |
@@ -319,7 +349,27 @@ char* DuplicateWtoM(LPCWSTR lpString, int c) | ||
319 | 349 | return p; |
320 | 350 | } |
321 | 351 | |
352 | +// メモリを確保してShift_JIS文字列からワイド文字列へ変換 | |
353 | +// リソースIDならば元の値を返す | |
354 | +wchar_t* DuplicateAtoW(LPCSTR lpString, int c) | |
355 | +{ | |
356 | + wchar_t* p; | |
357 | + int i; | |
358 | + if(lpString < (LPCSTR)0x00010000 || lpString == (LPCSTR)~0) | |
359 | + return (wchar_t*)lpString; | |
360 | + if(c < 0) | |
361 | + c = strlen(lpString); | |
362 | + p = AllocateStringW(AtoW(NULL, 0, lpString, c) + 1); | |
363 | + if(p) | |
364 | + { | |
365 | + i = AtoW(p, 65535, lpString, c); | |
366 | + p[i] = L'\0'; | |
367 | + } | |
368 | + return p; | |
369 | +} | |
370 | + | |
322 | 371 | // メモリを確保してワイド文字列からShift_JIS文字列へ変換 |
372 | +// リソースIDならば元の値を返す | |
323 | 373 | char* DuplicateWtoA(LPCWSTR lpString, int c) |
324 | 374 | { |
325 | 375 | char* p; |
@@ -338,6 +388,7 @@ char* DuplicateWtoA(LPCWSTR lpString, int c) | ||
338 | 388 | } |
339 | 389 | |
340 | 390 | // 文字列用に確保したメモリを開放 |
391 | +// リソースIDならば何もしない | |
341 | 392 | void FreeDuplicatedString(void* p) |
342 | 393 | { |
343 | 394 | if(p < (void*)0x00010000 || p == (void*)~0) |
@@ -351,10 +402,35 @@ void FreeDuplicatedString(void* p) | ||
351 | 402 | // マルチバイト文字バッファ pm%d |
352 | 403 | // 引数バッファ a%d |
353 | 404 | |
405 | +#pragma warning(disable:4102) | |
354 | 406 | #define START_ROUTINE do{ |
355 | 407 | #define END_ROUTINE }while(0);end_of_routine: |
356 | 408 | #define QUIT_ROUTINE goto end_of_routine; |
357 | 409 | |
410 | +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) | |
411 | +{ | |
412 | + int r = 0; | |
413 | + char* pm0 = NULL; | |
414 | +START_ROUTINE | |
415 | + pm0 = DuplicateWtoM(lpCmdLine, -1); | |
416 | + r = WinMainM(hInstance, hPrevInstance, pm0, nCmdShow); | |
417 | +END_ROUTINE | |
418 | + FreeDuplicatedString(pm0); | |
419 | + return r; | |
420 | +} | |
421 | + | |
422 | +HMODULE LoadLibraryM(LPCSTR lpLibFileName) | |
423 | +{ | |
424 | + HMODULE r = NULL; | |
425 | + wchar_t* pw0 = NULL; | |
426 | +START_ROUTINE | |
427 | + pw0 = DuplicateMtoW(lpLibFileName, -1); | |
428 | + r = LoadLibraryW(pw0); | |
429 | +END_ROUTINE | |
430 | + FreeDuplicatedString(pw0); | |
431 | + return r; | |
432 | +} | |
433 | + | |
358 | 434 | HANDLE CreateFileM(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) |
359 | 435 | { |
360 | 436 | HANDLE r = INVALID_HANDLE_VALUE; |
@@ -874,11 +950,24 @@ END_ROUTINE | ||
874 | 950 | return r; |
875 | 951 | } |
876 | 952 | |
953 | +LPSTR GetCommandLineM() | |
954 | +{ | |
955 | + LPSTR r = 0; | |
956 | + static char* pm0 = NULL; | |
957 | +START_ROUTINE | |
958 | + if(!pm0) | |
959 | + pm0 = DuplicateWtoM(GetCommandLineW(), -1); | |
960 | + r = pm0; | |
961 | +END_ROUTINE | |
962 | + return r; | |
963 | +} | |
964 | + | |
877 | 965 | DWORD GetCurrentDirectoryM(DWORD nBufferLength, LPSTR lpBuffer) |
878 | 966 | { |
879 | 967 | DWORD r = 0; |
880 | 968 | wchar_t* pw0 = NULL; |
881 | 969 | START_ROUTINE |
970 | + // TODO: バッファが不十分な場合に必要なサイズを返す | |
882 | 971 | pw0 = AllocateStringW(nBufferLength * 4); |
883 | 972 | GetCurrentDirectoryW(nBufferLength * 4, pw0); |
884 | 973 | WtoM(lpBuffer, nBufferLength, pw0, -1); |
@@ -900,18 +989,6 @@ END_ROUTINE | ||
900 | 989 | return r; |
901 | 990 | } |
902 | 991 | |
903 | -BOOL SetDllDirectoryM(LPCSTR lpPathName) | |
904 | -{ | |
905 | - BOOL r = FALSE; | |
906 | - wchar_t* pw0 = NULL; | |
907 | -START_ROUTINE | |
908 | - pw0 = DuplicateMtoW(lpPathName, -1); | |
909 | - r = SetDllDirectoryW(pw0); | |
910 | -END_ROUTINE | |
911 | - FreeDuplicatedString(pw0); | |
912 | - return r; | |
913 | -} | |
914 | - | |
915 | 992 | DWORD GetTempPathM(DWORD nBufferLength, LPSTR lpBuffer) |
916 | 993 | { |
917 | 994 | DWORD r = 0; |
@@ -1100,56 +1177,79 @@ START_ROUTINE | ||
1100 | 1177 | a0.hIcon = v0->hIcon; |
1101 | 1178 | a0.pszCaption = DuplicateMtoW(v0->pszCaption, -1); |
1102 | 1179 | a0.nPages = v0->nPages; |
1103 | - a0.pStartPage = DuplicateMtoW(v0->pStartPage, -1); | |
1104 | - if(v0->ppsp && (pwPage = (PROPSHEETPAGEW*)malloc(sizeof(PROPSHEETPAGEW) * v0->nPages))) | |
1180 | + if(v0->dwFlags & PSH_USEPSTARTPAGE) | |
1181 | + a0.pStartPage = DuplicateMtoW(v0->pStartPage, -1); | |
1182 | + else | |
1183 | + a0.nStartPage = v0->nStartPage; | |
1184 | + if(v0->dwFlags & PSH_PROPSHEETPAGE) | |
1105 | 1185 | { |
1106 | - for(i = 0; i < v0->nPages; i++) | |
1186 | + if(v0->ppsp && (pwPage = (PROPSHEETPAGEW*)malloc(sizeof(PROPSHEETPAGEW) * v0->nPages))) | |
1107 | 1187 | { |
1108 | - pwPage[i].dwSize = sizeof(PROPSHEETPAGEW); | |
1109 | - pwPage[i].dwFlags = v0->ppsp[i].dwFlags; | |
1110 | - pwPage[i].hInstance = v0->ppsp[i].hInstance; | |
1111 | - pwPage[i].pszTemplate = DuplicateMtoW(v0->ppsp[i].pszTemplate, -1); | |
1112 | - if(v0->ppsp[i].dwFlags & PSP_USEICONID) | |
1113 | - pwPage[i].pszIcon = DuplicateMtoW(v0->ppsp[i].pszIcon, -1); | |
1114 | - else | |
1115 | - pwPage[i].hIcon = v0->ppsp[i].hIcon; | |
1116 | - if(v0->ppsp[i].dwFlags & PSP_USETITLE) | |
1117 | - pwPage[i].pszTitle = DuplicateMtoW(v0->ppsp[i].pszTitle, -1); | |
1118 | - pwPage[i].pfnDlgProc = v0->ppsp[i].pfnDlgProc; | |
1119 | - pwPage[i].lParam = v0->ppsp[i].lParam; | |
1120 | - // TODO: pfnCallback | |
1121 | - pwPage[i].pfnCallback = v0->ppsp[i].pfnCallback; | |
1122 | - pwPage[i].pcRefParent = v0->ppsp[i].pcRefParent; | |
1123 | -// pwPage[i].pszHeaderTitle = DuplicateMtoW(v0->ppsp[i].pszHeaderTitle, -1); | |
1124 | -// pwPage[i].pszHeaderSubTitle = DuplicateMtoW(v0->ppsp[i].pszHeaderSubTitle, -1); | |
1125 | - pwPage[i].hActCtx = v0->ppsp[i].hActCtx; | |
1126 | -// pwPage[i].pszbmHeader = DuplicateMtoW(v0->ppsp[i].pszbmHeader, -1); | |
1188 | + for(i = 0; i < v0->nPages; i++) | |
1189 | + { | |
1190 | + pwPage[i].dwSize = sizeof(PROPSHEETPAGEW); | |
1191 | + pwPage[i].dwFlags = v0->ppsp[i].dwFlags; | |
1192 | + pwPage[i].hInstance = v0->ppsp[i].hInstance; | |
1193 | + if(v0->ppsp[i].dwFlags & PSP_DLGINDIRECT) | |
1194 | + pwPage[i].pResource = v0->ppsp[i].pResource; | |
1195 | + else | |
1196 | + pwPage[i].pszTemplate = DuplicateMtoW(v0->ppsp[i].pszTemplate, -1); | |
1197 | + if(v0->ppsp[i].dwFlags & PSP_USEICONID) | |
1198 | + pwPage[i].pszIcon = DuplicateMtoW(v0->ppsp[i].pszIcon, -1); | |
1199 | + else | |
1200 | + pwPage[i].hIcon = v0->ppsp[i].hIcon; | |
1201 | + if(v0->ppsp[i].dwFlags & PSP_USETITLE) | |
1202 | + pwPage[i].pszTitle = DuplicateMtoW(v0->ppsp[i].pszTitle, -1); | |
1203 | + pwPage[i].pfnDlgProc = v0->ppsp[i].pfnDlgProc; | |
1204 | + pwPage[i].lParam = v0->ppsp[i].lParam; | |
1205 | + // TODO: pfnCallback | |
1206 | + pwPage[i].pfnCallback = (LPFNPSPCALLBACKW)v0->ppsp[i].pfnCallback; | |
1207 | + pwPage[i].pcRefParent = v0->ppsp[i].pcRefParent; | |
1208 | + if(v0->ppsp[i].dwFlags & PSP_USEHEADERTITLE) | |
1209 | + pwPage[i].pszHeaderTitle = DuplicateMtoW(v0->ppsp[i].pszHeaderTitle, -1); | |
1210 | + if(v0->ppsp[i].dwFlags & PSP_USEHEADERSUBTITLE) | |
1211 | + pwPage[i].pszHeaderSubTitle = DuplicateMtoW(v0->ppsp[i].pszHeaderSubTitle, -1); | |
1212 | + } | |
1127 | 1213 | } |
1214 | + else | |
1215 | + pwPage = NULL; | |
1216 | + a0.ppsp = pwPage; | |
1128 | 1217 | } |
1129 | 1218 | else |
1130 | - pwPage = NULL; | |
1131 | - a0.ppsp = pwPage; | |
1219 | + a0.phpage = v0->phpage; | |
1132 | 1220 | a0.pfnCallback = v0->pfnCallback; |
1221 | + if(v0->dwFlags & PSH_USEHBMWATERMARK) | |
1222 | + a0.hbmWatermark = v0->hbmWatermark; | |
1223 | + else | |
1224 | + a0.pszbmWatermark = DuplicateMtoW(v0->pszbmWatermark, -1); | |
1133 | 1225 | r = PropertySheetW(&a0); |
1134 | 1226 | if(a0.dwFlags & PSH_USEICONID) |
1135 | - FreeDuplicatedString(a0.pszIcon); | |
1136 | - FreeDuplicatedString(a0.pszCaption); | |
1137 | - FreeDuplicatedString(a0.pStartPage); | |
1138 | - if(pwPage) | |
1227 | + FreeDuplicatedString((void*)a0.pszIcon); | |
1228 | + FreeDuplicatedString((void*)a0.pszCaption); | |
1229 | + if(v0->dwFlags & PSH_USEPSTARTPAGE) | |
1230 | + FreeDuplicatedString((void*)a0.pStartPage); | |
1231 | + if(v0->dwFlags & PSH_PROPSHEETPAGE) | |
1139 | 1232 | { |
1140 | - for(i = 0; i < v0->nPages; i++) | |
1233 | + if(pwPage) | |
1141 | 1234 | { |
1142 | - FreeDuplicatedString(pwPage[i].pszTemplate); | |
1143 | - if(pwPage[i].dwFlags & PSP_USEICONID) | |
1144 | - FreeDuplicatedString(pwPage[i].pszIcon); | |
1145 | - if(pwPage[i].dwFlags & PSP_USETITLE) | |
1146 | - FreeDuplicatedString(pwPage[i].pszTitle); | |
1147 | -// FreeDuplicatedString(pwPage[i].pszHeaderTitle); | |
1148 | -// FreeDuplicatedString(pwPage[i].pszHeaderSubTitle); | |
1149 | -// FreeDuplicatedString(pwPage[i].pszbmHeader); | |
1235 | + for(i = 0; i < v0->nPages; i++) | |
1236 | + { | |
1237 | + if(!(v0->ppsp[i].dwFlags & PSP_DLGINDIRECT)) | |
1238 | + FreeDuplicatedString((void*)pwPage[i].pszTemplate); | |
1239 | + if(v0->ppsp[i].dwFlags & PSP_USEICONID) | |
1240 | + FreeDuplicatedString((void*)pwPage[i].pszIcon); | |
1241 | + if(v0->ppsp[i].dwFlags & PSP_USETITLE) | |
1242 | + FreeDuplicatedString((void*)pwPage[i].pszTitle); | |
1243 | + if(v0->ppsp[i].dwFlags & PSP_USEHEADERTITLE) | |
1244 | + FreeDuplicatedString((void*)pwPage[i].pszHeaderTitle); | |
1245 | + if(v0->ppsp[i].dwFlags & PSP_USEHEADERSUBTITLE) | |
1246 | + FreeDuplicatedString((void*)pwPage[i].pszHeaderSubTitle); | |
1247 | + } | |
1248 | + free(pwPage); | |
1150 | 1249 | } |
1151 | - free(pwPage); | |
1152 | 1250 | } |
1251 | + if(!(v0->dwFlags & PSH_USEHBMWATERMARK)) | |
1252 | + FreeDuplicatedString((void*)a0.pszbmWatermark); | |
1153 | 1253 | END_ROUTINE |
1154 | 1254 | return r; |
1155 | 1255 | } |
@@ -1437,7 +1537,8 @@ START_ROUTINE | ||
1437 | 1537 | wFileOp.fFlags = lpFileOp->fFlags; |
1438 | 1538 | wFileOp.fAnyOperationsAborted = lpFileOp->fAnyOperationsAborted; |
1439 | 1539 | wFileOp.hNameMappings = lpFileOp->hNameMappings; |
1440 | - pw2 = DuplicateMtoW(lpFileOp->lpszProgressTitle, -1); | |
1540 | + if(lpFileOp->fFlags & FOF_SIMPLEPROGRESS) | |
1541 | + pw2 = DuplicateMtoW(lpFileOp->lpszProgressTitle, -1); | |
1441 | 1542 | r = SHFileOperationW(&wFileOp); |
1442 | 1543 | lpFileOp->fAnyOperationsAborted = wFileOp.fAnyOperationsAborted; |
1443 | 1544 | END_ROUTINE |
@@ -1479,9 +1580,13 @@ START_ROUTINE | ||
1479 | 1580 | wmii.hbmpChecked = lpmii->hbmpChecked; |
1480 | 1581 | wmii.hbmpUnchecked = lpmii->hbmpUnchecked; |
1481 | 1582 | wmii.dwItemData = lpmii->dwItemData; |
1482 | - pw0 = DuplicateMtoWBuffer(lpmii->dwTypeData, -1, lpmii->cch * 4); | |
1483 | - wmii.dwTypeData = pw0; | |
1484 | - wmii.cch = lpmii->cch * 4; | |
1583 | + if(lpmii->fMask & MIIM_TYPE) | |
1584 | + { | |
1585 | + pw0 = DuplicateMtoWBuffer(lpmii->dwTypeData, -1, lpmii->cch * 4); | |
1586 | + wmii.dwTypeData = pw0; | |
1587 | + wmii.cch = lpmii->cch * 4; | |
1588 | + } | |
1589 | + wmii.hbmpItem = lpmii->hbmpItem; | |
1485 | 1590 | r = GetMenuItemInfoW(hmenu, item, fByPosition, &wmii); |
1486 | 1591 | lpmii->fType = wmii.fType; |
1487 | 1592 | lpmii->fState = wmii.fState; |
@@ -1589,7 +1694,7 @@ START_ROUTINE | ||
1589 | 1694 | v0->nFontType = a0.nFontType; |
1590 | 1695 | if(pwlf) |
1591 | 1696 | free(pwlf); |
1592 | - FreeDuplicatedString(a0.lpTemplateName); | |
1697 | + FreeDuplicatedString((void*)a0.lpTemplateName); | |
1593 | 1698 | FreeDuplicatedString(a0.lpszStyle); |
1594 | 1699 | END_ROUTINE |
1595 | 1700 | FreeDuplicatedString(pw0); |
@@ -1692,7 +1797,7 @@ START_ROUTINE | ||
1692 | 1797 | if(wr) |
1693 | 1798 | { |
1694 | 1799 | *wr = L'\0'; |
1695 | - r = _Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1800 | + r = (unsigned char*)_Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1696 | 1801 | } |
1697 | 1802 | END_ROUTINE |
1698 | 1803 | FreeDuplicatedString(pw0); |
@@ -1711,7 +1816,7 @@ START_ROUTINE | ||
1711 | 1816 | if(wr) |
1712 | 1817 | { |
1713 | 1818 | *wr = L'\0'; |
1714 | - r = _Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1819 | + r = (unsigned char*)_Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1715 | 1820 | } |
1716 | 1821 | END_ROUTINE |
1717 | 1822 | FreeDuplicatedString(pw0); |
@@ -1731,7 +1836,7 @@ START_ROUTINE | ||
1731 | 1836 | if(wr) |
1732 | 1837 | { |
1733 | 1838 | *wr = L'\0'; |
1734 | - r = _Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1839 | + r = (unsigned char*)_Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1735 | 1840 | } |
1736 | 1841 | END_ROUTINE |
1737 | 1842 | FreeDuplicatedString(pw0); |
@@ -1823,7 +1928,7 @@ START_ROUTINE | ||
1823 | 1928 | if(wr) |
1824 | 1929 | { |
1825 | 1930 | *wr = L'\0'; |
1826 | - r = _Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1931 | + r = (unsigned char*)_Str + WtoM(NULL, 0, pw0, -1) - 1; | |
1827 | 1932 | } |
1828 | 1933 | END_ROUTINE |
1829 | 1934 | FreeDuplicatedString(pw0); |
@@ -11,6 +11,12 @@ | ||
11 | 11 | |
12 | 12 | #ifndef DO_NOT_REPLACE |
13 | 13 | |
14 | +#undef WinMain | |
15 | +#define WinMain WinMainM | |
16 | +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow); | |
17 | +#undef LoadLibrary | |
18 | +#define LoadLibrary LoadLibraryM | |
19 | +HMODULE LoadLibraryM(LPCSTR lpLibFileName); | |
14 | 20 | #undef CreateFile |
15 | 21 | #define CreateFile CreateFileM |
16 | 22 | HANDLE CreateFileM(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); |
@@ -59,15 +65,15 @@ BOOL SetWindowTextM(HWND hWnd, LPCSTR lpString); | ||
59 | 65 | #undef DragQueryFile |
60 | 66 | #define DragQueryFile DragQueryFileM |
61 | 67 | UINT DragQueryFileM(HDROP hDrop, UINT iFile, LPSTR lpszFile, UINT cch); |
68 | +#undef GetCommandLine | |
69 | +#define GetCommandLine GetCommandLineM | |
70 | +LPSTR GetCommandLineM(); | |
62 | 71 | #undef GetCurrentDirectory |
63 | 72 | #define GetCurrentDirectory GetCurrentDirectoryM |
64 | 73 | DWORD GetCurrentDirectoryM(DWORD nBufferLength, LPSTR lpBuffer); |
65 | 74 | #undef SetCurrentDirectory |
66 | 75 | #define SetCurrentDirectory SetCurrentDirectoryM |
67 | 76 | BOOL SetCurrentDirectoryM(LPCSTR lpPathName); |
68 | -#undef SetDllDirectory | |
69 | -#define SetDllDirectory SetDllDirectoryM | |
70 | -BOOL SetDllDirectoryM(LPCSTR lpPathName); | |
71 | 77 | #undef GetTempPath |
72 | 78 | #define GetTempPath GetTempPathM |
73 | 79 | DWORD GetTempPathM(DWORD nBufferLength, LPSTR lpBuffer); |
@@ -201,15 +207,17 @@ FILE * fopenM(const char * _Filename, const char * _Mode); | ||
201 | 207 | |
202 | 208 | int MtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count); |
203 | 209 | int WtoM(LPSTR pDst, int size, LPCWSTR pSrc, int count); |
210 | +int AtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count); | |
204 | 211 | int WtoA(LPSTR pDst, int size, LPCWSTR pSrc, int count); |
205 | 212 | int TerminateStringM(LPSTR lpString, int size); |
206 | 213 | int TerminateStringW(LPWSTR lpString, int size); |
207 | -int TerminateStringA(LPWSTR lpString, int size); | |
214 | +int TerminateStringA(LPSTR lpString, int size); | |
208 | 215 | size_t GetMultiStringLengthM(LPCSTR lpString); |
209 | 216 | size_t GetMultiStringLengthW(LPCWSTR lpString); |
210 | -size_t GetMultiStringLengthA(LPCWSTR lpString); | |
217 | +size_t GetMultiStringLengthA(LPCSTR lpString); | |
211 | 218 | int MtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc); |
212 | 219 | int WtoMMultiString(LPSTR pDst, int size, LPCWSTR pSrc); |
220 | +int AtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc); | |
213 | 221 | int WtoAMultiString(LPSTR pDst, int size, LPCWSTR pSrc); |
214 | 222 | char* AllocateStringM(int size); |
215 | 223 | wchar_t* AllocateStringW(int size); |
@@ -219,8 +227,11 @@ wchar_t* DuplicateMtoWBuffer(LPCSTR lpString, int c, int size); | ||
219 | 227 | wchar_t* DuplicateMtoWMultiString(LPCSTR lpString); |
220 | 228 | wchar_t* DuplicateMtoWMultiStringBuffer(LPCSTR lpString, int size); |
221 | 229 | char* DuplicateWtoM(LPCWSTR lpString, int c); |
230 | +wchar_t* DuplicateAtoW(LPCSTR lpString, int c); | |
222 | 231 | char* DuplicateWtoA(LPCWSTR lpString, int c); |
223 | 232 | void FreeDuplicatedString(void* p); |
224 | 233 | |
234 | +int WINAPI WinMainM(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); | |
235 | + | |
225 | 236 | #endif |
226 | 237 |
@@ -163,6 +163,10 @@ void SetOption(int Start) | ||
163 | 163 | PROPSHEETPAGE psp[12]; |
164 | 164 | PROPSHEETHEADER psh; |
165 | 165 | |
166 | + // 変数が未初期化のバグ修正 | |
167 | + memset(&psp, 0, sizeof(psp)); | |
168 | + memset(&psh, 0, sizeof(psh)); | |
169 | + | |
166 | 170 | psp[0].dwSize = sizeof(PROPSHEETPAGE); |
167 | 171 | psp[0].dwFlags = PSP_USETITLE | PSP_HASHELP; |
168 | 172 | psp[0].hInstance = GetFtpInst(); |
@@ -29,7 +29,8 @@ | ||
29 | 29 | |
30 | 30 | #define STRICT |
31 | 31 | |
32 | -#define WINVER 0x400 | |
32 | +// UTF-8対応 | |
33 | +//#define WINVER 0x400 | |
33 | 34 | |
34 | 35 | #include <windows.h> |
35 | 36 | #include <stdio.h> |
@@ -1,4 +1,4 @@ | ||
1 | -// socketwrapper.cpp | |
1 | +// socketwrapper.c | |
2 | 2 | // Copyright (C) 2011 Suguru Kawamoto |
3 | 3 | // ソケットラッパー |
4 | 4 | // socket関連関数をOpenSSL用に置換 |