From: jinhyung.jo Date: Wed, 2 Sep 2015 05:51:14 +0000 (+0900) Subject: emulator: Fixed a bug Java path not found on Windows 64 X-Git-Tag: Tizen_Studio_1.3_Release_p2.3~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b18af3ee3c62e92190507c08b4a652c58ca39011;p=sdk%2Femulator%2Fqemu.git 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 (cherry picked from commit 812b3ccac697ae0d026bb7ea911b95aaa7f04921) --- diff --git a/util/oslib-win32.c b/util/oslib-win32.c index b5beed56ee..22bdb0b212 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -101,20 +101,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);