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 6899 - (show annotations) (download) (as text)
Thu Aug 17 14:21:35 2017 UTC (6 years, 7 months ago) by doda
File MIME type: text/x-csrc
File size: 134987 byte(s)
設定の保存時、Version に現在のバージョンを書くように変更した。

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