[PATCH 2/2] kernel32: Handle win32 hresult in FormatMessage.

Sebastian Lackner sebastian at fds-team.de
Mon Oct 20 16:49:10 CDT 2014


On 20.10.2014 19:05, Catalin Patulea wrote:
> +static LPWSTR search_message( DWORD flags, HMODULE module, UINT id, WORD lang )
> +{
> +    LPWSTR from = NULL;
> +    if (flags & FORMAT_MESSAGE_FROM_HMODULE)
> +        from = load_message( module, id, lang );
> +    if (!from && (flags & FORMAT_MESSAGE_FROM_SYSTEM)) {          <---- [1]
> +        // Fold win32 hresult to its embedded error code.         <---- [2]
> +        if (HRESULT_SEVERITY(id) == SEVERITY_ERROR &&
> +            HRESULT_FACILITY(id) == FACILITY_WIN32) {             <---- [1]
> +            id = HRESULT_CODE(id);
> +        }
> +        from = load_message( kernel32_handle, id, lang );
> +    }
> +    return from;
> +}
> +

Some small style improvement suggestions:

1) better use this style for if conditions:

--- snip ---
if (...)
{

}
--- snip ---

2) Wine prefers comments using the following style

--- snip ---
/* ... */
--- snip ---

Regards,
Sebastian



More information about the wine-devel mailing list