https://bugs.winehq.org/show_bug.cgi?id=54364
Bug ID: 54364 Summary: RtlGenRandom fails on systems with more than 128 cores Product: Wine Version: 8.0-rc5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 Assignee: wine-bugs@winehq.org Reporter: tjeerd.bakker38@gmail.com Distribution: ---
WinHttpSendRequest() fails with ERROR_OUTOFMEMORY when the WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET is set on systems with 256 cores. I've tracked it down to dlls/advapi32/crypt.c.
RtlGenRandom is implemented by calling NtQuerySystemInformation(SystemInterruptInformation, ...) with a buffer sufficient for the data from at most 128 CPUs. The buffer size is determined by the #define in line 2393:
#define MAX_CPUS 128
Changing this line to
#define MAX_CPUS 256
make the problem go away for me, but the problem will probably return when someone builds a system with even more cores. I would suggest implementing RtlGenRandom() with a better source of randomness instead.