use SESSIONNAME for win32 who.device
This commit is contained in:
parent
e04943ccb1
commit
c545be8c5d
17
src/sigar.c
17
src/sigar.c
|
@ -813,7 +813,7 @@ static int get_logon_info(HKEY users,
|
||||||
DWORD status, size, type;
|
DWORD status, size, type;
|
||||||
HKEY key;
|
HKEY key;
|
||||||
char key_name[MAX_PATH];
|
char key_name[MAX_PATH];
|
||||||
char host[256];
|
char value[256];
|
||||||
FILETIME wtime;
|
FILETIME wtime;
|
||||||
|
|
||||||
who->time = 0;
|
who->time = 0;
|
||||||
|
@ -833,15 +833,22 @@ static int get_logon_info(HKEY users,
|
||||||
who->time = FileTimeToTime(&wtime) / 1000000;
|
who->time = FileTimeToTime(&wtime) / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = sizeof(host);
|
size = sizeof(value);
|
||||||
status = RegQueryValueEx(key, "CLIENTNAME",
|
status = RegQueryValueEx(key, "CLIENTNAME",
|
||||||
NULL, &type, host, &size);
|
NULL, &type, value, &size);
|
||||||
if (status == ERROR_SUCCESS) {
|
if (status == ERROR_SUCCESS) {
|
||||||
if ((host[0] != '\0') && !strEQ(host, "Console")) {
|
if ((value[0] != '\0') && !strEQ(value, "Console")) {
|
||||||
SIGAR_SSTRCPY(who->host, host);
|
SIGAR_SSTRCPY(who->host, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size = sizeof(value);
|
||||||
|
status = RegQueryValueEx(key, "SESSIONNAME",
|
||||||
|
NULL, &type, value, &size);
|
||||||
|
if (status == ERROR_SUCCESS) {
|
||||||
|
SIGAR_SSTRCPY(who->device, value);
|
||||||
|
}
|
||||||
|
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
|
|
Loading…
Reference in New Issue