kernel32: add the lstr* string API family#141
Open
Luminger wants to merge 1 commit into
Open
Conversation
Adds the legacy lstr{cpy,cat,len,cmp,cmpi}{A,W} + lstrcpynW functions
to kernel32, declared in dll/kernel32/winbase.h with implementations in
dll/kernel32/winbase.cpp. (lstrcpynA already exists since decompals#124 and is
kept as-is.)
These are a documented Win32 1.x / Win95-era surface that wibo does not
yet cover, and wibo's own embedded msvcrt40 (the encounter/winedll
build, WIBO_ENABLE_WINE_DLLS) imports the family from kernel32: hosting
MSVC 4.x's cl.exe stops at the first missing lstr* import inside c1.exe
without them. With this patch a clean cl.exe + link.exe + nmake.exe
pipeline (MSVC 4.00 and 4.20) runs end-to-end and produces output
byte-identical to the equivalent Wine-hosted build.
Behavioural notes:
* lstrcpyn copies up to iMaxLength-1 chars and ALWAYS writes a
terminating nul, unlike strncpy. iMaxLength is declared int but is
treated as unsigned per Windows' historical behaviour.
* lstrcmp(i) returns -1 / 0 / +1 (not strcmp's arbitrary delta). The
official implementation defers to CompareString with the thread
locale; a byte-wise compare is used here because the consumers
exercised (cl.exe, link.exe, nmake.exe, msvcrt) only feed ASCII.
* Access-violation behaviour (SetLastError + return 0) is emulated only
for the obvious NULL case -- wibo has no SEH dispatcher, so arbitrary
bad pointers fault the guest as they would on a real Windows.
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.
Adds the legacy
lstr{cpy,cat,len,cmp,cmpi}{A,W}+lstrcpynWfamily to kernel32 (lstrcpynAalready exists since #124 and is kept as-is).Why
wibo's own embedded msvcrt40 (the encounter/winedll build,
WIBO_ENABLE_WINE_DLLS) imports this family from kernel32. Hosting MSVC 4.x'scl.execurrently stops at the first missing lstr* import insidec1.exe:With this patch, clean
cl.exe+link.exe+nmake.exepipelines (MSVC 4.00 and 4.20, the mid-90s toolchains used by several matching-decompilation projects) run end-to-end under wibo and produce output byte-identical to the equivalent Wine-hosted builds.Behaviour notes
lstrcpyncopies up toiMaxLength-1chars and ALWAYS writes a terminating nul (unlikestrncpy);iMaxLengthis treated as unsigned per Windows' historical behaviour.lstrcmp(i)returns -1/0/+1 (notstrcmp's arbitrary delta). Windows defers toCompareStringwith the thread locale; a byte-wise compare is used here since the consumers exercised (cl/link/nmake/msvcrt) only feed ASCII.Testing
test_lstrcpyn)cl.exe/link.exe/nmake.exeend-to-end; compile output byte-identical to Wine-hosted reference builds across a 40-TU corpus