Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7447 - (show annotations) (download) (as text)
Thu Feb 28 09:26:46 2019 UTC (5 years, 1 month ago) by doda
File MIME type: text/x-csrc
File size: 140109 byte(s)
AlphaBlendActive のデフォルト値として AlphaBlend の値を使うようにした。

[Ttssh2-devel 3629]

AlphaBlend が設定されていて、AlphaBlendActive の設定が無い従来の(古い)
設定ファイルを利用時に、ts.AlphaBlendActive と ts.AlphaBlendInactive が
同じ値となって以前のバージョンと同じ動作をするようになる。
1 /*
2 * Copyright (C) 1994-1998 T. Teranishi
3 * (C) 2004-2019 TeraTerm Project
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
30
31 /* TTSET.DLL, setup file routines*/
32 #include <winsock2.h>
33 #include <ws2tcpip.h>
34 #include "teraterm.h"
35 #include "tttypes.h"
36 #include <stdio.h>
37 #include <string.h>
38 #include <direct.h>
39 #include <ctype.h>
40 #include <errno.h>
41 #include "ttlib.h"
42 #include "tt_res.h"
43 #include "servicenames.h"
44
45 #include "compat_w95.h"
46
47 #ifndef CLEARTYPE_QUALITY
48 #define CLEARTYPE_QUALITY 5
49 #endif
50
51 #define Section "Tera Term"
52
53 #define MaxStrLen (LONG)512
54
55 static PCHAR far TermList[] =
56 { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
57 "VT320", "VT382", "VT420", "VT520", "VT525", NULL };
58
59 static PCHAR far RussList[] =
60 { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
61 static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
62
63 WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
64 {
65 WORD i;
66 i = 0;
67 while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
68 i++;
69 if (List[i] == NULL)
70 i = DefId;
71 else
72 i++;
73
74 return i;
75 }
76
77 void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
78 {
79 int i;
80
81 if (Id == 0)
82 i = DefId - 1;
83 else {
84 i = 0;
85 while ((List[i] != NULL) && (i < Id - 1))
86 i++;
87 if (List[i] == NULL)
88 i = DefId - 1;
89 }
90 strncpy_s(str, destlen, List[i], _TRUNCATE);
91 }
92
93 int IconName2IconId(const char *name) {
94 int id;
95
96 if (_stricmp(name, "tterm") == 0) {
97 id = IDI_TTERM;
98 }
99 else if (_stricmp(name, "vt") == 0) {
100 id = IDI_VT;
101 }
102 else if (_stricmp(name, "tek") == 0) {
103 id = IDI_TEK;
104 }
105 else if (_stricmp(name, "tterm_classic") == 0) {
106 id = IDI_TTERM_CLASSIC;
107 }
108 else if (_stricmp(name, "vt_classic") == 0) {
109 id = IDI_VT_CLASSIC;
110 }
111 else if (_stricmp(name, "tterm_3d") == 0) {
112 id = IDI_TTERM_3D;
113 }
114 else if (_stricmp(name, "vt_3d") == 0) {
115 id = IDI_VT_3D;
116 }
117 else if (_stricmp(name, "cygterm") == 0) {
118 id = IDI_CYGTERM;
119 }
120 else {
121 id = IdIconDefault;
122 }
123 return id;
124 }
125
126 void IconId2IconName(char *name, int len, int id) {
127 char *icon;
128 switch (id) {
129 case IDI_TTERM:
130 icon = "tterm";
131 break;
132 case IDI_VT:
133 icon = "vt";
134 break;
135 case IDI_TEK:
136 icon = "tek";
137 break;
138 case IDI_TTERM_CLASSIC:
139 icon = "tterm_classic";
140 break;
141 case IDI_VT_CLASSIC:
142 icon = "vt_classic";
143 break;
144 case IDI_TTERM_3D:
145 icon = "tterm_3d";
146 break;
147 case IDI_VT_3D:
148 icon = "vt_3d";
149 break;
150 case IDI_CYGTERM:
151 icon = "cygterm";
152 break;
153 default:
154 icon = "Default";
155 }
156 strncpy_s(name, len, icon, _TRUNCATE);
157 }
158
159 WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default)
160 {
161 char Temp[4];
162 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
163 if (Default) {
164 if (_stricmp(Temp, "off") == 0)
165 return 0;
166 else
167 return 1;
168 }
169 else {
170 if (_stricmp(Temp, "on") == 0)
171 return 1;
172 else
173 return 0;
174 }
175 }
176
177 void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag)
178 {
179 char Temp[4];
180
181 if (Flag != 0)
182 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
183 else
184 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
185 WritePrivateProfileString(Sect, Key, Temp, FName);
186 }
187
188 void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i)
189 {
190 char Temp[15];
191 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
192 WritePrivateProfileString(Sect, Key, Temp, FName);
193 }
194
195 void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i)
196 {
197 char Temp[15];
198 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
199 WritePrivateProfileString(Sect, Key, Temp, FName);
200 }
201
202 void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2)
203 {
204 char Temp[32];
205 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
206 WritePrivateProfileString(Sect, Key, Temp, FName);
207 }
208
209 void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName,
210 int i1, int i2, int i3, int i4)
211 {
212 char Temp[64];
213 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
214 i1, i2, i3, i4);
215 WritePrivateProfileString(Sect, Key, Temp, FName);
216 }
217
218 void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName,
219 int i1, int i2, int i3, int i4, int i5, int i6)
220 {
221 char Temp[96];
222 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
223 i1, i2,i3, i4, i5, i6);
224 WritePrivateProfileString(Sect, Key, Temp, FName);
225 }
226
227 void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName,
228 PCHAR Name, int x, int y, int charset)
229 {
230 char Temp[80];
231 if (Name[0] != 0)
232 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
233 Name, x, y, charset);
234 else
235 Temp[0] = 0;
236 WritePrivateProfileString(Sect, Key, Temp, FName);
237 }
238
239
240
241 #define CYGTERM_FILE "cygterm.cfg" // CygTerm configuration file
242 #define CYGTERM_FILE_MAXLINE 100
243
244 static void ReadCygtermConfFile(PTTSet ts)
245 {
246 char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
247 char cfg[MAX_PATH];
248 FILE *fp;
249 char buf[256], *head, *body;
250 cygterm_t settings;
251
252 // try to read CygTerm config file
253 memset(&settings, 0, sizeof(settings));
254 _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "ttermpro.exe %%s %%d /E /KR=SJIS /KT=SJIS /VTICON=CygTerm /nossh");
255 _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "vt100");
256 _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "20000");
257 _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "40");
258 _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "auto");
259 _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "MAKE_MODE=unix");
260 _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "");
261 settings.login_shell = FALSE;
262 settings.home_chdir = FALSE;
263 settings.agent_proxy = FALSE;
264
265 strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
266 AppendSlash(cfg, sizeof(cfg));
267 strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
268
269 fp = fopen(cfg, "r");
270 if (fp != NULL) {
271 while (fgets(buf, sizeof(buf), fp) != NULL) {
272 int len = strlen(buf);
273
274 if (buf[len - 1] == '\n')
275 buf[len - 1] = '\0';
276
277 split_buffer(buf, '=', &head, &body);
278 if (head == NULL || body == NULL)
279 continue;
280
281 if (_stricmp(head, "TERM") == 0) {
282 _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "%s", body);
283
284 }
285 else if (_stricmp(head, "TERM_TYPE") == 0) {
286 _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "%s", body);
287
288 }
289 else if (_stricmp(head, "PORT_START") == 0) {
290 _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "%s", body);
291
292 }
293 else if (_stricmp(head, "PORT_RANGE") == 0) {
294 _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "%s", body);
295
296 }
297 else if (_stricmp(head, "SHELL") == 0) {
298 _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "%s", body);
299
300 }
301 else if (_stricmp(head, "ENV_1") == 0) {
302 _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "%s", body);
303
304 }
305 else if (_stricmp(head, "ENV_2") == 0) {
306 _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "%s", body);
307
308 }
309 else if (_stricmp(head, "LOGIN_SHELL") == 0) {
310 if (strchr("YyTt", *body)) {
311 settings.login_shell = TRUE;
312 }
313
314 }
315 else if (_stricmp(head, "HOME_CHDIR") == 0) {
316 if (strchr("YyTt", *body)) {
317 settings.home_chdir = TRUE;
318 }
319
320 }
321 else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
322 if (strchr("YyTt", *body)) {
323 settings.agent_proxy = TRUE;
324 }
325
326 }
327 else {
328 // TODO: error check
329
330 }
331 }
332 fclose(fp);
333 }
334
335 memcpy(&ts->CygtermSettings, &settings, sizeof(cygterm_t));
336 }
337
338 static void WriteCygtermConfFile(PTTSet ts)
339 {
340 char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
341 char *tmpfile = "cygterm.tmp";
342 char cfg[MAX_PATH];
343 char tmp[MAX_PATH];
344 FILE *fp;
345 FILE *tmp_fp;
346 char buf[256], *head, *body;
347 char uimsg[MAX_UIMSG];
348 cygterm_t settings;
349 char *line[CYGTERM_FILE_MAXLINE];
350 int i, linenum, len;
351
352 // Cygwin���������X�������������������A�t�@�C�����������������B
353 if (ts->CygtermSettings.update_flag == FALSE)
354 return;
355 // �t���O���������ASave setup�����x�����x�������������������������B
356 ts->CygtermSettings.update_flag = FALSE;
357
358 memcpy(&settings, &ts->CygtermSettings, sizeof(cygterm_t));
359
360 strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
361 AppendSlash(cfg, sizeof(cfg));
362 strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
363
364 strncpy_s(tmp, sizeof(tmp), ts->HomeDir, _TRUNCATE);
365 AppendSlash(tmp, sizeof(tmp));
366 strncat_s(tmp, sizeof(tmp), tmpfile, _TRUNCATE);
367
368 // cygterm.cfg �������������A�������������������������������B
369 memset(line, 0, sizeof(line));
370 linenum = 0;
371 fp = fopen(cfg, "r");
372 if (fp) {
373 i = 0;
374 while (fgets(buf, sizeof(buf), fp) != NULL) {
375 len = strlen(buf);
376 if (buf[len - 1] == '\n')
377 buf[len - 1] = '\0';
378 if (i < CYGTERM_FILE_MAXLINE)
379 line[i++] = _strdup(buf);
380 else
381 break;
382 }
383 linenum = i;
384 fclose(fp);
385 }
386
387 tmp_fp = fopen(cfg, "w");
388 if (tmp_fp == NULL) {
389 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
390 get_lang_msg("MSG_CYGTERM_CONF_WRITEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
391 "Can't write CygTerm configuration file (%d).", ts->UILanguageFile);
392 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
393 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
394 }
395 else {
396 if (linenum > 0) {
397 for (i = 0; i < linenum; i++) {
398 split_buffer(line[i], '=', &head, &body);
399 if (head == NULL || body == NULL) {
400 fprintf(tmp_fp, "%s\n", line[i]);
401 }
402 else if (_stricmp(head, "TERM") == 0) {
403 fprintf(tmp_fp, "TERM = %s\n", settings.term);
404 settings.term[0] = '\0';
405 }
406 else if (_stricmp(head, "TERM_TYPE") == 0) {
407 fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
408 settings.term_type[0] = '\0';
409 }
410 else if (_stricmp(head, "PORT_START") == 0) {
411 fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
412 settings.port_start[0] = '\0';
413 }
414 else if (_stricmp(head, "PORT_RANGE") == 0) {
415 fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
416 settings.port_range[0] = '\0';
417 }
418 else if (_stricmp(head, "SHELL") == 0) {
419 fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
420 settings.shell[0] = '\0';
421 }
422 else if (_stricmp(head, "ENV_1") == 0) {
423 fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
424 settings.env1[0] = '\0';
425 }
426 else if (_stricmp(head, "ENV_2") == 0) {
427 fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
428 settings.env2[0] = '\0';
429 }
430 else if (_stricmp(head, "LOGIN_SHELL") == 0) {
431 fprintf(tmp_fp, "LOGIN_SHELL = %s\n", (settings.login_shell == TRUE) ? "yes" : "no");
432 settings.login_shell = FALSE;
433 }
434 else if (_stricmp(head, "HOME_CHDIR") == 0) {
435 fprintf(tmp_fp, "HOME_CHDIR = %s\n", (settings.home_chdir == TRUE) ? "yes" : "no");
436 settings.home_chdir = FALSE;
437 }
438 else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
439 fprintf(tmp_fp, "SSH_AGENT_PROXY = %s\n", (settings.agent_proxy == TRUE) ? "yes" : "no");
440 settings.agent_proxy = FALSE;
441 }
442 else {
443 fprintf(tmp_fp, "%s = %s\n", head, body);
444 }
445 }
446 }
447 else {
448 fputs("# CygTerm setting\n", tmp_fp);
449 fputs("\n", tmp_fp);
450 }
451 if (settings.term[0] != '\0') {
452 fprintf(tmp_fp, "TERM = %s\n", settings.term);
453 }
454 if (settings.term_type[0] != '\0') {
455 fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
456 }
457 if (settings.port_start[0] != '\0') {
458 fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
459 }
460 if (settings.port_range[0] != '\0') {
461 fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
462 }
463 if (settings.shell[0] != '\0') {
464 fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
465 }
466 if (settings.env1[0] != '\0') {
467 fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
468 }
469 if (settings.env2[0] != '\0') {
470 fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
471 }
472 if (settings.login_shell) {
473 fprintf(tmp_fp, "LOGIN_SHELL = yes\n");
474 }
475 if (settings.home_chdir) {
476 fprintf(tmp_fp, "HOME_CHDIR = yes\n");
477 }
478 if (settings.agent_proxy) {
479 fprintf(tmp_fp, "SSH_AGENT_PROXY = yes\n");
480 }
481 fclose(tmp_fp);
482
483 // �_�C���N�g���t�@�C���������������������������A���L�������s�v�B
484 #if 0
485 if (remove(cfg) != 0 && errno != ENOENT) {
486 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
487 get_lang_msg("MSG_CYGTERM_CONF_REMOVEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
488 "Can't remove old CygTerm configuration file (%d).", ts->UILanguageFile);
489 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
490 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
491 }
492 else if (rename(tmp, cfg) != 0) {
493 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
494 get_lang_msg("MSG_CYGTERM_CONF_RENAMEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
495 "Can't rename CygTerm configuration file (%d).", ts->UILanguageFile);
496 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
497 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
498 }
499 else {
500 // cygterm.cfg �t�@�C�����������������������A���b�Z�[�W�_�C�A���O���\�������B
501 // �������ASave setup�����s�����K�v�������������������N�����B
502 // (2012.5.1 yutaka)
503 // Save setup ���s�����ACygTerm�������������������������������������A
504 // �_�C�A���O�\�����s�v�����������A���������B
505 // (2015.11.12 yutaka)
506 get_lang_msg("MSG_TT_NOTICE", uimsg, sizeof(uimsg), "MSG_TT_NOTICE", ts->UILanguageFile);
507 get_lang_msg("MSG_CYGTERM_CONF_SAVED_NOTICE", ts->UIMsg, sizeof(ts->UIMsg),
508 "%s has been saved. Do not do save setup.", ts->UILanguageFile);
509 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, CYGTERM_FILE);
510 MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONINFORMATION);
511 }
512 #endif
513 }
514
515 // �Y�������������t���[���������B
516 for (i = 0; i < linenum; i++) {
517 free(line[i]);
518 }
519
520 }
521
522 void PASCAL ReadIniFile(PCHAR FName, PTTSet ts)
523 {
524 int i;
525 HDC TmpDC;
526 char Temp[MAX_PATH], Temp2[MAX_PATH];
527
528 ts->Minimize = 0;
529 ts->HideWindow = 0;
530 ts->LogFlag = 0; // Log flags
531 ts->FTFlag = 0; // File transfer flags
532 ts->MenuFlag = 0; // Menu flags
533 ts->TermFlag = 0; // Terminal flag
534 ts->ColorFlag = 0; // ANSI/Attribute color flags
535 ts->FontFlag = 0; // Font flag
536 ts->PortFlag = 0; // Port flags
537 ts->WindowFlag = 0; // Window flags
538 ts->CtrlFlag = 0; // Control sequence flags
539 ts->PasteFlag = 0; // Clipboard Paste flags
540 ts->TelPort = 23;
541
542 ts->DisableTCPEchoCR = FALSE;
543
544 /* Version number */
545 /* GetPrivateProfileString(Section,"Version","",
546 Temp,sizeof(Temp),FName); */
547
548 /* Language */
549 GetPrivateProfileString(Section, "Language", "",
550 Temp, sizeof(Temp), FName);
551 if (_stricmp(Temp, "Japanese") == 0)
552 ts->Language = IdJapanese;
553 else if (_stricmp(Temp, "Russian") == 0)
554 ts->Language = IdRussian;
555 else if (_stricmp(Temp, "English") == 0)
556 ts->Language = IdEnglish;
557 else if (_stricmp(Temp,"Korean") == 0) // HKS
558 ts->Language = IdKorean;
559 else if (_stricmp(Temp,"UTF-8") == 0)
560 ts->Language = IdUtf8;
561 else {
562 switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
563 case LANG_JAPANESE:
564 ts->Language = IdJapanese;
565 break;
566 case LANG_RUSSIAN:
567 ts->Language = IdRussian;
568 break;
569 case LANG_KOREAN: // HKS
570 ts->Language = IdKorean;
571 break;
572 default:
573 ts->Language = IdEnglish;
574 }
575 }
576
577 /* Port type */
578 GetPrivateProfileString(Section, "Port", "",
579 Temp, sizeof(Temp), FName);
580 if (_stricmp(Temp, "serial") == 0)
581 ts->PortType = IdSerial;
582 else {
583 ts->PortType = IdTCPIP;
584 }
585
586 /* VT win position */
587 GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
588 GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
589 GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
590
591 /* TEK win position */
592 GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
593 GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
594 GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
595
596 /* Save VT Window position */
597 ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
598
599 /* VT terminal size */
600 GetPrivateProfileString(Section, "TerminalSize", "80,24",
601 Temp, sizeof(Temp), FName);
602 GetNthNum(Temp, 1, &ts->TerminalWidth);
603 GetNthNum(Temp, 2, &ts->TerminalHeight);
604 if (ts->TerminalWidth <= 0)
605 ts->TerminalWidth = 80;
606 else if (ts->TerminalWidth > TermWidthMax)
607 ts->TerminalWidth = TermWidthMax;
608 if (ts->TerminalHeight <= 0)
609 ts->TerminalHeight = 24;
610 else if (ts->TerminalHeight > TermHeightMax)
611 ts->TerminalHeight = TermHeightMax;
612
613 /* Terminal size = Window size */
614 ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
615
616 /* Auto window resize flag */
617 ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
618
619 /* CR Receive */
620 GetPrivateProfileString(Section, "CRReceive", "",
621 Temp, sizeof(Temp), FName);
622 if (_stricmp(Temp, "CRLF") == 0) {
623 ts->CRReceive = IdCRLF;
624 }
625 else if (_stricmp(Temp, "LF") == 0) {
626 ts->CRReceive = IdLF;
627 }
628 else if (_stricmp(Temp, "AUTO") == 0) {
629 ts->CRReceive = IdAUTO;
630 }
631 else {
632 ts->CRReceive = IdCR;
633 }
634 /* CR Send */
635 GetPrivateProfileString(Section, "CRSend", "",
636 Temp, sizeof(Temp), FName);
637 if (_stricmp(Temp, "CRLF") == 0) {
638 ts->CRSend = IdCRLF;
639 }
640 else if (_stricmp(Temp, "LF") == 0) {
641 ts->CRSend = IdLF;
642 }
643 else {
644 ts->CRSend = IdCR;
645 }
646 ts->CRSend_ini = ts->CRSend;
647
648 /* Local echo */
649 ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
650 ts->LocalEcho_ini = ts->LocalEcho;
651
652 /* Answerback */
653 GetPrivateProfileString(Section, "Answerback", "", Temp,
654 sizeof(Temp), FName);
655 ts->AnswerbackLen =
656 Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
657
658 /* Kanji Code (receive) */
659 GetPrivateProfileString(Section, "KanjiReceive", "",
660 Temp, sizeof(Temp), FName);
661 if (_stricmp(Temp, "EUC") == 0)
662 ts->KanjiCode = IdEUC;
663 else if (_stricmp(Temp, "JIS") == 0)
664 ts->KanjiCode = IdJIS;
665 else if (_stricmp(Temp, "UTF-8") == 0)
666 ts->KanjiCode = IdUTF8;
667 else if (_stricmp(Temp, "UTF-8m") == 0)
668 ts->KanjiCode = IdUTF8m;
669 else if (_stricmp(Temp, "KS5601") == 0)
670 ts->KanjiCode = IdSJIS;
671 else
672 ts->KanjiCode = IdSJIS;
673 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
674 {
675 WORD KanjiCode = ts->KanjiCode;
676 ts->KanjiCode = KanjiCodeTranslate(ts->Language,KanjiCode);
677 }
678
679 /* Katakana (receive) */
680 GetPrivateProfileString(Section, "KatakanaReceive", "",
681 Temp, sizeof(Temp), FName);
682 if (_stricmp(Temp, "7") == 0)
683 ts->JIS7Katakana = 1;
684 else
685 ts->JIS7Katakana = 0;
686
687 /* Kanji Code (transmit) */
688 GetPrivateProfileString(Section, "KanjiSend", "",
689 Temp, sizeof(Temp), FName);
690 if (_stricmp(Temp, "EUC") == 0)
691 ts->KanjiCodeSend = IdEUC;
692 else if (_stricmp(Temp, "JIS") == 0)
693 ts->KanjiCodeSend = IdJIS;
694 else if (_stricmp(Temp, "UTF-8") == 0)
695 ts->KanjiCodeSend = IdUTF8;
696 else if (_stricmp(Temp, "KS5601") == 0)
697 ts->KanjiCode = IdSJIS;
698 else
699 ts->KanjiCodeSend = IdSJIS;
700 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
701 {
702 WORD KanjiCodeSend = ts->KanjiCodeSend;
703 ts->KanjiCodeSend = KanjiCodeTranslate(ts->Language,KanjiCodeSend);
704 }
705
706 /* Katakana (receive) */
707 GetPrivateProfileString(Section, "KatakanaSend", "",
708 Temp, sizeof(Temp), FName);
709 if (_stricmp(Temp, "7") == 0)
710 ts->JIS7KatakanaSend = 1;
711 else
712 ts->JIS7KatakanaSend = 0;
713
714 /* KanjiIn */
715 GetPrivateProfileString(Section, "KanjiIn", "",
716 Temp, sizeof(Temp), FName);
717 if (_stricmp(Temp, "@") == 0)
718 ts->KanjiIn = IdKanjiInA;
719 else
720 ts->KanjiIn = IdKanjiInB;
721
722 /* KanjiOut */
723 GetPrivateProfileString(Section, "KanjiOut", "",
724 Temp, sizeof(Temp), FName);
725 if (_stricmp(Temp, "B") == 0)
726 ts->KanjiOut = IdKanjiOutB;
727 else if (_stricmp(Temp, "H") == 0)
728 ts->KanjiOut = IdKanjiOutH;
729 else
730 ts->KanjiOut = IdKanjiOutJ;
731
732 /* Auto Win Switch VT<->TEK */
733 ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
734
735 /* Terminal ID */
736 GetPrivateProfileString(Section, "TerminalID", "",
737 Temp, sizeof(Temp), FName);
738 ts->TerminalID = str2id(TermList, Temp, IdVT100);
739
740 /* Russian character set (host) */
741 GetPrivateProfileString(Section, "RussHost", "",
742 Temp, sizeof(Temp), FName);
743 ts->RussHost = str2id(RussList, Temp, IdKOI8);
744
745 /* Russian character set (client) */
746 GetPrivateProfileString(Section, "RussClient", "",
747 Temp, sizeof(Temp), FName);
748 ts->RussClient = str2id(RussList, Temp, IdWindows);
749
750 /* Title String */
751 GetPrivateProfileString(Section, "Title", "Tera Term",
752 ts->Title, sizeof(ts->Title), FName);
753
754 /* Cursor shape */
755 GetPrivateProfileString(Section, "CursorShape", "",
756 Temp, sizeof(Temp), FName);
757 if (_stricmp(Temp, "vertical") == 0)
758 ts->CursorShape = IdVCur;
759 else if (_stricmp(Temp, "horizontal") == 0)
760 ts->CursorShape = IdHCur;
761 else
762 ts->CursorShape = IdBlkCur;
763
764 /* Hide title */
765 ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
766
767 /* Popup menu */
768 ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
769
770 /* PC-Style bold color mapping */
771 if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
772 ts->ColorFlag |= CF_PCBOLD16;
773
774 /* aixterm style 16 colors mode */
775 if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
776 ts->ColorFlag |= CF_AIXTERM16;
777
778 /* xterm style 256 colors mode */
779 if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
780 ts->ColorFlag |= CF_XTERM256;
781
782 /* Enable scroll buffer */
783 ts->EnableScrollBuff =
784 GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
785
786 /* Scroll buffer size */
787 ts->ScrollBuffSize =
788 GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
789
790 /* VT Color */
791 GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
792 Temp, sizeof(Temp), FName);
793 for (i = 0; i <= 5; i++)
794 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
795 for (i = 0; i <= 1; i++)
796 ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
797 (BYTE) ts->TmpColor[0][i * 3 + 1],
798 (BYTE) ts->TmpColor[0][i * 3 + 2]);
799
800 /* VT Bold Color */
801 GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
802 Temp, sizeof(Temp), FName);
803 for (i = 0; i <= 5; i++)
804 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
805 for (i = 0; i <= 1; i++)
806 ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
807 (BYTE) ts->TmpColor[0][i * 3 + 1],
808 (BYTE) ts->TmpColor[0][i * 3 + 2]);
809 if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
810 ts->ColorFlag |= CF_BOLDCOLOR;
811
812 /* VT Blink Color */
813 GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
814 Temp, sizeof(Temp), FName);
815 for (i = 0; i <= 5; i++)
816 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
817 for (i = 0; i <= 1; i++)
818 ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
819 (BYTE) ts->TmpColor[0][i * 3 + 1],
820 (BYTE) ts->TmpColor[0][i * 3 + 2]);
821 if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
822 ts->ColorFlag |= CF_BLINKCOLOR;
823
824 /* VT Reverse Color */
825 GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
826 Temp, sizeof(Temp), FName);
827 for (i = 0; i <= 5; i++)
828 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
829 for (i = 0; i <= 1; i++)
830 ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
831 (BYTE) ts->TmpColor[0][i * 3 + 1],
832 (BYTE) ts->TmpColor[0][i * 3 + 2]);
833 if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
834 ts->ColorFlag |= CF_REVERSECOLOR;
835
836 ts->EnableClickableUrl =
837 GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
838
839 /* URL Color */
840 GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
841 Temp, sizeof(Temp), FName);
842 for (i = 0; i <= 5; i++)
843 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
844 for (i = 0; i <= 1; i++)
845 ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
846 (BYTE) ts->TmpColor[0][i * 3 + 1],
847 (BYTE) ts->TmpColor[0][i * 3 + 2]);
848 if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
849 ts->ColorFlag |= CF_URLCOLOR;
850
851 if (GetOnOff(Section, "URLUnderline", FName, TRUE))
852 ts->FontFlag |= FF_URLUNDERLINE;
853
854 /* TEK Color */
855 GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
856 Temp, sizeof(Temp), FName);
857 for (i = 0; i <= 5; i++)
858 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
859 for (i = 0; i <= 1; i++)
860 ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
861 (BYTE) ts->TmpColor[0][i * 3 + 1],
862 (BYTE) ts->TmpColor[0][i * 3 + 2]);
863
864 /* ANSI color definition (in the case FullColor=on) -- special option
865 o UseTextColor should be off, or the background and foreground color of
866 VTColor are assigned to color-number 0 and 7 respectively, even if
867 they are specified in ANSIColor.
868 o ANSIColor is a set of 4 values that are color-number(0--15),
869 red-value(0--255), green-value(0--255) and blue-value(0--255). */
870 GetPrivateProfileString(Section, "ANSIColor",
871 " 0, 0, 0, 0,"
872 " 1,255, 0, 0,"
873 " 2, 0,255, 0,"
874 " 3,255,255, 0,"
875 " 4, 0, 0,255,"
876 " 5,255, 0,255,"
877 " 6, 0,255,255,"
878 " 7,255,255,255,"
879 " 8,128,128,128,"
880 " 9,128, 0, 0,"
881 "10, 0,128, 0,"
882 "11,128,128, 0,"
883 "12, 0, 0,128,"
884 "13,128, 0,128,"
885 "14, 0,128,128,"
886 "15,192,192,192", Temp, sizeof(Temp), FName);
887 {
888 char *t;
889 int n = 1;
890 for (t = Temp; *t; t++)
891 if (*t == ',')
892 n++;
893 n /= 4;
894 for (i = 0; i < n; i++) {
895 int colorid, r, g, b;
896 GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
897 GetNthNum(Temp, i * 4 + 2, (int far *) &r);
898 GetNthNum(Temp, i * 4 + 3, (int far *) &g);
899 GetNthNum(Temp, i * 4 + 4, (int far *) &b);
900 ts->ANSIColor[colorid & 15] =
901 RGB((BYTE) r, (BYTE) g, (BYTE) b);
902 }
903 }
904
905 TmpDC = GetDC(0); /* Get screen device context */
906 for (i = 0; i <= 1; i++)
907 ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
908 for (i = 0; i <= 1; i++)
909 ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
910 for (i = 0; i <= 1; i++)
911 ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
912 for (i = 0; i <= 1; i++)
913 ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
914 /* begin - ishizaki */
915 for (i = 0; i <= 1; i++)
916 ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
917 /* end - ishizaki */
918 for (i = 0; i < 16; i++)
919 ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
920 ReleaseDC(0, TmpDC);
921 if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
922 ts->ColorFlag |= CF_ANSICOLOR;
923
924 /* TEK color emulation */
925 ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
926
927 /* VT Font */
928 GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
929 Temp, sizeof(Temp), FName);
930 GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
931 GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
932 GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
933 GetNthNum(Temp, 4, &(ts->VTFontCharSet));
934
935 /* Bold font flag */
936 if (GetOnOff(Section, "EnableBold", FName, TRUE))
937 ts->FontFlag |= FF_BOLD;
938
939 /* Russian character set (font) */
940 GetPrivateProfileString(Section, "RussFont", "",
941 Temp, sizeof(Temp), FName);
942 ts->RussFont = str2id(RussList, Temp, IdWindows);
943
944 /* TEK Font */
945 GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
946 Temp, sizeof(Temp), FName);
947 GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
948 GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
949 GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
950 GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
951
952 /* BS key */
953 GetPrivateProfileString(Section, "BSKey", "",
954 Temp, sizeof(Temp), FName);
955 if (_stricmp(Temp, "DEL") == 0)
956 ts->BSKey = IdDEL;
957 else
958 ts->BSKey = IdBS;
959 /* Delete key */
960 ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
961
962 /* Meta Key */
963 GetPrivateProfileString(Section, "MetaKey", "off", Temp, sizeof(Temp), FName);
964 if (_stricmp(Temp, "on") == 0)
965 ts->MetaKey = IdMetaOn;
966 else if (_stricmp(Temp, "left") == 0)
967 ts->MetaKey = IdMetaLeft;
968 else if (_stricmp(Temp, "right") == 0)
969 ts->MetaKey = IdMetaRight;
970 else
971 ts->MetaKey = IdMetaOff;
972
973 // Windows95 �n�����E�� Alt ��������������
974 if (!IsWindowsNTKernel() && ts->MetaKey != IdMetaOff) {
975 ts->MetaKey = IdMetaOn;
976 }
977
978 /* Application Keypad */
979 ts->DisableAppKeypad =
980 GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
981
982 /* Application Cursor */
983 ts->DisableAppCursor =
984 GetOnOff(Section, "DisableAppCursor", FName, FALSE);
985
986 /* Russian keyboard type */
987 GetPrivateProfileString(Section, "RussKeyb", "",
988 Temp, sizeof(Temp), FName);
989 ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
990
991 /* Serial port ID */
992 ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
993
994 /* Baud rate */
995 ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName);
996
997 /* Parity */
998 GetPrivateProfileString(Section, "Parity", "",
999 Temp, sizeof(Temp), FName);
1000 if (_stricmp(Temp, "even") == 0)
1001 ts->Parity = IdParityEven;
1002 else if (_stricmp(Temp, "odd") == 0)
1003 ts->Parity = IdParityOdd;
1004 else if (_stricmp(Temp, "mark") == 0)
1005 ts->Parity = IdParityMark;
1006 else if (_stricmp(Temp, "space") == 0)
1007 ts->Parity = IdParitySpace;
1008 else
1009 ts->Parity = IdParityNone;
1010
1011 /* Data bit */
1012 GetPrivateProfileString(Section, "DataBit", "",
1013 Temp, sizeof(Temp), FName);
1014 if (_stricmp(Temp, "7") == 0)
1015 ts->DataBit = IdDataBit7;
1016 else
1017 ts->DataBit = IdDataBit8;
1018
1019 /* Stop bit */
1020 GetPrivateProfileString(Section, "StopBit", "",
1021 Temp, sizeof(Temp), FName);
1022 if (_stricmp(Temp, "2") == 0)
1023 ts->StopBit = IdStopBit2;
1024 else if (_stricmp(Temp, "1.5") == 0)
1025 ts->StopBit = IdStopBit15;
1026 else
1027 ts->StopBit = IdStopBit1;
1028
1029 /* Flow control */
1030 GetPrivateProfileString(Section, "FlowCtrl", "",
1031 Temp, sizeof(Temp), FName);
1032 if (_stricmp(Temp, "x") == 0)
1033 ts->Flow = IdFlowX;
1034 else if (_stricmp(Temp, "hard") == 0)
1035 ts->Flow = IdFlowHard;
1036 else
1037 ts->Flow = IdFlowNone;
1038
1039 /* Delay per character */
1040 ts->DelayPerChar =
1041 GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
1042
1043 /* Delay per line */
1044 ts->DelayPerLine =
1045 GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
1046
1047 /* Telnet flag */
1048 ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
1049
1050 /* Telnet terminal type */
1051 GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
1052 sizeof(ts->TermType), FName);
1053
1054 /* TCP port num */
1055 ts->TCPPort =
1056 GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
1057
1058 /* Auto window close flag */
1059 ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
1060
1061 /* History list */
1062 ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
1063
1064 /* File transfer binary flag */
1065 ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
1066
1067 /* Log binary flag */
1068 ts->LogBinary = GetOnOff(Section, "LogBinary", FName, FALSE);
1069
1070 /* Log append */
1071 ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
1072
1073 /* Log plain text (2005.5.7 yutaka) */
1074 ts->LogTypePlainText =
1075 GetOnOff(Section, "LogTypePlainText", FName, FALSE);
1076
1077 /* Log with timestamp (2006.7.23 maya) */
1078 ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
1079
1080 /* Log without transfer dialog */
1081 ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
1082
1083 ts->LogAllBuffIncludedInFirst = GetOnOff(Section, "LogIncludeScreenBuffer", FName, FALSE);
1084
1085 /* Timestamp format of Log each line */
1086 GetPrivateProfileString(Section, "LogTimestampFormat", "%Y-%m-%d %H:%M:%S.%N",
1087 ts->LogTimestampFormat, sizeof(ts->LogTimestampFormat),
1088 FName);
1089
1090 /* Timestamp type */
1091 GetPrivateProfileString(Section, "LogTimestampType", "", Temp, sizeof(Temp), FName);
1092 if (_stricmp(Temp, "UTC") == 0)
1093 ts->LogTimestampType = TIMESTAMP_UTC;
1094 else if (_stricmp(Temp, "LoggingElapsed") == 0)
1095 ts->LogTimestampType = TIMESTAMP_ELAPSED_LOGSTART;
1096 else if (_stricmp(Temp, "ConnectionElapsed") == 0)
1097 ts->LogTimestampType = TIMESTAMP_ELAPSED_CONNECTED;
1098 else if (_stricmp(Temp, "") == 0 && GetOnOff(Section, "LogTimestampUTC", FName, FALSE))
1099 // LogTimestampType ���������������� LogTimestampUTC ���l���Q������
1100 ts->LogTimestampType = TIMESTAMP_UTC;
1101 else
1102 ts->LogTimestampType = TIMESTAMP_LOCAL;
1103
1104 /* File Transfer dialog visibility */
1105 ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE);
1106
1107 /* Default Log file name (2006.8.28 maya) */
1108 GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
1109 ts->LogDefaultName, sizeof(ts->LogDefaultName),
1110 FName);
1111
1112 /* Default Log file path (2007.5.30 maya) */
1113 GetPrivateProfileString(Section, "LogDefaultPath", "",
1114 ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
1115 FName);
1116
1117 /* Auto start logging (2007.5.31 maya) */
1118 ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
1119
1120 /* Log Rotate (2013.3.24 yutaka) */
1121 ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName);
1122 ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName);
1123 ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName);
1124 ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName);
1125
1126 /* Deferred Log Write Mode (2013.4.20 yutaka) */
1127 ts->DeferredLogWriteMode = GetOnOff(Section, "DeferredLogWriteMode", FName, TRUE);
1128
1129
1130 /* XMODEM option */
1131 GetPrivateProfileString(Section, "XmodemOpt", "",
1132 Temp, sizeof(Temp), FName);
1133 if (_stricmp(Temp, "crc") == 0)
1134 ts->XmodemOpt = XoptCRC;
1135 else if (_stricmp(Temp, "1k") == 0)
1136 ts->XmodemOpt = Xopt1kCRC;
1137 else if (_stricmp(Temp, "1ksum") == 0)
1138 ts->XmodemOpt = Xopt1kCksum;
1139 else
1140 ts->XmodemOpt = XoptCheck;
1141
1142 /* XMODEM binary file */
1143 ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
1144
1145 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1146 GetPrivateProfileString(Section, "XModemRcvCommand", "",
1147 ts->XModemRcvCommand,
1148 sizeof(ts->XModemRcvCommand), FName);
1149
1150 /* Default directory for file transfer */
1151 GetPrivateProfileString(Section, "FileDir", "",
1152 ts->FileDir, sizeof(ts->FileDir), FName);
1153 if (strlen(ts->FileDir) == 0)
1154 GetDownloadFolder(ts->FileDir, sizeof(ts->FileDir));
1155 else {
1156 _getcwd(Temp, sizeof(Temp));
1157 if (_chdir(ts->FileDir) != 0)
1158 GetDownloadFolder(ts->FileDir, sizeof(ts->FileDir));
1159 _chdir(Temp);
1160 }
1161
1162 /* filter on file send (2007.6.5 maya) */
1163 GetPrivateProfileString(Section, "FileSendFilter", "",
1164 ts->FileSendFilter, sizeof(ts->FileSendFilter),
1165 FName);
1166
1167 /* SCP���M���p�X (2012.4.6 yutaka) */
1168 GetPrivateProfileString(Section, "ScpSendDir", "",
1169 ts->ScpSendDir, sizeof(ts->ScpSendDir), FName);
1170
1171
1172 /*--------------------------------------------------*/
1173 /* 8 bit control code flag -- special option */
1174 if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
1175 ts->TermFlag |= TF_ACCEPT8BITCTRL;
1176
1177 /* Wrong sequence flag -- special option */
1178 if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
1179 ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
1180
1181 if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
1182 (ts->KanjiOut == IdKanjiOutH))
1183 ts->KanjiOut = IdKanjiOutJ;
1184
1185 // Detect disconnect/reconnect of serial port --- special option
1186 ts->AutoComPortReconnect = GetOnOff(Section, "AutoComPortReconnect", FName, TRUE);
1187
1188 // Auto file renaming --- special option
1189 if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
1190 ts->FTFlag |= FT_RENAME;
1191
1192 // Auto invoking (character set->G0->GL) --- special option
1193 if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
1194 ts->TermFlag |= TF_AUTOINVOKE;
1195
1196 // Auto text copy --- special option
1197 ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
1198
1199 /* Back wrap -- special option */
1200 if (GetOnOff(Section, "BackWrap", FName, FALSE))
1201 ts->TermFlag |= TF_BACKWRAP;
1202
1203 /* Beep type -- special option */
1204 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
1205 if (_stricmp(Temp, "off") == 0)
1206 ts->Beep = IdBeepOff;
1207 else if (_stricmp(Temp, "visual") == 0)
1208 ts->Beep = IdBeepVisual;
1209 else
1210 ts->Beep = IdBeepOn;
1211
1212 /* Beep on connection & disconnection -- special option */
1213 if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
1214 ts->PortFlag |= PF_BEEPONCONNECT;
1215
1216 /* Auto B-Plus activation -- special option */
1217 if (GetOnOff(Section, "BPAuto", FName, FALSE))
1218 ts->FTFlag |= FT_BPAUTO;
1219 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
1220 strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
1221 _TRUNCATE);
1222 ts->AnswerbackLen = 5;
1223 }
1224
1225 /* B-Plus ESCCTL flag -- special option */
1226 if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
1227 ts->FTFlag |= FT_BPESCCTL;
1228
1229 /* B-Plus log -- special option */
1230 if (GetOnOff(Section, "BPLog", FName, FALSE))
1231 ts->LogFlag |= LOG_BP;
1232
1233 /* Clear serial port buffer when port opening -- special option */
1234 ts->ClearComBuffOnOpen =
1235 GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
1236
1237 /* When serial port is specified with with /C= option and the port does not exist, Tera Term will wait for port connection. */
1238 ts->WaitCom = GetOnOff(Section, "WaitCom", FName, FALSE);
1239
1240 /* Confirm disconnection -- special option */
1241 if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
1242 ts->PortFlag |= PF_CONFIRMDISCONN;
1243
1244 /* Ctrl code in Kanji -- special option */
1245 if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
1246 ts->TermFlag |= TF_CTRLINKANJI;
1247
1248 /* Debug flag -- special option */
1249 ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
1250
1251 /* Delimiter list -- special option */
1252 GetPrivateProfileString(Section, "DelimList",
1253 "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
1254 Temp, sizeof(Temp), FName);
1255 Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
1256
1257 /* regard DBCS characters as delimiters -- special option */
1258 ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
1259
1260 // Enable popup menu -- special option
1261 if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
1262 ts->MenuFlag |= MF_NOPOPUP;
1263
1264 // Enable "Show menu" -- special option
1265 if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
1266 ts->MenuFlag |= MF_NOSHOWMENU;
1267
1268 // Enable the status line -- special option
1269 if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
1270 ts->TermFlag |= TF_ENABLESLINE;
1271
1272 // Enable multiple bytes send -- special option
1273 ts->FileSendHighSpeedMode = GetOnOff(Section, "FileSendHighSpeedMode", FName, TRUE);
1274
1275 // fixed JIS --- special
1276 if (GetOnOff(Section, "FixedJIS", FName, FALSE))
1277 ts->TermFlag |= TF_FIXEDJIS;
1278
1279 /* IME Flag -- special option */
1280 ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
1281
1282 /* IME-inline Flag -- special option */
1283 ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
1284
1285 /* Kermit log -- special option */
1286 if (GetOnOff(Section, "KmtLog", FName, FALSE))
1287 ts->LogFlag |= LOG_KMT;
1288 if (GetOnOff(Section, "KmtLongPacket", FName, FALSE))
1289 ts->KermitOpt |= KmtOptLongPacket;
1290 if (GetOnOff(Section, "KmtFileAttr", FName, FALSE))
1291 ts->KermitOpt |= KmtOptFileAttr;
1292
1293 // Enable language selection -- special option
1294 if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
1295 ts->MenuFlag |= MF_NOLANGUAGE;
1296
1297 /* Maximum scroll buffer size -- special option */
1298 ts->ScrollBuffMax =
1299 GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
1300 if (ts->ScrollBuffMax < 24)
1301 ts->ScrollBuffMax = 10000;
1302
1303 /* Max com port number -- special option */
1304 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 256, FName);
1305 if (ts->MaxComPort < 4)
1306 ts->MaxComPort = 4;
1307 if (ts->MaxComPort > MAXCOMPORT)
1308 ts->MaxComPort = MAXCOMPORT;
1309 if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
1310 ts->ComPort = 1;
1311
1312 /* Non-blinking cursor -- special option */
1313 ts->NonblinkingCursor =
1314 GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
1315
1316 // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
1317 ts->KillFocusCursor =
1318 GetOnOff(Section, "KillFocusCursor", FName, TRUE);
1319
1320 /* Delay for pass-thru printing activation */
1321 /* -- special option */
1322 ts->PassThruDelay =
1323 GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
1324
1325 /* Printer port for pass-thru printing */
1326 /* -- special option */
1327 GetPrivateProfileString(Section, "PassThruPort", "",
1328 ts->PrnDev, sizeof(ts->PrnDev), FName);
1329
1330 /* �v�����^�p�����R�[�h�������t������ */
1331 if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE))
1332 ts->TermFlag |= TF_PRINTERCTRL;
1333
1334 /* Printer Font --- special option */
1335 GetPrivateProfileString(Section, "PrnFont", "",
1336 Temp, sizeof(Temp), FName);
1337 if (strlen(Temp) == 0) {
1338 ts->PrnFont[0] = 0;
1339 ts->PrnFontSize.x = 0;
1340 ts->PrnFontSize.y = 0;
1341 ts->PrnFontCharSet = 0;
1342 }
1343 else {
1344 GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
1345 GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
1346 GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
1347 GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
1348 }
1349
1350 // Page margins (left, right, top, bottom) for printing
1351 // -- special option
1352 GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
1353 Temp, sizeof(Temp), FName);
1354 for (i = 0; i <= 3; i++)
1355 GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
1356
1357 /* Disable (convert to NL) Form Feed when printing */
1358 /* --- special option */
1359 ts->PrnConvFF =
1360 GetOnOff(Section, "PrnConvFF", FName, FALSE);
1361
1362 /* Quick-VAN log -- special option */
1363 if (GetOnOff(Section, "QVLog", FName, FALSE))
1364 ts->LogFlag |= LOG_QV;
1365
1366 /* Quick-VAN window size -- special */
1367 ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
1368
1369 /* Russian character set (print) -- special option */
1370 GetPrivateProfileString(Section, "RussPrint", "",
1371 Temp, sizeof(Temp), FName);
1372 ts->RussPrint = str2id(RussList, Temp, IdWindows);
1373
1374 /* Scroll threshold -- special option */
1375 ts->ScrollThreshold =
1376 GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
1377
1378 ts->MouseWheelScrollLine =
1379 GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
1380
1381 // Select on activate -- special option
1382 ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
1383
1384 /* Send 8bit control sequence -- special option */
1385 ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
1386
1387 /* SendBreak time (in msec) -- special option */
1388 ts->SendBreakTime =
1389 GetPrivateProfileInt(Section, "SendBreakTime", 1000, FName);
1390
1391 /* Startup macro -- special option */
1392 GetPrivateProfileString(Section, "StartupMacro", "",
1393 ts->MacroFN, sizeof(ts->MacroFN), FName);
1394
1395 /* TEK GIN Mouse keycode -- special option */
1396 ts->GINMouseCode =
1397 GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
1398
1399 /* Telnet Auto Detect -- special option */
1400 ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
1401
1402 /* Telnet binary flag -- special option */
1403 ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
1404
1405 /* Telnet Echo flag -- special option */
1406 ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
1407
1408 /* Telnet log -- special option */
1409 if (GetOnOff(Section, "TelLog", FName, FALSE))
1410 ts->LogFlag |= LOG_TEL;
1411
1412 /* TCP port num for telnet -- special option */
1413 ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
1414
1415 /* Telnet keep-alive packet(NOP command) interval -- special option */
1416 ts->TelKeepAliveInterval =
1417 GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
1418
1419 /* Max number of broadcast commad history */
1420 ts->MaxBroadcatHistory =
1421 GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
1422
1423 /* Local echo for non-telnet */
1424 ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
1425
1426 /* "new-line (transmit)" option for non-telnet -- special option */
1427 GetPrivateProfileString(Section, "TCPCRSend", "",
1428 Temp, sizeof(Temp), FName);
1429 if (_stricmp(Temp, "CR") == 0)
1430 ts->TCPCRSend = IdCR;
1431 else if (_stricmp(Temp, "CRLF") == 0)
1432 ts->TCPCRSend = IdCRLF;
1433 else
1434 ts->TCPCRSend = 0; // disabled
1435
1436 /* Use text (background) color for "white (black)" --- special option */
1437 if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1438 ts->ColorFlag |= CF_USETEXTCOLOR;
1439
1440 /* Title format -- special option */
1441 ts->TitleFormat =
1442 GetPrivateProfileInt(Section, "TitleFormat", 13, FName);
1443
1444 /* VT Compatible Tab -- special option */
1445 ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1446
1447 /* VT Font space --- special option */
1448 GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1449 Temp, sizeof(Temp), FName);
1450 GetNthNum(Temp, 1, &ts->FontDX);
1451 GetNthNum(Temp, 2, &ts->FontDW);
1452 GetNthNum(Temp, 3, &ts->FontDY);
1453 GetNthNum(Temp, 4, &ts->FontDH);
1454 if (ts->FontDX < 0)
1455 ts->FontDX = 0;
1456 if (ts->FontDW < 0)
1457 ts->FontDW = 0;
1458 ts->FontDW = ts->FontDW + ts->FontDX;
1459 if (ts->FontDY < 0)
1460 ts->FontDY = 0;
1461 if (ts->FontDH < 0)
1462 ts->FontDH = 0;
1463 ts->FontDH = ts->FontDH + ts->FontDY;
1464
1465 // VT-print scaling factors (pixels per inch) --- special option
1466 GetPrivateProfileString(Section, "VTPPI", "0,0",
1467 Temp, sizeof(Temp), FName);
1468 GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1469 GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1470
1471 // TEK-print scaling factors (pixels per inch) --- special option
1472 GetPrivateProfileString(Section, "TEKPPI", "0,0",
1473 Temp, sizeof(Temp), FName);
1474 GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1475 GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1476
1477 // Show "Window" menu -- special option
1478 if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1479 ts->MenuFlag |= MF_SHOWWINMENU;
1480
1481 /* XMODEM log -- special option */
1482 if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1483 ts->LogFlag |= LOG_X;
1484
1485 /* YMODEM log -- special option */
1486 if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1487 ts->LogFlag |= LOG_Y;
1488
1489 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
1490 GetPrivateProfileString(Section, "YModemRcvCommand", "rb",
1491 ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName);
1492
1493 /* Auto ZMODEM activation -- special option */
1494 if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1495 ts->FTFlag |= FT_ZAUTO;
1496
1497 /* ZMODEM data subpacket length for sending -- special */
1498 ts->ZmodemDataLen =
1499 GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1500 /* ZMODEM window size for sending -- special */
1501 ts->ZmodemWinSize =
1502 GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1503
1504 /* ZMODEM ESCCTL flag -- special option */
1505 if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1506 ts->FTFlag |= FT_ZESCCTL;
1507
1508 /* ZMODEM log -- special option */
1509 if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1510 ts->LogFlag |= LOG_Z;
1511
1512 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1513 GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1514 ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1515
1516 /* Enable continued-line copy -- special option */
1517 ts->EnableContinuedLineCopy =
1518 GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1519
1520 if (GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE))
1521 ts->PasteFlag |= CPF_DISABLE_RBUTTON;
1522
1523 if (GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE))
1524 ts->PasteFlag |= CPF_DISABLE_MBUTTON;
1525
1526 if (GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE))
1527 ts->PasteFlag |= CPF_CONFIRM_RBUTTON;
1528
1529 if (GetOnOff(Section, "ConfirmChangePaste", FName, TRUE))
1530 ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE;
1531
1532 if (GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE))
1533 ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE_CR;
1534
1535 GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "",
1536 Temp, sizeof(Temp), FName);
1537
1538 strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp,
1539 _TRUNCATE);
1540
1541 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1542 ts->ScrollWindowClearScreen =
1543 GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1544
1545 // added SelectOnlyByLButton (2007.11.20 maya)
1546 ts->SelectOnlyByLButton =
1547 GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1548
1549 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1550 ts->DisableAcceleratorSendBreak =
1551 GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1552
1553 // WinSock connecting timeout value (2007.1.11 yutaka)
1554 ts->ConnectingTimeout =
1555 GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1556
1557 // mouse cursor
1558 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1559 Temp, sizeof(Temp), FName);
1560 strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1561 _TRUNCATE);
1562
1563 // Translucent window
1564 ts->AlphaBlendInactive =
1565 GetPrivateProfileInt(Section, "AlphaBlend", 255, FName);
1566 ts->AlphaBlendInactive = max(0, ts->AlphaBlendInactive);
1567 ts->AlphaBlendInactive = min(255, ts->AlphaBlendInactive);
1568 ts->AlphaBlendActive =
1569 GetPrivateProfileInt(Section, "AlphaBlendActive", ts->AlphaBlendInactive, FName);
1570 ts->AlphaBlendActive = max(0, ts->AlphaBlendActive);
1571 ts->AlphaBlendActive = min(255, ts->AlphaBlendActive);
1572
1573 // Cygwin install path
1574 GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1575 Temp, sizeof(Temp), FName);
1576 strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1577 _TRUNCATE);
1578
1579 // Viewlog Editor path
1580 if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1)
1581 strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE);
1582 }
1583 else {
1584 Temp[0] = '\0';
1585 }
1586 GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
1587 ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
1588
1589 // Locale for UTF-8
1590 GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1591 Temp, sizeof(Temp), FName);
1592 strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1593
1594 // UI language message file
1595 GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1596 Temp, sizeof(Temp), FName);
1597 {
1598 char CurDir[MAX_PATH];
1599
1600 // �t���p�X�������O������������������������������
1601 strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1602
1603 GetCurrentDirectory(sizeof(CurDir), CurDir);
1604 SetCurrentDirectory(ts->HomeDir);
1605 _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1606 SetCurrentDirectory(CurDir);
1607 }
1608
1609 // Broadcast Command History (2007.3.3 maya)
1610 ts->BroadcastCommandHistory =
1611 GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1612
1613 // 337: 2007/03/20 Accept Broadcast
1614 ts->AcceptBroadcast =
1615 GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1616
1617 // Confirm send a file when drag and drop (2007.12.28 maya)
1618 ts->ConfirmFileDragAndDrop =
1619 GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1620
1621 // Translate mouse wheel to cursor key when application cursor mode
1622 ts->TranslateWheelToCursor =
1623 GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1624
1625 // Display "New Connection" dialog on startup (2008.1.18 maya)
1626 ts->HostDialogOnStartup =
1627 GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1628
1629 // Mouse event tracking
1630 ts->MouseEventTracking =
1631 GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1632
1633 // Maximized bug tweak
1634 GetPrivateProfileString(Section, "MaximizedBugTweak", "2", Temp,
1635 sizeof(Temp), FName);
1636 if (_stricmp(Temp, "on") == 0) {
1637 ts->MaximizedBugTweak = 2;
1638 }
1639 else {
1640 ts->MaximizedBugTweak = atoi(Temp);
1641 }
1642
1643 // Convert Unicode symbol characters to DEC Special characters
1644 ts->UnicodeDecSpMapping =
1645 GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1646
1647 // VT Window Icon
1648 GetPrivateProfileString(Section, "VTIcon", "Default",
1649 Temp, sizeof(Temp), FName);
1650 ts->VTIcon = IconName2IconId(Temp);
1651
1652 // Tek Window Icon
1653 GetPrivateProfileString(Section, "TEKIcon", "Default",
1654 Temp, sizeof(Temp), FName);
1655 ts->TEKIcon = IconName2IconId(Temp);
1656
1657 // Unknown Unicode Character
1658 ts->UnknownUnicodeCharaAsWide =
1659 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1660
1661 #ifdef USE_NORMAL_BGCOLOR
1662 // UseNormalBGColor
1663 ts->UseNormalBGColor =
1664 GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1665 // 2006/03/11 by 337
1666 if (ts->UseNormalBGColor) {
1667 ts->VTBoldColor[1] =
1668 ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1669 }
1670 #endif
1671
1672 // AutoScrollOnlyInBottomLine
1673 ts->AutoScrollOnlyInBottomLine =
1674 GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1675
1676 // Accept remote-controlled window title changing
1677 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1678 Temp, sizeof(Temp), FName);
1679 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1680 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1681 else if (_stricmp(Temp, "ahead") == 0)
1682 ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1683 else if (_stricmp(Temp, "last") == 0)
1684 ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1685 else
1686 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1687
1688 // Size of paste confirm dialog
1689 GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1690 Temp, sizeof(Temp), FName);
1691 GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1692 GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1693 if (ts->PasteDialogSize.cx < 0)
1694 ts->PasteDialogSize.cx = 330;
1695 if (ts->PasteDialogSize.cy < 0)
1696 ts->PasteDialogSize.cy = 220;
1697
1698 // Disable mouse event tracking when Control-Key is pressed.
1699 ts->DisableMouseTrackingByCtrl =
1700 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1701
1702 // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1703 ts->DisableWheelToCursorByCtrl =
1704 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1705
1706 // Strict Key Mapping.
1707 ts->StrictKeyMapping =
1708 GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1709
1710 // added Wait4allMacroCommand (2009.3.23 yutaka)
1711 ts->Wait4allMacroCommand =
1712 GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1713
1714 // added DisableMenuSendBreak (2009.4.6 maya)
1715 ts->DisableMenuSendBreak =
1716 GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1717
1718 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1719 ts->ClearScreenOnCloseConnection =
1720 GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1721
1722 // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1723 ts->DisableAcceleratorDuplicateSession =
1724 GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1725
1726 ts->AcceleratorNewConnection =
1727 GetOnOff(Section, "AcceleratorNewConnection", FName, TRUE);
1728
1729 ts->AcceleratorCygwinConnection =
1730 GetOnOff(Section, "AcceleratorCygwinConnection", FName, TRUE);
1731
1732 // added DisableMenuDuplicateSession (2010.8.3 maya)
1733 ts->DisableMenuDuplicateSession =
1734 GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE);
1735
1736 // added DisableMenuNewConnection (2010.8.4 maya)
1737 ts->DisableMenuNewConnection =
1738 GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE);
1739
1740 // added PasteDelayPerLine (2009.4.12 maya)
1741 ts->PasteDelayPerLine =
1742 GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1743 {
1744 int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1745 ts->PasteDelayPerLine = tmp;
1746 }
1747
1748 // Font scaling -- test
1749 ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1750
1751 // Meta sets MSB
1752 GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName);
1753 if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0)
1754 ts->Meta8Bit = IdMeta8BitRaw;
1755 else if (_stricmp(Temp, "text") == 0)
1756 ts->Meta8Bit = IdMeta8BitText;
1757 else
1758 ts->Meta8Bit = IdMeta8BitOff;
1759
1760 // Window control sequence
1761 if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE))
1762 ts->WindowFlag |= WF_WINDOWCHANGE;
1763
1764 // Cursor control sequence
1765 if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE))
1766 ts->WindowFlag |= WF_CURSORCHANGE;
1767
1768 // Window report sequence
1769 if (GetOnOff(Section, "WindowReportSequence", FName, TRUE))
1770 ts->WindowFlag |= WF_WINDOWREPORT;
1771
1772 // Title report sequence
1773 GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName);
1774 if (_stricmp(Temp, "accept") == 0)
1775 ts->WindowFlag |= IdTitleReportAccept;
1776 else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0)
1777 ts->WindowFlag &= ~WF_TITLEREPORT;
1778 else // empty
1779 ts->WindowFlag |= IdTitleReportEmpty;
1780
1781 // Line at a time mode
1782 ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE);
1783
1784 // Clear window on resize
1785 if (GetOnOff(Section, "ClearOnResize", FName, TRUE))
1786 ts->TermFlag |= TF_CLEARONRESIZE;
1787
1788 // Alternate Screen Buffer
1789 if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE))
1790 ts->TermFlag |= TF_ALTSCR;
1791
1792 // IME status related cursor style
1793 if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE))
1794 ts->WindowFlag |= WF_IMECURSORCHANGE;
1795
1796 // Terminal Unique ID
1797 GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName);
1798 if (strlen(Temp) == 8) {
1799 for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) {
1800 if (islower(Temp[i])) {
1801 ts->TerminalUID[i] = toupper(Temp[i]);
1802 }
1803 else {
1804 ts->TerminalUID[i] = Temp[i];
1805 }
1806 }
1807 if (i == 8) {
1808 ts->TerminalUID[i] = 0;
1809 }
1810 else {
1811 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1812 }
1813 }
1814 else {
1815 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1816 }
1817
1818 // Lock Terminal UID
1819 if (GetOnOff(Section, "LockTUID", FName, TRUE))
1820 ts->TermFlag |= TF_LOCKTUID;
1821
1822 // Jump List
1823 ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1824
1825 // TabStopModifySequence
1826 GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName);
1827 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1828 ts->TabStopFlag = TABF_ALL;
1829 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
1830 ts->TabStopFlag = TABF_NONE;
1831 else {
1832 ts->TabStopFlag = TABF_NONE;
1833 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1834 if (_stricmp(Temp2, "HTS") == 0)
1835 ts->TabStopFlag |= TABF_HTS;
1836 else if (_stricmp(Temp2, "HTS7") == 0)
1837 ts->TabStopFlag |= TABF_HTS7;
1838 else if (_stricmp(Temp2, "HTS8") == 0)
1839 ts->TabStopFlag |= TABF_HTS8;
1840 else if (_stricmp(Temp2, "TBC") == 0)
1841 ts->TabStopFlag |= TABF_TBC;
1842 else if (_stricmp(Temp2, "TBC0") == 0)
1843 ts->TabStopFlag |= TABF_TBC0;
1844 else if (_stricmp(Temp2, "TBC3") == 0)
1845 ts->TabStopFlag |= TABF_TBC3;
1846 }
1847 }
1848
1849 // Clipboard Access from Remote
1850 GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName);
1851 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0)
1852 ts->CtrlFlag |= CSF_CBRW;
1853 else if (_stricmp(Temp, "read") == 0)
1854 ts->CtrlFlag |= CSF_CBREAD;
1855 else if (_stricmp(Temp, "write") == 0)
1856 ts->CtrlFlag |= CSF_CBWRITE;
1857
1858 // Notify Clipboard Access from Remote
1859 ts->NotifyClipboardAccess = GetOnOff(Section, "NotifyClipboardAccess", FName, TRUE);
1860
1861 // Use invalid DECRPSS (for testing)
1862 if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
1863 ts->TermFlag |= TF_INVALIDDECRPSS;
1864
1865 // ClickableUrlBrowser
1866 GetPrivateProfileString(Section, "ClickableUrlBrowser", "",
1867 ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName);
1868 GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "",
1869 ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName);
1870
1871 // Exclusive Lock when open the log file
1872 ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE);
1873
1874 // Font quality
1875 GetPrivateProfileString(Section, "FontQuality", "default",
1876 Temp, sizeof(Temp), FName);
1877 if (_stricmp(Temp, "nonantialiased") == 0)
1878 ts->FontQuality = NONANTIALIASED_QUALITY;
1879 else if (_stricmp(Temp, "antialiased") == 0)
1880 ts->FontQuality = ANTIALIASED_QUALITY;
1881 else if (_stricmp(Temp, "cleartype") == 0)
1882 ts->FontQuality = CLEARTYPE_QUALITY;
1883 else
1884 ts->FontQuality = DEFAULT_QUALITY;
1885
1886 // Beep Over Used
1887 ts->BeepOverUsedCount =
1888 GetPrivateProfileInt(Section, "BeepOverUsedCount", 5, FName);
1889 ts->BeepOverUsedTime =
1890 GetPrivateProfileInt(Section, "BeepOverUsedTime", 2, FName);
1891 ts->BeepSuppressTime =
1892 GetPrivateProfileInt(Section, "BeepSuppressTime", 5, FName);
1893
1894 // Max OSC string buffer size
1895 ts->MaxOSCBufferSize =
1896 GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
1897
1898 ts->JoinSplitURL = GetOnOff(Section, "JoinSplitURL", FName, FALSE);
1899
1900 GetPrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", "\\", Temp, sizeof(Temp), FName);
1901 ts->JoinSplitURLIgnoreEOLChar = Temp[0];
1902
1903 // Debug modes.
1904 GetPrivateProfileString(Section, "DebugModes", "all", Temp, sizeof(Temp), FName);
1905 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1906 ts->DebugModes = DBGF_ALL;
1907 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0) {
1908 ts->DebugModes = DBGF_NONE;
1909 ts->Debug = FALSE;
1910 }
1911 else {
1912 ts->DebugModes = DBGF_NONE;
1913 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1914 if (_stricmp(Temp2, "normal") == 0)
1915 ts->DebugModes |= DBGF_NORM;
1916 else if (_stricmp(Temp2, "hex") == 0)
1917 ts->DebugModes |= DBGF_HEXD;
1918 else if (_stricmp(Temp2, "noout") == 0)
1919 ts->DebugModes |= DBGF_NOUT;
1920 }
1921 if (ts->DebugModes == DBGF_NONE)
1922 ts->Debug = FALSE;
1923 }
1924
1925 // Xmodem Timeout
1926 GetPrivateProfileString(Section, "XmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName);
1927 ts->XmodemTimeOutInit = GetNthNum2(Temp, 1, 10);
1928 if (ts->XmodemTimeOutInit < 1)
1929 ts->XmodemTimeOutInit = 1;
1930 ts->XmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3);
1931 if (ts->XmodemTimeOutInitCRC < 1)
1932 ts->XmodemTimeOutInitCRC = 1;
1933 ts->XmodemTimeOutShort = GetNthNum2(Temp, 3, 10);
1934 if (ts->XmodemTimeOutShort < 1)
1935 ts->XmodemTimeOutShort = 1;
1936 ts->XmodemTimeOutLong = GetNthNum2(Temp, 4, 20);
1937 if (ts->XmodemTimeOutLong < 1)
1938 ts->XmodemTimeOutLong = 1;
1939 ts->XmodemTimeOutVLong = GetNthNum2(Temp, 5, 60);
1940 if (ts->XmodemTimeOutVLong < 1)
1941 ts->XmodemTimeOutVLong = 1;
1942
1943 // Ymodem Timeout
1944 GetPrivateProfileString(Section, "YmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName);
1945 ts->YmodemTimeOutInit = GetNthNum2(Temp, 1, 10);
1946 if (ts->YmodemTimeOutInit < 1)
1947 ts->YmodemTimeOutInit = 1;
1948 ts->YmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3);
1949 if (ts->YmodemTimeOutInitCRC < 1)
1950 ts->YmodemTimeOutInitCRC = 1;
1951 ts->YmodemTimeOutShort = GetNthNum2(Temp, 3, 10);
1952 if (ts->YmodemTimeOutShort < 1)
1953 ts->YmodemTimeOutShort = 1;
1954 ts->YmodemTimeOutLong = GetNthNum2(Temp, 4, 20);
1955 if (ts->YmodemTimeOutLong < 1)
1956 ts->YmodemTimeOutLong = 1;
1957 ts->YmodemTimeOutVLong = GetNthNum2(Temp, 5, 60);
1958 if (ts->YmodemTimeOutVLong < 1)
1959 ts->YmodemTimeOutVLong = 1;
1960
1961 // Zmodem Timeout
1962 GetPrivateProfileString(Section, "ZmodemTimeouts", "10,0,10,3", Temp, sizeof(Temp), FName);
1963 ts->ZmodemTimeOutNormal = GetNthNum2(Temp, 1, 10);
1964 if (ts->ZmodemTimeOutNormal < 1)
1965 ts->ZmodemTimeOutNormal = 1;
1966 ts->ZmodemTimeOutTCPIP = GetNthNum2(Temp, 2, 0);
1967 if (ts->ZmodemTimeOutTCPIP < 0)
1968 ts->ZmodemTimeOutTCPIP = 0;
1969 ts->ZmodemTimeOutInit = GetNthNum2(Temp, 3, 10);
1970 if (ts->ZmodemTimeOutInit < 1)
1971 ts->ZmodemTimeOutInit = 1;
1972 ts->ZmodemTimeOutFin = GetNthNum2(Temp, 4, 3);
1973 if (ts->ZmodemTimeOutFin < 1)
1974 ts->ZmodemTimeOutFin = 1;
1975
1976 // Trim trailing new line character when pasting
1977 if (GetOnOff(Section, "TrimTrailingNLonPaste", FName, FALSE))
1978 ts->PasteFlag |= CPF_TRIM_TRAILING_NL;
1979
1980 // Normalize line break when pasting
1981 if (GetOnOff(Section, "NormalizeLineBreakOnPaste", FName, FALSE))
1982 ts->PasteFlag |= CPF_NORMALIZE_LINEBREAK;
1983
1984 // List Inactive Font
1985 ts->ListHiddenFonts = GetOnOff(Section, "ListHiddenFonts", FName, FALSE);
1986
1987 // ISO2022ShiftFunction
1988 GetPrivateProfileString(Section, "ISO2022ShiftFunction", "on", Temp, sizeof(Temp), FName);
1989 ts->ISO2022Flag = ISO2022_SHIFT_NONE;
1990 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1991 BOOL add=TRUE;
1992 char *p = Temp2, *p2;
1993 int mask = 0;
1994
1995 while (*p == ' ' || *p == '\t') {
1996 p++;
1997 }
1998 p2 = p + strlen(p);
1999 while (p2 > p) {
2000 p2--;
2001 if (*p2 != ' ' && *p2 != '\t') {
2002 break;
2003 }
2004 }
2005 *++p2 = 0;
2006
2007 if (*p == '-') {
2008 p++;
2009 add=FALSE;
2010 }
2011 else if (*p == '+') {
2012 p++;
2013 }
2014
2015 if (_stricmp(p, "on") == 0 || _stricmp(p, "all") == 0)
2016 ts->ISO2022Flag = ISO2022_SHIFT_ALL;
2017 else if (_stricmp(p, "off") == 0 || _stricmp(p, "none") == 0)
2018 ts->ISO2022Flag = ISO2022_SHIFT_NONE;
2019 else if (_stricmp(p, "SI") == 0 || _stricmp(p, "LS0") == 0)
2020 mask = ISO2022_SI;
2021 else if (_stricmp(p, "SO") == 0 || _stricmp(p, "LS1") == 0)
2022 mask = ISO2022_SO;
2023 else if (_stricmp(p, "LS2") == 0)
2024 mask = ISO2022_LS2;
2025 else if (_stricmp(p, "LS3") == 0)
2026 mask = ISO2022_LS3;
2027 else if (_stricmp(p, "LS1R") == 0)
2028 mask = ISO2022_LS1R;
2029 else if (_stricmp(p, "LS2R") == 0)
2030 mask = ISO2022_LS2R;
2031 else if (_stricmp(p, "LS3R") == 0)
2032 mask = ISO2022_LS3R;
2033 else if (_stricmp(p, "SS2") == 0)
2034 mask = ISO2022_SS2;
2035 else if (_stricmp(p, "SS3") == 0)
2036 mask = ISO2022_SS3;
2037
2038 if (mask) {
2039 if (add) {
2040 ts->ISO2022Flag |= mask;
2041 }
2042 else {
2043 ts->ISO2022Flag &= ~mask;
2044 }
2045 }
2046 }
2047
2048 // Terminal Speed (Used by telnet and ssh)
2049 GetPrivateProfileString(Section, "TerminalSpeed", "38400", Temp, sizeof(Temp), FName);
2050 GetNthNum(Temp, 1, &i);
2051 if (i > 0)
2052 ts->TerminalInputSpeed = i;
2053 else
2054 ts->TerminalInputSpeed = 38400;
2055 GetNthNum(Temp, 2, &i);
2056 if (i > 0)
2057 ts->TerminalOutputSpeed = i;
2058 else
2059 ts->TerminalOutputSpeed = ts->TerminalInputSpeed;
2060
2061 // Fallback to CP932 (Experimental)
2062 ts->FallbackToCP932 = GetOnOff(Section, "FallbackToCP932", FName, FALSE);
2063
2064 // CygTerm Configuration File
2065 ReadCygtermConfFile(ts);
2066 }
2067
2068 void PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
2069 {
2070 int i;
2071 char Temp[MAX_PATH];
2072 char buf[20];
2073 int ret;
2074 char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG];
2075
2076 /* version */
2077 ret = WritePrivateProfileString(Section, "Version", TT_VERSION_STR("."), FName);
2078 if (ret == 0) {
2079 // ini�t�@�C�����������������s�������A�G���[���b�Z�[�W���\�������B(2012.10.18 yutaka)
2080 ret = GetLastError();
2081 get_lang_msg("MSG_INI_WRITE_ERROR", uimsg, sizeof(uimsg), "Cannot write ini file", ts->UILanguageFile);
2082 _snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s (%d)", uimsg, ret);
2083
2084 get_lang_msg("MSG_INI_ERROR", uimsg2, sizeof(uimsg2), "Tera Term: Error", ts->UILanguageFile);
2085
2086 MessageBox(NULL, msg, uimsg2, MB_ICONEXCLAMATION);
2087 }
2088
2089 /* Language */
2090 switch (ts->Language) {
2091 case IdJapanese:
2092 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
2093 break;
2094 case IdKorean:
2095 strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
2096 break;
2097 case IdRussian:
2098 strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
2099 break;
2100 case IdUtf8:
2101 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
2102 break;
2103 default:
2104 strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
2105 }
2106
2107 WritePrivateProfileString(Section, "Language", Temp, FName);
2108
2109 /* Port type */
2110 WritePrivateProfileString(Section, "Port", (ts->PortType==IdSerial)?"serial":"tcpip", FName);
2111
2112 /* Save win position */
2113 if (ts->SaveVTWinPos) {
2114 /* VT win position */
2115 WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
2116 }
2117
2118 /* VT terminal size */
2119 WriteInt2(Section, "TerminalSize", FName,
2120 ts->TerminalWidth, ts->TerminalHeight);
2121
2122 /* Terminal size = Window size */
2123 WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
2124
2125 /* Auto window resize flag */
2126 WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
2127
2128 /* CR Receive */
2129 if (ts->CRReceive == IdCRLF) {
2130 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2131 }
2132 else if (ts->CRReceive == IdLF) {
2133 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
2134 }
2135 else if (ts->CRReceive == IdAUTO) {
2136 strncpy_s(Temp, sizeof(Temp), "AUTO", _TRUNCATE);
2137 }
2138 else {
2139 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2140 }
2141 WritePrivateProfileString(Section, "CRReceive", Temp, FName);
2142
2143 /* CR Send */
2144 if (ts->CRSend == IdCRLF) {
2145 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2146 }
2147 else if (ts->CRSend == IdLF) {
2148 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
2149 }
2150 else {
2151 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2152 }
2153 WritePrivateProfileString(Section, "CRSend", Temp, FName);
2154
2155 /* Local echo */
2156 WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
2157
2158 /* Answerback */
2159 if ((ts->FTFlag & FT_BPAUTO) == 0) {
2160 Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
2161 sizeof(Temp) - 1, TRUE);
2162 WritePrivateProfileString(Section, "Answerback", Temp, FName);
2163 }
2164
2165 /* Kanji Code (receive) */
2166 switch (ts->KanjiCode) {
2167 case IdEUC:
2168 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
2169 break;
2170 case IdJIS:
2171 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
2172 break;
2173 case IdUTF8:
2174 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
2175 break;
2176 case IdUTF8m:
2177 strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
2178 break;
2179 default:
2180 switch (ts->Language) {
2181 case IdJapanese:
2182 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2183 break;
2184 case IdKorean:
2185 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
2186 break;
2187 default:
2188 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2189 }
2190 }
2191 WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
2192
2193 /* Katakana (receive) */
2194 if (ts->JIS7Katakana == 1)
2195 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2196 else
2197 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2198
2199 WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
2200
2201 /* Kanji Code (transmit) */
2202 switch (ts->KanjiCodeSend) {
2203 case IdEUC:
2204 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
2205 break;
2206 case IdJIS:
2207 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
2208 break;
2209 case IdUTF8:
2210 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
2211 break;
2212 default:
2213 switch (ts->Language) {
2214 case IdJapanese:
2215 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2216 break;
2217 case IdKorean:
2218 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
2219 break;
2220 default:
2221 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2222 }
2223 }
2224 WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
2225
2226 /* Katakana (transmit) */
2227 if (ts->JIS7KatakanaSend == 1)
2228 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2229 else
2230 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2231
2232 WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
2233
2234 /* KanjiIn */
2235 if (ts->KanjiIn == IdKanjiInA)
2236 strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
2237 else
2238 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
2239
2240 WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
2241
2242 /* KanjiOut */
2243 switch (ts->KanjiOut) {
2244 case IdKanjiOutB:
2245 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
2246 break;
2247 case IdKanjiOutH:
2248 strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
2249 break;
2250 default:
2251 strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
2252 }
2253 WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
2254
2255 // new configuration
2256 WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
2257
2258 WriteOnOff(Section, "DisablePasteMouseRButton", FName,
2259 (WORD) (ts->PasteFlag & CPF_DISABLE_RBUTTON));
2260
2261 WriteOnOff(Section, "DisablePasteMouseMButton", FName,
2262 (WORD) (ts->PasteFlag & CPF_DISABLE_MBUTTON));
2263
2264 WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
2265 (WORD) (ts->PasteFlag & CPF_CONFIRM_RBUTTON));
2266
2267 // added ConfirmChangePaste
2268 WriteOnOff(Section, "ConfirmChangePaste", FName,
2269 (WORD) (ts->PasteFlag & CPF_CONFIRM_CHANGEPASTE));
2270
2271 WriteOnOff(Section, "ConfirmChangePasteCR", FName,
2272 (WORD) (ts->PasteFlag & CPF_CONFIRM_CHANGEPASTE_CR));
2273
2274 WritePrivateProfileString(Section, "ConfirmChangePasteStringFile",
2275 ts->ConfirmChangePasteStringFile, FName);
2276
2277 // added ScrollWindowClearScreen
2278 WriteOnOff(Section, "ScrollWindowClearScreen", FName,
2279 ts->ScrollWindowClearScreen);
2280
2281 // added SelectOnlyByLButton (2007.11.20 maya)
2282 WriteOnOff(Section, "SelectOnlyByLButton", FName,
2283 ts->SelectOnlyByLButton);
2284 // added DisableAcceleratorSendBreak (2007.3.17 maya)
2285 WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
2286 ts->DisableAcceleratorSendBreak);
2287 WriteOnOff(Section, "EnableContinuedLineCopy", FName,
2288 ts->EnableContinuedLineCopy);
2289 WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
2290 FName);
2291 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendInactive);
2292 WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
2293 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendActive);
2294 WritePrivateProfileString(Section, "AlphaBlendActive", Temp, FName);
2295 WritePrivateProfileString(Section, "CygwinDirectory",
2296 ts->CygwinDirectory, FName);
2297 WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
2298 FName);
2299 WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
2300
2301 // ANSI color(2004.9.5 yutaka)
2302 Temp[0] = '\0';
2303 for (i = 0; i < 15; i++) {
2304 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
2305 i,
2306 GetRValue(ts->ANSIColor[i]),
2307 GetGValue(ts->ANSIColor[i]),
2308 GetBValue(ts->ANSIColor[i])
2309 );
2310 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
2311 }
2312 i = 15;
2313 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
2314 i,
2315 GetRValue(ts->ANSIColor[i]),
2316 GetGValue(ts->ANSIColor[i]),
2317 GetBValue(ts->ANSIColor[i])
2318 );
2319 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
2320 WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
2321
2322 /* AutoWinChange VT<->TEK */
2323 WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
2324
2325 /* Terminal ID */
2326 id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
2327 WritePrivateProfileString(Section, "TerminalID", Temp, FName);
2328
2329 /* Russian character set (host) */
2330 id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
2331 WritePrivateProfileString(Section, "RussHost", Temp, FName);
2332
2333 /* Russian character set (client) */
2334 id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
2335 WritePrivateProfileString(Section, "RussClient", Temp, FName);
2336
2337 /* Title text */
2338 WritePrivateProfileString(Section, "Title", ts->Title, FName);
2339
2340 /* Cursor shape */
2341 switch (ts->CursorShape) {
2342 case IdVCur:
2343 strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
2344 break;
2345 case IdHCur:
2346 strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
2347 break;
2348 default:
2349 strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
2350 }
2351 WritePrivateProfileString(Section, "CursorShape", Temp, FName);
2352
2353 /* Hide title */
2354 WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
2355
2356 /* Popup menu */
2357 WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
2358
2359 /* PC-Style bold color mapping */
2360 WriteOnOff(Section, "PcBoldColor", FName,
2361 (WORD) (ts->ColorFlag & CF_PCBOLD16));
2362
2363 /* aixterm 16 colors mode */
2364 WriteOnOff(Section, "Aixterm16Color", FName,
2365 (WORD) (ts->ColorFlag & CF_AIXTERM16));
2366
2367 /* xterm 256 colors mode */
2368 WriteOnOff(Section, "Xterm256Color", FName,
2369 (WORD) (ts->ColorFlag & CF_XTERM256));
2370
2371 /* Enable scroll buffer */
2372 WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
2373
2374 /* Scroll buffer size */
2375 WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
2376
2377 /* VT Color */
2378 for (i = 0; i <= 1; i++) {
2379 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2380 if (ts->ColorFlag & CF_REVERSECOLOR) {
2381 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
2382 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
2383 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
2384 }
2385 else {
2386 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
2387 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
2388 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
2389 }
2390 }
2391 else {
2392 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
2393 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
2394 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
2395 }
2396 }
2397 WriteInt6(Section, "VTColor", FName,
2398 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2399 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2400
2401 /* VT Bold Color */
2402 for (i = 0; i <= 1; i++) {
2403 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2404 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
2405 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
2406 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
2407 }
2408 else {
2409 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
2410 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
2411 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
2412 }
2413 }
2414 WriteInt6(Section, "VTBoldColor", FName,
2415 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2416 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2417
2418 /* VT Blink Color */
2419 for (i = 0; i <= 1; i++) {
2420 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2421 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
2422 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
2423 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
2424 }
2425 else {
2426 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
2427 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
2428 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
2429 }
2430 }
2431 WriteInt6(Section, "VTBlinkColor", FName,
2432 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2433 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2434
2435 /* VT Reverse Color */
2436 for (i = 0; i <= 1; i++) {
2437 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
2438 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
2439 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
2440 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
2441 }
2442 else {
2443 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
2444 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
2445 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
2446 }
2447 }
2448 WriteInt6(Section, "VTReverseColor", FName,
2449 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2450 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2451
2452 WriteOnOff(Section, "EnableClickableUrl", FName,
2453 ts->EnableClickableUrl);
2454
2455 /* URL color */
2456 for (i = 0; i <= 1; i++) {
2457 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2458 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
2459 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
2460 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
2461 }
2462 else {
2463 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
2464 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
2465 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
2466 }
2467 }
2468 WriteInt6(Section, "URLColor", FName,
2469 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2470 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2471
2472 WriteOnOff(Section, "EnableBoldAttrColor", FName,
2473 (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
2474
2475 WriteOnOff(Section, "EnableBlinkAttrColor", FName,
2476 (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
2477
2478 WriteOnOff(Section, "EnableReverseAttrColor", FName,
2479 (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
2480
2481 WriteOnOff(Section, "EnableURLColor", FName,
2482 (WORD) (ts->ColorFlag & CF_URLCOLOR));
2483
2484 WriteOnOff(Section, "URLUnderline", FName,
2485 (WORD) (ts->FontFlag & FF_URLUNDERLINE));
2486
2487 WriteOnOff(Section, "EnableANSIColor", FName,
2488 (WORD) (ts->ColorFlag & CF_ANSICOLOR));
2489
2490 /* TEK Color */
2491 for (i = 0; i <= 1; i++) {
2492 ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
2493 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
2494 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
2495 }
2496 WriteInt6(Section, "TEKColor", FName,
2497 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2498 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2499
2500 /* TEK color emulation */
2501 WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
2502
2503 /* VT Font */
2504 WriteFont(Section, "VTFont", FName,
2505 ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
2506 ts->VTFontCharSet);
2507
2508 /* Enable bold font flag */
2509 WriteOnOff(Section, "EnableBold", FName,
2510 (WORD) (ts->FontFlag & FF_BOLD));
2511
2512 /* Russian character set (font) */
2513 id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
2514 WritePrivateProfileString(Section, "RussFont", Temp, FName);
2515
2516 /* TEK Font */
2517 WriteFont(Section, "TEKFont", FName,
2518 ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
2519 ts->TEKFontCharSet);
2520
2521 /* BS key */
2522 if (ts->BSKey == IdDEL)
2523 strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
2524 else
2525 strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
2526 WritePrivateProfileString(Section, "BSKey", Temp, FName);
2527
2528 /* Delete key */
2529 WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
2530
2531 /* Meta key */
2532 switch (ts->MetaKey) {
2533 case 1:
2534 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
2535 break;
2536 case 2:
2537 strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE);
2538 break;
2539 case 3:
2540 strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE);
2541 break;
2542 default:
2543 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2544 }
2545 WritePrivateProfileString(Section, "Metakey", Temp, FName);
2546
2547 /* Application Keypad */
2548 WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
2549
2550 /* Application Cursor */
2551 WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
2552
2553 /* Russian keyboard type */
2554 id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
2555 WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
2556
2557 /* Serial port ID */
2558 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
2559 WritePrivateProfileString(Section, "ComPort", Temp, FName);
2560
2561 /* Baud rate */
2562 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud);
2563 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
2564
2565 /* Parity */
2566 switch (ts->Parity) {
2567 case IdParityEven:
2568 strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
2569 break;
2570 case IdParityOdd:
2571 strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
2572 break;
2573 case IdParityMark:
2574 strncpy_s(Temp, sizeof(Temp), "mark", _TRUNCATE);
2575 break;
2576 case IdParitySpace:
2577 strncpy_s(Temp, sizeof(Temp), "space", _TRUNCATE);
2578 break;
2579 default:
2580 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2581 }
2582 WritePrivateProfileString(Section, "Parity", Temp, FName);
2583
2584 /* Data bit */
2585 if (ts->DataBit == IdDataBit7)
2586 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2587 else
2588 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2589
2590 WritePrivateProfileString(Section, "DataBit", Temp, FName);
2591
2592 /* Stop bit */
2593 switch (ts->StopBit) {
2594 case IdStopBit2:
2595 strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
2596 break;
2597 case IdStopBit15:
2598 strncpy_s(Temp, sizeof(Temp), "1.5", _TRUNCATE);
2599 break;
2600 default:
2601 strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
2602 break;
2603 }
2604
2605 WritePrivateProfileString(Section, "StopBit", Temp, FName);
2606
2607 /* Flow control */
2608 switch (ts->Flow) {
2609 case IdFlowX:
2610 strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
2611 break;
2612 case IdFlowHard:
2613 strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
2614 break;
2615 default:
2616 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2617 }
2618 WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
2619
2620 /* Delay per character */
2621 WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
2622
2623 /* Delay per line */
2624 WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
2625
2626 /* Telnet flag */
2627 WriteOnOff(Section, "Telnet", FName, ts->Telnet);
2628
2629 /* Telnet terminal type */
2630 WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
2631
2632 /* TCP port num for non-telnet */
2633 WriteUint(Section, "TCPPort", FName, ts->TCPPort);
2634
2635 /* Auto close flag */
2636 WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
2637
2638 /* History list */
2639 WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
2640
2641 /* File transfer binary flag */
2642 WriteOnOff(Section, "TransBin", FName, ts->TransBin);
2643
2644 /* Log binary flag */
2645 WriteOnOff(Section, "LogBinary", FName, ts->LogBinary);
2646
2647 /* Log append */
2648 WriteOnOff(Section, "LogAppend", FName, ts->Append);
2649
2650 /* Log plain text flag */
2651 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
2652
2653 /* Log with timestamp (2006.7.23 maya) */
2654 WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
2655
2656 /* Log without transfer dialog */
2657 WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
2658
2659 WriteOnOff(Section, "LogIncludeScreenBuffer", FName, ts->LogAllBuffIncludedInFirst);
2660
2661 /* Timestamp format of Log each line */
2662 WritePrivateProfileString(Section, "LogTimestampFormat",
2663 ts->LogTimestampFormat, FName);
2664
2665 /* Timestamp type */
2666 switch (ts->LogTimestampType) {
2667 case TIMESTAMP_LOCAL:
2668 WritePrivateProfileString(Section, "LogTimestampType", "Local", FName);
2669 break;
2670 case TIMESTAMP_UTC:
2671 WritePrivateProfileString(Section, "LogTimestampType", "UTC", FName);
2672 break;
2673 case TIMESTAMP_ELAPSED_LOGSTART:
2674 WritePrivateProfileString(Section, "LogTimestampType", "LoggingElapsed", FName);
2675 break;
2676 case TIMESTAMP_ELAPSED_CONNECTED:
2677 WritePrivateProfileString(Section, "LogTimestampType", "ConnectionElapsed", FName);
2678 break;
2679 }
2680
2681 /* Default Log file name (2006.8.28 maya) */
2682 WritePrivateProfileString(Section, "LogDefaultName",
2683 ts->LogDefaultName, FName);
2684
2685 /* Default Log file path (2007.5.30 maya) */
2686 WritePrivateProfileString(Section, "LogDefaultPath",
2687 ts->LogDefaultPath, FName);
2688
2689 /* Auto start logging (2007.5.31 maya) */
2690 WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
2691
2692 /* Log Rotate (2013.3.24 yutaka) */
2693 WriteInt(Section, "LogRotate", FName, ts->LogRotate);
2694 WriteInt(Section, "LogRotateSize", FName, ts->LogRotateSize);
2695 WriteInt(Section, "LogRotateSizeType", FName, ts->LogRotateSizeType);
2696 WriteInt(Section, "LogRotateStep", FName, ts->LogRotateStep);
2697
2698 /* Deferred Log Write Mode (2013.4.20 yutaka) */
2699 WriteOnOff(Section, "DeferredLogWriteMode", FName, ts->DeferredLogWriteMode);
2700
2701 /* XMODEM option */
2702 switch (ts->XmodemOpt) {
2703 case XoptCRC:
2704 strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
2705 break;
2706 case Xopt1kCRC:
2707 strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
2708 break;
2709 case Xopt1kCksum:
2710 strncpy_s(Temp, sizeof(Temp), "1ksum", _TRUNCATE);
2711 break;
2712 default:
2713 strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
2714 }
2715 WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
2716
2717 /* XMODEM binary flag */
2718 WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
2719
2720 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
2721 WritePrivateProfileString(Section, "XmodemRcvCommand",
2722 ts->XModemRcvCommand, FName);
2723
2724 /* Default directory for file transfer */
2725 WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
2726
2727 /* filter on file send (2007.6.5 maya) */
2728 WritePrivateProfileString(Section, "FileSendFilter",
2729 ts->FileSendFilter, FName);
2730
2731 WritePrivateProfileString(Section, "ScpSendDir", ts->ScpSendDir, FName);
2732
2733 /*------------------------------------------------------------------*/
2734 /* 8 bit control code flag -- special option */
2735 WriteOnOff(Section, "Accept8BitCtrl", FName,
2736 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
2737
2738 /* Wrong sequence flag -- special option */
2739 WriteOnOff(Section,