[PATCH 2/2] msi: automation: Implement Installer::RegistryValue.

Alexandre Julliard julliard at winehq.org
Thu May 10 05:13:49 CDT 2007


Misha Koshelev <mk144210 at 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 at winehq.org



More information about the wine-devel mailing list