runtime/shims: shim PSM app-notification and WER file registration APIs (RT-PSM-APPNOTIFY-WER) #1240
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1240"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-24T20:42:16Z.
Summary
Claim ID:
RT-PSM-APPNOTIFY-WERAdds
runtime/shims/appnotify.cppandruntime/test/appnotify_test.cpp(wired intoruntime/CMakeLists.txtandscripts/build_runtime.ps1):RegisterAppConstrainedChangeNotificationandUnregisterAppConstrainedChangeNotificationacrosskernel32.dll,kernelbase.dll,twinapi.appcore.dll, andapi-ms-win-core-psm-appnotify-l1-1-0/1.dll, returning distinct tracked registration handles, ignoringnullptr/foreign/already-freed handles cleanly on unregister, and using constant-initializedSRWLOCK+ raw lists to avoid MSVC TLS init guards. (RegisterAppStateChangeNotificationandUnregisterAppStateChangeNotificationare left out so they do not collide with#769.)WerRegisterFile/WerUnregisterFileacrosskernel32.dll,kernelbase.dll,wer.dll, andapi-ms-win-core-windowserrorreporting-l1-1-0/1.dll, tracking normalizedGAME:/G:/T:and host paths in-process without mutating host WER state or creating files on disk.runtime/test/appnotify_test.cppexecuted viart::shims::find.Verification
10.0.26100SDK), MSVC (RelWithDebInfo), rebased ontocont/main(871e4b8b9), commitb607337fd.ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure:100% tests passed out of 148(including#83 appnotify), with 7 game-data tests skipped (LEONIDA_GAME_DIRunset) and 2gameinputtests disabled (no SDL3).python -I tests/test_build_runtime_fallback.py: passed (10/10).python -I scripts/check_no_game_data.py ...andgit diff --check cont/main..HEAD: clean.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T01:51:58Z.
@piyonchu one overlap to sort out before this can go in:
RegisterAppStateChangeNotificationandUnregisterAppStateChangeNotificationforapi-ms-win-core-psm-appnotify-l1-1-0.dllandl1-1-1.dll(runtime/shims/appnotify.cpp, theAPPNOTIFY_APItable). #769 (RT-GDK-SPEECH-DISPLAY-LIFECYCLE, claimed at 04:11 UTC on 2026-11-24, before this one's 20:42 UTC) registers the same pair on the same two API sets.quiesced = TRUE, when the title's window is closed, then ends the run; this PR stores the registration and never calls it.RegisterAppStateChangeNotification/UnregisterAppStateChangeNotificationpair from this PR, and keep the rest: the constrained-change pair and theWerRegisterFileshims are not in #769 and are welcome. If a test of yours covers the state-change pair (for exampleUnregisterAppStateChangeNotification(nullptr)), that case would fit into #769'slifecycle_testinstead; say so there if you'd like it added.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-25T02:08:18Z.
Thanks for catching the
#769overlap, @aslan2142! Updated#1240(b607337fd) and rebased cleanly ontomain(871e4b8b9):RegisterAppStateChangeNotificationandUnregisterAppStateChangeNotificationfromruntime/shims/appnotify.cppandruntime/test/appnotify_test.cppso there is noSHIM_TABLEregistry collision with#769.RegisterAppConstrainedChangeNotification,UnregisterAppConstrainedChangeNotification,WerRegisterFile, andWerUnregisterFile, plus re-testedctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure(100% passed out of 148,#83 appnotifypassed) andpython -I tests/test_build_runtime_fallback.py(10/10passed).I also left a brief note on
#769with the negative test cases (nullptrregistration pointer, null callback zeroing*Registration,nullptr/foreign-handle unregister) in case they are useful forlifecycle_test.Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-26T21:40:43Z.
Rebased onto latest
main(fac8b4bb9, head commit677379b01), resolving thescripts/build_runtime.ps1fallback file list conflict cleanly (shims\xapu_queue.cpp+shims\appnotify.cpp).Verified locally after rebase:
git diff --check cont/main..HEADpython -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/appnotify.cpp runtime/test/appnotify_test.cpp scripts/build_runtime.ps1cmake --build runtime/build --config RelWithDebInfo --target gta6rt appnotify_testctest --test-dir runtime/build -C RelWithDebInfo -R "^appnotify$" --output-on-failure(1/1 passed)Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:51:55Z.
Independent Verification Report —
677379b018+origin/main(a8465211fb)Environment: Windows 11 (
26200), AMD Ryzen 9 5950X, MSVC19.44.35228(x64,/std:c++20 /EHsc /W4 /permissive- /utf-8, Debug/Od /MDd& Release/O2 /MD,/link /OPT:NOREF).Verdict: C++ shim &
appnotify_testPASS (46/46); 2 minor hygiene/SDK items noted below — clean Git merge withorigin/main(8690b4f8adf8).1. Red -> Green Verification
origin/mainregistry.cpp+#1240appnotify_test.cpp): Fails immediately (rt::shims::findreturnsnullptrforRegisterAppConstrainedChangeNotification,UnregisterAppConstrainedChangeNotification,WerRegisterFile, andWerUnregisterFile).677379b018+origin/main):appnotify_test(Debug/Od /MDd& Release/O2 /MD): PASS (46 check(s), 0 failure(s)),0warnings under/W4 /permissive-(verifyingSHIM_TABLEresolution across all 5 appnotify and 5 WER DLL names, null/sentinel/foreign/double unregister safety, 4-thread x 64-iteration concurrent register/unregister stress, andGAME:/G:/T:/..traversal normalization).python -I tests/test_ctest_registration.py&python -I tests/test_docs_encoding.py: PASS.SHIM_TABLEsymbol overlap withlifecycle.cpp(RegisterAppStateChangeNotification/UnregisterAppStateChangeNotificationremain solely inlifecycle.cpp).2. Non-Blocking Hygiene & SDK Notes
scripts/build_runtime.ps1:1: Onorigin/main,scripts/build_runtime.ps1has no BOM (23 20 42...), whereas677379b018prepends a 3-byte UTF-8 BOM (ef bb bf 23 20 42...). Stripping those 3 leading bytes keepsgit diffclean.WER_FILE_COMPRESSED(0x4) inwer_register_file(runtime/shims/appnotify.cpp:202): Windows SDK10.0.26100.0<werapi.h>definesWER_FILE_DELETE_WHEN_DONE = 0x1,WER_FILE_ANONYMOUS_DATA = 0x2, andWER_FILE_COMPRESSED = 0x4. WideningkWerKnownFlagsMaskfrom0x3uto0x7uavoids returningE_INVALIDARGif a title passesWER_FILE_COMPRESSED.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-29T01:14:52Z.
Addressed both items and rebased onto
cont/main(16f505304, heada3b3fe054), thanks @zmasi!scripts/build_runtime.ps1): Stripped the 3-byte UTF-8 BOM fromscripts/build_runtime.ps1.WER_FILE_COMPRESSED(runtime/shims/appnotify.cpp,runtime/test/appnotify_test.cpp): WidenedkWerKnownFlagsMaskfrom0x3uto0x7u(supportingWER_FILE_COMPRESSED = 0x4) and added a corresponding test check inappnotify_test.cpp.Verified locally after
a3b3fe054:python -I tests/test_text_encoding.py:Ran 2 tests ... OKpython -I tests/test_docs_encoding.py:Ran 1 test ... OKpython -I tests/test_ctest_registration.py:Ran 7 tests ... OKctest --test-dir runtime/build -C RelWithDebInfo -R "^appnotify$" --output-on-failure:1/1passedImported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:41:53Z.
Verified by OreoFR
5825b02ff+ PR heada3b3fe054(tested as a merge)ctest -R ^appnotify$shims/appnotify.cpp, absent on main)appnotifypasses;gta6rtlinks with the new shimgta6rt.exebuilds and links;dumpbin /dependentsshows the same DLLs as main, no network DLL)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:37:15Z.
#1240 | head
a3b3fe0542(merged cleanly onto origin/mainc8bf0e7b65) | Windows 11 (10.0.26200.9974), MSVC 19.44.35228 (x64), Python 3.12.10 | AI-assisted: yesSummary — PASS (Re-verification of updated head
a3b3fe054265)Re-verified
a3b3fe05426578493027567eb6acb7de0dc9a7demerged cleanly ontoorigin/main(c8bf0e7b6568f471b42540010e335ca6413d4c58,git merge-tree --write-treeexit0) on native Windows 11 (x64).Red -> Green Verification
origin/mainc8bf0e7b65):runtime/shims/appnotify.cppandruntime/test/appnotify_test.cppare absent onorigin/main.origin/main+#1240):19.44.35228build (/std:c++20 /O2 /MD /EHsc /W4 /permissive- /utf-8 /link /OPT:NOREF):appnotify_test.cpp + appnotify.cpp + registry.cppcompiled cleanly with0warnings.appnotify_test.exe->48 check(s), 0 failure(s)(export resolution across DLL sets,RegisterAppConstrainedChangeNotification/UnregisterAppConstrainedChangeNotificationnull/foreign/double-unregister and multi-threaded concurrent registration, plusWerRegisterFile/WerUnregisterFileargument validation,GAME:/G:/T:root-traversal rejection, normalized dot-dot path matching,WER_FILE_COMPRESSED, andERROR_NOT_FOUNDafter removal).python tests/test_ctest_registration.py->OKCross-PR Note (
#1242)rc=0) withorigin/main(c8bf0e7b65) and#1931. Co-merging alongside sibling PR#1242touches the same source/target registration lines inruntime/CMakeLists.txtandscripts/build_runtime.ps1(runtime/README.mdauto-merges cleanly), so whichever lands second will need a small 2-file merge.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T03:35:52Z.
Merging, thank you @piyonchu! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/1240#issuecomment-7248954919), and it still merges cleanly.
AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.