#include "private.h" // Thi is not working since ATL uses CRT dll. we should not use ATL to remove CRT bondage #define CPP_FUNCTIONS #include "icrtfree.h" // Code to help free modules from the bondage and tyranny of CRT libraries #ifdef NOCLIB #if defined(_M_IX86) extern "C" int _fltused = 1; /*---------------------------------------------------------------------------- _ftol - convert a float value to an __int64. The argument is on the top of the stack, the result is returned in EAX (low) and EDX (high). Note that this is used for all float to integral convertion and deals with both signed and unsigned values - the compiler just ignores the EDX value. The LongFromDouble and UlongFromDouble functions check the range, so this cavlier bitwise truncation doesn't matter. ------------------------------------------------------------------- JohnBo -*/ extern "C" __declspec(naked) void __cdecl _ftol(void) { // A simple FISTP is all that is required (so why is this out of line? // possible the CRT version handles overflow differently?) __asm PUSH EDX; // Just to make room on the stack __asm PUSH EAX; __asm FISTP QWORD PTR [ESP]; // Pop long off top of FP stack __asm POP EAX; // And put back into EDX/EAX - tedious eh? __asm POP EDX; // Stack grows downwards, so EDX is high. __asm RET; } #endif /* * memmove */ void * __cdecl memmove(void * dst, const void * src, size_t count) { void * ret = dst; if (dst <= src || (char *)dst >= ((char *)src + count)) { /* * Non-Overlapping Buffers * copy from lower addresses to higher addresses */ // memcpy is intrinsic memcpy(dst, src, count); } else { /* * Overlapping Buffers * copy from higher addresses to lower addresses */ dst = (char *)dst + count - 1; src = (char *)src + count - 1; while (count--) { *(char *)dst = *(char *)src; dst = (char *)dst - 1; src = (char *)src - 1; } } return(ret); } /*--------------------------------------------------------------------------- StrCopyW Unicode String copy ---------------------------------------------------------------------------*/ LPWSTR ImeRtl_StrCopyW(LPWSTR pwDest, LPCWSTR pwSrc) { LPWSTR pwStart = pwDest; while (*pwDest++ = *pwSrc++) ; return (pwStart); } /*--------------------------------------------------------------------------- StrnCopyW Unicode String copy ---------------------------------------------------------------------------*/ LPWSTR ImeRtl_StrnCopyW(LPWSTR pwDest, LPCWSTR pwSrc, UINT uiCount) { LPWSTR pwStart = pwDest; while (uiCount && (*pwDest++ = *pwSrc++)) // copy string uiCount--; if (uiCount) // pad out with zeroes while (--uiCount) *pwDest++ = 0; return (pwStart); } /*--------------------------------------------------------------------------- StrCmpW Unicode String compare ---------------------------------------------------------------------------*/ INT ImeRtl_StrCmpW(LPCWSTR pwSz1, LPCWSTR pwSz2) { INT cch1 = lstrlenW(pwSz1); INT cch2 = lstrlenW(pwSz2); if (cch1 != cch2) return cch2 - cch1; for (INT i=0; i