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