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.

146 lines
3.4 KiB

  1. class CJobError
  2. {
  3. public:
  4. CJobError();
  5. UINT64 GetCode() const
  6. {
  7. return m_ErrInfo.Code;
  8. }
  9. ERROR_STYLE GetStyle() const
  10. {
  11. return m_ErrInfo.Style;
  12. }
  13. ERROR_SOURCE GetSource() const
  14. {
  15. return m_ErrInfo.Source;
  16. }
  17. CFileExternal * CreateFileExternal() const;
  18. ULONG GetFileIndex() const
  19. {
  20. return m_FileIndex;
  21. }
  22. void GetOldInterfaceErrors(
  23. DWORD *pdwWin32Result,
  24. DWORD *pdwTransportResult ) const;
  25. void Set(
  26. CJob * Job,
  27. ULONG FileIndex,
  28. QMErrInfo * ErrInfo
  29. );
  30. bool IsErrorSet() const
  31. {
  32. return m_ErrorSet;
  33. }
  34. void ClearError();
  35. HRESULT Serialize( HANDLE hFile ) const;
  36. void Unserialize( HANDLE hFile, CJob * job );
  37. protected:
  38. bool m_ErrorSet;
  39. ULONG m_FileIndex;
  40. CJob * m_job;
  41. QMErrInfo m_ErrInfo;
  42. };
  43. class CJobErrorExternal : public CSimpleExternalIUnknown<IBackgroundCopyError>
  44. {
  45. public:
  46. // All external methods are read only so no locks are needed.
  47. // IBackgroundCopyError methods
  48. HRESULT STDMETHODCALLTYPE GetErrorInternal(
  49. /* [ in, out, unique ] */ BG_ERROR_CONTEXT *pContext,
  50. /* [ in, out, unique ] */ HRESULT *pCode );
  51. HRESULT STDMETHODCALLTYPE GetError(
  52. /* [ in, out, unique ] */ BG_ERROR_CONTEXT *pContext,
  53. /* [ in, out, unique ] */ HRESULT *pCode )
  54. {
  55. EXTERNAL_FUNC_WRAP( GetErrorInternal( pContext, pCode ) )
  56. }
  57. HRESULT STDMETHODCALLTYPE GetFileInternal(
  58. /* [ in, out, unique ] */ IBackgroundCopyFile ** pVal );
  59. HRESULT STDMETHODCALLTYPE GetFile(
  60. /* [ in, out, unique ] */ IBackgroundCopyFile ** pVal )
  61. {
  62. EXTERNAL_FUNC_WRAP( GetFileInternal( pVal ) )
  63. }
  64. // Retusn a human readable description of the error.
  65. // Use CoTaskMemAlloc to free the description.
  66. HRESULT STDMETHODCALLTYPE GetErrorDescriptionInternal(
  67. /* [in] */ DWORD LanguageId,
  68. /* [out,ref] */ LPWSTR *pErrorDescription );
  69. HRESULT STDMETHODCALLTYPE GetErrorDescription(
  70. /* [in] */ DWORD LanguageId,
  71. /* [out,ref] */ LPWSTR *pErrorDescription )
  72. {
  73. EXTERNAL_FUNC_WRAP( GetErrorDescriptionInternal( LanguageId, pErrorDescription ) )
  74. }
  75. // Return a human readable description of the error context.
  76. // Use CoTaskMemAlloc to free the description.
  77. HRESULT STDMETHODCALLTYPE GetErrorContextDescriptionInternal(
  78. /* [in] */ DWORD LanguageId,
  79. /* [out,ref] */ LPWSTR *pErrorDescription );
  80. HRESULT STDMETHODCALLTYPE GetErrorContextDescription(
  81. /* [in] */ DWORD LanguageId,
  82. /* [out,ref] */ LPWSTR *pErrorDescription )
  83. {
  84. EXTERNAL_FUNC_WRAP( GetErrorContextDescriptionInternal( LanguageId, pErrorDescription ) )
  85. }
  86. HRESULT STDMETHODCALLTYPE GetProtocolInternal(
  87. /* [out,ref] */ LPWSTR *pProtocol );
  88. HRESULT STDMETHODCALLTYPE GetProtocol(
  89. /* [out,ref] */ LPWSTR *pProtocol )
  90. {
  91. EXTERNAL_FUNC_WRAP( GetProtocolInternal( pProtocol ) )
  92. }
  93. // other member functions
  94. CJobErrorExternal( CJobError const * JobError );
  95. CJobErrorExternal( );
  96. protected:
  97. virtual ~CJobErrorExternal();
  98. BG_ERROR_CONTEXT m_Context;
  99. HRESULT m_Code;
  100. CFileExternal * m_FileExternal;
  101. HRESULT GetErrorDescription(
  102. HRESULT hResult,
  103. DWORD LanguageId,
  104. LPWSTR *pErrorDescription );
  105. };