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.

159 lines
3.9 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. LONG 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. LONG FileIndex,
  28. QMErrInfo * ErrInfo
  29. );
  30. bool IsErrorSet() const
  31. {
  32. return m_ErrorSet;
  33. }
  34. void ClearError();
  35. bool operator==( const CJobError & err )
  36. {
  37. if (m_ErrorSet == err.m_ErrorSet &&
  38. m_FileIndex == err.m_FileIndex &&
  39. m_job == err.m_job &&
  40. m_ErrInfo == err.m_ErrInfo)
  41. {
  42. return true;
  43. }
  44. return false;
  45. }
  46. HRESULT Serialize( HANDLE hFile ) const;
  47. void Unserialize( HANDLE hFile, CJob * job );
  48. protected:
  49. bool m_ErrorSet;
  50. LONG m_FileIndex;
  51. CJob * m_job;
  52. QMErrInfo m_ErrInfo;
  53. };
  54. class CJobErrorExternal : public CSimpleExternalIUnknown<IBackgroundCopyError>
  55. {
  56. public:
  57. // All external methods are read only so no locks are needed.
  58. // IBackgroundCopyError methods
  59. HRESULT STDMETHODCALLTYPE GetErrorInternal(
  60. /* [ in, out, unique ] */ BG_ERROR_CONTEXT *pContext,
  61. /* [ in, out, unique ] */ HRESULT *pCode );
  62. HRESULT STDMETHODCALLTYPE GetError(
  63. /* [ in, out, unique ] */ BG_ERROR_CONTEXT *pContext,
  64. /* [ in, out, unique ] */ HRESULT *pCode )
  65. {
  66. EXTERNAL_FUNC_WRAP( GetErrorInternal( pContext, pCode ) )
  67. }
  68. HRESULT STDMETHODCALLTYPE GetFileInternal(
  69. /* [ in, out, unique ] */ IBackgroundCopyFile ** pVal );
  70. HRESULT STDMETHODCALLTYPE GetFile(
  71. /* [ in, out, unique ] */ IBackgroundCopyFile ** pVal )
  72. {
  73. EXTERNAL_FUNC_WRAP( GetFileInternal( pVal ) )
  74. }
  75. // Retusn a human readable description of the error.
  76. // Use CoTaskMemAlloc to free the description.
  77. HRESULT STDMETHODCALLTYPE GetErrorDescriptionInternal(
  78. /* [in] */ DWORD LanguageId,
  79. /* [out,ref] */ LPWSTR *pErrorDescription );
  80. HRESULT STDMETHODCALLTYPE GetErrorDescription(
  81. /* [in] */ DWORD LanguageId,
  82. /* [out,ref] */ LPWSTR *pErrorDescription )
  83. {
  84. EXTERNAL_FUNC_WRAP( GetErrorDescriptionInternal( LanguageId, pErrorDescription ) )
  85. }
  86. // Return a human readable description of the error context.
  87. // Use CoTaskMemAlloc to free the description.
  88. HRESULT STDMETHODCALLTYPE GetErrorContextDescriptionInternal(
  89. /* [in] */ DWORD LanguageId,
  90. /* [out,ref] */ LPWSTR *pErrorDescription );
  91. HRESULT STDMETHODCALLTYPE GetErrorContextDescription(
  92. /* [in] */ DWORD LanguageId,
  93. /* [out,ref] */ LPWSTR *pErrorDescription )
  94. {
  95. EXTERNAL_FUNC_WRAP( GetErrorContextDescriptionInternal( LanguageId, pErrorDescription ) )
  96. }
  97. HRESULT STDMETHODCALLTYPE GetProtocolInternal(
  98. /* [out,ref] */ LPWSTR *pProtocol );
  99. HRESULT STDMETHODCALLTYPE GetProtocol(
  100. /* [out,ref] */ LPWSTR *pProtocol )
  101. {
  102. EXTERNAL_FUNC_WRAP( GetProtocolInternal( pProtocol ) )
  103. }
  104. // other member functions
  105. CJobErrorExternal( CJobError const * JobError );
  106. CJobErrorExternal( );
  107. protected:
  108. virtual ~CJobErrorExternal();
  109. BG_ERROR_CONTEXT m_Context;
  110. HRESULT m_Code;
  111. CFileExternal * m_FileExternal;
  112. HRESULT GetErrorDescription(
  113. HRESULT hResult,
  114. DWORD LanguageId,
  115. LPWSTR *pErrorDescription );
  116. };