Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.4 KiB

  1. // Code to help free modules from the bondage and tyranny of CRT libraries
  2. // Include this header in a single component and #define CPP_FUNCTIONS
  3. #ifdef __cplusplus
  4. #ifdef CPP_FUNCTIONS
  5. void* __cdecl operator new(size_t nSize)
  6. {
  7. LPVOID p;
  8. p = (LPVOID)CoTaskMemAlloc((ULONG)nSize);
  9. if (p != NULL)
  10. ZeroMemory(p, nSize);
  11. return p;
  12. }
  13. void __cdecl operator delete(void *pv)
  14. {
  15. CoTaskMemFree(pv);
  16. }
  17. #endif
  18. #ifdef DEFINE_PURECALL
  19. extern "C" int __cdecl _purecall(void)
  20. {
  21. return 0;
  22. }
  23. #endif
  24. #endif
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #if defined(DEFINE_FLOAT_STUFF)
  29. // If you aren't using any floating-point CRT functions and you know
  30. // you aren't performing any float conversions or arithmetic, yet the
  31. // linker wants these symbols declared, then define DEFINE_FLOAT_STUFF.
  32. //
  33. // Warning: declaring these symbols in a component that needs floating
  34. // point support from the CRT will produce undefined results. (You will
  35. // need fp support from the CRT if you simply perform fp arithmetic.)
  36. int _fltused = 0;
  37. void __cdecl _fpmath(void) { }
  38. #endif
  39. #ifdef __cplusplus
  40. };
  41. #endif
  42. #ifndef __CRTFREE_H_
  43. #define __CRTFREE_H_
  44. #ifdef __cplusplus
  45. #ifndef _M_PPC
  46. #pragma intrinsic(memcpy)
  47. #pragma intrinsic(memcmp)
  48. #pragma intrinsic(memset)
  49. #endif
  50. #endif
  51. #endif // __CRTFREE_H_