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