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