Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenerror.c
Go to the documentation of this file.
00001 /* 00002 * ERROR.C - error reporting functions. 00003 * 00004 * 00005 * History: 00006 * 00007 * 07/12/98 (Rob Lake) 00008 * started 00009 * 00010 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>) 00011 * added config.h include 00012 * 00013 * 24-Jan-1999 (Eric Kohl) 00014 * Redirection safe! 00015 * 00016 * 02-Feb-1999 (Eric Kohl) 00017 * Use FormatMessage() for error reports. 00018 * 00019 * 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>) 00020 * Remove all hardcode string to En.rc 00021 */ 00022 00023 #include <precomp.h> 00024 00025 00026 VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) 00027 { 00028 TCHAR szMsg[RC_STRING_MAX_SIZE]; 00029 TCHAR szMessage[1024]; 00030 LPTSTR szError; 00031 va_list arg_ptr; 00032 00033 if (dwErrorCode == ERROR_SUCCESS) 00034 return; 00035 00036 nErrorLevel = 1; 00037 00038 if (szFormat) 00039 { 00040 va_start (arg_ptr, szFormat); 00041 _vstprintf (szMessage, szFormat, arg_ptr); 00042 va_end (arg_ptr); 00043 } 00044 00045 if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, 00046 NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 00047 (LPTSTR)&szError, 0, NULL)) 00048 { 00049 ConErrPrintf (_T("%s %s\n"), szError, szMessage); 00050 if(szError) 00051 LocalFree (szError); 00052 return; 00053 } 00054 00055 /* Fall back just in case the error is not defined */ 00056 if (szFormat) 00057 ConErrPrintf (_T("%s -- %s\n"), szMsg, szMessage); 00058 else 00059 ConErrPrintf (_T("%s\n"), szMsg); 00060 } 00061 00062 VOID error_parameter_format(TCHAR ch) 00063 { 00064 ConErrResPrintf(STRING_ERROR_PARAMETERF_ERROR, ch); 00065 nErrorLevel = 1; 00066 } 00067 00068 00069 VOID error_invalid_switch (TCHAR ch) 00070 { 00071 ConErrResPrintf(STRING_ERROR_INVALID_SWITCH, ch); 00072 nErrorLevel = 1; 00073 } 00074 00075 00076 VOID error_too_many_parameters (LPTSTR s) 00077 { 00078 ConErrResPrintf(STRING_ERROR_TOO_MANY_PARAMETERS, s); 00079 nErrorLevel = 1; 00080 } 00081 00082 00083 VOID error_path_not_found (VOID) 00084 { 00085 ConErrResPuts(STRING_ERROR_PATH_NOT_FOUND); 00086 nErrorLevel = 1; 00087 } 00088 00089 00090 VOID error_file_not_found (VOID) 00091 { 00092 ConErrResPuts(STRING_ERROR_FILE_NOT_FOUND); 00093 nErrorLevel = 1; 00094 } 00095 00096 00097 VOID error_sfile_not_found (LPTSTR f) 00098 { 00099 TCHAR szMsg[RC_STRING_MAX_SIZE]; 00100 00101 LoadString(CMD_ModuleHandle, STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE); 00102 ConErrPrintf(_T("%s - %s\n"), szMsg, f); 00103 nErrorLevel = 1; 00104 } 00105 00106 00107 VOID error_req_param_missing (VOID) 00108 { 00109 ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING); 00110 nErrorLevel = 1; 00111 } 00112 00113 00114 VOID error_invalid_drive (VOID) 00115 { 00116 ConErrResPuts(STRING_ERROR_INVALID_DRIVE); 00117 nErrorLevel = 1; 00118 } 00119 00120 00121 VOID error_bad_command (LPTSTR s) 00122 { 00123 ConErrResPrintf(STRING_ERROR_BADCOMMAND, s); 00124 nErrorLevel = 9009; 00125 } 00126 00127 00128 VOID error_no_pipe (VOID) 00129 { 00130 ConErrResPuts(STRING_ERROR_CANNOTPIPE); 00131 nErrorLevel = 1; 00132 } 00133 00134 00135 VOID error_out_of_memory (VOID) 00136 { 00137 ConErrResPuts(STRING_ERROR_OUT_OF_MEMORY); 00138 nErrorLevel = 1; 00139 } 00140 00141 00142 VOID error_invalid_parameter_format (LPTSTR s) 00143 { 00144 ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, s); 00145 nErrorLevel = 1; 00146 } 00147 00148 00149 VOID error_syntax (LPTSTR s) 00150 { 00151 TCHAR szMsg[RC_STRING_MAX_SIZE]; 00152 00153 LoadString(CMD_ModuleHandle, STRING_ERROR_ERROR2, szMsg, RC_STRING_MAX_SIZE); 00154 00155 if (s) 00156 ConErrPrintf(_T("%s - %s\n"), szMsg, s); 00157 else 00158 ConErrPrintf(_T("%s.\n"), szMsg); 00159 00160 nErrorLevel = 1; 00161 } 00162 00163 00164 VOID msg_pause (VOID) 00165 { 00166 ConOutResPuts(STRING_ERROR_D_PAUSEMSG); 00167 } 00168 00169 /* EOF */ Generated on Sun May 27 2012 04:17:39 for ReactOS by
1.7.6.1
|