| 175 |
* TRUE: 変換成功 |
* TRUE: 変換成功 |
| 176 |
* FALSE: 変換失敗 |
* FALSE: 変換失敗 |
| 177 |
*/ |
*/ |
| 178 |
static int SerialPortConfconvertStr2Id(enum serial_port_conf type, PCHAR str, WORD *id) |
static int SerialPortConfconvertStr2Id(enum serial_port_conf type, const wchar_t *str, WORD *id) |
| 179 |
{ |
{ |
| 180 |
id_str_pair_t *conf; |
id_str_pair_t *conf; |
| 181 |
int ret = FALSE; |
int ret = FALSE; |
| 182 |
int i; |
int i; |
| 183 |
|
char *strA; |
| 184 |
|
|
| 185 |
switch (type) { |
switch (type) { |
| 186 |
case COM_DATABIT: |
case COM_DATABIT: |
| 199 |
conf = NULL; |
conf = NULL; |
| 200 |
break; |
break; |
| 201 |
} |
} |
| 202 |
if (conf == NULL) |
if (conf == NULL) { |
| 203 |
goto error; |
return FALSE; |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
strA = ToCharW(str); |
| 207 |
for (i = 0 ; ; i++) { |
for (i = 0 ; ; i++) { |
| 208 |
if (conf[i].id == IDENDMARK) |
if (conf[i].id == IDENDMARK) { |
| 209 |
goto error; |
ret = FALSE; |
| 210 |
if (_stricmp(conf[i].str, str) == 0) { |
break; |
| 211 |
|
} |
| 212 |
|
if (_stricmp(conf[i].str, strA) == 0) { |
| 213 |
*id = conf[i].id; |
*id = conf[i].id; |
| 214 |
|
ret = TRUE; |
| 215 |
break; |
break; |
| 216 |
} |
} |
| 217 |
} |
} |
| 218 |
|
free(strA); |
| 219 |
ret = TRUE; |
return ret; |
|
|
|
|
error: |
|
|
return (ret); |
|
| 220 |
} |
} |
| 221 |
|
|
|
|
|
| 222 |
WORD str2id(PCHAR far * List, PCHAR str, WORD DefId) |
WORD str2id(PCHAR far * List, PCHAR str, WORD DefId) |
| 223 |
{ |
{ |
| 224 |
WORD i; |
WORD i; |
| 249 |
strncpy_s(str, destlen, List[i], _TRUNCATE); |
strncpy_s(str, destlen, List[i], _TRUNCATE); |
| 250 |
} |
} |
| 251 |
|
|
| 252 |
int IconName2IconId(const char *name) { |
static int IconName2IconId(const wchar_t *name) |
| 253 |
|
{ |
| 254 |
int id; |
int id; |
| 255 |
|
|
| 256 |
if (_stricmp(name, "tterm") == 0) { |
if (_wcsicmp(name, L"tterm") == 0) { |
| 257 |
id = IDI_TTERM; |
id = IDI_TTERM; |
| 258 |
} |
} |
| 259 |
else if (_stricmp(name, "vt") == 0) { |
else if (_wcsicmp(name, L"vt") == 0) { |
| 260 |
id = IDI_VT; |
id = IDI_VT; |
| 261 |
} |
} |
| 262 |
else if (_stricmp(name, "tek") == 0) { |
else if (_wcsicmp(name, L"tek") == 0) { |
| 263 |
id = IDI_TEK; |
id = IDI_TEK; |
| 264 |
} |
} |
| 265 |
else if (_stricmp(name, "tterm_classic") == 0) { |
else if (_wcsicmp(name, L"tterm_classic") == 0) { |
| 266 |
id = IDI_TTERM_CLASSIC; |
id = IDI_TTERM_CLASSIC; |
| 267 |
} |
} |
| 268 |
else if (_stricmp(name, "vt_classic") == 0) { |
else if (_wcsicmp(name, L"vt_classic") == 0) { |
| 269 |
id = IDI_VT_CLASSIC; |
id = IDI_VT_CLASSIC; |
| 270 |
} |
} |
| 271 |
else if (_stricmp(name, "tterm_3d") == 0) { |
else if (_wcsicmp(name, L"tterm_3d") == 0) { |
| 272 |
id = IDI_TTERM_3D; |
id = IDI_TTERM_3D; |
| 273 |
} |
} |
| 274 |
else if (_stricmp(name, "vt_3d") == 0) { |
else if (_wcsicmp(name, L"vt_3d") == 0) { |
| 275 |
id = IDI_VT_3D; |
id = IDI_VT_3D; |
| 276 |
} |
} |
| 277 |
else if (_stricmp(name, "cygterm") == 0) { |
else if (_wcsicmp(name, L"cygterm") == 0) { |
| 278 |
id = IDI_CYGTERM; |
id = IDI_CYGTERM; |
| 279 |
} |
} |
| 280 |
else { |
else { |
| 283 |
return id; |
return id; |
| 284 |
} |
} |
| 285 |
|
|
| 286 |
|
static int IconName2IconIdA(const char *name) |
| 287 |
|
{ |
| 288 |
|
wchar_t *nameW = ToWcharA(name); |
| 289 |
|
int id = IconName2IconId(nameW); |
| 290 |
|
free(nameW); |
| 291 |
|
return id; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
|
| 295 |
void IconId2IconName(char *name, int len, int id) { |
void IconId2IconName(char *name, int len, int id) { |
| 296 |
char *icon; |
char *icon; |
| 297 |
switch (id) { |
switch (id) { |
| 731 |
int i; |
int i; |
| 732 |
HDC TmpDC; |
HDC TmpDC; |
| 733 |
char Temp[MAX_PATH], Temp2[MAX_PATH], *p; |
char Temp[MAX_PATH], Temp2[MAX_PATH], *p; |
| 734 |
|
wchar_t TempW[MAX_PATH]; |
| 735 |
|
|
| 736 |
ts->Minimize = 0; |
ts->Minimize = 0; |
| 737 |
ts->HideWindow = 0; |
ts->HideWindow = 0; |
| 1211 |
ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName); |
ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName); |
| 1212 |
|
|
| 1213 |
/* Parity */ |
/* Parity */ |
| 1214 |
GetPrivateProfileString(Section, "Parity", "", |
GetPrivateProfileStringW(SectionW, L"Parity", L"", |
| 1215 |
Temp, sizeof(Temp), FName); |
TempW, _countof(TempW), FName); |
| 1216 |
if (!SerialPortConfconvertStr2Id(COM_PARITY, Temp, &ts->Parity)) { |
if (!SerialPortConfconvertStr2Id(COM_PARITY, TempW, &ts->Parity)) { |
| 1217 |
ts->Parity = IdParityNone; |
ts->Parity = IdParityNone; |
| 1218 |
} |
} |
| 1219 |
|
|
| 1220 |
/* Data bit */ |
/* Data bit */ |
| 1221 |
GetPrivateProfileString(Section, "DataBit", "", |
GetPrivateProfileStringW(SectionW, L"DataBit", L"", |
| 1222 |
Temp, sizeof(Temp), FName); |
TempW, _countof(TempW), FName); |
| 1223 |
if (!SerialPortConfconvertStr2Id(COM_DATABIT, Temp, &ts->DataBit)) { |
if (!SerialPortConfconvertStr2Id(COM_DATABIT, TempW, &ts->DataBit)) { |
| 1224 |
ts->DataBit = IdDataBit8; |
ts->DataBit = IdDataBit8; |
| 1225 |
} |
} |
| 1226 |
|
|
| 1227 |
/* Stop bit */ |
/* Stop bit */ |
| 1228 |
GetPrivateProfileString(Section, "StopBit", "", |
GetPrivateProfileStringW(SectionW, L"StopBit", L"", |
| 1229 |
Temp, sizeof(Temp), FName); |
TempW, _countof(TempW), FName); |
| 1230 |
if (!SerialPortConfconvertStr2Id(COM_STOPBIT, Temp, &ts->StopBit)) { |
if (!SerialPortConfconvertStr2Id(COM_STOPBIT, TempW, &ts->StopBit)) { |
| 1231 |
ts->StopBit = IdStopBit1; |
ts->StopBit = IdStopBit1; |
| 1232 |
} |
} |
| 1233 |
|
|
| 1234 |
/* Flow control */ |
/* Flow control */ |
| 1235 |
GetPrivateProfileString(Section, "FlowCtrl", "", |
GetPrivateProfileStringW(SectionW, L"FlowCtrl", L"", |
| 1236 |
Temp, sizeof(Temp), FName); |
TempW, _countof(TempW), FName); |
| 1237 |
if (!SerialPortConfconvertStr2Id(COM_FLOWCTRL, Temp, &ts->Flow)) { |
if (!SerialPortConfconvertStr2Id(COM_FLOWCTRL, TempW, &ts->Flow)) { |
| 1238 |
ts->Flow = IdFlowNone; |
ts->Flow = IdFlowNone; |
| 1239 |
} |
} |
| 1240 |
|
|
| 1833 |
// VT Window Icon |
// VT Window Icon |
| 1834 |
GetPrivateProfileString(Section, "VTIcon", "Default", |
GetPrivateProfileString(Section, "VTIcon", "Default", |
| 1835 |
Temp, sizeof(Temp), FName); |
Temp, sizeof(Temp), FName); |
| 1836 |
ts->VTIcon = IconName2IconId(Temp); |
ts->VTIcon = IconName2IconIdA(Temp); |
| 1837 |
|
|
| 1838 |
// Tek Window Icon |
// Tek Window Icon |
| 1839 |
GetPrivateProfileString(Section, "TEKIcon", "Default", |
GetPrivateProfileString(Section, "TEKIcon", "Default", |
| 1840 |
Temp, sizeof(Temp), FName); |
Temp, sizeof(Temp), FName); |
| 1841 |
ts->TEKIcon = IconName2IconId(Temp); |
ts->TEKIcon = IconName2IconIdA(Temp); |
| 1842 |
|
|
| 1843 |
// Unknown Unicode Character |
// Unknown Unicode Character |
| 1844 |
ts->UnknownUnicodeCharaAsWide = |
ts->UnknownUnicodeCharaAsWide = |
| 2267 |
if (ts->UnicodeAmbiguousWidth < 1 || 2 < ts->UnicodeAmbiguousWidth) { |
if (ts->UnicodeAmbiguousWidth < 1 || 2 < ts->UnicodeAmbiguousWidth) { |
| 2268 |
ts->UnicodeAmbiguousWidth = 1; |
ts->UnicodeAmbiguousWidth = 1; |
| 2269 |
} |
} |
| 2270 |
ts->UnicodeEmojiOverride = GetOnOff(Section, "UnicodeEmojiOverride", FName, FALSE); |
ts->UnicodeEmojiOverride = (BYTE)GetOnOff(Section, "UnicodeEmojiOverride", FName, FALSE); |
| 2271 |
ts->UnicodeEmojiWidth = GetPrivateProfileInt(Section, "UnicodeEmojiWidth", 1, FName); |
ts->UnicodeEmojiWidth = GetPrivateProfileInt(Section, "UnicodeEmojiWidth", 1, FName); |
| 2272 |
if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { |
if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { |
| 2273 |
ts->UnicodeEmojiWidth = 1; |
ts->UnicodeEmojiWidth = 1; |
| 3738 |
} |
} |
| 3739 |
#endif |
#endif |
| 3740 |
|
|
| 3741 |
static int ParsePortName(char *buff) |
static int ParsePortName(const char *buff) |
| 3742 |
{ |
{ |
| 3743 |
int port = parse_port_from_buf(buff); |
int port = parse_port_from_buf(buff); |
| 3744 |
|
|
| 3748 |
return 0; |
return 0; |
| 3749 |
} |
} |
| 3750 |
|
|
| 3751 |
|
static int ParsePortNameW(const wchar_t *buff) |
| 3752 |
|
{ |
| 3753 |
|
char *buffA = ToCharW(buff); |
| 3754 |
|
int port = ParsePortName(buffA); |
| 3755 |
|
free(buffA); |
| 3756 |
|
return port; |
| 3757 |
|
} |
| 3758 |
|
|
| 3759 |
static void ParseHostName(char *HostStr, WORD * port) |
static void ParseHostName(char *HostStr, WORD * port) |
| 3760 |
{ |
{ |
| 3761 |
/* |
/* |
| 3845 |
} |
} |
| 3846 |
|
|
| 3847 |
|
|
| 3848 |
void PASCAL ParseParam(PCHAR Param, PTTSet ts, PCHAR DDETopic) |
void PASCAL ParseParam(wchar_t *Param, PTTSet ts, PCHAR DDETopic) |
| 3849 |
{ |
{ |
| 3850 |
int i, pos, c; |
int i, pos, c; |
| 3851 |
//int param_top; |
//int param_top; |
| 3852 |
char Temp[MaxStrLen]; // ttpmacroから呼ばれることを想定しMaxStrLenサイズとする |
wchar_t Temp[MaxStrLen]; // ttpmacroから呼ばれることを想定しMaxStrLenサイズとする |
| 3853 |
char Temp2[MaxStrLen]; |
wchar_t Temp2[MaxStrLen]; |
|
char TempDir[MAXPATHLEN]; |
|
| 3854 |
WORD ParamPort = 0; |
WORD ParamPort = 0; |
| 3855 |
WORD ParamCom = 0; |
WORD ParamCom = 0; |
| 3856 |
WORD ParamTCP = 0; |
WORD ParamTCP = 0; |
| 3859 |
DWORD ParamBaud = BaudNone; |
DWORD ParamBaud = BaudNone; |
| 3860 |
BOOL HostNameFlag = FALSE; |
BOOL HostNameFlag = FALSE; |
| 3861 |
BOOL JustAfterHost = FALSE; |
BOOL JustAfterHost = FALSE; |
| 3862 |
PCHAR start, cur, next, p; |
wchar_t *start, *cur, *next; |
| 3863 |
|
|
| 3864 |
ts->HostName[0] = 0; |
ts->HostName[0] = 0; |
| 3865 |
//ts->KeyCnfFN[0] = 0; |
//ts->KeyCnfFN[0] = 0; |
| 3875 |
DDETopic[0] = 0; |
DDETopic[0] = 0; |
| 3876 |
i = 0; |
i = 0; |
| 3877 |
/* the first term shuld be executable filename of Tera Term */ |
/* the first term shuld be executable filename of Tera Term */ |
| 3878 |
start = GetParam(Temp, sizeof(Temp), Param); |
start = GetParam(Temp, _countof(Temp), Param); |
| 3879 |
|
|
| 3880 |
cur = start; |
cur = start; |
| 3881 |
while (next = GetParam(Temp, sizeof(Temp), cur)) { |
while (next = GetParam(Temp, _countof(Temp), cur)) { |
| 3882 |
DequoteParam(Temp, sizeof(Temp), Temp); |
DequoteParam(Temp, _countof(Temp), Temp); |
| 3883 |
if (_strnicmp(Temp, "/F=", 3) == 0) { /* setup filename */ |
if (_wcsnicmp(Temp, L"/F=", 3) == 0) { /* setup filename */ |
| 3884 |
strncpy_s(Temp2, sizeof(Temp2), &Temp[3], _TRUNCATE); |
wcsncpy_s(Temp2, _countof(Temp2), &Temp[3], _TRUNCATE); |
| 3885 |
if (strlen(Temp2) > 0) { |
if (Temp2[0] != 0) { |
| 3886 |
ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".INI", Temp, |
ConvFNameW(ts->HomeDirW, Temp2, _countof(Temp2), L".INI", Temp, |
| 3887 |
sizeof(Temp)); |
_countof(Temp)); |
| 3888 |
if (_stricmp(ts->SetupFName, Temp) != 0) { |
if (_wcsicmp(ts->SetupFNameW, Temp) != 0) { |
|
strncpy_s(ts->SetupFName, sizeof(ts->SetupFName), Temp, |
|
|
_TRUNCATE); |
|
| 3889 |
free(ts->SetupFNameW); |
free(ts->SetupFNameW); |
| 3890 |
ts->SetupFNameW = ToWcharA(ts->SetupFName); |
ts->SetupFNameW = _wcsdup(Temp); |
| 3891 |
|
WideCharToACP_t(ts->SetupFNameW, ts->SetupFName, _countof(ts->SetupFName)); |
| 3892 |
ReadIniFile(ts->SetupFNameW, ts); |
ReadIniFile(ts->SetupFNameW, ts); |
| 3893 |
} |
} |
| 3894 |
} |
} |
| 3897 |
} |
} |
| 3898 |
|
|
| 3899 |
cur = start; |
cur = start; |
| 3900 |
while (next = GetParam(Temp, sizeof(Temp), cur)) { |
while (next = GetParam(Temp, _countof(Temp), cur)) { |
| 3901 |
DequoteParam(Temp, sizeof(Temp), Temp); |
DequoteParam(Temp, _countof(Temp), Temp); |
| 3902 |
|
|
| 3903 |
if (HostNameFlag) { |
if (HostNameFlag) { |
| 3904 |
JustAfterHost = TRUE; |
JustAfterHost = TRUE; |
| 3905 |
HostNameFlag = FALSE; |
HostNameFlag = FALSE; |
| 3906 |
} |
} |
| 3907 |
|
|
| 3908 |
if (_strnicmp(Temp, "/AUTOWINCLOSE=", 14) == 0) { /* AutoWinClose=on|off */ |
if (_wcsnicmp(Temp, L"/AUTOWINCLOSE=", 14) == 0) { /* AutoWinClose=on|off */ |
| 3909 |
char *s = &Temp[14]; |
wchar_t *s = &Temp[14]; |
| 3910 |
if (_stricmp(s, "on") == 0) |
if (_wcsicmp(s, L"on") == 0) |
| 3911 |
ts->AutoWinClose = 1; |
ts->AutoWinClose = 1; |
| 3912 |
else |
else |
| 3913 |
ts->AutoWinClose = 0; |
ts->AutoWinClose = 0; |
| 3914 |
} |
} |
| 3915 |
else if (_strnicmp(Temp, "/SPEED=", 7) == 0) { /* Serial port speed */ |
else if (_wcsnicmp(Temp, L"/SPEED=", 7) == 0) { /* Serial port speed */ |
| 3916 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3917 |
ParamBaud = atoi(&Temp[7]); |
ParamBaud = _wtoi(&Temp[7]); |
| 3918 |
} |
} |
| 3919 |
else if (_strnicmp(Temp, "/BAUD=", 6) == 0) { /* for backward compatibility */ |
else if (_wcsnicmp(Temp, L"/BAUD=", 6) == 0) { /* for backward compatibility */ |
| 3920 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3921 |
ParamBaud = atoi(&Temp[6]); |
ParamBaud = _wtoi(&Temp[6]); |
| 3922 |
} |
} |
| 3923 |
else if (_stricmp(Temp, "/B") == 0) { /* telnet binary */ |
else if (_wcsicmp(Temp, L"/B") == 0) { /* telnet binary */ |
| 3924 |
ParamPort = IdTCPIP; |
ParamPort = IdTCPIP; |
| 3925 |
ParamBin = 1; |
ParamBin = 1; |
| 3926 |
} |
} |
| 3927 |
else if (_strnicmp(Temp, "/C=", 3) == 0) { /* COM port num */ |
else if (_wcsnicmp(Temp, L"/C=", 3) == 0) { /* COM port num */ |
| 3928 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3929 |
ParamCom = atoi(&Temp[3]); |
ParamCom = _wtoi(&Temp[3]); |
| 3930 |
if ((ParamCom < 1) || (ParamCom > ts->MaxComPort)) |
if ((ParamCom < 1) || (ParamCom > ts->MaxComPort)) |
| 3931 |
ParamCom = 0; |
ParamCom = 0; |
| 3932 |
} |
} |
| 3933 |
else if (_strnicmp(Temp, "/CDATABIT=", 10) == 0) { /* COM data bit */ |
else if (_wcsnicmp(Temp, L"/CDATABIT=", 10) == 0) { /* COM data bit */ |
| 3934 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3935 |
SerialPortConfconvertStr2Id(COM_DATABIT, &Temp[10], &ts->DataBit); |
SerialPortConfconvertStr2Id(COM_DATABIT, &Temp[10], &ts->DataBit); |
| 3936 |
} |
} |
| 3937 |
else if (_strnicmp(Temp, "/CPARITY=", 9) == 0) { /* COM Parity */ |
else if (_wcsnicmp(Temp, L"/CPARITY=", 9) == 0) { /* COM Parity */ |
| 3938 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3939 |
SerialPortConfconvertStr2Id(COM_PARITY, &Temp[9], &ts->Parity); |
SerialPortConfconvertStr2Id(COM_PARITY, &Temp[9], &ts->Parity); |
| 3940 |
} |
} |
| 3941 |
else if (_strnicmp(Temp, "/CSTOPBIT=", 10) == 0) { /* COM Stop bit */ |
else if (_wcsnicmp(Temp, L"/CSTOPBIT=", 10) == 0) { /* COM Stop bit */ |
| 3942 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3943 |
SerialPortConfconvertStr2Id(COM_STOPBIT, &Temp[10], &ts->StopBit); |
SerialPortConfconvertStr2Id(COM_STOPBIT, &Temp[10], &ts->StopBit); |
| 3944 |
} |
} |
| 3945 |
else if (_strnicmp(Temp, "/CFLOWCTRL=", 11) == 0) { /* COM Flow control */ |
else if (_wcsnicmp(Temp, L"/CFLOWCTRL=", 11) == 0) { /* COM Flow control */ |
| 3946 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3947 |
SerialPortConfconvertStr2Id(COM_FLOWCTRL, &Temp[11], &ts->Flow); |
SerialPortConfconvertStr2Id(COM_FLOWCTRL, &Temp[11], &ts->Flow); |
| 3948 |
} |
} |
| 3949 |
else if (_strnicmp(Temp, "/CDELAYPERCHAR=", 15) == 0) { /* COM Transmit delay per character (in msec) */ |
else if (_wcsnicmp(Temp, L"/CDELAYPERCHAR=", 15) == 0) { /* COM Transmit delay per character (in msec) */ |
| 3950 |
WORD val = 0; |
WORD val = 0; |
| 3951 |
|
|
| 3952 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3953 |
val = atoi(&Temp[15]); |
val = _wtoi(&Temp[15]); |
| 3954 |
ts->DelayPerChar = val; |
ts->DelayPerChar = val; |
| 3955 |
} |
} |
| 3956 |
else if (_strnicmp(Temp, "/CDELAYPERLINE=", 15) == 0) { /* COM Transmit delay per line (in msec) */ |
else if (_wcsnicmp(Temp, L"/CDELAYPERLINE=", 15) == 0) { /* COM Transmit delay per line (in msec) */ |
| 3957 |
WORD val = 0; |
WORD val = 0; |
| 3958 |
|
|
| 3959 |
ParamPort = IdSerial; |
ParamPort = IdSerial; |
| 3960 |
val = atoi(&Temp[15]); |
val = _wtoi(&Temp[15]); |
| 3961 |
ts->DelayPerLine = val; |
ts->DelayPerLine = val; |
| 3962 |
} |
} |
| 3963 |
else if (_stricmp(Temp, "/WAITCOM") == 0) { /* wait COM arrival */ |
else if (_wcsicmp(Temp, L"/WAITCOM") == 0) { /* wait COM arrival */ |
| 3964 |
ts->WaitCom = 1; |
ts->WaitCom = 1; |
| 3965 |
} |
} |
| 3966 |
else if (_strnicmp(Temp, "/D=", 3) == 0) { |
else if (_wcsnicmp(Temp, L"/D=", 3) == 0) { |
| 3967 |
if (DDETopic != NULL) |
if (DDETopic != NULL) { |
| 3968 |
strncpy_s(DDETopic, 21, &Temp[3], _TRUNCATE); // 21 = sizeof(TopicName) |
char *DDETopicA = ToCharW(&Temp[3]); |
| 3969 |
|
strncpy_s(DDETopic, 21, DDETopicA, _TRUNCATE); // 21 = sizeof(TopicName) |
| 3970 |
|
free(DDETopicA); |
| 3971 |
|
} |
| 3972 |
} |
} |
| 3973 |
// "New connection" ダイアログを表示しない (2008.11.14 maya) |
// "New connection" ダイアログを表示しない (2008.11.14 maya) |
| 3974 |
else if (_stricmp(Temp, "/DS") == 0) { |
else if (_wcsicmp(Temp, L"/DS") == 0) { |
| 3975 |
ts->HostDialogOnStartup = FALSE; |
ts->HostDialogOnStartup = FALSE; |
| 3976 |
} |
} |
| 3977 |
// TCPLocalEcho/TCPCRSend を無効にする (maya 2007.4.25) |
// TCPLocalEcho/TCPCRSend を無効にする (maya 2007.4.25) |
| 3978 |
else if (_stricmp(Temp, "/E") == 0) { |
else if (_wcsicmp(Temp, L"/E") == 0) { |
| 3979 |
ts->DisableTCPEchoCR = TRUE; |
ts->DisableTCPEchoCR = TRUE; |
| 3980 |
} |
} |
| 3981 |
// "New connection" ダイアログを表示する (2013.10.08 maya) |
// "New connection" ダイアログを表示する (2013.10.08 maya) |
| 3982 |
else if (_stricmp(Temp, "/ES") == 0) { |
else if (_wcsicmp(Temp, L"/ES") == 0) { |
| 3983 |
ts->HostDialogOnStartup = TRUE; |
ts->HostDialogOnStartup = TRUE; |
| 3984 |
} |
} |
| 3985 |
else if (_strnicmp(Temp, "/FD=", 4) == 0) { /* file transfer directory */ |
else if (_wcsnicmp(Temp, L"/FD=", 4) == 0) { /* file transfer directory */ |
| 3986 |
strncpy_s(Temp2, sizeof(Temp2), &Temp[4], _TRUNCATE); |
wcsncpy_s(Temp2, _countof(Temp2), &Temp[4], _TRUNCATE); |
| 3987 |
if (strlen(Temp2) > 0) { |
if (wcslen(Temp2) > 0) { |
| 3988 |
_getcwd(TempDir, sizeof(TempDir)); |
char TempDir[MAXPATHLEN]; |
| 3989 |
if (_chdir(Temp2) == 0) |
_getcwd(TempDir, _countof(TempDir)); |
| 3990 |
strncpy_s(ts->FileDir, sizeof(ts->FileDir), Temp2, |
if (_wchdir(Temp2) == 0) { |
| 3991 |
|
char *FileDirA = ToCharW(Temp2); |
| 3992 |
|
strncpy_s(ts->FileDir, sizeof(ts->FileDir), FileDirA, |
| 3993 |
_TRUNCATE); |
_TRUNCATE); |
| 3994 |
|
free(FileDirA); |
| 3995 |
|
} |
| 3996 |
_chdir(TempDir); |
_chdir(TempDir); |
| 3997 |
} |
} |
| 3998 |
} |
} |
| 3999 |
else if (_stricmp(Temp, "/H") == 0) /* hide title bar */ |
else if (_wcsicmp(Temp, L"/H") == 0) /* hide title bar */ |
| 4000 |
ts->HideTitle = 1; |
ts->HideTitle = 1; |
| 4001 |
else if (_stricmp(Temp, "/I") == 0) /* iconize */ |
else if (_wcsicmp(Temp, L"/I") == 0) /* iconize */ |
| 4002 |
ts->Minimize = 1; |
ts->Minimize = 1; |
| 4003 |
else if (_strnicmp(Temp, "/K=", 3) == 0) { /* Keyboard setup file */ |
else if (_wcsnicmp(Temp, L"/K=", 3) == 0) { /* Keyboard setup file */ |
| 4004 |
strncpy_s(Temp2, sizeof(Temp2), &Temp[3], _TRUNCATE); |
wcsncpy_s(Temp2, _countof(Temp2), &Temp[3], _TRUNCATE); |
| 4005 |
ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".CNF", |
ConvFNameW(ts->HomeDirW, Temp2, _countof(Temp2), L".CNF", Temp, _countof(Temp)); |
| 4006 |
ts->KeyCnfFN, sizeof(ts->KeyCnfFN)); |
ts->KeyCnfFNW = _wcsdup(Temp); |
| 4007 |
ts->KeyCnfFNW = ToWcharA(ts->KeyCnfFN); |
WideCharToACP_t(ts->KeyCnfFNW, ts->KeyCnfFN, _countof(ts->KeyCnfFN)); |
| 4008 |
} |
} |
| 4009 |
else if ((_strnicmp(Temp, "/KR=", 4) == 0) || |
else if ((_wcsnicmp(Temp, L"/KR=", 4) == 0) || |
| 4010 |
(_strnicmp(Temp, "/KT=", 4) == 0)) { /* kanji code */ |
(_wcsnicmp(Temp, L"/KT=", 4) == 0)) { /* kanji code */ |
| 4011 |
if (_stricmp(&Temp[4], "UTF8m") == 0 || |
if (_wcsicmp(&Temp[4], L"UTF8m") == 0 || |
| 4012 |
_stricmp(&Temp[4], "UTF-8m") == 0) |
_wcsicmp(&Temp[4], L"UTF-8m") == 0) |
| 4013 |
c = IdUTF8m; |
c = IdUTF8m; |
| 4014 |
else if (_stricmp(&Temp[4], "UTF8") == 0 || |
else if (_wcsicmp(&Temp[4], L"UTF8") == 0 || |
| 4015 |
_stricmp(&Temp[4], "UTF-8") == 0) |
_wcsicmp(&Temp[4], L"UTF-8") == 0) |
| 4016 |
c = IdUTF8; |
c = IdUTF8; |
| 4017 |
else if (_stricmp(&Temp[4], "SJIS") == 0 || |
else if (_wcsicmp(&Temp[4], L"SJIS") == 0 || |
| 4018 |
_stricmp(&Temp[4], "KS5601") == 0) |
_wcsicmp(&Temp[4], L"KS5601") == 0) |
| 4019 |
c = IdSJIS; |
c = IdSJIS; |
| 4020 |
else if (_stricmp(&Temp[4], "EUC") == 0) |
else if (_wcsicmp(&Temp[4], L"EUC") == 0) |
| 4021 |
c = IdEUC; |
c = IdEUC; |
| 4022 |
else if (_stricmp(&Temp[4], "JIS") == 0) |
else if (_wcsicmp(&Temp[4], L"JIS") == 0) |
| 4023 |
c = IdJIS; |
c = IdJIS; |
| 4024 |
else |
else |
| 4025 |
c = -1; |
c = -1; |
| 4026 |
if (c != -1) { |
if (c != -1) { |
| 4027 |
if (_strnicmp(Temp, "/KR=", 4) == 0) |
if (_wcsnicmp(Temp, L"/KR=", 4) == 0) |
| 4028 |
ts->KanjiCode = c; |
ts->KanjiCode = c; |
| 4029 |
else |
else |
| 4030 |
ts->KanjiCodeSend = c; |
ts->KanjiCodeSend = c; |
| 4031 |
} |
} |
| 4032 |
} |
} |
| 4033 |
else if (_strnicmp(Temp, "/L=", 3) == 0) { /* log file */ |
else if (_wcsnicmp(Temp, L"/L=", 3) == 0) { /* log file */ |
| 4034 |
strncpy_s(ts->LogFN, sizeof(ts->LogFN), &Temp[3], _TRUNCATE); |
ts->LogFNW = _wcsdup(&Temp[3]); |
| 4035 |
ts->LogFNW = ToWcharA(ts->LogFN); |
WideCharToACP_t(ts->LogFNW, ts->LogFN, _countof(ts->LogFN)); |
| 4036 |
} |
} |
| 4037 |
else if (_strnicmp(Temp, "/LA=", 4) == 0) { /* language */ |
else if (_wcsnicmp(Temp, L"/LA=", 4) == 0) { /* language */ |
| 4038 |
switch (Temp[4]) { |
switch (Temp[4]) { |
| 4039 |
case 'E': |
case 'E': |
| 4040 |
case 'e': |
case 'e': |
| 4053 |
ts->Language = IdUtf8; break; |
ts->Language = IdUtf8; break; |
| 4054 |
} |
} |
| 4055 |
} |
} |
| 4056 |
else if (_strnicmp(Temp, "/MN=", 4) == 0) { /* multicastname */ |
else if (_wcsnicmp(Temp, L"/MN=", 4) == 0) { /* multicastname */ |
| 4057 |
strncpy_s(ts->MulticastName, sizeof(ts->MulticastName), &Temp[4], _TRUNCATE); |
WideCharToACP_t(&Temp[4], ts->MulticastName, _countof(ts->MulticastName)); |
| 4058 |
} |
} |
| 4059 |
else if (_strnicmp(Temp, "/M=", 3) == 0) { /* macro filename */ |
else if (_wcsnicmp(Temp, L"/M=", 3) == 0) { /* macro filename */ |
| 4060 |
if ((Temp[3] == 0) || (Temp[3] == '*')) { |
if ((Temp[3] == 0) || (Temp[3] == '*')) { |
| 4061 |
strncpy_s(ts->MacroFN, sizeof(ts->MacroFN), "*", |
ts->MacroFNW = _wcsdup(L"*"); |
|
_TRUNCATE); |
|
| 4062 |
} else { |
} else { |
| 4063 |
strncpy_s(Temp2, sizeof(Temp2), &Temp[3], _TRUNCATE); |
wcsncpy_s(Temp2, _countof(Temp2), &Temp[3], _TRUNCATE); |
| 4064 |
ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), ".TTL", |
ConvFNameW(ts->HomeDirW, Temp2, _countof(Temp2), L".TTL", Temp, _countof(Temp)); |
| 4065 |
ts->MacroFN, sizeof(ts->MacroFN)); |
ts->MacroFNW = _wcsdup(Temp); |
| 4066 |
} |
} |
| 4067 |
|
WideCharToACP_t(ts->MacroFNW, ts->MacroFN, _countof(ts->MacroFN)); |
| 4068 |
/* Disable auto connect to serial when macro mode (2006.9.15 maya) */ |
/* Disable auto connect to serial when macro mode (2006.9.15 maya) */ |
|
ts->MacroFNW = ToWcharA(ts->MacroFN); |
|
| 4069 |
ts->ComAutoConnect = FALSE; |
ts->ComAutoConnect = FALSE; |
| 4070 |
} |
} |
| 4071 |
else if (_stricmp(Temp, "/M") == 0) { /* macro option without file name */ |
else if (_wcsicmp(Temp, L"/M") == 0) { /* macro option without file name */ |
| 4072 |
strncpy_s(ts->MacroFN, sizeof(ts->MacroFN), "*", _TRUNCATE); |
ts->MacroFNW = _wcsdup(L"*"); |
| 4073 |
ts->MacroFNW = ToWcharA(ts->MacroFN); |
WideCharToACP_t(ts->MacroFNW, ts->MacroFN, _countof(ts->MacroFN)); |
| 4074 |
/* Disable auto connect to serial when macro mode (2006.9.15 maya) */ |
/* Disable auto connect to serial when macro mode (2006.9.15 maya) */ |
| 4075 |
ts->ComAutoConnect = FALSE; |
ts->ComAutoConnect = FALSE; |
| 4076 |
} |
} |
| 4077 |
else if (_stricmp(Temp, "/NOLOG") == 0) { /* disable auto logging */ |
else if (_wcsicmp(Temp, L"/NOLOG") == 0) { /* disable auto logging */ |
| 4078 |
ts->LogFN[0] = '\0'; |
ts->LogFN[0] = '\0'; |
| 4079 |
ts->LogAutoStart = 0; |
ts->LogAutoStart = 0; |
| 4080 |
} |
} |
| 4081 |
else if (_strnicmp(Temp, "/OSC52=", 7) == 0) { /* Clipboard access */ |
else if (_wcsnicmp(Temp, L"/OSC52=", 7) == 0) { /* Clipboard access */ |
| 4082 |
ts->CtrlFlag &= ~CSF_CBMASK; |
ts->CtrlFlag &= ~CSF_CBMASK; |
| 4083 |
if (_stricmp(&Temp[7], "on") == 0 || _stricmp(&Temp[7], "readwrite") == 0) |
if (_wcsicmp(&Temp[7], L"on") == 0 || _wcsicmp(&Temp[7], L"readwrite") == 0) |
| 4084 |
ts->CtrlFlag |= CSF_CBRW; |
ts->CtrlFlag |= CSF_CBRW; |
| 4085 |
else if (_stricmp(&Temp[7], "read") == 0) |
else if (_wcsicmp(&Temp[7], L"read") == 0) |
| 4086 |
ts->CtrlFlag |= CSF_CBREAD; |
ts->CtrlFlag |= CSF_CBREAD; |
| 4087 |
else if (_stricmp(&Temp[7], "write") == 0) |
else if (_wcsicmp(&Temp[7], L"write") == 0) |
| 4088 |
ts->CtrlFlag |= CSF_CBWRITE; |
ts->CtrlFlag |= CSF_CBWRITE; |
| 4089 |
else if (_stricmp(&Temp[7], "off") == 0) |
else if (_wcsicmp(&Temp[7], L"off") == 0) |
| 4090 |
ts->CtrlFlag |= CSF_CBNONE; |
ts->CtrlFlag |= CSF_CBNONE; |
| 4091 |
} |
} |
| 4092 |
else if (_strnicmp(Temp, "/P=", 3) == 0) { /* TCP port num */ |
else if (_wcsnicmp(Temp, L"/P=", 3) == 0) { /* TCP port num */ |
| 4093 |
ParamPort = IdTCPIP; |
ParamPort = IdTCPIP; |
| 4094 |
ParamTCP = ParsePortName(&Temp[3]); |
ParamTCP = ParsePortNameW(&Temp[3]); |
| 4095 |
} |
} |
| 4096 |
else if (_stricmp(Temp, "/PIPE") == 0 || |
else if (_wcsicmp(Temp, L"/PIPE") == 0 || |
| 4097 |
_stricmp(Temp, "/NAMEDPIPE") == 0) { /* 名前付きパイプ */ |
_wcsicmp(Temp, L"/NAMEDPIPE") == 0) { /* 名前付きパイプ */ |
| 4098 |
ParamPort = IdNamedPipe; |
ParamPort = IdNamedPipe; |
| 4099 |
} |
} |
| 4100 |
else if (_strnicmp(Temp, "/R=", 3) == 0) { /* Replay filename */ |
else if (_wcsnicmp(Temp, L"/R=", 3) == 0) { /* Replay filename */ |
| 4101 |
strncpy_s(Temp2, sizeof(Temp2), &Temp[3], _TRUNCATE); |
wcsncpy_s(Temp2, _countof(Temp2), &Temp[3], _TRUNCATE); |
| 4102 |
ConvFName(ts->HomeDir, Temp2, sizeof(Temp2), "", ts->HostName, |
ConvFNameW(ts->HomeDirW, Temp2, _countof(Temp2), L"", Temp, _countof(Temp)); |
| 4103 |
sizeof(ts->HostName)); |
WideCharToACP_t(Temp, ts->HostName, _countof(ts->HostName)); |
| 4104 |
if (strlen(ts->HostName) > 0) |
if (strlen(ts->HostName) > 0) |
| 4105 |
ParamPort = IdFile; |
ParamPort = IdFile; |
| 4106 |
} |
} |
| 4107 |
else if (_stricmp(Temp, "/T=0") == 0) { /* telnet disable */ |
else if (_wcsicmp(Temp, L"/T=0") == 0) { /* telnet disable */ |
| 4108 |
ParamPort = IdTCPIP; |
ParamPort = IdTCPIP; |
| 4109 |
ParamTel = 0; |
ParamTel = 0; |
| 4110 |
} |
} |
| 4111 |
else if (_stricmp(Temp, "/T=1") == 0) { /* telnet enable */ |
else if (_wcsicmp(Temp, L"/T=1") == 0) { /* telnet enable */ |
| 4112 |
ParamPort = IdTCPIP; |
ParamPort = IdTCPIP; |
| 4113 |
ParamTel = 1; |
ParamTel = 1; |
| 4114 |
} |
} |
| 4115 |
else if (_strnicmp(Temp, "/TEKICON=", 9) == 0) { /* Tek window icon */ |
else if (_wcsnicmp(Temp, L"/TEKICON=", 9) == 0) { /* Tek window icon */ |
| 4116 |
ts->TEKIcon = IconName2IconId(&Temp[9]); |
ts->TEKIcon = IconName2IconId(&Temp[9]); |
| 4117 |
} |
} |
| 4118 |
else if (_strnicmp(Temp, "/VTICON=", 8) == 0) { /* VT window icon */ |
else if (_wcsnicmp(Temp, L"/VTICON=", 8) == 0) { /* VT window icon */ |
| 4119 |
ts->VTIcon = IconName2IconId(&Temp[8]); |
ts->VTIcon = IconName2IconId(&Temp[8]); |
| 4120 |
} |
} |
| 4121 |
else if (_stricmp(Temp, "/V") == 0) { /* invisible */ |
else if (_wcsicmp(Temp, L"/V") == 0) { /* invisible */ |
| 4122 |
ts->HideWindow = 1; |
ts->HideWindow = 1; |
| 4123 |
} |
} |
| 4124 |
else if (_strnicmp(Temp, "/W=", 3) == 0) { /* Window title */ |
else if (_wcsnicmp(Temp, L"/W=", 3) == 0) { /* Window title */ |
| 4125 |
strncpy_s(ts->Title, sizeof(ts->Title), &Temp[3], _TRUNCATE); |
char* TitleA = ToCharW(&Temp[3]); |
| 4126 |
|
strncpy_s(ts->Title, sizeof(ts->Title), TitleA, _TRUNCATE); |
| 4127 |
|
free(TitleA); |
| 4128 |
} |
} |
| 4129 |
else if (_strnicmp(Temp, "/X=", 3) == 0) { /* Window pos (X) */ |
else if (_wcsnicmp(Temp, L"/X=", 3) == 0) { /* Window pos (X) */ |
| 4130 |
if (sscanf(&Temp[3], "%d", &pos) == 1) { |
if (swscanf(&Temp[3], L"%d", &pos) == 1) { |
| 4131 |
ts->VTPos.x = pos; |
ts->VTPos.x = pos; |
| 4132 |
if (ts->VTPos.y == CW_USEDEFAULT) |
if (ts->VTPos.y == CW_USEDEFAULT) |
| 4133 |
ts->VTPos.y = 0; |
ts->VTPos.y = 0; |
| 4134 |
} |
} |
| 4135 |
} |
} |
| 4136 |
else if (_strnicmp(Temp, "/Y=", 3) == 0) { /* Window pos (Y) */ |
else if (_wcsnicmp(Temp, L"/Y=", 3) == 0) { /* Window pos (Y) */ |
| 4137 |
if (sscanf(&Temp[3], "%d", &pos) == 1) { |
if (swscanf(&Temp[3], L"%d", &pos) == 1) { |
| 4138 |
ts->VTPos.y = pos; |
ts->VTPos.y = pos; |
| 4139 |
if (ts->VTPos.x == CW_USEDEFAULT) |
if (ts->VTPos.x == CW_USEDEFAULT) |
| 4140 |
ts->VTPos.x = 0; |
ts->VTPos.x = 0; |
| 4141 |
} |
} |
| 4142 |
} |
} |
| 4143 |
else if (_stricmp(Temp, "/4") == 0) /* Protocol Tera Term speaking */ |
else if (_wcsicmp(Temp, L"/4") == 0) /* Protocol Tera Term speaking */ |
| 4144 |
ts->ProtocolFamily = AF_INET; |
ts->ProtocolFamily = AF_INET; |
| 4145 |
else if (_stricmp(Temp, "/6") == 0) |
else if (_wcsicmp(Temp, L"/6") == 0) |
| 4146 |
ts->ProtocolFamily = AF_INET6; |
ts->ProtocolFamily = AF_INET6; |
| 4147 |
else if (_stricmp(Temp, "/DUPLICATE") == 0) { // duplicate session (2004.12.7. yutaka) |
else if (_wcsicmp(Temp, L"/DUPLICATE") == 0) { // duplicate session (2004.12.7. yutaka) |
| 4148 |
ts->DuplicateSession = 1; |
ts->DuplicateSession = 1; |
| 4149 |
|
|
| 4150 |
} |
} |
| 4151 |
else if (_strnicmp(Temp, "/TIMEOUT=", 9) == 0) { // Connecting Timeout value (2007.1.11. yutaka) |
else if (_wcsnicmp(Temp, L"/TIMEOUT=", 9) == 0) { // Connecting Timeout value (2007.1.11. yutaka) |
| 4152 |
if (sscanf(&Temp[9], "%d", &pos) == 1) { |
if (swscanf(&Temp[9], L"%d", &pos) == 1) { |
| 4153 |
if (pos >= 0) |
if (pos >= 0) |
| 4154 |
ts->ConnectingTimeout = pos; |
ts->ConnectingTimeout = pos; |
| 4155 |
} |
} |
| 4156 |
|
|
| 4157 |
} |
} |
| 4158 |
else if ((Temp[0] != '/') && (strlen(Temp) > 0)) { |
else if ((Temp[0] != '/') && (wcslen(Temp) > 0)) { |
| 4159 |
if (JustAfterHost && ((c=ParsePortName(Temp)) > 0)) |
if (JustAfterHost && ((c=ParsePortNameW(Temp)) > 0)) |
| 4160 |
ParamTCP = c; |
ParamTCP = c; |
| 4161 |
else { |
else { |
| 4162 |
strncpy_s(ts->HostName, sizeof(ts->HostName), Temp, _TRUNCATE); /* host name */ |
char *HostNameA = ToCharW(Temp); |
| 4163 |
|
strncpy_s(ts->HostName, sizeof(ts->HostName), HostNameA, _TRUNCATE); /* host name */ |
| 4164 |
|
free(HostNameA); |
| 4165 |
if (ParamPort == IdNamedPipe) { |
if (ParamPort == IdNamedPipe) { |
| 4166 |
// 何もしない。 |
// 何もしない。 |
| 4167 |
|
|
| 4216 |
break; |
break; |
| 4217 |
case IdNamedPipe: |
case IdNamedPipe: |
| 4218 |
if (ts->HostName[0] != 0 && ts->HostName[0] != '\\') { |
if (ts->HostName[0] != 0 && ts->HostName[0] != '\\') { |
| 4219 |
if (p = strchr(ts->HostName, '\\')) { |
char * p = strchr(ts->HostName, '\\'); |
| 4220 |
|
if (p == NULL) { |
| 4221 |
*p++ = '\0'; |
*p++ = '\0'; |
| 4222 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "\\\\%s\\pipe\\%s", ts->HostName, p); |
_snwprintf_s(Temp, _countof(Temp), _TRUNCATE, L"\\\\%hs\\pipe\\%hs", ts->HostName, p); |
| 4223 |
} |
} |
| 4224 |
else { |
else { |
| 4225 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "\\\\.\\pipe\\%s", ts->HostName); |
_snwprintf_s(Temp, _countof(Temp), _TRUNCATE, L"\\\\.\\pipe\\%hs", ts->HostName); |
| 4226 |
} |
} |
| 4227 |
strncpy_s(ts->HostName, sizeof(ts->HostName), Temp, _TRUNCATE); |
WideCharToACP_t(Temp, ts->HostName, _countof(ts->HostName)); |
| 4228 |
} |
} |
| 4229 |
ts->PortType = IdNamedPipe; |
ts->PortType = IdNamedPipe; |
| 4230 |
ts->ComPort = 0; |
ts->ComPort = 0; |