Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4786 - (show annotations) (download) (as text)
Thu Dec 29 12:29:38 2011 UTC (12 years, 3 months ago) by maya
File MIME type: text/x-csrc
File size: 110041 byte(s)
LogStart でログファイルを開くときに排他ロックするかどうかのオプションを作成
  http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=27016
  http://logmett.com/forum/viewtopic.php?f=8&t=1829
1 /* Tera Term
2 Copyright(C) 1994-1998 T. Teranishi
3 All rights reserved. */
4 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
5
6 /* TTSET.DLL, setup file routines*/
7 #ifndef NO_INET6
8 #include <winsock2.h>
9 #include <ws2tcpip.h>
10 #endif /* NO_INET6 */
11 #include "teraterm.h"
12 #include "tttypes.h"
13 #include <stdio.h>
14 #include <string.h>
15 #include <direct.h>
16 #include <ctype.h>
17 #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 "VT320", "VT382", "VT420", "VT520", "VT525", NULL };
27
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 char Temp[MAX_PATH], Temp2[MAX_PATH];
201 OSVERSIONINFO osvi;
202
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 ts->FontFlag = 0; // Font flag
211 ts->PortFlag = 0; // Port flags
212 ts->WindowFlag = 0; // Window flags
213 ts->CtrlFlag = 0; // Control sequence flags
214 ts->TelPort = 23;
215
216 ts->DisableTCPEchoCR = FALSE;
217
218 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
219 GetVersionEx(&osvi);
220
221 /* Version number */
222 /* GetPrivateProfileString(Section,"Version","",
223 Temp,sizeof(Temp),FName); */
224
225 /* Language */
226 GetPrivateProfileString(Section, "Language", "",
227 Temp, sizeof(Temp), FName);
228 if (_stricmp(Temp, "Japanese") == 0)
229 ts->Language = IdJapanese;
230 else if (_stricmp(Temp, "Russian") == 0)
231 ts->Language = IdRussian;
232 else if (_stricmp(Temp, "English") == 0)
233 ts->Language = IdEnglish;
234 else if (_stricmp(Temp,"Korean") == 0) // HKS
235 ts->Language = IdKorean;
236 else if (_stricmp(Temp,"UTF-8") == 0)
237 ts->Language = IdUtf8;
238 else {
239 switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
240 case LANG_JAPANESE:
241 ts->Language = IdJapanese;
242 break;
243 case LANG_RUSSIAN:
244 ts->Language = IdRussian;
245 break;
246 case LANG_KOREAN: // HKS
247 ts->Language = IdKorean;
248 break;
249 default:
250 ts->Language = IdEnglish;
251 }
252 }
253
254 /* Port type */
255 GetPrivateProfileString(Section, "Port", "",
256 Temp, sizeof(Temp), FName);
257 if (_stricmp(Temp, "tcpip") == 0)
258 ts->PortType = IdTCPIP;
259 else if (_stricmp(Temp, "serial") == 0)
260 ts->PortType = IdSerial;
261 else {
262 ts->PortType = IdTCPIP;
263 }
264
265 /* VT win position */
266 GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
267 GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
268 GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
269
270 /* TEK win position */
271 GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
272 GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
273 GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
274
275 /* Save VT Window position */
276 ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
277
278 /* VT terminal size */
279 GetPrivateProfileString(Section, "TerminalSize", "80,24",
280 Temp, sizeof(Temp), FName);
281 GetNthNum(Temp, 1, &ts->TerminalWidth);
282 GetNthNum(Temp, 2, &ts->TerminalHeight);
283 if (ts->TerminalWidth < 0)
284 ts->TerminalWidth = 1;
285 if (ts->TerminalHeight < 0)
286 ts->TerminalHeight = 1;
287
288 /* Terminal size = Window size */
289 ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
290
291 /* Auto window resize flag */
292 ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
293
294 /* CR Receive */
295 GetPrivateProfileString(Section, "CRReceive", "",
296 Temp, sizeof(Temp), FName);
297 if (_stricmp(Temp, "CRLF") == 0) {
298 ts->CRReceive = IdCRLF;
299 }
300 else if (_stricmp(Temp, "LF") == 0) {
301 ts->CRReceive = IdLF;
302 }
303 else {
304 ts->CRReceive = IdCR;
305 }
306 /* CR Send */
307 GetPrivateProfileString(Section, "CRSend", "",
308 Temp, sizeof(Temp), FName);
309 if (_stricmp(Temp, "CRLF") == 0)
310 ts->CRSend = IdCRLF;
311 else
312 ts->CRSend = IdCR;
313 ts->CRSend_ini = ts->CRSend;
314
315 /* Local echo */
316 ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
317 ts->LocalEcho_ini = ts->LocalEcho;
318
319 /* Answerback */
320 GetPrivateProfileString(Section, "Answerback", "", Temp,
321 sizeof(Temp), FName);
322 ts->AnswerbackLen =
323 Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
324
325 /* Kanji Code (receive) */
326 GetPrivateProfileString(Section, "KanjiReceive", "",
327 Temp, sizeof(Temp), FName);
328 if (_stricmp(Temp, "EUC") == 0)
329 ts->KanjiCode = IdEUC;
330 else if (_stricmp(Temp, "JIS") == 0)
331 ts->KanjiCode = IdJIS;
332 else if (_stricmp(Temp, "UTF-8") == 0)
333 ts->KanjiCode = IdUTF8;
334 else if (_stricmp(Temp, "UTF-8m") == 0)
335 ts->KanjiCode = IdUTF8m;
336 else if (_stricmp(Temp, "KS5601") == 0)
337 ts->KanjiCode = IdSJIS;
338 else
339 ts->KanjiCode = IdSJIS;
340 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
341 {
342 WORD KanjiCode = ts->KanjiCode;
343 ts->KanjiCode = KanjiCodeTranslate(ts->Language,KanjiCode);
344 }
345
346 /* Katakana (receive) */
347 GetPrivateProfileString(Section, "KatakanaReceive", "",
348 Temp, sizeof(Temp), FName);
349 if (_stricmp(Temp, "7") == 0)
350 ts->JIS7Katakana = 1;
351 else
352 ts->JIS7Katakana = 0;
353
354 /* Kanji Code (transmit) */
355 GetPrivateProfileString(Section, "KanjiSend", "",
356 Temp, sizeof(Temp), FName);
357 if (_stricmp(Temp, "EUC") == 0)
358 ts->KanjiCodeSend = IdEUC;
359 else if (_stricmp(Temp, "JIS") == 0)
360 ts->KanjiCodeSend = IdJIS;
361 else if (_stricmp(Temp, "UTF-8") == 0)
362 ts->KanjiCodeSend = IdUTF8;
363 else if (_stricmp(Temp, "KS5601") == 0)
364 ts->KanjiCode = IdSJIS;
365 else
366 ts->KanjiCodeSend = IdSJIS;
367 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
368 {
369 WORD KanjiCodeSend = ts->KanjiCodeSend;
370 ts->KanjiCodeSend = KanjiCodeTranslate(ts->Language,KanjiCodeSend);
371 }
372
373 /* Katakana (receive) */
374 GetPrivateProfileString(Section, "KatakanaSend", "",
375 Temp, sizeof(Temp), FName);
376 if (_stricmp(Temp, "7") == 0)
377 ts->JIS7KatakanaSend = 1;
378 else
379 ts->JIS7KatakanaSend = 0;
380
381 /* KanjiIn */
382 GetPrivateProfileString(Section, "KanjiIn", "",
383 Temp, sizeof(Temp), FName);
384 if (_stricmp(Temp, "@") == 0)
385 ts->KanjiIn = IdKanjiInA;
386 else
387 ts->KanjiIn = IdKanjiInB;
388
389 /* KanjiOut */
390 GetPrivateProfileString(Section, "KanjiOut", "",
391 Temp, sizeof(Temp), FName);
392 if (_stricmp(Temp, "B") == 0)
393 ts->KanjiOut = IdKanjiOutB;
394 else if (_stricmp(Temp, "H") == 0)
395 ts->KanjiOut = IdKanjiOutH;
396 else
397 ts->KanjiOut = IdKanjiOutJ;
398
399 /* Auto Win Switch VT<->TEK */
400 ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
401
402 /* Terminal ID */
403 GetPrivateProfileString(Section, "TerminalID", "",
404 Temp, sizeof(Temp), FName);
405 ts->TerminalID = str2id(TermList, Temp, IdVT100);
406
407 /* Russian character set (host) */
408 GetPrivateProfileString(Section, "RussHost", "",
409 Temp, sizeof(Temp), FName);
410 ts->RussHost = str2id(RussList, Temp, IdKOI8);
411
412 /* Russian character set (client) */
413 GetPrivateProfileString(Section, "RussClient", "",
414 Temp, sizeof(Temp), FName);
415 ts->RussClient = str2id(RussList, Temp, IdWindows);
416
417 /* Title String */
418 GetPrivateProfileString(Section, "Title", "Tera Term",
419 ts->Title, sizeof(ts->Title), FName);
420
421 /* Cursor shape */
422 GetPrivateProfileString(Section, "CursorShape", "",
423 Temp, sizeof(Temp), FName);
424 if (_stricmp(Temp, "vertical") == 0)
425 ts->CursorShape = IdVCur;
426 else if (_stricmp(Temp, "horizontal") == 0)
427 ts->CursorShape = IdHCur;
428 else
429 ts->CursorShape = IdBlkCur;
430
431 /* Hide title */
432 ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
433
434 /* Popup menu */
435 ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
436
437 /* PC-Style bold color mapping */
438 if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
439 ts->ColorFlag |= CF_PCBOLD16;
440
441 /* aixterm style 16 colors mode */
442 if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
443 ts->ColorFlag |= CF_AIXTERM16;
444
445 /* xterm style 256 colors mode */
446 if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
447 ts->ColorFlag |= CF_XTERM256;
448
449 /* Enable scroll buffer */
450 ts->EnableScrollBuff =
451 GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
452
453 /* Scroll buffer size */
454 ts->ScrollBuffSize =
455 GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
456
457 /* VT Color */
458 GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
459 Temp, sizeof(Temp), FName);
460 for (i = 0; i <= 5; i++)
461 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
462 for (i = 0; i <= 1; i++)
463 ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
464 (BYTE) ts->TmpColor[0][i * 3 + 1],
465 (BYTE) ts->TmpColor[0][i * 3 + 2]);
466
467 /* VT Bold Color */
468 GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
469 Temp, sizeof(Temp), FName);
470 for (i = 0; i <= 5; i++)
471 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
472 for (i = 0; i <= 1; i++)
473 ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
474 (BYTE) ts->TmpColor[0][i * 3 + 1],
475 (BYTE) ts->TmpColor[0][i * 3 + 2]);
476 if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
477 ts->ColorFlag |= CF_BOLDCOLOR;
478
479 /* VT Blink Color */
480 GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
481 Temp, sizeof(Temp), FName);
482 for (i = 0; i <= 5; i++)
483 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
484 for (i = 0; i <= 1; i++)
485 ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
486 (BYTE) ts->TmpColor[0][i * 3 + 1],
487 (BYTE) ts->TmpColor[0][i * 3 + 2]);
488 if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
489 ts->ColorFlag |= CF_BLINKCOLOR;
490
491 /* VT Reverse Color */
492 GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
493 Temp, sizeof(Temp), FName);
494 for (i = 0; i <= 5; i++)
495 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
496 for (i = 0; i <= 1; i++)
497 ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
498 (BYTE) ts->TmpColor[0][i * 3 + 1],
499 (BYTE) ts->TmpColor[0][i * 3 + 2]);
500 if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
501 ts->ColorFlag |= CF_REVERSECOLOR;
502
503 ts->EnableClickableUrl =
504 GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
505
506 /* URL Color */
507 GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
508 Temp, sizeof(Temp), FName);
509 for (i = 0; i <= 5; i++)
510 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
511 for (i = 0; i <= 1; i++)
512 ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
513 (BYTE) ts->TmpColor[0][i * 3 + 1],
514 (BYTE) ts->TmpColor[0][i * 3 + 2]);
515 if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
516 ts->ColorFlag |= CF_URLCOLOR;
517
518 if (GetOnOff(Section, "URLUnderline", FName, TRUE))
519 ts->FontFlag |= FF_URLUNDERLINE;
520
521 /* TEK Color */
522 GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
523 Temp, sizeof(Temp), FName);
524 for (i = 0; i <= 5; i++)
525 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
526 for (i = 0; i <= 1; i++)
527 ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
528 (BYTE) ts->TmpColor[0][i * 3 + 1],
529 (BYTE) ts->TmpColor[0][i * 3 + 2]);
530
531 #ifndef NO_ANSI_COLOR_EXTENSION
532 /* ANSI color definition (in the case FullColor=on) -- special option
533 o UseTextColor should be off, or the background and foreground color of
534 VTColor are assigned to color-number 0 and 7 respectively, even if
535 they are specified in ANSIColor.
536 o ANSIColor is a set of 4 values that are color-number(0--15),
537 red-value(0--255), green-value(0--255) and blue-value(0--255). */
538 GetPrivateProfileString(Section, "ANSIColor",
539 " 0, 0, 0, 0,"
540 " 1,255, 0, 0,"
541 " 2, 0,255, 0,"
542 " 3,255,255, 0,"
543 " 4, 0, 0,255,"
544 " 5,255, 0,255,"
545 " 6, 0,255,255,"
546 " 7,255,255,255,"
547 " 8,128,128,128,"
548 " 9,128, 0, 0,"
549 "10, 0,128, 0,"
550 "11,128,128, 0,"
551 "12, 0, 0,128,"
552 "13,128, 0,128,"
553 "14, 0,128,128,"
554 "15,192,192,192", Temp, sizeof(Temp), FName);
555 {
556 char *t;
557 int n = 1;
558 for (t = Temp; *t; t++)
559 if (*t == ',')
560 n++;
561 n /= 4;
562 for (i = 0; i < n; i++) {
563 int colorid, r, g, b;
564 GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
565 GetNthNum(Temp, i * 4 + 2, (int far *) &r);
566 GetNthNum(Temp, i * 4 + 3, (int far *) &g);
567 GetNthNum(Temp, i * 4 + 4, (int far *) &b);
568 ts->ANSIColor[colorid & 15] =
569 RGB((BYTE) r, (BYTE) g, (BYTE) b);
570 }
571 }
572 #endif /* NO_ANSI_COLOR_EXTENSION */
573
574 TmpDC = GetDC(0); /* Get screen device context */
575 for (i = 0; i <= 1; i++)
576 ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
577 for (i = 0; i <= 1; i++)
578 ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
579 for (i = 0; i <= 1; i++)
580 ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
581 for (i = 0; i <= 1; i++)
582 ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
583 /* begin - ishizaki */
584 for (i = 0; i <= 1; i++)
585 ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
586 /* end - ishizaki */
587 #ifndef NO_ANSI_COLOR_EXTENSION
588 for (i = 0; i < 16; i++)
589 ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
590 #endif /* NO_ANSI_COLOR_EXTENSION */
591 ReleaseDC(0, TmpDC);
592 if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
593 ts->ColorFlag |= CF_ANSICOLOR;
594
595 /* TEK color emulation */
596 ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
597
598 /* VT Font */
599 GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
600 Temp, sizeof(Temp), FName);
601 GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
602 GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
603 GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
604 GetNthNum(Temp, 4, &(ts->VTFontCharSet));
605
606 /* Bold font flag */
607 if (GetOnOff(Section, "EnableBold", FName, TRUE))
608 ts->FontFlag |= FF_BOLD;
609
610 /* Russian character set (font) */
611 GetPrivateProfileString(Section, "RussFont", "",
612 Temp, sizeof(Temp), FName);
613 ts->RussFont = str2id(RussList, Temp, IdWindows);
614
615 /* TEK Font */
616 GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
617 Temp, sizeof(Temp), FName);
618 GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
619 GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
620 GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
621 GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
622
623 /* BS key */
624 GetPrivateProfileString(Section, "BSKey", "",
625 Temp, sizeof(Temp), FName);
626 if (_stricmp(Temp, "DEL") == 0)
627 ts->BSKey = IdDEL;
628 else
629 ts->BSKey = IdBS;
630 /* Delete key */
631 ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
632
633 /* Meta Key */
634 GetPrivateProfileString(Section, "MetaKey", "off", Temp, sizeof(Temp), FName);
635 if (_stricmp(Temp, "on") == 0)
636 ts->MetaKey = IdMetaOn;
637 else if (_stricmp(Temp, "left") == 0)
638 ts->MetaKey = IdMetaLeft;
639 else if (_stricmp(Temp, "right") == 0)
640 ts->MetaKey = IdMetaRight;
641 else
642 ts->MetaKey = IdMetaOff;
643
644 // Windows95 �n�����E�� Alt ��������������
645 if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && ts->MetaKey != IdMetaOff) {
646 ts->MetaKey = IdMetaOn;
647 }
648
649 /* Application Keypad */
650 ts->DisableAppKeypad =
651 GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
652
653 /* Application Cursor */
654 ts->DisableAppCursor =
655 GetOnOff(Section, "DisableAppCursor", FName, FALSE);
656
657 /* Russian keyboard type */
658 GetPrivateProfileString(Section, "RussKeyb", "",
659 Temp, sizeof(Temp), FName);
660 ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
661
662 /* Serial port ID */
663 ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
664
665 /* Baud rate */
666 ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName);
667
668 /* Parity */
669 GetPrivateProfileString(Section, "Parity", "",
670 Temp, sizeof(Temp), FName);
671 if (_stricmp(Temp, "even") == 0)
672 ts->Parity = IdParityEven;
673 else if (_stricmp(Temp, "odd") == 0)
674 ts->Parity = IdParityOdd;
675 else
676 ts->Parity = IdParityNone;
677
678 /* Data bit */
679 GetPrivateProfileString(Section, "DataBit", "",
680 Temp, sizeof(Temp), FName);
681 if (_stricmp(Temp, "7") == 0)
682 ts->DataBit = IdDataBit7;
683 else
684 ts->DataBit = IdDataBit8;
685
686 /* Stop bit */
687 GetPrivateProfileString(Section, "StopBit", "",
688 Temp, sizeof(Temp), FName);
689 if (_stricmp(Temp, "2") == 0)
690 ts->StopBit = IdStopBit2;
691 else
692 ts->StopBit = IdStopBit1;
693
694 /* Flow control */
695 GetPrivateProfileString(Section, "FlowCtrl", "",
696 Temp, sizeof(Temp), FName);
697 if (_stricmp(Temp, "x") == 0)
698 ts->Flow = IdFlowX;
699 else if (_stricmp(Temp, "hard") == 0)
700 ts->Flow = IdFlowHard;
701 else
702 ts->Flow = IdFlowNone;
703
704 /* Delay per character */
705 ts->DelayPerChar =
706 GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
707
708 /* Delay per line */
709 ts->DelayPerLine =
710 GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
711
712 /* Telnet flag */
713 ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
714
715 /* Telnet terminal type */
716 GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
717 sizeof(ts->TermType), FName);
718
719 /* TCP port num */
720 ts->TCPPort =
721 GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
722
723 /* Auto window close flag */
724 ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
725
726 /* History list */
727 ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
728
729 /* File transfer binary flag */
730 ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
731
732 /* Log binary flag */
733 ts->LogBinary = GetOnOff(Section, "LogBinary", FName, FALSE);
734
735 /* Log append */
736 ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
737
738 /* Log plain text (2005.5.7 yutaka) */
739 ts->LogTypePlainText =
740 GetOnOff(Section, "LogTypePlainText", FName, FALSE);
741
742 /* Log with timestamp (2006.7.23 maya) */
743 ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
744
745 /* Log without transfer dialog */
746 ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
747
748 /* Default Log file name (2006.8.28 maya) */
749 GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
750 ts->LogDefaultName, sizeof(ts->LogDefaultName),
751 FName);
752
753 /* Default Log file path (2007.5.30 maya) */
754 GetPrivateProfileString(Section, "LogDefaultPath", "",
755 ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
756 FName);
757
758 /* Auto start logging (2007.5.31 maya) */
759 ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
760
761 /* XMODEM option */
762 GetPrivateProfileString(Section, "XmodemOpt", "",
763 Temp, sizeof(Temp), FName);
764 if (_stricmp(Temp, "crc") == 0)
765 ts->XmodemOpt = XoptCRC;
766 else if (_stricmp(Temp, "1k") == 0)
767 ts->XmodemOpt = Xopt1K;
768 else
769 ts->XmodemOpt = XoptCheck;
770
771 /* XMODEM binary file */
772 ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
773
774 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
775 GetPrivateProfileString(Section, "XModemRcvCommand", "",
776 ts->XModemRcvCommand,
777 sizeof(ts->XModemRcvCommand), FName);
778
779 /* Default directory for file transfer */
780 GetPrivateProfileString(Section, "FileDir", "",
781 ts->FileDir, sizeof(ts->FileDir), FName);
782 if (strlen(ts->FileDir) == 0)
783 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
784 else {
785 _getcwd(Temp, sizeof(Temp));
786 if (_chdir(ts->FileDir) != 0)
787 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
788 _chdir(Temp);
789 }
790
791 /* filter on file send (2007.6.5 maya) */
792 GetPrivateProfileString(Section, "FileSendFilter", "",
793 ts->FileSendFilter, sizeof(ts->FileSendFilter),
794 FName);
795
796 /*--------------------------------------------------*/
797 /* 8 bit control code flag -- special option */
798 if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
799 ts->TermFlag |= TF_ACCEPT8BITCTRL;
800
801 /* Wrong sequence flag -- special option */
802 if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
803 ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
804
805 if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
806 (ts->KanjiOut == IdKanjiOutH))
807 ts->KanjiOut = IdKanjiOutJ;
808
809 // Auto file renaming --- special option
810 if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
811 ts->FTFlag |= FT_RENAME;
812
813 // Auto invoking (character set->G0->GL) --- special option
814 if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
815 ts->TermFlag |= TF_AUTOINVOKE;
816
817 // Auto text copy --- special option
818 ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
819
820 /* Back wrap -- special option */
821 if (GetOnOff(Section, "BackWrap", FName, FALSE))
822 ts->TermFlag |= TF_BACKWRAP;
823
824 /* Beep type -- special option */
825 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
826 if (_stricmp(Temp, "off") == 0)
827 ts->Beep = IdBeepOff;
828 else if (_stricmp(Temp, "visual") == 0)
829 ts->Beep = IdBeepVisual;
830 else
831 ts->Beep = IdBeepOn;
832
833 /* Beep on connection & disconnection -- special option */
834 if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
835 ts->PortFlag |= PF_BEEPONCONNECT;
836
837 /* Auto B-Plus activation -- special option */
838 if (GetOnOff(Section, "BPAuto", FName, FALSE))
839 ts->FTFlag |= FT_BPAUTO;
840 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
841 strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
842 _TRUNCATE);
843 ts->AnswerbackLen = 5;
844 }
845
846 /* B-Plus ESCCTL flag -- special option */
847 if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
848 ts->FTFlag |= FT_BPESCCTL;
849
850 /* B-Plus log -- special option */
851 if (GetOnOff(Section, "BPLog", FName, FALSE))
852 ts->LogFlag |= LOG_BP;
853
854 /* Clear serial port buffer when port opening -- special option */
855 ts->ClearComBuffOnOpen =
856 GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
857
858 /* Confirm disconnection -- special option */
859 if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
860 ts->PortFlag |= PF_CONFIRMDISCONN;
861
862 /* Ctrl code in Kanji -- special option */
863 if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
864 ts->TermFlag |= TF_CTRLINKANJI;
865
866 /* Debug flag -- special option */
867 ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
868
869 /* Delimiter list -- special option */
870 GetPrivateProfileString(Section, "DelimList",
871 "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
872 Temp, sizeof(Temp), FName);
873 Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
874
875 /* regard DBCS characters as delimiters -- special option */
876 ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
877
878 // Enable popup menu -- special option
879 if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
880 ts->MenuFlag |= MF_NOPOPUP;
881
882 // Enable "Show menu" -- special option
883 if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
884 ts->MenuFlag |= MF_NOSHOWMENU;
885
886 // Enable the status line -- special option
887 if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
888 ts->TermFlag |= TF_ENABLESLINE;
889
890 // fixed JIS --- special
891 if (GetOnOff(Section, "FixedJIS", FName, FALSE))
892 ts->TermFlag |= TF_FIXEDJIS;
893
894 /* IME Flag -- special option */
895 ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
896
897 /* IME-inline Flag -- special option */
898 ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
899
900 /* Kermit log -- special option */
901 if (GetOnOff(Section, "KmtLog", FName, FALSE))
902 ts->LogFlag |= LOG_KMT;
903
904 // Enable language selection -- special option
905 if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
906 ts->MenuFlag |= MF_NOLANGUAGE;
907
908 /* Maximum scroll buffer size -- special option */
909 ts->ScrollBuffMax =
910 GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
911 if (ts->ScrollBuffMax < 24)
912 ts->ScrollBuffMax = 10000;
913
914 /* Max com port number -- special option */
915 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
916 if (ts->MaxComPort < 4)
917 ts->MaxComPort = 4;
918 // COM16����99���g�� (2005.11.30 yutaka)
919 // 99����200���g�� (2007.7.23 maya)
920 if (ts->MaxComPort > MAXCOMPORT)
921 ts->MaxComPort = MAXCOMPORT;
922 if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
923 ts->ComPort = 1;
924
925 /* Non-blinking cursor -- special option */
926 ts->NonblinkingCursor =
927 GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
928
929 // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
930 ts->KillFocusCursor =
931 GetOnOff(Section, "KillFocusCursor", FName, TRUE);
932
933 /* Delay for pass-thru printing activation */
934 /* -- special option */
935 ts->PassThruDelay =
936 GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
937
938 /* Printer port for pass-thru printing */
939 /* -- special option */
940 GetPrivateProfileString(Section, "PassThruPort", "",
941 ts->PrnDev, sizeof(ts->PrnDev), FName);
942
943 /* �v�����^�p�����R�[�h�������t������ */
944 if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE))
945 ts->TermFlag |= TF_PRINTERCTRL;
946
947 /* Printer Font --- special option */
948 GetPrivateProfileString(Section, "PrnFont", "",
949 Temp, sizeof(Temp), FName);
950 if (strlen(Temp) == 0) {
951 ts->PrnFont[0] = 0;
952 ts->PrnFontSize.x = 0;
953 ts->PrnFontSize.y = 0;
954 ts->PrnFontCharSet = 0;
955 }
956 else {
957 GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
958 GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
959 GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
960 GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
961 }
962
963 // Page margins (left, right, top, bottom) for printing
964 // -- special option
965 GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
966 Temp, sizeof(Temp), FName);
967 for (i = 0; i <= 3; i++)
968 GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
969
970 /* Quick-VAN log -- special option */
971 if (GetOnOff(Section, "QVLog", FName, FALSE))
972 ts->LogFlag |= LOG_QV;
973
974 /* Quick-VAN window size -- special */
975 ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
976
977 /* Russian character set (print) -- special option */
978 GetPrivateProfileString(Section, "RussPrint", "",
979 Temp, sizeof(Temp), FName);
980 ts->RussPrint = str2id(RussList, Temp, IdWindows);
981
982 /* Scroll threshold -- special option */
983 ts->ScrollThreshold =
984 GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
985
986 ts->MouseWheelScrollLine =
987 GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
988
989 // Select on activate -- special option
990 ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
991
992 /* Send 8bit control sequence -- special option */
993 ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
994
995 /* Startup macro -- special option */
996 GetPrivateProfileString(Section, "StartupMacro", "",
997 ts->MacroFN, sizeof(ts->MacroFN), FName);
998
999 /* TEK GIN Mouse keycode -- special option */
1000 ts->GINMouseCode =
1001 GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
1002
1003 /* Telnet Auto Detect -- special option */
1004 ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
1005
1006 /* Telnet binary flag -- special option */
1007 ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
1008
1009 /* Telnet Echo flag -- special option */
1010 ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
1011
1012 /* Telnet log -- special option */
1013 if (GetOnOff(Section, "TelLog", FName, FALSE))
1014 ts->LogFlag |= LOG_TEL;
1015
1016 /* TCP port num for telnet -- special option */
1017 ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
1018
1019 /* Telnet keep-alive packet(NOP command) interval -- special option */
1020 ts->TelKeepAliveInterval =
1021 GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
1022
1023 /* Max number of broadcast commad history */
1024 ts->MaxBroadcatHistory =
1025 GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
1026
1027 /* Local echo for non-telnet */
1028 ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
1029
1030 /* "new-line (transmit)" option for non-telnet -- special option */
1031 GetPrivateProfileString(Section, "TCPCRSend", "",
1032 Temp, sizeof(Temp), FName);
1033 if (_stricmp(Temp, "CR") == 0)
1034 ts->TCPCRSend = IdCR;
1035 else if (_stricmp(Temp, "CRLF") == 0)
1036 ts->TCPCRSend = IdCRLF;
1037 else
1038 ts->TCPCRSend = 0; // disabled
1039
1040 /* Use text (background) color for "white (black)" --- special option */
1041 if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1042 ts->ColorFlag |= CF_USETEXTCOLOR;
1043
1044 /* Title format -- special option */
1045 ts->TitleFormat =
1046 GetPrivateProfileInt(Section, "TitleFormat", 5, FName);
1047
1048 /* VT Compatible Tab -- special option */
1049 ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1050
1051 /* VT Font space --- special option */
1052 GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1053 Temp, sizeof(Temp), FName);
1054 GetNthNum(Temp, 1, &ts->FontDX);
1055 GetNthNum(Temp, 2, &ts->FontDW);
1056 GetNthNum(Temp, 3, &ts->FontDY);
1057 GetNthNum(Temp, 4, &ts->FontDH);
1058 if (ts->FontDX < 0)
1059 ts->FontDX = 0;
1060 if (ts->FontDW < 0)
1061 ts->FontDW = 0;
1062 ts->FontDW = ts->FontDW + ts->FontDX;
1063 if (ts->FontDY < 0)
1064 ts->FontDY = 0;
1065 if (ts->FontDH < 0)
1066 ts->FontDH = 0;
1067 ts->FontDH = ts->FontDH + ts->FontDY;
1068
1069 // VT-print scaling factors (pixels per inch) --- special option
1070 GetPrivateProfileString(Section, "VTPPI", "0,0",
1071 Temp, sizeof(Temp), FName);
1072 GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1073 GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1074
1075 // TEK-print scaling factors (pixels per inch) --- special option
1076 GetPrivateProfileString(Section, "TEKPPI", "0,0",
1077 Temp, sizeof(Temp), FName);
1078 GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1079 GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1080
1081 // Show "Window" menu -- special option
1082 if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1083 ts->MenuFlag |= MF_SHOWWINMENU;
1084
1085 /* XMODEM log -- special option */
1086 if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1087 ts->LogFlag |= LOG_X;
1088
1089 /* YMODEM log -- special option */
1090 if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1091 ts->LogFlag |= LOG_Y;
1092
1093 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
1094 GetPrivateProfileString(Section, "YModemRcvCommand", "rb",
1095 ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName);
1096
1097 /* Auto ZMODEM activation -- special option */
1098 if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1099 ts->FTFlag |= FT_ZAUTO;
1100
1101 /* ZMODEM data subpacket length for sending -- special */
1102 ts->ZmodemDataLen =
1103 GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1104 /* ZMODEM window size for sending -- special */
1105 ts->ZmodemWinSize =
1106 GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1107
1108 /* ZMODEM ESCCTL flag -- special option */
1109 if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1110 ts->FTFlag |= FT_ZESCCTL;
1111
1112 /* ZMODEM log -- special option */
1113 if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1114 ts->LogFlag |= LOG_Z;
1115
1116 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1117 GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1118 ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1119
1120 #ifndef NO_COPYLINE_FIX
1121
1122 /* Enable continued-line copy -- special option */
1123 ts->EnableContinuedLineCopy =
1124 GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1125 #endif /* NO_COPYLINE_FIX */
1126
1127 ts->DisablePasteMouseRButton =
1128 GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1129
1130 // added DisablePasteMouseMButton (2008.3.2 maya)
1131 ts->DisablePasteMouseMButton =
1132 GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1133
1134 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1135 ts->ConfirmPasteMouseRButton =
1136 GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1137
1138 // added ConfirmChangePaste (2008.2.3 yutaka)
1139 ts->ConfirmChangePaste =
1140 GetOnOff(Section, "ConfirmChangePaste", FName, TRUE);
1141 GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "",
1142 Temp, sizeof(Temp), FName);
1143 strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp,
1144 _TRUNCATE);
1145
1146 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1147 ts->ScrollWindowClearScreen =
1148 GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1149
1150 // added SelectOnlyByLButton (2007.11.20 maya)
1151 ts->SelectOnlyByLButton =
1152 GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1153
1154 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1155 ts->DisableAcceleratorSendBreak =
1156 GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1157
1158 // WinSock connecting timeout value (2007.1.11 yutaka)
1159 ts->ConnectingTimeout =
1160 GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1161
1162 // mouse cursor
1163 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1164 Temp, sizeof(Temp), FName);
1165 strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1166 _TRUNCATE);
1167
1168 // Translucent window
1169 ts->AlphaBlend =
1170 GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1171 ts->AlphaBlend = max(0, ts->AlphaBlend);
1172 ts->AlphaBlend = min(255, ts->AlphaBlend);
1173
1174 // Cygwin install path
1175 GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1176 Temp, sizeof(Temp), FName);
1177 strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1178 _TRUNCATE);
1179
1180 // Viewlog Editor path
1181 if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1)
1182 strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE);
1183 }
1184 else {
1185 Temp[0] = '\0';
1186 }
1187 GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
1188 ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
1189
1190 // Locale for UTF-8
1191 GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1192 Temp, sizeof(Temp), FName);
1193 strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1194
1195 // CodePage
1196 ts->CodePage =
1197 GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1198 FName);
1199
1200 // UI language message file
1201 GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1202 Temp, sizeof(Temp), FName);
1203 {
1204 char CurDir[MAX_PATH];
1205
1206 // �t���p�X�������O������������������������������
1207 strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1208
1209 GetCurrentDirectory(sizeof(CurDir), CurDir);
1210 SetCurrentDirectory(ts->HomeDir);
1211 _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1212 SetCurrentDirectory(CurDir);
1213 }
1214
1215 // Broadcast Command History (2007.3.3 maya)
1216 ts->BroadcastCommandHistory =
1217 GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1218
1219 // 337: 2007/03/20 Accept Broadcast
1220 ts->AcceptBroadcast =
1221 GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1222
1223 // Confirm send a file when drag and drop (2007.12.28 maya)
1224 ts->ConfirmFileDragAndDrop =
1225 GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1226
1227 // Translate mouse wheel to cursor key when application cursor mode
1228 ts->TranslateWheelToCursor =
1229 GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1230
1231 // Display "New Connection" dialog on startup (2008.1.18 maya)
1232 ts->HostDialogOnStartup =
1233 GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1234
1235 // Mouse event tracking
1236 ts->MouseEventTracking =
1237 GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1238
1239 // Maximized bug tweak
1240 ts->MaximizedBugTweak =
1241 GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1242
1243 // Convert Unicode symbol characters to DEC Special characters
1244 ts->UnicodeDecSpMapping =
1245 GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1246
1247 // VT Window Icon
1248 GetPrivateProfileString(Section, "VTIcon", "Default",
1249 Temp, sizeof(Temp), FName);
1250 ts->VTIcon = IconName2IconId(Temp);
1251
1252 // Tek Window Icon
1253 GetPrivateProfileString(Section, "TEKIcon", "Default",
1254 Temp, sizeof(Temp), FName);
1255 ts->TEKIcon = IconName2IconId(Temp);
1256
1257 // Unknown Unicode Character
1258 ts->UnknownUnicodeCharaAsWide =
1259 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1260
1261 #ifdef USE_NORMAL_BGCOLOR
1262 // UseNormalBGColor
1263 ts->UseNormalBGColor =
1264 GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1265 // 2006/03/11 by 337
1266 if (ts->UseNormalBGColor) {
1267 ts->VTBoldColor[1] =
1268 ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1269 }
1270 #endif
1271
1272 // AutoScrollOnlyInBottomLine
1273 ts->AutoScrollOnlyInBottomLine =
1274 GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1275
1276 // Accept remote-controlled window title changing
1277 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1278 Temp, sizeof(Temp), FName);
1279 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1280 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1281 else if (_stricmp(Temp, "ahead") == 0)
1282 ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1283 else if (_stricmp(Temp, "last") == 0)
1284 ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1285 else
1286 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1287
1288 // Size of paste confirm dialog
1289 GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1290 Temp, sizeof(Temp), FName);
1291 GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1292 GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1293 if (ts->PasteDialogSize.cx < 0)
1294 ts->PasteDialogSize.cx = 330;
1295 if (ts->PasteDialogSize.cy < 0)
1296 ts->PasteDialogSize.cy = 220;
1297
1298 // Disable mouse event tracking when Control-Key is pressed.
1299 ts->DisableMouseTrackingByCtrl =
1300 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1301
1302 // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1303 ts->DisableWheelToCursorByCtrl =
1304 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1305
1306 // Strict Key Mapping.
1307 ts->StrictKeyMapping =
1308 GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1309
1310 // added Wait4allMacroCommand (2009.3.23 yutaka)
1311 ts->Wait4allMacroCommand =
1312 GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1313
1314 // added DisableMenuSendBreak (2009.4.6 maya)
1315 ts->DisableMenuSendBreak =
1316 GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1317
1318 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1319 ts->ClearScreenOnCloseConnection =
1320 GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1321
1322 // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1323 ts->DisableAcceleratorDuplicateSession =
1324 GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1325
1326 // added DisableMenuDuplicateSession (2010.8.3 maya)
1327 ts->DisableMenuDuplicateSession =
1328 GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE);
1329
1330 // added DisableMenuNewConnection (2010.8.4 maya)
1331 ts->DisableMenuNewConnection =
1332 GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE);
1333
1334 // added PasteDelayPerLine (2009.4.12 maya)
1335 ts->PasteDelayPerLine =
1336 GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1337 {
1338 int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1339 ts->PasteDelayPerLine = tmp;
1340 }
1341
1342 // Font scaling -- test
1343 ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1344
1345 // Meta sets MSB
1346 GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName);
1347 if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0)
1348 ts->Meta8Bit = IdMeta8BitRaw;
1349 else if (_stricmp(Temp, "text") == 0)
1350 ts->Meta8Bit = IdMeta8BitText;
1351 else
1352 ts->Meta8Bit = IdMeta8BitOff;
1353
1354 // Window control sequence
1355 if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE))
1356 ts->WindowFlag |= WF_WINDOWCHANGE;
1357
1358 // Cursor control sequence
1359 if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE))
1360 ts->WindowFlag |= WF_CURSORCHANGE;
1361
1362 // Window report sequence
1363 if (GetOnOff(Section, "WindowReportSequence", FName, TRUE))
1364 ts->WindowFlag |= WF_WINDOWREPORT;
1365
1366 // Title report sequence
1367 GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName);
1368 if (_stricmp(Temp, "accept") == 0)
1369 ts->WindowFlag |= IdTitleReportAccept;
1370 else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0)
1371 ts->WindowFlag &= ~WF_TITLEREPORT;
1372 else // empty
1373 ts->WindowFlag |= IdTitleReportEmpty;
1374
1375 // Line at a time mode
1376 ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE);
1377
1378 // Clear window on resize
1379 if (GetOnOff(Section, "ClearOnResize", FName, TRUE))
1380 ts->TermFlag |= TF_CLEARONRESIZE;
1381
1382 // Alternate Screen Buffer
1383 if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE))
1384 ts->TermFlag |= TF_ALTSCR;
1385
1386 // IME status related cursor style
1387 if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE))
1388 ts->WindowFlag |= WF_IMECURSORCHANGE;
1389
1390 // Terminal Unique ID
1391 GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName);
1392 if (strlen(Temp) == 8) {
1393 for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) {
1394 if (islower(Temp[i])) {
1395 ts->TerminalUID[i] = toupper(Temp[i]);
1396 }
1397 else {
1398 ts->TerminalUID[i] = Temp[i];
1399 }
1400 }
1401 if (i == 8) {
1402 ts->TerminalUID[i] = 0;
1403 }
1404 else {
1405 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1406 }
1407 }
1408 else {
1409 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1410 }
1411
1412 // Lock Terminal UID
1413 if (GetOnOff(Section, "LockTUID", FName, TRUE))
1414 ts->TermFlag |= TF_LOCKTUID;
1415
1416 // Confirm PasteCR
1417 ts->ConfirmChangePasteCR = GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE);
1418
1419 // Jump List
1420 ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1421
1422 // TabStopModifySequence
1423 GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName);
1424 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1425 ts->TabStopFlag = TABF_ALL;
1426 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
1427 ts->TabStopFlag = TABF_NONE;
1428 else {
1429 ts->TabStopFlag = TABF_NONE;
1430 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1431 if (_stricmp(Temp2, "HTS") == 0)
1432 ts->TabStopFlag |= TABF_HTS;
1433 else if (_stricmp(Temp2, "HTS7") == 0)
1434 ts->TabStopFlag |= TABF_HTS7;
1435 else if (_stricmp(Temp2, "HTS8") == 0)
1436 ts->TabStopFlag |= TABF_HTS8;
1437 else if (_stricmp(Temp2, "TBC") == 0)
1438 ts->TabStopFlag |= TABF_TBC;
1439 else if (_stricmp(Temp2, "TBC0") == 0)
1440 ts->TabStopFlag |= TABF_TBC0;
1441 else if (_stricmp(Temp2, "TBC3") == 0)
1442 ts->TabStopFlag |= TABF_TBC3;
1443 }
1444 }
1445
1446 // Clipboard Access from Remote
1447 GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName);
1448 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0)
1449 ts->CtrlFlag |= CSF_CBRW;
1450 else if (_stricmp(Temp, "read") == 0)
1451 ts->CtrlFlag |= CSF_CBREAD;
1452 else if (_stricmp(Temp, "write") == 0)
1453 ts->CtrlFlag |= CSF_CBWRITE;
1454
1455 // Use invalid DECRPSS (for testing)
1456 if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
1457 ts->TermFlag |= TF_INVALIDDECRPSS;
1458
1459 // ClickableUrlBrowser
1460 GetPrivateProfileString(Section, "ClickableUrlBrowser", "",
1461 ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName);
1462 GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "",
1463 ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName);
1464
1465 // Exclusive Lock when open the log file
1466 ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE);
1467 }
1468
1469 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1470 {
1471 int i;
1472 char Temp[MAX_PATH];
1473 char buf[20];
1474
1475 /* version */
1476 WritePrivateProfileString(Section, "Version", "2.3", FName);
1477
1478 /* Language */
1479 switch (ts->Language) {
1480 case IdJapanese:
1481 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1482 break;
1483 case IdKorean:
1484 strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1485 break;
1486 case IdRussian:
1487 strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1488 break;
1489 case IdUtf8:
1490 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1491 break;
1492 default:
1493 strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1494 }
1495
1496 WritePrivateProfileString(Section, "Language", Temp, FName);
1497
1498 /* Port type */
1499 if (ts->PortType == IdSerial)
1500 strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1501 else /* IdFile -> IdTCPIP */
1502 strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1503
1504 WritePrivateProfileString(Section, "Port", Temp, FName);
1505
1506 /* Save win position */
1507 if (ts->SaveVTWinPos) {
1508 /* VT win position */
1509 WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1510 }
1511
1512 /* VT terminal size */
1513 WriteInt2(Section, "TerminalSize", FName,
1514 ts->TerminalWidth, ts->TerminalHeight);
1515
1516 /* Terminal size = Window size */
1517 WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1518
1519 /* Auto window resize flag */
1520 WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1521
1522 /* CR Receive */
1523 if (ts->CRReceive == IdCRLF) {
1524 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1525 }
1526 else if (ts->CRReceive == IdLF) {
1527 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1528 }
1529 else {
1530 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1531 }
1532 WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1533
1534 /* CR Send */
1535 if (ts->CRSend == IdCRLF)
1536 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1537 else
1538 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1539 WritePrivateProfileString(Section, "CRSend", Temp, FName);
1540
1541 /* Local echo */
1542 WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1543
1544 /* Answerback */
1545 if ((ts->FTFlag & FT_BPAUTO) == 0) {
1546 Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1547 sizeof(Temp) - 1, TRUE);
1548 WritePrivateProfileString(Section, "Answerback", Temp, FName);
1549 }
1550
1551 /* Kanji Code (receive) */
1552 switch (ts->KanjiCode) {
1553 case IdEUC:
1554 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1555 break;
1556 case IdJIS:
1557 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1558 break;
1559 case IdUTF8:
1560 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1561 break;
1562 case IdUTF8m:
1563 strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1564 break;
1565 default:
1566 switch (ts->Language) {
1567 case IdJapanese:
1568 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1569 break;
1570 case IdKorean:
1571 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1572 break;
1573 default:
1574 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1575 }
1576 }
1577 WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1578
1579 /* Katakana (receive) */
1580 if (ts->JIS7Katakana == 1)
1581 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1582 else
1583 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1584
1585 WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1586
1587 /* Kanji Code (transmit) */
1588 switch (ts->KanjiCodeSend) {
1589 case IdEUC:
1590 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1591 break;
1592 case IdJIS:
1593 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1594 break;
1595 case IdUTF8:
1596 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1597 break;
1598 default:
1599 switch (ts->Language) {
1600 case IdJapanese:
1601 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1602 break;
1603 case IdKorean:
1604 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1605 break;
1606 default:
1607 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1608 }
1609 }
1610 WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1611
1612 /* Katakana (transmit) */
1613 if (ts->JIS7KatakanaSend == 1)
1614 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1615 else
1616 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1617
1618 WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1619
1620 /* KanjiIn */
1621 if (ts->KanjiIn == IdKanjiInA)
1622 strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1623 else
1624 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1625
1626 WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1627
1628 /* KanjiOut */
1629 switch (ts->KanjiOut) {
1630 case IdKanjiOutB:
1631 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1632 break;
1633 case IdKanjiOutH:
1634 strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1635 break;
1636 default:
1637 strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1638 }
1639 WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1640
1641 // new configuration
1642 WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1643
1644 WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1645 ts->DisablePasteMouseRButton);
1646
1647 // added DisablePasteMouseMButton (2008.3.2 maya)
1648 WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1649 ts->DisablePasteMouseMButton);
1650
1651 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1652 WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1653 ts->ConfirmPasteMouseRButton);
1654
1655 // added ConfirmChangePaste
1656 WriteOnOff(Section, "ConfirmChangePaste", FName,
1657 ts->ConfirmChangePaste);
1658 WritePrivateProfileString(Section, "ConfirmChangePasteStringFile",
1659 ts->ConfirmChangePasteStringFile, FName);
1660
1661 // added ScrollWindowClearScreen
1662 WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1663 ts->ScrollWindowClearScreen);
1664
1665 // added SelectOnlyByLButton (2007.11.20 maya)
1666 WriteOnOff(Section, "SelectOnlyByLButton", FName,
1667 ts->SelectOnlyByLButton);
1668 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1669 WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1670 ts->DisableAcceleratorSendBreak);
1671 WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1672 ts->EnableContinuedLineCopy);
1673 WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1674 FName);
1675 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1676 WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1677 WritePrivateProfileString(Section, "CygwinDirectory",
1678 ts->CygwinDirectory, FName);
1679 WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1680 FName);
1681 WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1682 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1683 WritePrivateProfileString(Section, "CodePage", Temp, FName);
1684
1685 // ANSI color(2004.9.5 yutaka)
1686 Temp[0] = '\0';
1687 for (i = 0; i < 15; i++) {
1688 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1689 i,
1690 GetRValue(ts->ANSIColor[i]),
1691 GetGValue(ts->ANSIColor[i]),
1692 GetBValue(ts->ANSIColor[i])
1693 );
1694 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1695 }
1696 i = 15;
1697 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1698 i,
1699 GetRValue(ts->ANSIColor[i]),
1700 GetGValue(ts->ANSIColor[i]),
1701 GetBValue(ts->ANSIColor[i])
1702 );
1703 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1704 WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1705
1706 /* AutoWinChange VT<->TEK */
1707 WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1708
1709 /* Terminal ID */
1710 id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1711 WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1712
1713 /* Russian character set (host) */
1714 id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1715 WritePrivateProfileString(Section, "RussHost", Temp, FName);
1716
1717 /* Russian character set (client) */
1718 id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1719 WritePrivateProfileString(Section, "RussClient", Temp, FName);
1720
1721 /* Title text */
1722 WritePrivateProfileString(Section, "Title", ts->Title, FName);
1723
1724 /* Cursor shape */
1725 switch (ts->CursorShape) {
1726 case IdVCur:
1727 strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1728 break;
1729 case IdHCur:
1730 strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1731 break;
1732 default:
1733 strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1734 }
1735 WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1736
1737 /* Hide title */
1738 WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1739
1740 /* Popup menu */
1741 WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1742
1743 /* PC-Style bold color mapping */
1744 WriteOnOff(Section, "PcBoldColor", FName,
1745 (WORD) (ts->ColorFlag & CF_PCBOLD16));
1746
1747 /* aixterm 16 colors mode */
1748 WriteOnOff(Section, "Aixterm16Color", FName,
1749 (WORD) (ts->ColorFlag & CF_AIXTERM16));
1750
1751 /* xterm 256 colors mode */
1752 WriteOnOff(Section, "Xterm256Color", FName,
1753 (WORD) (ts->ColorFlag & CF_XTERM256));
1754
1755 /* Enable scroll buffer */
1756 WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1757
1758 /* Scroll buffer size */
1759 WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1760
1761 /* VT Color */
1762 for (i = 0; i <= 1; i++) {
1763 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1764 if (ts->ColorFlag & CF_REVERSECOLOR) {
1765 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1766 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1767 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1768 }
1769 else {
1770 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1771 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1772 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1773 }
1774 }
1775 else {
1776 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1777 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1778 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1779 }
1780 }
1781 WriteInt6(Section, "VTColor", FName,
1782 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1783 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1784
1785 /* VT Bold Color */
1786 for (i = 0; i <= 1; i++) {
1787 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1788 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1789 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1790 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1791 }
1792 else {
1793 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1794 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1795 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1796 }
1797 }
1798 WriteInt6(Section, "VTBoldColor", FName,
1799 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1800 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1801
1802 /* VT Blink Color */
1803 for (i = 0; i <= 1; i++) {
1804 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1805 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1806 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1807 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1808 }
1809 else {
1810 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1811 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1812 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1813 }
1814 }
1815 WriteInt6(Section, "VTBlinkColor", FName,
1816 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1817 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1818
1819 /* VT Reverse Color */
1820 for (i = 0; i <= 1; i++) {
1821 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1822 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1823 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1824 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1825 }
1826 else {
1827 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1828 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1829 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1830 }
1831 }
1832 WriteInt6(Section, "VTReverseColor", FName,
1833 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1834 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1835
1836 WriteOnOff(Section, "EnableClickableUrl", FName,
1837 ts->EnableClickableUrl);
1838
1839 /* URL color */
1840 for (i = 0; i <= 1; i++) {
1841 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1842 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1843 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1844 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1845 }
1846 else {
1847 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1848 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1849 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1850 }
1851 }
1852 WriteInt6(Section, "URLColor", FName,
1853 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1854 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1855
1856 WriteOnOff(Section, "EnableBoldAttrColor", FName,
1857 (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1858
1859 WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1860 (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1861
1862 WriteOnOff(Section, "EnableReverseAttrColor", FName,
1863 (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1864
1865 WriteOnOff(Section, "EnableURLColor", FName,
1866 (WORD) (ts->ColorFlag & CF_URLCOLOR));
1867
1868 WriteOnOff(Section, "URLUnderline", FName,
1869 (WORD) (ts->FontFlag & FF_URLUNDERLINE));
1870
1871 WriteOnOff(Section, "EnableANSIColor", FName,
1872 (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1873
1874 /* TEK Color */
1875 for (i = 0; i <= 1; i++) {
1876 ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1877 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1878 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1879 }
1880 WriteInt6(Section, "TEKColor", FName,
1881 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1882 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1883
1884 /* TEK color emulation */
1885 WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1886
1887 /* VT Font */
1888 WriteFont(Section, "VTFont", FName,
1889 ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1890 ts->VTFontCharSet);
1891
1892 /* Enable bold font flag */
1893 WriteOnOff(Section, "EnableBold", FName,
1894 (WORD) (ts->FontFlag & FF_BOLD));
1895
1896 /* Russian character set (font) */
1897 id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1898 WritePrivateProfileString(Section, "RussFont", Temp, FName);
1899
1900 /* TEK Font */
1901 WriteFont(Section, "TEKFont", FName,
1902 ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1903 ts->TEKFontCharSet);
1904
1905 /* BS key */
1906 if (ts->BSKey == IdDEL)
1907 strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1908 else
1909 strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1910 WritePrivateProfileString(Section, "BSKey", Temp, FName);
1911
1912 /* Delete key */
1913 WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1914
1915 /* Meta key */
1916 switch (ts->MetaKey) {
1917 case 1:
1918 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
1919 break;
1920 case 2:
1921 strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE);
1922 break;
1923 case 3:
1924 strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE);
1925 break;
1926 default:
1927 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
1928 }
1929 WritePrivateProfileString(Section, "Metakey", Temp, FName);
1930
1931 /* Application Keypad */
1932 WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1933
1934 /* Application Cursor */
1935 WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1936
1937 /* Russian keyboard type */
1938 id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1939 WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1940
1941 /* Serial port ID */
1942 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1943 WritePrivateProfileString(Section, "ComPort", Temp, FName);
1944
1945 /* Baud rate */
1946 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud);
1947 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1948
1949 /* Parity */
1950 switch (ts->Parity) {
1951 case IdParityEven:
1952 strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1953 break;
1954 case IdParityOdd:
1955 strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1956 break;
1957 default:
1958 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1959 }
1960 WritePrivateProfileString(Section, "Parity", Temp, FName);
1961
1962 /* Data bit */
1963 if (ts->DataBit == IdDataBit7)
1964 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1965 else
1966 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1967
1968 WritePrivateProfileString(Section, "DataBit", Temp, FName);
1969
1970 /* Stop bit */
1971 if (ts->StopBit == IdStopBit2)
1972 strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1973 else
1974 strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1975
1976 WritePrivateProfileString(Section, "StopBit", Temp, FName);
1977
1978 /* Flow control */
1979 switch (ts->Flow) {
1980 case IdFlowX:
1981 strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1982 break;
1983 case IdFlowHard:
1984 strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1985 break;
1986 default:
1987 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1988 }
1989 WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1990
1991 /* Delay per character */
1992 WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1993
1994 /* Delay per line */
1995 WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1996
1997 /* Telnet flag */
1998 WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1999
2000 /* Telnet terminal type */
2001 WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
2002
2003 /* TCP port num for non-telnet */
2004 WriteUint(Section, "TCPPort", FName, ts->TCPPort);
2005
2006 /* Auto close flag */
2007 WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
2008
2009 /* History list */
2010 WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
2011
2012 /* File transfer binary flag */
2013 WriteOnOff(Section, "TransBin", FName, ts->TransBin);
2014
2015 /* Log binary flag */
2016 WriteOnOff(Section, "LogBinary", FName, ts->LogBinary);
2017
2018 /* Log append */
2019 WriteOnOff(Section, "LogAppend", FName, ts->Append);
2020
2021 /* Log plain text flag */
2022 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
2023
2024 /* Log with timestamp (2006.7.23 maya) */
2025 WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
2026
2027 /* Log without transfer dialog */
2028 WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
2029
2030 /* Default Log file name (2006.8.28 maya) */
2031 WritePrivateProfileString(Section, "LogDefaultName",
2032 ts->LogDefaultName, FName);
2033
2034 /* Default Log file path (2007.5.30 maya) */
2035 WritePrivateProfileString(Section, "LogDefaultPath",
2036 ts->LogDefaultPath, FName);
2037
2038 /* Auto start logging (2007.5.31 maya) */
2039 WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
2040
2041 /* XMODEM option */
2042 switch (ts->XmodemOpt) {
2043 case XoptCRC:
2044 strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
2045 break;
2046 case Xopt1K:
2047 strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
2048 break;
2049 default:
2050 strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
2051 }
2052 WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
2053
2054 /* XMODEM binary flag */
2055 WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
2056
2057 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
2058 WritePrivateProfileString(Section, "XmodemRcvCommand",
2059 ts->XModemRcvCommand, FName);
2060
2061 /* Default directory for file transfer */
2062 WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
2063
2064 /* filter on file send (2007.6.5 maya) */
2065 WritePrivateProfileString(Section, "FileSendFilter",
2066 ts->FileSendFilter, FName);
2067
2068 /*------------------------------------------------------------------*/
2069 /* 8 bit control code flag -- special option */
2070 WriteOnOff(Section, "Accept8BitCtrl", FName,
2071 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
2072
2073 /* Wrong sequence flag -- special option */
2074 WriteOnOff(Section, "AllowWrongSequence", FName,
2075 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
2076
2077 /* Auto file renaming --- special option */
2078 WriteOnOff(Section, "AutoFileRename", FName,
2079 (WORD) (ts->FTFlag & FT_RENAME));
2080
2081 /* Auto text copy --- special option */
2082 WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
2083
2084 /* Back wrap -- special option */
2085 WriteOnOff(Section, "BackWrap", FName,
2086 (WORD) (ts->TermFlag & TF_BACKWRAP));
2087
2088 /* Beep type -- special option */
2089 WriteOnOff(Section, "Beep", FName, ts->Beep);
2090 switch (ts->Beep) {
2091 case IdBeepOff:
2092 WritePrivateProfileString(Section, "Beep", "off", FName);
2093 break;
2094 case IdBeepOn:
2095 WritePrivateProfileString(Section, "Beep", "on", FName);
2096 break;
2097 case IdBeepVisual:
2098 WritePrivateProfileString(Section, "Beep", "visual", FName);
2099 break;
2100 }
2101
2102 /* Beep on connection & disconnection -- special option */
2103 WriteOnOff(Section, "BeepOnConnect", FName,
2104 (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
2105
2106 /* Auto B-Plus activation -- special option */
2107 WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
2108
2109 /* B-Plus ESCCTL flag -- special option */
2110 WriteOnOff(Section, "BPEscCtl", FName,
2111 (WORD) (ts->FTFlag & FT_BPESCCTL));
2112
2113 /* B-Plus log -- special option */
2114 WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
2115
2116 /* Clear serial port buffer when port opening -- special option */
2117 WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
2118
2119 /* Confirm disconnection -- special option */
2120 WriteOnOff(Section, "ConfirmDisconnect", FName,
2121 (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
2122
2123 /* Ctrl code in Kanji -- special option */
2124 WriteOnOff(Section, "CtrlInKanji", FName,
2125 (WORD) (ts->TermFlag & TF_CTRLINKANJI));
2126
2127 /* Debug flag -- special option */
2128 WriteOnOff(Section, "Debug", FName, ts->Debug);
2129
2130 /* Delimiter list -- special option */
2131 Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
2132 sizeof(Temp) - 1, TRUE);
2133 WritePrivateProfileString(Section, "DelimList", Temp, FName);
2134
2135 /* regard DBCS characters as delimiters -- special option */
2136 WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
2137
2138 // Enable popup menu -- special option
2139 if ((ts->MenuFlag & MF_NOPOPUP) == 0)
2140 WriteOnOff(Section, "EnablePopupMenu", FName, 1);
2141 else
2142 WriteOnOff(Section, "EnablePopupMenu", FName, 0);
2143
2144 // Enable "Show menu" -- special option
2145 if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
2146 WriteOnOff(Section, "EnableShowMenu", FName, 1);
2147 else
2148 WriteOnOff(Section, "EnableShowMenu", FName, 0);
2149
2150 /* Enable the status line -- special option */
2151 WriteOnOff(Section, "EnableStatusLine", FName,
2152 (WORD) (ts->TermFlag & TF_ENABLESLINE));
2153
2154 /* IME Flag -- special option */
2155 WriteOnOff(Section, "IME", FName, ts->UseIME);
2156
2157 /* IME-inline Flag -- special option */
2158 WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
2159
2160 /* Kermit log -- special option */
2161 WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
2162
2163 // Enable language selection -- special option
2164 if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
2165 WriteOnOff(Section, "LanguageSelection", FName, 1);
2166 else
2167 WriteOnOff(Section, "LanguageSelection", FName, 0);
2168
2169 /* Maximum scroll buffer size -- special option */
2170 WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
2171
2172 /* Max com port number -- special option */
2173 WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
2174
2175 /* Non-blinking cursor -- special option */
2176 WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
2177
2178 WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
2179
2180 /* Delay for pass-thru printing activation */
2181 /* -- special option */
2182 WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
2183
2184 /* Printer port for pass-thru printing */
2185 /* -- special option */
2186 WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
2187
2188 /* �v�����^�p�����R�[�h�������t������ */
2189 WriteOnOff(Section, "PrinterCtrlSequence", FName,
2190 ts->TermFlag & TF_PRINTERCTRL);
2191
2192 /* Printer Font --- special option */
2193 WriteFont(Section, "PrnFont", FName,
2194 ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
2195 ts->PrnFontCharSet);
2196
2197 // Page margins (left, right, top, bottom) for printing
2198 // -- special option
2199 WriteInt4(Section, "PrnMargin", FName,
2200 ts->PrnMargin[0], ts->PrnMargin[1],
2201 ts->PrnMargin[2], ts->PrnMargin[3]);
2202
2203 /* Quick-VAN log -- special option */
2204 WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
2205
2206 /* Quick-VAN window size -- special */
2207 WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
2208
2209 /* Russian character set (print) -- special option */
2210 id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
2211 WritePrivateProfileString(Section, "RussPrint", Temp, FName);
2212
2213 /* Scroll threshold -- special option */
2214 WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
2215
2216 WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
2217
2218 // Select on activate -- special option
2219 WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
2220
2221 /* Send 8bit control sequence -- special option */
2222 WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
2223
2224 /* Startup macro -- special option */
2225 WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
2226
2227 /* TEK GIN Mouse keycode -- special option */
2228 WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
2229
2230 /* Telnet Auto Detect -- special option */
2231 WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
2232
2233 /* Telnet binary flag -- special option */
2234 WriteOnOff(Section, "TelBin", FName, ts->TelBin);
2235
2236 /* Telnet Echo flag -- special option */
2237 WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
2238
2239 /* Telnet log -- special option */
2240 WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2241
2242 /* TCP port num for telnet -- special option */
2243 WriteUint(Section, "TelPort", FName, ts->TelPort);
2244
2245 /* Telnet keep-alive packet(NOP command) interval -- special option */
2246 WriteUint(Section, "TelKeepAliveInterval", FName,
2247 ts->TelKeepAliveInterval);
2248
2249 /* Max number of broadcast commad history */
2250 WriteUint(Section, "MaxBroadcatHistory", FName,
2251 ts->MaxBroadcatHistory);
2252
2253 /* Local echo for non-telnet */
2254 WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2255
2256 /* "new-line (transmit)" option for non-telnet -- special option */
2257 if (ts->TCPCRSend == IdCRLF)
2258 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2259 else if (ts->TCPCRSend == IdCR)
2260 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2261 else
2262 Temp[0] = 0;
2263 WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2264
2265 /* Use text (background) color for "white (black)"
2266 --- special option */
2267 WriteOnOff(Section, "UseTextColor", FName,
2268 (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2269
2270 /* Title format -- special option */
2271 WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2272
2273 /* VT Compatible Tab -- special option */
2274 WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2275
2276 /* VT Font space --- special option */
2277 WriteInt4(Section, "VTFontSpace", FName,
2278 ts->FontDX, ts->FontDW - ts->FontDX,
2279 ts->FontDY, ts->FontDH - ts->FontDY);
2280
2281 // VT-print scaling factors (pixels per inch) --- special option
2282 WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2283
2284 // TEK-print scaling factors (pixels per inch) --- special option
2285 WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2286
2287 // Show "Window" menu -- special option
2288 WriteOnOff(Section, "WindowMenu", FName,
2289 (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2290
2291 /* XMODEM log -- special option */
2292 WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2293
2294 /* YMODEM log -- special option */
2295 WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2296
2297 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
2298 WritePrivateProfileString(Section, "YmodemRcvCommand", ts->YModemRcvCommand, FName);
2299
2300 /* Auto ZMODEM activation -- special option */
2301 WriteOnOff(Section, "ZmodemAuto", FName,
2302 (WORD) (ts->FTFlag & FT_ZAUTO));
2303
2304 /* ZMODEM data subpacket length for sending -- special */
2305 WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2306 /* ZMODEM window size for sending -- special */
2307 WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2308
2309 /* ZMODEM ESCCTL flag -- special option */
2310 WriteOnOff(Section, "ZmodemEscCtl", FName,
2311 (WORD) (ts->FTFlag & FT_ZESCCTL));
2312
2313 /* ZMODEM log -- special option */
2314 WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2315
2316 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2317 WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2318
2319 /* update file */
2320 WritePrivateProfileString(NULL, NULL, NULL, FName);
2321
2322 // Eterm lookfeel alphablend (2005.4.24 yutaka)
2323 #define ETERM_SECTION "BG"
2324 WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2325 ts->EtermLookfeel.BGEnable);
2326 WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2327 ts->EtermLookfeel.BGUseAlphaBlendAPI);
2328 WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2329 ts->EtermLookfeel.BGSPIPath, FName);
2330 WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2331 ts->EtermLookfeel.BGFastSizeMove);
2332 WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2333 ts->EtermLookfeel.BGNoCopyBits);
2334 WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2335 ts->EtermLookfeel.BGNoFrame);
2336 WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2337 ts->EtermLookfeel.BGThemeFile, FName);
2338
2339 #ifdef USE_NORMAL_BGCOLOR
2340 // UseNormalBGColor
2341 WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2342 #endif
2343
2344 // UI language message file
2345 WritePrivateProfileString(Section, "UILanguageFile",
2346 ts->UILanguageFile_ini, FName);
2347
2348 // Broadcast Command History (2007.3.3 maya)
2349 WriteOnOff(Section, "BroadcastCommandHistory", FName,
2350 ts->BroadcastCommandHistory);
2351
2352 // 337: 2007/03/20 Accept Broadcast
2353 WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2354
2355 // Confirm send a file when drag and drop (2007.12.28 maya)
2356 WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2357 ts->ConfirmFileDragAndDrop);
2358
2359 // Translate mouse wheel to cursor key when application cursor mode
2360 WriteOnOff(Section, "TranslateWheelToCursor", FName,
2361 ts->TranslateWheelToCursor);
2362
2363 // Display "New Connection" dialog on startup (2008.1.18 maya)
2364 WriteOnOff(Section, "HostDialogOnStartup", FName,
2365 ts->HostDialogOnStartup);
2366
2367 // Mouse event tracking
2368 WriteOnOff(Section, "MouseEventTracking", FName,
2369 ts->MouseEventTracking);
2370
2371 // Maximized bug tweak
2372 WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2373
2374 // Convert Unicode symbol characters to DEC Special characters
2375 WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2376
2377 // VT Window Icon
2378 IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2379 WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2380
2381 // Tek Window Icon
2382 IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2383 WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2384
2385 // AutoScrollOnlyInBottomLine
2386 WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2387 ts->AutoScrollOnlyInBottomLine);
2388
2389 // Unknown Unicode Character
2390 WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2391 ts->UnknownUnicodeCharaAsWide);
2392
2393 // Accept remote-controlled window title changing
2394 if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2395 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2396 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2397 strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2398 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2399 strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2400 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2401 strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2402 else
2403 Temp[0] = 0;
2404 WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2405
2406 // Size of paste confirm dialog
2407 WriteInt2(Section, "PasteDialogSize", FName,
2408 ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2409
2410 // Disable mouse event tracking when Control-Key is pressed.
2411 WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2412 ts->DisableMouseTrackingByCtrl);
2413
2414 // Disable TranslateWHeelToCursor when Control-Key is pressed.
2415 WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2416 ts->DisableWheelToCursorByCtrl);
2417
2418 // Strict Key Mapping.
2419 WriteOnOff(Section, "StrictKeyMapping", FName,
2420 ts->StrictKeyMapping);
2421
2422 // Wait4allMacroCommand
2423 WriteOnOff(Section, "Wait4allMacroCommand", FName,
2424 ts->Wait4allMacroCommand);
2425
2426 // DisableMenuSendBreak
2427 WriteOnOff(Section, "DisableMenuSendBreak", FName,
2428 ts->DisableMenuSendBreak);
2429
2430 // ClearScreenOnCloseConnection
2431 WriteOnOff(Section, "ClearScreenOnCloseConnection", FName,
2432 ts->ClearScreenOnCloseConnection);
2433
2434 // DisableAcceleratorDuplicateSession
2435 WriteOnOff(Section, "DisableAcceleratorDuplicateSession", FName,
2436 ts->DisableAcceleratorDuplicateSession);
2437
2438 // DisableMenuDuplicateSession
2439 WriteOnOff(Section, "DisableMenuDuplicateSession", FName,
2440 ts->DisableMenuDuplicateSession);
2441
2442 // DisableMenuNewConnection
2443 WriteOnOff(Section, "DisableMenuNewConnection", FName,
2444 ts->DisableMenuNewConnection);
2445
2446 // added PasteDelayPerLine (2009.4.12 maya)
2447 WriteInt(Section, "PasteDelayPerLine", FName,
2448 ts->PasteDelayPerLine);
2449
2450 // Meta sets MSB
2451 switch (ts->Meta8Bit) {
2452 case IdMeta8BitRaw:
2453 WritePrivateProfileString(Section, "Meta8Bit", "raw", FName);
2454 break;
2455 case IdMeta8BitText:
2456 WritePrivateProfileString(Section, "Meta8Bit", "text", FName);
2457 break;
2458 default:
2459 WritePrivateProfileString(Section, "Meta8Bit", "off", FName);
2460 }
2461
2462 // Window control sequence
2463 WriteOnOff(Section, "WindowCtrlSequence", FName,
2464 ts->WindowFlag & WF_WINDOWCHANGE);
2465
2466 // Cursor control sequence
2467 WriteOnOff(Section, "CursorCtrlSequence", FName,
2468 ts->WindowFlag & WF_CURSORCHANGE);
2469
2470 // Window report sequence
2471 WriteOnOff(Section, "WindowReportSequence", FName,
2472 ts->WindowFlag & WF_WINDOWREPORT);
2473
2474 // Title report sequence
2475 switch (ts->WindowFlag & WF_TITLEREPORT) {
2476 case IdTitleReportIgnore:
2477 WritePrivateProfileString(Section, "TitleReportSequence", "ignore", FName);
2478 break;
2479 case IdTitleReportAccept:
2480 WritePrivateProfileString(Section, "TitleReportSequence", "accept", FName);
2481 break;
2482 default: // IdTitleReportEmpty
2483 WritePrivateProfileString(Section, "TitleReportSequence", "empty", FName);
2484 break;
2485 }
2486
2487 // Line at a time mode
2488 WriteOnOff(Section, "EnableLineMode", FName, ts->EnableLineMode);
2489
2490 // Clear window on resize
2491 WriteOnOff(Section, "ClearOnResize", FName,
2492 ts->TermFlag & TF_CLEARONRESIZE);
2493
2494 // Alternate Screen Buffer
2495 WriteOnOff(Section, "AlternateScreenBuffer", FName,
2496 ts->TermFlag & TF_ALTSCR);
2497
2498 // IME status related cursor style
2499 WriteOnOff(Section, "IMERelatedCursor", FName,
2500 ts->WindowFlag & WF_IMECURSORCHANGE);
2501
2502 // Terminal Unique ID
2503 WritePrivateProfileString(Section, "TerminalUID", ts->TerminalUID, FName);
2504
2505 // Lock Terminal UID
2506 WriteOnOff(Section, "LockTUID", FName, ts->TermFlag & TF_LOCKTUID);
2507
2508 // Confirm PasteCR
2509 WriteOnOff(Section, "ConfirmChangePasteCR", FName, ts->ConfirmChangePasteCR);
2510
2511 // Jump List
2512 WriteOnOff(Section, "JumpList", FName, ts->JumpList);
2513
2514 // TabStopModifySequence
2515 switch (ts->TabStopFlag) {
2516 case TABF_ALL:
2517 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
2518 break;
2519 case TABF_NONE:
2520 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2521 break;
2522 default:
2523 switch (ts->TabStopFlag & TABF_HTS) {
2524 case TABF_HTS7: strncpy_s(Temp, sizeof(Temp), "HTS7", _TRUNCATE); break;
2525 case TABF_HTS8: strncpy_s(Temp, sizeof(Temp), "HTS8", _TRUNCATE); break;
2526 case TABF_HTS: strncpy_s(Temp, sizeof(Temp), "HTS", _TRUNCATE); break;
2527 default: Temp[0] = 0; break;
2528 }
2529
2530 if (ts->TabStopFlag & TABF_TBC) {
2531 if (Temp[0] != 0) {
2532 strncat_s(Temp, sizeof(Temp), ",", _TRUNCATE);
2533 }
2534 switch (ts->TabStopFlag & TABF_TBC) {
2535 case TABF_TBC0: strncat_s(Temp, sizeof(Temp), "TBC0", _TRUNCATE); break;
2536 case TABF_TBC3: strncat_s(Temp, sizeof(Temp), "TBC3", _TRUNCATE); break;
2537 case TABF_TBC: strncat_s(Temp, sizeof(Temp), "TBC", _TRUNCATE); break;
2538 }
2539 }
2540
2541 if (Temp[0] == 0) { // �����������������O������
2542 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2543 }
2544 break;
2545 }
2546 WritePrivateProfileString(Section, "TabStopModifySequence", Temp, FName);
2547
2548 // Clipboard Access from Remote
2549 switch (ts->CtrlFlag & CSF_CBRW) {
2550 case CSF_CBREAD:
2551 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "read", FName);
2552 break;
2553 case CSF_CBWRITE:
2554 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "write", FName);
2555 break;
2556 case CSF_CBRW:
2557 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "on", FName);
2558 break;
2559 default:
2560 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "off", FName);
2561 break;
2562 }
2563
2564 // ClickableUrlBrowser
2565 WritePrivateProfileString(Section, "ClickableUrlBrowser", ts->ClickableUrlBrowser, FName);
2566 WritePrivateProfileString(Section, "ClickableUrlBrowserArg", ts->ClickableUrlBrowserArg, FName);
2567
2568 // Exclusive Lock when open the log file
2569 WriteOnOff(Section, "LogLockExclusive", FName, ts->LogLockExclusive);
2570 }
2571
2572 #define VTEditor "VT editor keypad"
2573 #define VTNumeric "VT numeric keypad"
2574 #define VTFunction "VT function keys"
2575 #define XFunction "X function keys"
2576 #define ShortCut "Shortcut keys"
2577
2578 void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2579 {
2580 char Temp[11];
2581 WORD Num;
2582
2583 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2584 if (Temp[0] == 0)
2585 Num = 0xFFFF;
2586 else if (_stricmp(Temp, "off") == 0)
2587 Num = 0xFFFF;
2588 else if (sscanf(Temp, "%d", &Num) != 1)
2589 Num = 0xFFFF;
2590
2591 KeyMap->Map[KeyId - 1] = Num;
2592 }
2593
2594 void FAR PASCAL ReadKeyboardCnf
2595 (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2596 int i, j, Ptr;
2597 char EntName[7];
2598 char TempStr[221];
2599 char KStr[201];
2600
2601 // clear key map
2602 for (i = 0; i <= IdKeyMax - 1; i++)
2603 KeyMap->Map[i] = 0xFFFF;
2604 for (i = 0; i <= NumOfUserKey - 1; i++) {
2605 KeyMap->UserKeyPtr[i] = 0;
2606 KeyMap->UserKeyLen[i] = 0;
2607 }
2608
2609 // VT editor keypad
2610 GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2611
2612 GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2613
2614 GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2615
2616 GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2617
2618 GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2619
2620 GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2621
2622 GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2623
2624 GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2625
2626 GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2627
2628 GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2629
2630 // VT numeric keypad
2631 GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2632
2633 GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2634
2635 GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2636
2637 GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2638
2639 GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2640
2641 GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2642
2643 GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2644
2645 GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2646
2647 GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2648
2649 GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2650
2651 GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2652
2653 GetInt(KeyMap, IdComma, VTNumeric, "NumComma", FName);
2654
2655 GetInt(KeyMap, IdPeriod, VTNumeric, "NumPeriod", FName);
2656
2657 GetInt(KeyMap, IdEnter, VTNumeric, "NumEnter", FName);
2658
2659 GetInt(KeyMap, IdSlash, VTNumeric, "NumSlash", FName);
2660
2661 GetInt(KeyMap, IdAsterisk, VTNumeric, "NumAsterisk", FName);
2662
2663 GetInt(KeyMap, IdPlus, VTNumeric, "NumPlus", FName);
2664
2665 GetInt(KeyMap, IdPF1, VTNumeric, "PF1", FName);
2666
2667 GetInt(KeyMap, IdPF2, VTNumeric, "PF2", FName);
2668
2669 GetInt(KeyMap, IdPF3, VTNumeric, "PF3", FName);
2670
2671 GetInt(KeyMap, IdPF4, VTNumeric, "PF4", FName);
2672
2673 // VT function keys
2674 GetInt(KeyMap, IdHold, VTFunction, "Hold", FName);
2675
2676 GetInt(KeyMap, IdPrint, VTFunction, "Print", FName);
2677
2678 GetInt(KeyMap, IdBreak, VTFunction, "Break", FName);
2679
2680 GetInt(KeyMap, IdF6, VTFunction, "F6", FName);
2681
2682 GetInt(KeyMap, IdF7, VTFunction, "F7", FName);
2683
2684 GetInt(KeyMap, IdF8, VTFunction, "F8", FName);
2685
2686 GetInt(KeyMap, IdF9, VTFunction, "F9", FName);
2687
2688 GetInt(KeyMap, IdF10, VTFunction, "F10", FName);
2689
2690 GetInt(KeyMap, IdF11, VTFunction, "F11", FName);
2691
2692 GetInt(KeyMap, IdF12, VTFunction, "F12", FName);
2693
2694 GetInt(KeyMap, IdF13, VTFunction, "F13", FName);
2695
2696 GetInt(KeyMap, IdF14, VTFunction, "F14", FName);
2697
2698 GetInt(KeyMap, IdHelp, VTFunction, "Help", FName);
2699
2700 GetInt(KeyMap, IdDo, VTFunction, "Do", FName);
2701
2702 GetInt(KeyMap, IdF17, VTFunction, "F17", FName);
2703
2704 GetInt(KeyMap, IdF18, VTFunction, "F18", FName);
2705
2706 GetInt(KeyMap, IdF19, VTFunction, "F19", FName);
2707
2708 GetInt(KeyMap, IdF20, VTFunction, "F20", FName);
2709
2710 // UDK
2711 GetInt(KeyMap, IdUDK6, VTFunction, "UDK6", FName);
2712
2713 GetInt(KeyMap, IdUDK7, VTFunction, "UDK7", FName);
2714
2715 GetInt(KeyMap, IdUDK8, VTFunction, "UDK8", FName);
2716
2717 GetInt(KeyMap, IdUDK9, VTFunction, "UDK9", FName);
2718
2719 GetInt(KeyMap, IdUDK10, VTFunction, "UDK10", FName);
2720
2721 GetInt(KeyMap, IdUDK11, VTFunction, "UDK11", FName);
2722
2723 GetInt(KeyMap, IdUDK12, VTFunction, "UDK12", FName);
2724
2725 GetInt(KeyMap, IdUDK13, VTFunction, "UDK13", FName);
2726
2727 GetInt(KeyMap, IdUDK14, VTFunction, "UDK14", FName);
2728
2729 GetInt(KeyMap, IdUDK15, VTFunction, "UDK15", FName);
2730
2731 GetInt(KeyMap, IdUDK16, VTFunction, "UDK16", FName);
2732
2733 GetInt(KeyMap, IdUDK17, VTFunction, "UDK17", FName);
2734
2735 GetInt(KeyMap, IdUDK18, VTFunction, "UDK18", FName);
2736
2737 GetInt(KeyMap, IdUDK19, VTFunction, "UDK19", FName);
2738
2739 GetInt(KeyMap, IdUDK20, VTFunction, "UDK20", FName);
2740
2741 // XTERM function / extended keys
2742 GetInt(KeyMap, IdXF1, XFunction, "XF1", FName);
2743
2744 GetInt(KeyMap, IdXF2, XFunction, "XF2", FName);
2745
2746 GetInt(KeyMap, IdXF3, XFunction, "XF3", FName);
2747
2748 GetInt(KeyMap, IdXF4, XFunction, "XF4", FName);
2749
2750 GetInt(KeyMap, IdXF5, XFunction, "XF5", FName);
2751
2752 GetInt(KeyMap, IdXBackTab, XFunction, "XBackTab", FName);
2753
2754 // accelerator keys
2755 GetInt(KeyMap, IdCmdEditCopy, ShortCut, "EditCopy", FName);
2756
2757 GetInt(KeyMap, IdCmdEditPaste, ShortCut, "EditPaste", FName);
2758
2759 GetInt(KeyMap, IdCmdEditPasteCR, ShortCut, "EditPasteCR", FName);
2760
2761 GetInt(KeyMap, IdCmdEditCLS, ShortCut, "EditCLS", FName);
2762
2763 GetInt(KeyMap, IdCmdEditCLB, ShortCut, "EditCLB", FName);
2764
2765 GetInt(KeyMap, IdCmdCtrlOpenTEK, ShortCut, "ControlOpenTEK", FName);
2766
2767 GetInt(KeyMap, IdCmdCtrlCloseTEK, ShortCut, "ControlCloseTEK", FName);
2768
2769 GetInt(KeyMap, IdCmdLineUp, ShortCut, "LineUp", FName);
2770
2771 GetInt(KeyMap, IdCmdLineDown, ShortCut, "LineDown", FName);
2772
2773 GetInt(KeyMap, IdCmdPageUp, ShortCut, "PageUp", FName);
2774
2775 GetInt(KeyMap, IdCmdPageDown, ShortCut, "PageDown", FName);
2776
2777 GetInt(KeyMap, IdCmdBuffTop, ShortCut, "BuffTop", FName);
2778
2779 GetInt(KeyMap, IdCmdBuffBottom, ShortCut, "BuffBottom", FName);
2780
2781 GetInt(KeyMap, IdCmdNextWin, ShortCut, "NextWin", FName);
2782
2783 GetInt(KeyMap, IdCmdPrevWin, ShortCut, "PrevWin", FName);
2784
2785 GetInt(KeyMap, IdCmdNextSWin, ShortCut, "NextShownWin", FName);
2786
2787 GetInt(KeyMap, IdCmdPrevSWin, ShortCut, "PrevShownWin", FName);
2788
2789 GetInt(KeyMap, IdCmdLocalEcho, ShortCut, "LocalEcho", FName);
2790
2791 GetInt(KeyMap, IdCmdScrollLock, ShortCut, "ScrollLock", FName);
2792
2793 /* user keys */
2794
2795 Ptr = 0;
2796
2797 i = IdUser1;
2798 do {
2799 _snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "User%d", i - IdUser1 + 1);
2800 GetPrivateProfileString("User keys", EntName, "",
2801 TempStr, sizeof(TempStr), FName);
2802 if (strlen(TempStr) > 0) {
2803 /* scan code */
2804 GetNthString(TempStr, 1, sizeof(KStr), KStr);
2805 if (_stricmp(KStr, "off") == 0)
2806 KeyMap->Map[i - 1] = 0xFFFF;
2807 else {
2808 GetNthNum(TempStr, 1, &j);
2809 KeyMap->Map[i - 1] = (WORD) j;
2810 }
2811 /* conversion flag */
2812 GetNthNum(TempStr, 2, &j);
2813 KeyMap->UserKeyType[i - IdUser1] = (BYTE) j;
2814 /* key string */
2815 /* GetNthString(TempStr,3,sizeof(KStr),KStr); */
2816 KeyMap->UserKeyPtr[i - IdUser1] = Ptr;
2817 /* KeyMap->UserKeyLen[i-IdUser1] =
2818 Hex2Str(KStr,&(KeyMap->UserKeyStr[Ptr]),KeyStrMax-Ptr+1);
2819 */
2820 GetNthString(TempStr, 3, KeyStrMax - Ptr + 1,
2821 &(KeyMap->UserKeyStr[Ptr]));
2822 KeyMap-&