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