From c545be8c5d4191a895dd881cbadb340f62c08eae Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 24 Jul 2005 05:34:21 +0000 Subject: [PATCH] use SESSIONNAME for win32 who.device --- src/sigar.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/sigar.c b/src/sigar.c index cb0557d2..7c1cf6d7 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -813,7 +813,7 @@ static int get_logon_info(HKEY users, DWORD status, size, type; HKEY key; char key_name[MAX_PATH]; - char host[256]; + char value[256]; FILETIME wtime; who->time = 0; @@ -833,15 +833,22 @@ static int get_logon_info(HKEY users, who->time = FileTimeToTime(&wtime) / 1000000; } - size = sizeof(host); + size = sizeof(value); status = RegQueryValueEx(key, "CLIENTNAME", - NULL, &type, host, &size); + NULL, &type, value, &size); if (status == ERROR_SUCCESS) { - if ((host[0] != '\0') && !strEQ(host, "Console")) { - SIGAR_SSTRCPY(who->host, host); + if ((value[0] != '\0') && !strEQ(value, "Console")) { + 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); return SIGAR_OK;