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 6119 - (show annotations) (download) (as text)
Thu Nov 12 15:04:55 2015 UTC (8 years, 5 months ago) by yutakapon
File MIME type: text/x-csrc
File size: 128108 byte(s)
チケット #35710 Cygwin設定の見直し

項番1に対応させた。

1. 設定ダイアログでOK押下しただけで、cygterm.cfgを書き換えないようにし、
 Save setupで保存するように、本来あるべき姿に変更する。

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