BUG: 16-bit RPC Samples Print Meaningless Error Codes

Last reviewed: November 16, 1995
Article ID: Q139717
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) versions 3.1, 3.5, 3.51, 4.0

SYMPTOMS

Some of the 16-bit RPC samples print meaningless error codes. For example:

   Runtime reported exception 378535963

CAUSE

The 16-bit applications method for generating exceptions are different from those used by 32-bit applications. This is encapsulated to ease programming. Please look in the header file Rpcx86.h.

RpcExceptionCode is defined as _exception_code. However, _excpetion_code is a 16-bit integer, so when this is printed as an unsigned long integer, the result is not meaningful.

RESOLUTION

Any of the following methods should result in meaningful error codes:

  • Explicitly cast the value returned by RpcExceptionCode() as an unsigned long. For example:

          printf("Runtime reported exception %ld\n", (unsigned long)
    
             RpcExceptionCode());
    
       -or-
    
    
  • Use an unsigned long variable to trap the value of RpcExceptionCode(). For example:

          unsigned long ulCode;
          ulCode = RpcExceptionCode();
          printf("Runtime reported exception %ld\n",  ulCode );
    

    Note that this method is used by the samples that do not exhibit the problem.

    -or-

  • Print the value as an unsigned quantity. For example:

          printf("Runtime reported exception %u\n", RpcExceptionCode());
    

          -or-
    

          printf("Runtime reported exception %ul\n", RpcExceptionCode());
    

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are reasearching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

This bug is exhibited by the following samples:

callback\callc.c data\dunion\dunionc.c data\inout\inoutc.c data\repas\repasc.c data\xmit\xmitc.c doctor\doctorc.c rpcssm\rpcssmc.c

REFERENCES

The SDK header file Rpcerr.h that installs with the 16-bit runtimes for RPC.


Additional reference words: 3.10 3.50 3.51 4.00 win16sdk
KBCategory: kbnetwork kbbuglist
KBSubcategory: NtwkRpc


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.

Last reviewed: November 16, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.