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 4698 - (show annotations) (download) (as text)
Tue Nov 1 09:16:31 2011 UTC (12 years, 5 months ago) by doda
File MIME type: text/x-csrc
File size: 108197 byte(s)
typo fix.

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