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 4880 - (hide annotations) (download) (as text)
Thu Apr 5 16:30:06 2012 UTC (12 years ago) by yutakapon
File MIME type: text/x-csrc
File size: 112594 byte(s)
・ウィンドウへのドラッグ&ドロップによるファイル送信において、SCPの送信先パス(teraterm.iniのScpSendDir)
を表示するようにした。
・SSH SCPダイアログで、送信先パスのデフォルトをteraterm.iniのScpSendDirから設定するようにした。

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