Skip to content

Commit

Permalink
DosTrueGetMessage proto fix. DosScanEnv wrapper. Fix handle of some e…
Browse files Browse the repository at this point in the history
…rrors in all_GetSystemErrorMessage (error message already provided for some errors during message handling).
  • Loading branch information
prokushev committed Jun 20, 2024
1 parent 89a553e commit c21a5a1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
7 changes: 7 additions & 0 deletions OS2/CPI/doscalls/legacy/dos16scanenv.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "kal.h"


APIRET16 APIENTRY16 DOS16SCANENV(char * _Seg16 pszEnvVar, char * _Seg16 * _Seg16 ppszResult)
{
return DosScanEnv(pszEnvVar, ppszResult);
}
4 changes: 2 additions & 2 deletions OS2/CPI/doscalls/legacy/dos16truegetmessage.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ APIRET APIENTRY DosTrueGetMessage(void *msgSeg, PCHAR *pTable, ULONG cTable, PCH
ULONG cbBuf, ULONG msgnumber,
PSZ pszFile, PULONG pcbMsg);

USHORT APIENTRY16 DOS16TRUEGETMESSAGE(void * _Seg16 pMsgSeg, char * _Seg16 * _Seg16 ivTable,
USHORT APIENTRY16 DOS16TRUEGETMESSAGE(char * _Seg16 * _Seg16 ivTable,
USHORT ivCount, char * _Seg16 pData, USHORT cbData,
USHORT msgNum, char * _Seg16 pszFileName,
USHORT * _Seg16 msgLen)
USHORT * _Seg16 msgLen, void * _Seg16 pMsgSeg)
{
USHORT rc;
ULONG cbMsg=*msgLen;
Expand Down
6 changes: 0 additions & 6 deletions OS2/CPI/doscalls/legacy/unimp16.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,12 +1002,6 @@ USHORT APIENTRY16 DOS16SEARCHPATH(USHORT control, char * _Seg16 pszPath,
}


USHORT APIENTRY16 DOS16SCANENV(char * _Seg16 pszEnvVar, char * _Seg16 * _Seg16 ppszResult)
{
return unimplemented(__FUNCTION__);
}


// fix prototype !!! (undoc)
USHORT APIENTRY16 DOS16QPROCSTATUS(void)
{
Expand Down
1 change: 1 addition & 0 deletions OS2/CPI/doscalls/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ srcfiles = $(p)msg$(e) &
$(p)dos16makepipe$(e) &
$(p)dos16newsize$(e) &
$(p)dos16editname$(e) &
$(p)dos16scanenv$(e) &
$(p)doserror$(e) &
$(p)dosexecpgm$(e) &
$(p)dossetcurrentdir$(e) &
Expand Down
14 changes: 10 additions & 4 deletions OS2/Shared/all_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,30 @@
PSZ all_GetSystemErrorMessage(ULONG ulRc)
{
APIRET rc;
CHAR szErrorMessage[1000];
CHAR szErrorMessage[1000]={0};
#ifdef __386__
ULONG cbErrorMessage = 0;
#else
USHORT cbErrorMessage = 0;
#endif

rc=DosGetMessage(NULL, 0,szErrorMessage, sizeof(szErrorMessage),
ulRc,
rc=DosGetMessage(NULL, 0, // Argument table is empty
szErrorMessage, sizeof(szErrorMessage), // Message buffer
ulRc, // Error number
"OSO001.MSG", // default OS/2 message file
&cbErrorMessage);
&cbErrorMessage); // Returned message size

switch (rc)
{
case NO_ERROR: /* message retrieved, ok... */
break;
case ERROR_FILE_NOT_FOUND :
sprintf(szErrorMessage, "SYS%04u (Message file not found!)", ulRc);
break;
/* Error message already prepared in szErrorMessage */
//case ERROR_MR_CANT_FORMAT:
//case ERROR_MR_READ_ERROR:
case ERROR_MR_INV_IVCOUNT:
break;
default:
sprintf(szErrorMessage, "SYS%04u (Error %d while retrieving message text!)", ulRc, rc);
Expand Down

0 comments on commit c21a5a1

Please sign in to comment.