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.

76 lines
1.2 KiB

  1. /*
  2. * UTIL.C
  3. *
  4. *
  5. * DRIVEARB.DLL - Shared Drive Aribiter for shared disks and libraries
  6. * - inter-machine sharing client
  7. * - inter-app sharing service
  8. *
  9. * Author: ErvinP
  10. *
  11. * (c) 2000 Microsoft Corporation
  12. *
  13. */
  14. #include <stdlib.h>
  15. #include <wtypes.h>
  16. #include <dlmhdr.h> // BUGBUG - get a common DLM header from Cluster team
  17. #include <drivearb.h>
  18. #include "internal.h"
  19. DWORD MyStrNCpy(LPSTR destStr, LPSTR srcStr, DWORD maxChars)
  20. {
  21. DWORD charsCopied = 0;
  22. while ((maxChars == (DWORD)-1) || maxChars-- > 0){
  23. *destStr = *srcStr;
  24. charsCopied++;
  25. if (*srcStr == '\0'){
  26. break;
  27. }
  28. else {
  29. destStr++, srcStr++;
  30. }
  31. }
  32. return charsCopied;
  33. }
  34. BOOL MyCompareStringsI(LPSTR s, LPSTR p)
  35. {
  36. BOOL result;
  37. while (*s && *p){
  38. if ((*s|0x20) != (*p|0x20)){
  39. break;
  40. }
  41. else {
  42. s++, p++;
  43. }
  44. }
  45. // careful, NULL|0x20 == space|0x20 !
  46. if (!*s && !*p){
  47. result = TRUE;
  48. }
  49. else if (!*s || !*p){
  50. result = FALSE;
  51. }
  52. else if ((*s|0x20) == (*p|0x20)){
  53. result = TRUE;
  54. }
  55. else {
  56. result = FALSE;
  57. }
  58. return result;
  59. }