From 6eef4f7cdc0df6d1f9d317be3f2b200b812f4e66 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 23 Oct 2009 14:49:44 -0700 Subject: [PATCH 1/3] (SIGAR-186) fix Win32.getFileVersion on windows 2000 --- src/os/win32/win32_sigar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/os/win32/win32_sigar.c diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c old mode 100644 new mode 100755 index 39c46ac1..fed8e0d3 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -3705,7 +3705,7 @@ int sigar_file_version_get(sigar_file_version_t *version, data = malloc(len); if (GetFileVersionInfo(name, handle, len, data)) { - if (VerQueryValue(data, "\\", &info, 0)) { + if (VerQueryValue(data, "\\", &info, &len)) { version->product_major = HIWORD(info->dwProductVersionMS); version->product_minor = LOWORD(info->dwProductVersionMS); version->product_build = HIWORD(info->dwProductVersionLS); From 32040563ce74214758d3284200b7bf692b316b4b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 23 Oct 2009 14:50:29 -0700 Subject: [PATCH 2/3] (SIGAR-185) fix RegistryKey open on windows 2000 --- bindings/java/src/jni/win32/registrykey.cpp | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 bindings/java/src/jni/win32/registrykey.cpp diff --git a/bindings/java/src/jni/win32/registrykey.cpp b/bindings/java/src/jni/win32/registrykey.cpp old mode 100644 new mode 100755 index 7b3e378c..2995c3dc --- a/bindings/java/src/jni/win32/registrykey.cpp +++ b/bindings/java/src/jni/win32/registrykey.cpp @@ -115,6 +115,7 @@ JNIEXPORT jint SIGAR_JNI(win32_RegistryKey_RegLoadKey) #endif static DWORD RegOpenOpts[] = { + 0, KEY_WOW64_32KEY, KEY_WOW64_64KEY }; From a96bd1bc04e71be31b0931e3e5b7a9a03733b8c0 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 23 Oct 2009 14:52:51 -0700 Subject: [PATCH 3/3] Pdh test adjustments for windows 2000 --- .../src/org/hyperic/sigar/win32/test/TestPdh.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java diff --git a/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java b/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java old mode 100644 new mode 100755 index 22d56c33..a6f23c1e --- a/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java +++ b/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java @@ -98,11 +98,11 @@ public class TestPdh extends SigarTestCase { public void testValidate() { Object[][] tests = { - { "\\Does Not\\Exist", new Integer(Pdh.NO_OBJECT) }, + { "\\Does Not\\Exist", new Integer(Pdh.NO_OBJECT), new Integer(Pdh.BAD_COUNTERNAME) }, { "Does Not Exist", new Integer(Pdh.BAD_COUNTERNAME) }, { "\\System\\DoesNotExist", new Integer(Pdh.NO_COUNTER) }, { "\\Processor(666)\\% User Time", new Integer(Pdh.NO_INSTANCE) }, - { "\\System\\Threads", new Integer(Pdh.VALID_DATA) }, + { "\\System\\Threads", new Integer(Pdh.VALID_DATA), new Integer(Pdh.BAD_COUNTERNAME) }, //slow //{ "\\\\-\\System\\Threads", new Integer(Pdh.NO_MACHINE) }, }; @@ -113,6 +113,13 @@ public class TestPdh extends SigarTestCase { int status = Pdh.validate(path); boolean expectedResult = (status == expect); + if (!expectedResult) { + if (tests[i].length == 3) { + expect = ((Integer)tests[i][2]).intValue(); + expectedResult = (status == expect); + } + } + if (!expectedResult) { traceln("[validate] " + path + "-->" + Integer.toHexString(status).toUpperCase() +