• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

FFFTPのソースコードです。


Commit MetaInfo

Revisionace5228a5909b084161345b10e712b7937bb00c5 (tree)
Time2011-09-09 18:07:23
Authors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Fix bugs of text encoding routines.
Fix bugs of UTF-8 to UTF-16 API bridge.
Recover compatibility of registry settings.
Fix bugs of behavior of toolbar buttons.
Add support for JIS and EUC text mode transfer.

Change Summary

Incremental Difference

Binary files a/FFFTP.exe and b/FFFTP.exe differ
--- a/codecnv.c
+++ b/codecnv.c
@@ -366,6 +366,8 @@ void InitCodeConvInfo(CODECONVINFO *cInfo)
366366 cInfo->KanjiFst = 0;
367367 cInfo->KanaPrev = 0;
368368 cInfo->KanaProc = NULL;
369+ // UTF-8対応
370+ cInfo->EscUTF8Len = 0;
369371 return;
370372 }
371373
@@ -397,6 +399,9 @@ int FlushRestData(CODECONVINFO *cInfo)
397399 *Put++ = cInfo->EscCode[0];
398400 if(cInfo->EscProc == 2)
399401 *Put++ = cInfo->EscCode[1];
402+ // UTF-8対応
403+ memcpy(Put, cInfo->EscUTF8, sizeof(char) * cInfo->EscUTF8Len);
404+ Put += cInfo->EscUTF8Len;
400405
401406 cInfo->OutLen = Put - cInfo->Buf;
402407
@@ -1478,75 +1483,133 @@ int ConvUTF8NtoSJIS(CODECONVINFO *cInfo)
14781483 {
14791484 int Continue;
14801485
1481- char temp_string[2048];
1486+// char temp_string[2048];
14821487 int string_length;
14831488
1489+ // 大きいサイズに対応
1490+ // 終端のNULLを含むバグを修正
1491+ int SrcLength;
1492+ char* pSrc;
1493+ wchar_t* pUTF16;
1494+ int UTF16Length;
1495+ int Count;
1496+
14841497 Continue = NO;
14851498
14861499 // 生成される中間コードのサイズを調べる
1487- string_length = MultiByteToWideChar(
1488- CP_UTF8, // 変換先文字コード
1489- 0, // フラグ(0:なし)
1490- cInfo->Str, // 変換元文字列
1491- -1, // 変換元文字列バイト数(-1:自動)
1492- NULL, // 変換した文字列の格納先
1493- 0 // 格納先サイズ
1494- );
1500+// string_length = MultiByteToWideChar(
1501+// CP_UTF8, // 変換先文字コード
1502+// 0, // フラグ(0:なし)
1503+// cInfo->Str, // 変換元文字列
1504+// -1, // 変換元文字列バイト数(-1:自動)
1505+// NULL, // 変換した文字列の格納先
1506+// 0 // 格納先サイズ
1507+// );
1508+ // 前回の変換不能な残りの文字列を入力の先頭に結合
1509+ SrcLength = cInfo->StrLen + cInfo->EscUTF8Len;
1510+ if(!(pSrc = (char*)malloc(sizeof(char) * (SrcLength + 1))))
1511+ {
1512+ *(cInfo->Buf) = '\0';
1513+ cInfo->BufSize = 0;
1514+ return Continue;
1515+ }
1516+ memcpy(pSrc, cInfo->EscUTF8, sizeof(char) * cInfo->EscUTF8Len);
1517+ memcpy(pSrc + cInfo->EscUTF8Len, cInfo->Str, sizeof(char) * cInfo->StrLen);
1518+ *(pSrc + SrcLength) = '\0';
1519+ // UTF-8の場合、不完全な文字は常に変換されない
1520+ UTF16Length = MultiByteToWideChar(CP_UTF8, 0, pSrc, SrcLength, NULL, 0);
14951521
14961522 // サイズ0 or バッファサイズより大きい場合は
14971523 // cInfo->Bufの最初に'\0'を入れて、
14981524 // cInfo->BufSizeに0を入れて返す。
1499- if( string_length == 0 ||
1500- string_length >= 1024 ){
1525+// if( string_length == 0 ||
1526+// string_length >= 1024 ){
1527+// *(cInfo->Buf) = '\0';
1528+// cInfo->BufSize = 0;
1529+// return(Continue);
1530+// }
1531+ if(!(pUTF16 = (wchar_t*)malloc(sizeof(wchar_t) * UTF16Length)))
1532+ {
1533+ free(pSrc);
15011534 *(cInfo->Buf) = '\0';
15021535 cInfo->BufSize = 0;
1503- return(Continue);
1536+ return Continue;
15041537 }
15051538
15061539 // 中間コード(unicode)に変換
1507- MultiByteToWideChar(
1508- CP_UTF8, // 変換先文字コード
1509- 0, // フラグ(0:なし)
1510- cInfo->Str, // 変換元文字列
1511- -1, // 変換元文字列バイト数(-1:自動)
1512- (unsigned short *)temp_string, // 変換した文字列の格納先
1513- 1024 // 格納先サイズ
1514- );
1540+// MultiByteToWideChar(
1541+// CP_UTF8, // 変換先文字コード
1542+// 0, // フラグ(0:なし)
1543+// cInfo->Str, // 変換元文字列
1544+// -1, // 変換元文字列バイト数(-1:自動)
1545+// (unsigned short *)temp_string, // 変換した文字列の格納先
1546+// 1024 // 格納先サイズ
1547+// );
1548+ MultiByteToWideChar(CP_UTF8, 0, pSrc, SrcLength, pUTF16, UTF16Length);
15151549
15161550 // 生成されるUTF-8コードのサイズを調べる
1517- string_length = WideCharToMultiByte(
1518- CP_ACP, // 変換先文字コード
1519- 0, // フラグ(0:なし)
1520- (unsigned short *)temp_string, // 変換元文字列
1521- -1, // 変換元文字列バイト数(-1:自動)
1522- NULL, // 変換した文字列の格納先
1523- 0, // 格納先サイズ
1524- NULL,NULL
1525- );
1551+// string_length = WideCharToMultiByte(
1552+// CP_ACP, // 変換先文字コード
1553+// 0, // フラグ(0:なし)
1554+// (unsigned short *)temp_string, // 変換元文字列
1555+// -1, // 変換元文字列バイト数(-1:自動)
1556+// NULL, // 変換した文字列の格納先
1557+// 0, // 格納先サイズ
1558+// NULL,NULL
1559+// );
1560+ string_length = WideCharToMultiByte(CP_ACP, 0, pUTF16, UTF16Length, NULL, 0, NULL, NULL);
15261561
15271562 // サイズ0 or 出力バッファサイズより大きい場合は、
15281563 // cInfo->Bufの最初に'\0'を入れて、
15291564 // cInfo->BufSizeに0を入れて返す。
1530- if( string_length == 0 ||
1531- string_length >= cInfo->BufSize ){
1532- *(cInfo->Buf) = '\0';
1533- cInfo->BufSize = 0;
1534- return(Continue);
1535- }
1565+// if( string_length == 0 ||
1566+// string_length >= cInfo->BufSize ){
1567+// *(cInfo->Buf) = '\0';
1568+// cInfo->BufSize = 0;
1569+// return(Continue);
1570+// }
15361571
15371572 // 出力サイズを設定
1538- cInfo->OutLen = string_length;
1573+// cInfo->OutLen = string_length;
15391574
15401575 // UTF-8コードに変換
1541- WideCharToMultiByte(
1542- CP_ACP, // 変換先文字コード
1543- 0, // フラグ(0:なし)
1544- (unsigned short *)temp_string, // 変換元文字列
1545- -1, // 変換元文字列バイト数(-1:自動)
1546- cInfo->Buf, // 変換した文字列の格納先(BOM:3bytes)
1547- cInfo->BufSize, // 格納先サイズ
1548- NULL,NULL
1549- );
1576+// WideCharToMultiByte(
1577+// CP_ACP, // 変換先文字コード
1578+// 0, // フラグ(0:なし)
1579+// (unsigned short *)temp_string, // 変換元文字列
1580+// -1, // 変換元文字列バイト数(-1:自動)
1581+// cInfo->Buf, // 変換した文字列の格納先(BOM:3bytes)
1582+// cInfo->BufSize, // 格納先サイズ
1583+// NULL,NULL
1584+// );
1585+ cInfo->OutLen = WideCharToMultiByte(CP_ACP, 0, pUTF16, UTF16Length, cInfo->Buf, cInfo->BufSize, NULL, NULL);
1586+ // バッファに収まらないため変換文字数を半減
1587+ while(cInfo->OutLen == 0 && UTF16Length > 0)
1588+ {
1589+ UTF16Length = UTF16Length / 2;
1590+ cInfo->OutLen = WideCharToMultiByte(CP_ACP, 0, pUTF16, UTF16Length, cInfo->Buf, cInfo->BufSize, NULL, NULL);
1591+ }
1592+ // 変換された元の文字列での文字数を取得
1593+ Count = WideCharToMultiByte(CP_UTF8, 0, pUTF16, UTF16Length, NULL, 0, NULL, NULL);
1594+ // 変換可能な残りの文字数を取得
1595+ UTF16Length = MultiByteToWideChar(CP_UTF8, 0, pSrc + Count, SrcLength - Count, NULL, 0);
1596+ cInfo->Str += Count - cInfo->EscUTF8Len;
1597+ cInfo->StrLen -= Count - cInfo->EscUTF8Len;
1598+ cInfo->EscUTF8Len = 0;
1599+ if(UTF16Length > 0)
1600+ Continue = YES;
1601+ else
1602+ {
1603+ // 変換不能なため次の入力の先頭に結合
1604+ memcpy(cInfo->EscUTF8, cInfo->Str, sizeof(char) * cInfo->StrLen);
1605+ cInfo->EscUTF8Len = cInfo->StrLen;
1606+ cInfo->Str += cInfo->StrLen;
1607+ cInfo->StrLen = 0;
1608+ Continue = NO;
1609+ }
1610+
1611+ free(pSrc);
1612+ free(pUTF16);
15501613
15511614 return(Continue);
15521615 }
@@ -1566,64 +1629,112 @@ int ConvSJIStoUTF8N(CODECONVINFO *cInfo)
15661629 {
15671630 int Continue;
15681631
1569- char temp_string[2048];
1632+// char temp_string[2048];
15701633 int string_length;
15711634
1635+ // 大きいサイズに対応
1636+ // 終端のNULLを含むバグを修正
1637+ int SrcLength;
1638+ char* pSrc;
1639+ wchar_t* pUTF16;
1640+ int UTF16Length;
1641+ int Count;
1642+
15721643 Continue = NO;
15731644
15741645 // 生成される中間コードのサイズを調べる
1575- string_length = MultiByteToWideChar(
1576- CP_ACP, // 変換先文字コード
1577- 0, // フラグ(0:なし)
1578- cInfo->Str, // 変換元文字列
1579- -1, // 変換元文字列バイト数(-1:自動)
1580- NULL, // 変換した文字列の格納先
1581- 0 // 格納先サイズ
1582- );
1646+// string_length = MultiByteToWideChar(
1647+// CP_ACP, // 変換先文字コード
1648+// 0, // フラグ(0:なし)
1649+// cInfo->Str, // 変換元文字列
1650+// -1, // 変換元文字列バイト数(-1:自動)
1651+// NULL, // 変換した文字列の格納先
1652+// 0 // 格納先サイズ
1653+// );
1654+ // 前回の変換不能な残りの文字列を入力の先頭に結合
1655+ SrcLength = cInfo->StrLen + cInfo->EscUTF8Len;
1656+ if(!(pSrc = (char*)malloc(sizeof(char) * (SrcLength + 1))))
1657+ {
1658+ *(cInfo->Buf) = '\0';
1659+ cInfo->BufSize = 0;
1660+ return Continue;
1661+ }
1662+ memcpy(pSrc, cInfo->EscUTF8, sizeof(char) * cInfo->EscUTF8Len);
1663+ memcpy(pSrc + cInfo->EscUTF8Len, cInfo->Str, sizeof(char) * cInfo->StrLen);
1664+ *(pSrc + SrcLength) = '\0';
1665+ // Shift_JISの場合、不完全な文字でも変換されることがあるため、末尾の不完全な部分を削る
1666+ Count = 0;
1667+ while(Count < SrcLength)
1668+ {
1669+ if(((unsigned char)*(pSrc + Count) >= 0x81 && (unsigned char)*(pSrc + Count) <= 0x9f) || (unsigned char)*(pSrc + Count) >= 0xe0)
1670+ {
1671+ if((unsigned char)*(pSrc + Count + 1) >= 0x40)
1672+ Count += 2;
1673+ else
1674+ {
1675+ if(Count + 2 > SrcLength)
1676+ break;
1677+ Count += 1;
1678+ }
1679+ }
1680+ else
1681+ Count += 1;
1682+ }
1683+ SrcLength = Count;
1684+ UTF16Length = MultiByteToWideChar(CP_ACP, 0, pSrc, SrcLength, NULL, 0);
15831685
15841686 // サイズ0 or バッファサイズより大きい場合は、
15851687 // cInfo->Bufの最初に'\0'を入れて、
15861688 // cInfo->BufSizeに0を入れて返す。
1587- if( string_length == 0 ||
1588- string_length >= 1024 ){
1689+// if( string_length == 0 ||
1690+// string_length >= 1024 ){
1691+// *(cInfo->Buf) = '\0';
1692+// cInfo->BufSize = 0;
1693+// return(Continue);
1694+// }
1695+ if(!(pUTF16 = (wchar_t*)malloc(sizeof(wchar_t) * UTF16Length)))
1696+ {
1697+ free(pSrc);
15891698 *(cInfo->Buf) = '\0';
15901699 cInfo->BufSize = 0;
1591- return(Continue);
1700+ return Continue;
15921701 }
15931702
15941703 // 中間コード(unicode)に変換
1595- MultiByteToWideChar(
1596- CP_ACP, // 変換先文字コード
1597- 0, // フラグ(0:なし)
1598- cInfo->Str, // 変換元文字列
1599- -1, // 変換元文字列バイト数(-1:自動)
1600- (unsigned short *)temp_string, // 変換した文字列の格納先
1601- 1024 // 格納先サイズ
1602- );
1704+// MultiByteToWideChar(
1705+// CP_ACP, // 変換先文字コード
1706+// 0, // フラグ(0:なし)
1707+// cInfo->Str, // 変換元文字列
1708+// -1, // 変換元文字列バイト数(-1:自動)
1709+// (unsigned short *)temp_string, // 変換した文字列の格納先
1710+// 1024 // 格納先サイズ
1711+// );
1712+ MultiByteToWideChar(CP_ACP, 0, pSrc, SrcLength, pUTF16, UTF16Length);
16031713
16041714 // 生成されるUTF-8コードのサイズを調べる
1605- string_length = WideCharToMultiByte(
1606- CP_UTF8, // 変換先文字コード
1607- 0, // フラグ(0:なし)
1608- (unsigned short *)temp_string, // 変換元文字列
1609- -1, // 変換元文字列バイト数(-1:自動)
1610- NULL, // 変換した文字列の格納先
1611- 0, // 格納先サイズ
1612- NULL,NULL
1613- );
1715+// string_length = WideCharToMultiByte(
1716+// CP_UTF8, // 変換先文字コード
1717+// 0, // フラグ(0:なし)
1718+// (unsigned short *)temp_string, // 変換元文字列
1719+// -1, // 変換元文字列バイト数(-1:自動)
1720+// NULL, // 変換した文字列の格納先
1721+// 0, // 格納先サイズ
1722+// NULL,NULL
1723+// );
1724+ string_length = WideCharToMultiByte(CP_UTF8, 0, pUTF16, UTF16Length, NULL, 0, NULL, NULL);
16141725
16151726 // サイズ0 or 出力バッファサイズより大きい場合は、
16161727 // cInfo->Bufの最初に'\0'を入れて、
16171728 // cInfo->BufSizeに0を入れて返す。
1618- if( string_length == 0 ||
1619- string_length >= cInfo->BufSize ){
1620- *(cInfo->Buf) = '\0';
1621- cInfo->BufSize = 0;
1622- return(Continue);
1623- }
1729+// if( string_length == 0 ||
1730+// string_length >= cInfo->BufSize ){
1731+// *(cInfo->Buf) = '\0';
1732+// cInfo->BufSize = 0;
1733+// return(Continue);
1734+// }
16241735
16251736 // 出力サイズを設定
1626- cInfo->OutLen = string_length;
1737+// cInfo->OutLen = string_length;
16271738
16281739 /*
16291740 // ↓付けちゃだめ コマンドにも追加されてしまう
@@ -1634,15 +1745,43 @@ int ConvSJIStoUTF8N(CODECONVINFO *cInfo)
16341745 */
16351746
16361747 // UTF-8コードに変換
1637- WideCharToMultiByte(
1638- CP_UTF8, // 変換先文字コード
1639- 0, // フラグ(0:なし)
1640- (unsigned short *)temp_string, // 変換元文字列
1641- -1, // 変換元文字列バイト数(-1:自動)
1642- cInfo->Buf, // 変換した文字列の格納先(BOM:3bytes)
1643- cInfo->BufSize, // 格納先サイズ
1644- NULL,NULL
1645- );
1748+// WideCharToMultiByte(
1749+// CP_UTF8, // 変換先文字コード
1750+// 0, // フラグ(0:なし)
1751+// (unsigned short *)temp_string, // 変換元文字列
1752+// -1, // 変換元文字列バイト数(-1:自動)
1753+// cInfo->Buf, // 変換した文字列の格納先(BOM:3bytes)
1754+// cInfo->BufSize, // 格納先サイズ
1755+// NULL,NULL
1756+// );
1757+ cInfo->OutLen = WideCharToMultiByte(CP_UTF8, 0, pUTF16, UTF16Length, cInfo->Buf, cInfo->BufSize, NULL, NULL);
1758+ // バッファに収まらないため変換文字数を半減
1759+ while(cInfo->OutLen == 0 && UTF16Length > 0)
1760+ {
1761+ UTF16Length = UTF16Length / 2;
1762+ cInfo->OutLen = WideCharToMultiByte(CP_UTF8, 0, pUTF16, UTF16Length, cInfo->Buf, cInfo->BufSize, NULL, NULL);
1763+ }
1764+ // 変換された元の文字列での文字数を取得
1765+ Count = WideCharToMultiByte(CP_ACP, 0, pUTF16, UTF16Length, NULL, 0, NULL, NULL);
1766+ // 変換可能な残りの文字数を取得
1767+ UTF16Length = MultiByteToWideChar(CP_ACP, 0, pSrc + Count, SrcLength - Count, NULL, 0);
1768+ cInfo->Str += Count - cInfo->EscUTF8Len;
1769+ cInfo->StrLen -= Count - cInfo->EscUTF8Len;
1770+ cInfo->EscUTF8Len = 0;
1771+ if(UTF16Length > 0)
1772+ Continue = YES;
1773+ else
1774+ {
1775+ // 変換不能なため次の入力の先頭に結合
1776+ memcpy(cInfo->EscUTF8, cInfo->Str, sizeof(char) * cInfo->StrLen);
1777+ cInfo->EscUTF8Len = cInfo->StrLen;
1778+ cInfo->Str += cInfo->StrLen;
1779+ cInfo->StrLen = 0;
1780+ Continue = NO;
1781+ }
1782+
1783+ free(pSrc);
1784+ free(pUTF16);
16461785
16471786 return(Continue);
16481787 }
--- a/common.h
+++ b/common.h
@@ -669,16 +669,16 @@ LIST_UNIX_70
669669
670670 /*===== 漢字コード変換 =====*/
671671
672-#define KANJI_SJIS 1 /* SJIS */
673-#define KANJI_JIS 2 /* JIS */
674-#define KANJI_EUC 3 /* EUC */
675-#define KANJI_SMB_HEX 4 /* Samba-HEX */
676-#define KANJI_SMB_CAP 5 /* Samba-CAP */
677-#define KANJI_UTF8N 6 /* UTF-8N */
672+#define KANJI_SJIS 0 /* SJIS */
673+#define KANJI_JIS 1 /* JIS */
674+#define KANJI_EUC 2 /* EUC */
675+#define KANJI_SMB_HEX 3 /* Samba-HEX */
676+#define KANJI_SMB_CAP 4 /* Samba-CAP */
677+#define KANJI_UTF8N 5 /* UTF-8N */
678678
679-#define KANJI_NOCNV 0 /* 漢字コード変換なし */
679+#define KANJI_NOCNV -1 /* 漢字コード変換なし */
680680
681-#define KANJI_AUTO 0
681+#define KANJI_AUTO -1
682682
683683 /*===== サウンド =====*/
684684
@@ -1003,6 +1003,8 @@ typedef struct codeconvinfo {
10031003 char KanjiFst; /* 漢字コード1バイト目保存用 (内部処理用ワーク) */
10041004 char KanaPrev; /* 半角カタカナ保存用 (内部処理用ワーク) */
10051005 funcptr KanaProc; /* 半角カタカナ処理ルーチン (内部処理用ワーク) */
1006+ char EscUTF8[8];
1007+ int EscUTF8Len;
10061008 } CODECONVINFO;
10071009
10081010
@@ -1234,10 +1236,6 @@ void SetHostKanjiCode(int Type);
12341236 void DispHostKanjiCode(void);
12351237 int AskHostKanjiCode(void);
12361238 void HideHostKanjiButton(void);
1237-void SetHostKanaCnvImm(int Mode);
1238-void SetHostKanaCnv(void);
1239-void DispHostKanaCnv(void);
1240-int AskHostKanaCnv(void);
12411239 // ローカルの漢字コード
12421240 void SetLocalKanjiCodeImm(int Mode);
12431241 void SetLocalKanjiCode(int Type);
@@ -1245,6 +1243,10 @@ void DispLocalKanjiCode(void);
12451243 int AskLocalKanjiCode(void);
12461244 void HideLocalKanjiButton(void);
12471245 // ここまで
1246+void SetHostKanaCnvImm(int Mode);
1247+void SetHostKanaCnv(void);
1248+void DispHostKanaCnv(void);
1249+int AskHostKanaCnv(void);
12481250 void SetSortTypeImm(int LFsort, int LDsort, int RFsort, int RDsort);
12491251 void SetSortTypeByColumn(int Win, int Tab);
12501252 int AskSortType(int Name);
--- a/getput.c
+++ b/getput.c
@@ -1179,6 +1179,8 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
11791179 if((iFileHandle = CreateFile(Pkt->LocalFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &Sec, CreateMode, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE)
11801180 {
11811181 // UTF-8対応
1182+ char Buf3[(BUFSIZE + 3) * 4];
1183+ CODECONVINFO cInfo2;
11821184 int ProcessedBOM = NO;
11831185 if(CreateMode == OPEN_ALWAYS)
11841186 SetFilePointer(iFileHandle, 0, 0, FILE_END);
@@ -1192,6 +1194,9 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
11921194 InitCodeConvInfo(&cInfo);
11931195 cInfo.KanaCnv = Pkt->KanaCnv;
11941196
1197+ InitCodeConvInfo(&cInfo2);
1198+ cInfo2.KanaCnv = Pkt->KanaCnv;
1199+
11951200 /*===== ファイルを受信するループ =====*/
11961201 while((Pkt->Abort == ABORT_NONE) && (ForceAbort == NO))
11971202 {
@@ -1262,13 +1267,26 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
12621267 switch(Pkt->KanjiCodeDesired)
12631268 {
12641269 case KANJI_SJIS:
1265- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1266- cInfo2.OutLen = cInfo.StrLen;
1267- Continue = NO;
1270+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1271+// cInfo2.OutLen = cInfo.StrLen;
1272+// Continue = NO;
1273+ // カナ変換のため
1274+ Continue = ConvSJIStoJIS(&cInfo);
1275+ cInfo2.Str = cInfo.Buf;
1276+ cInfo2.StrLen = cInfo.OutLen;
1277+ cInfo2.Buf = Buf3;
1278+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1279+ ConvJIStoSJIS(&cInfo2);
12681280 break;
12691281 case KANJI_JIS:
1282+ Continue = ConvSJIStoJIS(&cInfo);
1283+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1284+ cInfo2.OutLen = cInfo.OutLen;
12701285 break;
12711286 case KANJI_EUC:
1287+ Continue = ConvSJIStoEUC(&cInfo);
1288+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1289+ cInfo2.OutLen = cInfo.OutLen;
12721290 break;
12731291 case KANJI_UTF8N:
12741292 if(ProcessedBOM == NO)
@@ -1280,7 +1298,7 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
12801298 break;
12811299 }
12821300 Continue = ConvSJIStoUTF8N(&cInfo);
1283- memcpy(Buf3, Buf2, cInfo.OutLen);
1301+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
12841302 cInfo2.OutLen = cInfo.OutLen;
12851303 break;
12861304 }
@@ -1290,15 +1308,28 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
12901308 {
12911309 case KANJI_SJIS:
12921310 Continue = ConvJIStoSJIS(&cInfo);
1293- memcpy(Buf3, Buf2, cInfo.OutLen);
1311+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
12941312 cInfo2.OutLen = cInfo.OutLen;
12951313 break;
12961314 case KANJI_JIS:
1297- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1298- cInfo2.OutLen = cInfo.StrLen;
1299- Continue = NO;
1315+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1316+// cInfo2.OutLen = cInfo.StrLen;
1317+// Continue = NO;
1318+ // カナ変換のため
1319+ Continue = ConvJIStoSJIS(&cInfo);
1320+ cInfo2.Str = cInfo.Buf;
1321+ cInfo2.StrLen = cInfo.OutLen;
1322+ cInfo2.Buf = Buf3;
1323+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1324+ ConvSJIStoJIS(&cInfo2);
13001325 break;
13011326 case KANJI_EUC:
1327+ Continue = ConvJIStoSJIS(&cInfo);
1328+ cInfo2.Str = cInfo.Buf;
1329+ cInfo2.StrLen = cInfo.OutLen;
1330+ cInfo2.Buf = Buf3;
1331+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1332+ ConvSJIStoEUC(&cInfo2);
13021333 break;
13031334 case KANJI_UTF8N:
13041335 if(ProcessedBOM == NO)
@@ -1310,8 +1341,6 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
13101341 break;
13111342 }
13121343 Continue = ConvJIStoSJIS(&cInfo);
1313- InitCodeConvInfo(&cInfo2);
1314- cInfo2.KanaCnv = NO;
13151344 cInfo2.Str = cInfo.Buf;
13161345 cInfo2.StrLen = cInfo.OutLen;
13171346 cInfo2.Buf = Buf3;
@@ -1325,15 +1354,28 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
13251354 {
13261355 case KANJI_SJIS:
13271356 Continue = ConvEUCtoSJIS(&cInfo);
1328- memcpy(Buf3, Buf2, cInfo.OutLen);
1357+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
13291358 cInfo2.OutLen = cInfo.OutLen;
13301359 break;
13311360 case KANJI_JIS:
1361+ Continue = ConvEUCtoSJIS(&cInfo);
1362+ cInfo2.Str = cInfo.Buf;
1363+ cInfo2.StrLen = cInfo.OutLen;
1364+ cInfo2.Buf = Buf3;
1365+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1366+ ConvSJIStoJIS(&cInfo2);
13321367 break;
13331368 case KANJI_EUC:
1334- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1335- cInfo2.OutLen = cInfo.StrLen;
1336- Continue = NO;
1369+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
1370+// cInfo2.OutLen = cInfo.StrLen;
1371+// Continue = NO;
1372+ // カナ変換のため
1373+ Continue = ConvEUCtoSJIS(&cInfo);
1374+ cInfo2.Str = cInfo.Buf;
1375+ cInfo2.StrLen = cInfo.OutLen;
1376+ cInfo2.Buf = Buf3;
1377+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1378+ ConvSJIStoEUC(&cInfo2);
13371379 break;
13381380 case KANJI_UTF8N:
13391381 if(ProcessedBOM == NO)
@@ -1345,8 +1387,6 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
13451387 break;
13461388 }
13471389 Continue = ConvEUCtoSJIS(&cInfo);
1348- InitCodeConvInfo(&cInfo2);
1349- cInfo2.KanaCnv = NO;
13501390 cInfo2.Str = cInfo.Buf;
13511391 cInfo2.StrLen = cInfo.OutLen;
13521392 cInfo2.Buf = Buf3;
@@ -1379,12 +1419,24 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
13791419 {
13801420 case KANJI_SJIS:
13811421 Continue = ConvUTF8NtoSJIS(&cInfo);
1382- memcpy(Buf3, Buf2, cInfo.OutLen);
1422+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
13831423 cInfo2.OutLen = cInfo.OutLen;
13841424 break;
13851425 case KANJI_JIS:
1426+ Continue = ConvUTF8NtoSJIS(&cInfo);
1427+ cInfo2.Str = cInfo.Buf;
1428+ cInfo2.StrLen = cInfo.OutLen;
1429+ cInfo2.Buf = Buf3;
1430+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1431+ ConvSJIStoJIS(&cInfo2);
13861432 break;
13871433 case KANJI_EUC:
1434+ Continue = ConvUTF8NtoSJIS(&cInfo);
1435+ cInfo2.Str = cInfo.Buf;
1436+ cInfo2.StrLen = cInfo.OutLen;
1437+ cInfo2.Buf = Buf3;
1438+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1439+ ConvSJIStoEUC(&cInfo2);
13881440 break;
13891441 case KANJI_UTF8N:
13901442 memcpy(Buf3, cInfo.Str, cInfo.StrLen);
@@ -1425,7 +1477,130 @@ static int DownLoadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
14251477 cInfo.Buf = Buf2;
14261478 cInfo.BufSize = BUFSIZE+3;
14271479 FlushRestData(&cInfo);
1428- if(WriteFile(iFileHandle, Buf2, cInfo.OutLen, &Writed, NULL) == FALSE)
1480+ switch(Pkt->KanjiCode)
1481+ {
1482+ case KANJI_SJIS:
1483+ switch(Pkt->KanjiCodeDesired)
1484+ {
1485+ case KANJI_SJIS:
1486+ // カナ変換のため
1487+ cInfo2.Str = cInfo.Buf;
1488+ cInfo2.StrLen = cInfo.OutLen;
1489+ cInfo2.Buf = Buf3;
1490+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1491+ ConvJIStoSJIS(&cInfo2);
1492+ break;
1493+ case KANJI_JIS:
1494+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1495+ cInfo2.OutLen = cInfo.OutLen;
1496+ break;
1497+ case KANJI_EUC:
1498+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1499+ cInfo2.OutLen = cInfo.OutLen;
1500+ break;
1501+ case KANJI_UTF8N:
1502+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1503+ cInfo2.OutLen = cInfo.OutLen;
1504+ break;
1505+ }
1506+ break;
1507+ case KANJI_JIS:
1508+ switch(Pkt->KanjiCodeDesired)
1509+ {
1510+ case KANJI_SJIS:
1511+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1512+ cInfo2.OutLen = cInfo.OutLen;
1513+ break;
1514+ case KANJI_JIS:
1515+ // カナ変換のため
1516+ cInfo2.Str = cInfo.Buf;
1517+ cInfo2.StrLen = cInfo.OutLen;
1518+ cInfo2.Buf = Buf3;
1519+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1520+ ConvSJIStoJIS(&cInfo2);
1521+ break;
1522+ case KANJI_EUC:
1523+ cInfo2.Str = cInfo.Buf;
1524+ cInfo2.StrLen = cInfo.OutLen;
1525+ cInfo2.Buf = Buf3;
1526+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1527+ ConvSJIStoEUC(&cInfo2);
1528+ break;
1529+ case KANJI_UTF8N:
1530+ cInfo2.Str = cInfo.Buf;
1531+ cInfo2.StrLen = cInfo.OutLen;
1532+ cInfo2.Buf = Buf3;
1533+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1534+ ConvSJIStoUTF8N(&cInfo2);
1535+ break;
1536+ }
1537+ break;
1538+ case KANJI_EUC:
1539+ switch(Pkt->KanjiCodeDesired)
1540+ {
1541+ case KANJI_SJIS:
1542+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1543+ cInfo2.OutLen = cInfo.OutLen;
1544+ break;
1545+ case KANJI_JIS:
1546+ cInfo2.Str = cInfo.Buf;
1547+ cInfo2.StrLen = cInfo.OutLen;
1548+ cInfo2.Buf = Buf3;
1549+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1550+ ConvSJIStoJIS(&cInfo2);
1551+ break;
1552+ case KANJI_EUC:
1553+ // カナ変換のため
1554+ cInfo2.Str = cInfo.Buf;
1555+ cInfo2.StrLen = cInfo.OutLen;
1556+ cInfo2.Buf = Buf3;
1557+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1558+ ConvSJIStoEUC(&cInfo2);
1559+ break;
1560+ case KANJI_UTF8N:
1561+ cInfo2.Str = cInfo.Buf;
1562+ cInfo2.StrLen = cInfo.OutLen;
1563+ cInfo2.Buf = Buf3;
1564+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1565+ ConvSJIStoUTF8N(&cInfo2);
1566+ break;
1567+ }
1568+ break;
1569+ case KANJI_UTF8N:
1570+ switch(Pkt->KanjiCodeDesired)
1571+ {
1572+ case KANJI_SJIS:
1573+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1574+ cInfo2.OutLen = cInfo.OutLen;
1575+ break;
1576+ case KANJI_JIS:
1577+ cInfo2.Str = cInfo.Buf;
1578+ cInfo2.StrLen = cInfo.OutLen;
1579+ cInfo2.Buf = Buf3;
1580+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1581+ ConvSJIStoJIS(&cInfo2);
1582+ break;
1583+ case KANJI_EUC:
1584+ cInfo2.Str = cInfo.Buf;
1585+ cInfo2.StrLen = cInfo.OutLen;
1586+ cInfo2.Buf = Buf3;
1587+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1588+ ConvSJIStoEUC(&cInfo2);
1589+ break;
1590+ case KANJI_UTF8N:
1591+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
1592+ cInfo2.OutLen = cInfo.OutLen;
1593+ break;
1594+ }
1595+ break;
1596+ }
1597+// if(WriteFile(iFileHandle, Buf2, cInfo.OutLen, &Writed, NULL) == FALSE)
1598+ if(WriteFile(iFileHandle, Buf3, cInfo2.OutLen, &Writed, NULL) == FALSE)
1599+ Pkt->Abort = ABORT_DISKFULL;
1600+ cInfo2.Buf = Buf3;
1601+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
1602+ FlushRestData(&cInfo2);
1603+ if(WriteFile(iFileHandle, Buf3, cInfo2.OutLen, &Writed, NULL) == FALSE)
14291604 Pkt->Abort = ABORT_DISKFULL;
14301605 }
14311606
@@ -1981,6 +2156,8 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
19812156 FILE_SHARE_READ|FILE_SHARE_WRITE, &Sec, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
19822157 {
19832158 // UTF-8対応
2159+ char Buf3[(BUFSIZE + 3) * 4];
2160+ CODECONVINFO cInfo2;
19842161 int ProcessedBOM = NO;
19852162 if(Pkt->hWndTrans != NULL)
19862163 {
@@ -2000,6 +2177,9 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
20002177 cInfo.KanaCnv = Pkt->KanaCnv;
20012178 InitTermCodeConvInfo(&tInfo);
20022179
2180+ InitCodeConvInfo(&cInfo2);
2181+ cInfo2.KanaCnv = Pkt->KanaCnv;
2182+
20032183 /*===== ファイルを送信するループ =====*/
20042184 while((Pkt->Abort == ABORT_NONE) &&
20052185 (ForceAbort == NO) &&
@@ -2031,21 +2211,32 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
20312211 // Continue = ConvSJIStoJIS(&cInfo);
20322212 // else
20332213 // Continue = ConvSJIStoEUC(&cInfo);
2034- char Buf3[(BUFSIZE + 3) * 4];
2035- CODECONVINFO cInfo2;
20362214 switch(Pkt->KanjiCodeDesired)
20372215 {
20382216 case KANJI_SJIS:
20392217 switch(Pkt->KanjiCode)
20402218 {
20412219 case KANJI_SJIS:
2042- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2043- cInfo2.OutLen = cInfo.StrLen;
2044- Continue = NO;
2220+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2221+// cInfo2.OutLen = cInfo.StrLen;
2222+// Continue = NO;
2223+ // カナ変換のため
2224+ Continue = ConvSJIStoJIS(&cInfo);
2225+ cInfo2.Str = cInfo.Buf;
2226+ cInfo2.StrLen = cInfo.OutLen;
2227+ cInfo2.Buf = Buf3;
2228+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2229+ ConvJIStoSJIS(&cInfo2);
20452230 break;
20462231 case KANJI_JIS:
2232+ Continue = ConvSJIStoJIS(&cInfo);
2233+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2234+ cInfo2.OutLen = cInfo.OutLen;
20472235 break;
20482236 case KANJI_EUC:
2237+ Continue = ConvSJIStoEUC(&cInfo);
2238+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2239+ cInfo2.OutLen = cInfo.OutLen;
20492240 break;
20502241 case KANJI_UTF8N:
20512242 if(ProcessedBOM == NO)
@@ -2057,7 +2248,7 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
20572248 break;
20582249 }
20592250 Continue = ConvSJIStoUTF8N(&cInfo);
2060- memcpy(Buf3, cInfo.Str, cInfo.OutLen);
2251+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
20612252 cInfo2.OutLen = cInfo.OutLen;
20622253 break;
20632254 }
@@ -2067,15 +2258,28 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
20672258 {
20682259 case KANJI_SJIS:
20692260 Continue = ConvJIStoSJIS(&cInfo);
2070- memcpy(Buf3, Buf2, cInfo.OutLen);
2261+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
20712262 cInfo2.OutLen = cInfo.OutLen;
20722263 break;
20732264 case KANJI_JIS:
2074- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2075- cInfo2.OutLen = cInfo.StrLen;
2076- Continue = NO;
2265+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2266+// cInfo2.OutLen = cInfo.StrLen;
2267+// Continue = NO;
2268+ // カナ変換のため
2269+ Continue = ConvJIStoSJIS(&cInfo);
2270+ cInfo2.Str = cInfo.Buf;
2271+ cInfo2.StrLen = cInfo.OutLen;
2272+ cInfo2.Buf = Buf3;
2273+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2274+ ConvSJIStoJIS(&cInfo2);
20772275 break;
20782276 case KANJI_EUC:
2277+ Continue = ConvJIStoSJIS(&cInfo);
2278+ cInfo2.Str = cInfo.Buf;
2279+ cInfo2.StrLen = cInfo.OutLen;
2280+ cInfo2.Buf = Buf3;
2281+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2282+ ConvSJIStoEUC(&cInfo2);
20792283 break;
20802284 case KANJI_UTF8N:
20812285 if(ProcessedBOM == NO)
@@ -2087,8 +2291,6 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
20872291 break;
20882292 }
20892293 Continue = ConvJIStoSJIS(&cInfo);
2090- InitCodeConvInfo(&cInfo2);
2091- cInfo2.KanaCnv = NO;
20922294 cInfo2.Str = cInfo.Buf;
20932295 cInfo2.StrLen = cInfo.OutLen;
20942296 cInfo2.Buf = Buf3;
@@ -2102,15 +2304,28 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
21022304 {
21032305 case KANJI_SJIS:
21042306 Continue = ConvEUCtoSJIS(&cInfo);
2105- memcpy(Buf3, Buf2, cInfo.OutLen);
2307+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
21062308 cInfo2.OutLen = cInfo.OutLen;
21072309 break;
21082310 case KANJI_JIS:
2311+ Continue = ConvEUCtoSJIS(&cInfo);
2312+ cInfo2.Str = cInfo.Buf;
2313+ cInfo2.StrLen = cInfo.OutLen;
2314+ cInfo2.Buf = Buf3;
2315+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2316+ ConvSJIStoJIS(&cInfo2);
21092317 break;
21102318 case KANJI_EUC:
2111- memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2112- cInfo2.OutLen = cInfo.StrLen;
2113- Continue = NO;
2319+// memcpy(Buf3, cInfo.Str, cInfo.StrLen);
2320+// cInfo2.OutLen = cInfo.StrLen;
2321+// Continue = NO;
2322+ // カナ変換のため
2323+ Continue = ConvEUCtoSJIS(&cInfo);
2324+ cInfo2.Str = cInfo.Buf;
2325+ cInfo2.StrLen = cInfo.OutLen;
2326+ cInfo2.Buf = Buf3;
2327+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2328+ ConvSJIStoEUC(&cInfo2);
21142329 break;
21152330 case KANJI_UTF8N:
21162331 if(ProcessedBOM == NO)
@@ -2122,8 +2337,6 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
21222337 break;
21232338 }
21242339 Continue = ConvEUCtoSJIS(&cInfo);
2125- InitCodeConvInfo(&cInfo2);
2126- cInfo2.KanaCnv = NO;
21272340 cInfo2.Str = cInfo.Buf;
21282341 cInfo2.StrLen = cInfo.OutLen;
21292342 cInfo2.Buf = Buf3;
@@ -2156,12 +2369,24 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
21562369 {
21572370 case KANJI_SJIS:
21582371 Continue = ConvUTF8NtoSJIS(&cInfo);
2159- memcpy(Buf3, Buf2, cInfo.OutLen);
2372+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
21602373 cInfo2.OutLen = cInfo.OutLen;
21612374 break;
21622375 case KANJI_JIS:
2376+ Continue = ConvUTF8NtoSJIS(&cInfo);
2377+ cInfo2.Str = cInfo.Buf;
2378+ cInfo2.StrLen = cInfo.OutLen;
2379+ cInfo2.Buf = Buf3;
2380+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2381+ ConvSJIStoJIS(&cInfo2);
21632382 break;
21642383 case KANJI_EUC:
2384+ Continue = ConvUTF8NtoSJIS(&cInfo);
2385+ cInfo2.Str = cInfo.Buf;
2386+ cInfo2.StrLen = cInfo.OutLen;
2387+ cInfo2.Buf = Buf3;
2388+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2389+ ConvSJIStoEUC(&cInfo2);
21652390 break;
21662391 case KANJI_UTF8N:
21672392 memcpy(Buf3, cInfo.Str, cInfo.StrLen);
@@ -2206,8 +2431,131 @@ static int UpLoadFile(TRANSPACKET *Pkt, SOCKET dSkt)
22062431 cInfo.Buf = Buf2;
22072432 cInfo.BufSize = BUFSIZE+3;
22082433 FlushRestData(&cInfo);
2434+ switch(Pkt->KanjiCodeDesired)
2435+ {
2436+ case KANJI_SJIS:
2437+ switch(Pkt->KanjiCode)
2438+ {
2439+ case KANJI_SJIS:
2440+ // カナ変換のため
2441+ cInfo2.Str = cInfo.Buf;
2442+ cInfo2.StrLen = cInfo.OutLen;
2443+ cInfo2.Buf = Buf3;
2444+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2445+ ConvJIStoSJIS(&cInfo2);
2446+ break;
2447+ case KANJI_JIS:
2448+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2449+ cInfo2.OutLen = cInfo.OutLen;
2450+ break;
2451+ case KANJI_EUC:
2452+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2453+ cInfo2.OutLen = cInfo.OutLen;
2454+ break;
2455+ case KANJI_UTF8N:
2456+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2457+ cInfo2.OutLen = cInfo.OutLen;
2458+ break;
2459+ }
2460+ break;
2461+ case KANJI_JIS:
2462+ switch(Pkt->KanjiCode)
2463+ {
2464+ case KANJI_SJIS:
2465+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2466+ cInfo2.OutLen = cInfo.OutLen;
2467+ break;
2468+ case KANJI_JIS:
2469+ // カナ変換のため
2470+ cInfo2.Str = cInfo.Buf;
2471+ cInfo2.StrLen = cInfo.OutLen;
2472+ cInfo2.Buf = Buf3;
2473+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2474+ ConvSJIStoJIS(&cInfo2);
2475+ break;
2476+ case KANJI_EUC:
2477+ cInfo2.Str = cInfo.Buf;
2478+ cInfo2.StrLen = cInfo.OutLen;
2479+ cInfo2.Buf = Buf3;
2480+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2481+ ConvSJIStoEUC(&cInfo2);
2482+ break;
2483+ case KANJI_UTF8N:
2484+ cInfo2.Str = cInfo.Buf;
2485+ cInfo2.StrLen = cInfo.OutLen;
2486+ cInfo2.Buf = Buf3;
2487+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2488+ ConvSJIStoUTF8N(&cInfo2);
2489+ break;
2490+ }
2491+ break;
2492+ case KANJI_EUC:
2493+ switch(Pkt->KanjiCode)
2494+ {
2495+ case KANJI_SJIS:
2496+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2497+ cInfo2.OutLen = cInfo.OutLen;
2498+ break;
2499+ case KANJI_JIS:
2500+ cInfo2.Str = cInfo.Buf;
2501+ cInfo2.StrLen = cInfo.OutLen;
2502+ cInfo2.Buf = Buf3;
2503+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2504+ ConvSJIStoJIS(&cInfo2);
2505+ break;
2506+ case KANJI_EUC:
2507+ // カナ変換のため
2508+ cInfo2.Str = cInfo.Buf;
2509+ cInfo2.StrLen = cInfo.OutLen;
2510+ cInfo2.Buf = Buf3;
2511+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2512+ ConvSJIStoEUC(&cInfo2);
2513+ break;
2514+ case KANJI_UTF8N:
2515+ cInfo2.Str = cInfo.Buf;
2516+ cInfo2.StrLen = cInfo.OutLen;
2517+ cInfo2.Buf = Buf3;
2518+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2519+ ConvSJIStoUTF8N(&cInfo2);
2520+ break;
2521+ }
2522+ break;
2523+ case KANJI_UTF8N:
2524+ switch(Pkt->KanjiCode)
2525+ {
2526+ case KANJI_SJIS:
2527+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2528+ cInfo2.OutLen = cInfo.OutLen;
2529+ break;
2530+ case KANJI_JIS:
2531+ cInfo2.Str = cInfo.Buf;
2532+ cInfo2.StrLen = cInfo.OutLen;
2533+ cInfo2.Buf = Buf3;
2534+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2535+ ConvSJIStoJIS(&cInfo2);
2536+ break;
2537+ case KANJI_EUC:
2538+ cInfo2.Str = cInfo.Buf;
2539+ cInfo2.StrLen = cInfo.OutLen;
2540+ cInfo2.Buf = Buf3;
2541+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2542+ ConvSJIStoEUC(&cInfo2);
2543+ break;
2544+ case KANJI_UTF8N:
2545+ memcpy(Buf3, cInfo.Buf, cInfo.OutLen);
2546+ cInfo2.OutLen = cInfo.OutLen;
2547+ break;
2548+ }
2549+ break;
2550+ }
22092551
2210- if(TermCodeConvAndSend(&tInfo, dSkt, Buf2, cInfo.OutLen, Pkt->Type) == FAIL)
2552+// if(TermCodeConvAndSend(&tInfo, dSkt, Buf2, cInfo.OutLen, Pkt->Type) == FAIL)
2553+ if(TermCodeConvAndSend(&tInfo, dSkt, Buf3, cInfo2.OutLen, Pkt->Type) == FAIL)
2554+ Pkt->Abort = ABORT_ERROR;
2555+ cInfo2.Buf = Buf3;
2556+ cInfo2.BufSize = (BUFSIZE + 3) * 4;
2557+ FlushRestData(&cInfo2);
2558+ if(TermCodeConvAndSend(&tInfo, dSkt, Buf3, cInfo2.OutLen, Pkt->Type) == FAIL)
22112559 Pkt->Abort = ABORT_ERROR;
22122560 }
22132561
@@ -2571,12 +2919,17 @@ static void DispTransFileInfo(TRANSPACKET *Pkt, char *Title, int SkipButton, int
25712919 else if(Pkt->Type == TYPE_A)
25722920 SendDlgItemMessage(Pkt->hWndTrans, TRANS_MODE, WM_SETTEXT, 0, (LPARAM)MSGJPN120);
25732921
2922+ // UTF-8対応
25742923 if(Pkt->KanjiCode == KANJI_NOCNV)
25752924 SendDlgItemMessage(Pkt->hWndTrans, TRANS_KANJI, WM_SETTEXT, 0, (LPARAM)MSGJPN121);
2925+ else if(Pkt->KanjiCode == KANJI_SJIS)
2926+ SendDlgItemMessage(Pkt->hWndTrans, TRANS_KANJI, WM_SETTEXT, 0, (LPARAM)MSGJPN305);
25762927 else if(Pkt->KanjiCode == KANJI_JIS)
25772928 SendDlgItemMessage(Pkt->hWndTrans, TRANS_KANJI, WM_SETTEXT, 0, (LPARAM)MSGJPN122);
25782929 else if(Pkt->KanjiCode == KANJI_EUC)
25792930 SendDlgItemMessage(Pkt->hWndTrans, TRANS_KANJI, WM_SETTEXT, 0, (LPARAM)MSGJPN123);
2931+ else if(Pkt->KanjiCode == KANJI_UTF8N)
2932+ SendDlgItemMessage(Pkt->hWndTrans, TRANS_KANJI, WM_SETTEXT, 0, (LPARAM)MSGJPN306);
25802933 }
25812934 else
25822935 {
@@ -2668,14 +3021,28 @@ static int IsSpecialDevice(char *Fname)
26683021 int Sts;
26693022
26703023 Sts = NO;
2671- if((_stricmp(Fname, "CON") == 0) ||
2672- (_stricmp(Fname, "PRN") == 0) ||
2673- (_stricmp(Fname, "AUX") == 0) ||
2674- (_strnicmp(Fname, "CON.", 4) == 0) ||
2675- (_strnicmp(Fname, "PRN.", 4) == 0) ||
2676- (_strnicmp(Fname, "AUX.", 4) == 0))
3024+ // バグ修正
3025+// if((_stricmp(Fname, "CON") == 0) ||
3026+// (_stricmp(Fname, "PRN") == 0) ||
3027+// (_stricmp(Fname, "AUX") == 0) ||
3028+// (_strnicmp(Fname, "CON.", 4) == 0) ||
3029+// (_strnicmp(Fname, "PRN.", 4) == 0) ||
3030+// (_strnicmp(Fname, "AUX.", 4) == 0))
3031+// {
3032+// Sts = YES;
3033+// }
3034+ if(_strnicmp(Fname, "AUX", 3) == 0|| _strnicmp(Fname, "CON", 3) == 0 || _strnicmp(Fname, "NUL", 3) == 0 || _strnicmp(Fname, "PRN", 3) == 0)
3035+ {
3036+ if(*(Fname + 3) == '\0' || *(Fname + 3) == '.')
3037+ Sts = YES;
3038+ }
3039+ else if(_strnicmp(Fname, "COM", 3) == 0 || _strnicmp(Fname, "LPT", 3) == 0)
26773040 {
2678- Sts = YES;
3041+ if(isdigit(*(Fname + 3)) != 0)
3042+ {
3043+ if(*(Fname + 4) == '\0' || *(Fname + 4) == '.')
3044+ Sts = YES;
3045+ }
26793046 }
26803047 return(Sts);
26813048 }
--- a/main.c
+++ b/main.c
@@ -1308,7 +1308,7 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
13081308 break;
13091309
13101310 case MENU_KNJ_SJIS :
1311- lpttt->lpszText = MSGJPN305;
1311+ lpttt->lpszText = MSGJPN307;
13121312 break;
13131313
13141314 case MENU_KNJ_EUC :
@@ -1320,7 +1320,7 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
13201320 break;
13211321
13221322 case MENU_KNJ_UTF8N :
1323- lpttt->lpszText = MSGJPN306;
1323+ lpttt->lpszText = MSGJPN308;
13241324 break;
13251325
13261326 case MENU_KNJ_NONE :
@@ -1328,19 +1328,19 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
13281328 break;
13291329
13301330 case MENU_L_KNJ_SJIS :
1331- lpttt->lpszText = MSGJPN307;
1331+ lpttt->lpszText = MSGJPN309;
13321332 break;
13331333
13341334 case MENU_L_KNJ_EUC :
1335- lpttt->lpszText = MSGJPN308;
1335+ lpttt->lpszText = MSGJPN310;
13361336 break;
13371337
13381338 case MENU_L_KNJ_JIS :
1339- lpttt->lpszText = MSGJPN309;
1339+ lpttt->lpszText = MSGJPN311;
13401340 break;
13411341
13421342 case MENU_L_KNJ_UTF8N :
1343- lpttt->lpszText = MSGJPN310;
1343+ lpttt->lpszText = MSGJPN312;
13441344 break;
13451345
13461346 case MENU_KANACNV :
@@ -1937,6 +1937,7 @@ void DoubleClickProc(int Win, int Mode, int App)
19371937 MainTransPkt.Type = AskTransferTypeAssoc(MainTransPkt.RemoteFile, AskTransferType());
19381938 MainTransPkt.Size = 1;
19391939 MainTransPkt.KanjiCode = AskHostKanjiCode();
1940+ MainTransPkt.KanjiCodeDesired = AskLocalKanjiCode();
19401941 MainTransPkt.KanaCnv = AskHostKanaCnv();
19411942 MainTransPkt.Mode = EXIST_OVW;
19421943 MainTransPkt.ExistSize = 0;
--- a/mbswrapper.c
+++ b/mbswrapper.c
@@ -393,7 +393,7 @@ START_ROUTINE
393393 break;
394394 default:
395395 GetClassNameW(hWnd, ClassName, sizeof(ClassName) / sizeof(wchar_t));
396- if(wcsicmp(ClassName, WC_EDITW) == 0)
396+ if(_wcsicmp(ClassName, WC_EDITW) == 0)
397397 {
398398 switch(Msg)
399399 {
@@ -406,7 +406,7 @@ START_ROUTINE
406406 break;
407407 }
408408 }
409- else if(wcsicmp(ClassName, WC_COMBOBOXW) == 0)
409+ else if(_wcsicmp(ClassName, WC_COMBOBOXW) == 0)
410410 {
411411 switch(Msg)
412412 {
@@ -427,7 +427,7 @@ START_ROUTINE
427427 break;
428428 }
429429 }
430- else if(wcsicmp(ClassName, WC_LISTBOXW) == 0)
430+ else if(_wcsicmp(ClassName, WC_LISTBOXW) == 0)
431431 {
432432 switch(Msg)
433433 {
@@ -452,7 +452,7 @@ START_ROUTINE
452452 break;
453453 }
454454 }
455- else if(wcsicmp(ClassName, WC_LISTVIEWW) == 0)
455+ else if(_wcsicmp(ClassName, WC_LISTVIEWW) == 0)
456456 {
457457 switch(Msg)
458458 {
@@ -568,7 +568,7 @@ START_ROUTINE
568568 break;
569569 }
570570 }
571- else if(wcsicmp(ClassName, STATUSCLASSNAMEW) == 0)
571+ else if(_wcsicmp(ClassName, STATUSCLASSNAMEW) == 0)
572572 {
573573 switch(Msg)
574574 {
@@ -733,13 +733,36 @@ LSTATUS RegQueryValueExM(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDW
733733 {
734734 LSTATUS r = 0;
735735 wchar_t* pw0 = NULL;
736+ wchar_t* pw1 = NULL;
737+ DWORD dwType;
738+ DWORD wcbData;
736739 START_ROUTINE
737740 pw0 = DuplicateMtoW(lpValueName, -1);
738- // TODO: レジストリはUTF-8で保存されてしまう(以前のバージョンと互換性なし)
739- // UTF-16で保存するべき
740- r = RegQueryValueExW(hKey, pw0, lpReserved, lpType, lpData, lpcbData);
741+ if(RegQueryValueExW(hKey, pw0, NULL, &dwType, NULL, 0) == ERROR_SUCCESS)
742+ {
743+ switch(dwType)
744+ {
745+ case REG_SZ:
746+ case REG_EXPAND_SZ:
747+ case REG_MULTI_SZ:
748+ if(lpData && lpcbData)
749+ {
750+ pw1 = AllocateStringW(*lpcbData / sizeof(char) * 4);
751+ wcbData = *lpcbData / sizeof(char) * 4;
752+ r = RegQueryValueExW(hKey, pw0, lpReserved, lpType, (LPBYTE)pw1, &wcbData);
753+ *lpcbData = sizeof(char) * WtoM((char*)lpData, *lpcbData / sizeof(char), pw1, wcbData / sizeof(wchar_t));
754+ }
755+ break;
756+ default:
757+ r = RegQueryValueExW(hKey, pw0, lpReserved, lpType, lpData, lpcbData);
758+ break;
759+ }
760+ }
761+ else
762+ r = RegQueryValueExW(hKey, pw0, lpReserved, lpType, lpData, lpcbData);
741763 END_ROUTINE
742764 FreeDuplicatedString(pw0);
765+ FreeDuplicatedString(pw1);
743766 return r;
744767 }
745768
@@ -747,13 +770,27 @@ LSTATUS RegSetValueExM(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwTy
747770 {
748771 LSTATUS r = 0;
749772 wchar_t* pw0 = NULL;
773+ wchar_t* pw1 = NULL;
774+ DWORD wcbData;
750775 START_ROUTINE
751776 pw0 = DuplicateMtoW(lpValueName, -1);
752- // TODO: レジストリはUTF-8で保存されてしまう(以前のバージョンと互換性なし)
753- // UTF-16で保存するべき
777+ switch(dwType)
778+ {
779+ case REG_SZ:
780+ case REG_EXPAND_SZ:
781+ case REG_MULTI_SZ:
782+ wcbData = MtoW(NULL, 0, (char*)lpData, cbData / sizeof(char));
783+ pw1 = AllocateStringW(wcbData);
784+ MtoW(pw1, wcbData, (char*)lpData, cbData / sizeof(char));
785+ wcbData = sizeof(wchar_t) * wcbData;
786+ lpData = (BYTE*)pw1;
787+ cbData = wcbData;
788+ break;
789+ }
754790 r = RegSetValueExW(hKey, pw0, Reserved, dwType, lpData, cbData);
755791 END_ROUTINE
756792 FreeDuplicatedString(pw0);
793+ FreeDuplicatedString(pw1);
757794 return r;
758795 }
759796
@@ -974,7 +1011,7 @@ END_ROUTINE
9741011
9751012 HWND HtmlHelpM(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData)
9761013 {
977- HINSTANCE r = NULL;
1014+ HWND r = NULL;
9781015 wchar_t* pw0 = NULL;
9791016 START_ROUTINE
9801017 pw0 = DuplicateMtoW(pszFile, -1);
@@ -984,6 +1021,76 @@ END_ROUTINE
9841021 return r;
9851022 }
9861023
1024+BOOL CreateProcessM(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
1025+{
1026+ BOOL r = FALSE;
1027+ wchar_t* pw0 = NULL;
1028+ wchar_t* pw1 = NULL;
1029+ wchar_t* pw2 = NULL;
1030+ wchar_t* pw3 = NULL;
1031+ wchar_t* pw4 = NULL;
1032+ wchar_t* pw5 = NULL;
1033+ STARTUPINFOW wStartupInfo;
1034+START_ROUTINE
1035+ pw0 = DuplicateMtoW(lpApplicationName, -1);
1036+ pw1 = DuplicateMtoWBuffer(lpCommandLine, -1, (strlen(lpCommandLine) + 1) * 4);
1037+ pw2 = DuplicateMtoW(lpCurrentDirectory, -1);
1038+ wStartupInfo.cb = sizeof(LPSTARTUPINFOW);
1039+ pw3 = DuplicateMtoW(lpStartupInfo->lpReserved, -1);
1040+ wStartupInfo.lpReserved = pw3;
1041+ pw4 = DuplicateMtoW(lpStartupInfo->lpDesktop, -1);
1042+ wStartupInfo.lpDesktop = pw4;
1043+ pw5 = DuplicateMtoW(lpStartupInfo->lpTitle, -1);
1044+ wStartupInfo.lpTitle = pw5;
1045+ wStartupInfo.dwX = lpStartupInfo->dwX;
1046+ wStartupInfo.dwY = lpStartupInfo->dwY;
1047+ wStartupInfo.dwXSize = lpStartupInfo->dwXSize;
1048+ wStartupInfo.dwYSize = lpStartupInfo->dwYSize;
1049+ wStartupInfo.dwXCountChars = lpStartupInfo->dwXCountChars;
1050+ wStartupInfo.dwYCountChars = lpStartupInfo->dwYCountChars;
1051+ wStartupInfo.dwFillAttribute = lpStartupInfo->dwFillAttribute;
1052+ wStartupInfo.dwFlags = lpStartupInfo->dwFlags;
1053+ wStartupInfo.wShowWindow = lpStartupInfo->wShowWindow;
1054+ wStartupInfo.cbReserved2 = lpStartupInfo->cbReserved2;
1055+ wStartupInfo.lpReserved2 = lpStartupInfo->lpReserved2;
1056+ wStartupInfo.hStdInput = lpStartupInfo->hStdInput;
1057+ wStartupInfo.hStdOutput = lpStartupInfo->hStdOutput;
1058+ wStartupInfo.hStdError = lpStartupInfo->hStdError;
1059+ r = CreateProcessW(pw0, pw1, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, pw2, &wStartupInfo, lpProcessInformation);
1060+ WtoM(lpCommandLine, strlen(lpCommandLine) + 1, pw1, -1);
1061+END_ROUTINE
1062+ FreeDuplicatedString(pw0);
1063+ FreeDuplicatedString(pw1);
1064+ FreeDuplicatedString(pw2);
1065+ FreeDuplicatedString(pw3);
1066+ FreeDuplicatedString(pw4);
1067+ FreeDuplicatedString(pw5);
1068+ return r;
1069+}
1070+
1071+HINSTANCE FindExecutableM(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
1072+{
1073+ HINSTANCE r = NULL;
1074+ wchar_t* pw0 = NULL;
1075+ wchar_t* pw1 = NULL;
1076+ wchar_t* pw2 = NULL;
1077+ wchar_t* pw3 = NULL;
1078+START_ROUTINE
1079+ pw0 = DuplicateMtoW(lpFile, -1);
1080+ pw1 = DuplicateMtoW(lpDirectory, -1);
1081+ pw2 = AllocateStringW(MAX_PATH * 4);
1082+ r = FindExecutableW(pw0, pw1, pw2);
1083+ // バッファ長不明のためオーバーランの可能性あり
1084+ WtoM(lpResult, MAX_PATH, pw2, -1);
1085+ TerminateStringM(lpResult, MAX_PATH);
1086+END_ROUTINE
1087+ FreeDuplicatedString(pw0);
1088+ FreeDuplicatedString(pw1);
1089+ FreeDuplicatedString(pw2);
1090+ FreeDuplicatedString(pw3);
1091+ return r;
1092+}
1093+
9871094 HINSTANCE ShellExecuteM(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd)
9881095 {
9891096 HINSTANCE r = NULL;
@@ -1224,7 +1331,17 @@ END_ROUTINE
12241331 return r;
12251332 }
12261333
1227-
1334+INT_PTR DialogBoxParamM(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
1335+{
1336+ INT_PTR r = 0;
1337+ wchar_t* pw0 = NULL;
1338+START_ROUTINE
1339+ pw0 = DuplicateMtoW(lpTemplateName, -1);
1340+ r = DialogBoxParamW(hInstance, pw0, hWndParent, lpDialogFunc, dwInitParam);
1341+END_ROUTINE
1342+ FreeDuplicatedString(pw0);
1343+ return r;
1344+}
12281345
12291346
12301347
--- a/mbswrapper.h
+++ b/mbswrapper.h
@@ -59,6 +59,10 @@
5959 #define GetSaveFileName GetSaveFileNameM
6060 #undef HtmlHelp
6161 #define HtmlHelp HtmlHelpM
62+#undef CreateProcess
63+#define CreateProcess CreateProcessM
64+#undef FindExecutable
65+#define FindExecutable FindExecutableM
6266 #undef ShellExecute
6367 #define ShellExecute ShellExecuteM
6468 #undef SHBrowseForFolder
@@ -75,6 +79,8 @@
7579 #define CreateFontIndirect CreateFontIndirectM
7680 #undef ChooseFont
7781 #define ChooseFont ChooseFontM
82+#undef DialogBoxParam
83+#define DialogBoxParam DialogBoxParamM
7884
7985 #undef CreateWindow
8086 #define CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) CreateWindowEx(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
--- a/mesg-eng.h
+++ b/mesg-eng.h
@@ -302,9 +302,11 @@
302302 #define MSGJPN302 "Master password checker looks broken."
303303 #define MSGJPN303 "Master password has been changed."
304304 #define MSGJPN304 "Speecified master password is not correct.\r\nAre you sure you want to re-enter?\r\nNo memorized FTP password is available if you choose 'NO'"
305-#define MSGJPN305 "Shift_JIS Kanji Code"
306-#define MSGJPN306 "UTF-8 Kanji Code"
307-#define MSGJPN307 "Shift_JIS Kanji Code (Local)"
308-#define MSGJPN308 "EUC Kanji Code (Local)"
309-#define MSGJPN309 "JIS Kanji Code (Local)"
310-#define MSGJPN310 "UTF-8 Kanji Code (Local)"
305+#define MSGJPN305 "Shift_JIS"
306+#define MSGJPN306 "UTF-8N"
307+#define MSGJPN307 "Shift_JIS Kanji Code"
308+#define MSGJPN308 "UTF-8N Kanji Code"
309+#define MSGJPN309 "Shift_JIS Kanji Code (Local)"
310+#define MSGJPN310 "EUC Kanji Code (Local)"
311+#define MSGJPN311 "JIS Kanji Code (Local)"
312+#define MSGJPN312 "UTF-8N Kanji Code (Local)"
--- a/mesg-eng.old.h
+++ b/mesg-eng.old.h
@@ -302,9 +302,11 @@
302302 #define MSGJPN302 "Master password checker looks broken."
303303 #define MSGJPN303 "Master password has been changed."
304304 #define MSGJPN304 "Speecified master password is not correct.\r\nAre you sure you want to re-enter?\r\nNo memorized FTP password is available if you choose 'NO'"
305-#define MSGJPN305 "Shift_JIS Kanji Code"
306-#define MSGJPN306 "UTF-8 Kanji Code"
307-#define MSGJPN307 "Shift_JIS Kanji Code (Local)"
308-#define MSGJPN308 "EUC Kanji Code (Local)"
309-#define MSGJPN309 "JIS Kanji Code (Local)"
310-#define MSGJPN310 "UTF-8 Kanji Code (Local)"
305+#define MSGJPN305 "Shift_JIS"
306+#define MSGJPN306 "UTF-8N"
307+#define MSGJPN307 "Shift_JIS Kanji Code"
308+#define MSGJPN308 "UTF-8N Kanji Code"
309+#define MSGJPN309 "Shift_JIS Kanji Code (Local)"
310+#define MSGJPN310 "EUC Kanji Code (Local)"
311+#define MSGJPN311 "JIS Kanji Code (Local)"
312+#define MSGJPN312 "UTF-8N Kanji Code (Local)"
--- a/mesg-jpn.h
+++ b/mesg-jpn.h
@@ -302,9 +302,11 @@
302302 #define MSGJPN302 "\xE7\xA2\xBA\xE8\xAA\x8D\xE7\x94\xA8\xE3\x83\x87\xE3\x83\xBC\xE3\x82\xBF\xE3\x81\x8C\xE5\xA3\x8A\xE3\x82\x8C\xE3\x81\xA6\xE3\x81\x84\xE3\x82\x8B\xE3\x81\x9F\xE3\x82\x81\xEF\xBC\x8C\xE3\x83\x9E\xE3\x82\xB9\xE3\x82\xBF\xE3\x83\xBC\xE3\x83\x91\xE3\x82\xB9\xE3\x83\xAF\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAE\xE6\xAD\xA3\xE5\xBD\x93\xE6\x80\xA7\xE3\x82\x92\xE7\xA2\xBA\xE8\xAA\x8D\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93\xE3\x81\xA7\xE3\x81\x97\xE3\x81\x9F\xEF\xBC\x8E"
303303 #define MSGJPN303 "\xE3\x83\x9E\xE3\x82\xB9\xE3\x82\xBF\xE3\x83\xBC\xE3\x83\x91\xE3\x82\xB9\xE3\x83\xAF\xE3\x83\xBC\xE3\x83\x89\xE3\x82\x92\xE5\xA4\x89\xE6\x9B\xB4\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F"
304304 #define MSGJPN304 "\xE6\x8C\x87\xE5\xAE\x9A\xE3\x81\x95\xE3\x82\x8C\xE3\x81\x9F\xE3\x83\x9E\xE3\x82\xB9\xE3\x82\xBF\xE3\x83\xBC\xE3\x83\x91\xE3\x82\xB9\xE3\x83\xAF\xE3\x83\xBC\xE3\x83\x89\xE3\x81\x8C\xE7\x99\xBB\xE9\x8C\xB2\xE3\x81\x95\xE3\x82\x8C\xE3\x81\x9F\xE3\x82\x82\xE3\x81\xAE\xE3\x81\xA8\xE4\xB8\x80\xE8\x87\xB4\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93\xEF\xBC\x8E\r\n\xE5\x86\x8D\xE5\xBA\xA6\xE5\x85\xA5\xE5\x8A\x9B\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x99\xE3\x81\x8B\xEF\xBC\x9F\r\n\xE3\x80\x8C\xE3\x81\x84\xE3\x81\x84\xE3\x81\x88\xE3\x80\x8D\xE3\x82\x92\xE9\x81\xB8\xE3\x81\xB6\xE3\x81\xA8\xE8\xA8\x98\xE6\x86\xB6\xE3\x81\x95\xE3\x82\x8C\xE3\x81\x9F\x46TP\xE3\x83\x91\xE3\x82\xB9\xE3\x83\xAF\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAF\xE5\x88\xA9\xE7\x94\xA8\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93\xEF\xBC\x8E"
305-#define MSGJPN305 "\xE3\x83\x9B\xE3\x82\xB9\xE3\x83\x88\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFShift_JIS"
306-#define MSGJPN306 "\xE3\x83\x9B\xE3\x82\xB9\xE3\x83\x88\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFUTF-8"
307-#define MSGJPN307 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFShift_JIS"
308-#define MSGJPN308 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAF\x45UC"
309-#define MSGJPN309 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFJIS"
310-#define MSGJPN310 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFUTF-8"
305+#define MSGJPN305 "Shift_JIS"
306+#define MSGJPN306 "UTF-8N"
307+#define MSGJPN307 "\xE3\x83\x9B\xE3\x82\xB9\xE3\x83\x88\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFShift_JIS"
308+#define MSGJPN308 "\xE3\x83\x9B\xE3\x82\xB9\xE3\x83\x88\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFUTF-8N"
309+#define MSGJPN309 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFShift_JIS"
310+#define MSGJPN310 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAF\x45UC"
311+#define MSGJPN311 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFJIS"
312+#define MSGJPN312 "\xE3\x83\xAD\xE3\x83\xBC\xE3\x82\xAB\xE3\x83\xAB\xE3\x81\xAE\xE6\xBC\xA2\xE5\xAD\x97\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xAFUTF-8N"
--- a/mesg-jpn.old.h
+++ b/mesg-jpn.old.h
@@ -302,9 +302,11 @@
302302 #define MSGJPN302 "確認用データが壊れているため,マスターパスワードの正当性を確認できませんでした."
303303 #define MSGJPN303 "マスターパスワードを変更しました"
304304 #define MSGJPN304 "指定されたマスターパスワードが登録されたものと一致しません.\r\n再度入力しますか?\r\n「いいえ」を選ぶと記憶されたFTPパスワードは利用できません."
305-#define MSGJPN305 "ホストの漢字コードはShift_JIS"
306-#define MSGJPN306 "ホストの漢字コードはUTF-8"
307-#define MSGJPN307 "ローカルの漢字コードはShift_JIS"
308-#define MSGJPN308 "ローカルの漢字コードはEUC"
309-#define MSGJPN309 "ローカルの漢字コードはJIS"
310-#define MSGJPN310 "ローカルの漢字コードはUTF-8"
305+#define MSGJPN305 "Shift_JIS"
306+#define MSGJPN306 "UTF-8N"
307+#define MSGJPN307 "ホストの漢字コードはShift_JIS"
308+#define MSGJPN308 "ホストの漢字コードはUTF-8N"
309+#define MSGJPN309 "ローカルの漢字コードはShift_JIS"
310+#define MSGJPN310 "ローカルの漢字コードはEUC"
311+#define MSGJPN311 "ローカルの漢字コードはJIS"
312+#define MSGJPN312 "ローカルの漢字コードはUTF-8N"
--- a/toolmenu.c
+++ b/toolmenu.c
@@ -791,6 +791,10 @@ void EnableUserOpe(void)
791791 EnableWindow(hWndDirLocal, TRUE);
792792 EnableWindow(hWndDirRemote, TRUE);
793793
794+ // 選択不可な漢字コードのボタンが表示されるバグを修正
795+ HideHostKanjiButton();
796+ HideLocalKanjiButton();
797+
794798 HideUI = NO;
795799
796800 MakeButtonsFocus();
@@ -1114,11 +1118,28 @@ void HideHostKanjiButton(void)
11141118 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_JIS, MAKELONG(TRUE, 0));
11151119 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8N, MAKELONG(TRUE, 0));
11161120 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_NONE, MAKELONG(TRUE, 0));
1117- if(TmpHostKanjiCode != KANJI_NOCNV)
1118- SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));
1119- else
1120- SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));
1121- break;
1121+// if(TmpHostKanjiCode != KANJI_NOCNV)
1122+// SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));
1123+// else
1124+// SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));
1125+// break;
1126+ // 現在カナ変換はShift_JIS、JIS、EUC間でのみ機能する
1127+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));
1128+ switch(TmpHostKanjiCode)
1129+ {
1130+ case KANJI_SJIS:
1131+ case KANJI_JIS:
1132+ case KANJI_EUC:
1133+ switch(TmpLocalKanjiCode)
1134+ {
1135+ case KANJI_SJIS:
1136+ case KANJI_JIS:
1137+ case KANJI_EUC:
1138+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));
1139+ break;
1140+ }
1141+ break;
1142+ }
11221143 }
11231144 return;
11241145 }
@@ -1146,11 +1167,11 @@ void SetLocalKanjiCode(int Type)
11461167 break;
11471168
11481169 case MENU_L_KNJ_EUC :
1149-// TmpLocalKanjiCode = KANJI_EUC;
1170+ TmpLocalKanjiCode = KANJI_EUC;
11501171 break;
11511172
11521173 case MENU_L_KNJ_JIS :
1153-// TmpLocalKanjiCode = KANJI_JIS;
1174+ TmpLocalKanjiCode = KANJI_JIS;
11541175 break;
11551176
11561177 case MENU_L_KNJ_UTF8N :
@@ -1172,11 +1193,11 @@ void DispLocalKanjiCode(void)
11721193 break;
11731194
11741195 case KANJI_EUC :
1175-// SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));
1196+ SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));
11761197 break;
11771198
11781199 case KANJI_JIS :
1179-// SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));
1200+ SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));
11801201 break;
11811202
11821203 case KANJI_UTF8N :
@@ -1205,12 +1226,26 @@ void HideLocalKanjiButton(void)
12051226
12061227 default :
12071228 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_SJIS, MAKELONG(TRUE, 0));
1208-// SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));
1209-// SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));
1229+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));
1230+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));
12101231 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(TRUE, 0));
1211- // TODO: 現在EUCとJISは非対応
1212- SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(FALSE, 0));
1213- SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(FALSE, 0));
1232+ // 現在カナ変換はShift_JIS、JIS、EUC間でのみ機能する
1233+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));
1234+ switch(TmpHostKanjiCode)
1235+ {
1236+ case KANJI_SJIS:
1237+ case KANJI_JIS:
1238+ case KANJI_EUC:
1239+ switch(TmpLocalKanjiCode)
1240+ {
1241+ case KANJI_SJIS:
1242+ case KANJI_JIS:
1243+ case KANJI_EUC:
1244+ SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));
1245+ break;
1246+ }
1247+ break;
1248+ }
12141249 break;
12151250 }
12161251 return;