Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Tuesday 11 January 2022 11:40:45 Martin Storsjö wrote: > On Mon, 10 Jan 2022, LIU Hao wrote: > > > 在 2022-01-01 05:54, Pali Rohár 写道: > > > > > > Well, if you want from me any improvements in this patch, I can do it. > > > Just let me know what is needed to fix/change. > > > > > > > However, cleaning the code from such workarounds seems tempting. > > > > I wonder if > > > > there is a real use case for this or is it just an experiment for fun? > > > > > > There is a real use case to allow writing new DLL plugins with modern > > > mingw-w64 tools for older applications which were compiled with VC6 (and > > > which use VC6 msvcrt.dll). > > > > > > > Jacek, do we accept this patch, or suggest a `_vscprintf` in > > 'libmsvcrt.a' which overrides the one from MSVCRT (and provides it if > > MSVCRT doesn't, so it's always available)? The latter seems better. > > I guess that could be a nicer way of handling it, so it doesn't only help in > this particular case, but for any caller that happens to call that function. So, should I change my patch to do this? > But even if this current file is built as part of libmingwex.a, the function > __ms_vsnprintf is only called in msvcrt builds anyway, so if kept here, it > doesn't bother UCRT anyway. > > // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Tue, 11 Jan 2022, Pali Rohár wrote: On Tuesday 11 January 2022 11:40:45 Martin Storsjö wrote: On Mon, 10 Jan 2022, LIU Hao wrote: 在 2022-01-01 05:54, Pali Rohár 写道: Well, if you want from me any improvements in this patch, I can do it. Just let me know what is needed to fix/change. However, cleaning the code from such workarounds seems tempting. I wonder if there is a real use case for this or is it just an experiment for fun? There is a real use case to allow writing new DLL plugins with modern mingw-w64 tools for older applications which were compiled with VC6 (and which use VC6 msvcrt.dll). Jacek, do we accept this patch, or suggest a `_vscprintf` in 'libmsvcrt.a' which overrides the one from MSVCRT (and provides it if MSVCRT doesn't, so it's always available)? The latter seems better. I guess that could be a nicer way of handling it, so it doesn't only help in this particular case, but for any caller that happens to call that function. So, should I change my patch to do this? I think that would be nicer, yes. By adding that source file to src_msvcrt32, it would only get included for 32 bit x86 libmsvcrt.a and nothing else. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Mon, 10 Jan 2022, LIU Hao wrote: 在 2022-01-01 05:54, Pali Rohár 写道: Well, if you want from me any improvements in this patch, I can do it. Just let me know what is needed to fix/change. However, cleaning the code from such workarounds seems tempting. I wonder if there is a real use case for this or is it just an experiment for fun? There is a real use case to allow writing new DLL plugins with modern mingw-w64 tools for older applications which were compiled with VC6 (and which use VC6 msvcrt.dll). Jacek, do we accept this patch, or suggest a `_vscprintf` in 'libmsvcrt.a' which overrides the one from MSVCRT (and provides it if MSVCRT doesn't, so it's always available)? The latter seems better. I guess that could be a nicer way of handling it, so it doesn't only help in this particular case, but for any caller that happens to call that function. But even if this current file is built as part of libmingwex.a, the function __ms_vsnprintf is only called in msvcrt builds anyway, so if kept here, it doesn't bother UCRT anyway. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
在 2022-01-01 05:54, Pali Rohár 写道: Well, if you want from me any improvements in this patch, I can do it. Just let me know what is needed to fix/change. However, cleaning the code from such workarounds seems tempting. I wonder if there is a real use case for this or is it just an experiment for fun? There is a real use case to allow writing new DLL plugins with modern mingw-w64 tools for older applications which were compiled with VC6 (and which use VC6 msvcrt.dll). Jacek, do we accept this patch, or suggest a `_vscprintf` in 'libmsvcrt.a' which overrides the one from MSVCRT (and provides it if MSVCRT doesn't, so it's always available)? The latter seems better. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Friday 31 December 2021 00:30:37 Jacek Caban wrote: > On 12/29/21 16:52, Martin Storsjö wrote: > > On Wed, 29 Dec 2021, LIU Hao wrote: > > > > > 在 2021-12-23 22:20, Pali Rohár 写道: > > > > Original MSVC 6.0 msvcrt.dll library does not provide _vscprintf() > > > > function. Therefore usage of snprintf() with this DLL library cause > > > > application crash. Add simple fallback implementation of > > > > _vscprintf() just > > > > for __ms_vsnprintf() to allow usage of snprintf() function also > > > > when using > > > > original msvcrt.dll library. This fallback implementation is > > > > static and not > > > > exported outside of vsnprintf.c source file. > > > > --- > > > > mingw-w64-crt/stdio/vsnprintf.c | 67 > > > > + > > > > 1 file changed, 67 insertions(+) > > > > > > > > > > I have an impression that we have not been supporting for VC6 since > > > many years ago. All code targeting MSVCRT now requires Windows XP > > > and the MSVCRT.DLL from it. > > > > While this is true in general, I'm not totally opposed to such a fairly > > nonintrusive workaround, if it makes things work in more cases with the > > original msvcrt.dll (and while we can't guarantee that it stays > > working). But I'm interested in hearing more opinions. Jacek? > > > I'm not sure if we ever formalized treatment for old architectures, my > impression is that we stopped carrying about them in reviews, but never > cleaned up the tree so we never intentionally broke them. If we keep similar > code anyway, a non-intrusive workaround seems fine. If we decided to use > something like that, we should probably just hook _vscprintf like we do with > other functions, through. Well, if you want from me any improvements in this patch, I can do it. Just let me know what is needed to fix/change. > However, cleaning the code from such workarounds seems tempting. I wonder if > there is a real use case for this or is it just an experiment for fun? There is a real use case to allow writing new DLL plugins with modern mingw-w64 tools for older applications which were compiled with VC6 (and which use VC6 msvcrt.dll). Another real use case for which I used this my patch in last few days was finalizing windows port of pciutils project, specially lspci.exe command line application which prints all PCI(e) devices in system with configuration, resources, etc... Because older windows versions (which has only VC6 msvcrt) have radically smaller hard disk image and need less runtime memory, I used them in VM (qemu+kvm) with HDD image in RAM for testing lspci port. So ability to run binaries compiled by mingw-w64 with VC6 msvcrt runtime library is a big advantage for me. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Wednesday 29 December 2021 22:35:08 LIU Hao wrote: > 在 2021-12-23 22:20, Pali Rohár 写道: > > Original MSVC 6.0 msvcrt.dll library does not provide _vscprintf() > > function. Therefore usage of snprintf() with this DLL library cause > > application crash. Add simple fallback implementation of _vscprintf() just > > for __ms_vsnprintf() to allow usage of snprintf() function also when using > > original msvcrt.dll library. This fallback implementation is static and not > > exported outside of vsnprintf.c source file. > > --- > > mingw-w64-crt/stdio/vsnprintf.c | 67 + > > 1 file changed, 67 insertions(+) > > > > I have an impression that we have not been supporting for VC6 since many > years ago. All code targeting MSVCRT now requires Windows XP and the > MSVCRT.DLL from it. Hello! It is truth that WinXP's system MSVCRT has this function. But there is an issue that system MSVCRT library is not versioned and you never know at compile / link time which version of MSVCRT will be loaded at runtime (as opposite of when not using system MSVCRT library but e.g. msvcr90.dll which has version in its name). So for example if some plugin (DLL) is compiled by mingw-w64 and code of this plugin uses snprintf() then this plugin fails to load in (older) application which is shipped with original 6.0 msvcrt.dll library. And this happens on any Windows, including XP and newer. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On 12/29/21 16:52, Martin Storsjö wrote: On Wed, 29 Dec 2021, LIU Hao wrote: 在 2021-12-23 22:20, Pali Rohár 写道: Original MSVC 6.0 msvcrt.dll library does not provide _vscprintf() function. Therefore usage of snprintf() with this DLL library cause application crash. Add simple fallback implementation of _vscprintf() just for __ms_vsnprintf() to allow usage of snprintf() function also when using original msvcrt.dll library. This fallback implementation is static and not exported outside of vsnprintf.c source file. --- mingw-w64-crt/stdio/vsnprintf.c | 67 + 1 file changed, 67 insertions(+) I have an impression that we have not been supporting for VC6 since many years ago. All code targeting MSVCRT now requires Windows XP and the MSVCRT.DLL from it. While this is true in general, I'm not totally opposed to such a fairly nonintrusive workaround, if it makes things work in more cases with the original msvcrt.dll (and while we can't guarantee that it stays working). But I'm interested in hearing more opinions. Jacek? I'm not sure if we ever formalized treatment for old architectures, my impression is that we stopped carrying about them in reviews, but never cleaned up the tree so we never intentionally broke them. If we keep similar code anyway, a non-intrusive workaround seems fine. If we decided to use something like that, we should probably just hook _vscprintf like we do with other functions, through. However, cleaning the code from such workarounds seems tempting. I wonder if there is a real use case for this or is it just an experiment for fun? Thanks, Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
On Wed, 29 Dec 2021, LIU Hao wrote: 在 2021-12-23 22:20, Pali Rohár 写道: Original MSVC 6.0 msvcrt.dll library does not provide _vscprintf() function. Therefore usage of snprintf() with this DLL library cause application crash. Add simple fallback implementation of _vscprintf() just for __ms_vsnprintf() to allow usage of snprintf() function also when using original msvcrt.dll library. This fallback implementation is static and not exported outside of vsnprintf.c source file. --- mingw-w64-crt/stdio/vsnprintf.c | 67 + 1 file changed, 67 insertions(+) I have an impression that we have not been supporting for VC6 since many years ago. All code targeting MSVCRT now requires Windows XP and the MSVCRT.DLL from it. While this is true in general, I'm not totally opposed to such a fairly nonintrusive workaround, if it makes things work in more cases with the original msvcrt.dll (and while we can't guarantee that it stays working). But I'm interested in hearing more opinions. Jacek? // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
在 2021-12-23 22:20, Pali Rohár 写道: Original MSVC 6.0 msvcrt.dll library does not provide _vscprintf() function. Therefore usage of snprintf() with this DLL library cause application crash. Add simple fallback implementation of _vscprintf() just for __ms_vsnprintf() to allow usage of snprintf() function also when using original msvcrt.dll library. This fallback implementation is static and not exported outside of vsnprintf.c source file. --- mingw-w64-crt/stdio/vsnprintf.c | 67 + 1 file changed, 67 insertions(+) I have an impression that we have not been supporting for VC6 since many years ago. All code targeting MSVCRT now requires Windows XP and the MSVCRT.DLL from it. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Add fallback _vscprintf_emu code for __ms_vsnprintf()
_vscprintf is exported from msvcrt.dll in Windows 10. Should there be a msvcrt version check in the function definition? Where can I get original MSVC 6.0 msvcrt.dll? ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public