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 3399 - (hide annotations) (download) (as text)
Fri May 15 12:03:33 2009 UTC (14 years, 10 months ago) by doda
File MIME type: text/x-csrc
File size: 96827 byte(s)
コマンドラインオプションで、/F=オプションは他のオプションより先に処理するように変更した。
例えば、ttermpro /DS /F=hoge.iniとした時、hoge.iniのHostDialogOnStartupの設定が使われる為、結果的に/DSは無視されていた。
この変更により、hoge.iniの中のHostDialogOnStartupの設定に関係なく、/DSによりホストダイアログが表示されなくなる。


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