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.

74 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1994, Microsoft Corporation.
  4. //
  5. // File: htxexcpt.hxx
  6. //
  7. // Contents: Message exception package for IDQ files
  8. //
  9. // History: 96-Jan-98 DwightKr Created
  10. //
  11. //----------------------------------------------------------------------------
  12. #pragma once
  13. //+---------------------------------------------------------------------------
  14. //
  15. // Class: CHTXException
  16. //
  17. // Purpose: Exception class containing message numbers referring to
  18. // keys within query.dll
  19. //
  20. // History: 96-Feb-26 DwightKr Created.
  21. // 96-Jun-24 DwightKr Track file name
  22. //
  23. // Notes: We don't want to own any resources in this class, othersize
  24. // it will need to be unwindable. Therefore, if the string
  25. // is longer than MAX_PATH, we'll truncate.
  26. //
  27. //----------------------------------------------------------------------------
  28. class CHTXException : public CException
  29. {
  30. public:
  31. CHTXException( long lError,
  32. WCHAR const * wcsFileName,
  33. ULONG ulErrorIndex )
  34. : _ulErrorIndex(ulErrorIndex),
  35. CException(lError)
  36. {
  37. _awcHTXFileName[0] = 0;
  38. if ( 0 != wcsFileName )
  39. {
  40. ULONG cwcFileName = min( wcslen(wcsFileName) + 1, MAX_PATH );
  41. RtlCopyMemory( _awcHTXFileName,
  42. wcsFileName,
  43. sizeof(WCHAR) * cwcFileName );
  44. _awcHTXFileName[MAX_PATH-1] = 0;
  45. }
  46. }
  47. ULONG GetErrorIndex() const { return _ulErrorIndex; }
  48. WCHAR const * GetHTXFileName() const { return _awcHTXFileName; }
  49. # if !defined(NATIVE_EH)
  50. // inherited methods
  51. EXPORTDEF virtual int WINAPI IsKindOf( const char * szClass ) const
  52. {
  53. if( strcmp( szClass, "CHTXException" ) == 0 )
  54. return TRUE;
  55. else
  56. return CException::IsKindOf( szClass );
  57. }
  58. # endif // !defined(NATIVE_EH)
  59. private:
  60. ULONG _ulErrorIndex;
  61. WCHAR _awcHTXFileName[MAX_PATH];
  62. };