Changeset 613
- Timestamp:
- Apr 19, 2007, 2:06:38 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/dll/error.c ¶
r552 r613 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2004, 200 6Steven H. Levine9 Copyright (c) 2004, 2007 Steven H. Levine 10 10 11 11 12 Aug 04 SHL Comments … … 21 21 16 Aug 06 SHL Tweak message formatting 22 22 07 Jan 07 GKY Move error strings etc. to string file 23 18 Apr 07 SHL showMsg: correct selective logging checks 23 24 24 25 ***********************************************************************/ … … 40 41 #pragma alloc_text(FMINPUT,Win_Error,Dos_Error,saymsg,showMsg) 41 42 42 static APIRET showMsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszMsg );43 static APIRET showMsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszMsg, BOOL wantLog); 43 44 44 45 //== Win_Error: report Win...() error using passed message string === … … 63 64 // Format callers message 64 65 va_start(va, pszFmt); 65 vsprintf(szMsg, pszFmt, va); 66 va_end(va); 66 szMsg[sizeof(szMsg) - 1] = 0; 67 vsprintf(szMsg, pszFmt, va); 68 va_end(va); 69 70 if (szMsg[sizeof(szMsg) - 1]) { 71 fprintf(stderr, "Buffer overflow in Win_Error - need %u bytes\n", strlen(szMsg) + 1); 72 fflush(stderr); 73 } 67 74 68 75 if (strchr(szMsg, ' ') == NULL) … … 77 84 if (!pErrInfoBlk) { 78 85 psz = szMsg + strlen(szMsg); 79 strcpy(psz, " WinGetError failed.");86 strcpy(psz, " WinGetErrorInfo failed."); 80 87 } 81 88 else { … … 98 105 } 99 106 100 showMsg(MB_ENTER | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_GENERR2TEXT), // Titlebar message101 szMsg ); // Formatted message107 showMsg(MB_ENTER | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_GENERR2TEXT), 108 szMsg, TRUE); 102 109 103 110 } // Win_Error … … 131 138 // Format caller's message 132 139 va_start(va, pszFmt); 133 vsprintf(szMsg, pszFmt, va); 134 va_end(va); 140 szMsg[sizeof(szMsg) - 1] = 0; 141 vsprintf(szMsg, pszFmt, va); 142 va_end(va); 143 144 if (szMsg[sizeof(szMsg) - 1]) { 145 fprintf(stderr, "Buffer overflow in Dos_Error - need %u bytes\n", strlen(szMsg) + 1); 146 fflush(stderr); 147 } 135 148 136 149 if (strchr(szMsg, ' ') == NULL) … … 179 192 } 180 193 181 return showMsg(mb_type | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_DOSERR2TEXT), // Title182 szMsg );194 return showMsg(mb_type | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_DOSERR2TEXT), 195 szMsg, TRUE); 183 196 184 197 } // Dos_Error … … 203 216 // Format caller's message 204 217 va_start(va, pszFmt); 205 vsprintf(szMsg, pszFmt, va); 206 va_end(va); 218 szMsg[sizeof(szMsg) - 1] = 0; 219 vsprintf(szMsg, pszFmt, va); 220 va_end(va); 221 222 if (szMsg[sizeof(szMsg) - 1]) { 223 fprintf(stderr, "Buffer overflow in Runtime_Error - need %u bytes\n", strlen(szMsg) + 1); 224 fflush(stderr); 225 } 207 226 208 227 if (strchr(szMsg, ' ') == NULL) … … 210 229 211 230 sprintf(szMsg + strlen(szMsg), 212 213 214 showMsg(MB_ICONEXCLAMATION, HWND_DESKTOP, DEBUG_STRING, szMsg );231 GetPString(IDS_GENERR1TEXT), pszSrcFile, uSrcLineNo); 232 233 showMsg(MB_ICONEXCLAMATION, HWND_DESKTOP, DEBUG_STRING, szMsg, TRUE); 215 234 216 235 } // Runtime_Error … … 234 253 235 254 va_start(va, pszFmt); 236 vsprintf(szMsg, pszFmt, va); 237 va_end(va); 238 239 return showMsg(mb_type, hwnd, pszTitle, szMsg); 255 szMsg[sizeof(szMsg) - 1] = 0; 256 vsprintf(szMsg, pszFmt, va); 257 va_end(va); 258 259 if (szMsg[sizeof(szMsg) - 1]) { 260 fprintf(stderr, "Buffer overflow in saymsg - need %u bytes\n", strlen(szMsg) + 1); 261 fflush(stderr); 262 } 263 264 return showMsg(mb_type, hwnd, pszTitle, szMsg, FALSE); 240 265 241 266 } // saymsg … … 243 268 //=== showMsg: display error popup === 244 269 245 static APIRET showMsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszMsg )246 { 247 if ( (mb_type & (MB_YESNO | MB_YESNOCANCEL)) == 0) {270 static APIRET showMsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszMsg, BOOL wantLog) 271 { 272 if (wantLog) { 248 273 fputs(pszMsg, stderr); 249 274 fputc('\n', stderr); … … 260 285 (PSZ) pszMsg, (PSZ) pszTitle, 0, // help id 261 286 mb_type | MB_MOVEABLE); 262 } 287 } // showMsg
Note:
See TracChangeset
for help on using the changeset viewer.