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 2558 - (show annotations) (download) (as text)
Wed Jul 9 06:06:56 2008 UTC (15 years, 9 months ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 86416 byte(s)
リモートからのウィンドウタイトル変更要求を受け入れるかを設定できるようにした。
http://sourceforge.jp/tracker/index.php?func=detail&aid=12951&group_id=1412&atid=5333

設定パラメータ名は暫定であり、要検討。

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

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