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 2554 - (show annotations) (download) (as text)
Sat Jul 5 21:36:42 2008 UTC (15 years, 9 months ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 85875 byte(s)
ビジュアルベルをサポート。BEL文字を受信した時に、Beepを鳴らす代わりに画面をフラッシュさせる事が出来るようにした。
TERATERM.INIのBeepエントリを拡張し、On/Offの他にVisualを指定できるようにした。

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

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26