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.

186 lines
5.1 KiB

  1. /*****************************************************************************
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. ShowError.CPP
  5. Abstract:
  6. This module is intended to prepare error messages.
  7. Author:
  8. Akhil Gokhale 03-Oct.-2000 (Created it)
  9. Revision History:
  10. ******************************************************************************/
  11. #include "pch.h"
  12. #include "ETCommon.h"
  13. #include "ShowError.h"
  14. #include "resource.h"
  15. // ***************************************************************************
  16. // Routine Description:
  17. // Class default constructor.
  18. //
  19. // Arguments:
  20. // None
  21. // Return Value:
  22. // None
  23. //
  24. //***************************************************************************
  25. CShowError::CShowError()
  26. {
  27. m_lErrorNumber = 0;
  28. }
  29. // ***************************************************************************
  30. // Routine Description:
  31. // Class constructor.
  32. //
  33. // Arguments:
  34. // None
  35. // Return Value:
  36. // None
  37. //
  38. //***************************************************************************
  39. CShowError::CShowError(LONG lErrorNumber)
  40. {
  41. m_lErrorNumber = lErrorNumber;
  42. }
  43. // ***************************************************************************
  44. // Routine Description:
  45. // Class default desctructor.
  46. //
  47. // Arguments:
  48. // None
  49. // Return Value:
  50. // None
  51. //
  52. //***************************************************************************
  53. CShowError::~CShowError()
  54. {
  55. }
  56. // ***************************************************************************
  57. // Routine Description:
  58. // This function will return Text reason for given error code.
  59. //
  60. // Arguments:
  61. // None
  62. // Return Value:
  63. // None
  64. //
  65. //***************************************************************************
  66. LPCTSTR CShowError::ShowReason()
  67. {
  68. __STRING_64 szTempStr = NULL_STRING;
  69. BOOL bShowExtraMsg = TRUE;
  70. switch(m_lErrorNumber )
  71. {
  72. case MK_E_SYNTAX:
  73. case E_OUTOFMEMORY:
  74. {
  75. LPWSTR pwszTemp = NULL;
  76. lstrcpy(m_szErrorMsg,GetReason());
  77. bShowExtraMsg = FALSE;
  78. }
  79. break;
  80. case IDS_USERNAME_REQUIRED:
  81. lstrcpy(m_szErrorMsg,GetResString(IDS_USERNAME_REQUIRED));
  82. g_dwOptionFlag = FALSE;
  83. break;
  84. case IDS_ERROR_USERNAME_EMPTY:
  85. lstrcpy(m_szErrorMsg,GetResString(IDS_ERROR_USERNAME_EMPTY));
  86. g_dwOptionFlag = FALSE;
  87. break;
  88. case IDS_ERROR_SERVERNAME_EMPTY:
  89. lstrcpy(m_szErrorMsg,GetResString(IDS_ERROR_SERVERNAME_EMPTY));
  90. g_dwOptionFlag = FALSE;
  91. break;
  92. case IDS_ID_TRIG_NAME_MISSING:
  93. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_TRIG_NAME_MISSING));
  94. break;
  95. case IDS_ID_TYPE_SOURCE:
  96. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_TYPE_SOURCE));
  97. break;
  98. case IDS_INVALID_ID:
  99. lstrcpy(m_szErrorMsg,GetResString(IDS_INVALID_ID));
  100. g_dwOptionFlag = FALSE;
  101. break;
  102. case IDS_ID_TK_NAME_MISSING:
  103. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_TK_NAME_MISSING));
  104. break;
  105. case IDS_ID_REQUIRED:
  106. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_REQUIRED));
  107. break;
  108. case IDS_ID_NON_NUMERIC:
  109. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_NON_NUMERIC));
  110. g_dwOptionFlag = FALSE;
  111. break;
  112. case IDS_HEADER_NOT_ALLOWED:
  113. lstrcpy(m_szErrorMsg,GetResString(IDS_HEADER_NOT_ALLOWED));
  114. break;
  115. case IDS_ERROR_USERNAME_BUT_NOMACHINE:
  116. lstrcpy(m_szErrorMsg,GetResString(IDS_ERROR_USERNAME_BUT_NOMACHINE));
  117. bShowExtraMsg = FALSE;
  118. break;
  119. case IDS_ID_SOURCE_EMPTY:
  120. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_SOURCE_EMPTY));
  121. g_dwOptionFlag = FALSE;
  122. break;
  123. case IDS_ID_DESC_EMPTY:
  124. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_DESC_EMPTY));
  125. g_dwOptionFlag = FALSE;
  126. break;
  127. case IDS_ID_LOG_EMPTY:
  128. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_LOG_EMPTY));
  129. g_dwOptionFlag = FALSE;
  130. break;
  131. case IDS_ID_INVALID_TRIG_NAME:
  132. lstrcpy(m_szErrorMsg,GetResString(IDS_ID_INVALID_TRIG_NAME));
  133. g_dwOptionFlag = FALSE;
  134. break;
  135. case IDS_RUN_AS_USERNAME_REQUIRED:
  136. lstrcpy(m_szErrorMsg,GetResString(IDS_RUN_AS_USERNAME_REQUIRED));
  137. g_dwOptionFlag = FALSE;
  138. break;
  139. case IDS_ERROR_R_U_EMPTY:
  140. lstrcpy(m_szErrorMsg,GetResString(IDS_ERROR_R_U_EMPTY));
  141. g_dwOptionFlag = FALSE;
  142. default:
  143. break;
  144. }
  145. if(bShowExtraMsg)
  146. {
  147. __STRING_64 szStr = NULL_STRING; ;
  148. lstrcpy(szStr,GetResString(IDS_UTILITY_NAME));
  149. switch(g_dwOptionFlag)
  150. {
  151. case 0:
  152. lstrcpy(szTempStr,NULL_STRING);
  153. break;
  154. case 1:
  155. wsprintf(szTempStr,GetResString(IDS_TYPE_HELP),szStr,OPTION_CREATE);
  156. break;
  157. case 2:
  158. wsprintf(szTempStr,GetResString(IDS_TYPE_HELP),szStr,OPTION_DELETE);
  159. break;
  160. case 3:
  161. wsprintf(szTempStr,GetResString(IDS_TYPE_HELP),szStr,OPTION_QUERY);
  162. break;
  163. default:
  164. break;
  165. }
  166. }
  167. lstrcat(m_szErrorMsg,szTempStr);
  168. return m_szErrorMsg;
  169. }