Changeset 1558


Ignore:
Timestamp:
Dec 1, 2010, 11:15:20 PM (15 years ago)
Author:
Steven Levine
Message:

Remap API errors code that with odd oso001*.msg messages

Location:
trunk/dll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/errutil.c

    r1450 r1558  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2008 Steven H. Levine
     9  Copyright (c) 2004, 2010 Steven H. Levine
    1010
    1111  12 Aug 04 SHL Comments
     
    3434  08 Mar 09 GKY Remove Dos_Error2 (unused) and Runtime_Error2 (no advantage over using Runtime_Error)
    3535  23 Jul 09 GKY Add low mem buffers for the msg file name so DosGetMessage
    36                 works in HIMEM builds
     36                works in HIMEM builds
     37  01 Dec 10 SHL Dos_Error - remap API errors code that with odd oso001*.msg messages
    3738
    3839***********************************************************************/
     
    5152#include "strutil.h"                    // GetPString
    5253#include "fm3str.h"
    53 #include "notebook.h"                   // fErrorBeepOff
    54 #include "init.h"                       // Data declares
     54#include "notebook.h"                   // fErrorBeepOff
     55#include "init.h"                       // Data declares
    5556
    5657#pragma data_seg(DATA1)
     
    8485  if (!ul1stMSec) {
    8586    ul1stMSec = msec;
    86     // ulLastMSec = msec;                       // Avoid big delta 1st time
     87    // ulLastMSec = msec;               // Avoid big delta 1st time
    8788  }
    8889
     
    115116//== Dos_Error: report Dos...() error using passed message string ===
    116117
    117 INT Dos_Error(ULONG mb_type, ULONG ulRC, HWND hwndOwner,
     118// 2010-12-01 SHL fixme for ULONG to be APIRET
     119
     120INT Dos_Error(ULONG mb_type, ULONG apiret, HWND hwndOwner,
    118121              PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...)
    119122{
     
    122125  ULONG Class;                          // Error class
    123126  ULONG action;                         // Error action
    124   ULONG Locus;                          // Error location
     127  ULONG Locus;                          // Error location
    125128  ULONG ulMsgLen;
     129  APIRET mapped_apiret;
    126130  CHAR *pszMsgStart;
    127131  CHAR *psz;
    128132  va_list va;
    129133
    130   if (!ulRC)
     134  if (!apiret)
    131135    return MBID_ENTER;                  // Should not have been called
    132136
     
    144148  if (strchr(szMsg, ' ') == NULL) {
    145149    strcat(szMsg, " ");
    146     strcat(szMsg, GetPString(IDS_FAILEDTEXT));          // Assume simple function name
    147   }
    148 
    149   DosErrClass(ulRC, &Class, &action, &Locus);
     150    strcat(szMsg, GetPString(IDS_FAILEDTEXT));  // Assume simple function name
     151  }
     152
     153  DosErrClass(apiret, &Class, &action, &Locus);
    150154
    151155  sprintf(szMsg + strlen(szMsg),
     
    153157          pszSrcFile,
    154158          uSrcLineNo,
    155           ulRC,
     159          apiret,
    156160          GetPString(IDS_ERRCLASS1TEXT + (Class - 1)),
    157161          GetPString(IDS_ERRACTION1TEXT + (action - 1)),
    158           GetPString(IDS_ERRLOCUS1TEXT + (Locus - 1)));
     162          GetPString(IDS_ERRLOCUS1TEXT + (Locus - 1)));
    159163  pszMsgStart = szMsg + strlen(szMsg) + 1;
    160164  strcpy(szMsgFile, "OSO001.MSG");
    161165  strcpy(szMsgFileH, "OSO001H.MSG");
    162166  // Get message leaving space for NL separator
    163   if (!DosGetMessage(NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, ulRC, szMsgFile, &ulMsgLen)
    164       || !DosGetMessage(NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, ulRC,
    165                         szMsgFileH, &ulMsgLen)) {
     167  // 2010-12-01 SHL Handle cases where message file message does not make sense relative to API error
     168  switch (apiret) {
     169  case ERROR_TIMEOUT:
     170    mapped_apiret = ERROR_SEM_TIMEOUT;  // Assume semaphore timeout
     171    break;
     172  default:
     173    mapped_apiret = apiret;
     174  }
     175  if (!DosGetMessage(NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, mapped_apiret, szMsgFile, &ulMsgLen)
     176      || !DosGetMessage(NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, mapped_apiret,
     177                        szMsgFileH, &ulMsgLen)) {
    166178    // Got message
    167179    pszMsgStart[ulMsgLen + 1] = 0;      // Terminate
     
    227239  if (strchr(pszBuf, ' ') == NULL) {
    228240    strcat(pszBuf, " ");
    229     strcat(pszBuf, GetPString(IDS_FAILEDTEXT));         // Assume simple function name
     241    strcat(pszBuf, GetPString(IDS_FAILEDTEXT)); // Assume simple function name
    230242  }
    231243
     
    311323  if (strchr(szMsg, ' ') == NULL) {
    312324    strcat(szMsg, " ");
    313     strcat(szMsg, GetPString(IDS_FAILEDTEXT));          // Assume simple function name
     325    strcat(szMsg, GetPString(IDS_FAILEDTEXT));  // Assume simple function name
    314326  }
    315327
  • trunk/dll/errutil.h

    r1402 r1558  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2010 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Move from fm3dll.h to here
     
    2323
    2424VOID DbgMsg(PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...);
    25 INT Dos_Error(ULONG mb_type, ULONG ulRC, HWND hwndOwner,
     25INT Dos_Error(ULONG mb_type, APIRET apiret, HWND hwndOwner,
    2626              PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...);
    2727ULONG GetMSecTimer(void);
Note: See TracChangeset for help on using the changeset viewer.