Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3425 - (hide annotations) (download) (as text)
Wed May 27 15:03:11 2009 UTC (14 years, 10 months ago) by doda
File MIME type: text/x-csrc
File size: 98293 byte(s)
オプションの解釈を厳密にした。
例えば、/HOGE が /H として認識されるのは望ましくないと思われる。

1 maya 3227 /* 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 "ttlib.h"
17     #include "tt_res.h"
18    
19     #include "compat_w95.h"
20    
21     #define Section "Tera Term"
22    
23     static PCHAR far TermList[] =
24     { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
25     "VT320", "VT382", NULL };
26    
27     static PCHAR far RussList[] =
28     { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
29     static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
30    
31     WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
32     {
33     WORD i;
34     i = 0;
35     while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
36     i++;
37     if (List[i] == NULL)
38     i = DefId;
39     else
40     i++;
41    
42     return i;
43     }
44    
45     void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
46     {
47     int i;
48    
49     if (Id == 0)
50     i = DefId - 1;
51     else {
52     i = 0;
53     while ((List[i] != NULL) && (i < Id - 1))
54     i++;
55     if (List[i] == NULL)
56     i = DefId - 1;
57     }
58     strncpy_s(str, destlen, List[i], _TRUNCATE);
59     }
60    
61     int IconName2IconId(const char *name) {
62     int id;
63    
64     if (_stricmp(name, "tterm") == 0) {
65     id = IDI_TTERM;
66     }
67     else if (_stricmp(name, "vt") == 0) {
68     id = IDI_VT;
69     }
70     else if (_stricmp(name, "tek") == 0) {
71     id = IDI_TEK;
72     }
73     else if (_stricmp(name, "tterm_classic") == 0) {
74     id = IDI_TTERM_CLASSIC;
75     }
76     else if (_stricmp(name, "vt_classic") == 0) {
77     id = IDI_VT_CLASSIC;
78     }
79     else if (_stricmp(name, "cygterm") == 0) {
80     id = IDI_CYGTERM;
81     }
82     else {
83     id = IdIconDefault;
84     }
85     return id;
86     }
87    
88     void IconId2IconName(char *name, int len, int id) {
89     char *icon;
90     switch (id) {
91     case IDI_TTERM:
92     icon = "tterm";
93     break;
94     case IDI_VT:
95     icon = "vt";
96     break;
97     case IDI_TEK:
98     icon = "tek";
99     break;
100     case IDI_TTERM_CLASSIC:
101     icon = "tterm_classic";
102     break;
103     case IDI_VT_CLASSIC:
104     icon = "vt_classic";
105     break;
106     case IDI_CYGTERM:
107     icon = "cygterm";
108     break;
109     default:
110     icon = "Default";
111     }
112     strncpy_s(name, len, icon, _TRUNCATE);
113     }
114    
115     WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default)
116     {
117     char Temp[4];
118     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
119     if (Default) {
120     if (_stricmp(Temp, "off") == 0)
121     return 0;
122     else
123     return 1;
124     }
125     else {
126     if (_stricmp(Temp, "on") == 0)
127     return 1;
128     else
129     return 0;
130     }
131     }
132    
133     void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag)
134     {
135     char Temp[4];
136    
137     if (Flag != 0)
138     strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
139     else
140     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
141     WritePrivateProfileString(Sect, Key, Temp, FName);
142     }
143    
144     void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i)
145     {
146     char Temp[15];
147     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
148     WritePrivateProfileString(Sect, Key, Temp, FName);
149     }
150    
151     void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i)
152     {
153     char Temp[15];
154     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
155     WritePrivateProfileString(Sect, Key, Temp, FName);
156     }
157    
158     void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2)
159     {
160     char Temp[32];
161     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
162     WritePrivateProfileString(Sect, Key, Temp, FName);
163     }
164    
165     void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName,
166     int i1, int i2, int i3, int i4)
167     {
168     char Temp[64];
169     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
170     i1, i2, i3, i4);
171     WritePrivateProfileString(Sect, Key, Temp, FName);
172     }
173    
174     void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName,
175     int i1, int i2, int i3, int i4, int i5, int i6)
176     {
177     char Temp[96];
178     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
179     i1, i2,i3, i4, i5, i6);
180     WritePrivateProfileString(Sect, Key, Temp, FName);
181     }
182    
183     void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName,
184     PCHAR Name, int x, int y, int charset)
185     {
186     char Temp[80];
187     if (Name[0] != 0)
188     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
189     Name, x, y, charset);
190     else
191     Temp[0] = 0;
192     WritePrivateProfileString(Sect, Key, Temp, FName);
193     }
194    
195     void FAR PASCAL ReadIniFile(PCHAR FName, PTTSet ts)
196     {
197     int i;
198     HDC TmpDC;
199     char Temp[MAXPATHLEN];
200    
201     ts->Minimize = 0;
202     ts->HideWindow = 0;
203     ts->LogFlag = 0; // Log flags
204     ts->FTFlag = 0; // File transfer flags
205     ts->MenuFlag = 0; // Menu flags
206     ts->TermFlag = 0; // Terminal flag
207     ts->ColorFlag = 0; // ANSI/Attribute color flags
208     ts->PortFlag = 0; // Port flags
209     ts->TelPort = 23;
210    
211 doda 3388 ts->DisableTCPEchoCR = FALSE;
212    
213 maya 3227 /* Version number */
214     /* GetPrivateProfileString(Section,"Version","",
215     Temp,sizeof(Temp),FName); */
216    
217     /* Language */
218     GetPrivateProfileString(Section, "Language", "",
219     Temp, sizeof(Temp), FName);
220     if (_stricmp(Temp, "Japanese") == 0)
221     ts->Language = IdJapanese;
222     else if (_stricmp(Temp, "Russian") == 0)
223     ts->Language = IdRussian;
224     else if (_stricmp(Temp, "English") == 0)
225     ts->Language = IdEnglish;
226     else if (_stricmp(Temp,"Korean") == 0) // HKS
227     ts->Language = IdKorean;
228 maya 3401 else if (_stricmp(Temp,"UTF-8") == 0)
229     ts->Language = IdUtf8;
230 maya 3227 else {
231     switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
232     case LANG_JAPANESE:
233     ts->Language = IdJapanese;
234     break;
235     case LANG_RUSSIAN:
236     ts->Language = IdRussian;
237     break;
238 doda 3354 case LANG_KOREAN: // HKS
239 maya 3227 ts->Language = IdKorean;
240     break;
241     default:
242     ts->Language = IdEnglish;
243     }
244     }
245    
246     /* Port type */
247     GetPrivateProfileString(Section, "Port", "",
248     Temp, sizeof(Temp), FName);
249     if (_stricmp(Temp, "tcpip") == 0)
250     ts->PortType = IdTCPIP;
251     else if (_stricmp(Temp, "serial") == 0)
252     ts->PortType = IdSerial;
253     else {
254     ts->PortType = IdTCPIP;
255     }
256    
257     /* VT win position */
258     GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
259     GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
260     GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
261    
262     /* TEK win position */
263     GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
264     GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
265     GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
266    
267     /* Save VT Window position */
268     ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
269    
270     /* VT terminal size */
271     GetPrivateProfileString(Section, "TerminalSize", "80,24",
272     Temp, sizeof(Temp), FName);
273     GetNthNum(Temp, 1, &ts->TerminalWidth);
274     GetNthNum(Temp, 2, &ts->TerminalHeight);
275     if (ts->TerminalWidth < 0)
276     ts->TerminalWidth = 1;
277     if (ts->TerminalHeight < 0)
278     ts->TerminalHeight = 1;
279    
280     /* Terminal size = Window size */
281     ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
282    
283     /* Auto window resize flag */
284     ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
285    
286     /* CR Receive */
287     GetPrivateProfileString(Section, "CRReceive", "",
288     Temp, sizeof(Temp), FName);
289     if (_stricmp(Temp, "CRLF") == 0) {
290     ts->CRReceive = IdCRLF;
291     }
292     else if (_stricmp(Temp, "LF") == 0) {
293     ts->CRReceive = IdLF;
294     }
295     else {
296     ts->CRReceive = IdCR;
297     }
298     /* CR Send */
299     GetPrivateProfileString(Section, "CRSend", "",
300     Temp, sizeof(Temp), FName);
301     if (_stricmp(Temp, "CRLF") == 0)
302     ts->CRSend = IdCRLF;
303     else
304     ts->CRSend = IdCR;
305     ts->CRSend_ini = ts->CRSend;
306    
307     /* Local echo */
308     ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
309     ts->LocalEcho_ini = ts->LocalEcho;
310    
311     /* Answerback */
312     GetPrivateProfileString(Section, "Answerback", "", Temp,
313     sizeof(Temp), FName);
314     ts->AnswerbackLen =
315     Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
316    
317     /* Kanji Code (receive) */
318     GetPrivateProfileString(Section, "KanjiReceive", "",
319     Temp, sizeof(Temp), FName);
320     if (_stricmp(Temp, "EUC") == 0)
321     ts->KanjiCode = IdEUC;
322     else if (_stricmp(Temp, "JIS") == 0)
323     ts->KanjiCode = IdJIS;
324     else if (_stricmp(Temp, "UTF-8") == 0)
325     ts->KanjiCode = IdUTF8;
326     else if (_stricmp(Temp, "UTF-8m") == 0)
327     ts->KanjiCode = IdUTF8m;
328 doda 3420 else if (_stricmp(Temp, "KS5601") == 0)
329     ts->KanjiCode = IdSJIS;
330 maya 3227 else
331     ts->KanjiCode = IdSJIS;
332 maya 3401 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
333     {
334     WORD KanjiCode = ts->KanjiCode;
335     ts->KanjiCode = KanjiCodeTranslate(ts->Language,KanjiCode);
336     }
337 maya 3227
338     /* Katakana (receive) */
339     GetPrivateProfileString(Section, "KatakanaReceive", "",
340     Temp, sizeof(Temp), FName);
341     if (_stricmp(Temp, "7") == 0)
342     ts->JIS7Katakana = 1;
343     else
344     ts->JIS7Katakana = 0;
345    
346     /* Kanji Code (transmit) */
347     GetPrivateProfileString(Section, "KanjiSend", "",
348     Temp, sizeof(Temp), FName);
349     if (_stricmp(Temp, "EUC") == 0)
350     ts->KanjiCodeSend = IdEUC;
351     else if (_stricmp(Temp, "JIS") == 0)
352     ts->KanjiCodeSend = IdJIS;
353     else if (_stricmp(Temp, "UTF-8") == 0)
354     ts->KanjiCodeSend = IdUTF8;
355 doda 3420 else if (_stricmp(Temp, "KS5601") == 0)
356     ts->KanjiCode = IdSJIS;
357 maya 3227 else
358     ts->KanjiCodeSend = IdSJIS;
359 maya 3401 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
360     {
361     WORD KanjiCodeSend = ts->KanjiCodeSend;
362     ts->KanjiCodeSend = KanjiCodeTranslate(ts->Language,KanjiCodeSend);
363     }
364 maya 3227
365     /* Katakana (receive) */
366     GetPrivateProfileString(Section, "KatakanaSend", "",
367     Temp, sizeof(Temp), FName);
368     if (_stricmp(Temp, "7") == 0)
369     ts->JIS7KatakanaSend = 1;
370     else
371     ts->JIS7KatakanaSend = 0;
372    
373     /* KanjiIn */
374     GetPrivateProfileString(Section, "KanjiIn", "",
375     Temp, sizeof(Temp), FName);
376     if (_stricmp(Temp, "@") == 0)
377     ts->KanjiIn = IdKanjiInA;
378     else
379     ts->KanjiIn = IdKanjiInB;
380    
381     /* KanjiOut */
382     GetPrivateProfileString(Section, "KanjiOut", "",
383     Temp, sizeof(Temp), FName);
384     if (_stricmp(Temp, "B") == 0)
385     ts->KanjiOut = IdKanjiOutB;
386     else if (_stricmp(Temp, "H") == 0)
387     ts->KanjiOut = IdKanjiOutH;
388     else
389     ts->KanjiOut = IdKanjiOutJ;
390    
391     /* Auto Win Switch VT<->TEK */
392     ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
393    
394     /* Terminal ID */
395     GetPrivateProfileString(Section, "TerminalID", "",
396     Temp, sizeof(Temp), FName);
397     ts->TerminalID = str2id(TermList, Temp, IdVT100);
398    
399     /* Russian character set (host) */
400     GetPrivateProfileString(Section, "RussHost", "",
401     Temp, sizeof(Temp), FName);
402     ts->RussHost = str2id(RussList, Temp, IdKOI8);
403    
404     /* Russian character set (client) */
405     GetPrivateProfileString(Section, "RussClient", "",
406     Temp, sizeof(Temp), FName);
407     ts->RussClient = str2id(RussList, Temp, IdWindows);
408    
409     /* Title String */
410     GetPrivateProfileString(Section, "Title", "Tera Term",
411     ts->Title, sizeof(ts->Title), FName);
412    
413     /* Cursor shape */
414     GetPrivateProfileString(Section, "CursorShape", "",
415     Temp, sizeof(Temp), FName);
416     if (_stricmp(Temp, "vertical") == 0)
417     ts->CursorShape = IdVCur;
418     else if (_stricmp(Temp, "horizontal") == 0)
419     ts->CursorShape = IdHCur;
420     else
421     ts->CursorShape = IdBlkCur;
422    
423     /* Hide title */
424     ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
425    
426     /* Popup menu */
427     ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
428    
429     /* PC-Style bold color mapping */
430     if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
431     ts->ColorFlag |= CF_PCBOLD16;
432    
433     /* aixterm style 16 colors mode */
434     if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
435     ts->ColorFlag |= CF_AIXTERM16;
436    
437     /* xterm style 256 colors mode */
438     if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
439     ts->ColorFlag |= CF_XTERM256;
440    
441     /* Enable scroll buffer */
442     ts->EnableScrollBuff =
443     GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
444    
445     /* Scroll buffer size */
446     ts->ScrollBuffSize =
447     GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
448    
449     /* VT Color */
450     GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
451     Temp, sizeof(Temp), FName);
452     for (i = 0; i <= 5; i++)
453     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
454     for (i = 0; i <= 1; i++)
455     ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
456     (BYTE) ts->TmpColor[0][i * 3 + 1],
457     (BYTE) ts->TmpColor[0][i * 3 + 2]);
458    
459     /* VT Bold Color */
460     GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
461     Temp, sizeof(Temp), FName);
462     for (i = 0; i <= 5; i++)
463     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
464     for (i = 0; i <= 1; i++)
465     ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
466     (BYTE) ts->TmpColor[0][i * 3 + 1],
467     (BYTE) ts->TmpColor[0][i * 3 + 2]);
468     if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
469     ts->ColorFlag |= CF_BOLDCOLOR;
470    
471     /* VT Blink Color */
472     GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
473     Temp, sizeof(Temp), FName);
474     for (i = 0; i <= 5; i++)
475     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
476     for (i = 0; i <= 1; i++)
477     ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
478     (BYTE) ts->TmpColor[0][i * 3 + 1],
479     (BYTE) ts->TmpColor[0][i * 3 + 2]);
480     if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
481     ts->ColorFlag |= CF_BLINKCOLOR;
482    
483     /* VT Reverse Color */
484     GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
485     Temp, sizeof(Temp), FName);
486     for (i = 0; i <= 5; i++)
487     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
488     for (i = 0; i <= 1; i++)
489     ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
490     (BYTE) ts->TmpColor[0][i * 3 + 1],
491     (BYTE) ts->TmpColor[0][i * 3 + 2]);
492     if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
493     ts->ColorFlag |= CF_REVERSECOLOR;
494    
495     ts->EnableClickableUrl =
496     GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
497    
498     /* URL Color */
499     GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
500     Temp, sizeof(Temp), FName);
501     for (i = 0; i <= 5; i++)
502     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
503     for (i = 0; i <= 1; i++)
504     ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
505     (BYTE) ts->TmpColor[0][i * 3 + 1],
506     (BYTE) ts->TmpColor[0][i * 3 + 2]);
507     if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
508     ts->ColorFlag |= CF_URLCOLOR;
509    
510     /* TEK Color */
511     GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
512     Temp, sizeof(Temp), FName);
513     for (i = 0; i <= 5; i++)
514     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
515     for (i = 0; i <= 1; i++)
516     ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
517     (BYTE) ts->TmpColor[0][i * 3 + 1],
518     (BYTE) ts->TmpColor[0][i * 3 + 2]);
519    
520     #ifndef NO_ANSI_COLOR_EXTENSION
521     /* ANSI color definition (in the case FullColor=on) -- special option
522     o UseTextColor should be off, or the background and foreground color of
523     VTColor are assigned to color-number 0 and 7 respectively, even if
524     they are specified in ANSIColor.
525     o ANSIColor is a set of 4 values that are color-number(0--15),
526     red-value(0--255), green-value(0--255) and blue-value(0--255). */
527     GetPrivateProfileString(Section, "ANSIColor",
528     " 0, 0, 0, 0,"
529     " 1,255, 0, 0,"
530     " 2, 0,255, 0,"
531     " 3,255,255, 0,"
532     " 4, 0, 0,255,"
533     " 5,255, 0,255,"
534     " 6, 0,255,255,"
535     " 7,255,255,255,"
536     " 8,128,128,128,"
537     " 9,128, 0, 0,"
538     "10, 0,128, 0,"
539     "11,128,128, 0,"
540     "12, 0, 0,128,"
541     "13,128, 0,128,"
542     "14, 0,128,128,"
543     "15,192,192,192", Temp, sizeof(Temp), FName);
544     {
545     char *t;
546     int n = 1;
547     for (t = Temp; *t; t++)
548     if (*t == ',')
549     n++;
550     n /= 4;
551     for (i = 0; i <= n; i++) {
552     int colorid, r, g, b;
553     GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
554     GetNthNum(Temp, i * 4 + 2, (int far *) &r);
555     GetNthNum(Temp, i * 4 + 3, (int far *) &g);
556     GetNthNum(Temp, i * 4 + 4, (int far *) &b);
557     ts->ANSIColor[colorid & 15] =
558     RGB((BYTE) r, (BYTE) g, (BYTE) b);
559     }
560     }
561     #endif /* NO_ANSI_COLOR_EXTENSION */
562    
563     TmpDC = GetDC(0); /* Get screen device context */
564     for (i = 0; i <= 1; i++)
565     ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
566     for (i = 0; i <= 1; i++)
567     ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
568     for (i = 0; i <= 1; i++)
569     ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
570     for (i = 0; i <= 1; i++)
571     ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
572     /* begin - ishizaki */
573     for (i = 0; i <= 1; i++)
574     ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
575     /* end - ishizaki */
576     #ifndef NO_ANSI_COLOR_EXTENSION
577     for (i = 0; i < 16; i++)
578     ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
579     #endif /* NO_ANSI_COLOR_EXTENSION */
580     ReleaseDC(0, TmpDC);
581     if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
582     ts->ColorFlag |= CF_ANSICOLOR;
583    
584     /* TEK color emulation */
585     ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
586    
587     /* VT Font */
588     GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
589     Temp, sizeof(Temp), FName);
590     GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
591     GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
592     GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
593     GetNthNum(Temp, 4, &(ts->VTFontCharSet));
594    
595     /* Bold font flag */
596     ts->EnableBold = GetOnOff(Section, "EnableBold", FName, TRUE);
597    
598     /* Russian character set (font) */
599     GetPrivateProfileString(Section, "RussFont", "",
600     Temp, sizeof(Temp), FName);
601     ts->RussFont = str2id(RussList, Temp, IdWindows);
602    
603     /* TEK Font */
604     GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
605     Temp, sizeof(Temp), FName);
606     GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
607     GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
608     GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
609     GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
610    
611     /* BS key */
612     GetPrivateProfileString(Section, "BSKey", "",
613     Temp, sizeof(Temp), FName);
614     if (_stricmp(Temp, "DEL") == 0)
615     ts->BSKey = IdDEL;
616     else
617     ts->BSKey = IdBS;
618     /* Delete key */
619     ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
620    
621     /* Meta Key */
622     ts->MetaKey = GetOnOff(Section, "MetaKey", FName, FALSE);
623    
624     /* Application Keypad */
625     ts->DisableAppKeypad =
626     GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
627    
628     /* Application Cursor */
629     ts->DisableAppCursor =
630     GetOnOff(Section, "DisableAppCursor", FName, FALSE);
631    
632     /* Russian keyboard type */
633     GetPrivateProfileString(Section, "RussKeyb", "",
634     Temp, sizeof(Temp), FName);
635     ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
636    
637     /* Serial port ID */
638     ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
639    
640     /* Baud rate */
641     GetPrivateProfileString(Section, "BaudRate", "9600",
642     Temp, sizeof(Temp), FName);
643     ts->Baud = str2id(BaudList, Temp, IdBaud9600);
644    
645     /* Parity */
646     GetPrivateProfileString(Section, "Parity", "",
647     Temp, sizeof(Temp), FName);
648     if (_stricmp(Temp, "even") == 0)
649     ts->Parity = IdParityEven;
650     else if (_stricmp(Temp, "odd") == 0)
651     ts->Parity = IdParityOdd;
652     else
653     ts->Parity = IdParityNone;
654    
655     /* Data bit */
656     GetPrivateProfileString(Section, "DataBit", "",
657     Temp, sizeof(Temp), FName);
658     if (_stricmp(Temp, "7") == 0)
659     ts->DataBit = IdDataBit7;
660     else
661     ts->DataBit = IdDataBit8;
662    
663     /* Stop bit */
664     GetPrivateProfileString(Section, "StopBit", "",
665     Temp, sizeof(Temp), FName);
666     if (_stricmp(Temp, "2") == 0)
667     ts->StopBit = IdStopBit2;
668     else
669     ts->StopBit = IdStopBit1;
670    
671     /* Flow control */
672     GetPrivateProfileString(Section, "FlowCtrl", "",
673     Temp, sizeof(Temp), FName);
674     if (_stricmp(Temp, "x") == 0)
675     ts->Flow = IdFlowX;
676     else if (_stricmp(Temp, "hard") == 0)
677     ts->Flow = IdFlowHard;
678     else
679     ts->Flow = IdFlowNone;
680    
681     /* Delay per character */
682     ts->DelayPerChar =
683     GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
684    
685     /* Delay per line */
686     ts->DelayPerLine =
687     GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
688    
689     /* Telnet flag */
690     ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
691    
692     /* Telnet terminal type */
693     GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
694     sizeof(ts->TermType), FName);
695    
696     /* TCP port num */
697     ts->TCPPort =
698     GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
699    
700     /* Auto window close flag */
701     ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
702    
703     /* History list */
704     ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
705    
706     /* File transfer binary flag */
707     ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
708    
709     /* Log append */
710     ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
711    
712     /* Log plain text (2005.5.7 yutaka) */
713     ts->LogTypePlainText =
714     GetOnOff(Section, "LogTypePlainText", FName, FALSE);
715    
716     /* Log with timestamp (2006.7.23 maya) */
717     ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
718    
719     /* Log without transfer dialog */
720     ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
721    
722     /* Default Log file name (2006.8.28 maya) */
723     GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
724     ts->LogDefaultName, sizeof(ts->LogDefaultName),
725     FName);
726    
727     /* Default Log file path (2007.5.30 maya) */
728     GetPrivateProfileString(Section, "LogDefaultPath", "",
729     ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
730     FName);
731    
732     /* Auto start logging (2007.5.31 maya) */
733     ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
734    
735     /* XMODEM option */
736     GetPrivateProfileString(Section, "XmodemOpt", "",
737     Temp, sizeof(Temp), FName);
738     if (_stricmp(Temp, "crc") == 0)
739     ts->XmodemOpt = XoptCRC;
740     else if (_stricmp(Temp, "1k") == 0)
741     ts->XmodemOpt = Xopt1K;
742     else
743     ts->XmodemOpt = XoptCheck;
744    
745     /* XMODEM binary file */
746     ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
747    
748     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
749     GetPrivateProfileString(Section, "XModemRcvCommand", "",
750     ts->XModemRcvCommand,
751     sizeof(ts->XModemRcvCommand), FName);
752    
753     /* Default directory for file transfer */
754     GetPrivateProfileString(Section, "FileDir", "",
755     ts->FileDir, sizeof(ts->FileDir), FName);
756     if (strlen(ts->FileDir) == 0)
757     strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
758     else {
759     _getcwd(Temp, sizeof(Temp));
760     if (_chdir(ts->FileDir) != 0)
761     strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
762     _chdir(Temp);
763     }
764    
765     /* filter on file send (2007.6.5 maya) */
766     GetPrivateProfileString(Section, "FileSendFilter", "",
767     ts->FileSendFilter, sizeof(ts->FileSendFilter),
768     FName);
769    
770     /*--------------------------------------------------*/
771     /* 8 bit control code flag -- special option */
772     if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
773     ts->TermFlag |= TF_ACCEPT8BITCTRL;
774    
775     /* Wrong sequence flag -- special option */
776     if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
777     ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
778    
779     if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
780     (ts->KanjiOut == IdKanjiOutH))
781     ts->KanjiOut = IdKanjiOutJ;
782    
783     // Auto file renaming --- special option
784     if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
785     ts->FTFlag |= FT_RENAME;
786    
787     // Auto invoking (character set->G0->GL) --- special option
788     if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
789     ts->TermFlag |= TF_AUTOINVOKE;
790    
791     // Auto text copy --- special option
792     ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
793    
794     /* Back wrap -- special option */
795     if (GetOnOff(Section, "BackWrap", FName, FALSE))
796     ts->TermFlag |= TF_BACKWRAP;
797    
798     /* Beep type -- special option */
799     GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
800     if (_stricmp(Temp, "off") == 0)
801     ts->Beep = IdBeepOff;
802     else if (_stricmp(Temp, "visual") == 0)
803     ts->Beep = IdBeepVisual;
804     else
805     ts->Beep = IdBeepOn;
806    
807     /* Beep on connection & disconnection -- special option */
808     if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
809     ts->PortFlag |= PF_BEEPONCONNECT;
810    
811     /* Auto B-Plus activation -- special option */
812     if (GetOnOff(Section, "BPAuto", FName, FALSE))
813     ts->FTFlag |= FT_BPAUTO;
814     if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
815     strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
816     _TRUNCATE);
817     ts->AnswerbackLen = 5;
818     }
819    
820     /* B-Plus ESCCTL flag -- special option */
821     if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
822     ts->FTFlag |= FT_BPESCCTL;
823    
824     /* B-Plus log -- special option */
825     if (GetOnOff(Section, "BPLog", FName, FALSE))
826     ts->LogFlag |= LOG_BP;
827    
828     /* Clear serial port buffer when port opening -- special option */
829     ts->ClearComBuffOnOpen =
830     GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
831    
832     /* Confirm disconnection -- special option */
833     if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
834     ts->PortFlag |= PF_CONFIRMDISCONN;
835    
836     /* Ctrl code in Kanji -- special option */
837     if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
838     ts->TermFlag |= TF_CTRLINKANJI;
839    
840     /* Debug flag -- special option */
841     ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
842    
843     /* Delimiter list -- special option */
844     GetPrivateProfileString(Section, "DelimList",
845     "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
846     Temp, sizeof(Temp), FName);
847     Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
848    
849     /* regard DBCS characters as delimiters -- special option */
850     ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
851    
852     // Enable popup menu -- special option
853     if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
854     ts->MenuFlag |= MF_NOPOPUP;
855    
856     // Enable "Show menu" -- special option
857     if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
858     ts->MenuFlag |= MF_NOSHOWMENU;
859    
860     // Enable the status line -- special option
861     if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
862     ts->TermFlag |= TF_ENABLESLINE;
863    
864     // fixed JIS --- special
865     if (GetOnOff(Section, "FixedJIS", FName, FALSE))
866     ts->TermFlag |= TF_FIXEDJIS;
867    
868     /* IME Flag -- special option */
869     ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
870    
871     /* IME-inline Flag -- special option */
872     ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
873    
874     /* Kermit log -- special option */
875     if (GetOnOff(Section, "KmtLog", FName, FALSE))
876     ts->LogFlag |= LOG_KMT;
877    
878     // Enable language selection -- special option
879     if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
880     ts->MenuFlag |= MF_NOLANGUAGE;
881    
882     /* Maximum scroll buffer size -- special option */
883     ts->ScrollBuffMax =
884     GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
885     if (ts->ScrollBuffMax < 24)
886     ts->ScrollBuffMax = 10000;
887    
888     /* Max com port number -- special option */
889     ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
890     if (ts->MaxComPort < 4)
891     ts->MaxComPort = 4;
892     // COM16����99���g�� (2005.11.30 yutaka)
893     // 99����200���g�� (2007.7.23 maya)
894     if (ts->MaxComPort > MAXCOMPORT)
895     ts->MaxComPort = MAXCOMPORT;
896     if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
897     ts->ComPort = 1;
898    
899     /* Non-blinking cursor -- special option */
900     ts->NonblinkingCursor =
901     GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
902    
903     // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
904     ts->KillFocusCursor =
905     GetOnOff(Section, "KillFocusCursor", FName, TRUE);
906    
907     /* Delay for pass-thru printing activation */
908     /* -- special option */
909     ts->PassThruDelay =
910     GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
911    
912     /* Printer port for pass-thru printing */
913     /* -- special option */
914     GetPrivateProfileString(Section, "PassThruPort", "",
915     ts->PrnDev, sizeof(ts->PrnDev), FName);
916    
917     /* Printer Font --- special option */
918     GetPrivateProfileString(Section, "PrnFont", "",
919     Temp, sizeof(Temp), FName);
920     if (strlen(Temp) == 0) {
921     ts->PrnFont[0] = 0;
922     ts->PrnFontSize.x = 0;
923     ts->PrnFontSize.y = 0;
924     ts->PrnFontCharSet = 0;
925     }
926     else {
927     GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
928     GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
929     GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
930     GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
931     }
932    
933     // Page margins (left, right, top, bottom) for printing
934     // -- special option
935     GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
936     Temp, sizeof(Temp), FName);
937     for (i = 0; i <= 3; i++)
938     GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
939    
940     /* Quick-VAN log -- special option */
941     if (GetOnOff(Section, "QVLog", FName, FALSE))
942     ts->LogFlag |= LOG_QV;
943    
944     /* Quick-VAN window size -- special */
945     ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
946    
947     /* Russian character set (print) -- special option */
948     GetPrivateProfileString(Section, "RussPrint", "",
949     Temp, sizeof(Temp), FName);
950     ts->RussPrint = str2id(RussList, Temp, IdWindows);
951    
952     /* Scroll threshold -- special option */
953     ts->ScrollThreshold =
954     GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
955    
956     ts->MouseWheelScrollLine =
957     GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
958    
959     // Select on activate -- special option
960     ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
961    
962     /* Send 8bit control sequence -- special option */
963     ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
964    
965     /* Startup macro -- special option */
966     GetPrivateProfileString(Section, "StartupMacro", "",
967     ts->MacroFN, sizeof(ts->MacroFN), FName);
968    
969     /* TEK GIN Mouse keycode -- special option */
970     ts->GINMouseCode =
971     GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
972    
973     /* Telnet Auto Detect -- special option */
974     ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
975    
976     /* Telnet binary flag -- special option */
977     ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
978    
979     /* Telnet Echo flag -- special option */
980     ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
981    
982     /* Telnet log -- special option */
983     if (GetOnOff(Section, "TelLog", FName, FALSE))
984     ts->LogFlag |= LOG_TEL;
985    
986     /* TCP port num for telnet -- special option */
987     ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
988    
989     /* Telnet keep-alive packet(NOP command) interval -- special option */
990     ts->TelKeepAliveInterval =
991     GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
992    
993     /* Max number of broadcast commad history */
994     ts->MaxBroadcatHistory =
995     GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
996    
997     /* Local echo for non-telnet */
998     ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
999    
1000     /* "new-line (transmit)" option for non-telnet -- special option */
1001     GetPrivateProfileString(Section, "TCPCRSend", "",
1002     Temp, sizeof(Temp), FName);
1003     if (_stricmp(Temp, "CR") == 0)
1004     ts->TCPCRSend = IdCR;
1005     else if (_stricmp(Temp, "CRLF") == 0)
1006     ts->TCPCRSend = IdCRLF;
1007     else
1008     ts->TCPCRSend = 0; // disabled
1009    
1010     /* Use text (background) color for "white (black)" --- special option */
1011     if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1012     ts->ColorFlag |= CF_USETEXTCOLOR;
1013    
1014     /* Title format -- special option */
1015     ts->TitleFormat =
1016     GetPrivateProfileInt(Section, "TitleFormat", 5, FName);
1017    
1018     /* VT Compatible Tab -- special option */
1019     ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1020    
1021     /* VT Font space --- special option */
1022     GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1023     Temp, sizeof(Temp), FName);
1024     GetNthNum(Temp, 1, &ts->FontDX);
1025     GetNthNum(Temp, 2, &ts->FontDW);
1026     GetNthNum(Temp, 3, &ts->FontDY);
1027     GetNthNum(Temp, 4, &ts->FontDH);
1028     if (ts->FontDX < 0)
1029     ts->FontDX = 0;
1030     if (ts->FontDW < 0)
1031     ts->FontDW = 0;
1032     ts->FontDW = ts->FontDW + ts->FontDX;
1033     if (ts->FontDY < 0)
1034     ts->FontDY = 0;
1035     if (ts->FontDH < 0)
1036     ts->FontDH = 0;
1037     ts->FontDH = ts->FontDH + ts->FontDY;
1038    
1039     // VT-print scaling factors (pixels per inch) --- special option
1040     GetPrivateProfileString(Section, "VTPPI", "0,0",
1041     Temp, sizeof(Temp), FName);
1042     GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1043     GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1044    
1045     // TEK-print scaling factors (pixels per inch) --- special option
1046     GetPrivateProfileString(Section, "TEKPPI", "0,0",
1047     Temp, sizeof(Temp), FName);
1048     GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1049     GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1050    
1051     // Show "Window" menu -- special option
1052     if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1053     ts->MenuFlag |= MF_SHOWWINMENU;
1054    
1055     /* XMODEM log -- special option */
1056     if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1057     ts->LogFlag |= LOG_X;
1058    
1059     /* YMODEM log -- special option */
1060     if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1061     ts->LogFlag |= LOG_Y;
1062    
1063     /* Auto ZMODEM activation -- special option */
1064     if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1065     ts->FTFlag |= FT_ZAUTO;
1066    
1067     /* ZMODEM data subpacket length for sending -- special */
1068     ts->ZmodemDataLen =
1069     GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1070     /* ZMODEM window size for sending -- special */
1071     ts->ZmodemWinSize =
1072     GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1073    
1074     /* ZMODEM ESCCTL flag -- special option */
1075     if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1076     ts->FTFlag |= FT_ZESCCTL;
1077    
1078     /* ZMODEM log -- special option */
1079     if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1080     ts->LogFlag |= LOG_Z;
1081    
1082     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1083     GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1084     ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1085    
1086     #ifndef NO_COPYLINE_FIX
1087    
1088     /* Enable continued-line copy -- special option */
1089     ts->EnableContinuedLineCopy =
1090     GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1091     #endif /* NO_COPYLINE_FIX */
1092    
1093     ts->DisablePasteMouseRButton =
1094     GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1095    
1096     // added DisablePasteMouseMButton (2008.3.2 maya)
1097     ts->DisablePasteMouseMButton =
1098     GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1099    
1100     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1101     ts->ConfirmPasteMouseRButton =
1102     GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1103    
1104     // added ConfirmChangePaste (2008.2.3 yutaka)
1105     ts->ConfirmChangePaste =
1106     GetOnOff(Section, "ConfirmChangePaste", FName, TRUE);
1107    
1108     // added ScrollWindowClearScreen (2008.5.3 yutaka)
1109     ts->ScrollWindowClearScreen =
1110     GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1111    
1112     // added SelectOnlyByLButton (2007.11.20 maya)
1113     ts->SelectOnlyByLButton =
1114     GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1115    
1116     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1117     ts->DisableAcceleratorSendBreak =
1118     GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1119    
1120     // WinSock connecting timeout value (2007.1.11 yutaka)
1121     ts->ConnectingTimeout =
1122     GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1123    
1124     // mouse cursor
1125     GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1126     Temp, sizeof(Temp), FName);
1127     strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1128     _TRUNCATE);
1129    
1130     // Translucent window
1131     ts->AlphaBlend =
1132     GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1133     ts->AlphaBlend = max(0, ts->AlphaBlend);
1134     ts->AlphaBlend = min(255, ts->AlphaBlend);
1135    
1136     // Cygwin install path
1137     GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1138     Temp, sizeof(Temp), FName);
1139     strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1140     _TRUNCATE);
1141    
1142     // Viewlog Editor path
1143     GetPrivateProfileString(Section, "ViewlogEditor ", "notepad.exe",
1144     Temp, sizeof(Temp), FName);
1145     strncpy_s(ts->ViewlogEditor, sizeof(ts->ViewlogEditor), Temp,
1146     _TRUNCATE);
1147    
1148     // Locale for UTF-8
1149     GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1150     Temp, sizeof(Temp), FName);
1151     strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1152    
1153     // CodePage
1154     ts->CodePage =
1155     GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1156     FName);
1157    
1158     // UI language message file
1159     GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1160     Temp, sizeof(Temp), FName);
1161     {
1162     char CurDir[MAX_PATH];
1163    
1164     // �t���p�X�������O������������������������������
1165     strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1166    
1167     GetCurrentDirectory(sizeof(CurDir), CurDir);
1168     SetCurrentDirectory(ts->HomeDir);
1169     _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1170     SetCurrentDirectory(CurDir);
1171     }
1172    
1173     // Broadcast Command History (2007.3.3 maya)
1174     ts->BroadcastCommandHistory =
1175     GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1176    
1177     // 337: 2007/03/20 Accept Broadcast
1178     ts->AcceptBroadcast =
1179     GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1180    
1181     // Confirm send a file when drag and drop (2007.12.28 maya)
1182     ts->ConfirmFileDragAndDrop =
1183     GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1184    
1185     // Translate mouse wheel to cursor key when application cursor mode
1186     ts->TranslateWheelToCursor =
1187     GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1188    
1189     // Display "New Connection" dialog on startup (2008.1.18 maya)
1190     ts->HostDialogOnStartup =
1191     GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1192    
1193     // Mouse event tracking
1194     ts->MouseEventTracking =
1195     GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1196    
1197     // Maximized bug tweak
1198     ts->MaximizedBugTweak =
1199     GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1200    
1201     // Convert Unicode symbol characters to DEC Special characters
1202     ts->UnicodeDecSpMapping =
1203     GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1204    
1205     // VT Window Icon
1206     GetPrivateProfileString(Section, "VTIcon", "Default",
1207     Temp, sizeof(Temp), FName);
1208     ts->VTIcon = IconName2IconId(Temp);
1209    
1210     // Tek Window Icon
1211     GetPrivateProfileString(Section, "TEKIcon", "Default",
1212     Temp, sizeof(Temp), FName);
1213     ts->TEKIcon = IconName2IconId(Temp);
1214    
1215     // Unknown Unicode Character
1216     ts->UnknownUnicodeCharaAsWide =
1217     GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1218    
1219     #ifdef USE_NORMAL_BGCOLOR
1220     // UseNormalBGColor
1221     ts->UseNormalBGColor =
1222     GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1223     // 2006/03/11 by 337
1224     if (ts->UseNormalBGColor) {
1225     ts->VTBoldColor[1] =
1226     ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1227     }
1228     #endif
1229    
1230     // AutoScrollOnlyInBottomLine
1231     ts->AutoScrollOnlyInBottomLine =
1232     GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1233    
1234     // Accept remote-controlled window title changing
1235     GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1236     Temp, sizeof(Temp), FName);
1237     if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1238     ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1239     else if (_stricmp(Temp, "ahead") == 0)
1240     ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1241     else if (_stricmp(Temp, "last") == 0)
1242     ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1243     else
1244     ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1245    
1246     // Size of paste confirm dialog
1247     GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1248     Temp, sizeof(Temp), FName);
1249     GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1250     GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1251     if (ts->PasteDialogSize.cx < 0)
1252     ts->PasteDialogSize.cx = 330;
1253     if (ts->PasteDialogSize.cy < 0)
1254     ts->PasteDialogSize.cy = 220;
1255    
1256     // Disable mouse event tracking when Control-Key is pressed.
1257     ts->DisableMouseTrackingByCtrl =
1258     GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1259    
1260     // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1261     ts->DisableWheelToCursorByCtrl =
1262     GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1263    
1264     // Strict Key Mapping.
1265     ts->StrictKeyMapping =
1266     GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1267    
1268     // added Wait4allMacroCommand (2009.3.23 yutaka)
1269     ts->Wait4allMacroCommand =
1270     GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1271 maya 3279
1272 maya 3283 // added DisableMenuSendBreak (2009.4.6 maya)
1273     ts->DisableMenuSendBreak =
1274     GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1275 maya 3282
1276 maya 3283 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1277     ts->ClearScreenOnCloseConnection =
1278     GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1279    
1280     // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1281 maya 3282 ts->DisableAcceleratorDuplicateSession =
1282     GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1283 maya 3306
1284     // added PasteDelayPerLine (2009.4.12 maya)
1285     ts->PasteDelayPerLine =
1286     GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1287 maya 3315 {
1288     int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1289     ts->PasteDelayPerLine = tmp;
1290     }
1291 doda 3395
1292     // Font scaling -- test
1293     ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1294 maya 3227 }
1295    
1296     void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1297     {
1298     int i;
1299     char Temp[MAXPATHLEN];
1300     char buf[20];
1301    
1302     /* version */
1303     WritePrivateProfileString(Section, "Version", "2.3", FName);
1304    
1305     /* Language */
1306 doda 3359 switch (ts->Language) {
1307     case IdJapanese:
1308 maya 3227 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1309 doda 3359 break;
1310     case IdKorean:
1311     strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1312     break;
1313     case IdRussian:
1314     strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1315     break;
1316 maya 3401 case IdUtf8:
1317     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1318     break;
1319 doda 3359 default:
1320     strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1321     }
1322    
1323 maya 3227 WritePrivateProfileString(Section, "Language", Temp, FName);
1324    
1325     /* Port type */
1326     if (ts->PortType == IdSerial)
1327     strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1328     else /* IdFile -> IdTCPIP */
1329     strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1330    
1331     WritePrivateProfileString(Section, "Port", Temp, FName);
1332    
1333     /* Save win position */
1334     if (ts->SaveVTWinPos) {
1335     /* VT win position */
1336     WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1337     }
1338    
1339     /* VT terminal size */
1340     WriteInt2(Section, "TerminalSize", FName,
1341     ts->TerminalWidth, ts->TerminalHeight);
1342    
1343     /* Terminal size = Window size */
1344     WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1345    
1346     /* Auto window resize flag */
1347     WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1348    
1349     /* CR Receive */
1350     if (ts->CRReceive == IdCRLF) {
1351     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1352     }
1353     else if (ts->CRReceive == IdLF) {
1354     strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1355     }
1356     else {
1357     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1358     }
1359     WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1360    
1361     /* CR Send */
1362     if (ts->CRSend == IdCRLF)
1363     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1364     else
1365     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1366     WritePrivateProfileString(Section, "CRSend", Temp, FName);
1367    
1368     /* Local echo */
1369     WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1370    
1371     /* Answerback */
1372     if ((ts->FTFlag & FT_BPAUTO) == 0) {
1373     Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1374     sizeof(Temp) - 1, TRUE);
1375     WritePrivateProfileString(Section, "Answerback", Temp, FName);
1376     }
1377    
1378     /* Kanji Code (receive) */
1379     switch (ts->KanjiCode) {
1380     case IdEUC:
1381     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1382     break;
1383     case IdJIS:
1384     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1385     break;
1386     case IdUTF8:
1387     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1388     break;
1389     case IdUTF8m:
1390     strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1391     break;
1392     default:
1393 doda 3420 switch (ts->Language) {
1394     case IdJapanese:
1395     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1396     break;
1397     case IdKorean:
1398     strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1399     break;
1400     default:
1401     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1402     }
1403 maya 3227 }
1404     WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1405    
1406     /* Katakana (receive) */
1407     if (ts->JIS7Katakana == 1)
1408     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1409     else
1410     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1411    
1412     WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1413    
1414     /* Kanji Code (transmit) */
1415     switch (ts->KanjiCodeSend) {
1416     case IdEUC:
1417     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1418     break;
1419     case IdJIS:
1420     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1421     break;
1422     case IdUTF8:
1423     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1424     break;
1425     default:
1426 doda 3420 switch (ts->Language) {
1427     case IdJapanese:
1428     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1429     break;
1430     case IdKorean:
1431     strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1432     break;
1433     default:
1434     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1435     }
1436 maya 3227 }
1437     WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1438    
1439     /* Katakana (transmit) */
1440     if (ts->JIS7KatakanaSend == 1)
1441     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1442     else
1443     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1444    
1445     WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1446    
1447     /* KanjiIn */
1448     if (ts->KanjiIn == IdKanjiInA)
1449     strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1450     else
1451     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1452    
1453     WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1454    
1455     /* KanjiOut */
1456     switch (ts->KanjiOut) {
1457     case IdKanjiOutB:
1458     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1459     break;
1460     case IdKanjiOutH:
1461     strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1462     break;
1463     default:
1464     strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1465     }
1466     WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1467    
1468     // new configuration
1469     WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1470    
1471     WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1472     ts->DisablePasteMouseRButton);
1473    
1474     // added DisablePasteMouseMButton (2008.3.2 maya)
1475     WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1476     ts->DisablePasteMouseMButton);
1477    
1478     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1479     WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1480     ts->ConfirmPasteMouseRButton);
1481    
1482     // added ConfirmChangePaste
1483     WriteOnOff(Section, "ConfirmChangePaste", FName,
1484     ts->ConfirmChangePaste);
1485    
1486     // added ScrollWindowClearScreen
1487     WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1488     ts->ScrollWindowClearScreen);
1489    
1490     // added SelectOnlyByLButton (2007.11.20 maya)
1491     WriteOnOff(Section, "SelectOnlyByLButton", FName,
1492     ts->SelectOnlyByLButton);
1493     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1494     WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1495     ts->DisableAcceleratorSendBreak);
1496     WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1497     ts->EnableContinuedLineCopy);
1498     WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1499     FName);
1500     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1501     WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1502     WritePrivateProfileString(Section, "CygwinDirectory",
1503     ts->CygwinDirectory, FName);
1504     WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1505     FName);
1506     WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1507     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1508     WritePrivateProfileString(Section, "CodePage", Temp, FName);
1509    
1510     // ANSI color(2004.9.5 yutaka)
1511     Temp[0] = '\0';
1512     for (i = 0; i < 15; i++) {
1513     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1514     i,
1515     GetRValue(ts->ANSIColor[i]),
1516     GetGValue(ts->ANSIColor[i]),
1517     GetBValue(ts->ANSIColor[i])
1518     );
1519     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1520     }
1521     i = 15;
1522     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1523     i,
1524     GetRValue(ts->ANSIColor[i]),
1525     GetGValue(ts->ANSIColor[i]),
1526     GetBValue(ts->ANSIColor[i])
1527     );
1528     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1529     WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1530    
1531     /* AutoWinChange VT<->TEK */
1532     WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1533    
1534     /* Terminal ID */
1535     id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1536     WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1537    
1538     /* Russian character set (host) */
1539     id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1540     WritePrivateProfileString(Section, "RussHost", Temp, FName);
1541    
1542     /* Russian character set (client) */
1543     id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1544     WritePrivateProfileString(Section, "RussClient", Temp, FName);
1545    
1546     /* Title text */
1547     WritePrivateProfileString(Section, "Title", ts->Title, FName);
1548    
1549     /* Cursor shape */
1550     switch (ts->CursorShape) {
1551     case IdVCur:
1552     strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1553     break;
1554     case IdHCur:
1555     strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1556     break;
1557     default:
1558     strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1559     }
1560     WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1561    
1562     /* Hide title */
1563     WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1564    
1565     /* Popup menu */
1566     WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1567    
1568     /* PC-Style bold color mapping */
1569     WriteOnOff(Section, "PcBoldColor", FName,
1570     (WORD) (ts->ColorFlag & CF_PCBOLD16));
1571    
1572     /* aixterm 16 colors mode */
1573     WriteOnOff(Section, "Aixterm16Color", FName,
1574     (WORD) (ts->ColorFlag & CF_AIXTERM16));
1575    
1576     /* xterm 256 colors mode */
1577     WriteOnOff(Section, "Xterm256Color", FName,
1578     (WORD) (ts->ColorFlag & CF_XTERM256));
1579    
1580     /* Enable scroll buffer */
1581     WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1582    
1583     /* Scroll buffer size */
1584     WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1585    
1586     /* VT Color */
1587     for (i = 0; i <= 1; i++) {
1588     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1589     if (ts->ColorFlag & CF_REVERSECOLOR) {
1590     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1591     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1592     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1593     }
1594     else {
1595     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1596     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1597     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1598     }
1599     }
1600     else {
1601     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1602     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1603     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1604     }
1605     }
1606     WriteInt6(Section, "VTColor", FName,
1607     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1608     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1609    
1610     /* VT Bold Color */
1611     for (i = 0; i <= 1; i++) {
1612     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1613     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1614     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1615     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1616     }
1617     else {
1618     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1619     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1620     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1621     }
1622     }
1623     WriteInt6(Section, "VTBoldColor", FName,
1624     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1625     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1626    
1627     /* VT Blink Color */
1628     for (i = 0; i <= 1; i++) {
1629     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1630     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1631     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1632     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1633     }
1634     else {
1635     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1636     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1637     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1638     }
1639     }
1640     WriteInt6(Section, "VTBlinkColor", FName,
1641     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1642     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1643    
1644     /* VT Reverse Color */
1645     for (i = 0; i <= 1; i++) {
1646     if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1647     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1648     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1649     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1650     }
1651     else {
1652     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1653     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1654     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1655     }
1656     }
1657     WriteInt6(Section, "VTReverseColor", FName,
1658     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1659     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1660    
1661     WriteOnOff(Section, "EnableClickableUrl", FName,
1662     ts->EnableClickableUrl);
1663    
1664     /* URL color */
1665     for (i = 0; i <= 1; i++) {
1666     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1667     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1668     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1669     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1670     }
1671     else {
1672     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1673     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1674     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1675     }
1676     }
1677     WriteInt6(Section, "URLColor", FName,
1678     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1679     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1680    
1681     WriteOnOff(Section, "EnableBoldAttrColor", FName,
1682     (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1683    
1684     WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1685     (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1686    
1687     WriteOnOff(Section, "EnableReverseAttrColor", FName,
1688     (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1689    
1690     WriteOnOff(Section, "EnableURLColor", FName,
1691     (WORD) (ts->ColorFlag & CF_URLCOLOR));
1692    
1693     WriteOnOff(Section, "EnableANSIColor", FName,
1694     (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1695    
1696     /* TEK Color */
1697     for (i = 0; i <= 1; i++) {
1698     ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1699     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1700     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1701     }
1702     WriteInt6(Section, "TEKColor", FName,
1703     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1704     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1705    
1706     /* TEK color emulation */
1707     WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1708    
1709     /* VT Font */
1710     WriteFont(Section, "VTFont", FName,
1711     ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1712     ts->VTFontCharSet);
1713    
1714     /* Enable bold font flag */
1715     WriteOnOff(Section, "EnableBold", FName, ts->EnableBold);
1716    
1717     /* Russian character set (font) */
1718     id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1719     WritePrivateProfileString(Section, "RussFont", Temp, FName);
1720    
1721     /* TEK Font */
1722     WriteFont(Section, "TEKFont", FName,
1723     ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1724     ts->TEKFontCharSet);
1725    
1726     /* BS key */
1727     if (ts->BSKey == IdDEL)
1728     strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1729     else
1730     strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1731     WritePrivateProfileString(Section, "BSKey", Temp, FName);
1732    
1733     /* Delete key */
1734     WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1735    
1736     /* Meta key */
1737     WriteOnOff(Section, "MetaKey", FName, ts->MetaKey);
1738    
1739     /* Application Keypad */
1740     WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1741    
1742     /* Application Cursor */
1743     WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1744    
1745     /* Russian keyboard type */
1746     id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1747     WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1748    
1749     /* Serial port ID */
1750     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1751     WritePrivateProfileString(Section, "ComPort", Temp, FName);
1752    
1753     /* Baud rate */
1754     id2str(BaudList, ts->Baud, IdBaud9600, Temp, sizeof(Temp));
1755     WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1756    
1757     /* Parity */
1758     switch (ts->Parity) {
1759     case IdParityEven:
1760     strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1761     break;
1762     case IdParityOdd:
1763     strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1764     break;
1765     default:
1766     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1767     }
1768     WritePrivateProfileString(Section, "Parity", Temp, FName);
1769    
1770     /* Data bit */
1771     if (ts->DataBit == IdDataBit7)
1772     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1773     else
1774     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1775    
1776     WritePrivateProfileString(Section, "DataBit", Temp, FName);
1777    
1778     /* Stop bit */
1779     if (ts->StopBit == IdStopBit2)
1780     strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1781     else
1782     strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1783    
1784     WritePrivateProfileString(Section, "StopBit", Temp, FName);
1785    
1786     /* Flow control */
1787     switch (ts->Flow) {
1788     case IdFlowX:
1789     strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1790     break;
1791     case IdFlowHard:
1792     strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1793     break;
1794     default:
1795     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1796     }
1797     WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1798    
1799     /* Delay per character */
1800     WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1801    
1802     /* Delay per line */
1803     WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1804    
1805     /* Telnet flag */
1806     WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1807    
1808     /* Telnet terminal type */
1809     WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1810    
1811     /* TCP port num for non-telnet */
1812     WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1813    
1814     /* Auto close flag */
1815     WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1816    
1817     /* History list */
1818     WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1819    
1820     /* File transfer binary flag */
1821     WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1822    
1823     /* Log append */
1824     WriteOnOff(Section, "LogAppend", FName, ts->Append);
1825    
1826     /* File transfer binary flag */
1827     WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1828    
1829     /* Log with timestamp (2006.7.23 maya) */
1830     WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1831    
1832     /* Log without transfer dialog */
1833     WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1834    
1835     /* Default Log file name (2006.8.28 maya) */
1836     WritePrivateProfileString(Section, "LogDefaultName",
1837     ts->LogDefaultName, FName);
1838    
1839     /* Default Log file path (2007.5.30 maya) */
1840     WritePrivateProfileString(Section, "LogDefaultPath",
1841     ts->LogDefaultPath, FName);
1842    
1843     /* Auto start logging (2007.5.31 maya) */
1844     WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1845    
1846     /* XMODEM option */
1847     switch (ts->XmodemOpt) {
1848     case XoptCRC:
1849     strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
1850     break;
1851     case Xopt1K:
1852     strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
1853     break;
1854     default:
1855     strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
1856     }
1857     WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
1858    
1859     /* XMODEM binary flag */
1860     WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
1861    
1862     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1863     WritePrivateProfileString(Section, "XmodemRcvCommand",
1864     ts->XModemRcvCommand, FName);
1865    
1866     /* Default directory for file transfer */
1867     WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
1868    
1869     /* filter on file send (2007.6.5 maya) */
1870     WritePrivateProfileString(Section, "FileSendFilter",
1871     ts->FileSendFilter, FName);
1872    
1873     /*------------------------------------------------------------------*/
1874     /* 8 bit control code flag -- special option */
1875     WriteOnOff(Section, "Accept8BitCtrl", FName,
1876     (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
1877    
1878     /* Wrong sequence flag -- special option */
1879     WriteOnOff(Section, "AllowWrongSequence", FName,
1880     (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
1881    
1882     /* Auto file renaming --- special option */
1883     WriteOnOff(Section, "AutoFileRename", FName,
1884     (WORD) (ts->FTFlag & FT_RENAME));
1885    
1886     /* Auto text copy --- special option */
1887     WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
1888    
1889     /* Back wrap -- special option */
1890     WriteOnOff(Section, "BackWrap", FName,
1891     (WORD) (ts->TermFlag & TF_BACKWRAP));
1892    
1893     /* Beep type -- special option */
1894     WriteOnOff(Section, "Beep", FName, ts->Beep);
1895     switch (ts->Beep) {
1896     case IdBeepOff:
1897 doda 3278 WritePrivateProfileString(Section, "Beep", "off", FName);
1898 maya 3227 break;
1899     case IdBeepOn:
1900 doda 3278 WritePrivateProfileString(Section, "Beep", "on", FName);
1901 maya 3227 break;
1902     case IdBeepVisual:
1903 doda 3278 WritePrivateProfileString(Section, "Beep", "visual", FName);
1904 maya 3227 break;
1905     }
1906    
1907     /* Beep on connection & disconnection -- special option */
1908     WriteOnOff(Section, "BeepOnConnect", FName,
1909     (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
1910    
1911     /* Auto B-Plus activation -- special option */
1912     WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
1913    
1914     /* B-Plus ESCCTL flag -- special option */
1915     WriteOnOff(Section, "BPEscCtl", FName,
1916     (WORD) (ts->FTFlag & FT_BPESCCTL));
1917    
1918     /* B-Plus log -- special option */
1919     WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
1920    
1921     /* Clear serial port buffer when port opening -- special option */
1922     WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
1923    
1924     /* Confirm disconnection -- special option */
1925     WriteOnOff(Section, "ConfirmDisconnect", FName,
1926     (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
1927    
1928     /* Ctrl code in Kanji -- special option */
1929     WriteOnOff(Section, "CtrlInKanji", FName,
1930     (WORD) (ts->TermFlag & TF_CTRLINKANJI));
1931    
1932     /* Debug flag -- special option */
1933     WriteOnOff(Section, "Debug", FName, ts->Debug);
1934    
1935     /* Delimiter list -- special option */
1936     Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
1937     sizeof(Temp) - 1, TRUE);
1938     WritePrivateProfileString(Section, "DelimList", Temp, FName);
1939    
1940     /* regard DBCS characters as delimiters -- special option */
1941     WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
1942    
1943     // Enable popup menu -- special option
1944     if ((ts->MenuFlag & MF_NOPOPUP) == 0)
1945     WriteOnOff(Section, "EnablePopupMenu", FName, 1);
1946     else
1947     WriteOnOff(Section, "EnablePopupMenu", FName, 0);
1948    
1949     // Enable "Show menu" -- special option
1950     if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
1951     WriteOnOff(Section, "EnableShowMenu", FName, 1);
1952     else
1953     WriteOnOff(Section, "EnableShowMenu", FName, 0);
1954    
1955     /* Enable the status line -- special option */
1956     WriteOnOff(Section, "EnableStatusLine", FName,
1957     (WORD) (ts->TermFlag & TF_ENABLESLINE));
1958    
1959     /* IME Flag -- special option */
1960     WriteOnOff(Section, "IME", FName, ts->UseIME);
1961    
1962     /* IME-inline Flag -- special option */
1963     WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
1964    
1965     /* Kermit log -- special option */
1966     WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
1967    
1968     // Enable language selection -- special option
1969     if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
1970     WriteOnOff(Section, "LanguageSelection", FName, 1);
1971     else
1972     WriteOnOff(Section, "LanguageSelection", FName, 0);
1973    
1974     /* Maximum scroll buffer size -- special option */
1975     WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
1976    
1977     /* Max com port number -- special option */
1978     WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
1979    
1980     /* Non-blinking cursor -- special option */
1981     WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
1982    
1983     WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
1984    
1985     /* Delay for pass-thru printing activation */
1986     /* -- special option */
1987     WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
1988    
1989     /* Printer port for pass-thru printing */
1990     /* -- special option */
1991     WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
1992    
1993     /* Printer Font --- special option */
1994     WriteFont(Section, "PrnFont", FName,
1995     ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
1996     ts->PrnFontCharSet);
1997    
1998     // Page margins (left, right, top, bottom) for printing
1999     // -- special option
2000     WriteInt4(Section, "PrnMargin", FName,
2001     ts->PrnMargin[0], ts->PrnMargin[1],
2002     ts->PrnMargin[2], ts->PrnMargin[3]);
2003    
2004     /* Quick-VAN log -- special option */
2005     WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
2006    
2007     /* Quick-VAN window size -- special */
2008     WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
2009    
2010     /* Russian character set (print) -- special option */
2011     id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
2012     WritePrivateProfileString(Section, "RussPrint", Temp, FName);
2013    
2014     /* Scroll threshold -- special option */
2015     WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
2016    
2017     WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
2018    
2019     // Select on activate -- special option
2020     WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
2021    
2022     /* Send 8bit control sequence -- special option */
2023     WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
2024    
2025     /* Startup macro -- special option */
2026     WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
2027    
2028     /* TEK GIN Mouse keycode -- special option */
2029     WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
2030    
2031     /* Telnet Auto Detect -- special option */
2032     WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
2033    
2034     /* Telnet binary flag -- special option */
2035     WriteOnOff(Section, "TelBin", FName, ts->TelBin);
2036    
2037     /* Telnet Echo flag -- special option */
2038     WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
2039    
2040     /* Telnet log -- special option */
2041     WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2042    
2043     /* TCP port num for telnet -- special option */
2044     WriteUint(Section, "TelPort", FName, ts->TelPort);
2045    
2046     /* Telnet keep-alive packet(NOP command) interval -- special option */
2047     WriteUint(Section, "TelKeepAliveInterval", FName,
2048     ts->TelKeepAliveInterval);
2049    
2050     /* Max number of broadcast commad history */
2051     WriteUint(Section, "MaxBroadcatHistory", FName,
2052     ts->MaxBroadcatHistory);
2053    
2054     /* Local echo for non-telnet */
2055     WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2056    
2057     /* "new-line (transmit)" option for non-telnet -- special option */
2058     if (ts->TCPCRSend == IdCRLF)
2059     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2060     else if (ts->TCPCRSend == IdCR)
2061     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2062     else
2063     Temp[0] = 0;
2064     WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2065    
2066     /* Use text (background) color for "white (black)"
2067     --- special option */
2068     WriteOnOff(Section, "UseTextColor", FName,
2069     (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2070    
2071     /* Title format -- special option */
2072     WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2073    
2074     /* VT Compatible Tab -- special option */
2075     WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2076    
2077     /* VT Font space --- special option */
2078     WriteInt4(Section, "VTFontSpace", FName,
2079     ts->FontDX, ts->FontDW - ts->FontDX,
2080     ts->FontDY, ts->FontDH - ts->FontDY);
2081    
2082     // VT-print scaling factors (pixels per inch) --- special option
2083     WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2084    
2085     // TEK-print scaling factors (pixels per inch) --- special option
2086     WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2087    
2088     // Show "Window" menu -- special option
2089     WriteOnOff(Section, "WindowMenu", FName,
2090     (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2091    
2092     /* XMODEM log -- special option */
2093     WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2094    
2095     /* YMODEM log -- special option */
2096     WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2097    
2098     /* Auto ZMODEM activation -- special option */
2099     WriteOnOff(Section, "ZmodemAuto", FName,
2100     (WORD) (ts->FTFlag & FT_ZAUTO));
2101    
2102     /* ZMODEM data subpacket length for sending -- special */
2103     WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2104     /* ZMODEM window size for sending -- special */
2105     WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2106    
2107     /* ZMODEM ESCCTL flag -- special option */
2108     WriteOnOff(Section, "ZmodemEscCtl", FName,
2109     (WORD) (ts->FTFlag & FT_ZESCCTL));
2110    
2111     /* ZMODEM log -- special option */
2112     WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2113    
2114     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2115     WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2116    
2117     /* update file */
2118     WritePrivateProfileString(NULL, NULL, NULL, FName);
2119    
2120     // Eterm lookfeel alphablend (2005.4.24 yutaka)
2121     #define ETERM_SECTION "BG"
2122     WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2123     ts->EtermLookfeel.BGEnable);
2124     WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2125     ts->EtermLookfeel.BGUseAlphaBlendAPI);
2126     WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2127     ts->EtermLookfeel.BGSPIPath, FName);
2128     WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2129     ts->EtermLookfeel.BGFastSizeMove);
2130     WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2131     ts->EtermLookfeel.BGNoCopyBits);
2132     WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2133     ts->EtermLookfeel.BGNoFrame);
2134     WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2135     ts->EtermLookfeel.BGThemeFile, FName);
2136    
2137     #ifdef USE_NORMAL_BGCOLOR
2138     // UseNormalBGColor
2139     WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2140     #endif
2141    
2142     // UI language message file
2143     WritePrivateProfileString(Section, "UILanguageFile",
2144     ts->UILanguageFile_ini, FName);
2145    
2146     // Broadcast Command History (2007.3.3 maya)
2147     WriteOnOff(Section, "BroadcastCommandHistory", FName,
2148     ts->BroadcastCommandHistory);
2149    
2150     // 337: 2007/03/20 Accept Broadcast
2151     WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2152    
2153     // Confirm send a file when drag and drop (2007.12.28 maya)
2154     WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2155     ts->ConfirmFileDragAndDrop);
2156    
2157     // Translate mouse wheel to cursor key when application cursor mode
2158     WriteOnOff(Section, "TranslateWheelToCursor", FName,
2159     ts->TranslateWheelToCursor);
2160    
2161     // Display "New Connection" dialog on startup (2008.1.18 maya)
2162     WriteOnOff(Section, "HostDialogOnStartup", FName,
2163     ts->HostDialogOnStartup);
2164    
2165     // Mouse event tracking
2166     WriteOnOff(Section, "MouseEventTracking", FName,
2167     ts->MouseEventTracking);
2168    
2169     // Maximized bug tweak
2170     WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2171    
2172     // Convert Unicode symbol characters to DEC Special characters
2173     WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2174    
2175     // VT Window Icon
2176     IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2177     WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2178    
2179     // Tek Window Icon
2180     IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2181     WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2182    
2183     // AutoScrollOnlyInBottomLine
2184     WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2185     ts->AutoScrollOnlyInBottomLine);
2186    
2187     // Unknown Unicode Character
2188     WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2189     ts->UnknownUnicodeCharaAsWide);
2190    
2191     // Accept remote-controlled window title changing
2192     if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2193     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2194     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2195     strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2196     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2197     strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2198     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2199     strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2200     else
2201     Temp[0] = 0;
2202     WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2203    
2204     // Size of paste confirm dialog
2205     WriteInt2(Section, "PasteDialogSize", FName,
2206     ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2207    
2208     // Disable mouse event tracking when Control-Key is pressed.
2209     WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2210     ts->DisableMouseTrackingByCtrl);
2211    
2212     // Disable TranslateWHeelToCursor when Control-Key is pressed.
2213     WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2214     ts->DisableWheelToCursorByCtrl);
2215    
2216     // Strict Key Mapping.
2217     WriteOnOff(Section, "StrictKeyMapping", FName,
2218     ts->StrictKeyMapping);
2219    
2220     // Wait4allMacroCommand
2221     WriteOnOff(Section, "Wait4allMacroCommand", FName,
2222     ts->Wait4allMacroCommand);
2223 maya 3279
2224 maya 3283 // DisableMenuSendBreak
2225     WriteOnOff(Section, "DisableMenuSendBreak", FName,
2226 maya 3284 ts->DisableMenuSendBreak);
2227 maya 3280
2228     // ClearScreenOnCloseConnection
2229     WriteOnOff(Section, "ClearScreenOnCloseConnection", FName,
2230     ts->ClearScreenOnCloseConnection);
2231 maya 3282
2232     // DisableAcceleratorDuplicateSession
2233     WriteOnOff(Section, "DisableAcceleratorDuplicateSession", FName,
2234     ts->DisableAcceleratorDuplicateSession);
2235 maya 3306
2236     // added PasteDelayPerLine (2009.4.12 maya)
2237     WriteInt(Section, "PasteDelayPerLine", FName,
2238     ts->PasteDelayPerLine);
2239 maya 3227 }
2240    
2241     #define VTEditor "VT editor keypad"
2242     #define VTNumeric "VT numeric keypad"
2243     #define VTFunction "VT function keys"
2244     #define XFunction "X function keys"
2245     #define ShortCut "Shortcut keys"
2246    
2247     void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2248     {
2249     char Temp[11];
2250     WORD Num;
2251    
2252     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2253     if (Temp[0] == 0)
2254     Num = 0xFFFF;
2255     else if (_stricmp(Temp, "off") == 0)
2256     Num = 0xFFFF;
2257     else if (sscanf(Temp, "%d", &Num) != 1)
2258     Num = 0xFFFF;
2259    
2260     KeyMap->Map[KeyId - 1] = Num;
2261     }
2262    
2263     void FAR PASCAL ReadKeyboardCnf
2264     (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2265     int i, j, Ptr;
2266     char EntName[7];
2267     char TempStr[221];
2268     char KStr[201];
2269    
2270     // clear key map
2271     for (i = 0; i <= IdKeyMax - 1; i++)
2272     KeyMap->Map[i] = 0xFFFF;
2273     for (i = 0; i <= NumOfUserKey - 1; i++) {
2274     KeyMap->UserKeyPtr[i] = 0;
2275     KeyMap->UserKeyLen[i] = 0;
2276     }
2277    
2278     // VT editor keypad
2279     GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2280