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.

87 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. validc.h
  5. Abstract:
  6. Strings of valid/invalid characters for canonicalization
  7. Author:
  8. Richard Firth (rfirth) 15-May-1991
  9. Revision History:
  10. 03-Jan-1992 rfirth
  11. Added ILLEGAL_FAT_CHARS and ILLEGAL_HPFS_CHARS (from fsrtl\name.c)
  12. 27-Sep-1991 JohnRo
  13. Changed TEXT macro usage to allow UNICODE.
  14. 19-Feb-1993 RitaW
  15. Ported for NetWare use.
  16. --*/
  17. //
  18. // Disallowed control characters (not including \0)
  19. //
  20. #define CTRL_CHARS_0 L"\001\002\003\004\005\006\007"
  21. #define CTRL_CHARS_1 L"\010\011\012\013\014\015\016\017"
  22. #define CTRL_CHARS_2 L"\020\021\022\023\024\025\026\027"
  23. #define CTRL_CHARS_3 L"\030\031\032\033\034\035\036\037"
  24. #define CTRL_CHARS_STR CTRL_CHARS_0 CTRL_CHARS_1 CTRL_CHARS_2 CTRL_CHARS_3
  25. //
  26. // Character subsets
  27. //
  28. #define NON_COMPONENT_CHARS L"\\/:"
  29. #define ILLEGAL_CHARS_STR L"\"<>|"
  30. #define SPACE_STR L" "
  31. #define PATH_SEPARATORS L"\\/"
  32. //
  33. // Combinations of the above
  34. //
  35. #define ILLEGAL_CHARS CTRL_CHARS_STR ILLEGAL_CHARS_STR
  36. #define ILLEGAL_NAME_CHARS_STR L"\"/\\[]:|<>+;,?" CTRL_CHARS_STR // "=" removed for NDS
  37. #define STANDARD_ILLEGAL_CHARS ILLEGAL_NAME_CHARS_STR L"*"
  38. #define SERVER_ILLEGAL_CHARS STANDARD_ILLEGAL_CHARS SPACE_STR
  39. //
  40. // Characters which may not appear in a canonicalized FAT filename are:
  41. //
  42. // 0x00 - 0x1f " * + , / : ; < = > ? [ \ ] |
  43. //
  44. #define ILLEGAL_FAT_CHARS CTRL_CHARS_STR L"\"*+,/:;<=>?[\\]|"
  45. //
  46. // Characters which may not appear in a canonicalized HPFS filename are:
  47. //
  48. // 0x00 - 0x1f " * / : < > ? \ |
  49. //
  50. #define ILLEGAL_HPFS_CHARS CTRL_CHARS_STR L"\"*/:<>?\\|"
  51. //
  52. // Checks if the token contains all valid characters
  53. //
  54. #define IS_VALID_TOKEN(_Str, _StrLen) \
  55. ((BOOL) (wcscspn((_Str), STANDARD_ILLEGAL_CHARS) == (_StrLen)))
  56. //
  57. // Checks if the server name contains all valid characters for the server name
  58. //
  59. #define IS_VALID_SERVER_TOKEN(_Str, _StrLen) \
  60. ((BOOL) (wcscspn((_Str), SERVER_ILLEGAL_CHARS) == (_StrLen)))