Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2006-05-11 15:13:25 +0000
committerDoug Schaefer2006-05-11 15:13:25 +0000
commitcb183a66225f497bef8b32bbc25ef24e377c483f (patch)
treeb005b47c99e74d161181694490024fc2546dea50 /core/org.eclipse.cdt.core.win32
parent0bdb8b262e0109081f6f641477d83771249b4a2b (diff)
downloadorg.eclipse.cdt-cb183a66225f497bef8b32bbc25ef24e377c483f.tar.gz
org.eclipse.cdt-cb183a66225f497bef8b32bbc25ef24e377c483f.tar.xz
org.eclipse.cdt-cb183a66225f497bef8b32bbc25ef24e377c483f.zip
Patch for Ling@nokia. New entry to windows registry utility.
Diffstat (limited to 'core/org.eclipse.cdt.core.win32')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg.cpp40
-rw-r--r--core/org.eclipse.cdt.core.win32/os/win32/x86/winreg.dllbin49152 -> 49152 bytes
2 files changed, 40 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg.cpp b/core/org.eclipse.cdt.core.win32/library/winreg.cpp
index 8b0562ae7f1..2feeeb9ad48 100644
--- a/core/org.eclipse.cdt.core.win32/library/winreg.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/winreg.cpp
@@ -28,3 +28,43 @@ JNIEXPORT jstring Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValu
return result;
}
+
+/*
+ * Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0)
+ * to the key's array of values, return the name of the indexed value.
+ * The return value is null on any error or when the index is invalid.
+ */
+
+extern "C"
+JNIEXPORT jstring Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValueName(
+ JNIEnv * env, jobject obj, jstring subkey, jint index)
+{
+ const jchar * csubkey = env->GetStringChars(subkey, NULL);
+ jstring result = NULL;
+
+ HKEY key;
+ LONG rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, (const wchar_t *)csubkey, 0, KEY_READ, &key);
+ if (rc != ERROR_SUCCESS)
+ return NULL;
+
+ wchar_t valueName[256];
+ DWORD nameSize = sizeof(valueName) + 2;
+
+ rc = RegEnumValue(key, index,
+ valueName, // UNICODE string
+ &nameSize,
+ NULL, NULL,
+ NULL, // data string
+ NULL); // size in BYTE of data.
+
+ if (rc == ERROR_SUCCESS)
+ {
+ result = env->NewString((jchar *)valueName, nameSize);
+ }
+
+ RegCloseKey(key);
+
+ env->ReleaseStringChars(subkey, csubkey);
+
+ return result;
+}
diff --git a/core/org.eclipse.cdt.core.win32/os/win32/x86/winreg.dll b/core/org.eclipse.cdt.core.win32/os/win32/x86/winreg.dll
index 5290964e77d..d0d0636d9fe 100644
--- a/core/org.eclipse.cdt.core.win32/os/win32/x86/winreg.dll
+++ b/core/org.eclipse.cdt.core.win32/os/win32/x86/winreg.dll
Binary files differ

Back to the top