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.

173 lines
8.9 KiB

  1. /*****************************************************************************
  2. *
  3. * ftppidl.h - LPITEMIDLIST management routines
  4. *
  5. *****************************************************************************/
  6. #ifndef _FTPPIDL_H
  7. #define _FTPPIDL_H
  8. /****************************************************\
  9. FTP PIDL to URL functions
  10. \****************************************************/
  11. #ifdef UNICODE
  12. #define UrlCreateFromPidl UrlCreateFromPidlW
  13. #else // UNICODE
  14. #define UrlCreateFromPidl UrlCreateFromPidlA
  15. #endif // UNICODE
  16. // Create FTP Pidl
  17. HRESULT CreateFtpPidlFromFtpWirePath(LPCWIRESTR pwFtpWirePath, CWireEncoding * pwe, ULONG *pcchEaten, LPITEMIDLIST * ppidl, BOOL fIsTypeKnown, BOOL fIsDir);
  18. HRESULT CreateFtpPidlFromDisplayPath(LPCWSTR pwzFullPath, CWireEncoding * pwe, ULONG *pcchEaten, LPITEMIDLIST * ppidl, BOOL fIsTypeKnown, BOOL fIsDir);
  19. HRESULT CreateFtpPidlFromUrl(LPCTSTR pszName, CWireEncoding * pwe, ULONG *pcchEaten, LPITEMIDLIST * ppidl, IMalloc * pm, BOOL fHidePassword);
  20. HRESULT CreateFtpPidlFromUrlEx(LPCTSTR pszUrl, CWireEncoding * pwe, ULONG *pcchEaten, LPITEMIDLIST * ppidl, IMalloc * pm, BOOL fHidePassword, BOOL fIsTypeKnown, BOOL fIsDir);
  21. HRESULT CreateFtpPidlFromUrlPathAndPidl(LPCITEMIDLIST pidl, CWireEncoding * pwe, LPCWIRESTR pwFtpWirePath, LPITEMIDLIST * ppidl);
  22. // Get Data from FTP Pidl
  23. HRESULT UrlCreateFromPidlW(LPCITEMIDLIST pidl, DWORD shgno, LPWSTR pwzUrl, DWORD cchSize, DWORD dwFlags, BOOL fHidePassword);
  24. HRESULT UrlCreateFromPidlA(LPCITEMIDLIST pidl, DWORD shgno, LPSTR pszUrl, DWORD cchSize, DWORD dwFlags, BOOL fHidePassword);
  25. HRESULT GetDisplayPathFromPidl(LPCITEMIDLIST pidl, LPWSTR pwzDisplayPath, DWORD cchUrlPathSize, BOOL fDirsOnly);
  26. HRESULT GetWirePathFromPidl(LPCITEMIDLIST pidl, LPWIRESTR pwWirePath, DWORD cchUrlPathSize, BOOL fDirsOnly);
  27. // Functions to work on an entire FTP PIDLs
  28. BOOL FtpPidl_IsValid(LPCITEMIDLIST pidl);
  29. BOOL FtpPidl_IsValidFull(LPCITEMIDLIST pidl);
  30. BOOL FtpPidl_IsValidRelative(LPCITEMIDLIST pidl);
  31. DWORD FtpPidl_GetVersion(LPCITEMIDLIST pidl);
  32. BOOL FtpID_IsServerItemID(LPCITEMIDLIST pidl);
  33. LPCITEMIDLIST FtpID_GetLastIDReferense(LPCITEMIDLIST pidl);
  34. HRESULT FtpPidl_GetServer(LPCITEMIDLIST pidl, LPTSTR pszServer, DWORD cchSize);
  35. BOOL FtpPidl_IsDNSServerName(LPCITEMIDLIST pidl);
  36. HRESULT FtpPidl_GetUserName(LPCITEMIDLIST pidl, LPTSTR pszUserName, DWORD cchSize);
  37. HRESULT FtpPidl_GetPassword(LPCITEMIDLIST pidl, LPTSTR pszPassword, DWORD cchSize, BOOL fIncludingHidenPassword);
  38. HRESULT FtpPidl_GetDownloadTypeStr(LPCITEMIDLIST pidl, LPTSTR pszDownloadType, DWORD cchSize);
  39. DWORD FtpPidl_GetDownloadType(LPCITEMIDLIST pidl);
  40. INTERNET_PORT FtpPidl_GetPortNum(LPCITEMIDLIST pidl);
  41. BOOL FtpPidl_IsDirectory(LPCITEMIDLIST pidl, BOOL fAssumeDirForUnknown);
  42. ULONGLONG FtpPidl_GetFileSize(LPCITEMIDLIST pidl);
  43. HRESULT FtpPidl_SetFileSize(LPCITEMIDLIST pidl, DWORD dwSizeHigh, DWORD dwSizeLow);
  44. DWORD FtpPidl_GetAttributes(LPCITEMIDLIST pidl);
  45. BOOL FtpPidl_HasPath(LPCITEMIDLIST pidl);
  46. HRESULT FtpPidl_SetFileItemType(LPITEMIDLIST pidl, BOOL fIsDir);
  47. HRESULT FtpPidl_GetFileInfo(LPCITEMIDLIST pidl, SHFILEINFO *psfi, DWORD rgf);
  48. HRESULT FtpPidl_GetFileType(LPCITEMIDLIST pidl, LPTSTR pszType, DWORD cchSize);
  49. HRESULT FtpPidl_GetFileTypeStrRet(LPCITEMIDLIST pidl, LPSTRRET pstr);
  50. HRESULT FtpPidl_GetFragment(LPCITEMIDLIST pidl, LPTSTR pszFragment, DWORD cchSize);
  51. HRESULT FtpPidl_SetAttributes(LPCITEMIDLIST pidl, DWORD dwAttribs);
  52. HRESULT FtpPidl_GetWireName(LPCITEMIDLIST pidl, LPWIRESTR pwName, DWORD cchSize);
  53. HRESULT FtpPidl_GetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwzName, DWORD cchSize);
  54. LPCWIRESTR FtpPidl_GetFileWireName(LPCITEMIDLIST pidl);
  55. LPCWIRESTR FtpPidl_GetLastItemWireName(LPCITEMIDLIST pidl);
  56. HRESULT FtpPidl_GetLastItemDisplayName(LPCITEMIDLIST pidl, LPWSTR pwzName, DWORD cchSize);
  57. HRESULT FtpPidl_GetLastFileDisplayName(LPCITEMIDLIST pidl, LPWSTR pwzName, DWORD cchSize);
  58. BOOL FtpPidl_IsAnonymous(LPCITEMIDLIST pidl);
  59. HRESULT FtpPidl_ReplacePath(LPCITEMIDLIST pidlServer, LPCITEMIDLIST pidlFtpPath, LPITEMIDLIST * ppidlOut);
  60. #define FILEATTRIB_DIRSOFTLINK (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT)
  61. #define FtpPidl_IsDirSoftLink(pidl) (FILEATTRIB_DIRSOFTLINK == (FILEATTRIB_DIRSOFTLINK & FtpPidl_GetAttributes(pidl)))
  62. #define FtpPidl_IsSoftLink(pidl) (FILE_ATTRIBUTE_REPARSE_POINT & FtpPidl_GetAttributes(pidl))
  63. // WIN32_FIND_DATA normally stores the dates/times in a time zone independent (UTC)
  64. // way, but FTP doesn't. This requires conversions of dates when transfering
  65. // from one to another.
  66. FILETIME FtpPidl_GetFileTime(LPCITEMIDLIST pidl); // Return value is UTC
  67. FILETIME FtpPidl_GetFTPFileTime(LPCITEMIDLIST pidl); // Return value is in Local Time Zone.
  68. void FtpItemID_SetFileTime(LPCITEMIDLIST pidl, FILETIME fileTime); // fileTime is in UTC
  69. HRESULT Win32FindDataFromPidl(LPCITEMIDLIST pidl, LPWIN32_FIND_DATA pwfd, BOOL fFullPath, BOOL fInDisplayFormat);
  70. HRESULT FtpPidl_SetFileTime(LPCITEMIDLIST pidl, FILETIME ftTimeDate); // ftTimeDate In UTC
  71. HRESULT FtpPidl_InsertVirtualRoot(LPCITEMIDLIST pidlVirtualRoot, LPCITEMIDLIST pidlFtpPath, LPITEMIDLIST * ppidl);
  72. BOOL IsFtpPidlQuestionable(LPCITEMIDLIST pidl);
  73. #define FtpPidl_DirChoose(pidl, dir, file) (FtpPidl_IsDirectory(pidl, TRUE) ? dir : file)
  74. LPITEMIDLIST ILCloneFirstItemID(LPITEMIDLIST pidl);
  75. /****************************************************\
  76. FTP Individual ServerID/ItemID functions
  77. \****************************************************/
  78. // Ftp ServerID Helper Functions
  79. HRESULT FtpServerID_GetServer(LPCITEMIDLIST pidl, LPTSTR szServer, DWORD cchSize);
  80. BOOL FtpServerID_ServerStrCmp(LPCITEMIDLIST pidl, LPCTSTR pszServer);
  81. HRESULT FtpServerID_SetHiddenPassword(LPITEMIDLIST pidl, LPCTSTR pszPassword);
  82. DWORD FtpServerID_GetTypeID(LPCITEMIDLIST pidl);
  83. INTERNET_PORT FtpServerID_GetPortNum(LPCITEMIDLIST pidl);
  84. HRESULT FtpServerID_Create(LPCTSTR pszServer, LPCTSTR pszUserName, LPCTSTR pszPassword,
  85. DWORD dwFlags, INTERNET_PORT ipPortNum, LPITEMIDLIST * ppidl, IMalloc *pm, BOOL fHidePassword);
  86. // Ftp ItemID Creation Functions
  87. HRESULT FtpItemID_CreateFake(LPCWSTR pwzDisplayName, LPCWIRESTR pwWireName, BOOL fTypeKnown, BOOL fIsFile, BOOL fIsFragment, LPITEMIDLIST * ppidl);
  88. HRESULT FtpItemID_CreateReal(const LPFTP_FIND_DATA pwfd, LPCWSTR pwzDisplayName, LPITEMIDLIST * ppidl);
  89. // Ftp ItemID Helper Functions
  90. HRESULT FtpItemID_CreateWithNewName(LPCITEMIDLIST pidl, LPCWSTR pwzDisplayName, LPCWIRESTR pwWireName, LPITEMIDLIST * ppidlOut);
  91. HRESULT FtpItemID_GetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwzName, DWORD cchSize);
  92. HRESULT FtpItemID_GetWireName(LPCITEMIDLIST pidl, LPWIRESTR pszName, DWORD cchSize);
  93. HRESULT FtpItemID_GetFragment(LPCITEMIDLIST pidl, LPTSTR pszName, DWORD cchSize);
  94. HRESULT FtpItemID_GetNameA(LPCITEMIDLIST pidl, LPSTR pszName, DWORD cchSize);
  95. BOOL FtpItemID_IsFragment(LPCITEMIDLIST pidl);
  96. BOOL FtpItemID_IsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  97. BOOL FtpPidl_IsPathEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  98. BOOL FtpItemID_IsParent(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild);
  99. LPCITEMIDLIST FtpItemID_FindDifference(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild);
  100. DWORD FtpItemID_GetAttributes(LPCITEMIDLIST pidl);
  101. DWORD FtpItemID_SetDirAttribute(LPCITEMIDLIST pidl);
  102. HRESULT FtpItemID_SetAttributes(LPCITEMIDLIST pidl, DWORD dwFileAttributes);
  103. DWORD FtpItemID_GetUNIXPermissions(LPCITEMIDLIST pidl);
  104. HRESULT FtpItemID_SetUNIXPermissions(LPCITEMIDLIST pidl, DWORD dwFileAttributes);
  105. LPCWIRESTR FtpItemID_GetWireNameReference(LPCITEMIDLIST pidl);
  106. LPCUWSTR FtpItemID_GetDisplayNameReference(LPCITEMIDLIST pidl);
  107. ULONGLONG FtpItemID_GetFileSize(LPCITEMIDLIST pidl);
  108. void FtpItemID_SetFileSize(LPCITEMIDLIST pidl, ULARGE_INTEGER uliFileSize);
  109. DWORD FtpItemID_GetFileSizeLo(LPCITEMIDLIST pidl);
  110. DWORD FtpItemID_GetFileSizeHi(LPCITEMIDLIST pidl);
  111. DWORD FtpItemID_GetCompatFlags(LPCITEMIDLIST pidl);
  112. HRESULT FtpItemID_SetCompatFlags(LPCITEMIDLIST pidl, DWORD dwCompatFlags);
  113. BOOL FtpItemID_IsDirectory(LPCITEMIDLIST pidl, BOOL fAssumeDirForUnknown);
  114. // Flags for FtpItemID dwCompatFlags
  115. #define COMPAT_APPENDSLASHTOURL 0x00000001
  116. // Flags for dwCompFlags
  117. #define FCMP_NORMAL 0x00000000
  118. #define FCMP_GROUPDIRS 0x00000001
  119. #define FCMP_CASEINSENSE 0x00000002
  120. HRESULT FtpItemID_CompareIDs(LPARAM ici, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, DWORD dwCompFlags);
  121. int FtpItemID_CompareIDsInt(LPARAM ici, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, DWORD dwCompFlags);
  122. LPITEMIDLIST FtpCloneServerID(LPCITEMIDLIST pidl);
  123. HRESULT PurgeSessionKey(void);
  124. // NOT USED
  125. //HRESULT CreateFtpPidlFromFindData(LPCTSTR pszBaseUrl, const LPWIN32_FIND_DATA pwfd, LPITEMIDLIST * ppidl, IMalloc * pm);
  126. //HRESULT UrlGetFileNameFromPidl(LPCITEMIDLIST pidl, LPTSTR pszFileName, DWORD cchSize);
  127. //HRESULT FtpServerID_CopyHiddenPassword(LPCITEMIDLIST pidlSrc, LPITEMIDLIST pidlDest);
  128. #endif // _FTPPIDL_H