| 41 |
#include "ttlib.h" |
#include "ttlib.h" |
| 42 |
#include "tt_res.h" |
#include "tt_res.h" |
| 43 |
#include "servicenames.h" |
#include "servicenames.h" |
| 44 |
|
#include "codeconv.h" |
| 45 |
|
|
| 46 |
#define DllExport __declspec(dllexport) |
#define DllExport __declspec(dllexport) |
| 47 |
#include "ttset.h" |
#include "ttset.h" |
| 49 |
#ifndef CLEARTYPE_QUALITY |
#ifndef CLEARTYPE_QUALITY |
| 50 |
#define CLEARTYPE_QUALITY 5 |
#define CLEARTYPE_QUALITY 5 |
| 51 |
#endif |
#endif |
| 52 |
|
#define INI_FILE_IS_UNICODE 1 |
| 53 |
|
|
| 54 |
#define Section "Tera Term" |
#define Section "Tera Term" |
| 55 |
|
|
| 154 |
return (ret); |
return (ret); |
| 155 |
} |
} |
| 156 |
|
|
| 157 |
|
/** |
| 158 |
|
* GetPrivateProfileStringA() のファイル名だけが wchar_t 版 |
| 159 |
|
*/ |
| 160 |
|
DWORD GetPrivateProfileStringAFileW(const char *appA, const char *keyA, const char* defA, char *strA, DWORD size, const wchar_t *filenameW) |
| 161 |
|
{ |
| 162 |
|
DWORD lenA; |
| 163 |
|
wchar_t *appW = ToWcharA(appA); |
| 164 |
|
wchar_t *keyW = ToWcharA(keyA); |
| 165 |
|
wchar_t *defW = ToWcharA(defA); |
| 166 |
|
DWORD lenW_max = size; |
| 167 |
|
wchar_t *strW = malloc(sizeof(wchar_t) * lenW_max); |
| 168 |
|
DWORD lenW = GetPrivateProfileStringW(appW, keyW, defW, strW, lenW_max, filenameW); |
| 169 |
|
free(appW); |
| 170 |
|
free(keyW); |
| 171 |
|
free(defW); |
| 172 |
|
if (lenW == 0) { |
| 173 |
|
free(strW); |
| 174 |
|
*strA = '\0'; |
| 175 |
|
return 0; |
| 176 |
|
} |
| 177 |
|
if (lenW < lenW_max) { |
| 178 |
|
lenW++; // for L'\0' |
| 179 |
|
} |
| 180 |
|
lenA = WideCharToMultiByte(CP_ACP, 0, strW, lenW, strA, size, NULL, NULL); |
| 181 |
|
// GetPrivateProfileStringW() の戻り値は '\0' を含まない文字列長 |
| 182 |
|
// WideCharToMultiByte() の戻り値は '\0' を含む文字列長 |
| 183 |
|
if (lenW != 0 && strA[lenA-1] == 0) { |
| 184 |
|
lenA--; |
| 185 |
|
} |
| 186 |
|
return lenA; |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
/** |
| 190 |
|
* WritePrivateProfileStringA() のファイル名だけが wchar_t 版 |
| 191 |
|
*/ |
| 192 |
|
BOOL WritePrivateProfileStringAFileW(const char *appA, const char *keyA, const char *strA, const wchar_t *filenameW) |
| 193 |
|
{ |
| 194 |
|
wchar_t *appW = ToWcharA(appA); |
| 195 |
|
wchar_t *keyW = ToWcharA(keyA); |
| 196 |
|
wchar_t *strW = ToWcharA(strA); |
| 197 |
|
BOOL r = WritePrivateProfileStringW(appW, keyW, strW, filenameW); |
| 198 |
|
free(appW); |
| 199 |
|
free(keyW); |
| 200 |
|
free(strW); |
| 201 |
|
return r; |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
/** |
| 205 |
|
* GetPrivateProfileIntFileA() のファイル名だけが wchar_t 版 |
| 206 |
|
*/ |
| 207 |
|
UINT GetPrivateProfileIntFileW(const char *appA, const char *keyA, int def, const wchar_t *filenameW) |
| 208 |
|
{ |
| 209 |
|
wchar_t *appW = ToWcharA(appA); |
| 210 |
|
wchar_t *keyW = ToWcharA(keyA); |
| 211 |
|
UINT r = GetPrivateProfileIntW(appW, keyW, def, filenameW); |
| 212 |
|
free(appW); |
| 213 |
|
free(keyW); |
| 214 |
|
return r; |
| 215 |
|
} |
| 216 |
|
|
| 217 |
|
/** |
| 218 |
|
* WritePrivateProfileInt() のファイル名だけが wchar_t 版 |
| 219 |
|
*/ |
| 220 |
|
BOOL WritePrivateProfileIntFileW(const char *appA, const char *keyA, int val, const wchar_t *filenameW) |
| 221 |
|
{ |
| 222 |
|
wchar_t strW[MAX_PATH]; |
| 223 |
|
wchar_t *appW = ToWcharA(appA); |
| 224 |
|
wchar_t *keyW = ToWcharA(keyA); |
| 225 |
|
BOOL r; |
| 226 |
|
_snwprintf_s(strW, _countof(strW), _TRUNCATE, L"%d", val); |
| 227 |
|
r = WritePrivateProfileStringW(appW, keyW, strW, filenameW); |
| 228 |
|
free(appW); |
| 229 |
|
free(keyW); |
| 230 |
|
return r; |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
#if INI_FILE_IS_UNICODE |
| 234 |
|
#undef GetPrivateProfileInt |
| 235 |
|
#undef GetPrivateProfileString |
| 236 |
|
#define GetPrivateProfileInt(p1, p2, p3, p4) GetPrivateProfileIntFileW(p1, p2, p3, p4) |
| 237 |
|
#define GetPrivateProfileString(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 238 |
|
#define GetPrivateProfileStringA(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 239 |
|
#define WritePrivateProfileStringA(p1, p2, p3, p4) WritePrivateProfileStringAFileW(p1, p2, p3, p4) |
| 240 |
|
#endif |
| 241 |
|
|
| 242 |
/* |
/* |
| 243 |
* シリアルポート関連の設定 |
* シリアルポート関連の設定 |
| 244 |
* 文字列からIdに変換する。 |
* 文字列からIdに変換する。 |
| 385 |
strncpy_s(name, len, icon, _TRUNCATE); |
strncpy_s(name, len, icon, _TRUNCATE); |
| 386 |
} |
} |
| 387 |
|
|
| 388 |
WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default) |
#if INI_FILE_IS_UNICODE |
| 389 |
|
static WORD GetOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, BOOL Default) |
| 390 |
|
#else |
| 391 |
|
static WORD GetOnOff(PCHAR Sect, PCHAR Key, const char *FName, BOOL Default) |
| 392 |
|
#endif |
| 393 |
{ |
{ |
| 394 |
char Temp[4]; |
char Temp[4]; |
| 395 |
GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName); |
GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName); |
| 407 |
} |
} |
| 408 |
} |
} |
| 409 |
|
|
| 410 |
void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag) |
#if INI_FILE_IS_UNICODE |
| 411 |
|
void WriteOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, WORD Flag) |
| 412 |
|
#else |
| 413 |
|
void WriteOnOff(PCHAR Sect, PCHAR Key, const char *FName, WORD Flag) |
| 414 |
|
#endif |
| 415 |
{ |
{ |
| 416 |
char Temp[4]; |
const char *on_off = (Flag != 0) ? "on" : "off"; |
| 417 |
|
WritePrivateProfileStringA(Sect, Key, on_off, FName); |
|
if (Flag != 0) |
|
|
strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE); |
|
|
else |
|
|
strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE); |
|
|
WritePrivateProfileString(Sect, Key, Temp, FName); |
|
| 418 |
} |
} |
| 419 |
|
|
| 420 |
void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i) |
#if INI_FILE_IS_UNICODE |
| 421 |
|
void WriteInt(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i) |
| 422 |
|
#else |
| 423 |
|
void WriteInt(PCHAR Sect, PCHAR Key, const char *FName, int i) |
| 424 |
|
#endif |
| 425 |
{ |
{ |
| 426 |
char Temp[15]; |
char Temp[15]; |
| 427 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i); |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i); |
| 428 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 429 |
} |
} |
| 430 |
|
|
| 431 |
void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i) |
#if INI_FILE_IS_UNICODE |
| 432 |
|
void WriteUint(PCHAR Sect, PCHAR Key, const wchar_t *FName, UINT i) |
| 433 |
|
#else |
| 434 |
|
void WriteUint(PCHAR Sect, PCHAR Key, const char *FName, UINT i) |
| 435 |
|
#endif |
| 436 |
{ |
{ |
| 437 |
char Temp[15]; |
char Temp[15]; |
| 438 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i); |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i); |
| 439 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 440 |
} |
} |
| 441 |
|
|
| 442 |
void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2) |
#if INI_FILE_IS_UNICODE |
| 443 |
|
void WriteInt2(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i1, int i2) |
| 444 |
|
#else |
| 445 |
|
void WriteInt2(PCHAR Sect, PCHAR Key, const char *FName, int i1, int i2) |
| 446 |
|
#endif |
| 447 |
{ |
{ |
| 448 |
char Temp[32]; |
char Temp[32]; |
| 449 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2); |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2); |
| 450 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 451 |
} |
} |
| 452 |
|
|
| 453 |
void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName, |
#if INI_FILE_IS_UNICODE |
| 454 |
|
void WriteInt4(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 455 |
|
int i1, int i2, int i3, int i4) |
| 456 |
|
#else |
| 457 |
|
void WriteInt4(PCHAR Sect, PCHAR Key, const char *FName, |
| 458 |
int i1, int i2, int i3, int i4) |
int i1, int i2, int i3, int i4) |
| 459 |
|
#endif |
| 460 |
{ |
{ |
| 461 |
char Temp[64]; |
char Temp[64]; |
| 462 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d", |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d", |
| 463 |
i1, i2, i3, i4); |
i1, i2, i3, i4); |
| 464 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 465 |
} |
} |
| 466 |
|
|
| 467 |
void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName, |
#if INI_FILE_IS_UNICODE |
| 468 |
|
void WriteInt6(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 469 |
|
int i1, int i2, int i3, int i4, int i5, int i6) |
| 470 |
|
#else |
| 471 |
|
void WriteInt6(PCHAR Sect, PCHAR Key, const char *FName, |
| 472 |
int i1, int i2, int i3, int i4, int i5, int i6) |
int i1, int i2, int i3, int i4, int i5, int i6) |
| 473 |
|
#endif |
| 474 |
{ |
{ |
| 475 |
char Temp[96]; |
char Temp[96]; |
| 476 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d", |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d", |
| 477 |
i1, i2,i3, i4, i5, i6); |
i1, i2,i3, i4, i5, i6); |
| 478 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 479 |
} |
} |
| 480 |
|
|
| 481 |
// フォント情報書き込み、4パラメータ版 |
// フォント情報書き込み、4パラメータ版 |
| 482 |
static void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName, |
#if INI_FILE_IS_UNICODE |
| 483 |
|
static void WriteFont(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 484 |
|
PCHAR Name, int x, int y, int charset) |
| 485 |
|
#else |
| 486 |
|
static void WriteFont(PCHAR Sect, PCHAR Key, const char *FName, |
| 487 |
PCHAR Name, int x, int y, int charset) |
PCHAR Name, int x, int y, int charset) |
| 488 |
|
#endif |
| 489 |
{ |
{ |
| 490 |
char Temp[80]; |
char Temp[80]; |
| 491 |
if (Name[0] != 0) |
if (Name[0] != 0) |
| 493 |
Name, x, y, charset); |
Name, x, y, charset); |
| 494 |
else |
else |
| 495 |
Temp[0] = 0; |
Temp[0] = 0; |
| 496 |
WritePrivateProfileString(Sect, Key, Temp, FName); |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 497 |
} |
} |
| 498 |
|
|
| 499 |
// フォント情報読み込み、4パラメータ版 |
// フォント情報読み込み、4パラメータ版 |
| 500 |
|
#if INI_FILE_IS_UNICODE |
| 501 |
|
static void ReadFont( |
| 502 |
|
const char *Sect, const char *Key, const char *Default, const wchar_t *FName, |
| 503 |
|
char *FontName, size_t FontNameLen, POINT *FontSize, int *FontCharSet) |
| 504 |
|
#else |
| 505 |
static void ReadFont( |
static void ReadFont( |
| 506 |
const char *Sect, const char *Key, const char *Default, const char *FName, |
const char *Sect, const char *Key, const char *Default, const char *FName, |
| 507 |
char *FontName, size_t FontNameLen, POINT *FontSize, int *FontCharSet) |
char *FontName, size_t FontNameLen, POINT *FontSize, int *FontCharSet) |
| 508 |
|
#endif |
| 509 |
{ |
{ |
| 510 |
char Temp[MAX_PATH]; |
char Temp[MAX_PATH]; |
| 511 |
GetPrivateProfileString(Sect, Key, Default, |
GetPrivateProfileString(Sect, Key, Default, |
| 526 |
} |
} |
| 527 |
|
|
| 528 |
// フォント情報読み込み、3パラメータ版 |
// フォント情報読み込み、3パラメータ版 |
| 529 |
|
#if INI_FILE_IS_UNICODE |
| 530 |
|
static void ReadFont3( |
| 531 |
|
const char *Sect, const char *Key, const char *Default, const wchar_t *FName, |
| 532 |
|
char *FontName, size_t FontNameLen, int *FontPoint, int *FontCharSet) |
| 533 |
|
#else |
| 534 |
static void ReadFont3( |
static void ReadFont3( |
| 535 |
const char *Sect, const char *Key, const char *Default, const char *FName, |
const char *Sect, const char *Key, const char *Default, const char *FName, |
| 536 |
char *FontName, size_t FontNameLen, int *FontPoint, int *FontCharSet) |
char *FontName, size_t FontNameLen, int *FontPoint, int *FontCharSet) |
| 537 |
|
#endif |
| 538 |
{ |
{ |
| 539 |
char Temp[MAX_PATH]; |
char Temp[MAX_PATH]; |
| 540 |
GetPrivateProfileString(Sect, Key, Default, |
GetPrivateProfileString(Sect, Key, Default, |
| 583 |
fp = fopen(cfg, "r"); |
fp = fopen(cfg, "r"); |
| 584 |
if (fp != NULL) { |
if (fp != NULL) { |
| 585 |
while (fgets(buf, sizeof(buf), fp) != NULL) { |
while (fgets(buf, sizeof(buf), fp) != NULL) { |
| 586 |
int len = strlen(buf); |
size_t len = strlen(buf); |
| 587 |
|
|
| 588 |
if (buf[len - 1] == '\n') |
if (buf[len - 1] == '\n') |
| 589 |
buf[len - 1] = '\0'; |
buf[len - 1] = '\0'; |
| 661 |
char uimsg[MAX_UIMSG]; |
char uimsg[MAX_UIMSG]; |
| 662 |
cygterm_t settings; |
cygterm_t settings; |
| 663 |
char *line[CYGTERM_FILE_MAXLINE]; |
char *line[CYGTERM_FILE_MAXLINE]; |
| 664 |
int i, linenum, len; |
int i, linenum; |
| 665 |
|
|
| 666 |
// Cygwin設定が変更されていない場合は、ファイルを書き込まない。 |
// Cygwin設定が変更されていない場合は、ファイルを書き込まない。 |
| 667 |
if (ts->CygtermSettings.update_flag == FALSE) |
if (ts->CygtermSettings.update_flag == FALSE) |
| 686 |
if (fp) { |
if (fp) { |
| 687 |
i = 0; |
i = 0; |
| 688 |
while (fgets(buf, sizeof(buf), fp) != NULL) { |
while (fgets(buf, sizeof(buf), fp) != NULL) { |
| 689 |
len = strlen(buf); |
size_t len = strlen(buf); |
| 690 |
if (buf[len - 1] == '\n') |
if (buf[len - 1] == '\n') |
| 691 |
buf[len - 1] = '\0'; |
buf[len - 1] = '\0'; |
| 692 |
if (i < CYGTERM_FILE_MAXLINE) |
if (i < CYGTERM_FILE_MAXLINE) |
| 833 |
|
|
| 834 |
} |
} |
| 835 |
|
|
| 836 |
void PASCAL ReadIniFile(PCHAR FName, PTTSet ts) |
void PASCAL ReadIniFile(PCHAR FNameA, PTTSet ts) |
| 837 |
{ |
{ |
| 838 |
int i; |
int i; |
| 839 |
HDC TmpDC; |
HDC TmpDC; |
| 840 |
char Temp[MAX_PATH], Temp2[MAX_PATH], *p; |
char Temp[MAX_PATH], Temp2[MAX_PATH], *p; |
| 841 |
|
#if INI_FILE_IS_UNICODE |
| 842 |
|
const wchar_t *FName = ToWcharA(FNameA); |
| 843 |
|
#else |
| 844 |
|
const char *FName = FNameA; |
| 845 |
|
#endif |
| 846 |
|
|
| 847 |
ts->Minimize = 0; |
ts->Minimize = 0; |
| 848 |
ts->HideWindow = 0; |
ts->HideWindow = 0; |
| 2383 |
if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { |
if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { |
| 2384 |
ts->UnicodeEmojiWidth = 1; |
ts->UnicodeEmojiWidth = 1; |
| 2385 |
} |
} |
| 2386 |
|
|
| 2387 |
|
#if INI_FILE_IS_UNICODE |
| 2388 |
|
free((void *)FName); |
| 2389 |
|
#endif |
| 2390 |
} |
} |
| 2391 |
|
|
| 2392 |
void PASCAL WriteIniFile(PCHAR FName, PTTSet ts) |
void PASCAL WriteIniFile(PCHAR FNameA, PTTSet ts) |
| 2393 |
{ |
{ |
| 2394 |
int i; |
int i; |
| 2395 |
char Temp[MAX_PATH]; |
char Temp[MAX_PATH]; |
| 2396 |
char buf[20]; |
char buf[20]; |
| 2397 |
int ret; |
int ret; |
| 2398 |
char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG]; |
char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG]; |
| 2399 |
|
#if INI_FILE_IS_UNICODE |
| 2400 |
|
const wchar_t *FName = ToWcharA(FNameA); |
| 2401 |
|
#else |
| 2402 |
|
const char *FName = FNameA; |
| 2403 |
|
#endif |
| 2404 |
|
|
| 2405 |
/* version */ |
/* version */ |
| 2406 |
ret = WritePrivateProfileString(Section, "Version", TT_VERSION_STR("."), FName); |
ret = WritePrivateProfileString(Section, "Version", TT_VERSION_STR("."), FName); |
| 3316 |
ts->EtermLookfeel.BGNoFrame); |
ts->EtermLookfeel.BGNoFrame); |
| 3317 |
WritePrivateProfileString(ETERM_SECTION, "BGThemeFile", |
WritePrivateProfileString(ETERM_SECTION, "BGThemeFile", |
| 3318 |
ts->EtermLookfeel.BGThemeFile, FName); |
ts->EtermLookfeel.BGThemeFile, FName); |
| 3319 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s\\%s", ts->HomeDir, BG_THEME_IMAGEFILE); |
{ |
| 3320 |
WritePrivateProfileString(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, Temp); |
#if INI_FILE_IS_UNICODE |
| 3321 |
WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, Temp, ts->BGImgBrightness); |
wchar_t TempW[MAX_PATH]; |
| 3322 |
WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, Temp, ts->BGImgBrightness); |
_snwprintf_s(TempW, _countof(TempW), _TRUNCATE, L"%hs\\%hs", ts->HomeDir, BG_THEME_IMAGEFILE); |
| 3323 |
|
#else |
| 3324 |
|
char TempW[MAX_PATH]; |
| 3325 |
|
_snprintf_s(TempW, _countof(TempW), _TRUNCATE, "%s\\%s", ts->HomeDir, BG_THEME_IMAGEFILE); |
| 3326 |
|
#endif |
| 3327 |
|
WritePrivateProfileStringA(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, TempW); |
| 3328 |
|
WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, TempW, ts->BGImgBrightness); |
| 3329 |
|
WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, TempW, ts->BGImgBrightness); |
| 3330 |
|
} |
| 3331 |
WriteOnOff(ETERM_SECTION, "BGIgnoreThemeFile", FName, |
WriteOnOff(ETERM_SECTION, "BGIgnoreThemeFile", FName, |
| 3332 |
ts->EtermLookfeel.BGIgnoreThemeFile); |
ts->EtermLookfeel.BGIgnoreThemeFile); |
| 3333 |
|
|
| 3727 |
WriteInt(Section, "UnicodeAmbiguousWidth", FName, ts->UnicodeAmbiguousWidth); |
WriteInt(Section, "UnicodeAmbiguousWidth", FName, ts->UnicodeAmbiguousWidth); |
| 3728 |
WriteOnOff(Section, "UnicodeEmojiOverride", FName, ts->UnicodeEmojiOverride); |
WriteOnOff(Section, "UnicodeEmojiOverride", FName, ts->UnicodeEmojiOverride); |
| 3729 |
WriteInt(Section, "UnicodeEmojiWidth", FName, ts->UnicodeEmojiWidth); |
WriteInt(Section, "UnicodeEmojiWidth", FName, ts->UnicodeEmojiWidth); |
| 3730 |
|
|
| 3731 |
|
#if INI_FILE_IS_UNICODE |
| 3732 |
|
free((void *)FName); |
| 3733 |
|
#endif |
| 3734 |
} |
} |
| 3735 |
|
|
| 3736 |
#define VTEditor "VT editor keypad" |
#define VTEditor "VT editor keypad" |
| 3739 |
#define XFunction "X function keys" |
#define XFunction "X function keys" |
| 3740 |
#define ShortCut "Shortcut keys" |
#define ShortCut "Shortcut keys" |
| 3741 |
|
|
| 3742 |
|
#if INI_FILE_IS_UNICODE |
| 3743 |
|
static void GetInt(PKeyMap KeyMap, int KeyId, const char *Sect, const char *Key, const wchar_t *FName) |
| 3744 |
|
#else |
| 3745 |
static void GetInt(PKeyMap KeyMap, int KeyId, const char *Sect, const char *Key, const char *FName) |
static void GetInt(PKeyMap KeyMap, int KeyId, const char *Sect, const char *Key, const char *FName) |
| 3746 |
|
#endif |
| 3747 |
{ |
{ |
| 3748 |
char Temp[11]; |
char Temp[11]; |
| 3749 |
WORD Num; |
WORD Num; |
| 3760 |
} |
} |
| 3761 |
|
|
| 3762 |
void PASCAL ReadKeyboardCnf |
void PASCAL ReadKeyboardCnf |
| 3763 |
(PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) { |
(PCHAR FNameA, PKeyMap KeyMap, BOOL ShowWarning) { |
| 3764 |
int i, j, Ptr; |
int i, j, Ptr; |
| 3765 |
char EntName[7]; |
char EntName[7]; |
| 3766 |
char TempStr[221]; |
char TempStr[221]; |
| 3767 |
char KStr[201]; |
char KStr[201]; |
| 3768 |
|
#if INI_FILE_IS_UNICODE |
| 3769 |
|
const wchar_t *FName = ToWcharA(FNameA); |
| 3770 |
|
#else |
| 3771 |
|
const char *FName = FNameA; |
| 3772 |
|
#endif |
| 3773 |
|
|
| 3774 |
// clear key map |
// clear key map |
| 3775 |
for (i = 0; i <= IdKeyMax - 1; i++) |
for (i = 0; i <= IdKeyMax - 1; i++) |
| 4015 |
} |
} |
| 4016 |
KeyMap->Map[i] = 0xFFFF; |
KeyMap->Map[i] = 0xFFFF; |
| 4017 |
} |
} |
| 4018 |
|
|
| 4019 |
|
#if INI_FILE_IS_UNICODE |
| 4020 |
|
free((void *)FName); |
| 4021 |
|
#endif |
| 4022 |
} |
} |
| 4023 |
|
|
| 4024 |
void PASCAL CopySerialList(PCHAR IniSrc, PCHAR IniDest, PCHAR section, |
void PASCAL CopySerialList(PCHAR IniSrcA, PCHAR IniDestA, PCHAR section, |
| 4025 |
PCHAR key, int MaxList) |
PCHAR key, int MaxList) |
| 4026 |
{ |
{ |
| 4027 |
int i, j; |
int i, j; |
| 4028 |
char EntName[10], EntName2[10]; |
char EntName[10], EntName2[10]; |
| 4029 |
char TempHost[HostNameMaxLength + 1]; |
char TempHost[HostNameMaxLength + 1]; |
| 4030 |
|
#if INI_FILE_IS_UNICODE |
| 4031 |
|
const wchar_t *IniSrc = ToWcharA(IniSrcA); |
| 4032 |
|
const wchar_t *IniDest = ToWcharA(IniDestA); |
| 4033 |
|
#else |
| 4034 |
|
const char *IniSrc = IniSrcA; |
| 4035 |
|
const char *IniDest = IniDestA; |
| 4036 |
|
#endif |
| 4037 |
|
|
| 4038 |
|
#if INI_FILE_IS_UNICODE |
| 4039 |
|
if (_wcsicmp(IniSrc, IniDest) == 0) |
| 4040 |
|
return; |
| 4041 |
|
#else |
| 4042 |
if (_stricmp(IniSrc, IniDest) == 0) |
if (_stricmp(IniSrc, IniDest) == 0) |
| 4043 |
return; |
return; |
| 4044 |
|
#endif |
| 4045 |
|
|
| 4046 |
WritePrivateProfileString(section, NULL, NULL, IniDest); |
WritePrivateProfileString(section, NULL, NULL, IniDest); |
| 4047 |
|
|
| 4066 |
WritePrivateProfileString(NULL, NULL, NULL, IniDest); |
WritePrivateProfileString(NULL, NULL, NULL, IniDest); |
| 4067 |
} |
} |
| 4068 |
|
|
| 4069 |
void PASCAL AddValueToList(PCHAR FName, PCHAR Host, PCHAR section, |
void PASCAL AddValueToList(PCHAR FNameA, PCHAR Host, PCHAR section, |
| 4070 |
PCHAR key, int MaxList) |
PCHAR key, int MaxList) |
| 4071 |
{ |
{ |
| 4072 |
HANDLE MemH; |
HANDLE MemH; |
| 4074 |
char EntName[13]; |
char EntName[13]; |
| 4075 |
int i, j, Len; |
int i, j, Len; |
| 4076 |
BOOL Update; |
BOOL Update; |
| 4077 |
|
#if INI_FILE_IS_UNICODE |
| 4078 |
|
wchar_t *FName = ToWcharA(FNameA); |
| 4079 |
|
#else |
| 4080 |
|
char *FName = FNameA; |
| 4081 |
|
#endif |
| 4082 |
|
|
| 4083 |
if ((FName[0] == 0) || (Host[0] == 0)) |
if ((FName[0] == 0) || (Host[0] == 0)) |
| 4084 |
return; |
return; |
| 4095 |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
| 4096 |
|
|
| 4097 |
/* Get a hostname */ |
/* Get a hostname */ |
| 4098 |
GetPrivateProfileString(section, EntName, "", |
GetPrivateProfileStringA(section, EntName, "", |
| 4099 |
&MemP[j], HostNameMaxLength + 1, |
&MemP[j], HostNameMaxLength + 1, |
| 4100 |
FName); |
FName); |
| 4101 |
Len = strlen(&MemP[j]); |
Len = strlen(&MemP[j]); |
| 4102 |
if (_stricmp(&MemP[j], Host) == 0) { |
if (_stricmp(&MemP[j], Host) == 0) { |
| 4103 |
if (i == 1) |
if (i == 1) |
| 4110 |
} while ((i <= MaxList) && Update); |
} while ((i <= MaxList) && Update); |
| 4111 |
|
|
| 4112 |
if (Update) { |
if (Update) { |
| 4113 |
WritePrivateProfileString(section, NULL, NULL, FName); |
WritePrivateProfileStringA(section, NULL, NULL, FName); |
| 4114 |
|
|
| 4115 |
j = 0; |
j = 0; |
| 4116 |
i = 1; |
i = 1; |
| 4118 |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
| 4119 |
|
|
| 4120 |
if (MemP[j] != 0) |
if (MemP[j] != 0) |
| 4121 |
WritePrivateProfileString(section, EntName, &MemP[j], |
WritePrivateProfileStringA(section, EntName, &MemP[j], |
| 4122 |
FName); |
FName); |
| 4123 |
j = j + strlen(&MemP[j]) + 1; |
j = j + strlen(&MemP[j]) + 1; |
| 4124 |
i++; |
i++; |
| 4125 |
} while ((i <= MaxList) && (MemP[j] != 0)); |
} while ((i <= MaxList) && (MemP[j] != 0)); |
| 4230 |
if (*s == ']') { |
if (*s == ']') { |
| 4231 |
/* found IPv6 raw address */ |
/* found IPv6 raw address */ |
| 4232 |
/* triming [ ] */ |
/* triming [ ] */ |
| 4233 |
int len = strlen(HostStr); |
size_t len = strlen(HostStr); |
| 4234 |
char *lastptr = &HostStr[len - 1]; |
char *lastptr = &HostStr[len - 1]; |
| 4235 |
memmove(HostStr, HostStr + 1, len - 1); |
memmove(HostStr, HostStr + 1, len - 1); |
| 4236 |
s = s - 1; |
s = s - 1; |