KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q39469: Process "exit" Values Must Lie Between 0 and 255 Inclusive

Article: Q39469
Product(s): See article
Version(s): 4.00 5.00 5.10 | 4.00 5.00 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | S_QUICKC | mspl13_c
Last Modified: 29-DEC-1988

Problem:

I am testing the exit value of a process. This value is not accurate
for values above 255.

Response:

Exit values must range between 0 and 255 inclusive. This limitation
has its roots in the "terminate with return code" interrupt function
(interrupt 21H, function 4CH). Using this function, exit values are
specified in the AL register. The AL register allows values from 0 to
255. All Microsoft C programs under DOS terminate using this function.

Under OS/2, the same limitation exists. Although OS/2 does not use
interrupts as DOS does, the reasoning is analogous.

Exit values can be tested using the functions spawnl, spawnle, spawnlp,
spawnlpe, spawnv, spawnve, spawnvp, and spawnvpe. Also, batch files may
test exit values using the IF ERRORLEVEL statement.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.