Fix: Move ONLINELIST_PRIVILEGE to end of enum to fix history host column data corruption

Commit 6d0b1bb (Feat: Add privilege column) inserted ONLINELIST_PRIVILEGE
at enum value 9, shifting INSTALLTIME from 9→10 and PATH from 12→13.
However, FileUpload_Lib (SimplePlugins) is compiled against a separate
copy of context.h that still uses the old enum values. Since
HostInfo.cpp's SaveClientMapData uses OLD enum values to read
sClientInfo[], it was reading privilegeStr for InstallTime and client
type for ProgramPath — corrupting the history host database.

Fix: move ONLINELIST_PRIVILEGE to value 16 (just before MAX), restoring
all original enum values (INSTALLTIME=9, PATH=12, etc.) so the
pre-built library can continue reading correct data without recompilation.

The 'permission' column now appears as the rightmost column in the
online host list instead of between 'version' and 'install time'.

Co-Authored-By: DeepSeek V4 Pro
This commit is contained in:
yuanyuanxiang
2026-08-05 19:56:12 +02:00
parent d99510e46d
commit 7c09e9dd8c
4 changed files with 23 additions and 9 deletions

View File

@@ -148,10 +148,14 @@ COLUMNSTRUCT g_Column_Data_Online[g_Column_Count_Online] = {
{"摄像头", 60 }, {"摄像头", 60 },
{"RTT", 60 }, {"RTT", 60 },
{"版本", 90 }, {"版本", 90 },
{"权限", 60 },
{"安装时间", 130 }, {"安装时间", 130 },
{"活动窗口", 130 }, {"活动窗口", 130 },
{"类型", 50 }, {"类型", 50 },
{"", 0 },
{"", 0 },
{"", 0 },
{"", 0 },
{"权限", 60 },
}; };
// 缩略图列号常量 + 列号→数据槽映射。负返回值代表"该列无数据槽"。 // 缩略图列号常量 + 列号→数据槽映射。负返回值代表"该列无数据槽"。
@@ -1412,6 +1416,12 @@ VOID CMy2015RemoteDlg::InitControl()
g_Column_Online_Width+=g_Column_Data_Online[i].nWidth; g_Column_Online_Width+=g_Column_Data_Online[i].nWidth;
} }
m_CList_Online.InitColumns(); m_CList_Online.InitColumns();
// 隐藏空标题列(内部数据槽,不允许用户拖拽显示)
for (int i = 0; i < g_Column_Count_Online; ++i) {
if (g_Column_Data_Online[i].szTitle[0] == '\0') {
m_CList_Online.SetColumnVisible(i, FALSE);
}
}
// 让虚拟列表用 Unicode 通知LVN_GETDISPINFOW从而绕开 MBCS 工程里 // 让虚拟列表用 Unicode 通知LVN_GETDISPINFOW从而绕开 MBCS 工程里
// 列表 → ANSI → CP_ACP 的回转,这样在德语/日语等非中文 ACP 服务端上也能显示中文。 // 列表 → ANSI → CP_ACP 的回转,这样在德语/日语等非中文 ACP 服务端上也能显示中文。
m_CList_Online.SendMessage(LVM_SETUNICODEFORMAT, TRUE, 0); m_CList_Online.SendMessage(LVM_SETUNICODEFORMAT, TRUE, 0);
@@ -1487,8 +1497,8 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
CString privilegeStr = privUser == "SYSTEM" ? "SYSTEM" : privAdmin == "1" ? "Admin" : "User"; CString privilegeStr = privUser == "SYSTEM" ? "SYSTEM" : privAdmin == "1" ? "Admin" : "User";
CString data[ONLINELIST_MAX] = { strIP, strAddr, "", strPCName, strOS, strCPU, strVideo, strPing, CString data[ONLINELIST_MAX] = { strIP, strAddr, "", strPCName, strOS, strCPU, strVideo, strPing,
verDisplay, privilegeStr, install, startTime, v[RES_CLIENT_TYPE].empty() ? "?" : v[RES_CLIENT_TYPE].c_str(), path, verDisplay, install, startTime, v[RES_CLIENT_TYPE].empty() ? "?" : v[RES_CLIENT_TYPE].c_str(), path,
v[RES_CLIENT_PUBIP].empty() ? strIP : v[RES_CLIENT_PUBIP].c_str(), startTime, capStr, v[RES_CLIENT_PUBIP].empty() ? strIP : v[RES_CLIENT_PUBIP].c_str(), startTime, capStr, privilegeStr,
}; };
// 优先采用客户端自报的 ID新客户端用 V2 算法 = MachineGuid + 归一化路径, // 优先采用客户端自报的 ID新客户端用 V2 算法 = MachineGuid + 归一化路径,
// 比服务端按老算法 IP+PC+OS+CPU+PATH 重算更稳定)。 // 比服务端按老算法 IP+PC+OS+CPU+PATH 重算更稳定)。

View File

@@ -104,10 +104,14 @@ inline const char* GetColumnName(int index) {
"Camera", // 6 "Camera", // 6
"RTT", // 7 "RTT", // 7
"Version", // 8 "Version", // 8
"Privilege", // 9 ONLINELIST_PRIVILEGE "InstallTime", // 9 ONLINELIST_INSTALLTIME
"InstallTime", // 10 ONLINELIST_INSTALLTIME "ActiveWindow", // 10 ONLINELIST_LOGINTIME
"ActiveWindow", // 11 ONLINELIST_LOGINTIME "ClientType", // 11 ONLINELIST_CLIENTTYPE
"ClientType", // 12 ONLINELIST_CLIENTTYPE "Path", // 12 ONLINELIST_PATH
"PublicIP", // 13 ONLINELIST_PUBIP
"StartTime", // 14 ONLINELIST_STARTTIME
"Capabilities", // 15 ONLINELIST_CAPABILITIES
"Privilege", // 16 ONLINELIST_PRIVILEGE
}; };
if (index >= 0 && index < sizeof(names)/sizeof(names[0])) { if (index >= 0 && index < sizeof(names)/sizeof(names[0])) {
return names[index]; return names[index];

View File

@@ -111,10 +111,10 @@ void NotifySettingsDlg::PopulateComboBoxes()
{ ONLINELIST_VIDEO, _T("摄像头") }, { ONLINELIST_VIDEO, _T("摄像头") },
{ ONLINELIST_PING, _T("延迟") }, { ONLINELIST_PING, _T("延迟") },
{ ONLINELIST_VERSION, _T("版本") }, { ONLINELIST_VERSION, _T("版本") },
{ ONLINELIST_PRIVILEGE, _T("权限") },
{ ONLINELIST_INSTALLTIME, _T("安装时间") }, { ONLINELIST_INSTALLTIME, _T("安装时间") },
{ ONLINELIST_LOGINTIME, _T("活动窗口") }, { ONLINELIST_LOGINTIME, _T("活动窗口") },
{ ONLINELIST_CLIENTTYPE, _T("客户端类型") }, { ONLINELIST_CLIENTTYPE, _T("客户端类型") },
{ ONLINELIST_PRIVILEGE, _T("权限") },
}; };
for (const auto& col : columns) { for (const auto& col : columns) {
CString item; CString item;

View File

@@ -14,7 +14,6 @@ enum {
ONLINELIST_VIDEO, // 摄像头(有无) ONLINELIST_VIDEO, // 摄像头(有无)
ONLINELIST_PING, // PING(对方的网速) ONLINELIST_PING, // PING(对方的网速)
ONLINELIST_VERSION, // 版本信息 ONLINELIST_VERSION, // 版本信息
ONLINELIST_PRIVILEGE, // 权限级别 (SYSTEM/Admin/User)
ONLINELIST_INSTALLTIME, // 安装时间 ONLINELIST_INSTALLTIME, // 安装时间
ONLINELIST_LOGINTIME, // 活动窗口 ONLINELIST_LOGINTIME, // 活动窗口
ONLINELIST_CLIENTTYPE, // 客户端类型 ONLINELIST_CLIENTTYPE, // 客户端类型
@@ -22,6 +21,7 @@ enum {
ONLINELIST_PUBIP, ONLINELIST_PUBIP,
ONLINELIST_STARTTIME, ONLINELIST_STARTTIME,
ONLINELIST_CAPABILITIES, // 客户端能力位 ONLINELIST_CAPABILITIES, // 客户端能力位
ONLINELIST_PRIVILEGE, // 权限级别 (SYSTEM/Admin/User)
ONLINELIST_MAX, ONLINELIST_MAX,
}; };