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.

913 lines
33 KiB

  1. #ifndef _PRIV_H_
  2. #define _PRIV_H_
  3. /*****************************************************************************
  4. *
  5. * Magic comments:
  6. *
  7. * _UNDOCUMENTED_: Something that is not documented in the SDK.
  8. *
  9. * _UNOBVIOUS_: Some unusual feature that isn't obvious from the
  10. * documentation. A candidate for a "Tips and Tricks" chapter.
  11. *
  12. * _HACKHACK_: Something that is gross but necessary.
  13. *
  14. * _CHARSET_: Character set issues.
  15. *
  16. * Magic ifdefs:
  17. *
  18. *****************************************************************************/
  19. /*****************************************************************************
  20. *
  21. * Global Includes
  22. *
  23. *****************************************************************************/
  24. #define WIN32_LEAN_AND_MEAN
  25. #define NOIME
  26. #define NOSERVICE
  27. // This stuff must run on Win95
  28. // Don't do this if RC_INVOKED because Fusion will #include <windows.h> before
  29. // we get a chance to override the value of _WIN32_WINDOWS, and our choice
  30. // of 0x0400 will generate a redefinition error... Fortunately, resource files
  31. // are reasonably insensitive to Windows versions.
  32. #ifndef RC_INVOKED
  33. #ifdef _WIN32_WINDOWS
  34. #undef _WIN32_WINDOWS
  35. #endif // _WIN32_WINDOWS
  36. #define _WIN32_WINDOWS 0x501
  37. #endif
  38. #ifdef WINVER
  39. #undef WINVER
  40. #endif // WINVER
  41. #define WINVER 0x501
  42. #ifdef _WIN32_WINNT
  43. #undef _WIN32_WINNT
  44. #endif // _WIN32_WINNT
  45. #define _WIN32_WINNT 0x501
  46. #define _OLEAUT32_ // get DECLSPEC_IMPORT stuff right, we are defing these
  47. #define _FSMENU_ // for DECLSPEC_IMPORT
  48. #define _WINMM_ // for DECLSPEC_IMPORT in mmsystem.h
  49. #define _SHDOCVW_ // for DECLSPEC_IMPORT in shlobj.h
  50. #define _WINX32_ // get DECLSPEC_IMPORT stuff right for WININET API
  51. #define _URLCACHEAPI_ // get DECLSPEC_IMPORT stuff right for wininet urlcache
  52. #define STRICT
  53. #include <windows.h>
  54. #ifdef RC_INVOKED /* Define some tags to speed up rc.exe */
  55. #define __RPCNDR_H__ /* Don't need RPC network data representation */
  56. #define __RPC_H__ /* Don't need RPC */
  57. #include <oleidl.h> /* Get the DROPEFFECT stuff */
  58. #define _OLE2_H_ /* But none of the rest */
  59. #define _WINDEF_
  60. #define _WINBASE_
  61. #define _WINGDI_
  62. #define NONLS
  63. #define _WINCON_
  64. #define _WINREG_
  65. #define _WINNETWK_
  66. #define _INC_COMMCTRL
  67. #define _INC_SHELLAPI
  68. #define _SHSEMIP_H_ /* _UNDOCUMENTED_: Internal header */
  69. #else // RC_INVOKED
  70. #include <windowsx.h>
  71. #endif // RC_INVOKED
  72. #ifdef __cplusplus
  73. extern "C" { /* Assume C declarations for C++. */
  74. #endif /* __cplusplus */
  75. #ifdef __cplusplus
  76. } /* End of extern "C" {. */
  77. #endif /* __cplusplus */
  78. #include "resource.h"
  79. #define _FIX_ENABLEMODELESS_CONFLICT // for shlobj.h
  80. //WinInet need to be included BEFORE ShlObjp.h
  81. #include <wininet.h>
  82. #include <winineti.h>
  83. #include <urlmon.h>
  84. #include <shlobj.h>
  85. #include <shlobjp.h> // For IProgressDialog
  86. #include <exdisp.h>
  87. #include <objidl.h>
  88. #include <shlwapi.h>
  89. #include <shlwapip.h>
  90. #include <shellapi.h>
  91. #include <shlapip.h>
  92. #include <shsemip.h>
  93. #include <ole2ver.h>
  94. #include <olectl.h>
  95. #include <shellp.h>
  96. #include <commctrl.h>
  97. #include <comctrlp.h>
  98. #include <shdocvw.h>
  99. #include <shlguid.h>
  100. #include <ieguidp.h>
  101. #include <isguids.h>
  102. #include <mimeinfo.h>
  103. #include <hlguids.h>
  104. #include <mshtmdid.h>
  105. #include <dispex.h> // IDispatchEx
  106. #include <perhist.h>
  107. #include <help.h>
  108. #include <multimon.h>
  109. #define DISALLOW_Assert // Force to use ASSERT instead of Assert
  110. #define DISALLOW_DebugMsg // Force to use TraceMsg instead of DebugMsg
  111. #include <debug.h>
  112. #include <urlhist.h>
  113. #include <regstr.h> // for REGSTR_PATH_EXPLORE
  114. #define USE_SYSTEM_URL_MONIKER
  115. #include <urlmon.h>
  116. //#include <winineti.h> // Cache APIs & structures
  117. #include <inetreg.h>
  118. #define _INTSHCUT_ // get DECLSPEC_IMPORT stuff right for INTSHCUT.h
  119. #include <intshcut.h>
  120. #include <propset.h>
  121. #define HLINK_NO_GUIDS
  122. #include <hlink.h>
  123. #include <hliface.h>
  124. #include <docobj.h>
  125. #include <ccstock.h>
  126. #include <port32.h>
  127. #include <prsht.h>
  128. #include <inetcpl.h>
  129. #include <uastrfnc.h>
  130. #include <align.h>
  131. #include <commctrl.h>
  132. #include "unithunk.h"
  133. // Trace flags
  134. #define TF_FTPREF 0x00000100 // Dll Reference
  135. #define TF_FTPPERF 0x00000200 // Perf
  136. #define TF_FTPALLOCS 0x00000400 // Object Allocs
  137. #define TF_FTPDRAGDROP 0x00000800 // Drag and Drop
  138. #define TF_FTPLIST 0x00001000 // HDPA Wrapper
  139. #define TF_FTPISF 0x00002000 // IShellFolder
  140. #define TF_FTPQI 0x00004000 // QueryInterface
  141. #define TF_FTPSTATUSBAR 0x00008000 // Status Bar Spew
  142. #define TF_FTPOPERATION 0x00010000 // Ftp Operation (Put File, Get File, CreateDir, DeleteDir, ...)
  143. #define TF_FTPURL_UTILS 0x00020000 // Ftp Url Operations (Pidl->Url, Url->Pidl, ...)
  144. #define TF_FTP_DLLLOADING 0x00040000 // Loading Other DLLs
  145. #define TF_FTP_OTHER 0x00080000 // Misc.
  146. #define TF_FTP_IDENUM 0x00100000 // IDList Enum (IIDEnum).
  147. #define TF_CHANGENOTIFY 0x00200000 // Change Notify
  148. #define TF_PIDLLIST_DUMP 0x00400000 // Dump the contents in the Pidl List
  149. #define TF_WININET_DEBUG 0x00800000 // Dump wininet calls
  150. #define TF_BKGD_THREAD 0x01000000 // Background thread that caches wininet handles.
  151. #define TF_FOLDER_SHRTCUTS 0x02000000 // Info about Folder Shortcuts.
  152. /*****************************************************************************
  153. *
  154. * Global Helper Macros/Typedefs
  155. *
  156. *****************************************************************************/
  157. //////////////////////////// IE 5 vs IE 4 /////////////////////////////////
  158. // These are functions that IE5 exposes (normally in shlwapi), but
  159. // if we want to be compatible with IE4, we need to have our own copy.
  160. // If we turn on USE_IE5_UTILS, we won't work with IE4's DLLs (like shlwapi).
  161. //
  162. // #define USE_IE5_UTILS
  163. //////////////////////////// IE 5 vs IE 4 /////////////////////////////////
  164. #ifdef OLD_HLIFACE
  165. #define HLNF_OPENINNEWWINDOW HLBF_OPENINNEWWINDOW
  166. #endif // OLD_HLIFACE
  167. #define ISVISIBLE(hwnd) ((GetWindowStyle(hwnd) & WS_VISIBLE) == WS_VISIBLE)
  168. // shorthand
  169. #ifndef ATOMICRELEASE
  170. #define ATOMICRELEASET(p,type) { type* punkT=p; p=NULL; punkT->Release(); }
  171. // doing this as a function instead of inline seems to be a size win.
  172. //
  173. #ifdef NOATOMICRELESEFUNC
  174. #define ATOMICRELEASE(p) ATOMICRELEASET(p, IUnknown)
  175. #else // NOATOMICRELESEFUNC
  176. //////////////////////////// IE 5 vs IE 4 /////////////////////////////////
  177. #ifndef USE_IE5_UTILS
  178. #define ATOMICRELEASE(p) FtpCopy_IUnknown_AtomicRelease((LPVOID*)&p)
  179. void FtpCopy_IUnknown_AtomicRelease(LPVOID* ppunk);
  180. #endif // USE_IE5_UTILS
  181. //////////////////////////// IE 5 vs IE 4 /////////////////////////////////
  182. #endif // NOATOMICRELESEFUNC
  183. #endif // ATOMICRELEASE
  184. #ifdef SAFERELEASE
  185. #undef SAFERELEASE
  186. #endif // SAFERELEASE
  187. #define SAFERELEASE(p) ATOMICRELEASE(p)
  188. #define IsInRange InRange
  189. // Include the automation definitions...
  190. #include <exdisp.h>
  191. #include <exdispid.h>
  192. #include <ocmm.h>
  193. #include <mshtmhst.h>
  194. #include <simpdata.h>
  195. #include <htiface.h>
  196. #include <objsafe.h>
  197. //
  198. // Neutral ANSI/UNICODE types and macros... 'cus Chicago seems to lack them
  199. //
  200. #ifdef UNICODE
  201. typedef WCHAR TUCHAR, *PTUCHAR;
  202. #else /* UNICODE */
  203. typedef unsigned char TUCHAR, *PTUCHAR;
  204. #endif /* UNICODE */
  205. typedef unsigned __int64 QWORD, * LPQWORD;
  206. STDAPI_(void) DllAddRef(void);
  207. STDAPI_(void) DllRelease(void);
  208. #define CALLWNDPROC WNDPROC
  209. extern HINSTANCE g_hinst;
  210. #define HINST_THISDLL g_hinst
  211. #include "idispids.h"
  212. // Count of characters to count of bytes
  213. //
  214. #define CbFromCchW(cch) ((cch)*sizeof(WCHAR))
  215. #define CbFromCchA(cch) ((cch)*sizeof(CHAR))
  216. #ifdef UNICODE
  217. #define CbFromCch CbFromCchW
  218. #else // UNICODE
  219. #define CbFromCch CbFromCchA
  220. #endif // UNICODE
  221. // General flag macros
  222. //
  223. #define SetFlag(obj, f) do {obj |= (f);} while (0)
  224. #define ToggleFlag(obj, f) do {obj ^= (f);} while (0)
  225. #define ClearFlag(obj, f) do {obj &= ~(f);} while (0)
  226. #define IsFlagSet(obj, f) (BOOL)(((obj) & (f)) == (f))
  227. #define IsFlagClear(obj, f) (BOOL)(((obj) & (f)) != (f))
  228. /*****************************************************************************
  229. *
  230. * Baggage - Stuff I carry everywhere
  231. *
  232. *****************************************************************************/
  233. #define BEGIN_CONST_DATA data_seg(".text", "CODE")
  234. #define END_CONST_DATA data_seg(".data", "DATA")
  235. // Convert an array name (A) to a generic count (c).
  236. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  237. #define pvByteIndexCb(pv, cb) ((LPVOID)((PBYTE)pv + (cb)))
  238. #ifdef DEBUG
  239. #define DEBUG_CODE(x) x
  240. #else // DEBUG
  241. #define DEBUG_CODE(x)
  242. #endif // DEBUG
  243. #undef lstrcatnW
  244. #undef lstrcpy
  245. #define lstrcpy BUG_BUG_BAD_lstrcpy
  246. #undef lstrcpyW
  247. #define lstrcpyW BUG_BUG_BAD_lstrcpyW
  248. #undef lstrcpyA
  249. #define lstrcpyA BUG_BUG_BAD_lstrcpyA
  250. #undef lstrcpynW
  251. #define lstrcpynW BUG_BUG_BAD_lstrcpynW
  252. #undef lstrcmpW
  253. #define lstrcmpW BUG_BUG_BAD_lstrcmpW
  254. #undef lstrcmpiW
  255. #define lstrcmpiW BUG_BUG_BAD_lstrcmpiW
  256. #undef lstrcatW
  257. #define lstrcatW BUG_BUG_BAD_lstrcatW
  258. #undef lstrcatnW
  259. #define lstrcatnW BUG_BUG_BAD_lstrcatnW
  260. #undef StrCat
  261. #define StrCat BUG_BUG_BAD_StrCat
  262. #undef StrCatW
  263. #define StrCatW BUG_BUG_BAD_StrCatW
  264. #undef StrCatA
  265. #define StrCatA BUG_BUG_BAD_StrCatA
  266. // Fix shell32 bugs:
  267. #define ILCombine ILCombineWrapper
  268. #define ILClone ILCloneWrapper
  269. #define ILFree ILFreeWrapper
  270. LPITEMIDLIST ILCombineWrapper(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  271. LPITEMIDLIST ILCloneWrapper(LPCITEMIDLIST pidl);
  272. void ILFreeWrapper(LPITEMIDLIST pidl);
  273. /*****************************************************************************
  274. *
  275. * Wrappers and other quickies
  276. *
  277. *****************************************************************************/
  278. #define HRESULT_FROM_SUCCESS_VALUE(us) MAKE_HRESULT(SEVERITY_SUCCESS, 0, (USHORT)(us))
  279. #define ILIsSimple(pidl) (ILIsEmpty(_ILNext(pidl)))
  280. typedef DWORD DROPEFFECT;
  281. #define ProtocolIdlInnerData(pidl) ((LPVOID)&(((PDELEGATEITEMID)(pidl))->rgb[0]))
  282. #define ProtocolIdlInnerDataSize (sizeof(DELEGATEITEMID) - (sizeof(BYTE)*2))
  283. /*****************************************************************************
  284. *
  285. * Const globals: Never change.
  286. *
  287. *****************************************************************************/
  288. #pragma BEGIN_CONST_DATA
  289. extern char c_szSlash[]; /* "/" */
  290. extern WORD c_wZero; /* A word of zeros */
  291. #pragma END_CONST_DATA
  292. #define c_pidlNil ((LPCITEMIDLIST)&c_wZero) /* null pidl */
  293. #define c_tszNil ((LPCTSTR)&c_wZero) /* null string */
  294. #define c_szNil ((LPCSTR)&c_wZero) /* null string */
  295. /*****************************************************************************
  296. *
  297. * Static globals: Initialized at PROCESS_ATTACH and never modified.
  298. *
  299. * WARNING! <shelldll\idlcomm.h> #define's various g_cf's, so we need
  300. * to #undef them before we start partying on them again.
  301. *
  302. *****************************************************************************/
  303. #undef g_cfFileDescriptor
  304. #undef g_cfFileContents
  305. #undef g_cfShellIDList
  306. #undef g_cfFileNameMap
  307. #undef g_cfPreferredDe
  308. extern HINSTANCE g_hinst; // My instance handle
  309. extern CHAR g_szShell32[MAX_PATH]; // Full path to shell32.dll (must be ANSI)
  310. // Detect "." or ".." as invalid files
  311. #define IS_VALID_FILE(str) (!(('.' == str[0]) && (('\0' == str[1]) || (('.' == str[1]) && ('\0' == str[2])))))
  312. extern FORMATETC g_formatEtcOffsets;
  313. extern FORMATETC g_formatPasteSucceeded;
  314. extern FORMATETC g_dropTypes[];
  315. extern CLIPFORMAT g_cfTargetCLSID;
  316. // TODO:
  317. // Create a DROP_FTP clipboard format that will
  318. // give a source URL, a destination URL, and
  319. // a list of files that need to be moved or copied
  320. // from relative to the source URL to relative to
  321. // the destination URL.
  322. enum DROPTYPES
  323. {
  324. // File contents is inherently weird
  325. DROP_FCont = 0, // File contents
  326. // Clipboard formats we offer from our DataObject
  327. DROP_FGDW, // File Group DescriptorW 1
  328. DROP_FGDA, // File Group DescriptorA 2
  329. DROP_IDList, // ID List Array 3
  330. DROP_URL, // Uniform Resource Locator 4
  331. // DROP_Offsets, // Shell Object Offsets
  332. DROP_PrefDe, // Preferred Drop Effect 5
  333. DROP_PerfDe, // Performed Drop Effect 6
  334. DROP_FTP_PRIVATE, // Ftp Private Data - Flag to indicate Ftp was the drag source 7
  335. DROP_OLEPERSIST, // Used by ole to realize that they should persist via IPersistStream across OleFlushClipboard calls.
  336. // Clipboard formats we query but do not offer
  337. DROP_Hdrop, // File Drop
  338. DROP_FNMA, // File Name Map (Ansi)
  339. DROP_FNMW // File Name Map (Unicode)
  340. };
  341. #define DROP_OFFERMIN DROP_FGDW
  342. #define DROP_OFFERMAX DROP_Hdrop
  343. #define DROP_MAX (DROP_FNMW+1)
  344. /*****************************************************************************
  345. *
  346. * Global state management.
  347. *
  348. * DLL reference count, DLL critical section.
  349. *
  350. *****************************************************************************/
  351. void DllAddRef(void);
  352. void DllRelease(void);
  353. #ifdef UNICODE
  354. #define EMPTYSTR_FOR_NULL EMPTYSTR_FOR_NULLW
  355. #else // UNICODE
  356. #define EMPTYSTR_FOR_NULL EMPTYSTR_FOR_NULLA
  357. #endif // UNICODE
  358. #define NULL_FOR_EMPTYSTR(str) (((str) && (str)[0]) ? str : NULL)
  359. #define EMPTYSTR_FOR_NULLA(str) ((str) ? (str) : "")
  360. #define EMPTYSTR_FOR_NULLW(str) ((str) ? (str) : L"")
  361. typedef void (*LISTPROC)(UINT flm, LPVOID pv);
  362. /*****************************************************************************
  363. * Local Includes
  364. *****************************************************************************/
  365. class CFtpFolder;
  366. class CFtpSite;
  367. class CFtpList;
  368. class CFtpDir;
  369. class CFtpPidlList;
  370. class CFtpMenu;
  371. class CFtpDrop;
  372. class CFtpEidl;
  373. class CFtpObj;
  374. class CFtpProp;
  375. class CFtpView;
  376. class CFtpIcon;
  377. class CStatusBar;
  378. #define FTP_SHCNE_EVENTS (SHCNE_DISKEVENTS | SHCNE_ASSOCCHANGED | SHCNE_RMDIR | SHCNE_DELETE | SHCNE_MKDIR | SHCNE_CREATE | SHCNE_RENAMEFOLDER | SHCNE_RENAMEITEM | SHCNE_ATTRIBUTES)
  379. typedef struct HINTPROCINFO {
  380. CFtpDir * pfd; /* CFtpDir in which it's happening */
  381. HWND hwnd; /* The window to use for UI */
  382. CStatusBar * psb; /* The status bar object. */
  383. } HPI, *PHPI;
  384. typedef HRESULT (*HINTPROC)(HINTERNET hint, PHPI phpi, LPVOID pv, BOOL * pfReleaseHint);
  385. void GetCfBufA(UINT cf, PSTR psz, int cch);
  386. // This is defined in WININET.CPP
  387. typedef LPVOID HINTERNET;
  388. typedef HGLOBAL HIDA;
  389. typedef void (*DELAYEDACTIONPROC)(LPVOID);
  390. typedef struct GLOBALTIMEOUTINFO GLOBALTIMEOUTINFO, * LPGLOBALTIMEOUTINFO;
  391. struct GLOBALTIMEOUTINFO
  392. {
  393. LPGLOBALTIMEOUTINFO hgtiNext;
  394. LPGLOBALTIMEOUTINFO hgtiPrev;
  395. LPGLOBALTIMEOUTINFO * phgtiOwner;
  396. DWORD dwTrigger;
  397. DELAYEDACTIONPROC pfn; // Callback procedure
  398. LPVOID pvRef; // Reference data for timer
  399. };
  400. #define INTERNET_MAX_PATH_LENGTH 2048
  401. #define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
  402. #define MAX_URL_STRING (INTERNET_MAX_SCHEME_LENGTH \
  403. + sizeof("://") \
  404. + INTERNET_MAX_PATH_LENGTH)
  405. #define LEAK_CFtpFolder 0
  406. #define LEAK_CFtpDir 1
  407. #define LEAK_CFtpSite 2
  408. #define LEAK_CFtpObj 3
  409. #define LEAK_CFtpEidl 4
  410. #define LEAK_CFtpDrop 5
  411. #define LEAK_CFtpList 6
  412. #define LEAK_CFtpStm 7
  413. #define LEAK_CAccount 8
  414. #define LEAK_CFtpFactory 9
  415. #define LEAK_CFtpContextMenu 10
  416. #define LEAK_CFtpEfe 11
  417. #define LEAK_CFtpGlob 12
  418. #define LEAK_CFtpIcon 13
  419. #define LEAK_CMallocItem 14
  420. #define LEAK_CFtpPidlList 15
  421. #define LEAK_CFtpProp 16
  422. #define LEAK_CStatusBar 17
  423. #define LEAK_CFtpView 18
  424. #define LEAK_CFtpWebView 19
  425. #define LEAK_CCookieList 20
  426. #define LEAK_CDropOperation 21
  427. #ifdef DEBUG
  428. typedef struct tagLEAKSTRUCT
  429. {
  430. DWORD dwRef;
  431. CHAR szObject[MAX_PATH];
  432. } LEAKSTRUCT;
  433. extern LEAKSTRUCT g_LeakList[];
  434. #define LEAK_ADDREF(dwIndex) DEBUG_CODE(g_LeakList[dwIndex].dwRef++)
  435. #define LEAK_DELREF(dwIndex) DEBUG_CODE(g_LeakList[dwIndex].dwRef--)
  436. #else // DEBUG
  437. #define LEAK_ADDREF(dwIndex) NULL
  438. #define LEAK_DELREF(dwIndex) NULL
  439. #endif // DEBUG
  440. /*****************************************************************************
  441. *
  442. * ftpdhlp.c - DialogBox helpers
  443. *
  444. *****************************************************************************/
  445. // Only update after 50k bytes were copied.
  446. #define SIZE_PROGRESS_AFTERBYTES 50000
  447. typedef struct tagPROGRESSINFO
  448. {
  449. IProgressDialog * ppd;
  450. ULARGE_INTEGER uliBytesCompleted;
  451. ULARGE_INTEGER uliBytesTotal;
  452. DWORD dwCompletedInCurFile;
  453. DWORD dwLastDisplayed; // We only display in chuncks of 50k, so what was the last chunk we displayed. Chunck #3 means between 100k and 150k.
  454. HINTERNET hint; // Used to cancel operation.
  455. } PROGRESSINFO, * LPPROGRESSINFO;
  456. typedef const BYTE *LPCBYTE;
  457. typedef union FDI {
  458. struct {
  459. WORD id;
  460. WORD fdio;
  461. };
  462. DWORD dw;
  463. } FDI, *PFDI;
  464. typedef const FDI *PCFDI;
  465. #define FDIO_ICON 0
  466. #define FDIO_NAME 1
  467. #define FDIO_TYPE 2
  468. #define FDIO_LOCATION 3
  469. #define FDIO_SIZE 4
  470. #define FDIO_DATE 5
  471. #define FDIO_COUNT 7
  472. #define FDIO_CANMULTI 8
  473. #define FDII_HFPL 0
  474. #define FDII_WFDA 3
  475. void FtpDlg_InitDlg(HWND hdlg, UINT id, CFtpFolder * pff, LPCVOID pv, UINT fdii);
  476. #define FDI_FILEICON { IDC_FILEICON, FDIO_ICON, }
  477. #define FDI_FILENAME { IDC_FILENAME, FDIO_NAME, }
  478. #define FDI_FILETYPE { IDC_FILETYPE, FDIO_TYPE, }
  479. #define FDI_LOCATION { IDC_LOCATION, FDIO_LOCATION, }
  480. #define FDI_FILESIZE { IDC_FILESIZE, FDIO_SIZE, }
  481. #define FDI_FILETIME { IDC_FILETIME, FDIO_DATE, }
  482. #define imiTop 0
  483. #define imiBottom ((UINT)-1)
  484. typedef void (*GLOBALTIMEOUTPROC)(LPVOID);
  485. /*****************************************************************************\
  486. UNIX Chmod Bits
  487. \*****************************************************************************/
  488. #define UNIX_CHMOD_READ_OWNER 0x00000400
  489. #define UNIX_CHMOD_WRITE_OWNER 0x00000200
  490. #define UNIX_CHMOD_EXEC_OWNER 0x00000100
  491. #define UNIX_CHMOD_READ_GROUP 0x00000040
  492. #define UNIX_CHMOD_WRITE_GROUP 0x00000020
  493. #define UNIX_CHMOD_EXEC_GROUP 0x00000010
  494. #define UNIX_CHMOD_READ_ALL 0x00000004
  495. #define UNIX_CHMOD_WRITE_ALL 0x00000002
  496. #define UNIX_CHMOD_EXEC_ALL 0x00000001
  497. /*****************************************************************************\
  498. STRINGS
  499. \*****************************************************************************/
  500. #define SZ_FTPURLA "ftp://"
  501. #define SZ_EMPTYA ""
  502. #define SZ_MESSAGE_FILEA "MESSAGE.TXT"
  503. #define SZ_ALL_FILESA "*.*"
  504. #define SZ_URL_SLASHA "/"
  505. #define SZ_FTP_URL_TYPEA ";type=" // This is the section of the url that contains the download type.
  506. #define SZ_ESCAPED_SPACEA "%20"
  507. #define SZ_ESCAPED_SLASHA "%5c"
  508. #define SZ_DOTA "."
  509. #define SZ_ASTRICSA "*"
  510. #define SZ_DOS_SLASHA "\\"
  511. #define SZ_SPACEA " "
  512. #define SZ_HASH_ENCODEDA "%23"
  513. #define SZ_FTPURLW L"ftp://"
  514. #define SZ_EMPTYW L""
  515. #define SZ_MESSAGE_FILEW L"MESSAGE.TXT"
  516. #define SZ_ALL_FILESW L"*.*"
  517. #define SZ_URL_SLASHW L"/"
  518. #define SZ_FTP_URL_TYPEW L";type=" // This is the section of the url that contains the download type.
  519. #define SZ_ESCAPED_SPACEW L"%20"
  520. #define SZ_ESCAPED_SLASHW L"%5c"
  521. #define SZ_DOTW L"."
  522. #define SZ_ASTRICSW L"*"
  523. #define SZ_DOS_SLASHW L"\\"
  524. #define SZ_SPACEW L" "
  525. #define SZ_HASH_ENCODEDW L"%23"
  526. #define SZ_FTPURL TEXT(SZ_FTPURLA)
  527. #define SZ_EMPTY TEXT(SZ_EMPTYA)
  528. #define SZ_MESSAGE_FILE TEXT(SZ_MESSAGE_FILEA)
  529. #define SZ_ALL_FILES TEXT(SZ_ALL_FILESA)
  530. #define SZ_URL_SLASH TEXT(SZ_URL_SLASHA)
  531. #define SZ_FTP_URL_TYPE TEXT(SZ_FTP_URL_TYPEA) // This is the section of the url that contains the download type.
  532. #define SZ_ESCAPED_SPACE TEXT(SZ_ESCAPED_SPACEA)
  533. #define SZ_ESCAPED_SLASH TEXT(SZ_ESCAPED_SLASHA)
  534. #define SZ_DOT TEXT(SZ_DOTA)
  535. #define SZ_ASTRICS TEXT(SZ_ASTRICSA)
  536. #define SZ_DOS_SLASH TEXT(SZ_DOS_SLASHA)
  537. #define SZ_SPACE TEXT(SZ_SPACEA)
  538. #define SZ_HASH_ENCODED TEXT(SZ_HASH_ENCODEDA)
  539. #define SZ_ANONYMOUS TEXT("anonymous")
  540. #define CH_URL_SLASHA '\\'
  541. #define CH_URL_URL_SLASHA '/'
  542. #define CH_URL_LOGON_SEPARATORA '@'
  543. #define CH_URL_PASSWORD_SEPARATORA ':'
  544. #define CH_URL_TEMP_LOGON_SEPARATORA '-'
  545. #define CH_HASH_DECODEDA '#'
  546. #define CH_URL_SLASHW L'\\'
  547. #define CH_URL_URL_SLASHW L'/'
  548. #define CH_URL_LOGON_SEPARATORW L'@'
  549. #define CH_URL_PASSWORD_SEPARATORW L':'
  550. #define CH_URL_TEMP_LOGON_SEPARATORW L'-'
  551. #define CH_HASH_DECODEDW L'#'
  552. #define CH_URL_SLASH TEXT(CH_URL_SLASHA)
  553. #define CH_URL_URL_SLASH TEXT(CH_URL_URL_SLASHA)
  554. #define CH_URL_LOGON_SEPARATOR TEXT(CH_URL_LOGON_SEPARATORA)
  555. #define CH_URL_PASSWORD_SEPARATOR TEXT(CH_URL_PASSWORD_SEPARATORA)
  556. #define CH_URL_TEMP_LOGON_SEPARATOR TEXT(CH_URL_TEMP_LOGON_SEPARATORA)
  557. #define CH_HASH_DECODED TEXT(CH_HASH_DECODEDA)
  558. // FTP Commands
  559. #define FTP_CMD_SYSTEM "syst"
  560. #define FTP_CMD_SITE "site"
  561. #define FTP_CMD_SITE_HELP "site help"
  562. #define FTP_CMD_SITE_CHMOD_TEMPL "site chmod %lx %s"
  563. #define FTP_CMD_FEAT "feat"
  564. #define FTP_CMD_UTF8 "opts utf8 on"
  565. #define FTP_CMD_NO_OP "noop"
  566. // UNIX Commands (Used via SITE FTP command)
  567. #define FTP_UNIXCMD_CHMODA "chmod"
  568. #define FTP_SYST_VMS "VMS "
  569. /*****************************************************************************\
  570. REG Keys and Values
  571. \*****************************************************************************/
  572. // FTP Registry Keys
  573. #define SZ_REGKEY_FTPCLASS TEXT("ftp")
  574. #define SZ_REGKEY_MICROSOFTSOFTWARE TEXT("Software\\Microsoft")
  575. #define SZ_REGKEY_FTPFOLDER TEXT("Software\\Microsoft\\Ftp")
  576. #define SZ_REGKEY_FTPFOLDER_ACCOUNTS TEXT("Software\\Microsoft\\Ftp\\Accounts\\")
  577. #define SZ_REGKEY_FTPFOLDER_COMPAT TEXT("Software\\Microsoft\\Ftp\\Compatible")
  578. #define SZ_REGKEY_INTERNET_SETTINGS TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")
  579. #define SZ_REGKEY_INTERNET_SETTINGS_LAN TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\LAN")
  580. #define SZ_REGKEY_INTERNET_EXPLORER TEXT("Software\\Microsoft\\Internet Explorer")
  581. // FTP Registry Values
  582. #define SZ_REGVALUE_PASSWDSIN_ADDRBAR TEXT("PasswordsInAddressBar")
  583. #define SZ_REGVALUE_DOWNLOAD_DIR TEXT("Download Directory")
  584. #define SZ_REGVALUE_DOWNLOAD_TYPE TEXT("Download Type")
  585. #define SZ_REGVALUE_WARN_ABOUT_PROXY TEXT("Warn About Proxy")
  586. #define SZ_REGVALUE_DEFAULT_FTP_CLIENT TEXT("ShellFolder")
  587. #define SZ_REGVALUE_PREVIOUS_FTP_CLIENT TEXT("Previous FTP Client")
  588. #define SZ_REGVALUE_PROXY_SERVER TEXT("ProxyServer")
  589. #define SZ_REGVALUE_URL_ENCODING TEXT("UrlEncoding")
  590. #define SZ_REGVALUE_DISABLE_PASSWORD_CACHE TEXT("DisablePasswordCaching")
  591. // FTP Registry Data
  592. #define SZ_REGDATA_IE_FTP_CLIENT TEXT("{63da6ec0-2e98-11cf-8d82-444553540000}")
  593. // Accounts
  594. #define SZ_REGVALUE_DEFAULT_USER TEXT("Default User")
  595. #define SZ_REGVALUE_ACCOUNTNAME TEXT("Name")
  596. #define SZ_REGVALUE_PASSWORD TEXT("Password")
  597. #define SZ_ACCOUNT_PROP TEXT("CAccount_This")
  598. #define SZ_REGKEY_LOGIN_ATTRIBS TEXT("Login Attributes")
  599. #define SZ_REGKEY_EMAIL_NAME TEXT("EmailName")
  600. #define SZ_REGKEY_USE_OLD_UI TEXT("Use Web Based FTP")
  601. #define SZ_REGVALUE_FTP_PASV TEXT("Use PASV")
  602. /*****************************************************************************\
  603. FEATURES
  604. \*****************************************************************************/
  605. // Features
  606. //#define FEATURE_DIALER
  607. //#define FEATURE_OFFLINE
  608. // Feature Tests
  609. #define FEATURE_TEST_OFFLINE
  610. #define FEATURE_TEST_DIALER
  611. #define FEATURE_SAVE_PASSWORD
  612. #define FEATURE_CHANGE_PERMISSIONS // UNIX CHMOD command
  613. // #define FEATURE_FTP_TO_FTP_COPY
  614. #define FEATURE_CUT_MOVE
  615. // #define ADD_ABOUTBOX
  616. /*****************************************************************************\
  617. UNIQUE IDENTIFIERS
  618. \*****************************************************************************/
  619. // CLSIDs/IIDs Private to msieftp.dll
  620. // WARNING: Never move these CLSID/IID definitions outside of the DLL.
  621. //
  622. // {299D0193-6DAA-11d2-B679-006097DF5BD4}
  623. extern const GUID CLSID_FtpDataObject;
  624. // {A11501B3-6EA4-11d2-B679-006097DF5BD4}
  625. extern const GUID IID_CFtpFolder;
  626. /*****************************************************************************\
  627. Local Includes
  628. \*****************************************************************************/
  629. class CFtpFolder;
  630. class CFtpSite;
  631. class CFtpStm;
  632. #include "codepage.h"
  633. #include "encoding.h"
  634. #include "dllload.h"
  635. #include "ftpdir.h"
  636. #include "ftplist.h"
  637. #include "ftppidl.h"
  638. #include "ftpinet.h"
  639. #include "ftppl.h"
  640. #include "util.h"
  641. #include "ftpapi.h"
  642. /*****************************************************************************
  643. * Object Constructors
  644. *****************************************************************************/
  645. HRESULT CFtpFactory_Create(REFCLSID rclsid, REFIID riid, LPVOID * ppvObj);
  646. HRESULT CFtpMenu_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, HWND hwnd, REFIID riid, LPVOID * ppvObj, BOOL fFromCreateViewObject);
  647. HRESULT CFtpMenu_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, HWND hwnd, BOOL fFromCreateViewObject, CFtpMenu ** ppfm);
  648. HRESULT CFtpDrop_Create(CFtpFolder * pff, HWND hwnd, CFtpDrop ** ppfm);
  649. HRESULT CFtpEfe_Create(DWORD dwSize, FORMATETC rgfe[], STGMEDIUM rgstg[], CFtpObj * pfo, IEnumFORMATETC ** ppenum);
  650. HRESULT CFtpEidl_Create(CFtpDir * pfd, CFtpFolder * pff, HWND hwndOwner, DWORD shcontf, IEnumIDList ** ppenum);
  651. HRESULT CFtpFolder_Create(REFIID riid, LPVOID * ppvObj);
  652. HRESULT CFtpInstaller_Create(REFIID riid, LPVOID * ppvObj);
  653. IUnknown * CFtpGlob_Create(HGLOBAL hglob);
  654. CFtpGlob * CFtpGlob_CreateStr(LPCTSTR pszStr);
  655. HRESULT CFtpIcon_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, REFIID riid, LPVOID * ppv);
  656. HRESULT CFtpIcon_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, CFtpIcon ** ppfm);
  657. HRESULT CFtpList_Create(int cpvInit, PFNDPAENUMCALLBACK pfn, UINT nGrow, CFtpList ** ppfl);
  658. HRESULT CFtpObj_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, REFIID riid, LPVOID * ppvObj);
  659. HRESULT CFtpObj_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, CFtpObj ** ppfo);
  660. HRESULT CFtpObj_Create(REFIID riid, void ** ppvObj);
  661. HRESULT CFtpProp_Create(CFtpPidlList * pflHfpl, CFtpFolder * pff, HWND hwnd, CFtpProp ** ppfp);
  662. HRESULT CFtpStm_Create(CFtpDir * pfd, LPCITEMIDLIST pidl, DWORD dwAccess, CFtpStm ** ppstream, ULARGE_INTEGER uliComplete, ULARGE_INTEGER uliTotal, IProgressDialog * ppd, BOOL fClosePrgDlg);
  663. HRESULT CFtpView_Create(CFtpFolder * pff, HWND hwndOwner, CFtpView ** ppfv);
  664. HRESULT CFtpSite_Create(LPCSTR pszSite, CFtpSite ** ppfs);
  665. HRESULT CFtpPidlList_Create(int cpidl, LPCITEMIDLIST rgpidl[], CFtpPidlList ** ppfl);
  666. void TriggerDelayedAction(LPGLOBALTIMEOUTINFO * phgti);
  667. STDMETHODIMP SetDelayedAction(DELAYEDACTIONPROC pfn, LPVOID pvRef, LPGLOBALTIMEOUTINFO * phgti);
  668. HRESULT PurgeDelayedActions(void);
  669. BOOL AreOutstandingDelayedActions(void);
  670. UINT FtpConfirmDeleteDialog(HWND hwnd, CFtpPidlList * pflHfpl, CFtpFolder * pff);
  671. UINT FtpConfirmReplaceDialog(HWND hwnd, LPWIN32_FIND_DATA pwfdLocal, LPFTP_FIND_DATA pwfdRemote, int cobj, CFtpFolder * pff);
  672. UINT FtpConfirmReplaceDialog(HWND hwnd, LPFTP_FIND_DATA pwfdLocal, LPWIN32_FIND_DATA pwfdRemote, int cobj, CFtpFolder * pff);
  673. CFtpView * GetCFtpViewFromDefViewSite(IUnknown * punkSite);
  674. /*****************************************************************************\
  675. FTP Notes and Issues
  676. Time/Date Stamps on FTP Files:
  677. There are two issues, the date on the server isn't time zone independent,
  678. and FTP/Wininet only do LastWriteTime (not CreationTime & LastAccessedTime).
  679. 1. Corrdinated Universal Time (UTC) is the format to use to store time in
  680. a time zone indepndent manner. Time displayed to the user then gets
  681. converted at the last moment so it's correct wrt the time zone. FindFirstFile()
  682. does fill in the WIN32_FIND_DATA structure with UTC time, but wininet doesn't.
  683. This means that this FTP code can't do the UTC->LocalTime convertion when
  684. displaying the date/time.
  685. 2. Only the modified date is sent via FTP. Oh well, not to sever.
  686. Threading Issues:
  687. FTP can be called from several threads:
  688. 1. Main UI Thread: CFtpFolder, ....
  689. 2. Folder Contents Enum: CFtpFolder, IEnumIDList, CFtpDir, CFtpSite.
  690. 2. AutoComplete Enum: CFtpFolder, IEnumIDList, CFtpDir, CFtpSite.
  691. PERF:
  692. 1. We only cache an FTP session (InternetConnect()) for 10 seconds. We should
  693. increase this to 50sec to 90 or maybe 120sec. This is currently done because
  694. we need to force the session to close down early when we are going to shutdown
  695. the process or try to unload our dll.
  696. 2. Our Tree Walker code for recusrive operations (upload, download, delete) (in ftppl.cpp)
  697. calls FtpGetCurrentDirectory() and FtpSetCurrentDirectory() too often. To fix
  698. this, we need to verify we don't recurse into SOFTLINK directories because
  699. this is what requires the FtpGetCurrentDirectory. This also could cause a
  700. recursion death bug and infinite loop. We would then create
  701. ::_CacheChangeDir() and ::_CommitChangeDir() so the could remain
  702. simple but we would cache several Change Directories.
  703. 3. If the desktop or desktop toolbars have FTP Shortcuts, the icon is
  704. extracted in such a way that we hit the net. Bad bad bad.
  705. Fix this, even if this mean hacking.
  706. \*****************************************************************************/
  707. // WARNING: Don't put any #defines or typedefs after the includes or they won't be recognized.
  708. #include <shfusion.h>
  709. #endif // _PRIV_H_