diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/rpc/ndrlib | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/rpc/ndrlib')
31 files changed, 8366 insertions, 0 deletions
diff --git a/private/rpc/ndrlib/autohand.cxx b/private/rpc/ndrlib/autohand.cxx new file mode 100644 index 000000000..d7593a5d8 --- /dev/null +++ b/private/rpc/ndrlib/autohand.cxx @@ -0,0 +1,227 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + autohand.cxx + +Abstract: + + This module implements the autohandle functions call by the compiler + generated stubs. + +Author: + + Steven Zeck (stevez) 03/10/92 + +--*/ + +#include <rpc.h> +#include <rpcdcep.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rpcnsi.h> +#include <rpcnsip.h> + +#ifdef __cplusplus +} +#endif + + + +RPC_STATUS RPC_ENTRY +I_RpcNsGetBuffer( + IN PRPC_MESSAGE Message + ) + +/*++ + +Routine Description: + + Auto bind to a given interface. + +Arguments: + + Message - describes the interface that we want to auto bind to. + +Returns: + + RPC_S_OK, RPC_S_CALL_FAILED_DNE, I_RpcGetBuffer() + +--*/ + +{ + RPC_STATUS status; + PRPC_IMPORT_CONTEXT_P Import; + int fSetAge = 0; + + Message->ImportContext = 0; + + // If there already is a handle, use it directly. + + if (Message->Handle) + return(I_RpcGetBuffer(Message)); + + for (int cTry = 0; cTry < 2; cTry++) + { + status = RpcNsBindingImportBegin(RPC_C_NS_SYNTAX_DEFAULT, 0, + Message->RpcInterfaceInformation, 0, &Message->ImportContext); + + Import = (PRPC_IMPORT_CONTEXT_P) Message->ImportContext; + + if (status) + break; + + // This will cause some Zecky Magic + // Also note that naively one might move this ExpAge to + // after the first lookup failed time- that is a bobo + if (fSetAge) + status = RpcNsMgmtHandleSetExpAge (Message->ImportContext, 0); + + // If we found no bindings last time, tell the locator + // to look on the net. + + + // For each handle returned by import, try using it with I_RpcGetBuffer + // function until success or no more import handles. + + while(RpcNsBindingImportNext(Import, &Import->ProposedHandle) + == RPC_S_OK) + { + Message->Handle = Import->ProposedHandle; + + if (I_RpcGetBuffer(Message) == RPC_S_OK) + return(RPC_S_OK); + + RpcBindingFree(&Import->ProposedHandle); + } + + fSetAge = 1; + + + RpcNsBindingImportDone(&Message->ImportContext); + } + + + if (status == RPC_S_NAME_SERVICE_UNAVAILABLE || + status == RPC_S_OUT_OF_MEMORY || + status == RPC_S_OUT_OF_RESOURCES) + + return(status); + + return(RPC_S_CALL_FAILED_DNE); +} + + + +RPC_STATUS RPC_ENTRY +I_RpcNsSendReceive( + IN PRPC_MESSAGE Message, + OUT RPC_BINDING_HANDLE * Handle + ) + +/*++ + +Routine Description: + + Make a call on a RPC server. If the call fails continue looking for + servers to bind to. This is only needed for protocols + which don't allocate the connection at I_RpcGetBuffer time. + + +Arguments: + + Message - describes the interface that we want to Call. The + ImportContext field contains the active lookup handle, if any. + + Handle - returns the binding handle used on the successfull call. + +Returns: + + + RPC_S_CALL_FAILED_DNE, I_RpcSendReceive() + +--*/ + +{ + RPC_STATUS status; + PRPC_IMPORT_CONTEXT_P Import; + + Import = (PRPC_IMPORT_CONTEXT_P) Message->ImportContext; + + while ((status = I_RpcSendReceive(Message)) != RPC_S_OK && Import) + { + RpcBindingFree(&Import->ProposedHandle); + + // The call failed, try the next binding handle + + while(RpcNsBindingImportNext(Import, &Import->ProposedHandle) + == RPC_S_OK) + { + Message->Handle = Import->ProposedHandle; + + I_RpcReBindBuffer(Message); + continue; + } + + I_RpcFreeBuffer(Message); + + status = RPC_S_CALL_FAILED_DNE; + } + + if (Import) + { + *Handle = Import->ProposedHandle; + RpcNsBindingImportDone(&Message->ImportContext); + } + + if (status) + *Handle = 0; + + return(status); +} + + + +void RPC_ENTRY +I_RpcNsRaiseException( + IN PRPC_MESSAGE Message, + IN RPC_STATUS Status + ) + +/*++ + +Routine Description: + + Raise an Exception for an autobind interface. We simply cleanup any + open import context and raise the exception. + +Arguments: + + Message - continas the import context, if any. + +--*/ + +{ + RpcNsBindingImportDone(&Message->ImportContext); + + RpcRaiseException(Status); +} + + +// BUG BUG implement this is the runtime. + +RPC_STATUS RPC_ENTRY +I_RpcReBindBuffer( + IN PRPC_MESSAGE Message + ) +{ + (void __RPC_FAR *) Message; + + RpcRaiseException(RPC_S_INTERNAL_ERROR); + return(0); +} diff --git a/private/rpc/ndrlib/ccontext.cxx b/private/rpc/ndrlib/ccontext.cxx new file mode 100644 index 000000000..4ac7170e6 --- /dev/null +++ b/private/rpc/ndrlib/ccontext.cxx @@ -0,0 +1,309 @@ +/* -------------------------------------------------------------------- + + Microsoft OS/2 LAN Manager + Copyright(c) Microsoft Corp., 1991 + +-------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- + +Description : + +Provides RPC client side stub context management + +History : + +stevez 01-15-91 First bits into the bucket. + +-------------------------------------------------------------------- */ + +#ifdef NTENV + +extern "C" +{ +#include <sysinc.h> +} + +#else // NTENV + +#include <sysinc.h> + +#endif // NTENV + +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> +#include <util.hxx> +#include <osfpcket.hxx> + +#ifdef NTENV +#include <memory.h> +#endif // NTENV + +#ifdef WIN +#define memset _fmemset +#define memcpy _fmemcpy +#define memcmp _fmemcmp +#endif // WIN + +// The NDR format of a context is a (GUID, long) instead of a pointer +// in the server address space due history. Anyway, we just save this +// cookie, which is sent on the and mapped to and from a pointer +// on the server side. + +#define CONTEXT_MAGIC_VALUE 0xFEDCBA98 + +typedef struct _WIRE_CONTEXT +{ + unsigned long ContextType; + UUID ContextUuid; +} WIRE_CONTEXT; + +typedef struct _CCONTEXT { + + RPC_BINDING_HANDLE hRPC; // binding handle assoicated with context + + unsigned long MagicValue; + WIRE_CONTEXT NDR; + +} CCONTEXT, *PCCONTEXT; + +static unsigned char NilContext[20]; + + +RPC_BINDING_HANDLE RPC_ENTRY +NDRCContextBinding ( + IN NDR_CCONTEXT CContext + ) +/*++ + +Routine Description: + + Given a client context handle, we need to extract the binding from it. + If an addressing exception occurs, we need to return invalid handle + rather than GP-fault. + +Arguments: + + CContext - Supplies the client context handle. + +Return Value: + + The binding handle associated with the supplied client context handle + will be returned. If the client context handle is invalid, then we + raise the RPC_X_SS_CONTEXT_MISMATCH exception. + +--*/ +{ +#ifdef NTENV + + RpcTryExcept + { + if ( ((CCONTEXT PAPI *) CContext)->MagicValue != CONTEXT_MAGIC_VALUE ) + { + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + } + RpcExcept( ( RpcExceptionCode() == STATUS_ACCESS_VIOLATION ) + || ( RpcExceptionCode() == STATUS_DATATYPE_MISALIGNMENT ) ) + { + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + RpcEndExcept + +#else // NTENV + + if ( ( CContext == 0 ) + || ( ((CCONTEXT PAPI *) CContext)->MagicValue != CONTEXT_MAGIC_VALUE ) ) + { + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + +#endif // NTENV + + return(((CCONTEXT PAPI *) CContext)->hRPC); +} + + +void RPC_ENTRY +NDRCContextMarshall ( // copy a context to a buffer + +IN NDR_CCONTEXT hCC, // context to marshell +OUT void PAPI *pBuff // buffer to marshell to + + // Copy the interal representation of a context into a buffer +) //-----------------------------------------------------------------------// +{ +#define hCContext ((CCONTEXT PAPI *) hCC) // cast opeqe pointer to internal + + if (!hCContext) + memset(pBuff, 0, cbNDRContext); + else + { + + // Check the magic value to see if this is a legit context + + RpcTryExcept + { + if ( ((CCONTEXT PAPI *) hCContext)->MagicValue != CONTEXT_MAGIC_VALUE ) + { + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + } + RpcExcept(1) + { + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + RpcEndExcept + + memcpy(pBuff, &hCContext->NDR, sizeof(hCContext->NDR)); + } + +#undef hCContext +} + + +static void +ByteSwapWireContext( + IN WIRE_CONTEXT PAPI * WireContext, + IN unsigned long PAPI * DataRepresentation + ) +/*++ + +Routine Description: + + If necessary, the wire context will be byte swapped in place. + +Arguments: + + WireContext - Supplies the wire context be byte swapped and returns the + resulting byte swapped context. + + DataRepresentation - Supplies the data representation of the supplied wire + context. + +--*/ +{ + if ( (*DataRepresentation & NDR_LITTLE_ENDIAN) + != NDR_LOCAL_ENDIAN ) + { + ByteSwapLong(WireContext->ContextType); + ByteSwapLong(WireContext->ContextUuid.Data1); + ByteSwapShort(WireContext->ContextUuid.Data2); + ByteSwapShort(WireContext->ContextUuid.Data3); + } +} + +void RPC_ENTRY +NDRCContextUnmarshall ( // process returned context + +OUT NDR_CCONTEXT PAPI *phCContext,// stub context to update +IN RPC_BINDING_HANDLE hRPC, // binding handle to associate with +IN void PAPI *pBuff, // pointer to NDR wire format +IN unsigned long DataRepresentation // pointer to NDR data rep + + // Update the users context handle from the servers NDR wire format. +) //-----------------------------------------------------------------------// +{ + PCCONTEXT hCC = (PCCONTEXT) ((long) *phCContext); + + // destory this context if the server returned none + + ByteSwapWireContext((WIRE_CONTEXT PAPI *) pBuff, + (unsigned long PAPI *) &DataRepresentation); + + ASSERT( !RpcpCheckHeap() ); + + if (memcmp(pBuff, NilContext, cbNDRContext) == 0) + { + if (hCC) + { + if (hCC->hRPC) + RpcBindingFree(&(hCC->hRPC)); // discard duplicated binding + + hCC->MagicValue = 0; + I_RpcFree(hCC); + } + + *phCContext = Nil; + return; + } + + PCCONTEXT hCCtemp = 0; + + if (! hCC) // allocate new if none existed + { + hCCtemp = (PCCONTEXT) I_RpcAllocate(sizeof(CCONTEXT)); + + if (hCCtemp == 0) + { + RpcRaiseException(RPC_S_OUT_OF_MEMORY); + } + + hCCtemp->MagicValue = CONTEXT_MAGIC_VALUE; + } + else if (memcmp(&hCC->NDR, pBuff, sizeof(hCC->NDR)) == 0) + { + // the returned context is the same as the app's context. + + return; + } + + + RPC_BINDING_HANDLE hBindtemp ; + + if( I_RpcBindingCopy(hRPC, &hBindtemp) != RPC_S_OK ) + { + ASSERT( !RpcpCheckHeap() ); + I_RpcFree( hCCtemp ); + RpcRaiseException(RPC_S_OUT_OF_MEMORY); + } + + if ( hCCtemp ) + hCC = hCCtemp; + else + RpcBindingFree(&(hCC->hRPC)); + + memcpy(&hCC->NDR, pBuff, sizeof(hCC->NDR)); + hCC->hRPC = hBindtemp; + + ASSERT( !RpcpCheckHeap() ); + + *phCContext = (NDR_CCONTEXT)hCC; +} + + +void RPC_ENTRY +RpcSsDestroyClientContext ( + IN OUT void PAPI * PAPI * ContextHandle + ) +/*++ + +Routine Description: + + A client application will use this routine to destroy a context handle + which it no longer needs. This will work without having to contact the + server. + +Arguments: + + ContextHandle - Supplies the context handle to be destroyed. It will + be set to zero before this routine returns. + +Exceptions: + + If the context handle is invalid, then the RPC_X_SS_CONTEXT_MISMATCH + exception will be raised. + +--*/ +{ + RPC_BINDING_HANDLE BindingHandle; + RPC_STATUS RpcStatus; + + BindingHandle = NDRCContextBinding(*ContextHandle); + + RpcStatus = RpcBindingFree(&BindingHandle); + // ASSERT( RpcStatus == RPC_S_OK ); + + I_RpcFree(*ContextHandle); + *ContextHandle = 0; +} diff --git a/private/rpc/ndrlib/charconv.cxx b/private/rpc/ndrlib/charconv.cxx new file mode 100644 index 000000000..5e6e2edee --- /dev/null +++ b/private/rpc/ndrlib/charconv.cxx @@ -0,0 +1,303 @@ + +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + charconv.cxx + +Abstract: + + Single byte character conversion routines. + +Author: + + Donna Liu (DonnaLi) ??-???-19?? + +Environment: + + This code should execute in all environments supported by RPC + (DOS, Win 3.X, and Win/NT as well as OS2). + +Comments: + + The EBCDIC to ASCII data conversion will not be tested until we + interoperate with some system which speaks EBCDIC. + +Revision history: + + ... (long...) + + Dov Harel 04-24-1992 Added char_array_from_ndr. + Dov Harel 04-24-1992 Fixed both _from_ndr to do EBCDIC => ASCII + conversion. Changed the ebcdic_to_ascii + table to "unsigned char" array type. + Donna Liu 07-23-1992 Added LowerIndex parameter to + <basetype>_array_from_ndr routines + Dov Harel 08-19-1992 Added RpcpMemoryCopy ([_f]memcpy) + to ..._array_from_ndr routines + +--*/ + +#include <string.h> +#include <sysinc.h> +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> + +unsigned char ebcdic_to_ascii[] = +{ +0x20, 0x01, 0x02, 0x03, 0x3f, 0x09, 0x3f, 0x10, +0x3f, 0x3f, 0x3f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, +0x10, 0x11, 0x12, 0x13, 0x3f, 0x3f, 0x08, 0x3f, +0x18, 0x19, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x3f, 0x1c, 0x3f, 0x3f, 0x3f, 0x17, 0x1b, +0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x05, 0x06, 0x07, +0x00, 0x00, 0x16, 0x00, 0x3f, 0x1e, 0x3f, 0x04, +0x3f, 0x3f, 0x3f, 0x3f, 0x14, 0x15, 0x00, 0x1a, +0x20, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x3f, 0x3f, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, +0x26, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x3f, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, +0x2d, 0x2f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x3f, 0x3f, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, +0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, +0x3f, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +0x68, 0x69, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, +0x71, 0x72, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +0x79, 0x7a, 0x3f, 0x3f, 0x3f, 0x5b, 0x3f, 0x3f, +0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x5d, 0x3f, 0x3f, +0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +0x48, 0x49, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, +0x51, 0x52, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x5c, 0x3f, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +0x59, 0x5a, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +0x38, 0x39, 0x7c, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f +}; + +#if !defined(DOS) || defined(WIN) +// +// Due to the DOS NDR1/NDR2 split, this function is now defined for DOS +// in ndr20\dos +// +size_t RPC_ENTRY +MIDL_wchar_strlen ( + IN wchar_t s[] + ) + +{ + size_t i = 0; + + while (s[i] != (wchar_t)0) + { + ++i; + } + + return i; +} +#endif + +void RPC_ENTRY +MIDL_wchar_strcpy ( + OUT void * t, + IN wchar_t * s + ) +{ + while ( *(*(wchar_t **)&t)++ = *s++ ) + ; +} + +void RPC_ENTRY +char_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + OUT unsigned char * Target + ) + +/*++ + +Routine Description: + + Unmarshall a single char from an RPC message buffer into + the target (*Target). This routine: + + o Unmarshalls the char (as unsigned char); performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the unmarshalled char. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the char to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the char which was just unmarshalled. + + Target - A pointer to the char to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + if ( (SourceMessage->DataRepresentation & NDR_CHAR_REP_MASK) == + NDR_EBCDIC_CHAR ) + { + // + // The sender is an EBCDIC system. To convert to ASCII: + // retrieve *(SourceMessage->Buffer) as an unsigned char, and use + // that value to index into the ebcdic_to_ascii table. + // + + *Target = ebcdic_to_ascii[*(unsigned char *)SourceMessage->Buffer]; + } + else + { + // + // The sender is an ASCII system. To unmarshall, just + // copy an unsigned character from the buffer to the Target. + // + + *Target = *(unsigned char *)SourceMessage->Buffer; + } + // + // Advance the buffer pointer before returning + // + + (*(unsigned char**)&SourceMessage->Buffer)++; +} + +// +// end char_from_ndr +// + +void RPC_ENTRY +char_array_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, + OUT unsigned char Target[] + ) + +/*++ + +Routine Description: + + Unmarshall an array of chars from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of shorts (Target[]). This routine: + + o Unmarshalls MemberCount chars; performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the last unmarshalled char. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first char to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last char which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - An array of chars to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + + register unsigned char * MsgBuffer = (unsigned char *)SourceMessage->Buffer; + unsigned int Index; + int byteCount = (int)(UpperIndex - LowerIndex); + + if ( (SourceMessage->DataRepresentation & NDR_CHAR_REP_MASK) == + NDR_EBCDIC_CHAR ) + { + + for (Index = (int)LowerIndex; Index < UpperIndex; Index++) + { + + // + // The sender is an EBCDIC system. To convert to ASCII: + // retrieve *(SourceMessage->Buffer) as an unsigned char, and use + // that value to Index into the ebcdic_to_ascii table. + // + + Target[Index] = + ebcdic_to_ascii[ MsgBuffer[(Index-LowerIndex)] ]; + + } + } + else + { + + RpcpMemoryCopy( + &Target[LowerIndex], + MsgBuffer, + byteCount + ); + + /* Replaced by RpcpMemoryCopy: + + for (Index = LowerIndex; Index < UpperIndex; Index++) + { + + // + // The sender is an ASCII system. To unmarshall, just + // copy an unsigned character from the buffer to the Target. + // + + Target[Index] = MsgBuffer[(Index-LowerIndex)]; + } + */ + + } + // + // Advance the buffer pointer before returning + // + + *(unsigned char **)&SourceMessage->Buffer += byteCount; +} + +// +// end char_array_from_ndr +// + +/* + +// +// Changed name to ..._bytecount. Not currently used. +// + +int MIDL_wchar_bytecount ( + unsigned char s[] + ) + +{ + int i = 0; + + while (s[2*i] || s[2*i+1]) ++i; + + return i; +} + +*/ diff --git a/private/rpc/ndrlib/dataconv.cxx b/private/rpc/ndrlib/dataconv.cxx new file mode 100644 index 000000000..d35dc0299 --- /dev/null +++ b/private/rpc/ndrlib/dataconv.cxx @@ -0,0 +1,1182 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + dataconv.cxx + +Abstract: + + This file contains routines used by the RPC stubs to assist in marshalling + and unmarshalling data to and from an RPC message buffer. Each routine + receives as a parameter a format string which drives its actions. The + valid characters for the format string are : + c - charater + b - byte + w - wide charater or short + l - long + f - float + d - double + s1, s2, sb - string of chars, wide chars, or bytes + z - byte string + )2, )4, )8, + (2, (4, (8, + 1, 2, 4, 8 - various alignment directives + + For more details consult the Network Computing Architecture documentation + on Network Data Representation. + +Author: + + Donna Liu (donnali) 09-Nov-1990 + +Revision History: + + 26-Feb-1992 donnali + + Moved toward NT coding style. + + 09-Jul-1993 DKays + + Made wholesale source level optimizations for speed and size. + +--*/ + +#include <sysinc.h> +#include <rpc.h> +#include <rpcndr.h> + +#if !defined(WIN32) && !defined(MAC) +#define strcpy _fstrcpy +#define strlen _fstrlen +#endif + +// +// alignment macros +// + +#define ALIGN(buffer,increment) \ + (((unsigned long)buffer + increment) & ~ increment); + +#define ALIGN2(buffer) \ + (((unsigned long)buffer + 1) & 0xfffffffe) + +#define ALIGN4(buffer) \ + (((unsigned long)buffer + 3) & 0xfffffffc) + +#define ALIGN8(buffer) \ + (((unsigned long)buffer + 7) & 0xfffffff8) + +// local routines +static unsigned long NdrStrlenStrcpy ( char *, char * ); +static unsigned long NdrWStrlenStrcpy ( wchar_t *, wchar_t * ); + + +void RPC_ENTRY +data_from_ndr ( + PRPC_MESSAGE source, + void * target, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine copies data from the runtime buffer. + +Arguments: + + source - RPC message structure passed from the runtime to the stub. + + target - Buffer to receive the unmarshalled data. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_lower; + unsigned long valid_total; + register char *pSource; + register char *pTarget; + unsigned long pack2, pack4, pack8; + unsigned long pack, align; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack2 = MscPak & 0x1; + pack4 = MscPak & 0x3; + pack8 = MscPak & 0x7; + + if ((source->DataRepresentation & (unsigned long)0X0000FFFF) == + NDR_LOCAL_DATA_REPRESENTATION) + { + + pSource = (char *) source->Buffer; + pTarget = (char *) target; + + for (;;) + { + switch ( *format++ ) + { + case 'b' : + case 'c' : + *((char *)pTarget) = *((char *)pSource); + pTarget += 1; + pSource += 1; + break; + case 'w' : + pSource = (char *) ALIGN2(pSource); + pTarget = (char *) ALIGN(pTarget,pack2); + + *((short *)pTarget) = *((short *)pSource); + pTarget += 2; + pSource += 2; + break; + case 'l' : + case 'f' : + pSource = (char *) ALIGN4(pSource); + pTarget = (char *) ALIGN(pTarget,pack4); + + *((long *)pTarget) = *((long *)pSource); + pTarget += 4; + pSource += 4; + break; + case 'h' : + case 'd' : + pSource = (char *) ALIGN8(pSource); + pTarget = (char *) ALIGN(pTarget,pack8); + +#if defined(DOS) || defined(WIN) + *((DWORD *) pTarget) = *((DWORD *) &pSource); + *(((DWORD *) pTarget) + 1) = *(((DWORD *) &pSource) + 1); +#else + *((__int64 *)pTarget) = *((__int64 *)pSource); +#endif + pTarget += 8; + pSource += 8; + break; + case 's' : + pSource = (char *) ALIGN4(pSource); + + valid_lower = *((long *)pSource); + pSource += 4; + valid_total = *((long *)pSource); + pSource += 4; + + // double the valid_total if this is a wide char string + if ( *format++ == '2' ) + valid_total <<= 1; + + RpcpMemoryCopy(pTarget, + pSource, + valid_total); + pTarget += valid_total; + pSource += valid_total; + break; + case 'z' : + pSource = (char *) ALIGN4(pSource); + + valid_total = *((long *)pSource); + pSource += 4; + + *((int *)pTarget - 1) = (int) valid_total; + + // double the valid_total if this is a wide char string + if ( *format++ == '2' ) + valid_total <<= 1; + + RpcpMemoryCopy(pTarget, + pSource, + valid_total); + pTarget += valid_total; + pSource += valid_total; + break; + case 'p' : + pSource = (char *) ALIGN4(pSource); + pTarget = (char *) ALIGN(pTarget,pack4); + + pTarget += 4; + pSource += 4; + break; + case '(' : + // *format == '2', '4', or '8'; align = 1, 3, or 7 + align = *format - '0' - 1; + pSource = (char *) ALIGN(pSource,align); + case ')' : + switch ( *format++ ) + { + case '8' : + pack = pack8; + break; + case '4' : + pack = pack4; + break; + case '2' : + pack = pack2; + break; + default : + continue; + } + pTarget = (char *) ALIGN(pTarget,pack); + break; + case '8' : + pSource = (char *) ALIGN8(pSource); + break; + case '4' : + pSource = (char *) ALIGN4(pSource); + break; + case '2' : + pSource = (char *) ALIGN2(pSource); + break; + case '1' : + break; + default : + source->Buffer = pSource; + return; + } // switch + } // for + } // if + else + { + for (;;) + { + switch ( *format++ ) + { + case 'b' : + *((char *)target) = *((char *)source->Buffer); + source->Buffer = (void *)((long)source->Buffer + 1); + target = (void *)((long)target + 1); + break; + case 'c' : + char_from_ndr(source,(unsigned char *)target); + target = (void *)((long)target + 1); + break; + case 'w' : + target = (void *) ALIGN(target,pack2); + short_from_ndr(source,(unsigned short *)target); + target = (void *)((long)target + 2); + break; + case 'l' : + target = (void *) ALIGN(target,pack4); + long_from_ndr(source,(unsigned long *)target); + target = (void *)((long)target + 4); + break; + case 'f' : + target = (void *) ALIGN(target,pack4); + float_from_ndr(source, target); + target = (void *)((long)target + 4); + break; + case 'd' : + target = (void *) ALIGN(target,pack8); + double_from_ndr(source, target); + target = (void *)((long)target + 8); + break; + case 'h' : + target = (void *) ALIGN(target,pack8); + hyper_from_ndr(source, (hyper *)target); + target = (void *)((long)target + 8); + break; + case 's' : + long_from_ndr(source, &valid_lower); + long_from_ndr(source, &valid_total); + switch ( *format++ ) + { + case '2' : + short_array_from_ndr (source, + 0, + valid_total, + (unsigned short *)target); + valid_total <<= 1; + break; + case '1' : + char_array_from_ndr (source, + 0, + valid_total, + (unsigned char *)target); + break; + case 'b' : + byte_array_from_ndr(source, + 0, + valid_total, + target); + break; + default : + continue; + } + target = (void *)((long)target + valid_total); + break; + case 'z' : + long_from_ndr(source, &valid_total); + + *((int *)target - 1) = (int) valid_total; + + switch ( *format++ ) + { + case '2' : + short_array_from_ndr(source, + 0, + valid_total, + (unsigned short *)target); + valid_total <<= 1; + break; + case '1' : + byte_array_from_ndr(source, + 0, + valid_total, + target); + break; + } + target = (void *)((long)target + valid_total); + break; + case 'p' : + source->Buffer = (void *) ALIGN4(source->Buffer); + target = (void *) ALIGN(target,pack4); + source->Buffer = (void *)((long)source->Buffer + 4); + target = (void *)((long)target + 4); + break; + case '(' : + // *format == '2', '4', or '8'; align = 1, 3, or 7 + align = *format - '0' - 1; + pSource = (char *) ALIGN(pSource,align); + case ')' : + switch (*format++) + { + case '8' : + pack = pack8; + break; + case '4' : + pack = pack4; + break; + case '2' : + pack = pack2; + break; + default : + continue; + } + target = (void *) ALIGN(target,pack); + break; + case '8' : + source->Buffer = (void *)ALIGN8(source->Buffer); + break; + case '4' : + source->Buffer = (void *)ALIGN4(source->Buffer); + break; + case '2' : + source->Buffer = (void *)ALIGN2(source->Buffer); + break; + case '1' : + break; + default : + return; + } // switch + } // for + } // else +} + + +void RPC_ENTRY +data_into_ndr ( + void * source, + PRPC_MESSAGE target, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine copies data into the runtime buffer. + +Arguments: + + source - Buffer of data to be marshalled into the RPC message. + + target - RPC message structure to be passed to the runtime. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_total; + register char *pSource; + register char *pTarget; + unsigned long pack2, pack4, pack8; + unsigned long increment; + unsigned long pack, align; + + pSource = (char *)source; + pTarget = (char *)target->Buffer; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack2 = MscPak & 0x1; + pack4 = MscPak & 0x3; + pack8 = MscPak & 0x7; + + for (;;) + { + switch (*format++) + { + case 'b' : + case 'c' : + *((char *)pTarget) = *((char *)pSource); + pTarget += 1; + pSource += 1; + break; + case 'w' : + pTarget = (char *) ALIGN2(pTarget); + pSource = (char *) ALIGN(pSource,pack2); + + *((short *)pTarget) = *((short *)pSource); + pTarget += 2; + pSource += 2; + break; + case 'l' : + case 'f' : + pTarget = (char *) ALIGN4(pTarget); + pSource = (char *) ALIGN(pSource,pack4); + + *((long *)pTarget) = *((long *)pSource); + pTarget += 4; + pSource += 4; + break; + case 'h' : + case 'd' : + pTarget = (char *) ALIGN8(pTarget); + pSource = (char *) ALIGN(pSource,pack8); + +#if defined(DOS) || defined(WIN) + *((DWORD *) pTarget) = *((DWORD *) &pSource); + *(((DWORD *) pTarget) + 1) = *(((DWORD *) &pSource) + 1); +#else + *((__int64 *)pTarget) = *((__int64 *)pSource); +#endif + pTarget += 8; + pSource += 8; + break; + case 's' : + pTarget = (char *) ALIGN4(pTarget); + + switch (*format++) + { + case '2' : + valid_total = NdrWStrlenStrcpy((wchar_t *)(pTarget + 8), + (wchar_t *)pSource); + increment = valid_total << 1; + break; + case '1' : + valid_total = NdrStrlenStrcpy(pTarget + 8,pSource); + increment = valid_total; + break; + default : + continue; + } + + *((long *)pTarget) = 0; // offset + pTarget += 4; + *((long *)pTarget) = valid_total; // count + pTarget += 4; + + pTarget += increment; + pSource += increment; + break; + case 'z' : + valid_total = (long) *((int *)pSource - 1); + + pTarget = (char *) ALIGN4(pTarget); + + *((long *)pTarget) = valid_total; + pTarget += 4; + + if ( *format++ == '2' ) + valid_total <<= 1; + + RpcpMemoryCopy(pTarget, + pSource, + valid_total); + pTarget += valid_total; + pSource += valid_total; + break; + case 'p' : + pTarget = (char *) ALIGN4(pTarget); + pSource = (char *) ALIGN(pSource,pack4); + + pTarget += 4; + pSource += 4; + break; + case '(' : + // *format == '2', '4', or '8'; align = 1, 3, or 7 + align = *format - '0' - 1; + pTarget = (char *) ALIGN(pTarget,align); + case ')' : + switch (*format++) + { + case '8' : + pack = pack8; + break; + case '4' : + pack = pack4; + break; + case '2' : + pack = pack2; + break; + default : + continue; + } + pSource = (char *) ALIGN(pSource,pack); + break; + case '8' : + pTarget = (char *) ALIGN8(pTarget); + break; + case '4' : + pTarget = (char *) ALIGN4(pTarget); + break; + case '2' : + pTarget = (char *) ALIGN2(pTarget); + break; + case '1' : + break; + default : + target->Buffer = pTarget; + return; + } // switch + } // for +} + + +void RPC_ENTRY +tree_into_ndr ( + void * source, + PRPC_MESSAGE target, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine copies data into the runtime buffer. + +Arguments: + + source - Buffer of data to be marshalled into the RPC message. + + target - RPC message structure to be passed to the runtime. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_total; + register char *pSource; + register char *pTarget; + unsigned long pack2, pack4, pack8; + unsigned long increment; + + pSource = (char *)source; + pTarget = (char *)target->Buffer; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack2 = MscPak & 0x1; + pack4 = MscPak & 0x3; + pack8 = MscPak & 0x7; + + for (;;) + { + switch (*format++) + { + case 'b' : + case 'c' : + pSource += 1; + break; + case 'w' : + pSource = (char *) ALIGN(pSource,pack2); + pSource += 2; + break; + case 'l' : + case 'f' : + pSource = (char *) ALIGN(pSource,pack4); + pSource += 4; + break; + case 'h' : + case 'd' : + pSource = (char *) ALIGN(pSource,pack8); + pSource += 8; + break; + case 's' : + pSource = (char *) ALIGN(pSource,pack4); + + if ( ! *(void **)pSource ) + { + pSource += 4; + format++; + break; + } + + pTarget = (char *) ALIGN4(pTarget); + + switch (*format++) + { + case '2' : + valid_total = NdrWStrlenStrcpy((wchar_t *)(pTarget+12), + *(wchar_t **)pSource); + increment = valid_total << 1; + break; + case '1' : + valid_total = NdrStrlenStrcpy(pTarget + 12, + *(char **)pSource); + increment = valid_total; + break; + default : + continue; + } + + *((long *)pTarget) = valid_total; // max count + pTarget += 4; + *((long *)pTarget) = 0; // offset + pTarget += 4; + *((long *)pTarget) = valid_total; // actual count + pTarget += 4; + + pSource += 4; + pTarget += increment; + break; + case 'z' : + pSource = (char *) ALIGN(pSource,pack4); + + if ( ! *(void **)pSource ) + { + pSource += 4; + break; + } + + valid_total = (long) *(*(int **)pSource - 1); + + pTarget = (char *) ALIGN4(pTarget); + + *((long *)pTarget) = valid_total; // max count + pTarget += 4; + *((long *)pTarget) = valid_total; // actual count + pTarget += 4; + + if ( *format++ == '2' ) + valid_total <<= 1; + + RpcpMemoryCopy(pTarget, + *(char **)pSource, + valid_total); + pSource += 4; + pTarget += valid_total; + break; + case '(' : + case ')' : + switch (*format++) + { + case '8' : + pSource = (char *) ALIGN(pSource,pack8); + break; + case '4' : + pSource = (char *) ALIGN(pSource,pack4); + break; + case '2' : + pSource = (char *) ALIGN(pSource,pack2); + break; + default : + break; + } + break; + case '8' : + case '4' : + case '2' : + case '1' : + break; + default : + target->Buffer = pTarget; + return; + } // switch + } // for +} + + +void RPC_ENTRY +data_size_ndr ( + void * source, + PRPC_MESSAGE target, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine calculates the size of the runtime buffer. + +Arguments: + + source - Buffer of data to be marshalled into the RPC message. + + target - RPC message structure to be passed to the runtime. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_total; + register char *pSource; + register unsigned long targetLength; + unsigned long pack2, pack4, pack8; + unsigned long pack, align; + + pSource = (char *)source; + targetLength = target->BufferLength; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack2 = MscPak & 0x1; + pack4 = MscPak & 0x3; + pack8 = MscPak & 0x7; + + for (;;) + { + switch (*format++) + { + case 'b' : + case 'c' : + targetLength += 1; + break; + case 'w' : + targetLength = (unsigned long) ALIGN2(targetLength); + pSource = (char *) ALIGN(pSource,pack2); + + targetLength += 2; + pSource += 2; + break; + case 'l' : + case 'f' : + targetLength = (unsigned long) ALIGN4(targetLength); + pSource = (char *) ALIGN(pSource,pack4); + + targetLength += 4; + pSource += 4; + break; + case 'h' : + case 'd' : + targetLength = (unsigned long) ALIGN8(targetLength); + pSource = (char *) ALIGN(pSource,pack8); + + targetLength += 8; + pSource += 8; + break; + case 's' : + switch (*format++) + { + case '2' : + valid_total = MIDL_wchar_strlen((wchar_t *)pSource) + 1; + valid_total <<= 1; + break; + case '1' : + valid_total = strlen(pSource) + 1; + break; + default : + continue; + } + + targetLength = (unsigned long) ALIGN4(targetLength); + + // add string length plus two longs (for offset and count) + targetLength += 8 + valid_total; + break; + case 'z' : + targetLength = (unsigned long) ALIGN4(targetLength); + + valid_total = (long) *((int *)pSource - 1); + if ( *format++ == '2' ) + valid_total <<= 1; + + // add byte string length plus one long (for count) + targetLength += 4 + valid_total; + break; + case 'p' : + targetLength = (unsigned long) ALIGN4(targetLength); + pSource = (char *) ALIGN(pSource,pack4); + + target->Buffer = (void *)((long)target->Buffer + 4); + pSource += 4; + break; + case '(' : + // *format == '2', '4', or '8'; align = 1, 3, or 7 + align = *format - '0' - 1; + targetLength = (unsigned long) ALIGN(targetLength,align); + case ')' : + switch (*format++) + { + case '8' : + pack = pack8; + break; + case '4' : + pack = pack4; + break; + case '2' : + pack = pack2; + break; + default : + continue; + } + pSource = (char *) ALIGN(pSource,pack); + break; + case '8' : + targetLength = (unsigned long) ALIGN8(targetLength); + break; + case '4' : + targetLength = (unsigned long) ALIGN4(targetLength); + break; + case '2' : + targetLength = (unsigned long) ALIGN2(targetLength); + break; + case '1' : + break; + default : + target->BufferLength = targetLength; + return; + } // switch + } // for +} + + +void RPC_ENTRY +tree_size_ndr ( + void * source, + PRPC_MESSAGE target, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine calculates the size of the runtime buffer. + +Arguments: + + source - Buffer of data to be marshalled into the RPC message. + + target - RPC message structure to be passed to the runtime. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_total; + register char *pSource; + unsigned long pack2, pack4, pack8; + + pSource = (char *)source; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack2 = MscPak & 0x1; + pack4 = MscPak & 0x3; + pack8 = MscPak & 0x7; + + for (;;) + { + switch (*format++) + { + case 'b' : + case 'c' : + pSource += 1; + break; + case 'w' : + pSource = (char *) ALIGN(pSource,pack2); + pSource += 2; + break; + case 'l' : + case 'f' : + pSource = (char *) ALIGN(pSource,pack4); + pSource += 4; + break; + case 'h' : + case 'd' : + pSource = (char *) ALIGN(pSource,pack8); + pSource += 8; + break; + case 's' : + pSource = (char *) ALIGN(pSource,pack4); + + if ( ! *(void __RPC_FAR * __RPC_FAR *)pSource ) + { + pSource += 4; + format++; + break; + } + + switch (*format++) + { + case '2' : + valid_total = MIDL_wchar_strlen( + *(wchar_t __RPC_FAR * __RPC_FAR *)pSource)+1; + valid_total <<= 1; + break; + case '1' : + valid_total = + strlen (*(char __RPC_FAR * __RPC_FAR *)pSource) + 1; + break; + default : + continue; + } + + target->BufferLength = (unsigned int) + ALIGN4(target->BufferLength); + + // add string length plus 3 longs (max count, offset, and + // actual count) + target->BufferLength += 12 + valid_total; + pSource += 4; + break; + case 'z' : + pSource = (char *) ALIGN(pSource,pack4); + + if ( ! *(void __RPC_FAR * __RPC_FAR *)pSource ) + { + pSource += 4; + break; + } + + valid_total = (long) *(*(int **)pSource - 1); + if ( *format++ == '2' ) + valid_total <<= 1; + + target->BufferLength = (unsigned int) + ALIGN4(target->BufferLength); + + // add string length plus 2 longs (max count and actual count) + target->BufferLength += 8 + valid_total; + pSource += 4; + break; + case '(' : + case ')' : + switch (*format++) + { + case '8' : + pSource = (char *) ALIGN(pSource,pack8); + break; + case '4' : + pSource = (char *) ALIGN(pSource,pack4); + break; + case '2' : + pSource = (char *) ALIGN(pSource,pack2); + break; + default : + break; + } + break; + case '8' : + case '4' : + case '2' : + case '1' : + break; + default : + return; + } + } +} + + +void RPC_ENTRY +tree_peek_ndr ( + PRPC_MESSAGE source, + unsigned char ** buffer, + char * format, + unsigned char MscPak) +/*++ + +Routine Description: + + This routine peeks the runtime buffer. + +Arguments: + + source - RPC message structure passed from the runtime to the stubs. + + target - Buffer to receive the unmarshalled data. + + format - Format of the data. + + MscPak - Packing level. + +--*/ +{ + unsigned long valid_total; + register unsigned char *pBuffer; + unsigned long pack8; + int IsString; + + pBuffer = *buffer; + + // pre-compute the possible alignment masks + if ( MscPak ) + MscPak--; + pack8 = MscPak & 0x7; + + IsString = (*format == 's' || *format == 'z'); + + for (;;) + { + switch (*format++) + { + case 'b' : + case 'c' : + pBuffer += 1; + break; + case 'w' : + pBuffer = (unsigned char *) ALIGN2(pBuffer); + pBuffer += 2; + break; + case 'l' : + case 'f' : + pBuffer = (unsigned char *) ALIGN4(pBuffer); + pBuffer += 4; + break; + case 'h' : + case 'd' : + pBuffer = (unsigned char *) ALIGN8(pBuffer); + pBuffer += 8; + break; + case 's' : + if ( ! IsString ) + { + pBuffer = (unsigned char *) ALIGN4(pBuffer); + if ( ! *(long *)pBuffer ) + { + pBuffer += 4; + format++; + break; + } + pBuffer += 4; + long_from_ndr (source, &valid_total); // max count (ignore) + } + + long_from_ndr (source, &valid_total); // offset (ignore) + long_from_ndr (source, &valid_total); // actual count + + // if it's a wide char string + if ( *format++ == '2' ) + { + // wide char string must be aligned on at least a + // short boundary + if ( ! MscPak ) + pack8 = 0x1; + valid_total <<= 1; + } + + source->BufferLength = (unsigned int) + ALIGN(source->BufferLength,pack8); + + *((unsigned long *)pBuffer - 1) = source->BufferLength; + source->BufferLength += valid_total; + source->Buffer = (void *)((long)source->Buffer + valid_total); + break; + case 'z' : + if ( ! IsString ) + { + pBuffer = (unsigned char *) ALIGN4(pBuffer); + if ( ! *(long *)pBuffer ) + { + pBuffer += 4; + format++; + break; + } + pBuffer += 4; + long_from_ndr (source, &valid_total); // max count (ignore) + } + + long_from_ndr (source, &valid_total); // actual count + + // if it's a wide byte string + if ( *format++ == '2' ) + { + // wide byte string must be aligned on at least a + // short boundary + if ( ! MscPak ) + pack8 = 0x1; + valid_total <<= 1; + } + + source->BufferLength = (unsigned int) + ALIGN(source->BufferLength,pack8); + + *((unsigned long *)pBuffer - 1) = source->BufferLength; + source->BufferLength += valid_total; + source->Buffer = (void *)((long)source->Buffer + valid_total); + break; + case '(' : + switch (*format++) + { + case '8' : + pBuffer = (unsigned char *) ALIGN8(pBuffer); + break; + case '4' : + pBuffer = (unsigned char *) ALIGN4(pBuffer); + break; + case '2' : + pBuffer = (unsigned char *) ALIGN2(pBuffer); + break; + default : + break; + } + break; + case ')' : + format++; + break; + case '8' : + pBuffer = (unsigned char *) ALIGN8(pBuffer); + break; + case '4' : + pBuffer = (unsigned char *) ALIGN4(pBuffer); + break; + case '2' : + pBuffer = (unsigned char *) ALIGN2(pBuffer); + break; + case '1' : + break; + default : + *buffer = pBuffer; + return; + } + } +} + +static unsigned long NdrStrlenStrcpy ( char *pTarget, + char *pSource ) +{ + register unsigned int count; + + for ( count = 1; *pTarget++ = *pSource++; count++ ) + ; + + return count; +} + +static unsigned long NdrWStrlenStrcpy ( wchar_t *pTarget, + wchar_t *pSource ) +{ + register unsigned int count; + + for ( count = 1; *pTarget++ = *pSource++; count++ ) + ; + + return count; +} diff --git a/private/rpc/ndrlib/dos/depend.mk b/private/rpc/ndrlib/dos/depend.mk new file mode 100644 index 000000000..14aac9e08 --- /dev/null +++ b/private/rpc/ndrlib/dos/depend.mk @@ -0,0 +1,78 @@ +help.obj help.lst: ../help.c $(DOS_INC)/memory.h + +floatc.obj floatc.lst: ../floatc.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/dos/rpc.h \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h ../../ndr20/cvt.h + +dataconv.obj dataconv.lst: ../dataconv.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/dos/rpc.h \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h + +charconv.obj charconv.lst: ../charconv.cxx $(DOS_INC)/string.h \ + $(PUBLIC)/inc/poppack.h $(PUBLIC)/inc/pshpack4.h \ + $(PUBLIC)/inc/rpcdce.h $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h \ + $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h + +ccontext.obj ccontext.lst: ../ccontext.cxx $(DOS_INC)/memory.h \ + $(PUBLIC)/inc/poppack.h $(PUBLIC)/inc/pshpack4.h \ + $(PUBLIC)/inc/rpcdce.h $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h \ + $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/util.hxx + +autohand.obj autohand.lst: ../autohand.cxx $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h + +ndrhelp.obj ndrhelp.lst: ../ndrhelp.c $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h ../ndrhelp.h + +linklist.obj linklist.lst: ../linklist.cxx $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/linklist.hxx \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/util.hxx + +intconv.obj intconv.lst: ../intconv.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/dos/rpc.h \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h + +ndrtest.obj ndrtest.lst: ../ndrtest.cxx $(DOS_INC)/malloc.h \ + $(DOS_INC)/stdio.h $(DOS_INC)/stdlib.h $(DOS_INC)/string.h \ + $(PUBLIC)/inc/poppack.h $(PUBLIC)/inc/pshpack4.h \ + $(PUBLIC)/inc/rpcdce.h $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h \ + $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + ../../ndr20/cvt.h ../../ndr20/cvtpvt.h + +scontext.obj scontext.lst: ../scontext.cxx $(DOS_INC)/memory.h \ + $(PUBLIC)/inc/issper16.h $(PUBLIC)/inc/issperr.h \ + $(PUBLIC)/inc/kerbcon.h $(PUBLIC)/inc/kerberos.h \ + $(PUBLIC)/inc/ntlmsp.h $(PUBLIC)/inc/ntlsa.h $(PUBLIC)/inc/ntmsv1_0.h \ + $(PUBLIC)/inc/ntsam.h $(PUBLIC)/inc/poppack.h $(PUBLIC)/inc/pshpack4.h \ + $(PUBLIC)/inc/rpcdce.h $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h \ + $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h $(PUBLIC)/inc/secext.h \ + $(PUBLIC)/inc/secobjs.h $(PUBLIC)/inc/secpkg.h \ + $(PUBLIC)/inc/security.h $(PUBLIC)/inc/sspi.h \ + $(RPC)/runtime/mtrt/dos/rpc.h $(RPC)/runtime/mtrt/interlck.hxx \ + $(RPC)/runtime/mtrt/linklist.hxx $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcssp.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/threads.hxx $(RPC)/runtime/mtrt/util.hxx + diff --git a/private/rpc/ndrlib/dos/makefile b/private/rpc/ndrlib/dos/makefile new file mode 100644 index 000000000..68cc1c929 --- /dev/null +++ b/private/rpc/ndrlib/dos/makefile @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : makefile. +# +# Title : Makefile for the DOS stub library. +# +# History : +# mikemon 01-30-91 Beginning of recorded history. +# mikemon 02-02-91 Modifies to obey the build rules. +# dovh 04-30-92 Modified to reflect recent changes: +# o Split charconv.cxx into +# dataconv, charconv, & intconv (.cxx) +# o Added Digital / DCE data conversion +# (Floating Pt. & Int conversion) +# brucemc 05-21-92 Added C7 support and cleaned up. +# +# -------------------------------------------------------------------- + +DOS=1 + +!include ..\rules.mk + +CFLAGS =$(CFLAGS) -NTNDRLIB_Text +CXXFLAGS =$(CXXFLAGS) -NTNDRLIB_Text + +# -------------------------------------------------------------------- +# Targets required by build process. + +all : RpcNdrP.lib RpcNdr10.lib + +depend : + $(INCLUDES) $(INCLUDESFLAGS) ..\*.c ..\*.cxx > depend.mk + +tree : + copy rpcndr10.lib $(RPCDIST)\dos\lib + +# -------------------------------------------------------------------- +# Dependancies + +RpcNdrP.lib : ccontext.obj autohand.obj + -del $@ 2>nul + $(LIBRARIAN) $(LIBFLAGS) $@+$(**: =+) ; + +RpcNdr10.lib : charconv.obj floatc.obj helpx86.obj \ + dataconv.obj intconv.obj + -del $@ 2>nul + $(LIBRARIAN) $(LIBFLAGS) $@+$(**: =+) ; + +!include depend.mk + diff --git a/private/rpc/ndrlib/floatc.cxx b/private/rpc/ndrlib/floatc.cxx new file mode 100644 index 000000000..5be884d2a --- /dev/null +++ b/private/rpc/ndrlib/floatc.cxx @@ -0,0 +1,698 @@ + +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + floatc.cxx + +Abstract: + + Float and double conversion routines. + +Author: + + Dov Harel (DovH) 23-Apr-1992 + +Environment: + + This code should execute in all environments supported by RPC + (DOS, Win 3.X, and Win/NT as well as OS2). + +Comments: + + This file was completely rewritten to incorporate DCE floating + point conversion. Currently the only supported DCE interoperation + is with DEC system. The vax conversion routines used + (cvt_vax_f_to_ieee_single, and cvt_vax_g_to_ieee_double) + were supplied by Digital, and are used for full compatibility with + DCE RPC. (See name.map for Digital files used). + + Also added floating point array conversion routines. + +Revision history: + + Donna Liu 07-23-1992 Added LowerIndex parameter to + <basetype>_array_from_ndr routines + Dov Harel 08-19-1992 Added RpcpMemoryCopy ([_f]memcpy) + to ..._array_from_ndr routines + Dov Harel 08-25-1992 Added byte swapping for IEEE big endian + machines (such as HP). + +--*/ + +#include <sysinc.h> +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> +START_C_EXTERN +#include <..\ndr20\cvt.h> +END_C_EXTERN + +// +// For longs assume the following 32-bit word layout: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+---------------+---------------+ +// | A | B | C | D | +// +---------------+---------------+---------------+---------------+ +// +// +// Masks defined for long byte swapping: +// + +#define MASK_AB__ (unsigned long)0XFFFF0000L +#define MASK___CD (unsigned long)0X0000FFFFL +#define MASK_A_C_ (unsigned long)0XFF00FF00L +#define MASK__B_D (unsigned long)0X00FF00FFL + +// +// #define NDR_CHAR_REP_MASK (unsigned long)0X0000000FL +// #define NDR_INT_REP_MASK (unsigned long)0X000000F0L +// #define NDR_FLOAT_REP_MASK (unsigned long)0X0000FF00L +// +// #define NDR_LITTLE_ENDIAN (unsigned long)0X00000010L +// #define NDR_BIG_ENDIAN (unsigned long)0X00000000L +// +// #define NDR_IEEE_FLOAT (unsigned long)0X00000000L +// #define NDR_VAX_FLOAT (unsigned long)0X00000100L +// +// #define NDR_ASCII_CHAR (unsigned long)0X00000000L +// #define NDR_EBCDIC_CHAR (unsigned long)0X00000001L +// +// #define NDR_LOCAL_DATA_REPRESENTATION (unsigned long)0X00000010L +// + +#define NDR_FLOAT_INT_MASK (unsigned long)0X0000FFF0L + +#define NDR_BIG_IEEE_REP (unsigned long)0X00000000L +#define NDR_LITTLE_IEEE_REP (unsigned long)0X00000010L + +void RPC_ENTRY +NdrpLongByteSwap( + IN void PAPI * Source, + OUT void PAPI * Target + ) + +/*++ + +Routine Description: + + Assuming both Source and Target point to aligned unsigned longs, + move the bytes of *Source into *Target in reverse oreder. The value + of (*Target) following the call is the bate swapped value of + (*Source). + +Arguments: + + Source - A pointer to an aligned unsigned long. + + Target - A pointer to the long to swap the *Source bytes into. + +Return Values: + + None. + +--*/ + +{ + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)Target = + (*(unsigned long *)Source & MASK_A_C_) >> 8 | + (*(unsigned long *)Source & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + + *(unsigned long *)Target = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + +} + +// +// end NdrpLongByteSwap +// + +/* + +// +// Relevant definitions from cvt.h (Digital): +// + +typedef unsigned char CVT_BYTE; +typedef CVT_BYTE *CVT_BYTE_PTR; + +typedef CVT_BYTE CVT_VAX_F[4]; +typedef CVT_BYTE CVT_VAX_D[8]; +typedef CVT_BYTE CVT_VAX_G[8]; + +typedef CVT_BYTE CVT_IEEE_SINGLE[4]; +typedef CVT_BYTE CVT_IEEE_DOUBLE[8]; + +// +// Relevant definitions from vaxout.c +// (previous floating point conversion test): +// + +CVT_VAX_F inputf; +CVT_IEEE_SINGLE outputf; +CVT_VAX_G inputg; +CVT_IEEE_DOUBLE outputg; + +cvt_vax_f_to_ieee_single( inputf, 0, outputf ); +cvt_vax_g_to_ieee_double( inputg, 0, outputg ); + +*/ + + +void RPC_ENTRY +float_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + OUT void * Target + ) + +/*++ + +Routine Description: + + Unmarshall a float from an RPC message buffer into the target + (*Target). This routine: + + o Aligns the buffer pointer to the next (0 mod 4) boundary. + o Unmarshalls the float; performs data conversion if necessary + (only VAX and IEEE Big Endian conversion currently supported). + o Advances the buffer pointer to the address immediately + following the unmarshalled float. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the float to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the float which was just unmarshalled. + + Target - A pointer to the float to unmarshall the data into. + A (void*) pointer is used, so that the runtime library code + is not loaded, unless the application code actually uses + floating point. + +Return Values: + + None. + +--*/ + +{ + unsigned char PAPI * F_Input = + (unsigned char *)SourceMessage->Buffer; + + unsigned char PAPI * F_Output = (unsigned char PAPI *)Target; + // CVT_IEEE_SINGLE F_Output = (unsigned char PAPI *)Target; + + unsigned long SenderDataRepresentation; + + // + // Align F_Input to next (0 mod 4) address + // + + *(unsigned long *)&F_Input += 3; + *(unsigned long *)&F_Input &= 0XFFFFFFFCL; + + if ( ( (SenderDataRepresentation = SourceMessage->DataRepresentation) & + NDR_FLOAT_INT_MASK ) == NDR_LITTLE_IEEE_REP ) + // + // Robust check for little endian IEEE (local data representation) + // + + { + *(unsigned long *)Target = *(unsigned long*)F_Input; + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_REP_MASK) == + NDR_VAX_FLOAT ) + { + cvt_vax_f_to_ieee_single(F_Input, 0, F_Output); + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_INT_MASK) == + NDR_BIG_IEEE_REP ) + // + // Big endian IEEE sender: + // + + { + NdrpLongByteSwap(F_Input, F_Output); + } + + else + { + RpcRaiseException( RPC_X_BAD_STUB_DATA ); + } + + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = F_Input + 4; +} + +// +// end float_from_ndr +// + +void RPC_ENTRY +float_array_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, + OUT void * Target + ) + +/*++ + +Routine Description: + + Unmarshall an array of floats from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of floats (Target[]). This routine: + + o Aligns the buffer pointer to the next (0 mod 4) boundary, + o Unmarshalls MemberCount floats; performs data + conversion if necessary (Currently VAX format only), and + o Advances the buffer pointer to the address immediately + following the last unmarshalled float. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first float to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last float which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - A pointer to an array of floats to unmarshall the data into. + A (void*) pointer is used, so that the runtime library code + is not loaded, unless the application code actually uses + floating point. + +Return Values: + + None. + +--*/ + +{ + unsigned char PAPI * F_Input = + (unsigned char PAPI *)SourceMessage->Buffer; + + unsigned char PAPI * F_Output = (unsigned char PAPI *)Target; + + register unsigned int Index; + unsigned long SenderDataRepresentation; + + // + // Align F_Input to next (0 mod 4) address + // + + *(unsigned long *)&F_Input += 3; + *(unsigned long *)&F_Input &= 0XFFFFFFFCL; + + if ( ( (SenderDataRepresentation = SourceMessage->DataRepresentation) & + NDR_FLOAT_INT_MASK ) == NDR_LITTLE_IEEE_REP ) + // + // Robust check for little endian IEEE (local data representation) + // + { + + int byteCount = 4*(int)(UpperIndex - LowerIndex); + + RpcpMemoryCopy( + F_Output, + F_Input, + byteCount + ); + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)(F_Input + byteCount); + + /* Replaced by RpcpMemoryCopy: + + for (Index = LowerIndex; Index < UpperIndex; Index++) + { + ((unsigned long *)F_Output)[Index] = + *(unsigned long *)F_Input; + + F_Input += 4; + + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = F_Input; + */ + + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_REP_MASK) == + NDR_VAX_FLOAT ) + { + F_Output += 4 * LowerIndex; + for (Index = (int)LowerIndex; Index < UpperIndex; Index++) + { + cvt_vax_f_to_ieee_single(F_Input, 0, F_Output); + + F_Input += 4; + F_Output += 4; + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = F_Input; + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_INT_MASK) == + NDR_BIG_IEEE_REP ) + // + // Big endian IEEE sender: + // + + { + F_Output += 4 * LowerIndex; + for (Index = (int)LowerIndex; Index < UpperIndex; Index++) + { + NdrpLongByteSwap(F_Input, F_Output); + + F_Input += 4; + F_Output += 4; + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = F_Input; + } + + else + { + RpcRaiseException( RPC_X_BAD_STUB_DATA ); + } + +} + +// +// end float_array_from_ndr +// + +void RPC_ENTRY +double_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + OUT void * Target + ) + +/*++ + +Routine Description: + + Unmarshall a double from an RPC message buffer into the target + (*Target). This routine: + + o Aligns the buffer pointer to the next (0 mod 8) boundary. + o Unmarshalls the double; performs data conversion if necessary + (only VAX conversion currently supported). + o Advances the buffer pointer to the address immediately + following the unmarshalled double. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the double to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the double which was just unmarshalled. + + Target - A pointer to the double to unmarshall the data into. + A (void*) pointer is used, so that the runtime library code + is not loaded, unless the application code actually uses + floating point. + +Return Values: + + None. + +--*/ + +{ + unsigned char PAPI * D_Input = + (unsigned char PAPI *)SourceMessage->Buffer; + + unsigned char PAPI * D_Output = (unsigned char PAPI *)Target; + + unsigned long SenderDataRepresentation; + + // + // Align D_Input to next (0 mod 8) address + // + + *(unsigned long *)&D_Input += 7; + *(unsigned long *)&D_Input &= 0XFFFFFFF8L; + + if ( ( (SenderDataRepresentation = SourceMessage->DataRepresentation) & + NDR_FLOAT_INT_MASK ) == NDR_LITTLE_IEEE_REP ) + // + // Robust check for little endian IEEE (local data representation) + // + { + ((unsigned long *)Target)[0] = ((unsigned long*)D_Input)[0]; + ((unsigned long *)Target)[1] = ((unsigned long*)D_Input)[1]; + } + + else if ( (SourceMessage->DataRepresentation & NDR_FLOAT_REP_MASK) == + NDR_VAX_FLOAT ) + { + cvt_vax_g_to_ieee_double(D_Input, 0, D_Output); + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_INT_MASK) == + NDR_BIG_IEEE_REP ) + // + // Big endian IEEE sender: + // + + { + // + // Swap the low half of D_Input into the high half of D_Output + // + NdrpLongByteSwap( + &((unsigned long*)D_Input)[0], + &((unsigned long *)Target)[1] + ); + + // + // Swap the high half of D_Input into the low half of D_Output + // + NdrpLongByteSwap( + &((unsigned long*)D_Input)[1], + &((unsigned long *)Target)[0] + ); + } + + else + { + RpcRaiseException( RPC_X_BAD_STUB_DATA ); + } + + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = D_Input + 8; +} + +// +// end double_from_ndr +// + +void RPC_ENTRY +double_array_from_ndr ( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, + OUT void * Target + ) + +/*++ + +Routine Description: + + Unmarshall an array of doubles from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of (Target[]). This routine: + + o Aligns the buffer pointer to the next (0 mod 8) boundary, + o Unmarshalls MemberCount doubles; performs data + conversion if necessary (Currently VAX format only), and + o Advances the buffer pointer to the address immediately + following the last unmarshalled double. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first double to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last double which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - A pointer to an array of doubles to unmarshall the data into. + A (void*) pointer is used, so that the runtime library code + is not loaded, unless the application code actually uses + floating point. + +Return Values: + + None. + +--*/ + +{ + unsigned char PAPI * D_Input = + (unsigned char PAPI *)SourceMessage->Buffer; + + unsigned char PAPI * D_Output = (unsigned char PAPI *)Target; + + register unsigned int Index; + unsigned long SenderDataRepresentation; + + // + // Align D_Input to next (0 mod 8) address + // + + *(unsigned long *)&D_Input += 7; + *(unsigned long *)&D_Input &= 0XFFFFFFF8L; + + if ( ( (SenderDataRepresentation = SourceMessage->DataRepresentation) & + NDR_FLOAT_INT_MASK ) == NDR_LITTLE_IEEE_REP ) + // + // Robust check for little endian IEEE (local data representation) + // + { + + int byteCount = 8*(int)(UpperIndex - LowerIndex); + + RpcpMemoryCopy( + D_Output, + D_Input, + byteCount + ); + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)(D_Input + byteCount); + + /* Replaced by RpcpMemoryCopy: + + for (Index = LowerIndex; Index < UpperIndex; Index++) + { + ((unsigned long *)D_Output)[(Index * 2)] = + *(unsigned long *)D_Input; + + D_Input += 4; + + ((unsigned long *)D_Output)[(Index * 2 + 1)] = + *((unsigned long *)D_Input) ; + + D_Input += 4; + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = D_Input; + */ + + } + + else if ( (SourceMessage->DataRepresentation & NDR_FLOAT_REP_MASK) == + NDR_VAX_FLOAT ) + { + for (Index = (int)LowerIndex; Index < UpperIndex; Index++) + { + cvt_vax_g_to_ieee_double(D_Input, 0, D_Output); + + D_Input += 8; + D_Output += 8; + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = D_Input; + } + + else if ( (SenderDataRepresentation & NDR_FLOAT_INT_MASK) == + NDR_BIG_IEEE_REP ) + // + // Big endian IEEE sender: + // + + { + for (Index = (int)LowerIndex; Index < UpperIndex; Index++) + { + NdrpLongByteSwap( + &((unsigned long PAPI *)D_Input)[0], + &((unsigned long PAPI *)D_Output)[1] + ); + + NdrpLongByteSwap( + &((unsigned long PAPI *)D_Input)[1], + &((unsigned long PAPI *)D_Output)[0] + ); + + D_Input += 8; + D_Output += 8; + } + // + // Advance the buffer pointer before returning: + // + + SourceMessage->Buffer = D_Input; + } + + else + { + RpcRaiseException( RPC_X_BAD_STUB_DATA ); + } + +} + +// +// end double_array_from_ndr +// diff --git a/private/rpc/ndrlib/help.c b/private/rpc/ndrlib/help.c new file mode 100644 index 000000000..32ddfab76 --- /dev/null +++ b/private/rpc/ndrlib/help.c @@ -0,0 +1,25 @@ +#ifdef WIN32 + +#include <memory.h> + +void +NDRcopy ( + void *pDest, + void *pSrc, + int cb + ) +{ + memcpy(pDest, pSrc, cb); +} + +#else // WIN32 + +void * memcpy(void far *, void far *, int); +#pragma intrinsic(memcpy) + +void pascal NDRopy(void far *pDest, void far *pSrc, int cb) +{ + memcpy(pDest, pSrc, cb); +} + +#endif // WIN32 diff --git a/private/rpc/ndrlib/helpx86.asm b/private/rpc/ndrlib/helpx86.asm new file mode 100644 index 000000000..336717c82 --- /dev/null +++ b/private/rpc/ndrlib/helpx86.asm @@ -0,0 +1,13 @@ +.model large, pascal +.code + +NDRcopy proc uses si di ds, pTarget:ptr, pSource:ptr, cb:word + + les di,pTarget + lds si,pSource + mov cx, cb + rep movsb + ret + +NDRcopy endp + end diff --git a/private/rpc/ndrlib/intconv.cxx b/private/rpc/ndrlib/intconv.cxx new file mode 100644 index 000000000..0d12c573b --- /dev/null +++ b/private/rpc/ndrlib/intconv.cxx @@ -0,0 +1,1239 @@ + +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + intconv.c + +Abstract: + + Short and long conversion routines. + +Author: + + Dov Harel (DovH) 21-Apr-1992 + +Environment: + + This code should execute in all environments supported by RPC + (DOS, Win 3.X, and Win/NT as well as OS2). + +Comments: + + Split charconv.cxx into + + charconv.cxx - Character related conversion. + intconv.cxx - Integral type conversion. + dataconv.cxx - Interpretation style converstion. + +Revision history: + + Donna Liu 07-23-1992 Added LowerIndex parameter to + <basetype>_array_from_ndr routines + Dov Harel 08-19-1992 Added RpcpMemoryCopy ([_f]memcpy) + to ..._array_from_ndr routines + Ryszard Kott 06-15-1993 Added hyper support + +--*/ + +#include <sysinc.h> +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> + +// +// Definitions from rpcndr.h +// +// Network Computing Architecture (NCA) definition: +// +// Network Data Representation: (NDR) Label format: +// An unsigned long (32 bits) with the following layout: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+---------------+-------+-------+ +// | Reserved | Reserved |Floating point | Int | Char | +// | | |Representation | Rep. | Rep. | +// +---------------+---------------+---------------+-------+-------+ +// +// Where +// +// Reserved: +// +// Must be zero (0) for NCA 1.5 and NCA 2.0. +// +// Floating point Representation is: +// +// 0 - IEEE +// 1 - VAX +// 2 - Cray +// 3 - IBM +// +// Int Rep. is Integer Representation: +// +// 0 - Big Endian +// 1 - Little Endian +// +// Char Rep. is Character Representation: +// +// 0 - ASCII +// 1 - EBCDIC +// +// #define NDR_CHAR_REP_MASK (unsigned long)0X0000000FL +// #define NDR_INT_REP_MASK (unsigned long)0X000000F0L +// #define NDR_FLOAT_REP_MASK (unsigned long)0X0000FF00L +// +// #define NDR_LITTLE_ENDIAN (unsigned long)0X00000010L +// #define NDR_BIG_ENDIAN (unsigned long)0X00000000L +// +// #define NDR_IEEE_FLOAT (unsigned long)0X00000000L +// #define NDR_VAX_FLOAT (unsigned long)0X00000100L +// +// #define NDR_ASCII_CHAR (unsigned long)0X00000000L +// #define NDR_EBCDIC_CHAR (unsigned long)0X00000001L +// +// #define NDR_LOCAL_DATA_REPRESENTATION (unsigned long)0X00000010L +// + +// +// For shorts assume the following 16-bit word layout: +// +// 1 1 1 1 1 1 +// 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+ +// | A | B | +// +---------------+---------------+ +// +// For longs assume the following 32-bit word layout: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+---------------+---------------+ +// | A | B | C | D | +// +---------------+---------------+---------------+---------------+ +// + +// +// Masks defined for short byte swapping: +// + +#define MASK_A_ (unsigned short)0XFF00 +#define MASK__B (unsigned short)0X00FF + +// +// Masks defined for long byte swapping: +// + +#define MASK_AB__ (unsigned long)0XFFFF0000L +#define MASK___CD (unsigned long)0X0000FFFFL +#define MASK_A_C_ (unsigned long)0XFF00FF00L +#define MASK__B_D (unsigned long)0X00FF00FFL + +void RPC_ENTRY +short_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + OUT unsigned short * Target + ) + +/*++ + +Routine Description: + + Unmarshall a short from an RPC message buffer into the target + (*Target). This routine: + + o Aligns the buffer pointer to the next (0 mod 2) boundary, + o Unmarshalls the short (as unsigned short); performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the unmarshalled short. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the short to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the short which was just unmarshalled. + + Target - A pointer to the short to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + // size on NT i386: 0X44 (68 bytes) + + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + + aBuffer++; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFEL); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + // + // Swap bytes: (AB => BA) + // + + *(unsigned short *)Target = + (*(unsigned short *)aBuffer & MASK_A_) >> 8 | + (*(unsigned short *)aBuffer & MASK__B) << 8 ; + + } + else + { + *(short *)Target = *((short *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + + // + // BUGBUG: cl386 barfs on the following (increment of cast (not an lvalue)! + // + // SourceMessage->Buffer = ++((short *)aBuffer); + + SourceMessage->Buffer = aBuffer + 2; +} + +// +// end short_from_ndr +// + +void RPC_ENTRY +short_array_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, + OUT unsigned short *Target + ) + +/*++ + +Routine Description: + + Unmarshall an array of shorts from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of shorts (Target[]). This routine: + + o Aligns the buffer pointer to the next (0 mod 2) boundary, + o Unmarshalls MemberCount shorts; performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the last unmarshalled short. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first short to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last short which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - An array of shorts to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + register unsigned int index; + + aBuffer++; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFEL); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + // + // Big Endian Sender + // + + for (index = (int)LowerIndex; index < UpperIndex; index++) + { + // + // Swap bytes: (AB => BA) + // + + Target[index] = + (*(unsigned short *)aBuffer & MASK_A_) >> 8 | + (*(unsigned short *)aBuffer & MASK__B) << 8 ; + + // + // BUGBUG cfront + cl386! + // ((unsigned short *)aBuffer)++; + // + + aBuffer += 2; + + } + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)aBuffer; + + } + else + { + + int byteCount = 2*(int)(UpperIndex - LowerIndex); + + RpcpMemoryCopy( + &Target[LowerIndex], + aBuffer, + byteCount + ); + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)(aBuffer + byteCount); + + /* Replaced by RpcpMemoryCopy: + + for (index = LowerIndex; index < UpperIndex; index++) + { + Target[index] = *(unsigned short *)aBuffer; + + aBuffer += 2; + + } + + SourceMessage->Buffer = (void PAPI *)aBuffer; + + */ + + } +} + +// +// end short_array_from_ndr +// + +void RPC_ENTRY +short_from_ndr_temp ( + IN OUT unsigned char ** source, + OUT unsigned short * target, + IN unsigned long format + ) +{ + +/*++ + +Routine Description: + + Unmarshall a short from a given buffer into the target + (*target). This routine: + + o Aligns the *source pointer to the next (0 mod 2) boundary, + o Unmarshalls a short (as unsigned short); performs data + conversion if necessary, and + o Advances the *source pointer to the address immediately + following the unmarshalled short. + +Arguments: + + source - A pointer to a pointer to a buffer + + IN - *source points to the address just prior to + the short to be unmarshalled. + OUT - *source points to the address just following + the short which was just unmarshalled. + + target - A pointer to the short to unmarshall the data into. + + format - The sender data representation. + +Return Values: + + None. + +--*/ + + register unsigned char PAPI * aBuffer = *source; + + aBuffer++; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFEL); + + if ( (format & NDR_INT_REP_MASK) == NDR_BIG_ENDIAN ) + { + // + // Swap bytes: (AB => BA) + // + + *(unsigned short *)target = + (*(unsigned short *)aBuffer & MASK_A_) >> 8 | + (*(unsigned short *)aBuffer & MASK__B) << 8 ; + } + else + { + *(short *)target = *((short *)aBuffer); + } + + // + // Update *source (== aBuffer) before returning: + // + + // BUGBUG cfront + cl386 + // *source = (unsigned char PAPI *) ++((short *)aBuffer); + + *source = aBuffer + 2; +} + +// +// end short_from_ndr_temp +// + +void RPC_ENTRY +long_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + OUT unsigned long * Target + ) + +/*++ + +Routine Description: + + Unmarshall a long from an RPC message buffer into the target + (*Target). This routine: + + o Aligns the buffer pointer to the next (0 mod 4) boundary, + o Unmarshalls the long (as unsigned long); performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the unmarshalled long. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the short to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the short which was just unmarshalled. + + Target - A pointer to the long to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + + aBuffer = aBuffer + 3; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFCL); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + + *(unsigned long *)Target = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + } + else + { + *(long *)Target = (*(long *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + + // BUGBUG cfront + cl386 + // SourceMessage->Buffer = (void PAPI *) ++((long *)aBuffer); + + SourceMessage->Buffer = aBuffer + 4; +} + +// +// end long_from_ndr +// + +void RPC_ENTRY +long_array_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, + OUT unsigned long * Target + ) + +/*++ + +Routine Description: + + Unmarshall an array of longs from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of longs (Target[]). This routine: + + o Aligns the buffer pointer to the next (0 mod 4) boundary, + o Unmarshalls MemberCount longs; performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the last unmarshalled long. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first long to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last long which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - An array of longs to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + register unsigned int index; + + aBuffer = (unsigned char *)(unsigned long)aBuffer + 3; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFCL); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + for (index = (int)LowerIndex; index < UpperIndex; index++) + { + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + Target[index] = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + + Target[index] = + (Target[index] & MASK_AB__) >> 16 | + (Target[index] & MASK___CD) << 16 ; + + // + // BUGBUG c_front + cl386 + // ((unsigned long *)aBuffer)++; + + aBuffer += 4; + } + + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)aBuffer; + + } + else + { + + int byteCount = 4*(int)(UpperIndex - LowerIndex); + + RpcpMemoryCopy( + &Target[LowerIndex], + aBuffer, + byteCount + ); + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)(aBuffer + byteCount); + + /* Replaced by RpcpMemoryCopy: + + for (index = LowerIndex; index < UpperIndex; index++) + { + // + // BUGBUG YABB - c_front + cl386 + // Target[index] = *((unsigned long *)aBuffer)++; + + Target[index] = *((unsigned long *)aBuffer); + + aBuffer += 4; + } + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)aBuffer; + + */ + + } +} + +// +// end long_array_from_ndr +// + +void RPC_ENTRY +long_from_ndr_temp ( + IN OUT unsigned char ** source, + OUT unsigned long * target, + IN unsigned long format + ) + +/*++ + +Routine Description: + + Unmarshall a long from a given buffer into the target + (*target). This routine: + + o Aligns the *source pointer to the next (0 mod 2) boundary, + o Unmarshalls a long (as unsigned long); performs data + conversion if necessary, and + o Advances the *source pointer to the address immediately + following the unmarshalled long. + +Arguments: + + source - A pointer to a pointer to a buffer + + IN - *source points to the address just prior to + the long to be unmarshalled. + OUT - *source points to the address just following + the long which was just unmarshalled. + + target - A pointer to the long to unmarshall the data into. + + format - The sender data representation. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = *source; + + aBuffer = (unsigned char *)(unsigned long)aBuffer + 3; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFCL); + + if ( (format & NDR_INT_REP_MASK) == NDR_BIG_ENDIAN ) + { + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the target long word + // achieving full swap: BADC => DCBA + // + + *(unsigned long *)target = + (*(unsigned long *)target & MASK_AB__) >> 16 | + (*(unsigned long *)target & MASK___CD) << 16 ; + + } + else + { + *(long *)target = (*(long *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + // BUGBUG: c_front+cl386 + // *source = (unsigned char PAPI *) ++((long *)aBuffer); + + *source = aBuffer + 4; +} + +// +// end long_from_ndr_temp +// + +void RPC_ENTRY +enum_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + OUT unsigned int * Target + ) + +/*++ + +Routine Description: + + Unmarshall an int from an RPC message buffer into the target + (*Target). Note: this is based on the assumption, valid in all + C compilers we currently support, that "enum" is treated as an + "int" by the compiler. + + This routine: + + o Aligns the buffer pointer to the next (0 mod 2) boundary, + o Unmarshalls the int (as unsigned int); performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the unmarshalled int. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the int to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the int which was just unmarshalled. + + Target - A pointer to the int to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + // size on NT i386: 0X44 (68 bytes) + + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + + aBuffer++; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFEL); + + // + // Zeroe *Target to be on the safe side later for 32-bit + // int systems! + // + + *Target = 0; + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + + // + // Swap bytes: (AB => BA) + // + // The following code will swap bytes and fill the two low + // order bytes of (*Target), independently of the size of int. + // + + *(unsigned short *)Target = + (*(unsigned short *)aBuffer & MASK_A_) >> 8 | + (*(unsigned short *)aBuffer & MASK__B) << 8 ; + + } + else + { + // + // The following code will copy two bytes from the wire + // to the two low order bytes of (*Target) independently of + // the size of int. + // + + *(short *)Target = *((short *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + + SourceMessage->Buffer = aBuffer + 2; +} + +// +// end enum_from_ndr +// + +void RPC_ENTRY +hyper_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, +// OUT unsigned hyper * Target + OUT hyper * Target + ) + +/*++ + +Routine Description: + + Unmarshall a hyper from an RPC message buffer into the target + (*Target). This routine: + + o Aligns the buffer pointer to the next (0 mod 8) boundary, + o Unmarshalls the hyper (as unsigned hyper); performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the unmarshalled hyper. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the hyper to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the hyper which was just unmarshalled. + + Target - A pointer to the hyper to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + + aBuffer = aBuffer + 7; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFF8L); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + + //.. We are doing ABCDEFGH -> HGFEDCBA + //.. We start with ABCD going as DCBA into second word of Target + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + //.. and put it into second word, without changing Target pointer + + *((unsigned long *)Target + 1) = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + //.. What's left is EFGH going into first word at Target + //.. Compiler can't do this: ((long *)aBuffer)++; + + aBuffer += 4; + + // Swap bytes: + // + // First apply the transformation: EFGH => FEHG + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: FEHG => HGFE + // + //.. and put it into first word, at the original Target pointer + + *(unsigned long *)Target = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + } + else + { + //.. Copy hyper as two longs, don't change Target pointer. + //.. Advance aBuffer though to get the same as from above. + //.. Compiler can't do this: ((long *)aBuffer)++; + + *(long *)Target = (*(long *)aBuffer); + aBuffer += 4; + *((long *)Target + 1) = (*(long *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + + SourceMessage->Buffer = aBuffer + 4; +} + +// +// end hyper_from_ndr +// + +void RPC_ENTRY +hyper_array_from_ndr( + IN OUT PRPC_MESSAGE SourceMessage, + IN unsigned long LowerIndex, + IN unsigned long UpperIndex, +// OUT unsigned hyper Target[] + OUT hyper * Target + ) + +/*++ + +Routine Description: + + Unmarshall an array of hypers from an RPC message buffer into + the range Target[LowerIndex] .. Target[UpperIndex-1] of the + target array of hypers (Target[]). This routine: + + o Aligns the buffer pointer to the next (0 mod 8) boundary, + o Unmarshalls MemberCount hypers; performs data + conversion if necessary, and + o Advances the buffer pointer to the address immediately + following the last unmarshalled hyper. + +Arguments: + + SourceMessage - A pointer to an RPC_MESSAGE. + + IN - SourceMessage->Buffer points to the address just prior to + the first hyper to be unmarshalled. + OUT - SourceMessage->Buffer points to the address just following + the last hyper which was just unmarshalled. + + LowerIndex - Lower index into the target array. + + UpperIndex - Upper bound index into the target array. + + Target - An array of hypers to unmarshall the data into. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = + (unsigned char *)SourceMessage->Buffer; + register unsigned int index; + + aBuffer = (unsigned char *)(unsigned long)aBuffer + 7; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFF8L); + + if ( (SourceMessage->DataRepresentation & NDR_INT_REP_MASK) == + NDR_BIG_ENDIAN ) + { + for (index = (int)LowerIndex; index < UpperIndex; index++) + { + + //.. We are doing ABCDEFGH -> HGFEDCBA + //.. We start with ABCD going as DCBA into second word of Target + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + //.. Put it into second word, without changing Target pointer yet. + + *((unsigned long *)Target + 1) = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + //.. What's left is EFGH going into first word at Target + //.. Compiler can't do this: ((long *)aBuffer)++; + + aBuffer += 4; + + // Swap bytes: + // + // First apply the transformation: EFGH => FEHG + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: FEHG => HGFE + // + //.. Put it into first word, at the Target pointer + + *(unsigned long *)Target = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + //.. Loop, advance pointers. + + Target++; + aBuffer += 4; //.. ((long *)aBuffer)++; + } + + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)aBuffer; + + } + else + { + + int byteCount = 8*(int)(UpperIndex - LowerIndex); + + RpcpMemoryCopy( + &Target[LowerIndex], + aBuffer, + byteCount + ); + // + // Update SourceMessage->Buffer + // + + SourceMessage->Buffer = (void PAPI *)(aBuffer + byteCount); + + } +} + +// +// end long_array_from_ndr +// + +void RPC_ENTRY +hyper_from_ndr_temp ( + IN OUT unsigned char ** source, +// OUT unsigned hyper * Target, + OUT hyper * Target, + IN unsigned long format + ) + +/*++ + +Routine Description: + + Unmarshall a hyper from a given buffer into the target + (*target). This routine: + + o Aligns the *source pointer to the next (0 mod 2) boundary, + o Unmarshalls a hyper (as unsigned hyper); performs data + conversion if necessary, and + o Advances the *source pointer to the address immediately + following the unmarshalled hyper. + +Arguments: + + source - A pointer to a pointer to a buffer + + IN - *source points to the address just prior to + the hyper to be unmarshalled. + OUT - *source points to the address just following + the hyper which was just unmarshalled. + + Target - A pointer to the hyper to unmarshall the data into. + + format - The sender data representation. + +Return Values: + + None. + +--*/ + +{ + register unsigned char PAPI * aBuffer = *source; + + aBuffer = (unsigned char *)(unsigned long)aBuffer + 3; + aBuffer = (unsigned char *)((unsigned long) aBuffer & (unsigned long)0XFFFFFFFCL); + + if ( (format & NDR_INT_REP_MASK) == NDR_BIG_ENDIAN ) + { + + //.. We are doing ABCDEFGH -> HGFEDCBA + //.. We start with ABCD going as DCBA into second word of Target + + // + // Swap bytes: + // + // First apply the transformation: ABCD => BADC + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: BADC => DCBA + // + //.. and put it into second word, without changing Target pointer + + *((unsigned long *)Target + 1) = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + //.. What's left is EFGH going into first word at Target + //.. Compiler can't do this: ((long *)aBuffer)++; + + aBuffer += 4; + + // Swap bytes: + // + // First apply the transformation: EFGH => FEHG + // + + *(unsigned long *)Target = + (*(unsigned long *)aBuffer & MASK_A_C_) >> 8 | + (*(unsigned long *)aBuffer & MASK__B_D) << 8 ; + + // + // Now swap the left and right halves of the Target long word + // achieving full swap: FEHG => HGFE + // + //.. Put it into the first word, at the original Target pointer. + + *(unsigned long *)Target = + (*(unsigned long *)Target & MASK_AB__) >> 16 | + (*(unsigned long *)Target & MASK___CD) << 16 ; + + } + else + { + //.. Copy hyper as two longs, don't change Target pointer. + //.. Advance aBuffer by a long though to get the same as from above. + //.. Compiler can't do this: ((long *)aBuffer)++; + + *(unsigned long *)Target = (*(unsigned long *)aBuffer); + aBuffer += 4; + *((unsigned long *)Target + 1) = (*(unsigned long *)aBuffer); + } + + // + // Update SourceMessage->Buffer before returning: + // + // BUGBUG: c_front+cl386 + // *source = (unsigned char PAPI *) ++((long *)aBuffer); + + *source = aBuffer + 4; +} + +// +// end hyper_from_ndr_temp +// + + + +/* +void RPC_ENTRY +long_from_ndr ( + PRPC_MESSAGE source, + long * target) +{ +/ * + switch (format) + { + case BIG_ENDIAN : + ((unsigned char *)target)[0] = source[3]; + ((unsigned char *)target)[1] = source[2]; + ((unsigned char *)target)[2] = source[1]; + ((unsigned char *)target)[3] = source[0]; + break; + case LITTLE_ENDIAN : + *(long *)target = *(long *)source; + break; + } +* / + *(unsigned long *)&source->Buffer += 3; + *(unsigned long *)&source->Buffer &= 0xfffffffc; + *target = *(*(long **)&source->Buffer)++; +} +*/ + +/* +void RPC_ENTRY +long_from_ndr_temp ( + unsigned char ** source, + long * target, + unsigned long format) +{ +/ * + switch (format) + { + case BIG_ENDIAN : + ((unsigned char *)target)[0] = source[3]; + ((unsigned char *)target)[1] = source[2]; + ((unsigned char *)target)[2] = source[1]; + ((unsigned char *)target)[3] = source[0]; + break; + case LITTLE_ENDIAN : + *(long *)target = *(long *)source; + break; + } +* / + *(unsigned long *)source += 3; + *(unsigned long *)source &= 0xfffffffc; + *target = *(*(long **)source)++; +} +*/ + diff --git a/private/rpc/ndrlib/libdef.h b/private/rpc/ndrlib/libdef.h new file mode 100644 index 000000000..424b5c0df --- /dev/null +++ b/private/rpc/ndrlib/libdef.h @@ -0,0 +1,308 @@ +/*** MODULE $libdef ***/ +/* */ +/* This SDL File Generated by VAX-11 Message V04-00 on 8-APR-1988 06:19:34.14 */ +/* */ +/* FILE: LIBMSG.MSG EDIT: EGM2023 */ +/* */ +/***************************************************************************** */ +/** * */ +/** COPYRIGHT (C) 1978, 1980, 1982, 1984, 1986 BY * */ +/** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * */ +/** ALL RIGHTS RESERVED. * */ +/** * */ +/** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * */ +/** ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * */ +/** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * */ +/** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * */ +/** OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * */ +/** TRANSFERRED. * */ +/** * */ +/** THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * */ +/** AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * */ +/** CORPORATION. * */ +/** * */ +/** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * */ +/** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * */ +/** * */ +/** * */ +/***************************************************************************** */ +/* */ +/* */ +/* 1-013 - ADD LIB$_KEYALRINS, LIB$_KEYNOTFOU. SBL 20-MAR-1981 */ +/* 1-014 - ADD LIB$_INVCVT. FM 24-MAR-81 */ +/* 1-015 - ADD LIB$_INVDTYDSC, LIB$_INVCLADSC, LIB$_INVCLADTY, LIB$_INVNBDS */ +/* LIB$_DESSTROVF, LIB$_OUTSTRTRU. FM 21-APR-81 */ +/* 2-001 - CONVERT TO MESSAGE UTILITY SOURCE FORMAT. ADAPTED FROM LIBMSG.MDL */ +/* VERSION 1-015. SBL 23-APR-1981 */ +/* 2-002 - USE LIB$ FACILITY FOR LIB$_NORMAL. SBL 27-APR-1981 */ +/* 2-003 - ADD LIB$_INTOVF, LIB$_FLTOVF, LIB$_FLTUND, LIB$_DECOVF, LIB$_ROPRAND. */ +/* 2-004 - ADD LIB$_WRONUMARG. RKR 4-SEP-1981 */ +/* 2-005 - ADD MESSAGES FOR LIB$CLI_CALLBACK. SBL 14-SEPT-1981 */ +/* 2-006 - ADD LIB$_INVSYMNAM, MESSAGES FOR LIB$EXTEND_RANGE. SBL 1-OCT-1981 */ +/* 2-007 - ADD LIB$_WASSET AND LIB$_WASCLR. SBL 16-OCT-1981 */ +/* 2-008 - CORRECT TYPO IN LIB$_UNAEXTRAN. SBL 30-OCT-1981 */ +/* 2-009 - REMOVE LIB$_WASSET AND LIB$_WASCLR. ADD LIB$_ATTREQREF. SBL 21-DEC-1981 */ +/* 2-010 - REMOVE MESSAGES FOR LIB$EXTEND_RANGE. SBL 22-DEC-1981 */ +/* 2-011 - CORRECT TYPO. SBL 23-DEC-1981 */ +/* 2-012 - ADD LIB$_INVFILSPE FOR FILE MANIPULATION PROCEDURES. MLJ 30-DEC-1981 */ +/* 2-013 - ADD LIB$_ERRROUCAL AND .TITLE. SBL 28-AUG-1982 */ +/* 2-014 - ADD LIB$_INVXAB, LIB$_FILFAIMAT, LIB$_NEGANS, LIB$_QUIPRO, */ +/* LIB$_QUICONACT. TSK 20-SEP-1982 */ +/* 2-015 - ADD LIB$_RESTART. SBL 1-MAR-1983 */ +/* 2-016 - ADD LIB$_NO_STRACT FOR SCREEN PACKAGE. PLL 19-JUL-1983 */ +/* 2-017 - ADD SEVERAL NEW MESSAGES FOR LIB$$READ_OBJECT. BLS 25-FEB-1984 */ +/* 2-018 - ADD NEW MESSAGES FOR FUTURE LIB$VM. BLS 11-APR-1984 */ +/* 2-019 - ADD LIB$_NOTIMP. MDL 11-JUL-1985 */ +/* 2-020 - ADD LIB$_BADZONE. SMM 09-APR-1986 */ +/* */ +/* 2-021 - ADD ERROR MESSAGES FOR DATE/TIME ROUTINES. LIB$_IVTIME, */ +/* LIB$_ONEDELTIM, LIB$_NEGTIM, LIB$_INVARGORD, LIB$_INVOPER, */ +/* LIB$_ABSTIMREQ, LIB$_DELTIMREQ JWN 14-NOV-1986 */ +/* 2-022 - ADD SEVERAL NEW MESSAGES FOR LIB$DATE_FORMAT AKS 20-NOV-1986 */ +/* 2-023 - ADD NEW MESSAGES AND UPDATES FOR LIB$DATE_STRING. EGM 12-JAN-1987 */ +/* */ +/*- */ +/*+ */ +/* SYMBOLS ARE DEFINED FOLLOWING THE STANDARD FOR GLOBAL NAMES: */ +/* */ +/* LIB$_ABCMNOXYZ */ +/* */ +/* IN ADDITION, THE LIBRARY STANDARDS SPECIFY THAT THE LETTERS "abc", "mno", */ +/* AND "xyz" ARE THE FIRST THREE LETTERS OF THE FIRST THREE WORDS OF THE ERROR */ +/* MESSAGE, NOT COUNTING ARTICLES AND PREPOSITIONS. */ +/* */ +/* THE NAMES OF ALL PROCEDURES USING EACH ERROR CONDITION VALUE SHOULD APPEAR */ +/* IN THE COMMENTS INCLUDED WITH EACH ERROR DEFINITION. */ +/* */ +/* MACRO-32 PROGRAMMING: */ +/* */ +/* THE MACROS CALL: */ +/* */ +/* $LIBDEF */ +/* */ +/* WILL CAUSE ALL SYMBOLS TO BE MADE AVAILABLE TO THE MODULE. */ +/* THE RUN-TIME LIBRARY DECLARES THESE SYMBOLS AS EXTERNAL; */ +/* THE MACROS ARE PROVIDED ONLY FOR THE CONVENIENCE OF THE USER. */ +/*- */ +/* ; SET LH TO 21 (DECIMAL). */ +#define LIB__FACILITY 21 +#define LIB__NORMAL 1409025 +#define LIB__STRTRU 1409041 +#define LIB__ONEENTQUE 1409049 +/* ; LIB_INSQHI, LIB_INSQTI, LIB_REMQHI, LIB_REMQTI */ +#define LIB__KEYALRINS 1409057 +/* ; LIB_INSERT_TREE */ +#define LIB__ERRROUCAL 1409065 +/* ; LIB_DELETE_FILE, LIB_RENAME_FILE */ +#define LIB__RESTART 1409073 +/* ; LIB_DECODE_FAULT */ +/* ; NOTE: ERROR CODES MUST NOT OVERLAP SUCESS CODES!!! */ +/* ; SET SUB-SYSTEM SPECIFIC BIT FOR NOW. */ +/* ; SET LH TO 21 (DECIMAL). */ +/* ; SO THAT EACH CODE WILL BE AN WARNING CODE. */ +/* ; SET SUB-SYSTEM SPECIFIC BIT FOR NOW. */ +#define LIB__BADSTA 1409540 +/* ; LIB_FIXUP_FLT */ +#define LIB__FATERRLIB 1409548 +/* ; LIB_VM_GET */ +#define LIB__INSVIRMEM 1409556 +/* ; LIB_VM_GET, LIB_LOOKUP_KEY */ +#define LIB__INPSTRTRU 1409564 +/* ; LIB_GET_INPUT */ +#define LIB__INVSTRDES 1409572 +/* ; LIB_SCOPY_XXXX */ +#define LIB__INTLOGERR 1409580 +#define LIB__INVARG 1409588 +/* ; LIB_LOOKUP_KEY */ +#define LIB__AMBKEY 1409596 +/* ; LIB_LOOKUP_KEY */ +#define LIB__UNRKEY 1409604 +#define LIB__PUSSTAOVE 1409612 +/* ; LIB_FIXUP_FLT */ +#define LIB__USEFLORES 1409620 +/* ; LIB_LOOKUP_KEY */ +#define LIB__SIGNO_ARG 1409628 +/* ; LIB_SIGNAL, LIB_STOP */ +#define LIB__BADBLOADR 1409636 +/* ; LIB_FREE_VM */ +#define LIB__BADBLOSIZ 1409644 +/* ; LIB_GET_VM */ +#define LIB__NOTFOU 1409652 +/* ; LIB_FFS, LIB_FFC */ +#define LIB__ATTCONSTO 1409660 +/* ; LIB_SIGNAL, LIB_STOP */ +#define LIB__SYNTAXERR 1409668 +#define LIB__INVTYPE 1409676 +/* ; LIB_TPARSE */ +#define LIB__INSEF 1409684 +/* ; LIB_GET_EF */ +#define LIB__EF_ALRFRE 1409692 +/* ; LIB_FREE_EF */ +#define LIB__EF_ALRRES 1409700 +/* ; LIB_RESERVE_EF */ +#define LIB__EF_RESSYS 1409708 +/* ; LIB_FREE_EF, LIB_RESERVE_EF */ +#define LIB__INSLUN 1409716 +/* ; LIB_GET_LUN */ +#define LIB__LUNALRFRE 1409724 +/* ; LIB_FREE_LUN */ +#define LIB__LUNRESSYS 1409732 +/* ; LIB_FREE_LUN, LIB_RESERVE_LUN */ +#define LIB__SCRBUFOVF 1409740 +/* ; SCR PACKAGE */ +#define LIB__INVSCRPOS 1409748 +/* ; SCR PACKAGE */ +#define LIB__SECINTFAI 1409756 +/* ; LIB_INSQHI, LIB_INSQTI, LIB_REMQHI, LIB_REMQTI */ +#define LIB__INVCHA 1409764 +/* ; LIB_TRA_ASC_EBC, LIB_TRA_EBC_ASC */ +#define LIB__QUEWASEMP 1409772 +/* ; LIB_REMQHI, LIB_REMQTI */ +#define LIB__STRIS_INT 1409780 +/* ; LIB_SCOPY, ETC. */ +#define LIB__KEYNOTFOU 1409788 +/* ; LIB_LOOKUP_TREE */ +#define LIB__INVCVT 1409796 +/* ; LIB_CVTDXDX */ +#define LIB__INVDTYDSC 1409804 +/* ; LIB_CVTDXDX */ +#define LIB__INVCLADSC 1409812 +/* ; LIB_CVTDXDX */ +#define LIB__INVCLADTY 1409820 +/* ; LIB_CVTDXDX */ +#define LIB__INVNBDS 1409828 +/* ; LIB_CVTDXDX */ +#define LIB__DESSTROVF 1409836 +/* ; LIB_CVTDXDX */ +#define LIB__INTOVF 1409844 +/* ; LIB_CVTDXDX */ +#define LIB__DECOVF 1409852 +/* ; LIB_CVTDXDX */ +#define LIB__FLTOVF 1409860 +/* ; LIB_CVTDXDX */ +#define LIB__FLTUND 1409868 +/* ; LIB_CVTDXDX */ +#define LIB__ROPRAND 1409876 +/* ; LIB_CVTDXDX */ +#define LIB__WRONUMARG 1409884 +/* ; LIB_ANALYZE_SDESC */ +#define LIB__NOSUCHSYM 1409892 +/* ; LIB_CLI_CALLBACK */ +#define LIB__INSCLIMEM 1409900 +/* ; LIB_CLI_CALLBACK */ +#define LIB__AMBSYMDEF 1409908 +/* ; LIB_CLI_CALLBACK */ +#define LIB__NOCLI 1409916 +/* ; LIB_CLI_CALLBACK */ +#define LIB__UNECLIERR 1409924 +/* ; LIB_CLI_CALLBACK */ +#define LIB__INVSYMNAM 1409932 +/* ; LIB_CLI_CALLBACK */ +#define LIB__ATTREQREF 1409940 +/* ; LIB_ATTACH */ +#define LIB__INVFILSPE 1409948 +/* ; LIB_FID_TO_NAME, LIB_EXTRACT_CONCEALED, */ +/* ; LIB_SET_FILE_PROT, LIB_UNLOCK_FILE, LIB_CREATE_DIR */ +#define LIB__INVXAB 1409956 +/* ; LIB_QUAL_FILE_PARSE */ +#define LIB__NO_STRACT 1409964 +/* ; SCR PACKAGE */ +#define LIB__BADTAGVAL 1409972 +/* ; LIB_VM */ +#define LIB__INVOPEZON 1409980 +/* ; LIB_VM */ +#define LIB__PAGLIMEXC 1409988 +/* ; LIB_VM */ +#define LIB__NOTIMP 1409996 +/* ; LIB_NOT_IMPLEMENTED */ +#define LIB__BADZONE 1410004 +/* ; LIB_VERIFY_VM_ZONE, LIB_SHOW_VM_ZONE, LIB_STAT_VM_ZONE */ +/* ; LIB_FIND_VM_ZONE */ +#define LIB__IVTIME 1410012 +/* ; LIB_ADD_TIMES, LIB_SUB_TIMES, LIB_MULIPLY_DELTA_TIME */ +/* ; LIB_MULTIPLY_DELTA_TIME_F, LIB_CVT_TO_INTERNAL_TIME */ +/* ; LIB_CVT_FROM_INTERNAL_TIME, LIB_CONVERT_DATE_STRING */ +#define LIB__ONEDELTIM 1410020 +/* ; LIB_ADD_TIMES */ +#define LIB__NEGTIM 1410028 +/* ; LIB_SUB_TIMES */ +#define LIB__INVARGORD 1410036 +/* ; LIB_SUB_TIMES */ +#define LIB__ABSTIMREQ 1410044 +/* ; LIB_CVT_FROM_INTERNAL_TIME */ +#define LIB__DELTIMREQ 1410052 +/* ; LIB_CVT_FROM_INTERNAL_TIME */ +#define LIB__INVOPER 1410060 +/* ; LIB_CVT_XXX_INTERNAL_TIME */ +#define LIB__REENTRANCY 1410068 +/* ;LIB_FORMAT_DATE_TIME, LIB_INIT_DATE_TIME_CONTEXT, */ +/* ;LIB_CONVERT_DATE_STRING, LIB_GET_DATE_FORMAT */ +#define LIB__UNRFORCOD 1410076 +/* ;LIB_FORMAT_DATE_TIME, LIB_CONVERT_DATE_STRING, */ +/* ;LIB_GET_DATE_FORMAT */ +#define LIB__ILLINISTR 1410084 +/* ;LIB_INIT_DATE_TIME_CONTEXT */ +#define LIB__NUMELEMENTS 1410092 +/* ;LIB_INIT_DATE_TIME_CONTEXT */ +#define LIB__ELETOOLON 1410100 +/* ;LIB_INIT_DATE_TIME_CONTEXT */ +#define LIB__ILLCOMPONENT 1410108 +/* ;LIB_INIT_DATE_TIME_CONTEXT */ +#define LIB__AMBDATTIM 1410116 +/* ;LIB_CONVERT_DATE_STRING */ +#define LIB__INCDATTIM 1410124 +/* ;LIB_CONVERT_DATE_STRING */ +#define LIB__ILLFORMAT 1410132 +/* ;LIB_CONVERT_DATE_STRING, LIB_GET_DATE_FORMAT */ +#define LIB__OUTSTRTRU 1413120 +/* ; LIB_CVTDXDX */ +#define LIB__FILFAIMAT 1413128 +/* ; LIB_QUAL_FILE_MATCH */ +#define LIB__NEGANS 1413136 +/* ; LIB_CONFIRM_ACT */ +#define LIB__QUIPRO 1413144 +/* ; LIB_CONFIRM_ACT, LIB_QUAL_FILE_MATCH */ +#define LIB__QUICONACT 1413152 +/* ; LIB_CONFIRM_ACT, LIB_QUAL_FILE_MATCH */ +#define LIB__ENGLUSED 1413160 +/* ;LIB_FORMAT_DATE_TIME, LIB_CONVERT_DATE_STRING, */ +/* ;LIB_GET_DATE_FORMAT */ +#define LIB__DEFFORUSE 1413168 +/* ;LIB_FORMAT_DATE_TIME, LIB_CONVERT_DATE_STRING, */ +/* ;LIB_GET_DATE_FORMAT */ +#define LIB__BADCCC 1425408 +/* ; LIB__READ_OBJECT */ +#define LIB__EOMERROR 1425416 +/* ; LIB__READ_OBJECT */ +#define LIB__EOMFATAL 1425424 +/* ; LIB__READ_OBJECT */ +#define LIB__EOMWARN 1425432 +/* ; LIB__READ_OBJECT */ +#define LIB__GSDTYP 1425440 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLFMLCNT 1425448 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLMODNAM 1425456 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLPSCLEN 1425464 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLRECLEN 1425472 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLRECLN2 1425480 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLRECTYP 1425488 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLRECTY2 1425496 +/* ; LIB__READ_OBJECT */ +#define LIB__ILLSYMLEN 1425504 +/* ; LIB__READ_OBJECT */ +#define LIB__NOEOM 1425512 +/* ; LIB__READ_OBJECT */ +#define LIB__RECTOOSML 1425520 +/* ; LIB__READ_OBJECT */ +#define LIB__SEQUENCE 1425528 +/* ; LIB__READ_OBJECT */ +#define LIB__SEQUENCE2 1425536 +/* ; LIB__READ_OBJECT */ +#define LIB__STRLVL 1425544 +/* ; LIB__READ_OBJECT */ diff --git a/private/rpc/ndrlib/mac/depend.mk b/private/rpc/ndrlib/mac/depend.mk new file mode 100644 index 000000000..5a24b3229 --- /dev/null +++ b/private/rpc/ndrlib/mac/depend.mk @@ -0,0 +1,10 @@ +ccontext.obj ccontext.lst: ../ccontext.cxx $(MAC_INC)/macos/memory.h \ + $(MAC_INC)/macos/msvcmac.h $(MAC_INC)/macos/Types.h \ + $(MAC_INC)/setjmp.h $(MAC_INC)/stdlib.h $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/mac/rpc.h \ + $(RPC)/runtime/mtrt/mac/rpcmac.h $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/util.hxx + diff --git a/private/rpc/ndrlib/mac/makefile b/private/rpc/ndrlib/mac/makefile new file mode 100644 index 000000000..4e8b4aa53 --- /dev/null +++ b/private/rpc/ndrlib/mac/makefile @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : +# +# Title : Makefile for the Mac stub library. +# +# MACBUG: This is not really needed on the MAC and should +# be removed when rpcndr20 no longer needs this. +# History : +# mariogo 2-10-94 Re-write +# +# -------------------------------------------------------------------- + +MAC=1 + +!include rules.mk + +all : RpcNdrp.lib + +depend : + $(INCLUDES) $(INCLUDESFLAGS) ..\ccontext.cxx > depend.mk + +tree : + +# -------------------------------------------------------------------- +# Dependancies +# + +RpcNdrp.lib : ccontext.obj + -del RpcNdrp.lib 2>nul + $(LIBRARIAN) $(LIBFLAGS) -out:RpcNdrp.lib $** + +!include depend.mk + diff --git a/private/rpc/ndrlib/mac/rules.mk b/private/rpc/ndrlib/mac/rules.mk new file mode 100644 index 000000000..0822ea2f1 --- /dev/null +++ b/private/rpc/ndrlib/mac/rules.mk @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : rules.mk +# +# Description : +# This is an extra file to be included by the makefiles in subdirectories. +# As far as I can tell, the sole purpose for this file is to slow down the +# build process; it will be a good excuse to get a faster machine. +# +# History : +# mikemon 02-10-94 Created. +# +# -------------------------------------------------------------------- + +!include $(RPC)\ndrlib\rules.mk + +.SUFFIXES: +.SUFFIXES: .cxx .c .obj .exe + +CINC=$(CINC) -I..\..\runtime\mtrt -I..\..\runtime\mtrt\mac + diff --git a/private/rpc/ndrlib/makefile b/private/rpc/ndrlib/makefile new file mode 100644 index 000000000..91480d0bf --- /dev/null +++ b/private/rpc/ndrlib/makefile @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : makefile. +# +# Description : +# For NT this includes the standard NT make stuff, for 16bit +# this makefile builds the ndrlib (v1.0) in subdirectories as needed. +# +# History : +# mikemon 12-21-90 Beginning of recorded history. +# brucemc 05-21-92 Added C7 support and cleaned up. +# mariogo 02-10-04 Mario hates the old build system. +# -------------------------------------------------------------------- + +!ifdef NTMAKEENV + +!include $(NTMAKEENV)\makefile.def + +!else + +ALL=1 + +!include rules.mk + +!if "$(TRG)" == "ALL" +TARGETDIRS = $(CLIENT_SUBDIRS) +!else +TARGETDIRS = $(TRG) +!endif + +all : + for %%i in ($(TARGETDIRS)) do (cd %%i && ($(MAKE) $(NMAKE_FLAGS) -$(MAKEFLAGS) || exit) && cd ..) + +clean : + for %%i in ($(TARGETDIRS)) do (cd %%i && ($(MAKE) -$(MAKEFLAGS) clean || exit ) && cd ..) + +clobber : + for %%i in ($(TARGETDIRS)) do (cd %%i && ($(MAKE) -$(MAKEFLAGS) clobber || exit ) && cd ..) + +depend : + for %%i in ($(TARGETDIRS)) do (cd %%i && ($(MAKE) -$(MAKEFLAGS) depend || exit ) && cd ..) + +tree : + for %%i in ($(TARGETDIRS)) do (cd %%i && ($(MAKE) -$(MAKEFLAGS) tree || exit ) && cd ..) + +!endif + diff --git a/private/rpc/ndrlib/makefile.inc b/private/rpc/ndrlib/makefile.inc new file mode 100644 index 000000000..c54467269 --- /dev/null +++ b/private/rpc/ndrlib/makefile.inc @@ -0,0 +1,10 @@ +!ifndef LIB386 +LIB386=\rpc\import\c700\bin\lib +!endif + +linklist.cxx : ..\runtime\mtrt\linklist.cxx + copy ..\runtime\mtrt\linklist.cxx . + +..\runtime\lib\i386\ndromf.lib: $(386_OBJECTS) + @-del $*.lib 2> nul + $(LIB386) $*.lib $(?: =+); diff --git a/private/rpc/ndrlib/makeomf.cmd b/private/rpc/ndrlib/makeomf.cmd new file mode 100644 index 000000000..2a421f8f9 --- /dev/null +++ b/private/rpc/ndrlib/makeomf.cmd @@ -0,0 +1,6 @@ +Rem Script to build C7 versions of the objects. + +setlocal +del obj\i386\*.obj +set OBJECT_TYPE_OMF=1 +build -es -nmake ..\runtime\lib\i386\ndromf.lib diff --git a/private/rpc/ndrlib/mppc/depend.mk b/private/rpc/ndrlib/mppc/depend.mk new file mode 100644 index 000000000..39d22aacf --- /dev/null +++ b/private/rpc/ndrlib/mppc/depend.mk @@ -0,0 +1,10 @@ +ccontext.obj ccontext.lst: ../ccontext.cxx \ + $(MPPC_ROOT)/include/macos/memory.h \ + $(MPPC_ROOT)/include/macos/msvcmac.h $(MPPC_ROOT)/include/macos/Types.h \ + $(PUBLIC)/inc/poppack.h $(PUBLIC)/inc/pshpack4.h \ + $(PUBLIC)/inc/rpcdce.h $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h \ + $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/mac/rpc.h $(RPC)/runtime/mtrt/mac/rpcmac.h \ + $(RPC)/runtime/mtrt/osfpcket.hxx $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/util.hxx + diff --git a/private/rpc/ndrlib/mppc/makefile b/private/rpc/ndrlib/mppc/makefile new file mode 100644 index 000000000..5aee4666f --- /dev/null +++ b/private/rpc/ndrlib/mppc/makefile @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : +# +# Title : Makefile for the Mac stub library. +# +# MACBUG: This is not really needed on the MAC and should +# be removed when rpcndr20 no longer needs this. +# History : +# mariogo 2-10-94 Re-write +# cbrown 10-05-95 Started PMac conversion +# -------------------------------------------------------------------- + +MPPC=1 + +!include rules.mk + +all : RpcNdrp.lib + +depend : + $(INCLUDES) $(INCLUDESFLAGS) ..\ccontext.cxx > depend.mk + +tree : + +# -------------------------------------------------------------------- +# Dependancies +# + +RpcNdrp.lib : ccontext.obj + -del RpcNdrp.lib 2>nul + $(LIBRARIAN) $(LIBFLAGS) -out:RpcNdrp.lib $** + +!include depend.mk + diff --git a/private/rpc/ndrlib/mppc/rules.mk b/private/rpc/ndrlib/mppc/rules.mk new file mode 100644 index 000000000..ccbd069b9 --- /dev/null +++ b/private/rpc/ndrlib/mppc/rules.mk @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : rules.mk +# +# Description : +# This is an extra file to be included by the makefiles in subdirectories. +# As far as I can tell, the sole purpose for this file is to slow down the +# build process; it will be a good excuse to get a faster machine. +# +# History : +# mikemon 02-10-94 Created. +# cbrown 10-05-95 Started PMac conversion +# -------------------------------------------------------------------- + +!include $(RPC)\ndrlib\rules.mk + +.SUFFIXES: +.SUFFIXES: .cxx .c .obj .exe + +CINC=$(CINC) -I..\..\runtime\mtrt -I..\..\runtime\mtrt\mac + diff --git a/private/rpc/ndrlib/ndrhelp.c b/private/rpc/ndrlib/ndrhelp.c new file mode 100644 index 000000000..e61aee32d --- /dev/null +++ b/private/rpc/ndrlib/ndrhelp.c @@ -0,0 +1,671 @@ +/* -------------------------------------------------------------------- + + Microsoft OS/2 LAN Manager + Copyright(c) Microsoft Corp., 1991 + +-------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- + +Description : + +Provides helper functions for data format conversion + +History : + +stevez 04-10-91 First bits into the bucket. + +-------------------------------------------------------------------- */ + +#include "rpc.h" +#include "ndrhelp.h" + +int _fstrlen(void far *); +void _pascal NDRcopy(void far *, void far *, int); + +void PAPI * MIDL_user_allocate(unsigned int); +extern char near ebcdic_to_ascii[]; + +#define SWAPSHORT(s) { \ +/* _asm mov ax, s */ \ + _asm xchg ah,al \ + _asm mov s,ax \ +} + +#define SWAPLONG(l) { \ +/* _asm mov ax, word ptr l */ \ + _asm xchg ah,al \ +/* _asm mov dx, word ptr l+2*/ \ + _asm xchg dh,dl \ + _asm mov word ptr l+2,ax \ + _asm mov word ptr l,dx \ +} + +#if 0 +#define SWAPSHORT(s) s = (((unsigned char *)&s)[1]<<8 | ((unsigned char *)&s)[0]) +#define SWAPLONG(l) l = ( ((long) ((unsigned char *)&ret)[3]<<24) | ((long) ((unsigned char *)&ret)[2]<<16) | \ + ((long) ((unsigned char *)&ret)[1]<<8) | ((long) ((unsigned char *)&ret)[0])) +#endif + +#define Nilp(p) (*((int _far *)&p+1) == 0) + +#define NEAR _near + +#ifndef THREADS + +#define GET_POINTER + +#define pBuffCur (&BuffCur) + +static NDR_BUFF NEAR BuffCur; // global static for no thread case + +#else + +PNDR_BUFF fetNDRCur(void); + +#define GET_POINTER PNDR_BUFF pBuffCur = fetNDRCur(); + +#endif + +#define fSelfLittleEndian 1 + +#define fEBCDIC (pBuffCur->dataType & 0x0f) +#define fSWAP ((pBuffCur->dataType & 0xf0) != fSelfLittleEndian) +#define fFloatType (*(((char *)&pBuffCur->dataType)+1)) + +enum {F_IEEE, F_VAX, F_CRAY, F_IBM }; + +static TypeAlign NEAR a1 = {0, 0, 0}; +static TypeAlign NEAR a2 = {2-1, 2-1, 2-1}; +static TypeAlign NEAR a4 = {2-1, 4-1, 4-1}; + +static TypeAlign NEAR *mAlignType[] = {0, &a1, &a2, 0, &a4}; + +#define GET_END_LIST ( (void PAPI *) -1) +typedef void PAPI * PAPI * PP; + + + +void NDR_Put_Init ( // Initialize global objects for marshelling + +PRPC_MESSAGE Message, +void PAPI * pParam + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->pSource = pBuffCur->pCur = pParam; + pBuffCur->pTarget = Message->Buffer; + pBuffCur->alignment = mAlignType[sizeof(int)]; +} + +void NDR_Get_Init ( // Initialize global objects for unmarshelling + +PRPC_MESSAGE Message, +void PAPI * pParam + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->dataType = Message->DataRepresentation; + pBuffCur->fSwap = fSWAP; + pBuffCur->pSource = Message->Buffer; + pBuffCur->pCur = Message->Buffer; + pBuffCur->pPushLast = (PP)Message->Buffer; + pBuffCur->pTarget = pParam; + pBuffCur->pTargetRoot = 0; + + pBuffCur->pAllocator = MIDL_user_allocate; + pBuffCur->alignment = mAlignType[sizeof(int)]; +} + +void NDR_Register_Unique( + +void PAPI *(PAPI * pAllocator)(unsigned int) + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->pAllocator = pAllocator; +} + + +void NDR_Pack_1 ( // Set the alignment to 1 + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + pBuffCur->alignment = &a1; +} + +void NDR_Pack_2 ( // Set the alignment to 2 + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + pBuffCur->alignment = &a2; +} + +void NDR_Pack_4 ( // Set the alignment to 4 + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + pBuffCur->alignment = &a4; +} + + + +#define ALIGN(ptr, byte) pBuffCur->ptr += (byte)-1; \ + *(int *)&pBuffCur->ptr &= ~((byte)-1); + +#define ALIGNCUR(ptr, TYPE) pBuffCur->ptr += pBuffCur->alignment->a##TYPE; \ + *(int *)&pBuffCur->ptr &= ~pBuffCur->alignment->a##TYPE; + +void NDR_Align_2 ( // Align the Target buffer to 2 byte boundary + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 2); +} + + +void NDR_Align_4 ( // Align the Target buffer to 4 byte boundary + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 4); +} + + +void NDR_Align_8 ( // Align the Target buffer to 8 byte boundary + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 8); +} + + +void NDR_Put_Set_Arg ( // set the source cursor to a value + +void PAPI *pNew + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + // if at the root level, save the next pointer + + if (Nilp(pBuffCur->pCur)) + pBuffCur->pCur = pBuffCur->pSource; + + pBuffCur->pSource = pNew; +} + +void NDR_Put_Next_Arg ( // move the cursor to the next base argment + + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->pSource = pBuffCur->pCur; + pBuffCur->pCur = 0; +} + + +void NDR_Skip_B_Long ( // Skip past a long in the Target Buffer + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->pTarget += 4; +} + +void NDR_Skip_M_Long ( // Skip past a long in the Source Buffer + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + pBuffCur->pSource += 4; +} + + +void NDR_Put_B_Short ( // Put an immediate Short +short immediate // value to put + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 2); + + *(short PAPI *) pBuffCur->pTarget = immediate; + pBuffCur->pTarget += 2; + +} + +void NDR_Put_B_Long ( // Put an immediate Long +long immediate // value to put + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 4); + + *(long PAPI *) pBuffCur->pTarget = immediate; + pBuffCur->pTarget += 4; + +} + + +void NDR_Put_Char ( // Put a char from the Target to Source + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + + *(char PAPI *) pBuffCur->pTarget = *(char PAPI *) pBuffCur->pSource; + + pBuffCur->pTarget += 1; + pBuffCur->pSource += 1; + +} + + +void NDR_Put_Short ( // Put a short from the Target to Source + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 2); + ALIGNCUR(pSource, short); + + *(short PAPI *) pBuffCur->pTarget = *(short PAPI *) pBuffCur->pSource; + + pBuffCur->pTarget += 2; + pBuffCur->pSource += 2; + +} + + +void NDR_Put_Long ( // Put a from the Target to Source + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + ALIGN(pTarget, 4); + ALIGNCUR(pSource, long); + + *(long PAPI *) pBuffCur->pTarget = *(long PAPI *) pBuffCur->pSource; + + pBuffCur->pTarget += 4; + pBuffCur->pSource += 4; + +} + + +void NDR_Put_String ( // Put a 0 terminated from the Target to Source + +) //-----------------------------------------------------------------------// +{ + short cbString; + GET_POINTER; + + ALIGN(pTarget, 2); + ALIGNCUR(pSource, short); + + *(short PAPI *) pBuffCur->pTarget = cbString = _fstrlen(*(char PAPI * PAPI *) pBuffCur->pTarget); + pBuffCur->pTarget += 2; + + NDRcopy(pBuffCur->pTarget, pBuffCur->pTarget, cbString); + pBuffCur->pSource += cbString; + +} + +void NDR_Put_Memory ( // Put a block of memory from the Target to Source +unsigned int cb + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + NDRcopy(pBuffCur->pTarget, pBuffCur->pTarget, cb); + pBuffCur->pSource += cb; + pBuffCur->pTarget += cb; + +} + + +short NDR_Get_B_Short ( // Return a short from the marshell buffer + +) //-----------------------------------------------------------------------// +{ + short ret; + GET_POINTER; + + ALIGN(pSource, 2); + + ret = *(short PAPI *) pBuffCur->pSource; + pBuffCur->pSource += 2; + + if (pBuffCur->fSwap) + return (((unsigned char *)&ret)[1]<<8 | ((unsigned char *)&ret)[0]); + else + return(ret); + +} + +long NDR_Get_B_Long ( // Return a long from the marshell buffer + +) //-----------------------------------------------------------------------// +{ + long lval; + GET_POINTER; + + ALIGN(pSource, 4); + + lval = *(long PAPI *) pBuffCur->pSource; + pBuffCur->pSource += 4; + + if (pBuffCur->fSwap) + SWAPLONG(lval) + + return(lval); + +} + +void NDR_Get_Byte( // Copy a byte from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + *(char PAPI *) pBuffCur->pTarget = *(char PAPI *) pBuffCur->pSource; + + pBuffCur->pTarget += 1; + pBuffCur->pSource += 1; + +} + +void NDR_Get_Char( // Copy a char from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + unsigned char c; + GET_POINTER; + + c = *(char PAPI *) pBuffCur->pSource; + if (fEBCDIC) + c = ebcdic_to_ascii[c]; + + *(char PAPI *) pBuffCur->pTarget = c; + + pBuffCur->pTarget += 1; + pBuffCur->pSource += 1; + +} + +void NDR_Get_Short( // Copy a short from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + short sval; + GET_POINTER; + + ALIGN(pSource, 2); + ALIGNCUR(pTarget, short); + + sval = *(short PAPI *) pBuffCur->pSource; + if (pBuffCur->fSwap) + SWAPSHORT(sval); + + *(short PAPI *) pBuffCur->pTarget = sval; + + pBuffCur->pSource += 2; + pBuffCur->pTarget += 2; +} + + +void NDR_Get_Long( // Copy a long from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + long lval; + GET_POINTER; + + ALIGN(pSource, 4); + ALIGNCUR(pTarget, long); + + lval = *(long PAPI *) pBuffCur->pSource; + if (pBuffCur->fSwap) + SWAPLONG(lval); + + *(long PAPI *) pBuffCur->pTarget = lval; + + pBuffCur->pSource += 4; + pBuffCur->pTarget += 4; +} + + +void NDR_Get_Float( // Copy a float from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + long lval; + GET_POINTER; + + ALIGN(pSource, 4); + ALIGNCUR(pTarget, long); + + lval = *(long PAPI *) pBuffCur->pSource; + if (pBuffCur->fSwap) + SWAPLONG(lval); + + switch(fFloatType) { + + case F_IEEE: + break; + + case F_VAX: + case F_CRAY: + case F_IBM: + ; + } + *(long PAPI *) pBuffCur->pTarget = lval; + + pBuffCur->pSource += 4; + pBuffCur->pTarget += 4; +} + +void NDR_Get_Double( // Copy a double from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + long lval[2]; + GET_POINTER; + + ALIGN(pSource, 4); + ALIGNCUR(pTarget, long); + + if (pBuffCur->fSwap) { + + lval[1] = *(long PAPI *) pBuffCur->pSource; + SWAPLONG(lval[1]); + + lval[0] = *((long PAPI *) pBuffCur->pSource + 1); + SWAPLONG(lval[0]); + } + else { + lval[0] = *(long PAPI *) pBuffCur->pSource; + lval[1] = *((long PAPI *) pBuffCur->pSource + 1); + } + + switch(fFloatType) { + + case F_IEEE: + break; + + case F_VAX: + case F_CRAY: + case F_IBM: + ; + } + + *(long PAPI *) pBuffCur->pTarget = lval[0]; + *((long PAPI *) pBuffCur->pTarget+1) = lval[1]; + + pBuffCur->pSource += 8; + pBuffCur->pTarget += 8; +} + +void NDR_Get_String( // Copy a string from the marshell buffer to the output buffer + +) //-----------------------------------------------------------------------// +{ + short cbString; + GET_POINTER; + + ALIGN(pSource, 2); + ALIGNCUR(pTarget, long); + + cbString = *(short PAPI *) pBuffCur->pSource; + if (pBuffCur->fSwap) + SWAPSHORT(cbString); + + pBuffCur->pSource += 2; + + if (fEBCDIC) { + + while (--cbString >= 0) + *pBuffCur->pTarget++ = ebcdic_to_ascii[*pBuffCur->pSource++]; + } + else { + NDRcopy(pBuffCur->pTarget, pBuffCur->pSource, cbString); + + pBuffCur->pTarget += cbString; + pBuffCur->pSource += cbString; + } +} + +void NDR_Get_Char_Array( // Copy a character array doing byte translation + +unsigned int Size +) //-----------------------------------------------------------------------// +{ + GET_POINTER; +} + + + +// For unmarshalling, pointers are retrieved by Get_Ptr. The current +// target offset is saved in a quque to be retrieved later. If the returned +// pointer is NIL, then no offset is retained + +void NDR_Get_Ptr( // Get a pointer and save offset for later + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + if (*(void PAPI * PAPI *)(pBuffCur->pSource)) + + *pBuffCur->pPushLast = (void PAPI *)pBuffCur->pTarget; + else + *pBuffCur->pPushLast = 0; + + pBuffCur->pPushLast++; + pBuffCur->pSource += 4; + pBuffCur->pTarget += 4; +} + +int NDR_Get_Peek_Ptr( // Return TRUE if the current saved pointer is valid + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + return(!Nilp(pBuffCur->pCur)); +} + +void NDR_Get_Next_Arg( // Set the target pointer to the next root item + +) //-----------------------------------------------------------------------// +{ + GET_POINTER; + + // set alignment back to one suitable for walking the stack + + pBuffCur->alignment = mAlignType[sizeof(int)]; + + pBuffCur->pTarget = pBuffCur->pTargetRoot; + pBuffCur->pCur = (char PAPI *) pBuffCur->pPushLast; + + pBuffCur->pTargetRoot = 0; + +} + + +int NDR_Get_Push_Unique( // Push the current target pointer and allocate memory + +unsigned int Size + +) //-----------------------------------------------------------------------// +{ + void PAPI *pT; + GET_POINTER; + + // first check to see if you have to pop back a level + + while( (PP) pBuffCur->pCur >= pBuffCur->pPushLast || + *(PP) pBuffCur->pCur == GET_END_LIST) { + + pBuffCur->pCur = (char PAPI *)pBuffCur->pPushRet; + pBuffCur->pPushRet = (PP) (PP) pBuffCur->pCur[-1]; + } + + pT = *(PP)(pBuffCur->pCur); + *(PP)pBuffCur->pCur = GET_END_LIST; + + if (!Nilp(pT)) { + + // there exists a valid pointer in the marshell buffer + + pT = *(PP)pT; + + // if there is no pointer to unmarshell into, allocate one + + if (Nilp(pT)) + pT = (pBuffCur->pAllocator)(Size); + + // if your leaving the root level, remember it for Next_Arg + + if (Nilp(pBuffCur->pTargetRoot)) + pBuffCur->pTargetRoot = pBuffCur->pTarget; + + // push the return address + + *(PP) pBuffCur->pCur = pBuffCur->pPushRet; + pBuffCur->pPushRet = (PP)pBuffCur->pCur+1; + + pBuffCur->pTarget = pT; + return (1); + } + + pBuffCur->pCur += 4; + return(0); +} diff --git a/private/rpc/ndrlib/ndrhelp.h b/private/rpc/ndrlib/ndrhelp.h new file mode 100644 index 000000000..15443ae43 --- /dev/null +++ b/private/rpc/ndrlib/ndrhelp.h @@ -0,0 +1,84 @@ +/* -------------------------------------------------------------------- + + Microsoft OS/2 LAN Manager + Copyright(c) Microsoft Corp., 1991 + +-------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- + +Description : + +Provides helper functions for data format conversion + +History : + +stevez 04-10-91 First bits into the bucket. + +-------------------------------------------------------------------- */ + +typedef struct { + int ashort; + int along; + int adouble; +} TypeAlign; + +typedef struct { + unsigned char PAPI *pSource; + unsigned char PAPI *pTarget; + + unsigned char PAPI *pCur; // General purpose cursor + void PAPI * PAPI * pPushRet; // pointer to return for push + void PAPI * PAPI * pPushLast; // pointer to last element used for push + char PAPI *pTargetRoot; // next root level argument + + void PAPI *(PAPI * pAllocator)(unsigned int); + + TypeAlign _near * alignment; + int dataType; + char fSwap; + +} NDR_BUFF, PAPI *PNDR_BUFF; + +void NDR_Pack_1 (void); +void NDR_Pack_2 (void); +void NDR_Pack_4 (void); + +void NDR_Align_2 (void); +void NDR_Align_4 (void); +void NDR_Align_8 (void); + +void NDR_Skip_B_Long (void); +void NDR_Skip_M_Long (void); + +void NDR_Put_B_Short (short); +void NDR_Put_B_Long (long); + +short NDR_Get_B_Short (void); +long NDR_Get_B_Long (void); + +void NDR_Put_Char (void); +void NDR_Put_Short (void); +void NDR_Put_Long (void); +void NDR_Put_String (void); +void NDR_Put_Memory (unsigned int cb); + +void NDR_Put_Set_Arg (void PAPI *); +void NDR_Put_Next_Arg (void); + +void NDR_Get_Byte (void); +void NDR_Get_Char (void); +void NDR_Get_Short (void); +void NDR_Get_Long (void); +void NDR_Get_Float (void); +void NDR_Get_Double (void); +void NDR_Get_String (void); +void NDR_Get_Char_Array (unsigned int); + +int NDR_Get_Peek_Ptr (void); +void NDR_Get_Ptr (void); +int NDR_Get_Push_Unique (unsigned int Size); +void NDR_Get_Next_Arg (void); + +void NDR_Put_Init (PRPC_MESSAGE Message, void PAPI * pParam); +void NDR_Get_Init (PRPC_MESSAGE Message, void PAPI * pParam); +void NDR_Register_Unique (void PAPI *(PAPI * pAllocator)(unsigned int)); diff --git a/private/rpc/ndrlib/ndrtest.cxx b/private/rpc/ndrlib/ndrtest.cxx new file mode 100644 index 000000000..98234f9ae --- /dev/null +++ b/private/rpc/ndrlib/ndrtest.cxx @@ -0,0 +1,1335 @@ + +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ndrtest.c + +Abstract: + + DCE NDR data conversion build verification test. + +Author: + + Dov Harel (DovH) 20-Apr-1992 + +Environment: + + This code should execute in all environments supported by RPC + (DOS, Win 3.X, and Win/NT as well as OS2). + +Comments: + + ASCII to EBCDIC conversion not currently tested. + +--*/ + +#include <string.h> +#include <sysinc.h> +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> + +// +// For the test program only: +// + +#include <stdio.h> +#include <malloc.h> +#include <stdlib.h> + +// +// For float test: +// + +#include <stdio.h> +#include <rpcndr.h> +#include "..\ndr20\cvt.h" +#include "..\ndr20\cvtpvt.h" + +#define NDR_BIG_ENDIAN (unsigned long)0X00000000L +#define NDR_LITTLE_ENDIAN (unsigned long)0X00000010L + +#define NDR_VAX_FLOAT (unsigned long)0X00000100L +#define NDR_IEEE_FLOAT (unsigned long)0X00000000L + +#define NDR_ASCII_CHAR (unsigned long)0X00000000L +#define NDR_EBCDIC_CHAR (unsigned long)0X00000001L + +// +// #define NDR_LOCAL_DATA_REPRESENTATION +// (unsigned long)0X00000010L +// + +#define NDR_LOCAL_DATA_REP \ + (NDR_LITTLE_ENDIAN | NDR_IEEE_FLOAT | NDR_ASCII_CHAR) + +typedef unsigned char ByteArray4[4]; +typedef unsigned char ByteArray8[8]; + +typedef ByteArray4 FloatBytesArray[5]; +typedef ByteArray8 DoubleBytesArray[5]; + +float FloatArray[5] = + { + 1000.00000000000000F, + 2.71828182846F, + 3.14159265359F, + 123.45678901234567F, + 0.33333333333333F + }; + +double DoubleArray[5] = + { + 1000.0000000000000000, + 2.7182818284601010101, + 3.141592653590314314, + 123.45678901234567, + 0.33333333333333 + }; + +float FloatChkArray[5] = + {0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; + +double DoubleChkArray[5] = + {0.0, 0.0, 0.0, 0.0, 0.0}; + +// +// The following HEX numbers were obtained by printing +// the bytes of the above float and double arrays on a VAX +// (using -Mg for the double: only the g format is supported +// by DCE). + +// +// Initialize Vax floats: +// + +ByteArray4 F0 = {0X7a, 0X45, 0X0, 0X0}; +ByteArray4 F1 = {0X2d, 0X41, 0X54, 0Xf8}; +ByteArray4 F2 = {0X49, 0X41, 0Xdb, 0Xf}; +ByteArray4 F3 = {0Xf6, 0X43, 0Xe0, 0Xe9}; +ByteArray4 F4 = {0Xaa, 0X3f, 0Xab, 0Xaa}; + +unsigned char * VaxFloats[] = {F0, F1, F2, F3, F4}; + +// +// Initialize Vax doubles: +// + +ByteArray8 D0 = { + 0xaf, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 + }; +ByteArray8 D1 = { + 0x25, 0x40, 0x0a, 0xbf, 0x14, 0x8b, 0xb3, 0x60 + }; +ByteArray8 D2 = { + 0x29, 0x40, 0xfb, 0x21, 0x44, 0x54, 0xae, 0x31 + }; +ByteArray8 D3 = { + 0x7e, 0x40, 0x3c, 0xdd, 0xfb, 0x07, 0x98, 0x4c + }; +ByteArray8 D4 = { + 0xf5, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x19, 0x55 + }; + +unsigned char * VaxDoubles[5] = {D0, D1, D2, D3, D4}; + +// +// Internal Bate swap routine from floatc.cxx: +// + +void RPC_ENTRY +NdrpLongByteSwap( + IN void PAPI * Source, + OUT void PAPI * Target + ); + + +void RPC_ENTRY +NdrTestpByteSwap( + IN int ByteCount, + IN unsigned char PAPI * Source, + OUT unsigned char PAPI * Target + ) + +/*++ + +Routine Description: + + Reverse ByteCount bytes from Source into Target. After + the call Target[0] contains Source[ByteCount-1], + Target[1] contains Dource[ByteCount-2], etc. + +Arguments: + + Source - A pointer to a byte stream Source[0], Source[1], ... + + Target - A pointer to the target byte stream: + Target[0], ... , Target[ByteCount-1]. + +Return Values: + + None. + +--*/ + +{ + + int i; + + // + // Swap bytes: + // + + for (i=0; i < ByteCount; i++) + { + Target[ByteCount-1-i] = Source[i]; + } + +} + +// +// end NdrTestpByteSwap +// + + +void * MIDL_user_allocate(size_t size) +{ + return( malloc(size) ); +} + +void MIDL_user_free(void* pointer) +{ + free(pointer); +} + +int +integer_test() + +/*++ + +Routine Description: + + Integer tests (short_from_ndr, short_array_from_ndr, long_from_ndr + and long_array_from_ndr) tested for little endian and big endian + sender. Also char_from_ndr and char_array_from_ndr tested, but only + for an ascii sender. + +Arguments: + + None. + +Return Values: + + None. + +Comment: + + BUGBUG: char_from_ndr and char_array_from_ndr not tested for an EBCDIC + sender. + +--*/ + +{ + RPC_MESSAGE Msg; + PRPC_MESSAGE PMsg = &Msg; + unsigned char PAPI * TmpBuffer; + unsigned char PAPI * OriginalBuffer; + unsigned long SenderDataRep; + + unsigned char * hello = (unsigned char *)"Hello world!"; + unsigned char world[15]; + unsigned char _hmm_[4]; + + unsigned short aShort = 0XABCD; + unsigned short aShort1 = aShort; + unsigned long aLong = 0XAABBCCDDL; + unsigned long aLong1 = aLong; + + unsigned long aLong2 = 0L; + unsigned long aLong3 = 0L; + + unsigned short shorts[2] = {0X1122, 0X3344}; + unsigned long longs[2] = {0X11223344L, 0X55667788L}; + + unsigned short chk_shorts[2] = {0X2211, 0X4433}; + unsigned long chk_longs[2] = {0X44332211L, 0X88776655L}; + + unsigned int i, index, success = 1; + + Msg.BufferLength = 256; + + // + // Start code: + // + + OriginalBuffer = (unsigned char *)malloc(256); + + for (i=0; i<2; i++) + { + // + // Set data representation for loop iteration + // + + if (i == 0) + { + SenderDataRep = NDR_BIG_ENDIAN; + Msg.DataRepresentation = SenderDataRep; + printf("\nBig Endian Integer Test:\n"); + } + else + { + SenderDataRep = NDR_LITTLE_ENDIAN; + Msg.DataRepresentation = SenderDataRep; + printf("\nLittle Endian Integer Test:\n"); + } + + printf("\nTest char / string unmarshalling first:\n"); + + TmpBuffer = OriginalBuffer; + Msg.Buffer = TmpBuffer; + + // + // Marshall chars + // + + *TmpBuffer++ = 'A'; + *TmpBuffer++ = '-'; + *TmpBuffer++ = ' '; + *TmpBuffer++ = '\0'; + + // + // Marshall string + // + + strcpy( (char *)TmpBuffer, (char *)hello); + + // + // Unmarshall first string, one character at a time: + // + + for (index = 0; index < 4; index++) + { + char_from_ndr(PMsg, &_hmm_[index]); + } + + // + // Unmarshall second string as an array of chars: + // + + char_array_from_ndr(PMsg, 0, 13, world); + + printf("\n%s\n", _hmm_); + printf("%s\n", world); + + // + // Align buffer, sync TmpBuffer and Msg.Buffer: + // + + TmpBuffer = (unsigned char *)Msg.Buffer; + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 3; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFFCL); + Msg.Buffer = TmpBuffer; + + // + // TmpBuffer is (0 mod 4) aligned + // + + *(*(unsigned long **)&PMsg->Buffer)++ = aLong; + *(*(unsigned short **)&PMsg->Buffer)++ = aShort; + + Msg.Buffer = TmpBuffer; + + printf("\n"); + + printf("%x \n", aLong); + long_from_ndr(PMsg, &aLong); + printf("%x \n", aLong); + + printf("%8.4x \n", aShort); + short_from_ndr(PMsg, &aShort); + printf("%8.4x \n", aShort); + + // + // Realign buffer + // + + (*(unsigned long *)&Msg.Buffer) += 3; + (*(unsigned long *)&Msg.Buffer) &= (unsigned long)0XFFFFFFFCL; + + TmpBuffer = (unsigned char *)Msg.Buffer; + + *(*(unsigned long **)&PMsg->Buffer)++ = aLong; + *(*(unsigned short **)&PMsg->Buffer)++ = aShort; + + Msg.Buffer = TmpBuffer; + + printf("\n"); + + printf("%x \n", aLong); + long_from_ndr_temp((unsigned char **)&PMsg->Buffer, &aLong, SenderDataRep); + printf("%x \n", aLong); + + printf("%8.4x \n", aShort); + short_from_ndr_temp((unsigned char **)&PMsg->Buffer, &aShort, SenderDataRep); + printf("%8.4x \n", aShort); + + // + // Internal test (NdrpLongByteSwap and NdrTestpByteSwap: + // + + printf("\n"); + printf("%x \n", aLong); + NdrpLongByteSwap(&aLong, &aLong2); + printf("%x \n", aLong2); + NdrTestpByteSwap( + 4, + (unsigned char PAPI *)&aLong2, + (unsigned PAPI char PAPI *)&aLong3 + ); + printf("%x \n", aLong3); + printf("\n"); + + // + // General success / failure message printing + // + + printf("\n"); + + if (aLong == aLong1) + { + printf("Long success!\n"); + } + else + { + printf("Long failure???\n"); + } + + if (aShort == aShort1) + { + printf("Short success!\n"); + } + else + { + printf("Short failure???\n"); + } + + // + // Realign buffer + // + + (*(unsigned long *)&Msg.Buffer) += 3; + (*(unsigned long *)&Msg.Buffer) &= (unsigned long)0XFFFFFFFCL; + + TmpBuffer = (unsigned char *)Msg.Buffer; + + for (index=0; index<2; index++) + { + *(*(unsigned long **)&PMsg->Buffer)++ = longs[index]; + } + + for (index=0; index<2; index++) + { + *(*(unsigned short **)&PMsg->Buffer)++ = shorts[index]; + } + + Msg.Buffer = TmpBuffer; + + printf("\n"); + + printf("%x %x\n", longs[0], longs[1]); + long_array_from_ndr(PMsg, 0, 2, longs); + printf("%x %x\n", longs[0], longs[1]); + + printf("%8.4x %8.4x\n", shorts[0], shorts[1]); + short_array_from_ndr(PMsg, 0, 2, shorts); + printf("%8.4x %8.4x\n", shorts[0], shorts[1]); + + // + // Check for arrays success / failure + // + + for (index=0; index<2; index++) + { + if ( (shorts[index] != chk_shorts[index]) || + (longs[index] != chk_longs[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("Short & long array success!\n"); + } + else + { + printf("Short / long array failure???\n"); + } + } + + free(OriginalBuffer); + + return(success); +} + +int +vax_float_test() + +/*++ + +Routine Description: + + Floating point tests (float_from_ndr, float_array_from_ndr, + double_from_ndr and double_array_from_ndr) tested against a VAX + VMS floating point sender. These exercise the DEC floating point + conversion routines + +Arguments: + + None. + +Return Values: + + None. + +Comment: + + BUGBUG: Floating point conversion is not tested against an IBM + sender. + +--*/ + +{ + RPC_MESSAGE Msg; + PRPC_MESSAGE PMsg = &Msg; + unsigned char PAPI * TmpBuffer; + unsigned char PAPI * OriginalBuffer; + unsigned char PAPI * AlignedBuffer; + unsigned long SenderDataRep; + + unsigned int i, j, index, success = 1; + /* + CVT_VAX_F inputf; + CVT_IEEE_SINGLE outputf; + CVT_VAX_G inputg; + CVT_IEEE_DOUBLE outputg; + */ + + // + // Code start: + // + + Msg.BufferLength = 256; + OriginalBuffer = (unsigned char *)malloc(256); + Msg.Buffer = OriginalBuffer; + + SenderDataRep = NDR_VAX_FLOAT; + Msg.DataRepresentation = SenderDataRep; + + //******************// + // VAX Float Test // + //******************// + + TmpBuffer = OriginalBuffer; + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 3; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFFCL); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + for (j=0; j<4; j++) + { + *TmpBuffer++ = VaxFloats[i][j]; + } + } + + for (i=0; i<5; i++) + { + float_from_ndr(PMsg, &FloatChkArray[i]); + } + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("VAX float success!\n"); + } + else + { + printf("VAX float failure???\n"); + + success = 1; + } + + //******************// + // VAX Double Test // + //******************// + + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 7; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFF8L); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + for (j=0; j<8; j++) + { + *TmpBuffer++ = VaxDoubles[i][j]; + } + } + + for (i=0; i<5; i++) + { + double_from_ndr(PMsg, &DoubleChkArray[i]); + } + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("VAX double success!\n"); + } + else + { + printf("VAX double failure???\n"); + + success = 1; + } + + //************************// + // VAX Float Array Test // + //************************// + + Msg.Buffer = OriginalBuffer; + + float_array_from_ndr(PMsg, 0, 5, FloatChkArray); + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("VAX float array success!\n"); + } + else + { + printf("VAX float array failure???\n"); + + success = 1; + } + + //************************// + // VAX Double Array Test // + //************************// + + double_array_from_ndr(PMsg, 0, 5, DoubleChkArray); + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("VAX double array success!\n"); + } + else + { + printf("VAX double array failure???\n"); + + success = 1; + } + + // *(*(unsigned long **)&PMsg->Buffer)++ = aLong; + + free(OriginalBuffer); + + return(success); +} + +int +little_endian_ieee_float_test() + +/*++ + +Routine Description: + + Floating point tests (float_from_ndr, float_array_from_ndr, + double_from_ndr and double_array_from_ndr) tested against a + little endian IEEE floating point sender (such as Intel X86, MIPS, + DecStation running Ultrix). + +Arguments: + + None. + +Return Values: + + None. + +Comment: + + BUGBUG: Floating point conversion is not tested against an IBM + sender. + +--*/ + +{ + RPC_MESSAGE Msg; + PRPC_MESSAGE PMsg = &Msg; + unsigned char PAPI * TmpBuffer; + unsigned char PAPI * OriginalBuffer; + unsigned char PAPI * AlignedBuffer; + unsigned long SenderDataRep; + + unsigned int i, j, index, success = 1; + // + // Code start: + // + + Msg.BufferLength = 256; + OriginalBuffer = (unsigned char *)malloc(256); + Msg.Buffer = OriginalBuffer; + + // SenderDataRep = NDR_IEEE_FLOAT; + + SenderDataRep = NDR_LOCAL_DATA_REP; + Msg.DataRepresentation = SenderDataRep; + + //*******************// + // IEEE Float Test // + //*******************// + + TmpBuffer = OriginalBuffer; + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 3; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFFCL); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + for (j=0; j<4; j++) + { + *TmpBuffer++ = ((unsigned char *)&FloatArray[i])[j]; + } + } + + for (i=0; i<5; i++) + { + float_from_ndr(PMsg, &FloatChkArray[i]); + } + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE little endian float success!\n"); + } + else + { + printf("IEEE little endian float failure???\n"); + + success = 1; + } + + //*******************// + // IEEE Double Test // + //*******************// + + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 7; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFF8L); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + for (j=0; j<8; j++) + { + *TmpBuffer++ = ((unsigned char *)&DoubleArray[i])[j]; + } + } + + for (i=0; i<5; i++) + { + double_from_ndr(PMsg, &DoubleChkArray[i]); + } + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE little endian double success!\n"); + } + else + { + printf("IEEE little endian double failure???\n"); + + success = 1; + } + + //*************************// + // IEEE Float Array Test // + //*************************// + + Msg.Buffer = OriginalBuffer; + + float_array_from_ndr(PMsg, 0, 5, FloatChkArray); + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE little endian float array success!\n"); + } + else + { + printf("IEEE little endian float array failure???\n"); + + success = 1; + } + + //*************************// + // IEEE Double Array Test // + //*************************// + + double_array_from_ndr(PMsg, 0, 5, DoubleChkArray); + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE little endian double array success!\n"); + } + else + { + printf("IEEE little endian double array failure???\n"); + + success = 1; + } + + // *(*(unsigned long **)&PMsg->Buffer)++ = aLong; + + free(OriginalBuffer); + + return(success); +} + +int +big_endian_ieee_float_test() + +/*++ + +Routine Description: + + Floating point tests (float_from_ndr, float_array_from_ndr, + double_from_ndr and double_array_from_ndr) tested against a + big endian IEEE floating point sender (such as HP). + +Arguments: + + None. + +Return Values: + + None. + +Comment: + + BUGBUG: Floating point conversion is not tested against an IBM + sender. + +--*/ + +{ + RPC_MESSAGE Msg; + PRPC_MESSAGE PMsg = &Msg; + unsigned char PAPI * TmpBuffer; + unsigned char PAPI * OriginalBuffer; + unsigned char PAPI * AlignedBuffer; + unsigned long SenderDataRep; + + unsigned int i, index, success = 1; + // + // Code start: + // + + Msg.BufferLength = 256; + OriginalBuffer = (unsigned char *)malloc(256); + Msg.Buffer = OriginalBuffer; + + // SenderDataRep = NDR_IEEE_FLOAT; + + SenderDataRep = NDR_BIG_ENDIAN; + // SenderDataRep = 0XFFFFFFFFL; + Msg.DataRepresentation = SenderDataRep; + + //*******************// + // IEEE Float Test // + //*******************// + + TmpBuffer = OriginalBuffer; + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 3; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFFCL); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + + // + // Copy FloatArray into TmpBuffer swapping bytes + // + + NdrTestpByteSwap(4, (unsigned char PAPI *)&FloatArray[i], TmpBuffer); + + TmpBuffer += 4; + + /* + for (j=0; j<4; j++) + { + *TmpBuffer++ = ((unsigned char *)&FloatArray[i])[j]; + } + */ + } + + for (i=0; i<5; i++) + { + float_from_ndr(PMsg, &FloatChkArray[i]); + } + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE big endian float success!\n"); + } + else + { + printf("IEEE big endian float failure???\n"); + + success = 1; + } + + //*******************// + // IEEE Double Test // + //*******************// + + TmpBuffer = (unsigned char *)(unsigned long)TmpBuffer + 7; + TmpBuffer = (unsigned char *) ((unsigned long)TmpBuffer & (unsigned long)0XFFFFFFF8L); + + // + // TmpBuffer is (0 mod 4) aligned + // + + AlignedBuffer = TmpBuffer; + + for (i=0; i<5; i++) + { + + // + // Copy DoubleArray into TmpBuffer swapping bytes + // + + NdrTestpByteSwap(8, (unsigned char PAPI *)&DoubleArray[i], TmpBuffer); + + TmpBuffer += 8; + + /* + for (j=0; j<8; j++) + { + *TmpBuffer++ = ((unsigned char *)&DoubleArray[i])[j]; + } + */ + } + + for (i=0; i<5; i++) + { + double_from_ndr(PMsg, &DoubleChkArray[i]); + } + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE big endian double success!\n"); + } + else + { + printf("IEEE big endian double failure???\n"); + + success = 1; + } + + //*************************// + // IEEE Float Array Test // + //*************************// + + Msg.Buffer = OriginalBuffer; + + float_array_from_ndr(PMsg, 0, 5, FloatChkArray); + + printf("\n"); + for (i=0; i<5; i++) + { + printf("Float : %30.20f \n", FloatArray[i]); + printf("Check : %30.20f \n", FloatChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (FloatArray[index] != FloatChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE big endian float array success!\n"); + } + else + { + printf("IEEE big endian float array failure???\n"); + + success = 1; + } + + //*************************// + // IEEE Double Array Test // + //*************************// + + double_array_from_ndr(PMsg, 0, 5, DoubleChkArray); + + printf("\n"); + + for (i=0; i<5; i++) + { + printf("Double: %30.20f \n", DoubleArray[i]); + printf("Check : %30.20f \n", DoubleChkArray[i]); + }; + + // + // Check for arrays success / failure + // + + for (index=0; index<5; index++) + { + if ( (DoubleArray[index] != DoubleChkArray[index]) ) + { + success = 0; + } + } + + // + // General success / failure message printing + // + + printf("\n"); + + if (success == 1) + { + printf("IEEE big endian double array success!\n"); + } + else + { + printf("IEEE big endian double array failure???\n"); + + success = 1; + } + + // *(*(unsigned long **)&PMsg->Buffer)++ = aLong; + + free(OriginalBuffer); + + return(success); +} + +// +// Main test driver +// + +void +main () + +{ + integer_test(); + + vax_float_test(); + + little_endian_ieee_float_test(); + + big_endian_ieee_float_test(); + +} + diff --git a/private/rpc/ndrlib/rules.mk b/private/rpc/ndrlib/rules.mk new file mode 100644 index 000000000..5a9d1d662 --- /dev/null +++ b/private/rpc/ndrlib/rules.mk @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : rules.mk +# +# Description : +# This is an extra file to be included by the makefiles in subdirectories. +# As far as I can tell, the sole purpose for this file is to slow down the +# build process; it will be a good excuse to get a faster machine. +# +# History : +# mikemon 02-02-91 Created. +# mariogo 02-10-94 Mario hates the old build system +# -------------------------------------------------------------------- + +!include $(RPC)\rules.mk + diff --git a/private/rpc/ndrlib/scontext.cxx b/private/rpc/ndrlib/scontext.cxx new file mode 100644 index 000000000..7ce2700a2 --- /dev/null +++ b/private/rpc/ndrlib/scontext.cxx @@ -0,0 +1,406 @@ +/* -------------------------------------------------------------------- + + Microsoft OS/2 LAN Manager + Copyright(c) Microsoft Corp., 1991 + +-------------------------------------------------------------------- */ +/* -------------------------------------------------------------------- + +Description : + +Provides RPC server side stub context management + +History : + +stevez 01-15-91 First bits into the bucket. + +-------------------------------------------------------------------- */ + +#include <sysinc.h> +#include <rpc.h> +#include <rpcdcep.h> +#include <rpcndr.h> +#include <rpcssp.h> +#include <util.hxx> +#include <linklist.hxx> +#include <osfpcket.hxx> +#include <rpcuuid.hxx> +#include <binding.hxx> +#include <handle.hxx> +#include <threads.hxx> + +enum { /* states for NDRCONTEXT.type */ + PendingAlloc = -1, /* new context being allocated */ + CompletedAlloc = 0 /* allocated context */ +}; + +typedef struct _WIRE_CONTEXT +{ + unsigned long ContextType; + UUID ContextUuid; +} WIRE_CONTEXT; + +LINK_LIST(SCONTEXT, + + SCONTEXTItem(); + + void * userContext; /* context for the user */ + NDR_RUNDOWN userRunDown; /* user routine to call */ + + WIRE_CONTEXT NDR; + CRITICAL_SECTION CriticalSection; + void __RPC_FAR * NextServerContext; + unsigned int ReferenceCount; + unsigned int DeletedFlag; +); + +typedef struct { + I_RPC_MUTEX access; /* multi thread protection */ + SCONTEXTList List; /* context link list header */ +} SCONTEXT; + +// Server context handle + +static WIRE_CONTEXT SContextNil; // all zeros +static I_RPC_MUTEX newContext = 0; // protection for new contexts + +static unsigned int DontSerializeContext = 0; + +#ifdef NTENV +#include <memory.h> +#endif // NTENV + + +void +DestoryContext( // perform association closed processing + +IN SCONTEXT * pSContext // context chain to process + +) //-----------------------------------------------------------------------// +{ + SCONTEXTItem * pSC, *pSCNext; + + // for each user created context for this assoication, call the + // rundown routine for the context + + for (pSC = pSContext->List.First(); pSC; pSC = pSCNext) + { + + // Only contexts which have a rundown and + // are valid are cleaned up. + + if (pSC->userRunDown != Nil && pSC->userContext) + (*pSC->userRunDown)(pSC->userContext); + + pSCNext = pSC->Next(); + if ( DontSerializeContext == 0 ) + { + DeleteCriticalSection(&(pSC->CriticalSection)); + } + I_RpcFree(pSC); + } + + I_RpcDeleteMutex(pSContext->access); + I_RpcFree(pSContext); +} + + +void +NdrAfterCallProcessing ( + IN void __RPC_FAR * ServerContextList + ) +/*++ + +Routine Description: + + This routine will be called after the remote procedure call has completed. + For each context handle, we will leave the critical section so that + another thread can use the context handle. + +Arguments: + + ServerContextList - Supplies the list of context handles. + +--*/ +{ + SCONTEXTItem * ServerContext; + SCONTEXT * ServerContextInfo; + SCONTEXTItem * DeleteMe; + + I_RpcGetAssociationContext((void **) &ServerContextInfo); + ASSERT( ServerContextInfo != 0 ); + + for (ServerContext = (SCONTEXTItem *) ServerContextList; + ServerContext != 0;) + { + I_RpcRequestMutex(&(ServerContextInfo->access)); + ServerContext->ReferenceCount -= 1; + LeaveCriticalSection(&(ServerContext->CriticalSection)); + if ( ( ServerContext->DeletedFlag != 0 ) + && ( ServerContext->ReferenceCount == 0 ) ) + { + DeleteMe = ServerContext; + ServerContext = (SCONTEXTItem *) ServerContext->NextServerContext; + DeleteCriticalSection(&(DeleteMe->CriticalSection)); + I_RpcFree(DeleteMe); + } + else + { + ServerContext = (SCONTEXTItem *) ServerContext->NextServerContext; + } + I_RpcClearMutex(ServerContextInfo->access); + } +} + + +static void +ByteSwapWireContext( + IN WIRE_CONTEXT PAPI * WireContext, + IN unsigned char PAPI * DataRepresentation + ) +/*++ + +Routine Description: + + If necessary, the wire context will be byte swapped in place. + +Arguments: + + WireContext - Supplies the wire context be byte swapped and returns the + resulting byte swapped context. + + DataRepresentation - Supplies the data representation of the supplied wire + context. + +--*/ +{ + if ( ( DataConvertEndian(DataRepresentation) != 0 ) + && ( WireContext != 0 ) ) + { + ByteSwapLong(WireContext->ContextType); + ByteSwapLong(WireContext->ContextUuid.Data1); + ByteSwapShort(WireContext->ContextUuid.Data2); + ByteSwapShort(WireContext->ContextUuid.Data3); + } +} + + +NDR_SCONTEXT RPC_ENTRY +NDRSContextUnmarshall ( // translate a NDR context to a handle + +IN void *pBuff, // pointer to NDR context +IN unsigned long DataRepresentation // specifies the NDR data representation + + // The stub calls this routine to lookup a NDR wire format context into + // a context handle that can be used with the other context functions + // provided for the stubs use. +) //-----------------------------------------------------------------------// +{ + SCONTEXTItem * pSC; + SCONTEXT * pSContext; + THREAD * Thread; + + // make sure the public structure and our private ones agree + + ASSERT(((PVOID)&((SCONTEXTItem *)0)->userContext) + == ((PVOID)NDRSContextValue((NDR_SCONTEXT)0))); + + ByteSwapWireContext((WIRE_CONTEXT PAPI *) pBuff, + (unsigned char PAPI *) &DataRepresentation); + + I_RpcGetAssociationContext((void **) &pSContext); + + if (!pSContext) // initial context list + { + + // newContext is used to serialize creation of new contexts + + I_RpcRequestMutex(&newContext); + I_RpcGetAssociationContext((void **) &pSContext); + + if (!pSContext) // if there still isn't a context + { + + pSContext = (SCONTEXT *) I_RpcAllocate(sizeof(SCONTEXT)); + if (!pSContext) + { + I_RpcClearMutex(newContext); + RpcRaiseException(RPC_S_OUT_OF_MEMORY); + } + + memset(pSContext,0,sizeof(SCONTEXT)); + + // Use the context field to point the head of the list of + // contexts and set the cleanup routine to be our own + + I_RpcMonitorAssociation(I_RpcGetCurrentCallHandle(), + (PRPC_RUNDOWN) DestoryContext, pSContext); + } + + I_RpcClearMutex(newContext); + } + + I_RpcRequestMutex(&(pSContext->access)); + + if (!pBuff || memcmp(pBuff, &SContextNil, sizeof(SContextNil)) == 0) + { + // allocate a new context for the Nil GUID context + + pSC = (SCONTEXTItem *) I_RpcAllocate(sizeof(SCONTEXTItem)); + if (!pSC) + { + I_RpcClearMutex(pSContext->access); + RpcRaiseException(RPC_S_OUT_OF_MEMORY); + } + + memset(pSC,0,sizeof(SCONTEXTItem)); + pSC->NDR.ContextType = (unsigned long) PendingAlloc; + pSContext->List.Add(pSC); + if ( DontSerializeContext == 0 ) + { + InitializeCriticalSection(&(pSC->CriticalSection)); + pSC->ReferenceCount = 0; + pSC->DeletedFlag = 0; + } + } + else + { + int cSearched = 0; // how far we look on this list + + // search the linked list for the GUID that matchs + + for (pSC = pSContext->List.First(); pSC; pSC = pSC->Next(), cSearched++) + + if (memcmp(pBuff, &pSC->NDR, sizeof(WIRE_CONTEXT)) == 0) + goto found; + + I_RpcClearMutex(pSContext->access); + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + +found:; + // speed optimization: put found SC at head of list + + if (cSearched > 10) + { + pSC->Remove(pSContext->List); + pSContext->List.Add(pSC); + } + } + + if ( DontSerializeContext == 0 ) + { + pSC->ReferenceCount += 1; + } + I_RpcClearMutex(pSContext->access); + if ( DontSerializeContext == 0 ) + { + EnterCriticalSection(&(pSC->CriticalSection)); + I_RpcRequestMutex(&(pSContext->access)); + if ( pSC->DeletedFlag != 0 ) + { + LeaveCriticalSection(&(pSC->CriticalSection)); + pSC->ReferenceCount -= 1; + if ( pSC->ReferenceCount == 0 ) + { + DeleteCriticalSection(&(pSC->CriticalSection)); + I_RpcFree(pSC); + } + I_RpcClearMutex(pSContext->access); + RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH); + } + I_RpcClearMutex(pSContext->access); + + Thread = ThreadSelf(); + ASSERT( Thread != 0 ); + pSC->NextServerContext = Thread->ServerContextList; + Thread->ServerContextList = (void __RPC_FAR *) pSC; + } + + return ((NDR_SCONTEXT) pSC); +} + + +void RPC_ENTRY +NDRSContextMarshall ( // copy out a server context + +IN OUT NDR_SCONTEXT hContext, // stub context to update +OUT void *pBuff, // buffer to marshell to +IN NDR_RUNDOWN userRunDownIn // user function to bind to context + + // This is called by the stubs after a OUT or IN/OUT context call. It + // will do the final allocation or delete destory contexts & marshall the + // new context to the supplied buffer +) //-----------------------------------------------------------------------// +{ +#define pSC ((SCONTEXTItem *)hContext) + + SCONTEXT * pSContext; + + if (pSC->userContext == Nil) + { + // the server code deleted this context, thus remove this context + // from the list of active contexts + + I_RpcGetAssociationContext((void **) &pSContext); + + I_RpcRequestMutex(&(pSContext->access)); + pSC->Remove(pSContext->List); + if ( DontSerializeContext == 0 ) + { + pSC->DeletedFlag = 1; + } + else + { + I_RpcFree(pSC); + } + hContext = Nil; + + I_RpcClearMutex(pSContext->access); + } + + if (!pSC) // return Nil content when deleted + { + memcpy(pBuff, &SContextNil, sizeof(WIRE_CONTEXT)); + return; + } + + if (pSC->NDR.ContextType == PendingAlloc) + { + + pSC->userRunDown = userRunDownIn; + + // this is a new context, allocate the GUID now + + pSC->NDR.ContextType = CompletedAlloc; + +#ifdef DOSWIN32RPC + UuidCreate((UUID PAPI *) &(pSC->NDR.ContextUuid)); +#else + I_UuidCreate((UUID PAPI *) &(pSC->NDR.ContextUuid)); +#endif + } + + memcpy(pBuff, &pSC->NDR, sizeof(WIRE_CONTEXT)); + +#undef pSC +} + + +void RPC_ENTRY +I_RpcSsDontSerializeContext ( + void + ) +/*++ + +Routine Description: + + By default, context handles are serialized at the server. The spooler + makes use of a single context handle by two threads at a time. This + API is used by spoolss.exe to turn off serializing access to context + handles. + +--*/ +{ + DontSerializeContext = 1; +} + diff --git a/private/rpc/ndrlib/sources b/private/rpc/ndrlib/sources new file mode 100644 index 000000000..4d51696c0 --- /dev/null +++ b/private/rpc/ndrlib/sources @@ -0,0 +1,107 @@ +!IF 0 + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + sources. + +Abstract: + + This file specifies the target component being built and the list of + sources files needed to build that component. Also specifies optional + compiler switches and libraries that are unique for the component being + built. + + +Author: + + Steve Wood (stevewo) 12-Apr-1989 + + +Revision History: + +!ENDIF + +# +# The TARGETNAME variable is defined by the developer. It is the name of +# the target (component) that is being built by this makefile. It +# should NOT include any path or file extension information. +# + +TARGETNAME=RpcNdrp + +# +# The TARGETPATH and TARGETTYPE varialbes are defined by the developer. +# The first specifies where the target is to be build. The second specifies +# the type of target (either PROGRAM, DYNLINK or LIBRARY) +# + + +# TARGETPATH=obj + +TARGETPATH=$(BASEDIR)\public\sdk\lib +TARGETTYPE=LIBRARY + +# +# The INCLUDES variable specifies any include paths that are specific to +# this source directory. Separate multiple directory paths with single +# semicolons. Relative path specifications are okay. +# + +INCLUDES=.;..\runtime\mtrt + + + +# +# The SOURCES variable is defined by the developer. It is a list of all the +# source files for this component. Each source file should be on a separate +# line using the line continuation character. This will minimize merge +# conflicts if two developers adding source files to the same component. +# + +SOURCES= \ + scontext.cxx \ + ccontext.cxx \ + dataconv.cxx \ + charconv.cxx \ + intconv.cxx \ + floatc.cxx \ + linklist.cxx \ + help.c + +# ndrtest.c + +!ifdef DOSWIN32RPC +RPCENV=-DDOSWIN32RPC -DWIN32RPC +!else +RPCENV=-DNTENV -DWIN32RPC -DNTWIN32RPC -DMSWMSG +!endif + +C_DEFINES=$(RPCENV) + +BLDCRT=1 + +MSC_WARNING_LEVEL=/WX + +# +# Defining the NTTARGETFILES variable causes MAKEFILE.DEF to attempt to +# include .\makefile.inc immediately after it specifies the top +# level targets (all, clean and loc) and their dependencies. MAKEFILE.DEF +# also expands the value of the NTTARGETFILES variable at the end of the +# list of dependencies for the all target. Useful for specifying additional +# targets and dependencies that don't fit the general case covered by +# MAKEFILE.DEF +# + +NTTARGETFILES=linklist.cxx + +UMTYPE=console +UMTEST=ndrtest +UMLIBS=$(TARGETPATH)\*\rpcndrp.lib \ + $(BASEDIR)\public\sdk\lib\*\rpcrt4.lib \ + obj\*\charconv.obj \ + obj\*\intconv.obj \ + obj\*\dataconv.obj \ + obj\*\floatc.obj + diff --git a/private/rpc/ndrlib/ssdef.h b/private/rpc/ndrlib/ssdef.h new file mode 100644 index 000000000..8ab00946c --- /dev/null +++ b/private/rpc/ndrlib/ssdef.h @@ -0,0 +1,785 @@ +/********************************************************************************************************************************/ +/* Created 15-JAN-1990 14:02:52 by VAX SDL V3.2-12 Source: 15-JAN-1990 14:02:37 WKD$:[MIPS]Q.SDL;1 */ +/********************************************************************************************************************************/ + +/*** MODULE $SSDEF ***/ +/* */ +/* This SDL File Generated by VAX-11 Message V04-00 on 15-JAN-1990 14:02:38.47 */ +/* */ +/* SSMSG.SDL - SYSTEM DEFINITION FILE FOR SYSTEM SERVICE MESSAGES */ +/* */ +/* VERSION: 'X-46U7' */ +/* */ +/***************************************************************************** */ +/** * */ +/** COPYRIGHT (C) 1978, 1980, 1982, 1984, 1989 BY * */ +/** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * */ +/** ALL RIGHTS RESERVED. * */ +/** * */ +/** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * */ +/** ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * */ +/** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * */ +/** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * */ +/** OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * */ +/** TRANSFERRED. * */ +/** * */ +/** THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * */ +/** AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * */ +/** CORPORATION. * */ +/** * */ +/** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * */ +/** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * */ +/** * */ +/** * */ +/***************************************************************************** */ +/*++ */ +/* */ +/* FACILITY: VAX/VMS SYSTEM MACRO LIBRARIES */ +/* */ +/* ABSTRACT: */ +/* */ +/* THIS FILE CONTAINS THE SDL SOURCE FOR SYSTEM SERVICE MESSAGES. */ +/* */ +/* ENVIRONMENT: */ +/* */ +/* N/A */ +/* */ +/*-- */ +/* */ +/* */ +/* AUTHOR: THE VMS GROUP CREATION DATE: 1-AUG-1976 */ +/* */ +/* MODIFIED BY: */ +/* */ +/* X-46U7 LBB0010 LEE BARTON 30-NOV-1989 */ +/* ADD SS$_ARCHIVING, SS$_ARCHIVED (XQP SUPPORT OF ALM) */ +/* */ +/* X-46U6 LMP0517 L. MARK PILANT, 17-OCT-1989 16:42 */ +/* ADD PROTECTED SUBSYSTEM SUPPORT. */ +/* */ +/* X-46U5 RLF RICHARD L. FRANK 16-OCT-1989 */ +/* MODIFY INSFSPTS TO BE MORE GENERIC. ADD INSFRPGS AND */ +/* INSFLPGS. */ +/* */ +/* X-46U4 CAM0072 CHRISTOPHER A. MEGA 06-OCT-1989 */ +/* CHANGED CPUSTOPPD TO CPUSTOPPING */ +/* */ +/* X-46U3 DDP0546 DERRELL D. PIPER 4-OCT-1989 14:24 */ +/* ADD SS$_NOCALLPRIV FOR $CHECK_ACCESS. */ +/* */ +/* X-46U2 PRD0503 PAUL R. DESTEFANO 25-SEP-1989 */ +/* ADD SS$_NOSUCHFAC FOR EVENT FACILITY OBJECT SECURITY. */ +/* */ +/* X-46U1 PRD0495 PAUL R. DESTEFANO 18-SEP-1989 */ +/* ADD SS$_INVEVENT FATAL MESSAGE FOR $SETEVTAST AND */ +/* $CANEVTAST. */ +/* */ +/* X-46 SAS0203 SCOTT A. SHURTS 15-SEP-1989 */ +/* ADD SS$_INCONOLCK FATAL MESSAGE FOR $CHANGE_ACL. */ +/* */ +/* X-45 CAM0063 CHRISTOPHER A. MEGA 13-SEP-1989 */ +/* ADD WARNING AND INFORMATIONAL STATUS FOR ENHANCED PRIMARY */ +/* CPU SWITCHING: CPUSTARTIP, CPUSTARTD, CPUSTOPPD, PRIMNOSTP. */ +/* ALSO ADDED /FAO=1 TO NSTPPD. */ +/* */ +/* X-44 DDP0429 DERRELL D. PIPER 11-SEP-1989 16:57 */ +/* CHANGE THE SEVERITY OF THE NEW PASSWORD STATUS CODES */ +/* FROM FATAL TO ERROR. */ +/* */ +/* X-43 CBD0198 CHARLES B. DUNN 14-AUG-1989 */ +/* ADD SS$_EFNOTSET FOR IOC$PRE_SIMREQCOM SUPPORT */ +/* */ +/* X-42 RAP0491 ROD A. PAYNE 15-AUG-89 */ +/* ADD SS$_HSTBUFACC, TO REPORT HOST BUFFER ACCESS ERRORS. */ +/* */ +/* X-41 CJB0041 CHERYL J. BULMER 9-AUG-1989 */ +/* ADD SS$_LOADER, TO REPORT LOADER CYCLE ERRORS. */ +/* */ +/* X-40 MAS0238 MARK A. STILES 9-AUG-1989 */ +/* ADD SS$_CPUCAP FOR USE WHEN A REQUESTED CPU DOES NOT */ +/* HAVE THE CAPABILITIES REQUIRED TO RUN THE PROCESS. */ +/* [FOLD FROM X-29U11 IN V5.3 STREAM] */ +/* */ +/* X-39 MVI0033 MICHAEL V. ILES, 28-JUL-1989 10:08:05.45 */ +/* ADD MESSAGE CODE NOSUCHCPB AND CHANGE TEXT FOR ACLFULL */ +/* */ +/* X-38 DDP0387 DERRELL D. PIPER 25-JUL-1989 12:47 */ +/* ADD MESSAGE CODES FOR SITE-SPECIFIC PASSWORD POLICIES. */ +/* */ +/* X-37 DDP0375 DERRELL D. PIPER 31-MAY-1989 15:12 */ +/* REPLACE SOME OBSOLETE MESSAGE CODES. */ +/* */ +/* X-36 HH0340 HAI HUANG 03-OCT-1988 */ +/* ADD VECALIGN ERROR. */ +/* */ +/* X-35 SSA0002 STAN AMWAY 30-SEP-1988 */ +/* CORRECT TEXT FOR SS$_VECFULL. */ +/* */ +/* X-34 JEJ0550 JAMES E JOHNSON 19-SEP-1988 */ +/* ADD ALRCURTID, RMALRDCL, NOSUCHPART, INVLOG, BADLOGVER, */ +/* LOGSTALL, LOGFULL, LOGNAME. */ +/* */ +/* X-33 SSA0001 STAN AMWAY 14-SEP-1988 */ +/* ADD NOSUSPEND ("process cannot be suspended"). */ +/* */ +/* X-32 RJB0165 RICHARD J. BOUCHARD JR. 14-SEP-1988 */ +/* ADD NOMOREDEV MESSAGE FOR $DEVICE_SCAN SERVICE. */ +/* */ +/* X-31 ACG0559 ANDREW C. GOLDSTEIN, 31-AUG-1988 16:28 */ +/* ADD HWM_STALL FOR ABORT OF STALLED INTERNAL IRP'S */ +/* */ +/* X-30 HH0334 HAI HUANG 31-AUG-1988 */ +/* REPLACE SYSVERDIF WITH A NEW VALUE (I.E. SEVERITY) AND */ +/* A NEW MESSAGE. */ +/* */ +/* X-29 DDP0308 DERRELL D. PIPER 21-JUL-1988 14:02 */ +/* ADD PWDSYNTAX, INVPWDLEN, AND PWDNOTDIF. */ +/* */ +/* X-28 JEJ0527 JAMES E JOHNSON 27-JUN-1988 */ +/* ADD NOSUCHTID, NOCURTID, WRONGSTATE, VETO, UNKRESULT, */ +/* FORGET, PREPARED, NOSUCHRM, ITEMNOTFOUND, NOMOREITEMS */ +/* */ +/* X-26 HH0315 HAI HUANG 18-APR-1988 */ +/* -27 ADD NEW STATUS CODES FOR VECTOR SUPPORT. */ +/* */ +/* X-25 PT00010 PANKAJ TANDON 30-DEC-1987 */ +/* ADD ALLSTARTED,ALRDYSTRT,ALRDYSTPPD AND NSTPPD FOR */ +/* $START/STOP CPU ERRONEOUS CASES. */ +/* */ +/* X-24 LMP0465 L. MARK PILANT, 28-OCT-1987 15:58 */ +/* ADD A NEW MESSAGE, SS$_NORIGHTSDB, TO INDICATE THAT THERE */ +/* IS NOT A RIGHTS DATABASE IS NOT PRESENT ON THE SYSTEM. */ +/* */ +/* X-23 SJF STU FARNHAM 5-OCT-1987 */ +/* ADD NOSUCHCPU */ +/* */ +/* X-22 DLM006 DAN MURPHY 13-SEP-1987 */ +/* INFORMATIONAL CODES FOR $GETSECI. */ +/* */ +/* X-21 WMC0021 WAYNE CARDOZA 4-SEP-1987 */ +/* FIX A MISSPELLING IN VA_IN_USE. */ +/* */ +/* X-20 WMC0020 WAYNE CARDOZA 27-JUL-1987 */ +/* ADD NODELETE. */ +/* */ +/* X-19 WMC0019 WAYNE CARDOZA 10-MAR-1987 */ +/* EXPRCLM SHOULD NOT MENTION SUBPROCESSES. */ +/* */ +/* X-18 WMC0018 WAYNE CARDOZA 19-FEB-1987 */ +/* ADD VA_IN_USE. */ +/* */ +/* X-17 DDP0029 DERRELL D. PIPER 21-JAN-1987 */ +/* CONVERT SS$_BADXXXCTX TO SINGLE BADCONTEXT MSG. */ +/* */ +/* X-16 DDP0027 DERRELL D. PIPER 12-JAN-1987 */ +/* ADD SS$_TOOMUCHCTX AND SS$_BADUAICTX. */ +/* */ +/* X-15 HH0237 HAI HUANG 06-JAN-1987 */ +/* ADD SS$_UNSUPPORTED. */ +/* */ +/* X-14 DDP0008 DERRELL D. PIPER 08-DEC-1986 */ +/* ADD SS$_LASTID, SS$_NOMOREID, SS$_RLSEMPTY, AND */ +/* SS$_BADJPICTX FOR JPI$_RIGHTSLIST ITEM CODE. */ +/* (NB: S VARIANT IS NOW OBSOLETE.) */ +/* */ +/* X-9 NCD0001 NANCY C. DENARDO 21-OCT-1986 */ +/* ADDED SS$_EXLICENSE, SS$_INVLICENSE, SS$_LICENSE_LEVEL, */ +/* AND SS$_INV_HW_ID FOR LMF SERVICE. */ +/* */ +/* X-8 SAS001 SCOTT A. SHURTS 02-OCT-1986 */ +/* ADDED SS$_SRVMMAT TO INDICATE CRYPTOGRAPHIC SERVICE */ +/* MISMATCH. */ +/* */ +/* X-7 KL 0001 KEITH LOEPERE 12-JUN-1986 */ +/* ADDED SS$_REMOVED TO INDICATE DIR ENTRY ONLY REMOVED. */ +/* */ +/* X-6 CWH5006 CW HOBBS 30-MAY-1986 */ +/* ADD SS$_REMOTE_PROC ERROR MESSAGE FOR CWPS. */ +/* */ +/* X-5H2 SJF STU FARNHAM 29-MAY-1986 */ +/* ADD SS$_CPUNOTACT TO INDICATE THAT THE REQUESTED */ +/* CPU IN AN SMP SYSTEM IS NOT ACTIVE. */ +/* */ +/* X-5 PRD0184 PAUL R. DESTEFANO 07-NOV-1985 */ +/* ADD SS$_DATALOST "data lost" TO INDICATE DLS END */ +/* FLAG SET IN CACHING TAPE DRIVE OR DRIVER HAS OTHERWISE */ +/* DETECTED THE LOSS OF CACHED DATA. */ +/* */ +/* X-4 LMP0382 L. MARK PILANT, 6-NOV-1985 10:10 */ +/* ADD SS$_OBJLOCKHELD TO INDICATE THAT A PROCESS ALREADY HOLDS */ +/* THE OBJECT'S ACL LOCK. */ +/* */ +/* X-3 JMK0002 JOSEPH M. KRAETSCH 17-SEP-1985 */ +/* ADD SS$_RUCONFLICT "file has active RUs by another facility". */ +/* REMOVE NOTMPJNL, NOPRMJNL (OBSOLETE). */ +/* */ +/* V04-001 ROW0466 RALPH O. WEBER 11-JUN-1985 */ +/* REPLACE SS$_SHACPYINP (A NO LONGER USED SHADOWING ERROR */ +/* STATUS) WITH SS$_DEVNOTSHR, "device not currently shareable". */ +/* SS$_DEVNOTSHR IS AN ERROR STATUE FOR USE WITH DEVICES MARKED */ +/* FOR EXCLUSIVE ACCESS BY SOMEONE ELSE BY AN MSCP CONTROLLER. */ +/* */ +/*--- */ +/*+ */ +/* SYSTEM STATUS CODES */ +/* */ +/* LAYOUT OF MESSAGE SPACE: */ +/* */ +/* MSG #S RANGE # MSGS DESCRIPTION */ +/* */ +/* 0-127 0-3FF 128 FATAL ERRORS */ +/* 128-191 400-5FF 64 HARDWARE DEFINED FATAL ERRORS */ +/* 192-255 600-7FF 64 SUCCESS CODES */ +/* 256-383 800-BFF 128 WARNING CODES */ +/* 384-447 C00-DFF 64 INFORMATIONAL CODES */ +/* 448-511 E00-FFF 64 NONFATAL ERROR CODES */ +/* 512-1023 1000-1FFF 512 SHARED MESSAGES (NOT HERE, SEE SHRMSG) */ +/* 1024-1279 2000-27FF 256 FATAL ERRORS (CONTINUED FROM 400) */ +/* 1280-1343 2800-29FF 64 NO PRIVILEGE ERRORS */ +/* 1344-1375 2A00-2AFF 32 EXCEEDED QUOTA ERRORS */ +/* 1376-4031 2B00-7DFF 2656 (UNUSED) */ +/* 4032-4095 7E00-7FFF 64 RESERVED FOR SCS SYSAPS */ +/* */ +/*- */ +/* */ +/* EXPLICITLY DEFINED SUCESS CODES */ +/* */ +/* DO NOT MIX THESE CODES WITH INCREMENTAL ASSIGNMENTS BELOW */ +/* */ +#define SYSTEM__FACILITY 0 +#define SS__NORMAL 1 +/* */ +/* NOTE THAT CONTINUE,WASCLR,WASSET DO NOT HAVE ANY MESSAGE TEXT -- */ +/* SINCE THESE CODES USE THE SAME MESSAGE NUMBER AS NORMAL AND ACCVIO, */ +/* THEY CAN NEVER BE MADE TO HAVE MESSAGES ASSOCIATED WITH THEM. */ +/* */ +#define SS__CONTINUE 1 +#define SS__WASCLR 1 +#define SS__WASSET 9 +/* */ +/* SEVERE ERRORS (HEX 0-400, 2000-2800) */ +/* */ +#define SS__ACCVIO 12 +#define SS__BADPARAM 20 +#define SS__EXQUOTA 28 +#define SS__NOPRIV 36 +/* MAKE THE ABOVE ERRORS FALL INTO SHORT LITERALS */ +#define SS__ABORT 44 +#define SS__BADATTRIB 52 +#define SS__BADESCAPE 60 +#define SS__BADIMGHDR 68 +#define SS__CHANINTLK 76 +#define SS__CTRLERR 84 +#define SS__DATACHECK 92 +#define SS__DEVFOREIGN 100 +#define SS__DEVMOUNT 108 +#define SS__DEVNOTMBX 116 +#define SS__DEVNOTMOUNT 124 +#define SS__DEVOFFLINE 132 +#define SS__DRVERR 140 +#define SS__DUPLNAM 148 +#define SS__FILACCERR 156 +#define SS__FILALRACC 164 +#define SS__FILNOTACC 172 +#define SS__FILNOTEXP 180 +#define SS__FORMAT 188 +#define SS__GPTFULL 196 +#define SS__GSDFULL 204 +#define SS__LCKPAGFUL 212 +#define SS__ILLBLKNUM 220 +#define SS__ILLCNTRFUNC 228 +#define SS__ILLEFC 236 +#define SS__ILLIOFUNC 244 +#define SS__ILLPAGCNT 252 +#define SS__ILLSER 260 +#define SS__INCVOLLABEL 268 +#define SS__INSFARG 276 +#define SS__INSFWSL 284 +#define SS__INSFMEM 292 +#define SS__INSFRAME 300 +#define SS__IVADDR 308 +#define SS__IVCHAN 316 +#define SS__IVDEVNAM 324 +#define SS__IVGSDNAM 332 +#define SS__IVLOGNAM 340 +#define SS__IVLOGTAB 348 +#define SS__IVQUOTAL 356 +#define SS__IVSECFLG 364 +#define SS__IVSSRQ 372 +#define SS__IVSTSFLG 380 +#define SS__IVTIME 388 +#define SS__LENVIO 396 +#define SS__LKWSETFUL 404 +#define SS__MBTOOSML 412 +#define SS__MEDOFL 420 +#define SS__NODATA 428 +#define SS__NOIOCHAN 436 +#define SS__NOLOGNAM 444 +#define SS__NONEXDRV 452 +#define SS__NOTFILEDEV 460 +#define SS__NOTINTBLSZ 468 +#define SS__NOTLABELMT 476 +#define SS__NOTSQDEV 484 +#define SS__PAGOWNVIO 492 +#define SS__PARITY 500 +#define SS__PARTESCAPE 508 +#define SS__PFMBSY 516 +#define SS__PSTFULL 524 +#define SS__RESULTOVF 532 +#define SS__SECTBLFUL 540 +#define SS__TAPEPOSLOST 548 +#define SS__TIMEOUT 556 +#define SS__UNASEFC 564 +#define SS__UNSAFE 572 +#define SS__VASFULL 580 +#define SS__VECINUSE 588 +#define SS__VOLINV 596 +#define SS__WRITLCK 604 +#define SS__NOTAPEOP 612 +#define SS__IVCHNLSEC 620 +#define SS__NOMBX 628 +#define SS__NOLINKS 636 +#define SS__NOSOLICIT 644 +#define SS__NOSUCHNODE 652 +#define SS__REJECT 660 +#define SS__TOOMUCHDATA 668 +#define SS__BUGCHECK 676 +#define SS__FILNOTCNTG 684 +#define SS__BADSTACK 692 +#define SS__MCHECK 700 +#define SS__DEVACTIVE 708 +#define SS__HANGUP 716 +#define SS__OPINCOMPL 724 +#define SS__ILLSEQOP 732 +#define SS__IVSECIDCTL 740 +#define SS__NOTNETDEV 748 +#define SS__IVPROTECT 756 +#define SS__ACPVAFUL 764 +#define SS__MTLBLLONG 772 +#define SS__BUFBYTALI 780 +#define SS__NOAQB 788 +#define SS__WRONGACP 796 +#define SS__BUFNOTALIGN 804 +#define SS__DEVCMDERR 812 +#define SS__DEVREQERR 820 +#define SS__INSFBUFDP 828 +#define SS__INSFMAPREG 836 +#define SS__IVBUFLEN 844 +#define SS__IVMODE 852 +#define SS__MCNOTVALID 860 +#define SS__POWERFAIL 868 +#define SS__SHMGSNOTMAP 876 +#define SS__TOOMANYLNAM 884 +#define SS__SHMNOTCNCT 892 +#define SS__NOTCREATOR 900 +#define SS__INTERLOCK 908 +#define SS__BADQUEUEHDR 916 +#define SS__NOSLOT 924 +#define SS__SUSPENDED 932 +#define SS__EXPORTQUOTA 940 +#define SS__NOSHMBLOCK 948 +#define SS__BADQFILE 956 +#define SS__NOQFILE 964 +#define SS__QFACTIVE 972 +#define SS__QFNOTACT 980 +#define SS__DUPDSKQUOTA 988 +#define SS__NODISKQUOTA 996 +#define SS__EXDISKQUOTA 1004 +#define SS__IDMISMATCH 1012 +#define SS__NOWRT 1020 +/* ************** */ +/* NOTE: THE ABOVE SET OF SEVERE ERROR MESSAGES IS FULL!!!! */ +/* [VMSLIB.SRC]SHRMSG.MDL HAS USED MESSAGE NUMBERS HEX 1000-2000. */ +/* ANY ADDITIONAL SEVERE ERROR MESSAGES MUST BE ADDED */ +/* BELOW, IN THE RANGE HEX 2000-2800. */ +/* ************** */ +#define SS__BADISD 8196 +#define SS__RELINK 8204 +#define SS__NOTINSTALL 8212 +#define SS__SHARTOOBIG 8220 +#define SS__NOP1VA 8228 +#define SS__MULTRMS 8236 +#define SS__VECFULL 8244 +#define SS__IVLVEC 8252 +#define SS__INSFSPTS 8260 +#define SS__DISCONNECT 8268 +#define SS__PRIVINSTALL 8276 +#define SS__PROTINSTALL 8284 +#define SS__BADVEC 8292 +#define SS__REMRSRC 8300 +#define SS__PROTOCOL 8308 +#define SS__THIRDPARTY 8316 +#define SS__NOSUCHUSER 8324 +#define SS__SHUT 8332 +#define SS__UNREACHABLE 8340 +#define SS__INVLOGIN 8348 +#define SS__NOSUCHOBJ 8356 +#define SS__EXCPUTIM 8364 +#define SS__OPRABORT 8372 +#define SS__SHRIDMISMAT 8380 +#define SS__COMMHARD 8388 +#define SS__IVCHAR 8396 +#define SS__DEVINACT 8404 +#define SS__CONNECFAIL 8412 +#define SS__LINKABORT 8420 +#define SS__LINKDISCON 8428 +#define SS__LINKEXIT 8436 +#define SS__PATHLOST 8444 +#define SS__CLEARED 8452 +#define SS__RESET 8460 +#define SS__UNSOLICIT 8468 +#define SS__TOOMANYREDS 8476 +#define SS__IVLOCKID 8484 +#define SS__SUBLOCKS 8492 +#define SS__PARNOTGRANT 8500 +#define SS__CVTUNGRANT 8508 +#define SS__FORCEDERROR 8516 +#define SS__ILLSELF 8524 +#define SS__ILLCDTST 8532 +#define SS__NOLISTENER 8540 +#define SS__EXGBLPAGFIL 8548 +#define SS__BADRCT 8556 +#define SS__DIRNOTEMPTY 8564 +#define SS__FORCEDEXIT 8572 +#define SS__NOTPRINTED 8580 +#define SS__JBCERROR 8588 +#define SS__NOLICENSE 8596 +#define SS__VCBROKEN 8604 +#define SS__VCCLOSED 8612 +#define SS__INSFCDT 8620 +#define SS__DEVNOTDISM 8628 +#define SS__NOSHRIMG 8636 +#define SS__DUPUNIT 8644 +#define SS__BADACLCTX 8652 +#define SS__SERIOUSEXCP 8660 +#define SS__TEMPLATEDEV 8668 +#define SS__IVACL 8676 +#define SS__NOSUCHID 8684 +#define SS__NOLCLMEDA 8692 +#define SS__NOREGAVIL 8700 +#define SS__NOREGSUIT 8708 +#define SS__NOSUCHPGM 8716 +#define SS__PGMLDFAIL 8724 +#define SS__PGMSTDALN 8732 +#define SS__IVIDENT 8740 +#define SS__DUPIDENT 8748 +#define SS__INCSEGTRA 8756 +#define SS__NODELEAVE 8764 +#define SS__KERNELINV 8772 +#define SS__EXLNMQUOTA 8780 +#define SS__PARENT_DEL 8788 +#define SS__PARNOTSYS 8796 +#define SS__INSSWAPSPACE 8804 +#define SS__VOLOERR 8812 +#define SS__DATALATE 8820 +#define SS__OVRMAXARG 8828 +#define SS__SHACHASTA 8836 +#define SS__TERMNETDEV 8844 +#define SS__NOLOGTAB 8852 +#define SS__WRONGNAME 8860 +#define SS__NOVOLACC 8868 +#define SS__NOFILACC 8876 +#define SS__INVEXHLIST 8884 +#define SS__NOACLSUPPORT 8892 +#define SS__INVSECLASS 8900 +#define SS__INCSHAMEM 8908 +#define SS__DEVNOTSHR 8916 +#define SS__RUCONFLICT 8924 +#define SS__DATALOST 8932 +#define SS__REMOTE_PROC 8940 +#define SS__CPUNOTACT 8948 +#define SS__SRVMMAT 8956 +#define SS__EXLICENSE 8964 +#define SS__INVLICENSE 8972 +#define SS__LICENSE_LEVEL 8980 +#define SS__INV_HW_ID 8988 +#define SS__BADCONTEXT 8996 +#define SS__TOOMUCHCTX 9004 +#define SS__VA_IN_USE 9012 +#define SS__NODELETE 9020 +#define SS__NOSUCHCPU 9028 +#define SS__IMGVEXC 9036 +#define SS__NOSAVPEXC 9044 +#define SS__NOSUCHTID 9052 +#define SS__NOSUCHRM 9060 +#define SS__NOCURTID 9068 +#define SS__WRONGSTATE 9076 +#define SS__VETO 9084 +#define SS__PWDSYNTAX 9092 +#define SS__PWDNOTDIF 9100 +#define SS__INVPWDLEN 9108 +#define SS__SYSVERDIF 9116 +#define SS__HWM_STALL 9124 +#define SS__NOSUSPEND 9132 +#define SS__NOSUCHPART 9140 +#define SS__RMALRDCL 9148 +#define SS__ALRCURTID 9156 +#define SS__INVLOG 9164 +#define SS__BADLOGVER 9172 +#define SS__OPINPROG 9180 +#define SS__WRONGACMODE 9188 +#define SS__SITEPWDFAIL 9196 +#define SS__NOSUCHCPB 9204 +#define SS__CPUCAP 9212 +#define SS__LOADER 9220 +#define SS__HSTBUFACC 9228 +#define SS__INCONOLCK 9236 +#define SS__INVEVENT 9244 +#define SS__NOSUCHFAC 9252 +#define SS__NOCALLPRIV 9260 +#define SS__INSFLPGS 9268 +#define SS__INSFRPGS 9276 +#define SS__SUBTRACED 9284 +#define SS__ARCHIVING 9292 +#define SS__ARCHIVED 9300 /* */ +/* HARDWARE FATAL EXCEPTION CODES (HEX 400-600) */ +/* */ +#define SS__PLHLDR 1028 +#define SS__ASTFLT 1036 +#define SS__BREAK 1044 +#define SS__CMODSUPR 1052 +#define SS__CMODUSER 1060 +#define SS__COMPAT 1068 +#define SS__OPCCUS 1076 +#define SS__OPCDEC 1084 +#define SS__PAGRDERR 1092 +#define SS__RADRMOD 1100 +#define SS__ROPRAND 1108 +#define SS__SSFAIL 1116 +#define SS__TBIT 1124 +#define SS__DEBUG 1132 +/* THE FOLLOWING CODES MUST BE IN ORDER SINCE THEY ARE CALCULATED */ +#define SS__ARTRES 1140 +#define SS__INTOVF 1148 +#define SS__INTDIV 1156 +#define SS__FLTOVF 1164 +#define SS__FLTDIV 1172 +#define SS__FLTUND 1180 +#define SS__DECOVF 1188 +#define SS__SUBRNG 1196 +#define SS__FLTOVF_F 1204 +#define SS__FLTDIV_F 1212 +#define SS__FLTUND_F 1220 +/* THE ABOVE CODES MUST BE IN ORDER SINCE THEY ARE CALCULATED */ +#define SS__INHCHMK 1228 +#define SS__INHCHME 1236 +#define SS__VECDIS 1244 +#define SS__VARITH 1252 +#define SS__ILLVECOP 1260 +#define SS__VECALIGN 1268 +/* */ +/* SUCCESS CODES (HEX 600-800) */ +/* */ +#define SS__BUFFEROVF 1537 +#define SS__CONTROLO 1545 +#define SS__CONTROLY 1553 +#define SS__CREATED 1561 +#define SS__MSGNOTFND 1569 +#define SS__NOTRAN 1577 +#define SS__SUPERSEDE 1585 +#define SS__WASECC 1593 +#define SS__DEVALRALLOC 1601 +#define SS__REMOTE 1609 +#define SS__CONTROLC 1617 +#define SS__NOTMODIFIED 1625 +#define SS__RDDELDATA 1633 +#define SS__OVRDSKQUOTA 1641 +#define SS__OBSOLETE_1 1649 +#define SS__FILEPURGED 1657 +#define SS__NOTALLPRIV 1665 +#define SS__SYNCH 1673 +#define SS__CONCEALED 1681 +#define SS__INCOMPAT 1689 +#define SS__DBGOPCREQ 1697 +#define SS__ALRDYCLOSED 1705 +#define SS__LNMCREATED 1713 +#define SS__ACEIDMATCH 1721 +#define SS__DBGEVENT 1729 +#define SS__REMOVED 1737 +#define SS__UNUSED_1 1745 +#define SS__UNUSED_2 1753 +#define SS__FORGET 1761 +#define SS__PREPARED 1769 +#define SS__NOMOREITEMS 1777 +#define SS__SUBDISABLED 1785 +/* */ +/* WARNING CODES (HEX 800-C00) */ +/* */ +#define SS__ACCONFLICT 2048 +#define SS__BADCHKSUM 2056 +#define SS__BADFILEHDR 2064 +#define SS__BADFILENAME 2072 +#define SS__BADFILEVER 2080 +#define SS__BADIRECTORY 2088 +#define SS__CANCEL 2096 +#define SS__DATAOVERUN 2104 +#define SS__DEVALLOC 2112 +#define SS__DEVASSIGN 2120 +#define SS__DEVICEFULL 2128 +#define SS__DEVNOTALLOC 2136 +#define SS__DIRFULL 2144 +#define SS__DUPFILENAME 2152 +#define SS__ENDOFFILE 2160 +#define SS__ENDOFTAPE 2168 +#define SS__EXTIDXFILE 2176 +#define SS__FCPREADERR 2184 +#define SS__FCPREWNDERR 2192 +#define SS__FCPSPACERR 2200 +#define SS__FCPWRITERR 2208 +#define SS__FILELOCKED 2216 +#define SS__FILENUMCHK 2224 +#define SS__FILESEQCHK 2232 +#define SS__FILESTRUCT 2240 +#define SS__HEADERFULL 2248 +#define SS__IDXFILEFULL 2256 +#define SS__MBFULL 2264 +#define SS__NOHOMEBLK 2272 +#define SS__NONEXPR 2280 +#define SS__NONLOCAL 2288 +#define SS__NOHANDLER 2296 +#define SS__NOSIGNAL 2304 +#define SS__NOSUCHDEV 2312 +#define SS__NOSUCHFILE 2320 +#define SS__RESIGNAL 2328 +#define SS__UNWIND 2336 +#define SS__UNWINDING 2344 +#define SS__NOMOREFILES 2352 +#define SS__BEGOFFILE 2360 +#define SS__BLOCKCNTERR 2368 +#define SS__MUSTCLOSEFL 2376 +#define SS__WAITUSRLBL 2384 +#define SS__ILLUSRLBLRD 2392 +#define SS__ILLUSRLBLWT 2400 +#define SS__ILLLBLAST 2408 +#define SS__ENDOFUSRLBL 2416 +#define SS__NOSUCHSEC 2424 +#define SS__CLIFRCEXT 2432 +#define SS__FCPREPSTN 2440 +#define SS__TOOMANYVER 2448 +#define SS__NOTVOLSET 2456 +#define SS__ENDOFVOLUME 2464 +#define SS__NOMOREPROC 2472 +#define SS__NODEVAVL 2480 +#define SS__NOTQUEUED 2488 +#define SS__DGQINCOMP 2496 +#define SS__DIRALLOC 2504 +#define SS__ACLEMPTY 2512 +#define SS__NOENTRY 2520 +#define SS__NOMOREACE 2528 +#define SS__RIGHTSFULL 2536 +#define SS__VALNOTVALID 2544 +#define SS__ACLFULL 2552 +#define SS__NOMORENODE 2560 +#define SS__NOMORELOCK 2568 +#define SS__BEGOFTAPE 2576 +#define SS__OBJLOCKHELD 2584 +#define SS__CPUSTARTIP 2592 +#define SS__ALLSTARTED 2600 +#define SS__ALRDYSTRT 2608 +#define SS__ALRDYSTPPD 2616 +#define SS__NSTPPD 2624 +#define SS__UNKRESULT 2632 +#define SS__ITEMNOTFOUND 2640 +#define SS__NOMOREDEV 2648 +#define SS__EFNOTSET 2656 +#define SS__PRIMNOSTP 2664 +/* */ +/* INFORMATIONAL CODES (HEX C00-E00) */ +/* */ +#define SS__EOTIN 3075 +#define SS__CHAINW 3083 +#define SS__NOTINSEC 3091 +#define SS__NONXPAG 3099 +#define SS__LOGNAME 3107 +#define SS__CPUSTARTD 3115 +#define SS__CPUSTOPPING 3123 +/* */ +/* NONFATAL ERROR CODES (HEX E00-1000) */ +/* */ +#define SS__LINEABRT 3586 +#define SS__DEADLOCK 3594 +#define SS__NOLOCKID 3602 +#define SS__EXDEPTH 3610 +#define SS__PARTMAPPED 3618 +#define SS__CANCELGRANT 3626 +#define SS__RETRY 3634 +#define SS__BADACL 3642 +#define SS__ACEEXISTS 3650 +#define SS__UNSUPPORTED 3658 +#define SS__NORIGHTSDB 3666 +#define SS__LOGSTALL 3674 +#define SS__LOGFULL 3682 +#define SS__PWDINDIC 3690 +#define SS__PWDINHIS 3698 +#define SS__PWDWEAK 3706 /* */ +/* NO PRIVILEGE FATAL ERROR CODES (HEX 2800-2A00) */ +/* */ +#define SS__NOPRIVSTRT 10240 +#define SS__NOCMKRNL 10244 +#define SS__NOCMEXEC 10252 +#define SS__NOSYSNAM 10260 +#define SS__NOGRPNAM 10268 +#define SS__NOALLSPOOL 10276 +#define SS__NODETACH 10284 +#define SS__NODIAGNOSE 10292 +#define SS__NOLOG_IO 10300 +#define SS__NOGROUP 10308 +#define SS__NOACNT 10316 +#define SS__NOPRMCEB 10324 +#define SS__NOPRMMBX 10332 +#define SS__NOPSWAPM 10340 +#define SS__NOALTPRI 10348 +#define SS__NOSETPRV 10356 +#define SS__NOTMPMBX 10364 +#define SS__NOWORLD 10372 +#define SS__NOMOUNT 10380 +#define SS__NOOPER 10388 +#define SS__NOEXQUOTA 10396 +#define SS__NONETMBX 10404 +#define SS__NOVOLPRO 10412 +#define SS__NOPHY_IO 10420 +#define SS__NOBUGCHK 10428 +#define SS__NOPRMGBL 10436 +#define SS__NOSYSGBL 10444 +#define SS__NOPFNMAP 10452 +#define SS__NOSHMEM 10460 +#define SS__NOSYSPRV 10468 +#define SS__NOBYPASS 10476 +#define SS__NOSYSLCK 10484 +#define SS__UNUSED_4 10492 +#define SS__UNUSED_5 10500 +#define SS__NODOWNGRADE 10508 +#define SS__NOUPGRADE 10516 +#define SS__NOGRPPRV 10524 +#define SS__NOREADALL 10532 +#define SS__NOSHARE 10540 +#define SS__NOSECURITY 10548 +#define SS__NOPRIVEND 10751 +/* */ +/* EXCEEDED QUOTA FATAL ERROR CODES (HEX 2A00-2B00) */ +/* */ +#define SS__EXQUOTASTRT 10752 +#define SS__EXASTLM 10756 +#define SS__EXBIOLM 10764 +#define SS__EXBYTLM 10772 +#define SS__EXDIOLM 10780 +#define SS__EXFILLM 10788 +#define SS__EXPGFLQUOTA 10796 +#define SS__EXPRCLM 10804 +#define SS__EXTQELM 10812 +#define SS__EXENQLM 10820 +#define SS__EXQUOTAEND 11007 +/* */ +/* RESERVED FOR SCA SYSAPS (HEX 7E00-7FFF) */ +/* */ +/* MESSAGE CODES IN THIS BLOCK ARE GUARANTEED NOT TO */ +/* BE TRANSLATED BY VMS WHEN THEY ARE SEND OUT BY VMSSCS */ +/* OR WHEN THEY ARE RECEIVED BY VMSSCS. SCA SYSAPS ARE */ +/* FREE TO USE THESE CODES IN ANY SYSAP-DEPENDENT MANNER */ +/* IN WHICH THEY CHOOSE. */ +/* */ +/* THIS ADDRESS OF THIS BLOCK OF CODES MUST BE IN CONFORMANCE */ +/* WITH THE SCA ARCHITECTURE, I.E., MUST NOT BE MOVED. */ +/* */ +#define SS__SYSAPMIN 32256 +#define SS__SYSAPMAX 32767 diff --git a/private/rpc/ndrlib/win/depend.mk b/private/rpc/ndrlib/win/depend.mk new file mode 100644 index 000000000..f71b6e559 --- /dev/null +++ b/private/rpc/ndrlib/win/depend.mk @@ -0,0 +1,80 @@ +help.obj help.lst: ../help.c $(WIN_INC)/memory.h + +floatc.obj floatc.lst: ../floatc.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/win/rpc.h ../../ndr20/cvt.h + +dataconv.obj dataconv.lst: ../dataconv.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/win/rpc.h + +charconv.obj charconv.lst: ../charconv.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/win/rpc.h $(WIN_INC)/string.h + +ccontext.obj ccontext.lst: ../ccontext.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/util.hxx \ + $(RPC)/runtime/mtrt/win/rpc.h $(WIN_INC)/memory.h + +autohand.obj autohand.lst: ../autohand.cxx $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h $(PUBLIC)/inc/rpcnsip.h \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/win/rpc.h + +ndrhelp.obj ndrhelp.lst: ../ndrhelp.c $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h \ + $(RPC)/runtime/mtrt/rpcerr.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/win/rpc.h ../ndrhelp.h + +helpx86.obj helpx86.lst: ../helpx86.asm + +linklist.obj linklist.lst: ../linklist.cxx $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcnsi.h \ + $(RPC)/runtime/mtrt/linklist.hxx $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/util.hxx $(RPC)/runtime/mtrt/win/rpc.h + +intconv.obj intconv.lst: ../intconv.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/win/rpc.h + +ndrtest.obj ndrtest.lst: ../ndrtest.cxx $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcx86.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/win/rpc.h $(WIN_INC)/malloc.h $(WIN_INC)/stdio.h \ + $(WIN_INC)/stdlib.h $(WIN_INC)/string.h ../../ndr20/cvt.h \ + ../../ndr20/cvtpvt.h + +scontext.obj scontext.lst: ../scontext.cxx $(PUBLIC)/inc/issper16.h \ + $(PUBLIC)/inc/issperr.h $(PUBLIC)/inc/kerbcon.h \ + $(PUBLIC)/inc/kerberos.h $(PUBLIC)/inc/ntlmsp.h $(PUBLIC)/inc/ntlsa.h \ + $(PUBLIC)/inc/ntmsv1_0.h $(PUBLIC)/inc/ntsam.h $(PUBLIC)/inc/poppack.h \ + $(PUBLIC)/inc/pshpack4.h $(PUBLIC)/inc/rpcdce.h \ + $(PUBLIC)/inc/rpcdcep.h $(PUBLIC)/inc/rpcndr.h $(PUBLIC)/inc/rpcnsi.h \ + $(PUBLIC)/inc/rpcnsip.h $(PUBLIC)/inc/secext.h $(PUBLIC)/inc/secobjs.h \ + $(PUBLIC)/inc/secpkg.h $(PUBLIC)/inc/security.h $(PUBLIC)/inc/sspi.h \ + $(RPC)/runtime/mtrt/interlck.hxx $(RPC)/runtime/mtrt/linklist.hxx \ + $(RPC)/runtime/mtrt/osfpcket.hxx $(RPC)/runtime/mtrt/rpcerr.h \ + $(RPC)/runtime/mtrt/rpcssp.h $(RPC)/runtime/mtrt/rpcx86.h \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/threads.hxx \ + $(RPC)/runtime/mtrt/util.hxx $(RPC)/runtime/mtrt/win/rpc.h \ + $(WIN_INC)/memory.h + diff --git a/private/rpc/ndrlib/win/makefile b/private/rpc/ndrlib/win/makefile new file mode 100644 index 000000000..de826b3a1 --- /dev/null +++ b/private/rpc/ndrlib/win/makefile @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : +# +# Title : Makefile for the Win16 stub library. +# +# History : +# mariogo 2-10-94 Re-write +# +# -------------------------------------------------------------------- + +WIN=1 + +!include ..\rules.mk + +CFLAGS =$(CFLAGS) -ALw +CXXFLAGS =$(CXXFLAGS) -ALw + +all : RpcNdrp.lib + +depend : + $(INCLUDES) $(INCLUDESFLAGS) ..\*.c ..\*.cxx ..\*.asm > depend.mk + +tree : + @echo No Publics Built Here + +# -------------------------------------------------------------------- +# Local targets + +RpcNdrp.lib : ccontext.obj charconv.obj helpx86.obj floatc.obj \ + dataconv.obj intconv.obj + -del RpcNdrp.lib 2>nul + $(LIBRARIAN) $(LIBFLAGS) $@+$(**: =+); + +# -------------------------------------------------------------------- + +!include depend.mk + diff --git a/private/rpc/ndrlib/win32c/depend.mk b/private/rpc/ndrlib/win32c/depend.mk new file mode 100644 index 000000000..5aa80c57c --- /dev/null +++ b/private/rpc/ndrlib/win32c/depend.mk @@ -0,0 +1,128 @@ +help.obj help.lst: ../help.c $(CHICODEV)/tools/c1032/inc/memory.h + +floatc.obj floatc.lst: ../floatc.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/sysinc.h \ + ../../ndr20/cvt.h + +dataconv.obj dataconv.lst: ../dataconv.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/sysinc.h + +charconv.obj charconv.lst: ../charconv.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h \ + $(CHICODEV)/tools/c1032/inc/string.h $(RPC)/runtime/mtrt/sysinc.h + +ccontext.obj ccontext.lst: ../ccontext.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h \ + $(CHICODEV)/tools/c1032/inc/memory.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/win32c/util.hxx + +autohand.obj autohand.lst: ../autohand.cxx $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h + +ndrhelp.obj ndrhelp.lst: ../ndrhelp.c $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h ../ndrhelp.h + +helpx86.obj helpx86.lst: ../helpx86.asm + +linklist.obj linklist.lst: ../linklist.cxx $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/linklist.hxx \ + $(RPC)/runtime/mtrt/sysinc.h $(RPC)/runtime/mtrt/win32c/util.hxx + +intconv.obj intconv.lst: ../intconv.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/sysinc.h + +ndrtest.obj ndrtest.lst: ../ndrtest.cxx $(CHICODEV)/sdk/inc/poppack.h \ + $(CHICODEV)/sdk/inc/pshpack4.h $(CHICODEV)/sdk/inc/winerror.h \ + $(CHICODEV)/tools/c1032/inc/excpt.h \ + $(CHICODEV)/tools/c1032/inc/malloc.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdio.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h \ + $(CHICODEV)/tools/c1032/inc/string.h $(RPC)/ndr20/descrip.h \ + $(RPC)/runtime/mtrt/sysinc.h ../../ndr20/cvt.h ../../ndr20/cvtpvt.h + +scontext.obj scontext.lst: ../scontext.cxx $(CHICODEV)/inc/issperr.h \ + $(CHICODEV)/inc/security.h $(CHICODEV)/inc/sspi.h \ + $(CHICODEV)/sdk/inc/poppack.h $(CHICODEV)/sdk/inc/pshpack4.h \ + $(CHICODEV)/sdk/inc/winerror.h $(CHICODEV)/tools/c1032/inc/excpt.h \ + $(CHICODEV)/tools/c1032/inc/memory.h $(CHICODEV)/tools/c1032/inc/rpc.h \ + $(CHICODEV)/tools/c1032/inc/rpcbase.h \ + $(CHICODEV)/tools/c1032/inc/rpcdce.h \ + $(CHICODEV)/tools/c1032/inc/rpcdcep.h \ + $(CHICODEV)/tools/c1032/inc/rpcndr.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsi.h \ + $(CHICODEV)/tools/c1032/inc/rpcnsip.h \ + $(CHICODEV)/tools/c1032/inc/rpcnterr.h \ + $(CHICODEV)/tools/c1032/inc/stdlib.h $(RPC)/runtime/mtrt/interlck.hxx \ + $(RPC)/runtime/mtrt/linklist.hxx $(RPC)/runtime/mtrt/osfpcket.hxx \ + $(RPC)/runtime/mtrt/rpcssp.h $(RPC)/runtime/mtrt/sysinc.h \ + $(RPC)/runtime/mtrt/threads.hxx $(RPC)/runtime/mtrt/win32c/util.hxx + diff --git a/private/rpc/ndrlib/win32c/makefile b/private/rpc/ndrlib/win32c/makefile new file mode 100644 index 000000000..9fbe3cd5a --- /dev/null +++ b/private/rpc/ndrlib/win32c/makefile @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------- +# +# Microsoft RPC +# Copyright(c) Microsoft Corp., 1994 +# +# -------------------------------------------------------------------- +# -------------------------------------------------------------------- +# +# File : +# +# Title : Makefile for the Win16 stub library. +# +# History : +# mariogo 2-10-94 Re-write +# +# -------------------------------------------------------------------- + +WIN32C=1 + +!include $(RPC)\rules.mk + +INCLUDESFLAGS = $(INCLUDESFLAGS) -I$(RPC)\ndr20 + +all : RpcNdrp.lib + +depend : + $(INCLUDES) $(INCLUDESFLAGS) ..\*.c ..\*.cxx ..\*.asm > depend.mk + +tree : + @echo No Publics Built Here + +# -------------------------------------------------------------------- +# Local targets + +RpcNdrp.lib : ccontext.obj scontext.obj charconv.obj floatc.obj \ + dataconv.obj intconv.obj help.obj + -del RpcNdrp.lib 2>nul + $(LIBRARIAN) -OUT:$@ $(LIBFLAGS) $** + +# -------------------------------------------------------------------- + +!include depend.mk + |