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