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 6328 - (show annotations) (download) (as text)
Mon Feb 29 04:30:12 2016 UTC (8 years, 1 month ago) by doda
File MIME type: text/x-csrc
File size: 131349 byte(s)
XMODEM Send ダイアログでのオプション選択と XMODEM Receive ダイアログでのオプション選択が干渉しないようにした。

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