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 4857 - (show annotations) (download) (as text)
Thu Mar 8 15:50:26 2012 UTC (12 years, 1 month ago) by yutakapon
File MIME type: text/x-csrc
File size: 111356 byte(s)
名前付きパイプをサポートした。
VMware Player 3.1.5 + Fedora 16 で動作確認済み。

* 未サポート
  - 接続ダイアログからの設定
  - ブレーク送信
  - 他

* コマンドライン
  書式 /NAMEDPIPE 名前付きパイプ名
  例   /NAMEDPIPE \\.\pipe\vmware-serial-port

* teraterm.ini
  Port=namedpipe 追加


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