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