Specify HMODULE for error messages
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
I'm using WinHTTP with wil::result.h and some WinHTTP error messages are not being found. I traced this down to GetFailureLogString calling FormatMessageW without the FORMAT_MESSAGE_FROM_HMODULE flag and passing nullptr as the lpSource parameter. WinHTTP provides some of its own error messages.
Is there an easy way I can extend wil to allow specifying the HMODULE when getting the error message? I can't find an easy way to do it that doesn't require copying all your formatting code, and then either using a ResultMessageCallback that will always check WinHTTP (undesired) or a custom exception and losing access to the convenient macros.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at GetFailureLogString and its FormatMessageW call, then trace how ResultMessageCallback and the convenience macros reach it. Define an extension that accepts an HMODULE without requiring copied formatting code or losing macro and exception support; done when WinHTTP-specific messages can be resolved through that path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100