Module: check_mk
Branch: master
Commit: 549b3364d62f27967c5f555463dd50cf9e12b7c3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=549b3364d62f27…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jul 11 15:29:04 2017 +0200
4847 FIX Windows Agent / fileinfo: fixed another issue, where meta information (size,age)
was not accessible
Change-Id: I45b16de4fbd0821ab639058ce420689e3e5e5fd0
---
.werks/4847 | 10 ++++++++
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 1340416 -> 1340416 bytes
agents/windows/check_mk_agent-64.unstripped.exe | Bin 15823789 -> 15809577 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 1340416 -> 1340416 bytes
agents/windows/check_mk_agent.exe | Bin 1318400 -> 1318400 bytes
agents/windows/check_mk_agent.msi | Bin 2928640 -> 2928640 bytes
agents/windows/check_mk_agent.unstripped.exe | Bin 13682205 -> 13668491 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 1318400 -> 1318400 bytes
agents/windows/install_agent-64.exe | Bin 591914 -> 591916 bytes
agents/windows/install_agent.exe | Bin 589544 -> 589458 bytes
agents/windows/plugins/mk_jolokia.exe | Bin 10106761 -> 10106761 bytes
agents/windows/sections/SectionFileinfo.cc | 31 ++++++++++-------------
13 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/.werks/4847 b/.werks/4847
new file mode 100644
index 0000000..f9fec0d
--- /dev/null
+++ b/.werks/4847
@@ -0,0 +1,10 @@
+Title: Windows Agent / fileinfo: fixed another issue, where meta information (size,age)
was not accessible
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1499779700
+Class: fix
+
+
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 70142a5..88ebae5 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-2838
+2846
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 056374b..17522d1 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.unstripped.exe
b/agents/windows/check_mk_agent-64.unstripped.exe
index 3b9865f..fc6580e 100755
Binary files a/agents/windows/check_mk_agent-64.unstripped.exe and
b/agents/windows/check_mk_agent-64.unstripped.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index 25ebfa6..b572492 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.exe b/agents/windows/check_mk_agent.exe
index d32b0b2..7592877 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 b65283f..b1709a3 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.unstripped.exe
b/agents/windows/check_mk_agent.unstripped.exe
index 55f6945..ff3b25a 100755
Binary files a/agents/windows/check_mk_agent.unstripped.exe and
b/agents/windows/check_mk_agent.unstripped.exe differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index 4dfd3b0..97d96ac 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 cb37a54..8c62ddb 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 dca8f40..d7aea94 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/plugins/mk_jolokia.exe
b/agents/windows/plugins/mk_jolokia.exe
index fde7dc3..2f88ebb 100755
Binary files a/agents/windows/plugins/mk_jolokia.exe and
b/agents/windows/plugins/mk_jolokia.exe differ
diff --git a/agents/windows/sections/SectionFileinfo.cc
b/agents/windows/sections/SectionFileinfo.cc
index 13db252..b08cc6d 100644
--- a/agents/windows/sections/SectionFileinfo.cc
+++ b/agents/windows/sections/SectionFileinfo.cc
@@ -94,7 +94,7 @@ void SectionFileinfo::determine_filepaths_simple_search(std::string
base_path, s
std::stringstream ss;
if (findHandle != INVALID_HANDLE_VALUE) {
do {
- if (true || (0 == (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))) {
+ if (0 == (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
ss.str("");
ss.clear();
ss << base_path << "\\" << data.cFileName;
@@ -141,21 +141,18 @@ void SectionFileinfo::outputFileinfos(std::ostream &out, const
char *path) {
}
bool SectionFileinfo::outputFileinfo(std::ostream &out, const std::string filename)
{
- auto hFile = std::make_unique<ManagedHandle>(CreateFile(filename.c_str(), 0,
FILE_SHARE_READ, NULL,
- OPEN_EXISTING, 0, NULL));
-
- FILETIME ftCreate, ftAccess, ftWrite;
- if (!GetFileTime(hFile->get_handle(), &ftCreate, &ftAccess,
&ftWrite))
- return false;
-
- LARGE_INTEGER size;
- if(!GetFileSizeEx(hFile->get_handle(), &size))
- return false;
-
- out << filename.c_str() << "|" << size.QuadPart <<
"|"
- << std::fixed << std::setprecision(0)
- << file_time(&ftWrite) << "\n";
-
- return true;
+ WIN32_FIND_DATA findData;
+ HANDLE findHandle;
+ if ( (findHandle=FindFirstFile(filename.c_str(), &findData)) !=
INVALID_HANDLE_VALUE )
+ {
+ unsigned long long size = (unsigned long long)findData.nFileSizeLow +
+ (((unsigned long long)findData.nFileSizeHigh) << 32);
+ out << filename.c_str() << "|" << size <<
"|"
+ << std::fixed << std::setprecision(0)
+ << file_time(&findData.ftLastWriteTime) << "\n";
+ FindClose(findHandle);
+ return true;
+ }
+ return false;
}