Browse Subversion Repository
Diff of /trunk/teraterm/ttpset/ttset.c
Parent Directory
| Revision Log
| Patch
| 55 |
#ifndef CLEARTYPE_QUALITY |
#ifndef CLEARTYPE_QUALITY |
| 56 |
#define CLEARTYPE_QUALITY 5 |
#define CLEARTYPE_QUALITY 5 |
| 57 |
#endif |
#endif |
|
#define INI_FILE_IS_UNICODE 1 |
|
| 58 |
|
|
| 59 |
#define Section "Tera Term" |
#define Section "Tera Term" |
| 60 |
#define SectionW L"Tera Term" |
#define SectionW L"Tera Term" |
| 160 |
return (ret); |
return (ret); |
| 161 |
} |
} |
| 162 |
|
|
|
#if INI_FILE_IS_UNICODE |
|
| 163 |
#undef GetPrivateProfileInt |
#undef GetPrivateProfileInt |
| 164 |
#undef GetPrivateProfileString |
#undef GetPrivateProfileString |
| 165 |
#define GetPrivateProfileInt(p1, p2, p3, p4) GetPrivateProfileIntAFileW(p1, p2, p3, p4) |
#define GetPrivateProfileInt(p1, p2, p3, p4) GetPrivateProfileIntAFileW(p1, p2, p3, p4) |
| 166 |
#define GetPrivateProfileString(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
#define GetPrivateProfileString(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 167 |
#define GetPrivateProfileStringA(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
#define GetPrivateProfileStringA(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 168 |
#define WritePrivateProfileStringA(p1, p2, p3, p4) WritePrivateProfileStringAFileW(p1, p2, p3, p4) |
#define WritePrivateProfileStringA(p1, p2, p3, p4) WritePrivateProfileStringAFileW(p1, p2, p3, p4) |
|
#endif |
|
| 169 |
|
|
| 170 |
/* |
/* |
| 171 |
* シリアルポート関連の設定 |
* シリアルポート関連の設定 |
| 3623 |
WritePrivateProfileStringW(NULL, NULL, NULL, IniDest); |
WritePrivateProfileStringW(NULL, NULL, NULL, IniDest); |
| 3624 |
} |
} |
| 3625 |
|
|
| 3626 |
void PASCAL AddValueToList(PCHAR FNameA, PCHAR Host, PCHAR section, |
void PASCAL AddValueToList(const wchar_t *FName, const wchar_t *Host, const wchar_t *section, |
| 3627 |
PCHAR key, int MaxList) |
const wchar_t *key, int MaxList) |
| 3628 |
{ |
{ |
| 3629 |
HANDLE MemH; |
wchar_t *MemP; |
| 3630 |
PCHAR MemP; |
wchar_t EntName[13]; |
|
char EntName[13]; |
|
| 3631 |
int i, j, Len; |
int i, j, Len; |
| 3632 |
BOOL Update; |
BOOL Update; |
|
#if INI_FILE_IS_UNICODE |
|
|
wchar_t *FName = ToWcharA(FNameA); |
|
|
#else |
|
|
char *FName = FNameA; |
|
|
#endif |
|
| 3633 |
|
|
| 3634 |
if ((FName[0] == 0) || (Host[0] == 0)) |
if ((FName[0] == 0) || (Host[0] == 0)) |
| 3635 |
return; |
return; |
| 3636 |
MemH = GlobalAlloc(GHND, (HostNameMaxLength + 1) * MaxList); |
MemP = malloc((HostNameMaxLength + 1) * sizeof(wchar_t) * MaxList); |
|
if (MemH == NULL) |
|
|
return; |
|
|
MemP = GlobalLock(MemH); |
|
| 3637 |
if (MemP != NULL) { |
if (MemP != NULL) { |
| 3638 |
strncpy_s(MemP, (HostNameMaxLength + 1) * MaxList, Host, _TRUNCATE); |
wcsncpy_s(MemP, (HostNameMaxLength + 1) * MaxList, Host, _TRUNCATE); |
| 3639 |
j = strlen(Host) + 1; |
j = wcslen(Host) + 1; |
| 3640 |
i = 1; |
i = 1; |
| 3641 |
Update = TRUE; |
Update = TRUE; |
| 3642 |
do { |
do { |
| 3643 |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
_snwprintf_s(EntName, _countof(EntName), _TRUNCATE, L"%s%i", key, i); |
| 3644 |
|
|
| 3645 |
/* Get a hostname */ |
/* Get a hostname */ |
| 3646 |
GetPrivateProfileStringA(section, EntName, "", |
GetPrivateProfileStringW(section, EntName, L"", |
| 3647 |
&MemP[j], HostNameMaxLength + 1, |
&MemP[j], HostNameMaxLength + 1, |
| 3648 |
FName); |
FName); |
| 3649 |
Len = strlen(&MemP[j]); |
Len = wcslen(&MemP[j]); |
| 3650 |
if (_stricmp(&MemP[j], Host) == 0) { |
if (_wcsicmp(&MemP[j], Host) == 0) { |
| 3651 |
if (i == 1) |
if (i == 1) |
| 3652 |
Update = FALSE; |
Update = FALSE; |
| 3653 |
} |
} |
| 3658 |
} while ((i <= MaxList) && Update); |
} while ((i <= MaxList) && Update); |
| 3659 |
|
|
| 3660 |
if (Update) { |
if (Update) { |
| 3661 |
WritePrivateProfileStringA(section, NULL, NULL, FName); |
WritePrivateProfileStringW(section, NULL, NULL, FName); |
| 3662 |
|
|
| 3663 |
j = 0; |
j = 0; |
| 3664 |
i = 1; |
i = 1; |
| 3665 |
do { |
do { |
| 3666 |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
_snwprintf_s(EntName, _countof(EntName), _TRUNCATE, L"%s%i", key, i); |
| 3667 |
|
|
| 3668 |
if (MemP[j] != 0) |
if (MemP[j] != 0) |
| 3669 |
WritePrivateProfileStringA(section, EntName, &MemP[j], |
WritePrivateProfileStringW(section, EntName, &MemP[j], |
| 3670 |
FName); |
FName); |
| 3671 |
j = j + strlen(&MemP[j]) + 1; |
j = j + wcslen(&MemP[j]) + 1; |
| 3672 |
i++; |
i++; |
| 3673 |
} while ((i <= MaxList) && (MemP[j] != 0)); |
} while ((i <= MaxList) && (MemP[j] != 0)); |
| 3674 |
/* update file */ |
/* update file */ |
| 3675 |
WritePrivateProfileString(NULL, NULL, NULL, FName); |
WritePrivateProfileStringW(NULL, NULL, NULL, FName); |
| 3676 |
} |
} |
| 3677 |
GlobalUnlock(MemH); |
free(MemP); |
| 3678 |
} |
} |
|
GlobalFree(MemH); |
|
| 3679 |
} |
} |
| 3680 |
|
|
| 3681 |
/* copy hostlist from source IniFile to dest IniFile */ |
/* copy hostlist from source IniFile to dest IniFile */ |
| 3684 |
CopySerialList(IniSrc, IniDest, L"Hosts", L"Host", MAXHOSTLIST); |
CopySerialList(IniSrc, IniDest, L"Hosts", L"Host", MAXHOSTLIST); |
| 3685 |
} |
} |
| 3686 |
|
|
| 3687 |
void PASCAL AddHostToList(PCHAR FName, PCHAR Host) |
void PASCAL AddHostToList(const wchar_t *FName, const wchar_t *Host) |
| 3688 |
{ |
{ |
| 3689 |
AddValueToList(FName, Host, "Hosts", "Host", MAXHOSTLIST); |
AddValueToList(FName, Host, L"Hosts", L"Host", MAXHOSTLIST); |
| 3690 |
} |
} |
| 3691 |
#if 0 |
#if 0 |
| 3692 |
BOOL NextParam(PCHAR Param, int *i, PCHAR Temp, int Size) |
BOOL NextParam(PCHAR Param, int *i, PCHAR Temp, int Size) |
|
|
Legend:
| Removed from v.9431 |
|
| changed lines |
| |
Added in v.9432 |
|
|
| |