R.Wieser
2020-11-27 19:21:02 UTC
Hello all,
I need to copy an ANSI string from a source into a buffer with a fixed
length. That looks like a job for "lstrcpynA". Easy-Peasy, right ?
There is only a tiny issue with it : For some reason its able to accept a
string that is too long to place in the target buffer, *but still succeed*.
The problem (to me) is that the MSDN docucumentation to the call [1] do not
even /hint/ at how I'm supposed to detect such a succeeded-but-failed
situation. :-(
[1]
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lstrcpyna
Does anyone know whay the succeeded-but-failed result look like ?
Regards,
Rudy Wieser
P.s.
I've seen the page state that I should not use that function, but instead
something like StringCchCopy. The problem with that is that they "forgot"
to mention which DLL its part of ... if its actually a DLL function to begin
with.
I need to copy an ANSI string from a source into a buffer with a fixed
length. That looks like a job for "lstrcpynA". Easy-Peasy, right ?
There is only a tiny issue with it : For some reason its able to accept a
string that is too long to place in the target buffer, *but still succeed*.
The problem (to me) is that the MSDN docucumentation to the call [1] do not
even /hint/ at how I'm supposed to detect such a succeeded-but-failed
situation. :-(
[1]
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lstrcpyna
Does anyone know whay the succeeded-but-failed result look like ?
Regards,
Rudy Wieser
P.s.
I've seen the page state that I should not use that function, but instead
something like StringCchCopy. The problem with that is that they "forgot"
to mention which DLL its part of ... if its actually a DLL function to begin
with.