Changeset 1686 for trunk/dll/errutil.c
- Timestamp:
- Mar 10, 2013, 7:34:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/errutil.c
r1673 r1686 36 36 works in HIMEM builds 37 37 01 Dec 10 SHL Dos_Error - remap API errors code that with odd oso001*.msg messages 38 10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options 39 Added saymsg2 for this purpose 38 40 39 41 ***********************************************************************/ … … 42 44 #include <string.h> 43 45 #include <stdarg.h> 46 #include <stdlib.h> 44 47 45 48 #define INCL_DOS … … 54 57 #include "notebook.h" // fErrorBeepOff 55 58 #include "init.h" // Data declares 59 #include "wrappers.h" // xmallocz 56 60 57 61 #pragma data_seg(DATA1) … … 348 352 } // saymsg 349 353 354 APIRET saymsg2(PCSZ pszButtonNames, int DefaultButton, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...) 355 { 356 ULONG i; 357 APIRET rc; 358 CHAR szMsg[4096]; 359 va_list va; 360 MB2INFO *pmbInfo; 361 MB2D mb2dBut[4]; 362 ULONG ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * 3)); 363 364 va_start(va, pszFmt); 365 szMsg[sizeof(szMsg) - 1] = 0; 366 vsprintf(szMsg, pszFmt, va); 367 va_end(va); 368 369 if (szMsg[sizeof(szMsg) - 1]) { 370 fprintf(stderr, "Buffer overflow in saymsg2 - need %u bytes\n", strlen(szMsg) + 1); 371 fflush(stderr); 372 } 373 374 memset(mb2dBut, 0, sizeof(MB2D) * 4); 375 //fixme to use GetPString 376 strcpy(mb2dBut[0].achText, /*pszButtonNames[0] ? &pszButtonNames[0] :*/ GetPString(IDS_MB2DYES)); 377 strcpy(mb2dBut[1].achText, /*pszButtonNames[1] ? &pszButtonNames[1] :*/ GetPString(IDS_MB2DYESDONTASK)); 378 strcpy(mb2dBut[2].achText, /*pszButtonNames[2] ? &pszButtonNames[2] :*/ GetPString(IDS_MB2DNO)); 379 strcpy(mb2dBut[3].achText,/* pszButtonNames[3] ? &pszButtonNames[3] :*/ GetPString(IDS_MB2DCANCELOP)); 380 mb2dBut[0].idButton = 1; 381 mb2dBut[1].idButton = 2; 382 mb2dBut[2].idButton = 3; 383 mb2dBut[3].idButton = 4; 384 if (DefaultButton) 385 mb2dBut[DefaultButton - 1].flStyle = BS_DEFAULT; 386 pmbInfo = xmallocz(ulInfoSize, pszSrcFile, __LINE__); 387 if (pmbInfo) { 388 pmbInfo->cb = ulInfoSize; 389 pmbInfo->hIcon = 0; 390 pmbInfo->cButtons = 4; 391 pmbInfo->flStyle = MB_MOVEABLE; 392 pmbInfo->hwndNotify = NULLHANDLE; 393 for (i = 0; i < 4; i++) { 394 memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D)); 395 } 396 rc = WinMessageBox2(HWND_DESKTOP, hwnd, 397 szMsg, pszTitle, 1234, 398 pmbInfo); 399 free(pmbInfo); 400 return rc; 401 } 402 return MBID_ERROR; 403 } 404 350 405 //=== showMsg: display error popup === 351 406
Note:
See TracChangeset
for help on using the changeset viewer.