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.

57 lines
1.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: crtstr.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #if !DBG
  11. // Only build for retail
  12. #include "windows.h"
  13. #include "malloc.h"
  14. int __cdecl _wcsicmp(const wchar_t * wsz1, const wchar_t * wsz2)
  15. //
  16. // REVIEW: Who calls this function, and should they be doing so?
  17. //
  18. // Return:
  19. // <0 if wsz1 < wsz2
  20. // 0 if wsz1 = wsz2
  21. // >0 if wsz1 > wsz2
  22. {
  23. //
  24. // Convert to multibyte and let the system do it
  25. //
  26. int cch1 = lstrlenW(wsz1);
  27. int cch2 = lstrlenW(wsz2);
  28. int cb1 = (cch1+1) * sizeof(WCHAR);
  29. int cb2 = (cch2+1) * sizeof(WCHAR);
  30. char* sz1= NULL;
  31. char* sz2= NULL;
  32. __try {
  33. sz1= (char*) _alloca(cb1);
  34. sz2= (char*) _alloca(cb2);
  35. } __except(EXCEPTION_EXECUTE_HANDLER) {
  36. //xiaohs: We return a non-zero value to
  37. //signal a falture case because all the calls to this
  38. //function compare the return value with 0
  39. SetLastError(GetExceptionCode());
  40. return -1;
  41. }
  42. WideCharToMultiByte(CP_ACP, 0, wsz1, -1, sz1, cb1, NULL, NULL);
  43. WideCharToMultiByte(CP_ACP, 0, wsz2, -1, sz2, cb2, NULL, NULL);
  44. return lstrcmpiA(sz1, sz2);
  45. }
  46. #endif // !DBG