From: Marijn Suijten <marijns95@gmail.com> According to https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-assoc... `pcchOut` should retain "the number of characters actually placed in the buffer" which will be the maximum length of the buffer if `datalen` (the actual length of the data to be returned) exceeds it. It seems that behaviour shouldn't change unless `ASSOCF_NOTRUNCATE` is set (or `out` is NULL) which doesn't return any data but only the actual required length of the buffer. Hence only update the `*pcchOut` argument (represented by `*outlen` here) if the flag was set. Also remove the unneeded `min()` as we already know that `*outlen` is smaller than `datalen`. --- dlls/shell32/assoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index fb96311eeef..a9ee3dd6f4e 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -455,13 +455,13 @@ static HRESULT ASSOC_ReturnString(ASSOCF flags, LPWSTR out, DWORD *outlen, LPCWS len = 0; if (*outlen > 0) out[0] = 0; hr = E_POINTER; + *outlen = datalen; } else { - len = min(*outlen, datalen); + len = *outlen; hr = E_NOT_SUFFICIENT_BUFFER; } - *outlen = datalen; } else { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10072