[PATCH 6/6] Implement SxsLookupClrGuid

Fabian Maurer dark.shadow4 at web.de
Tue Aug 7 14:26:40 CDT 2018


> > +BOOL WINAPI SxsLookupClrGuid(DWORD dwFlags, LPGUID pClsid, HANDLE
> > hActCtx, PVOID pvOutputBuffer, SIZE_T cbOutputBuffer, PSIZE_T
> > pcbOutputBuffer)
> Please fix argument type names.

What do you mean? I though for official API functions we keep the arguments like they are 
on windows?

> 
> > +    if (!FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, 0,
> > ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, pClsid, &guid_info)) +
> >    {
> > +        DWORD error = GetLastError();
> > +        if (error != ERROR_SXS_KEY_NOT_FOUND)
> > +            ERR("Failed to find guid: %d\n", error);
> > +        SetLastError(ERROR_NOT_FOUND);
> > +        return FALSE;
> > +    }
> 
> This looks too complicated.

Just a bit or extra error checking in case something goes wrong, but I can throw that out if 
you want.


> First call should also be checked for failure.

Will do.

> 
> > +    len_identity = (lstrlenW(ptr_identity) + 1) * sizeof(WCHAR);
> > +    len_name = (lstrlenW(ptr_name) + 1) * sizeof(WCHAR);
> > +    if (class_data->version_len > 0)
> > +        len_version = (lstrlenW(ptr_version) + 1) * sizeof(WCHAR);
> 
> You already have lengths of all three fields at this point.

Yeah, don't know why I didn't use that.

> 
> > +#define copy_str(target, ptr, len)                 \
> > +        target = len ? (void *)ret_strings : NULL; \
> > +        memcpy(ret_strings, ptr, len);             \
> > +        ret_strings += len;
> > +    copy_str(ret->pcwszAssemblyIdentity, ptr_identity, len_identity);
> > +    copy_str(ret->pcwszTypeName , ptr_name, len_name);
> > +    copy_str(ret->pcwszRuntimeVersion, ptr_version, len_version);
> > +#undef copy_str
> 
> Could you add a test for this layout? And probably remove a macro too.

Why add a test for the layout? All that matters is that the strings in the struct work, the 
rest is internals that we don't care about, no?
Also, why remove the macro? It makes the code simpler, do you prefer the duplication?

Regards,
Fabian Maurer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20180807/876bc78e/attachment-0001.html>


More information about the wine-devel mailing list