Skip to content

Commit

Permalink
** Test whether these are also needed for rosload
Browse files Browse the repository at this point in the history
  • Loading branch information
HBelusca committed Oct 3, 2024
1 parent bc38c57 commit 0ec883c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions boot/freeldr/freeldr/ntldr/winldr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 0ec883c

Please sign in to comment.