Microsoft KB Archive/256881

= PRB: RPC Numeric Endpoints Should Not Contain Leading Zeros =

Article ID: 256881

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 98 Standard Edition
 * Microsoft Windows NT Server 4.0 Standard Edition
 * Microsoft Windows NT Workstation 4.0 Developer Edition

-



This article was previously published under Q256881



SYMPTOMS
When you run a RPC program on a Microsoft Windows NT 4.0-based computer or a Microsoft Windows 2000-based computer, if the remote program runs on a Microsoft Windows 95-based computer or a Microsoft Windows 98-based computer, the use of numeric endpoints, which contain leading zeros, causes RPC calls to fail with error 1722:

(RPC_S_SERVER_UNAVAILABLE).



CAUSE
In C or C++, a number with a leading zero is normally considered an octal number. For instance, 03322 should be interpreted as decimal 1746.

On Windows 95-based computers or Windows 98-based computers, a numeric endpoint with a leading zero is interpreted as an octal number by the RPC run-time. On a Windows NT 4.0-based computer or a Microsoft Windows 2000-based computer, however, all leading zeros in a numeric endpoint are stripped off and the number is interpreted by the RPC run-time as decimal.



RESOLUTION
To resolve the problem, numeric RPC endpoints should not contain leading zeros, whether the endpoints are specified interactively or through an Interface Definition Language (IDL) file.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
Assume that an endpoint 03322 is specified for ncacn_ip_tcp in the IDL file, as follows: [uuid (cf0b9b5f-89c3-4ad6-944a-451bb34a3c29), version(1.0), pointer_default(unique) endpoint ("ncacn_ip_tcp:[03322]") ] interface myinterface { void MyRPCProc([in, string] unsigned char * pszString); } After Microsoft Interface Definition Language (MIDL) compilation, the server and client stub files should contain the following endpoint information: ... ... ... static RPC_PROTSEQ_ENDPOINT __RpcProtseqEndpoint[] = {   {(unsigned char *) "ncacn_ip_tcp", (unsigned char *) "03322"} }; ... ... ... Compile the server and client code with the stub files.Run the server on a Windows NT 4.0-based computer or a Windows 2000-based computer.Run the client on a Windows 95-based computer or Windows 98-based computer. The remote procedure call MyRPCProc fails with the 1722 error.

