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.

122 lines
2.9 KiB

  1. /*
  2. * U R L . H
  3. *
  4. * Url normalization/canonicalization
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #ifndef _URL_H_
  9. #define _URL_H_
  10. // ACP Language vs. DBCS -----------------------------------------------------
  11. //
  12. // ACP Language vs. DBCS -----------------------------------------------------
  13. //
  14. // FIsSystemDBCS()
  15. //
  16. typedef enum {
  17. DBCS_UNKNOWN = 0,
  18. DBCS_NO,
  19. DBCS_YES
  20. } LANG_DBCS;
  21. DEC_GLOBAL LANG_DBCS gs_dbcs = DBCS_UNKNOWN;
  22. inline BOOL
  23. FIsSystemDBCS()
  24. {
  25. if (DBCS_UNKNOWN == gs_dbcs)
  26. {
  27. UINT uPrimaryLangID = PRIMARYLANGID(GetSystemDefaultLangID());
  28. if ((uPrimaryLangID == LANG_JAPANESE) ||
  29. (uPrimaryLangID == LANG_CHINESE) ||
  30. (uPrimaryLangID == LANG_KOREAN))
  31. {
  32. gs_dbcs = DBCS_YES;
  33. }
  34. else
  35. gs_dbcs = DBCS_NO;
  36. }
  37. return (DBCS_YES == gs_dbcs);
  38. }
  39. inline BOOL
  40. FIsDBCSTrailingByte (const CHAR * pch, LONG cch)
  41. {
  42. // Checks to see if the previous byte of the pointed to character is
  43. // a lead byte if and only if there is characters preceeding and the
  44. // system is DBCS.
  45. //
  46. Assert (pch);
  47. return ((0 < cch) && FIsSystemDBCS() && IsDBCSLeadByte(*(pch - 1)));
  48. }
  49. inline BOOL
  50. FIsDriveTrailingChar(const CHAR * pch, LONG cch)
  51. {
  52. // Checks if the character we are pointing at stands after the drive letter
  53. //
  54. Assert(pch);
  55. return ((2 < cch) && (':' == *(pch - 1)) &&
  56. ((('a' <= *(pch - 2)) && ('z' >= *(pch - 2))) ||
  57. (('A' <= *(pch - 2)) && ('Z' >= *(pch - 2)))));
  58. }
  59. inline BOOL
  60. FIsDriveTrailingChar(const WCHAR * pwch, LONG cch)
  61. {
  62. // Checks if the character we are pointing at stands after the drive letter
  63. //
  64. Assert(pwch);
  65. return ((2 < cch) && (L':' == *(pwch - 1)) &&
  66. (((L'a' <= *(pwch - 2)) && (L'z' >= *(pwch - 2))) ||
  67. ((L'A' <= *(pwch - 2)) && (L'Z' >= *(pwch - 2)))));
  68. }
  69. // Processing ----------------------------------------------------------------
  70. //
  71. SCODE __fastcall
  72. ScStripAndCheckHttpPrefix (
  73. /* [in] */ const IEcb& ecb,
  74. /* [in/out] */ LPCWSTR * ppwszRequest);
  75. LPCWSTR __fastcall
  76. PwszUrlStrippedOfPrefix (
  77. /* [in] */ LPCWSTR pwszUrl);
  78. VOID __fastcall HttpUriEscape (
  79. /* [in] */ LPCSTR pszSrc,
  80. /* [out] */ auto_heap_ptr<CHAR>& pszDst);
  81. VOID __fastcall HttpUriUnescape (
  82. /* [in] */ const LPCSTR pszUrl,
  83. /* [out] */ LPSTR pszUnescaped);
  84. // Path conflicts ------------------------------------------------------------
  85. //
  86. BOOL __fastcall FPathConflict (
  87. /* [in] */ LPCWSTR pwszSrc,
  88. /* [in] */ LPCWSTR pwszDst);
  89. BOOL __fastcall FSizedPathConflict (
  90. /* [in] */ LPCWSTR pwszSrc,
  91. /* [in] */ UINT cchSrc,
  92. /* [in] */ LPCWSTR pwszDst,
  93. /* [in] */ UINT cchDst);
  94. BOOL __fastcall FIsImmediateParentUrl (
  95. /* [in] */ LPCWSTR pwszParent,
  96. /* [in] */ LPCWSTR pwszChild);
  97. SCODE __fastcall
  98. ScConstructRedirectUrl (
  99. /* [in] */ const IEcb& ecb,
  100. /* [in] */ BOOL fNeedSlash,
  101. /* [out] */ LPSTR * ppszUrl,
  102. /* [in] */ LPCWSTR pwszServer = NULL);
  103. #endif // _URL_H_