Repository navigation
Conversation
…ng size fail as on the host (WINHTTP-ARG-CHECKS) Two argument checks answered differently from the host's winhttp.dll (measured on Windows 11): - WinHttpConnect with an empty server name failed with ERROR_INVALID_PARAMETER; the host gives ERROR_WINHTTP_INVALID_URL (a null name stays ERROR_INVALID_PARAMETER on both). - WinHttpSetOption(WINHTTP_OPTION_CONTEXT_VALUE) accepted any length of at least a DWORD_PTR and read the first eight bytes; the host takes exactly a DWORD_PTR and refuses 16 bytes with ERROR_INSUFFICIENT_BUFFER as it does 4, keeping the context it had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: WINHTTP-ARG-CHECKS
What and why
I compared the offline WinHTTP shim with the host's
winhttp.dllon the calls that need no network: handles, options, timeouts and the argument checks. A small ctypes probe ran on Windows 11 against.invalidnames, with no request sent. Two answers differ:winhttp.dllmainWinHttpConnect(session, L"", 80, 0)ERROR_WINHTTP_INVALID_URL(12005)ERROR_INVALID_PARAMETER(87)WinHttpConnect(session, nullptr, 80, 0)ERROR_INVALID_PARAMETERERROR_INVALID_PARAMETERWinHttpSetOption(h, WINHTTP_OPTION_CONTEXT_VALUE, buf, 4)ERROR_INSUFFICIENT_BUFFERERROR_INSUFFICIENT_BUFFERWinHttpSetOption(h, WINHTTP_OPTION_CONTEXT_VALUE, buf, 16)ERROR_INSUFFICIENT_BUFFEREverything else in the probe already matched:
WinHttpConnecton a connect handle andWinHttpOpenRequeston a session (ERROR_WINHTTP_INCORRECT_HANDLE_TYPE);WinHttpCloseHandleofNULLand of a closed handle;NULLhandle.Both are fixed: an empty server name now fails with
ERROR_WINHTTP_INVALID_URL, and the context option takes exactlysizeof(DWORD_PTR)and leaves the handle's context as it was otherwise.Not changed: the shim still accepts options it does not know (the host refuses an unknown option number with
ERROR_WINHTTP_INVALID_OPTION). The file's header says options are accepted on purpose, and matching the host there would need the host's list of options per handle type.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
winhttp_offline_testgets three checks: a 16-byte context value fails withERROR_INSUFFICIENT_BUFFER, the context set before it stays, and an empty server name fails withERROR_WINHTTP_INVALID_URL.main: 3 of 86 checks fail.scripts/pr_overlap.pyfrom scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK) #2349).scripts/check_no_game_data.pyon both files.Not tested under Wine.
GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code