Module: check_mk
Branch: master
Commit: ab0a25bcdee012b9a3613a0023df449158c37c57
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab0a25bcdee012…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Aug 18 16:11:23 2015 +0200
#2419 windows agent: is now downward compatible to win2k
---
.werks/2419 | 10 +++++++++
ChangeLog | 1 +
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 302080 -> 302080 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 302080 -> 302080 bytes
agents/windows/check_mk_agent.cc | 26 ++++++++++++++++++----
agents/windows/check_mk_agent.exe | Bin 183808 -> 183808 bytes
agents/windows/check_mk_agent.msi | Bin 734720 -> 734720 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 183808 -> 183808 bytes
agents/windows/install_agent-64.exe | Bin 179051 -> 179073 bytes
agents/windows/install_agent.exe | Bin 160025 -> 160059 bytes
11 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/.werks/2419 b/.werks/2419
new file mode 100644
index 0000000..4140477
--- /dev/null
+++ b/.werks/2419
@@ -0,0 +1,10 @@
+Title: windows agent: is now downward compatible to win2k
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1439907013
+Class: feature
+
+
+
diff --git a/ChangeLog b/ChangeLog
index 03c206c..02ac85d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@
* 2527 emc_isilon_power, emc_isilon_quota: New checks for power supply and fs quotas
on EMC Isilon data storage devices
* 2528 emc_isilon_cpu, emc_isilon_ifs: New checks for cpu utilization and the
combined cluster storage on EMC Isilon data storage devices
* 2529 kernel.util can now be configured to warn if a single cpu core exceeds a
utilization threshold for a while
+ * 2419 windows agent: is now downward compatible to win2k
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 08839f6..b35cfaf 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-200
+206
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index b1cb3c3..08362a2 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index 3edfd78..b102f51 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index ab6bc48..1b1d936 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -549,6 +549,21 @@ void debug_script_container( script_container* container )
}
+
+template <typename FuncT> FuncT dynamic_func(LPCWSTR dllName, LPCSTR funcName) {
+ HMODULE mod = LoadLibraryW(dllName);
+ if (mod != NULL) {
+ FARPROC proc = GetProcAddress(mod, funcName);
+ if (proc != NULL) {
+ return (FuncT)proc;
+ }
+ }
+ return NULL;
+}
+
+#define DYNAMIC_FUNC(func, dllName) func ## _type func ## _dyn = dynamic_func<func ##
_type>(dllName, #func)
+// GetProcessHandleCount_type GetProcessHandleCount_dyn =
dynamic_func<GetProcessHandleCount_type>(L"kernel32.dll",
"GetProcessHandleCount");
+
// .----------------------------------------------------------------------.
// | ______ _ _ _ ______ |
// | / / / /___ _ _ ___| |_ ___ _ __ ___ | |_(_)_ __ ___ ___\ \ \ \ |
@@ -1670,11 +1685,14 @@ void section_ps(SOCKET &out)
usermodetime.HighPart = userTime.dwHighDateTime;
}
- // GetProcessHandleCount is only available winxp upwards
- // Win2k reports 0 handles
DWORD processHandleCount = 0;
- if (osv.dwMajorVersion > 5 || (osv.dwMajorVersion == 5 &&
osv.dwMinorVersion > 0))
- GetProcessHandleCount(hProcess, &processHandleCount);
+
+ // GetProcessHandleCount is only available winxp upwards
+ typedef BOOL (*GetProcessHandleCount_type)(HANDLE, PDWORD);
+ DYNAMIC_FUNC(GetProcessHandleCount, L"kernel32.dll");
+ if (GetProcessHandleCount_dyn != NULL) {
+ GetProcessHandleCount_dyn(hProcess, &processHandleCount);
+ }
// Process owner
ExtractProcessOwner(hProcess, user);
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 3d39d84..1f755a2 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.msi b/agents/windows/check_mk_agent.msi
index e212db8..30b5357 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index 9ad9f0c..c264215 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index 0e27d75..8f70c4a 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index dd1d83e..49e7b49 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ