From 0ec883c9c458c9dd53887215537896d25651fd1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 3 Oct 2024 18:01:15 +0200 Subject: [PATCH] ** Test whether these are also needed for rosload --- boot/freeldr/freeldr/ntldr/winldr.c | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/boot/freeldr/freeldr/ntldr/winldr.c b/boot/freeldr/freeldr/ntldr/winldr.c index bb078c640cf6b..8f4150d8de993 100644 --- a/boot/freeldr/freeldr/ntldr/winldr.c +++ b/boot/freeldr/freeldr/ntldr/winldr.c @@ -1359,3 +1359,52 @@ WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock) NextBd = ArcDisk->ListEntry.Flink; } } + +///////////////////////////////////////// + +// We need to emulate these, because the original ones don't work in freeldr +// These functions are here, because they need to be in the main compilation unit +// and cannot be in a library. +int __cdecl wctomb(char *mbchar, wchar_t wchar) +{ + *mbchar = (char)wchar; + return 1; +} + +int __cdecl mbtowc(wchar_t *wchar, const char *mbchar, size_t count) +{ + *wchar = (wchar_t)*mbchar; + return 1; +} + +// The wctype table is 144 KB, too much for poor freeldr +int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags) +{ + return _isctype((char)wc, wctypeFlags); +} + +#ifdef _MSC_VER +#pragma warning(disable:4164) +#pragma function(pow) +#pragma function(log) +#pragma function(log10) +#endif + +// Stubs to avoid pulling in data from CRT +double pow(double x, double y) +{ + __debugbreak(); + return 0.0; +} + +double log(double x) +{ + __debugbreak(); + return 0.0; +} + +double log10(double x) +{ + __debugbreak(); + return 0.0; +}