[Bug 59402] New: AssocQueryStringW does not update pcchOut when pszOut is non-null
http://bugs.winehq.org/show_bug.cgi?id=59402 Bug ID: 59402 Summary: AssocQueryStringW does not update pcchOut when pszOut is non-null Product: Wine Version: 11.2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: shlwapi Assignee: wine-bugs@list.winehq.org Reporter: marijns95@gmail.com Distribution: --- In a little Rust crate called `webbrowser`, `AssocQueryStringW()` is used to retrieve the command to launch a webbrowser: https://github.com/amodm/webbrowser-rs/blob/94baf04e0c325f4ae9f86969dee252b6... I'm currently running this under `wine` (just updated to 11.2) and found the character count in `pcchOut` isn't updated but remains at the default buffer size of `512` (leading to the rest of the code processing a string with a bunch of interior NULs, because Rust uses string length by default). If I manually alter the code to pass `NULL` to `pszOut`, the count is updated to the actual length of the command string. This seems to mismatch what this crate is expecting, and what the Windows documentation states: https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-assoc...
When the function returns successfully, the value is set to the number of characters actually placed in the buffer.
The documentation of the underlying IQueryAssociations_fnGetString() also says:
Success: S_OK. pszOut contains the string, pcchOut contains its length.
Looking at the actual implementation of ASSOC_ReturnString, it only updates `*outlen` when the output string was NULL (as seen above) or when it was too small for the data (`*outlen < datalen`): https://gitlab.winehq.org/wine/wine/-/blob/9f704e4cc4a346d249ebc5346975e2d18... Should this assignment simply be moved out of those if's? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59402 --- Comment #1 from Marijn <marijns95@gmail.com> --- Separately, according to the docs the required length of the string should only be returned if ASSOCF_NOTRUNCATE is set:
If the ASSOCF_NOTRUNCATE flag is set in flags and the buffer specified in pszOut is too small, the function returns E_POINTER and the value is set to the required size of the buffer.
When the string is instead truncated by default (if that flag is not set), I expect it to instead return the original "the number of characters actually placed in the buffer", so `*outlen` should stay at its original `*datalen` value instead of being updated to `datalen`? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59402 --- Comment #2 from Marijn <marijns95@gmail.com> --- I opened an MR at https://gitlab.winehq.org/wine/wine/-/merge_requests/10072 that addresses this. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla