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