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 3388 - (hide annotations) (download) (as text)
Mon May 11 04:18:15 2009 UTC (14 years, 11 months ago) by doda
File MIME type: text/x-csrc
File size: 96789 byte(s)
ssh/cygwin接続を複製した後の新規接続で、TCPLocalEcho/TCPCRSendが無視されるのを修正した。

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 maya 3227 }
1276    
1277     void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1278     {
1279     int i;
1280     char Temp[MAXPATHLEN];
1281     char buf[20];
1282    
1283     /* version */
1284     WritePrivateProfileString(Section, "Version", "2.3", FName);
1285    
1286     /* Language */
1287 doda 3359 switch (ts->Language) {
1288     case IdJapanese:
1289 maya 3227 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1290 doda 3359 break;
1291     case IdKorean:
1292     strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1293     break;
1294     case IdRussian:
1295     strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1296     break;
1297     default:
1298     strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1299     }
1300    
1301 maya 3227 WritePrivateProfileString(Section, "Language", Temp, FName);
1302    
1303     /* Port type */
1304     if (ts->PortType == IdSerial)
1305     strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1306     else /* IdFile -> IdTCPIP */
1307     strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1308    
1309     WritePrivateProfileString(Section, "Port", Temp, FName);
1310    
1311     /* Save win position */
1312     if (ts->SaveVTWinPos) {
1313     /* VT win position */
1314     WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1315     }
1316    
1317     /* VT terminal size */
1318     WriteInt2(Section, "TerminalSize", FName,
1319     ts->TerminalWidth, ts->TerminalHeight);
1320    
1321     /* Terminal size = Window size */
1322     WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1323    
1324     /* Auto window resize flag */
1325     WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1326    
1327     /* CR Receive */
1328     if (ts->CRReceive == IdCRLF) {
1329     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1330     }
1331     else if (ts->CRReceive == IdLF) {
1332     strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1333     }
1334     else {
1335     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1336     }
1337     WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1338    
1339     /* CR Send */
1340     if (ts->CRSend == IdCRLF)
1341     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1342     else
1343     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1344     WritePrivateProfileString(Section, "CRSend", Temp, FName);
1345    
1346     /* Local echo */
1347     WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1348    
1349     /* Answerback */
1350     if ((ts->FTFlag & FT_BPAUTO) == 0) {
1351     Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1352     sizeof(Temp) - 1, TRUE);
1353     WritePrivateProfileString(Section, "Answerback", Temp, FName);
1354     }
1355    
1356     /* Kanji Code (receive) */
1357     switch (ts->KanjiCode) {
1358     case IdEUC:
1359     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1360     break;
1361     case IdJIS:
1362     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1363     break;
1364     case IdUTF8:
1365     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1366     break;
1367     case IdUTF8m:
1368     strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1369     break;
1370     default:
1371     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1372     }
1373     WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1374    
1375     /* Katakana (receive) */
1376     if (ts->JIS7Katakana == 1)
1377     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1378     else
1379     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1380    
1381     WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1382    
1383     /* Kanji Code (transmit) */
1384     switch (ts->KanjiCodeSend) {
1385     case IdEUC:
1386     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1387     break;
1388     case IdJIS:
1389     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1390     break;
1391     case IdUTF8:
1392     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1393     break;
1394     default:
1395     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1396     }
1397     WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1398    
1399     /* Katakana (transmit) */
1400     if (ts->JIS7KatakanaSend == 1)
1401     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1402     else
1403     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1404    
1405     WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1406    
1407     /* KanjiIn */
1408     if (ts->KanjiIn == IdKanjiInA)
1409     strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1410     else
1411     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1412    
1413     WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1414    
1415     /* KanjiOut */
1416     switch (ts->KanjiOut) {
1417     case IdKanjiOutB:
1418     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1419     break;
1420     case IdKanjiOutH:
1421     strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1422     break;
1423     default:
1424     strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1425     }
1426     WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1427    
1428     // new configuration
1429     WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1430    
1431     WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1432     ts->DisablePasteMouseRButton);
1433    
1434     // added DisablePasteMouseMButton (2008.3.2 maya)
1435     WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1436     ts->DisablePasteMouseMButton);
1437    
1438     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1439     WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1440     ts->ConfirmPasteMouseRButton);
1441    
1442     // added ConfirmChangePaste
1443     WriteOnOff(Section, "ConfirmChangePaste", FName,
1444     ts->ConfirmChangePaste);
1445    
1446     // added ScrollWindowClearScreen
1447     WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1448     ts->ScrollWindowClearScreen);
1449    
1450     // added SelectOnlyByLButton (2007.11.20 maya)
1451     WriteOnOff(Section, "SelectOnlyByLButton", FName,
1452     ts->SelectOnlyByLButton);
1453     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1454     WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1455     ts->DisableAcceleratorSendBreak);
1456     WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1457     ts->EnableContinuedLineCopy);
1458     WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1459     FName);
1460     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1461     WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1462     WritePrivateProfileString(Section, "CygwinDirectory",
1463     ts->CygwinDirectory, FName);
1464     WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1465     FName);
1466     WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1467     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1468     WritePrivateProfileString(Section, "CodePage", Temp, FName);
1469    
1470     // ANSI color(2004.9.5 yutaka)
1471     Temp[0] = '\0';
1472     for (i = 0; i < 15; i++) {
1473     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1474     i,
1475     GetRValue(ts->ANSIColor[i]),
1476     GetGValue(ts->ANSIColor[i]),
1477     GetBValue(ts->ANSIColor[i])
1478     );
1479     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1480     }
1481     i = 15;
1482     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1483     i,
1484     GetRValue(ts->ANSIColor[i]),
1485     GetGValue(ts->ANSIColor[i]),
1486     GetBValue(ts->ANSIColor[i])
1487     );
1488     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1489     WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1490    
1491     /* AutoWinChange VT<->TEK */
1492     WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1493    
1494     /* Terminal ID */
1495     id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1496     WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1497    
1498     /* Russian character set (host) */
1499     id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1500     WritePrivateProfileString(Section, "RussHost", Temp, FName);
1501    
1502     /* Russian character set (client) */
1503     id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1504     WritePrivateProfileString(Section, "RussClient", Temp, FName);
1505    
1506     /* Title text */
1507     WritePrivateProfileString(Section, "Title", ts->Title, FName);
1508    
1509     /* Cursor shape */
1510     switch (ts->CursorShape) {
1511     case IdVCur:
1512     strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1513     break;
1514     case IdHCur:
1515     strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1516     break;
1517     default:
1518     strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1519     }
1520     WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1521    
1522     /* Hide title */
1523     WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1524    
1525     /* Popup menu */
1526     WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1527    
1528     /* PC-Style bold color mapping */
1529     WriteOnOff(Section, "PcBoldColor", FName,
1530     (WORD) (ts->ColorFlag & CF_PCBOLD16));
1531    
1532     /* aixterm 16 colors mode */
1533     WriteOnOff(Section, "Aixterm16Color", FName,
1534     (WORD) (ts->ColorFlag & CF_AIXTERM16));
1535    
1536     /* xterm 256 colors mode */
1537     WriteOnOff(Section, "Xterm256Color", FName,
1538     (WORD) (ts->ColorFlag & CF_XTERM256));
1539    
1540     /* Enable scroll buffer */
1541     WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1542    
1543     /* Scroll buffer size */
1544     WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1545    
1546     /* VT Color */
1547     for (i = 0; i <= 1; i++) {
1548     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1549     if (ts->ColorFlag & CF_REVERSECOLOR) {
1550     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1551     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1552     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1553     }
1554     else {
1555     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1556     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1557     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1558     }
1559     }
1560     else {
1561     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1562     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1563     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1564     }
1565     }
1566     WriteInt6(Section, "VTColor", FName,
1567     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1568     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1569    
1570     /* VT Bold Color */
1571     for (i = 0; i <= 1; i++) {
1572     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1573     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1574     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1575     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1576     }
1577     else {
1578     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1579     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1580     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1581     }
1582     }
1583     WriteInt6(Section, "VTBoldColor", FName,
1584     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1585     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1586    
1587     /* VT Blink Color */
1588     for (i = 0; i <= 1; i++) {
1589     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1590     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1591     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1592     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1593     }
1594     else {
1595     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1596     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1597     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1598     }
1599     }
1600     WriteInt6(Section, "VTBlinkColor", FName,
1601     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1602     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1603    
1604     /* VT Reverse Color */
1605     for (i = 0; i <= 1; i++) {
1606     if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1607     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1608     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1609     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1610     }
1611     else {
1612     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1613     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1614     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1615     }
1616     }
1617     WriteInt6(Section, "VTReverseColor", FName,
1618     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1619     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1620    
1621     WriteOnOff(Section, "EnableClickableUrl", FName,
1622     ts->EnableClickableUrl);
1623    
1624     /* URL color */
1625     for (i = 0; i <= 1; i++) {
1626     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1627     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1628     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1629     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1630     }
1631     else {
1632     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1633     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1634     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1635     }
1636     }
1637     WriteInt6(Section, "URLColor", FName,
1638     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1639     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1640    
1641     WriteOnOff(Section, "EnableBoldAttrColor", FName,
1642     (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1643    
1644     WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1645     (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1646    
1647     WriteOnOff(Section, "EnableReverseAttrColor", FName,
1648     (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1649    
1650     WriteOnOff(Section, "EnableURLColor", FName,
1651     (WORD) (ts->ColorFlag & CF_URLCOLOR));
1652    
1653     WriteOnOff(Section, "EnableANSIColor", FName,
1654     (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1655    
1656     /* TEK Color */
1657     for (i = 0; i <= 1; i++) {
1658     ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1659     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1660     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1661     }
1662     WriteInt6(Section, "TEKColor", FName,
1663     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1664     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1665    
1666     /* TEK color emulation */
1667     WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1668    
1669     /* VT Font */
1670     WriteFont(Section, "VTFont", FName,
1671     ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1672     ts->VTFontCharSet);
1673    
1674     /* Enable bold font flag */
1675     WriteOnOff(Section, "EnableBold", FName, ts->EnableBold);
1676    
1677     /* Russian character set (font) */
1678     id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1679     WritePrivateProfileString(Section, "RussFont", Temp, FName);
1680    
1681     /* TEK Font */
1682     WriteFont(Section, "TEKFont", FName,
1683     ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1684     ts->TEKFontCharSet);
1685    
1686     /* BS key */
1687     if (ts->BSKey == IdDEL)
1688     strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1689     else
1690     strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1691     WritePrivateProfileString(Section, "BSKey", Temp, FName);
1692    
1693     /* Delete key */
1694     WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1695    
1696     /* Meta key */
1697     WriteOnOff(Section, "MetaKey", FName, ts->MetaKey);
1698    
1699     /* Application Keypad */
1700     WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1701    
1702     /* Application Cursor */
1703     WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1704    
1705     /* Russian keyboard type */
1706     id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1707     WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1708    
1709     /* Serial port ID */
1710     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1711     WritePrivateProfileString(Section, "ComPort", Temp, FName);
1712    
1713     /* Baud rate */
1714     id2str(BaudList, ts->Baud, IdBaud9600, Temp, sizeof(Temp));
1715     WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1716    
1717     /* Parity */
1718     switch (ts->Parity) {
1719     case IdParityEven:
1720     strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1721     break;
1722     case IdParityOdd:
1723     strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1724     break;
1725     default:
1726     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1727     }
1728     WritePrivateProfileString(Section, "Parity", Temp, FName);
1729    
1730     /* Data bit */
1731     if (ts->DataBit == IdDataBit7)
1732     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1733     else
1734     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1735    
1736     WritePrivateProfileString(Section, "DataBit", Temp, FName);
1737    
1738     /* Stop bit */
1739     if (ts->StopBit == IdStopBit2)
1740     strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1741     else
1742     strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1743    
1744     WritePrivateProfileString(Section, "StopBit", Temp, FName);
1745    
1746     /* Flow control */
1747     switch (ts->Flow) {
1748     case IdFlowX:
1749     strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1750     break;
1751     case IdFlowHard:
1752     strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1753     break;
1754     default:
1755     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1756     }
1757     WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1758    
1759     /* Delay per character */
1760     WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1761    
1762     /* Delay per line */
1763     WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1764    
1765     /* Telnet flag */
1766     WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1767    
1768     /* Telnet terminal type */
1769     WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1770    
1771     /* TCP port num for non-telnet */
1772     WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1773    
1774     /* Auto close flag */
1775     WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1776    
1777     /* History list */
1778     WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1779    
1780     /* File transfer binary flag */
1781     WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1782    
1783     /* Log append */
1784     WriteOnOff(Section, "LogAppend", FName, ts->Append);
1785    
1786     /* File transfer binary flag */
1787     WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1788    
1789     /* Log with timestamp (2006.7.23 maya) */
1790     WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1791    
1792     /* Log without transfer dialog */
1793     WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1794    
1795     /* Default Log file name (2006.8.28 maya) */
1796     WritePrivateProfileString(Section, "LogDefaultName",
1797     ts->LogDefaultName, FName);
1798    
1799     /* Default Log file path (2007.5.30 maya) */
1800     WritePrivateProfileString(Section, "LogDefaultPath",
1801     ts->LogDefaultPath, FName);
1802    
1803     /* Auto start logging (2007.5.31 maya) */
1804     WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1805    
1806     /* XMODEM option */
1807     switch (ts->XmodemOpt) {
1808     case XoptCRC:
1809     strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
1810     break;
1811     case Xopt1K:
1812     strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
1813     break;
1814     default:
1815     strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
1816     }
1817     WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
1818    
1819     /* XMODEM binary flag */
1820     WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
1821    
1822     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1823     WritePrivateProfileString(Section, "XmodemRcvCommand",
1824     ts->XModemRcvCommand, FName);
1825    
1826     /* Default directory for file transfer */
1827     WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
1828    
1829     /* filter on file send (2007.6.5 maya) */
1830     WritePrivateProfileString(Section, "FileSendFilter",
1831     ts->FileSendFilter, FName);
1832    
1833     /*------------------------------------------------------------------*/
1834     /* 8 bit control code flag -- special option */
1835     WriteOnOff(Section, "Accept8BitCtrl", FName,
1836     (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
1837    
1838     /* Wrong sequence flag -- special option */
1839     WriteOnOff(Section, "AllowWrongSequence", FName,
1840     (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
1841    
1842     /* Auto file renaming --- special option */
1843     WriteOnOff(Section, "AutoFileRename", FName,
1844     (WORD) (ts->FTFlag & FT_RENAME));
1845    
1846     /* Auto text copy --- special option */
1847     WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
1848    
1849     /* Back wrap -- special option */
1850     WriteOnOff(Section, "BackWrap", FName,
1851     (WORD) (ts->TermFlag & TF_BACKWRAP));
1852    
1853     /* Beep type -- special option */
1854     WriteOnOff(Section, "Beep", FName, ts->Beep);
1855     switch (ts->Beep) {
1856     case IdBeepOff:
1857 doda 3278 WritePrivateProfileString(Section, "Beep", "off", FName);
1858 maya 3227 break;
1859     case IdBeepOn:
1860 doda 3278 WritePrivateProfileString(Section, "Beep", "on", FName);
1861 maya 3227 break;
1862     case IdBeepVisual:
1863 doda 3278 WritePrivateProfileString(Section, "Beep", "visual", FName);
1864 maya 3227 break;
1865     }
1866    
1867     /* Beep on connection & disconnection -- special option */
1868     WriteOnOff(Section, "BeepOnConnect", FName,
1869     (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
1870    
1871     /* Auto B-Plus activation -- special option */
1872     WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
1873    
1874     /* B-Plus ESCCTL flag -- special option */
1875     WriteOnOff(Section, "BPEscCtl", FName,
1876     (WORD) (ts->FTFlag & FT_BPESCCTL));
1877    
1878     /* B-Plus log -- special option */
1879     WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
1880    
1881     /* Clear serial port buffer when port opening -- special option */
1882     WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
1883    
1884     /* Confirm disconnection -- special option */
1885     WriteOnOff(Section, "ConfirmDisconnect", FName,
1886     (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
1887    
1888     /* Ctrl code in Kanji -- special option */
1889     WriteOnOff(Section, "CtrlInKanji", FName,
1890     (WORD) (ts->TermFlag & TF_CTRLINKANJI));
1891    
1892     /* Debug flag -- special option */
1893     WriteOnOff(Section, "Debug", FName, ts->Debug);
1894    
1895     /* Delimiter list -- special option */
1896     Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
1897     sizeof(Temp) - 1, TRUE);
1898     WritePrivateProfileString(Section, "DelimList", Temp, FName);
1899    
1900     /* regard DBCS characters as delimiters -- special option */
1901     WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
1902    
1903     // Enable popup menu -- special option
1904     if ((ts->MenuFlag & MF_NOPOPUP) == 0)
1905     WriteOnOff(Section, "EnablePopupMenu", FName, 1);
1906     else
1907     WriteOnOff(Section, "EnablePopupMenu", FName, 0);
1908    
1909     // Enable "Show menu" -- special option
1910     if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
1911     WriteOnOff(Section, "EnableShowMenu", FName, 1);
1912     else
1913     WriteOnOff(Section, "EnableShowMenu", FName, 0);
1914    
1915     /* Enable the status line -- special option */
1916     WriteOnOff(Section, "EnableStatusLine", FName,
1917     (WORD) (ts->TermFlag & TF_ENABLESLINE));
1918    
1919     /* IME Flag -- special option */
1920     WriteOnOff(Section, "IME", FName, ts->UseIME);
1921    
1922     /* IME-inline Flag -- special option */
1923     WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
1924    
1925     /* Kermit log -- special option */
1926     WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
1927    
1928     // Enable language selection -- special option
1929     if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
1930     WriteOnOff(Section, "LanguageSelection", FName, 1);
1931     else
1932     WriteOnOff(Section, "LanguageSelection", FName, 0);
1933    
1934     /* Maximum scroll buffer size -- special option */
1935     WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
1936    
1937     /* Max com port number -- special option */
1938     WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
1939    
1940     /* Non-blinking cursor -- special option */
1941     WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
1942    
1943     WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
1944    
1945     /* Delay for pass-thru printing activation */
1946     /* -- special option */
1947     WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
1948    
1949     /* Printer port for pass-thru printing */
1950     /* -- special option */
1951     WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
1952    
1953     /* Printer Font --- special option */
1954     WriteFont(Section, "PrnFont", FName,
1955     ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
1956     ts->PrnFontCharSet);
1957    
1958     // Page margins (left, right, top, bottom) for printing
1959     // -- special option
1960     WriteInt4(Section, "PrnMargin", FName,
1961     ts->PrnMargin[0], ts->PrnMargin[1],
1962     ts->PrnMargin[2], ts->PrnMargin[3]);
1963    
1964     /* Quick-VAN log -- special option */
1965     WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
1966    
1967     /* Quick-VAN window size -- special */
1968     WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
1969    
1970     /* Russian character set (print) -- special option */
1971     id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
1972     WritePrivateProfileString(Section, "RussPrint", Temp, FName);
1973    
1974     /* Scroll threshold -- special option */
1975     WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
1976    
1977     WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
1978    
1979     // Select on activate -- special option
1980     WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
1981    
1982     /* Send 8bit control sequence -- special option */
1983     WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
1984    
1985     /* Startup macro -- special option */
1986     WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
1987    
1988     /* TEK GIN Mouse keycode -- special option */
1989     WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
1990    
1991     /* Telnet Auto Detect -- special option */
1992     WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
1993    
1994     /* Telnet binary flag -- special option */
1995     WriteOnOff(Section, "TelBin", FName, ts->TelBin);
1996    
1997     /* Telnet Echo flag -- special option */
1998     WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
1999    
2000     /* Telnet log -- special option */
2001     WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2002    
2003     /* TCP port num for telnet -- special option */
2004     WriteUint(Section, "TelPort", FName, ts->TelPort);
2005    
2006     /* Telnet keep-alive packet(NOP command) interval -- special option */
2007     WriteUint(Section, "TelKeepAliveInterval", FName,
2008     ts->TelKeepAliveInterval);
2009    
2010     /* Max number of broadcast commad history */
2011     WriteUint(Section, "MaxBroadcatHistory", FName,
2012     ts->MaxBroadcatHistory);
2013    
2014     /* Local echo for non-telnet */
2015     WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2016    
2017     /* "new-line (transmit)" option for non-telnet -- special option */
2018     if (ts->TCPCRSend == IdCRLF)
2019     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2020     else if (ts->TCPCRSend == IdCR)
2021     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2022     else
2023     Temp[0] = 0;
2024     WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2025    
2026     /* Use text (background) color for "white (black)"
2027     --- special option */
2028     WriteOnOff(Section, "UseTextColor", FName,
2029     (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2030    
2031     /* Title format -- special option */
2032     WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2033    
2034     /* VT Compatible Tab -- special option */
2035     WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2036    
2037     /* VT Font space --- special option */
2038     WriteInt4(Section, "VTFontSpace", FName,
2039     ts->FontDX, ts->FontDW - ts->FontDX,
2040     ts->FontDY, ts->FontDH - ts->FontDY);
2041    
2042     // VT-print scaling factors (pixels per inch) --- special option
2043     WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2044    
2045     // TEK-print scaling factors (pixels per inch) --- special option
2046     WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2047    
2048     // Show "Window" menu -- special option
2049     WriteOnOff(Section, "WindowMenu", FName,
2050     (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2051    
2052     /* XMODEM log -- special option */
2053     WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2054    
2055     /* YMODEM log -- special option */
2056     WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2057    
2058     /* Auto ZMODEM activation -- special option */
2059     WriteOnOff(Section, "ZmodemAuto", FName,
2060     (WORD) (ts->FTFlag & FT_ZAUTO));
2061    
2062     /* ZMODEM data subpacket length for sending -- special */
2063     WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2064     /* ZMODEM window size for sending -- special */
2065     WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2066    
2067     /* ZMODEM ESCCTL flag -- special option */
2068     WriteOnOff(Section, "ZmodemEscCtl", FName,
2069     (WORD) (ts->FTFlag & FT_ZESCCTL));
2070    
2071     /* ZMODEM log -- special option */
2072     WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2073    
2074     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2075     WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2076    
2077     /* update file */
2078     WritePrivateProfileString(NULL, NULL, NULL, FName);
2079    
2080     // Eterm lookfeel alphablend (2005.4.24 yutaka)
2081     #define ETERM_SECTION "BG"
2082     WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2083     ts->EtermLookfeel.BGEnable);
2084     WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2085     ts->EtermLookfeel.BGUseAlphaBlendAPI);
2086     WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2087     ts->EtermLookfeel.BGSPIPath, FName);
2088     WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2089     ts->EtermLookfeel.BGFastSizeMove);
2090     WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2091     ts->EtermLookfeel.BGNoCopyBits);
2092     WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2093     ts->EtermLookfeel.BGNoFrame);
2094     WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2095     ts->EtermLookfeel.BGThemeFile, FName);
2096    
2097     #ifdef USE_NORMAL_BGCOLOR
2098     // UseNormalBGColor
2099     WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2100     #endif
2101    
2102     // UI language message file
2103     WritePrivateProfileString(Section, "UILanguageFile",
2104     ts->UILanguageFile_ini, FName);
2105    
2106     // Broadcast Command History (2007.3.3 maya)
2107     WriteOnOff(Section, "BroadcastCommandHistory", FName,
2108     ts->BroadcastCommandHistory);
2109    
2110     // 337: 2007/03/20 Accept Broadcast
2111     WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2112    
2113     // Confirm send a file when drag and drop (2007.12.28 maya)
2114     WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2115     ts->ConfirmFileDragAndDrop);
2116    
2117     // Translate mouse wheel to cursor key when application cursor mode
2118     WriteOnOff(Section, "TranslateWheelToCursor", FName,
2119     ts->TranslateWheelToCursor);
2120    
2121     // Display "New Connection" dialog on startup (2008.1.18 maya)
2122     WriteOnOff(Section, "HostDialogOnStartup", FName,
2123     ts->HostDialogOnStartup);
2124    
2125     // Mouse event tracking
2126     WriteOnOff(Section, "MouseEventTracking", FName,
2127     ts->MouseEventTracking);
2128    
2129     // Maximized bug tweak
2130     WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2131    
2132     // Convert Unicode symbol characters to DEC Special characters
2133     WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2134    
2135     // VT Window Icon
2136     IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2137     WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2138    
2139     // Tek Window Icon
2140     IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2141     WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2142    
2143     // AutoScrollOnlyInBottomLine
2144     WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2145     ts->AutoScrollOnlyInBottomLine);
2146    
2147     // Unknown Unicode Character
2148     WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2149     ts->UnknownUnicodeCharaAsWide);
2150    
2151     // Accept remote-controlled window title changing
2152     if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2153     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2154     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2155     strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2156     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2157     strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2158     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2159     strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2160     else
2161     Temp[0] = 0;
2162     WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2163    
2164     // Size of paste confirm dialog
2165     WriteInt2(Section, "PasteDialogSize", FName,
2166     ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2167    
2168     // Disable mouse event tracking when Control-Key is pressed.
2169     WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2170     ts->DisableMouseTrackingByCtrl);
2171    
2172     // Disable TranslateWHeelToCursor when Control-Key is pressed.
2173     WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2174     ts->DisableWheelToCursorByCtrl);
2175    
2176     // Strict Key Mapping.
2177     WriteOnOff(Section, "StrictKeyMapping", FName,
2178     ts->StrictKeyMapping);
2179    
2180     // Wait4allMacroCommand
2181     WriteOnOff(Section, "Wait4allMacroCommand", FName,
2182     ts->Wait4allMacroCommand);
2183 maya 3279
2184 maya 3283 // DisableMenuSendBreak
2185     WriteOnOff(Section, "DisableMenuSendBreak", FName,
2186 maya 3284 ts->DisableMenuSendBreak);
2187 maya 3280
2188     // ClearScreenOnCloseConnection
2189     WriteOnOff(Section, "ClearScreenOnCloseConnection", FName,
2190     ts->ClearScreenOnCloseConnection);
2191 maya 3282
2192     // DisableAcceleratorDuplicateSession
2193     WriteOnOff(Section, "DisableAcceleratorDuplicateSession", FName,
2194     ts->DisableAcceleratorDuplicateSession);
2195 maya 3306
2196     // added PasteDelayPerLine (2009.4.12 maya)
2197     WriteInt(Section, "PasteDelayPerLine", FName,
2198     ts->PasteDelayPerLine);
2199 maya 3227 }
2200    
2201     #define VTEditor "VT editor keypad"
2202     #define VTNumeric "VT numeric keypad"
2203     #define VTFunction "VT function keys"
2204     #define XFunction "X function keys"
2205     #define ShortCut "Shortcut keys"
2206    
2207     void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2208     {
2209     char Temp[11];
2210     WORD Num;
2211    
2212     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2213     if (Temp[0] == 0)
2214     Num = 0xFFFF;
2215     else if (_stricmp(Temp, "off") == 0)
2216     Num = 0xFFFF;
2217     else if (sscanf(Temp, "%d", &Num) != 1)
2218     Num = 0xFFFF;
2219    
2220     KeyMap->Map[KeyId - 1] = Num;
2221     }
2222    
2223     void FAR PASCAL ReadKeyboardCnf
2224     (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2225     int i, j, Ptr;
2226     char EntName[7];
2227     char TempStr[221];
2228     char KStr[201];
2229    
2230     // clear key map
2231     for (i = 0; i <= IdKeyMax - 1; i++)
2232     KeyMap->Map[i] = 0xFFFF;
2233     for (i = 0; i <= NumOfUserKey - 1; i++) {
2234     KeyMap->UserKeyPtr[i] = 0;
2235     KeyMap->UserKeyLen[i] = 0;
2236     }
2237    
2238     // VT editor keypad
2239     GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2240    
2241     GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2242    
2243     GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2244    
2245     GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2246    
2247     GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2248    
2249     GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2250    
2251     GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2252    
2253     GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2254    
2255     GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2256    
2257     GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2258    
2259     // VT numeric keypad
2260     GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2261    
2262     GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2263    
2264     GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2265    
2266     GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2267    
2268     GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2269    
2270     GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2271    
2272     GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2273    
2274     GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2275    
2276     GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2277    
2278     GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2279    
2280     GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2281    
2282     GetInt(KeyMap, IdComma, VTNumeric, "NumComma", FName);
2283