diff options
author | jinhyung.jo <jinhyung.jo@samsung.com> | 2015-09-02 14:51:14 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2015-09-02 18:29:37 +0900 |
commit | 812b3ccac697ae0d026bb7ea911b95aaa7f04921 (patch) | |
tree | 420b2cf89066a01a4cd02a60c7e90e1f0bd24289 /util/oslib-win32.c | |
parent | 98a7aa6d5cee3c9c65cf41a71baad256e0aa6669 (diff) | |
download | qemu-812b3ccac697ae0d026bb7ea911b95aaa7f04921.tar.gz qemu-812b3ccac697ae0d026bb7ea911b95aaa7f04921.tar.bz2 qemu-812b3ccac697ae0d026bb7ea911b95aaa7f04921.zip |
emulator: Fixed a bug Java path not found on Windows 64
The get_java_path function aways returns the first item of the JRE(or JDK) registry.
The RegEnumKeyEx function's 4th argument type is [In, Out],
But previous implementations have used without resetting it.
So fix it and improved the 'while' statement.
Change-Id: Ief77879c1b6be8f02fbc36e5c7d118152984e371
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r-- | util/oslib-win32.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 9149fa64e0..2c855166f6 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -105,20 +105,18 @@ bool get_java_path(char **java_path) } if (res == ERROR_SUCCESS) { - RegEnumKeyEx(hKey, 0, (LPSTR)strSubKeyName, &dwSubKeyNameMax, - NULL, NULL, NULL, NULL); - strcpy(strChoosenName, strSubKeyName); - - index = 1; - while (ERROR_SUCCESS == - RegEnumKeyEx(hKey, index, - (LPSTR)strSubKeyName, &dwSubKeyNameMax, - NULL, NULL, NULL, NULL)) { + index = 0; + do { + dwSubKeyNameMax = JAVA_MAX_COMMAND_LENGTH; + res = RegEnumKeyEx(hKey, + index++, + (LPSTR)strSubKeyName, + &dwSubKeyNameMax, + NULL, NULL, NULL, NULL); if (strcmp(strChoosenName, strSubKeyName) < 0) { strcpy(strChoosenName, strSubKeyName); } - index++; - } + } while (res == ERROR_SUCCESS); RegOpenKeyEx(hKey, strChoosenName, 0, KEY_QUERY_VALUE | MY_KEY_WOW64_64KEY, &hSubKey); |