Improve windows agent (#18227)
thiagoftsm committed
Jul 26, 2024 at 11:45 UTC
26d1c193b74909172ba85363eec3ff3c769c6d5b
2 files changed
+13
-5
packaging/windows/installer.nsi
+1
-1
@@ -3,7 +3,7 @@
3
4
Name "Netdata"
5
Outfile "netdata-installer.exe"
6
-InstallDir "$PROGRAMFILES\netdata"
6
+InstallDir "$PROGRAMFILES\Netdata"
7
RequestExecutionLevel admin
8
9
!define MUI_ICON "NetdataWhite.ico"
src/daemon/win_system-info.c
+12
-4
@@ -166,7 +166,6 @@ static void netdata_windows_get_total_disk_size(struct rrdhost_system_info *syst
166
// Host
167
static DWORD netdata_windows_get_current_build()
168
{
169
- HKEY hKey;
169
char cBuild[64];
170
if (!netdata_registry_get_string(
171
cBuild, 63, HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuild"))
@@ -183,10 +182,19 @@ static DWORD netdata_windows_get_current_build()
182
183
static void netdata_windows_discover_os_version(char *os, size_t length, DWORD build)
184
{
186
- char *commonName = {"Windows"};
185
+ char versionName[256];
186
+ if (!netdata_registry_get_string(versionName,
187
+ 255,
188
+ HKEY_LOCAL_MACHINE,
189
+ "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
190
+ "DisplayVersion"))
191
+ {
192
+ (void)snprintf(os, length, "Microsoft Windows");
193
+ return;
194
+ }
195
196
if (IsWindowsServer()) {
189
- (void)snprintf(os, length, "%s Server", commonName);
197
+ (void)snprintf(os, length, "Microsoft Windows Version %s", versionName);
198
return;
199
}
200
@@ -212,7 +220,7 @@ static void netdata_windows_discover_os_version(char *os, size_t length, DWORD b
220
}
221
// We are not testing older, because it is not supported anymore by Microsoft
222
215
- (void)snprintf(os, length, "%s %s Client", commonName, version);
223
+ (void)snprintf(os, length, "Microsoft Windows Version %s, Build %d (Name: Windows %s)", versionName, build, version);
224
}
225
226
static void netdata_windows_os_version(char *out, DWORD length)