Improve: Remove redundant code for reading the registry

This commit is contained in:
yuanyuanxiang
2025-06-29 15:23:09 +08:00
parent aa34b64995
commit 4ca2b45242
6 changed files with 29 additions and 88 deletions

View File

@@ -254,11 +254,11 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
GetModuleFileNameA(NULL, buf, sizeof(buf));
LoginInfor.AddReserved(buf); // <20>ļ<EFBFBD>·<EFBFBD><C2B7>
LoginInfor.AddReserved("?"); // test
std::string installTime;
auto b = ReadAppSettingA("install_time", installTime);
if (!b || installTime.empty()) {
installTime = ToPekingTimeAsString(nullptr);;
WriteAppSettingA("install_time", installTime);
iniFile cfg(CLIENT_PATH);
std::string installTime = cfg.GetStr("settings", "install_time");
if (installTime.empty()) {
installTime = ToPekingTimeAsString(nullptr);
cfg.SetStr("settings", "install_time", installTime);
}
LoginInfor.AddReserved(installTime.c_str()); // <20><>װʱ<D7B0><CAB1>
LoginInfor.AddReserved("?"); // <20><>װ<EFBFBD><D7B0>Ϣ
@@ -285,7 +285,6 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
strcmp(conn.szFlag, skCrypt("Happy New Year!")) == 0;
const char* id = isDefault ? masterHash.c_str() : conn.szFlag;
memcpy(LoginInfor.szMasterID, id, min(strlen(id), 16));
iniFile cfg(CLIENT_PATH);
std::string loc = cfg.GetStr("settings", "location", "");
std::string pubIP = cfg.GetStr("settings", "public_ip", "");
IPConverter cvt;