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.

37 lines
1.4 KiB

  1. //////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // string.c
  4. //
  5. // This file contains most commonly used string operation. ALl the setup project should link here
  6. // or add the common utility here to avoid duplicating code everywhere or using CRT runtime.
  7. //
  8. // Created 4\15\997 inateeg
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////////////////////////
  11. #include <windows.h>
  12. #include "sdsutils.h"
  13. //=================================================================================================
  14. //
  15. // copied from \\trango\slmadd\src\shell\shlwapi\strings.c
  16. //
  17. // StrRChr - Find last occurrence of character in string
  18. // Assumes lpStart points to start of null terminated string
  19. // wMatch is the character to match
  20. // returns ptr to the last occurrence of ch in str, NULL if not found.
  21. //
  22. //=================================================================================================
  23. LPSTR FAR ANSIStrRChr(LPCSTR lpStart, WORD wMatch)
  24. {
  25. LPCSTR lpFound = NULL;
  26. for ( ; *lpStart; lpStart = CharNext(lpStart))
  27. {
  28. // (ChrCmp returns FALSE when characters match)
  29. if (!ChrCmpA_inline(*(UNALIGNED WORD FAR *)lpStart, wMatch))
  30. lpFound = lpStart;
  31. }
  32. return ((LPSTR)lpFound);
  33. }