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 7706 - (show annotations) (download) (as text)
Tue May 21 15:20:52 2019 UTC (4 years, 10 months ago) by zmatsuo
File MIME type: text/x-csrc
File size: 141060 byte(s)
ダイアログフォントの設定をメモリに持つようにした

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