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.

51 lines
1.1 KiB

  1. #ifndef _INLINE_STRING_H_
  2. #define _INLINE_STRING_H_
  3. /* strutil.cpp */
  4. #define StrlenA lstrlenA
  5. #define StrcatA lstrcatA
  6. #define StrcpyA lstrcpyA
  7. #define StrcpynA lstrcpynA
  8. #define StrcmpA lstrcmpA
  9. #define StrlenW lstrlenW
  10. #define StrcpySafeW StrcpynW
  11. #define StrcpySafeA StrcpynA
  12. inline LPWSTR StrcpyW(WCHAR *dest, const WCHAR *source)
  13. {
  14. WCHAR *start = dest;
  15. while (*dest++ = *source++);
  16. return(start);
  17. }
  18. inline LPWSTR StrcatW(WCHAR *dest, const WCHAR *source)
  19. {
  20. WCHAR *start = dest;
  21. WCHAR *pwch;
  22. for (pwch = dest; *pwch; pwch++);
  23. while (*pwch++ = *source++);
  24. return(start);
  25. }
  26. inline LPWSTR StrcpynW(LPWSTR dest, LPWSTR src, INT destLen)
  27. {
  28. if(!dest) {
  29. return NULL;
  30. }
  31. if(!src) {
  32. return dest;
  33. }
  34. //WCHAR *start = dest;
  35. INT i;
  36. for(i = 0; i < destLen-1 && src[i]; i++) {
  37. dest[i] = src[i];
  38. }
  39. dest[i] = (WCHAR)0x0000;
  40. return dest;
  41. }
  42. inline int StrcmpW(const WCHAR * first, const WCHAR * last)
  43. {
  44. for (; *first && *last && (*first == *last); first++, last++);
  45. return (*first - *last);
  46. }
  47. #endif //_INLINE_STRING_H_