Skip to content

servers: avoid unsafe calls in ctrl event, main wnd, wnd proc handlers (Windows)#22045

Draft
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:t-whandlers
Draft

servers: avoid unsafe calls in ctrl event, main wnd, wnd proc handlers (Windows)#22045
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:t-whandlers

Conversation

@vszakats

@vszakats vszakats commented Jun 16, 2026

Copy link
Copy Markdown
Member

You can enable them for debugging purposes by uncommenting local macro
DEBUG_WIN32_CALLBACKS.

Replace logging functionality with bare bones alternative using
WriteFile() and GetStdHandle() Win32 API calls only, replacing calls
to CRT functions and internal APIs (that in turn call CRT functions.)

Not so much a bugfix, but an attempt to see if this patch makes any
difference with the long-time flaky CI test situation and/or avoid
potential issue with minimal loss of functionality. It's also easy for
the internal APIs accidentally picking up code that's not behaving well
in callbacks like these; another reason to avoid calling any.

Refs:
https://learn.microsoft.com/windows/console/registering-a-control-handler-function
https://learn.microsoft.com/windows/win32/api/winuser/nc-winuser-wndproc
https://learn.microsoft.com/previous-versions/windows/desktop/legacy/ms686736(v=vs.85)

Ref: 1c49f2f #18451

@vszakats vszakats added tests Windows Windows-specific labels Jun 16, 2026
@vszakats

vszakats commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

Error: Process completed with exit code 2304. on first run:
https://github.com/curl/curl/actions/runs/27620281150/job/81667049505?pr=22045

and a broken fork/pipe, then hang:

7004191 [main] sh 9151 dofork: child -1 - forked process 7312 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
sh: fork: retry: Resource temporarily unavailable

https://github.com/curl/curl/actions/runs/27620281150/job/81667049419?pr=22045

@vszakats vszakats marked this pull request as draft June 16, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

1 participant