Changeset 1891 for trunk/dll/errutil.c
- Timestamp:
- Jan 31, 2020, 3:47:37 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/errutil.c
r1880 r1891 6 6 Error reporting 7 7 8 Copyright (c) 1993- 98 M. Kimes9 Copyright (c) 2004 , 2015Steven H. Levine8 Copyright (c) 1993-1998 M. Kimes 9 Copyright (c) 2004-2020 Steven H. Levine 10 10 11 11 12 Aug 04 SHL Comments … … 41 41 15 Feb 14 GKY Improvements to saymsg2 some code cleanup 42 42 16 Feb 14 GKY Rework readonly check on delete code so it actually works in a logical way 43 43 and so it works with move to trashcan inabled. 44 44 09 Nov 13 SHL Use GetTidForThread in DbgMsg and tweak for for editors that understand file:line 45 28 Jan 20 SHL Add PmPrintf_Report 45 46 46 47 ***********************************************************************/ … … 66 67 #include "fm3dll2.h" 67 68 69 #ifdef PMPRINTF 70 #define _PMPRINTF_ // Enable debug macros 71 #include "PMPRINTF.H" 72 #endif 73 68 74 #pragma data_seg(DATA1) 69 75 … … 86 92 va_list va; 87 93 88 #if 1 // fixmeto be selectable94 #if 1 // FIXME to be selectable 89 95 90 96 static ULONG ul1stMSec; … … 94 100 95 101 if (!ul1stMSec) { 96 ul1stMSec = msec; 102 ul1stMSec = msec; // Avoid big delta 1st time 97 103 } 98 104 … … 124 130 */ 125 131 126 // 2010-12-01 SHL fixmefor ULONG to be APIRET132 // 2010-12-01 SHL FIXME for ULONG to be APIRET 127 133 128 134 INT Dos_Error(ULONG mb_type, ULONG apiret, HWND hwndOwner, … … 240 246 if (pszBuf[cBufBytes - 1]) { 241 247 fprintf(stderr, "Buffer overflow in formatWinError - need %u bytes\n", 242 248 strlen(pszBuf) + 1); 243 249 fflush(stderr); 244 250 } … … 263 269 if (!hwndOwner) 264 270 hwndOwner = HWND_DESKTOP; 265 // Find message offset in array of message offsets Assume 1 message - fixme?271 // Find message offset in array of message offsets Assume 1 message - FIXME? 266 272 pszOffset = ((PSZ) pErrInfoBlk) + pErrInfoBlk->offaoffszMsg; 267 273 // Address error message in array of messages and append error message to source code linenumber … … 303 309 } 304 310 311 #ifdef PMPRINTF 312 313 /** 314 * Format runtime error message and output using PmPrintf 315 * @note: Local errors written directly to stderr 316 * @note: If pszFmt is NULL a No Data error message is returned GKY 20 Feb 09 (Replaces Runtime_Error2) 317 */ 318 319 VOID PmPrintf_Report(PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...) 320 { 321 CHAR szMsg[4096]; 322 va_list va; 323 324 // Format caller's message 325 if (!pszFmt) 326 pszFmt = PCSZ_NODATA; 327 va_start(va, pszFmt); 328 szMsg[sizeof(szMsg) - 1] = 0; 329 vsprintf(szMsg, pszFmt, va); 330 va_end(va); 331 332 if (szMsg[sizeof(szMsg) - 1]) { 333 fprintf(stderr, "Buffer overflow in PmPrintf_Report - need %u bytes\n", strlen(szMsg) + 1); 334 fflush(stderr); 335 } 336 337 if (strchr(szMsg, ' ') == NULL) { 338 strcat(szMsg, " "); 339 strcat(szMsg, GetPString(IDS_FAILEDTEXT)); // Assume simple function name 340 } 341 342 // Avoid leading \n in IDS_GENERR1TEXT 343 strcat(szMsg, " "); 344 sprintf(szMsg + strlen(szMsg), 345 GetPString(IDS_GENERR1TEXT) + 1, pszSrcFile, uSrcLineNo); 346 347 PmPrintfString(szMsg); 348 349 } // PmPrintf_Report 350 351 #endif 352 305 353 /** 306 354 * Format runtime error message and output using showMsg … … 369 417 370 418 APIRET saymsg2(PCSZ pszButtonNames, int DefaultButton, HWND hwnd, 371 419 PCSZ pszTitle, PCSZ pszFmt, ...) 372 420 { 373 421 ULONG i; … … 412 460 rc = WinMessageBox2(HWND_DESKTOP, hwnd, 413 461 szMsg, pszTitle, SM2_DIALOG, 414 462 pmbInfo); 415 463 WinSetFocus(HWND_DESKTOP, SM2_DIALOG); 416 464 free(pmbInfo); … … 460 508 va_start(va, pszFmt); 461 509 formatWinError(szMsg, sizeof(szMsg), hwndErr, hwndOwner, pszSrcFile, 462 510 uSrcLineNo, pszFmt, va); 463 511 va_end(va); 464 512 … … 484 532 va_start(va, pszFmt); 485 533 formatWinError(szMsg, sizeof(szMsg), hwndErr, hwndOwner, pszSrcFile, uSrcLineNo, 486 534 pszFmt, va); 487 535 va_end(va); 488 536
Note:
See TracChangeset
for help on using the changeset viewer.