Source code of Windows XP (NT5)
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.

150 lines
4.1 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. {
  20. public:
  21. CUpload()
  22. {
  23. }
  24. DECLARE_REGISTRY_RESOURCEID(IDR_UPLOAD)
  25. DECLARE_PROTECT_FINAL_CONSTRUCT()
  26. BEGIN_COM_MAP(CUpload)
  27. COM_INTERFACE_ENTRY(IUpload)
  28. COM_INTERFACE_ENTRY(IDispatch)
  29. END_COM_MAP()
  30. // IUpload
  31. public:
  32. STDMETHOD(ShowTempFiles)();
  33. STDMETHOD(DeleteTempFiles)();
  34. STDMETHOD(AddDescriptionFile)(
  35. /*[in]*/BSTR pszApplicationName,
  36. /*[in]*/BSTR pszApplicationPath,
  37. /*[in]*/LONG lMediaType,
  38. /*[in]*/BOOL bCompatSuccess,
  39. /*[in]*/VARIANT* pvFixesApplied,
  40. /*[in]*/VARIANT pszKey,
  41. /*[out, retval]*/BOOL* pbSuccess);
  42. STDMETHOD(SendReport)(/*[out, retval]*/BOOL* pbSuccess);
  43. STDMETHOD(CreateManifestFile)(/*[out, retval]*/BOOL *pbSuccess);
  44. STDMETHOD(RemoveDataFile)(/*[in]*/BSTR pszDataFile);
  45. STDMETHOD(AddDataFile)(
  46. /*[in]*/BSTR pszDataFile,
  47. /*[in]*/VARIANT vKey,
  48. /*[in]*/VARIANT vDescription,
  49. /*[in]*/VARIANT vOwn);
  50. STDMETHOD(AddMatchingInfo)(
  51. /*[in]*/BSTR pszCommand,
  52. /*[in]*/VARIANT vFilter,
  53. /*[in]*/VARIANT vKey,
  54. /*[in]*/VARIANT vDescription,
  55. /*[in]*/VARIANT vProgress,
  56. /*[out, retval]*/BOOL* pbSuccess);
  57. STDMETHOD(GetKey)(/*[in]*/BSTR pszKey, /*[out, retval]*/VARIANT* pszValue);
  58. STDMETHOD(SetKey)(/*[in]*/BSTR pszKey, /*[in]*/VARIANT* pvValue);
  59. STDMETHOD(GetDataFile)(/*[in]*/VARIANT vKey, /*[in]*/LONG InformationClass, /*[out, retval]*/VARIANT* pVal);
  60. protected:
  61. //
  62. // map for the items, unique
  63. //
  64. VOID ListTempFiles(wstring& str);
  65. typedef map<wstring, wstring, less<wstring> > MAPSTR2STR;
  66. MAPSTR2STR m_mapManifest;
  67. //
  68. // data files collection in an embedded object
  69. //
  70. typedef struct tagMatchingFileInfo {
  71. wstring strDescription; // description of a matching file
  72. wstring strFileName; // filename
  73. BOOL bOwn; // do we own the file?
  74. } MFI, *PMFI;
  75. typedef map<wstring, MFI > MAPSTR2MFI;
  76. MAPSTR2MFI m_DataFiles;
  77. /*
  78. typedef vector<wstring> STRVEC;
  79. STRVEC m_DataFiles;
  80. */
  81. CComBSTR m_bstrManifest;
  82. BOOL GetDataFilesKey(CComBSTR& bstrVal);
  83. IProgressDialog* m_ppd;
  84. static BOOL CALLBACK _GrabmiCallback(
  85. LPVOID lpvCallbackParam, // application-defined parameter
  86. LPCTSTR lpszRoot, // root directory path
  87. LPCTSTR lpszRelative, // relative path
  88. PATTRINFO pAttrInfo, // attributes
  89. LPCWSTR pwszXML // resulting xml
  90. );
  91. BOOL IsHeadlessMode(void);
  92. typedef struct tagMIThreadParamBlock {
  93. CUpload* pThis;
  94. wstring strCommand;
  95. HWND hwndParent;
  96. DWORD dwFilter;
  97. BOOL bNoProgress;
  98. wstring strKey;
  99. wstring strDescription;
  100. } MITHREADPARAMBLK;
  101. typedef enum tagDATAFILESINFOCLASS {
  102. InfoClassCount = 0,
  103. InfoClassKey = 1,
  104. InfoClassFileName = 2,
  105. InfoClassDescription = 3
  106. } DATAFILESINFOCLASS;
  107. typedef pair<CUpload*, IProgressDialog*> GMEPARAMS;
  108. static DWORD WINAPI _AddMatchingInfoThreadProc(LPVOID lpvThis);
  109. BOOL AddMatchingInfoInternal(HWND hwndParent,
  110. LPCWSTR pszCommand,
  111. DWORD dwFilter,
  112. BOOL bNoProgress,
  113. LPCWSTR pszKey,
  114. LPCWSTR pszDescription);
  115. };
  116. #endif //__UPLOAD_H_