Source code of Windows XP (NT5)
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.

111 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. crtsubst.h
  5. Abstract:
  6. Maps some CRT functions to Win32 calls
  7. Author:
  8. Rajeev Dujari (rajeevd) 04-Apr-1996
  9. Revision History:
  10. 04-Apr-1996 rajeevd
  11. Created
  12. --*/
  13. #ifndef unix
  14. /*
  15. On NT, kernel32 forwards RtlMoveMemory to ntdll.
  16. On 95, kernel32 has RtlMoveMemory but ntdll doesn't.
  17. Override the NT headers forwarding at compile time.
  18. */
  19. #ifdef RtlMoveMemory
  20. #undef RtlMoveMemory
  21. extern "C" void RtlMoveMemory (void *, const void *, unsigned long);
  22. #endif
  23. /* WARNING: Be careful mapping CRT strncpy to Win32 lstrcpyn.
  24. strncpy (dst, "bar", 2); // dst will get 'b', 'a'
  25. lstrcpyn (dst, "bar" 2); // dst will get 'b', 0
  26. strncpy (dst, "bar", 6); // dst will get 'b', 'a', 'r', 0, 0, 0
  27. lstrcpyn (dst, "bar", 6); // dst will get 'b', 'a', 'r', 0
  28. */
  29. #undef free
  30. #undef malloc
  31. #undef memmove
  32. #undef strdup
  33. #undef stricmp
  34. #undef _stricmp
  35. #undef strlwr
  36. #undef _strlwr
  37. #undef strupr
  38. #undef tolower
  39. #undef toupper
  40. #undef wcslen
  41. #undef _strstr
  42. #undef strstr
  43. #undef _strchr
  44. #undef strchr
  45. #undef strrchr
  46. #undef __atoi
  47. #undef _atoi
  48. #undef atoi
  49. #undef _strncat
  50. #undef strncat
  51. #undef _strncpy
  52. #undef strncpy
  53. #undef _strnicmp
  54. #undef strnicmp
  55. #undef _strncmp
  56. #undef strncmp
  57. //#undef StrChr
  58. #define free(ptr) FREE_MEMORY((HLOCAL) ptr)
  59. #define malloc(size) ((PVOID)ALLOCATE_MEMORY(LMEM_FIXED, size))
  60. #define memmove(m1,m2,n) RtlMoveMemory (m1,m2,n)
  61. #define strdup(s) NewString(s)
  62. #define stricmp(s1,s2) lstrcmpi(s1,s2)
  63. #define _stricmp(s1,s2) lstrcmpi(s1,s2)
  64. #define strlwr(s) CharLower(s)
  65. #define _strlwr(s) CharLower(s)
  66. #define strupr(s) CharUpper(s)
  67. #define tolower(c) ((BYTE) CharLower((LPSTR) ((DWORD)((BYTE)(c) & 0xff))))
  68. #define toupper(c) ((BYTE) CharUpper((LPSTR) ((DWORD)((BYTE)(c) & 0xff))))
  69. #define wcslen(s) lstrlenW(s)
  70. #define _strstr StrStr
  71. #define strstr StrStr
  72. //#define StrChr PrivateStrChr
  73. #define _strchr StrChr
  74. #define strchr StrChr
  75. #define strrchr(s, c) StrRChr(s, NULL, c)
  76. #define __atoi StrToInt
  77. #define _atoi StrToInt
  78. #define atoi StrToInt
  79. #define strncat StrNCat
  80. #define _strncat StrNCat
  81. #define strncpy StrNCpy
  82. #define _strncpy StrNCpy
  83. #define strnicmp StrCmpNIC
  84. #define _strnicmp StrCmpNIC
  85. #define strncmp StrCmpNC
  86. #define _strncmp StrCmpNC
  87. #undef itoa
  88. #undef ultoa
  89. //#define itoa(val,s,n) _itoa(val,s,n)
  90. //#define ultoa(val,s,n) _ultoa(val,s,n)
  91. #endif /* unix */