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.

127 lines
3.0 KiB

  1. /*******************************************************************
  2. *
  3. * DESCRIPTION:
  4. * Header for uploading file to server
  5. *
  6. * DATE:8/22/2002
  7. *
  8. *******************************************************************/
  9. #include <inetupld.h>
  10. #ifndef __UPLOAD_H_
  11. #define __UPLOAD_H_
  12. #define _USE_WINHTTP 1
  13. #ifdef _USE_WINHTTP
  14. #include <winhttp.h>
  15. #include <winhttpi.h>
  16. #else
  17. #include <wininet.h>
  18. #endif
  19. class UploadFile : public IOcaUploadFile {
  20. public:
  21. UploadFile();
  22. ~UploadFile();
  23. // IUnknown.
  24. STDMETHOD(QueryInterface)(
  25. THIS_
  26. IN REFIID InterfaceId,
  27. OUT PVOID* Interface
  28. );
  29. STDMETHOD_(ULONG, AddRef)(
  30. THIS
  31. );
  32. STDMETHOD_(ULONG, Release)(
  33. THIS
  34. );
  35. STDMETHOD(InitializeSession)(
  36. THIS_
  37. LPWSTR OptionCode,
  38. LPWSTR wszFileToSend
  39. );
  40. STDMETHOD(SendFile)(
  41. THIS_
  42. LPWSTR wszRemoteFileName,
  43. BOOL bSecureMode
  44. );
  45. STDMETHOD(UnInitialize)(
  46. THIS_
  47. );
  48. STDMETHOD(Cancel)(
  49. THIS_
  50. );
  51. STDMETHOD(GetUrlPageData)(
  52. THIS_
  53. LPWSTR wszUrl,
  54. LPWSTR wszUrlPage,
  55. ULONG cbUrlPage
  56. );
  57. STDMETHOD_(ULONG, GetPercentComplete)(
  58. THIS_
  59. );
  60. STDMETHOD_(LPWSTR, GetServerName)(
  61. THIS_
  62. );
  63. STDMETHOD_(BOOL, IsUploadInProgress)(
  64. THIS_
  65. );
  66. STDMETHOD_(BOOL, GetUploadResult)(
  67. THIS_
  68. LPTSTR Result,
  69. ULONG cbResult
  70. );
  71. STDMETHOD(SetUploadResult)(
  72. THIS_
  73. EnumUploadStatus Success,
  74. LPCTSTR Text
  75. );
  76. private:
  77. HRESULT OpenSession();
  78. HRESULT SetFileToSend(LPWSTR wszFileName);
  79. BOOL CheckCancelRequest();
  80. HRESULT CreateCancelEventObject();
  81. HRESULT GetSessionRedirUrl(LPWSTR SessionUrl, LPWSTR wszRedirUrl, ULONG SizeofRedirUrl);
  82. HRESULT OpenConnection(LPWSTR wszRemoteFileName,
  83. BOOL bSecureMode);
  84. HRESULT StartSend();
  85. HRESULT CompleteSend();
  86. HRESULT CloseConnection();
  87. HRESULT CloseSession();
  88. HRESULT GetProxySettings(LPWSTR wszServerName, ULONG ServerNameSIze,
  89. LPWSTR wszByPass, ULONG ByPassSize);
  90. BOOL FireCancelEvent();
  91. BOOL GetRedirServerName(LPWSTR OptionCode, LPWSTR ConnectUrl,
  92. LPWSTR lpwszServerName, ULONG dwServerNameLength,
  93. LPWSTR lpwszUrl, ULONG UrlLength);
  94. ULONG m_Refs;
  95. BOOL m_fInitialized;
  96. LPCTSTR m_szFile;
  97. ULONG64 m_Sent;
  98. ULONG64 m_Size;
  99. HANDLE m_hCancelEvent;
  100. HANDLE m_hFile;
  101. HINTERNET m_hSession;
  102. HINTERNET m_hConnect;
  103. HINTERNET m_hRequest;
  104. ULONG m_NumTries;
  105. WCHAR m_wszServerName[MAX_PATH];
  106. EnumUploadStatus m_fLastUploadStatus;
  107. ULONG m_dwConnectPercentage;
  108. WCHAR m_wszLastUploadResult[MAX_PATH];
  109. };
  110. #endif // __UPLOAD_H_