Skip to content

Take the dummy handle limit from the atomic's value type - #133

Merged
ethindp merged 1 commit into
ethindp:masterfrom
trypsynth:fix/delay-load-dummy-pool
Sep 22, 2026
Merged

ethindp merged 1 commit into
ethindp:masterfrom
trypsynth:fix/delay-load-dummy-pool

Conversation

@trypsynth

Copy link
Copy Markdown
Contributor

std::numeric_limits has no specialization for std::atomic, so std::numeric_limits<std::atomic_unsigned_lock_free>::max() is the primary template's value-initialized T(), which is zero. dummy_count < 0 is never true, so every failed delay load skips the dummy handle and logs the pool as exhausted:

[prism WARN] prism/delayimp: delay-load dummy handle pool exhausted after 0 modules; 'PCTKUSR.dll' left unresolved

It works anyway on x86 and x64, because returning handle 1 still leads to dliFailGetProc, where the stubs are matched by DLL name. So the only visible effect is a warning on every machine without a given screen reader, and the dummy handles never being used.

What this does

Asks numeric_limits about std::atomic_unsigned_lock_free::value_type instead, in both the comparison and the log message.

Testing

Built shared for x64 with MSVC and ran a context with an availability callback on a machine without PC-Talker, under PRISM_LOG=debug. Before:

[prism WARN] prism/delayimp: delay-load dummy handle pool exhausted after 0 modules; 'PCTKUSR.dll' left unresolved

After:

[prism DEBUG] prism/delayimp: no installation of 'PCTKUSR.dll' found; substituting stubs

@ethindp
ethindp merged commit bf28f4b into ethindp:master Sep 22, 2026
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants