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.

116 lines
1.6 KiB

  1. /*--
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. util.h
  5. Abstract:
  6. Utility functions for dbghelp.
  7. Author:
  8. Pat Styles (patst) 6-Dec-2001
  9. Environment:
  10. User Mode
  11. --*/
  12. #ifndef true
  13. #define true TRUE
  14. #define false FALSE
  15. #endif
  16. int
  17. ReverseCmp(
  18. char *one,
  19. char *two
  20. );
  21. BOOL
  22. UpdateBestSrc(
  23. char *cmp,
  24. char *trg,
  25. char *src
  26. );
  27. BOOL
  28. ShortNodeName(
  29. char *in,
  30. char *out,
  31. size_t osize
  32. );
  33. BOOL
  34. ShortFileName(
  35. char *in,
  36. char *out,
  37. size_t osize
  38. );
  39. BOOL
  40. ToggleFailCriticalErrors(
  41. BOOL reset
  42. );
  43. DWORD
  44. fnGetFileAttributes(
  45. char *lpFileName
  46. );
  47. #define SetCriticalErrorMode() ToggleFailCriticalErrors(FALSE)
  48. #define ResetCriticalErrorMode() ToggleFailCriticalErrors(TRUE)
  49. __inline
  50. BOOL exists(char *path)
  51. {
  52. DWORD attrib = fnGetFileAttributes(path);
  53. if (attrib == 0xFFFFFFFF)
  54. return false;
  55. return true;
  56. }
  57. __inline
  58. BOOL fileexists(char *path)
  59. {
  60. DWORD attrib = fnGetFileAttributes(path);
  61. if (attrib == 0xFFFFFFFF)
  62. return false;
  63. if (attrib & FILE_ATTRIBUTE_DIRECTORY)
  64. return false;
  65. return true;
  66. }
  67. __inline
  68. BOOL isdir(char *path)
  69. {
  70. DWORD attrib = fnGetFileAttributes(path);
  71. if (attrib == 0xFFFFFFFF)
  72. return false;
  73. if (attrib & FILE_ATTRIBUTE_DIRECTORY)
  74. return true;
  75. return false;
  76. }
  77. void rtrim(LPSTR sz);
  78. void ltrim(LPSTR sz);
  79. void trim(LPSTR sz);
  80. char *errortext(DWORD err);
  81. VOID RemoveTrailingBackslash(LPSTR sz);