Improve kernel32 compatibility for MSVC tools#124
Merged
encounter merged 8 commits intoJun 26, 2026
Conversation
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.
Summary
This improves Wibo's kernel32 compatibility for legacy MSVC-era tooling. The changes were found while forcing a full LEGOLAND decompilation build through Wibo, including compile, link, and cvdump/reccmp.
The branch adds or fixes:
lstrcpynAexport and truncation/null-termination behavior.GetTempPathAtrailing-backslash and required-buffer behavior.GetTempFileNameAprefix, fixed-unique, generated-unique, and empty-file creation behavior.GetProcAddressmissing-export handling so dynamic probes returnNULL/ERROR_PROC_NOT_FOUNDinstead of routing to Wibo's missing-import trap.CreateFileMappingAfile-backed mapping growth for writable protections, and correct zero-length file mapping failures.MapViewOfFile/MapViewOfFileExhandling ofFILE_MAP_ALL_ACCESSas shared read/write access instead of copy-on-write.GetModuleHandleExWwith name,NULL,FROM_ADDRESS,PIN, andUNCHANGED_REFCOUNTcases.Fixture tests are included for the new and changed behavior.
Microsoft Learn references
lstrcpynA:iMaxLengthincludes space for the terminating null character, and success returns the destination buffer.GetTempPathA: successful paths end with a backslash and the too-small-buffer return value is the required length.GetTempFileNameA: only the first three prefix characters are used;uUnique == 0creates and closes an empty file, while nonzerouUniqueonly generates the name.GetProcAddress: missing names/ordinals fail withNULLand extended error information.Activation Contextsand side-by-side assemblies as a resource: activation contexts carry DLL redirection information used by the loader and manifests can provide process-default/static-import side-by-side bindings.CreateFileMappingA: writable file mappings larger than the backing file extend the file; zero-sized file mappings have documented failure behavior.MapViewOfFileand file-mapping access rights:FILE_MAP_ALL_ACCESSis equivalent toFILE_MAP_WRITEfor mapping views, whileFILE_MAP_COPYcreates a private copy-on-write view whose changes are not written back.GetModuleHandleExW: supports loaded-module lookup by name, process module lookup withNULL, address-based lookup, and the documented refcount flags.Validation
cmake --preset debug-macosandcmake --build --preset debug-macos.tools/verify/ reccmp through Wibo successfully.