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 4849 - (hide annotations) (download) (as text)
Thu Mar 1 09:14:41 2012 UTC (12 years, 1 month ago) by doda
File MIME type: text/x-csrc
File size: 110903 byte(s)
シリアル接続で、マークパリティ, スペースバリティ, 1.5ストップビットをサポートした。

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