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 6767 - (show annotations) (download) (as text)
Sun Jun 4 12:54:47 2017 UTC (6 years, 10 months ago) by maya
File MIME type: text/x-csrc
File size: 132814 byte(s)
ログのタイムスタンプのフォーマットを指定できるようにした

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