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 4699 - (hide annotations) (download) (as text)
Tue Nov 1 09:17:08 2011 UTC (12 years, 5 months ago) by doda
File MIME type: text/x-csrc
File size: 108224 byte(s)
コメント追加

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