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.

158 lines
4.4 KiB

  1. // Upload.h : Declaration of the CUpload
  2. #ifndef __UPLOAD_H_
  3. #define __UPLOAD_H_
  4. #include "resource.h" // main symbols
  5. #pragma warning(disable:4786)
  6. #include <string>
  7. #include <xstring>
  8. #include <map>
  9. #include <locale>
  10. #include <algorithm>
  11. #include <vector>
  12. using namespace std;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CUpload
  15. class ATL_NO_VTABLE CUpload :
  16. public CComObjectRootEx<CComSingleThreadModel>,
  17. public CComCoClass<CUpload, &CLSID_Upload>,
  18. public IDispatchImpl<IUpload, &IID_IUpload, &LIBID_COMPATUILib>,
  19. public IObjectWithSiteImpl<CUpload>
  20. {
  21. public:
  22. CUpload() : m_Safe(this)
  23. {
  24. }
  25. DECLARE_REGISTRY_RESOURCEID(IDR_UPLOAD)
  26. DECLARE_PROTECT_FINAL_CONSTRUCT()
  27. BEGIN_COM_MAP(CUpload)
  28. COM_INTERFACE_ENTRY(IUpload)
  29. COM_INTERFACE_ENTRY(IDispatch)
  30. COM_INTERFACE_ENTRY(IObjectWithSite)
  31. END_COM_MAP()
  32. // IUpload
  33. public:
  34. STDMETHOD(ShowTempFiles)();
  35. STDMETHOD(DeleteTempFiles)();
  36. STDMETHOD(AddDescriptionFile)(
  37. /*[in]*/BSTR pszApplicationName,
  38. /*[in]*/BSTR pszApplicationPath,
  39. /*[in]*/LONG lMediaType,
  40. /*[in]*/BOOL bCompatSuccess,
  41. /*[in]*/VARIANT* pvFixesApplied,
  42. /*[in]*/VARIANT pszKey,
  43. /*[out, retval]*/BOOL* pbSuccess);
  44. STDMETHOD(SendReport)(/*[out, retval]*/BOOL* pbSuccess);
  45. STDMETHOD(CreateManifestFile)(/*[out, retval]*/BOOL *pbSuccess);
  46. STDMETHOD(RemoveDataFile)(/*[in]*/BSTR pszDataFile);
  47. STDMETHOD(AddDataFile)(
  48. /*[in]*/BSTR pszDataFile,
  49. /*[in]*/VARIANT vKey,
  50. /*[in]*/VARIANT vDescription,
  51. /*[in]*/VARIANT vOwn);
  52. STDMETHOD(AddMatchingInfo)(
  53. /*[in]*/BSTR pszCommand,
  54. /*[in]*/VARIANT vFilter,
  55. /*[in]*/VARIANT vKey,
  56. /*[in]*/VARIANT vDescription,
  57. /*[in]*/VARIANT vProgress,
  58. /*[out, retval]*/BOOL* pbSuccess);
  59. STDMETHOD(GetKey)(/*[in]*/BSTR pszKey, /*[out, retval]*/VARIANT* pszValue);
  60. STDMETHOD(SetKey)(/*[in]*/BSTR pszKey, /*[in]*/VARIANT* pvValue);
  61. STDMETHOD(GetDataFile)(/*[in]*/VARIANT vKey, /*[in]*/LONG InformationClass, /*[out, retval]*/VARIANT* pVal);
  62. protected:
  63. //
  64. // safeguard against bad host
  65. //
  66. CSafeObject m_Safe;
  67. //
  68. // map for the items, unique
  69. //
  70. VOID ListTempFiles(wstring& str);
  71. typedef map<wstring, wstring, less<wstring> > MAPSTR2STR;
  72. MAPSTR2STR m_mapManifest;
  73. //
  74. // data files collection in an embedded object
  75. //
  76. typedef struct tagMatchingFileInfo {
  77. wstring strDescription; // description of a matching file
  78. wstring strFileName; // filename
  79. BOOL bOwn; // do we own the file?
  80. } MFI, *PMFI;
  81. typedef map<wstring, MFI > MAPSTR2MFI;
  82. MAPSTR2MFI m_DataFiles;
  83. /*
  84. typedef vector<wstring> STRVEC;
  85. STRVEC m_DataFiles;
  86. */
  87. CComBSTR m_bstrManifest;
  88. BOOL GetDataFilesKey(CComBSTR& bstrVal);
  89. IProgressDialog* m_ppd;
  90. static BOOL CALLBACK _GrabmiCallback(
  91. LPVOID lpvCallbackParam, // application-defined parameter
  92. LPCTSTR lpszRoot, // root directory path
  93. LPCTSTR lpszRelative, // relative path
  94. PATTRINFO pAttrInfo, // attributes
  95. LPCWSTR pwszXML // resulting xml
  96. );
  97. BOOL IsHeadlessMode(void);
  98. typedef struct tagMIThreadParamBlock {
  99. CUpload* pThis;
  100. wstring strCommand;
  101. HWND hwndParent;
  102. DWORD dwFilter;
  103. BOOL bNoProgress;
  104. wstring strKey;
  105. wstring strDescription;
  106. } MITHREADPARAMBLK;
  107. typedef enum tagDATAFILESINFOCLASS {
  108. InfoClassCount = 0,
  109. InfoClassKey = 1,
  110. InfoClassFileName = 2,
  111. InfoClassDescription = 3
  112. } DATAFILESINFOCLASS;
  113. typedef pair<CUpload*, IProgressDialog*> GMEPARAMS;
  114. static DWORD WINAPI _AddMatchingInfoThreadProc(LPVOID lpvThis);
  115. BOOL AddMatchingInfoInternal(HWND hwndParent,
  116. LPCWSTR pszCommand,
  117. DWORD dwFilter,
  118. BOOL bNoProgress,
  119. LPCWSTR pszKey,
  120. LPCWSTR pszDescription);
  121. };
  122. #endif //__UPLOAD_H_