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 3774 - (hide annotations) (download) (as text)
Mon Feb 8 15:26:07 2010 UTC (14 years, 2 months ago) by doda
File MIME type: text/x-csrc
File size: 101999 byte(s)
TitleReportSequence で受け付ける値を、accept/ignore/empty に変更した。[ttssh2-devel 1623]

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