Author: cfinck Date: Wed Apr 22 23:42:33 2009 New Revision: 40656
URL: http://svn.reactos.org/svn/reactos?rev=40656&view=rev Log: Fix the size passed to MultiByteToWideChar. This fixes downloading the correct Gecko version for mshtml. (our version from Downloader isn't compatible anymore though)
The patch was already submitted to Wine as well.
Modified: branches/ros-branch-0_3_9/reactos/dll/win32/mshtml/install.c
Modified: branches/ros-branch-0_3_9/reactos/dll/win32/mshtml/install.c URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_9/reactos/dll/win... ============================================================================== --- branches/ros-branch-0_3_9/reactos/dll/win32/mshtml/install.c [iso-8859-1] (original) +++ branches/ros-branch-0_3_9/reactos/dll/win32/mshtml/install.c [iso-8859-1] Wed Apr 22 23:42:33 2009 @@ -425,6 +425,7 @@ HKEY hkey; DWORD res, type; DWORD size = INTERNET_MAX_URL_LENGTH*sizeof(WCHAR); + DWORD returned_size; LPWSTR url;
static const WCHAR wszGeckoUrl[] = {'G','e','c','k','o','U','r','l',0}; @@ -437,15 +438,16 @@ return NULL;
url = heap_alloc(size); - - res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &size); + returned_size = size; + + res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &returned_size); RegCloseKey(hkey); if(res != ERROR_SUCCESS || type != REG_SZ) { heap_free(url); return NULL; }
- if(size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) { + if(returned_size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) { strcatW(url, v_formatW); MultiByteToWideChar(CP_ACP, 0, GECKO_VERSION, -1, url+strlenW(url), size/sizeof(WCHAR)-strlenW(url)); }