[PATCH 1/6] msi: Make MsiGetProperty() RPC-compatible.

Hans Leidekker hans at codeweavers.com
Tue Apr 17 07:20:44 CDT 2018


On Mon, 2018-04-16 at 20:20 -0500, Zebediah Figura wrote:
> +++ b/dlls/msi/package.c
> @@ -2396,52 +2396,23 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
>      package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE );
>      if (!package)
>      {
> -        HRESULT hr;
>          LPWSTR value = NULL;
>          MSIHANDLE remote;
> -        BSTR bname;
>  
>          if (!(remote = msi_get_remote(handle)))
>              return ERROR_INVALID_HANDLE;
>  
> -        bname = SysAllocString( name );
> -        if (!bname)
> -            return ERROR_OUTOFMEMORY;
> +        r = remote_GetProperty(remote, name, &value);
> +        if (r != ERROR_SUCCESS)
> +            return r;
>  
> -        hr = remote_GetProperty(remote, bname, NULL, &len);
> -        if (FAILED(hr))
> -            goto done;
> -
> -        len++;
> -        value = msi_alloc(len * sizeof(WCHAR));
> -        if (!value)
> -        {
> -            r = ERROR_OUTOFMEMORY;
> -            goto done;
> -        }
> -
> -        hr = remote_GetProperty(remote, bname, value, &len);
> -        if (FAILED(hr))
> -            goto done;
> -
> -        r = msi_strcpy_to_awstring( value, len, szValueBuf, pchValueBuf );
> +        r = msi_strcpy_to_awstring(value, -1, szValueBuf, pchValueBuf);

Property values can contain embedded nulls. You can't set such values
through MsiSetProperty but MsiGetProperty returns the full value and size
if the property is set by other means. If the remote case behaves the same
you'll have to keep the length parameter.




More information about the wine-devel mailing list