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 3887 - (hide annotations) (download) (as text)
Fri May 14 12:21:04 2010 UTC (13 years, 11 months ago) by doda
File MIME type: text/x-csrc
File size: 102379 byte(s)
"ファイル送信" と "ログ" の binary flag を分離。
http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=20881

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