Misha Koshelev <mk144210(a)bcm.edu> writes:
+ case VT_BSTR: /* Return value of specified key if it exists */ + if (ret == ERROR_SUCCESS) + { + ret = RegQueryValueExW(hkey, V_BSTR(&varg2), NULL, NULL, NULL, &dwSize); + if (ret == ERROR_SUCCESS) + { + szString = msi_alloc(dwSize); + if (szString) + { + LPWSTR szNewString = NULL; + DWORD dwType, dwNewSize = 0; + int idx; + + ret = RegQueryValueExW(hkey, V_BSTR(&varg2), NULL, &dwType, (LPBYTE)szString, &dwSize); + switch (dwType) + { + /* Registry strings may not be null terminated */ + case REG_MULTI_SZ: + idx = (dwSize/sizeof(WCHAR))-1; + while (idx >= 0 && !szString[idx]) idx--; + for (; idx >= 0; idx--) + if (!szString[idx]) szString[idx] = '\n'; [...]
This stuff clearly needs to be split out into a few helper functions. -- Alexandre Julliard julliard(a)winehq.org