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