rpcndr.h 18.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Copyright (C) 2000 Francois Gouget
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

19
#ifndef __RPCNDR_H_VERSION__
20 21
/* FIXME: What version?   Perhaps something is better than nothing, however incorrect */
#define __RPCNDR_H_VERSION__ ( 399 )
Ove Kaaven's avatar
Ove Kaaven committed
22 23
#endif

24 25 26
#ifndef __WINE_RPCNDR_H
#define __WINE_RPCNDR_H

Eric Pouech's avatar
Eric Pouech committed
27 28 29 30
#ifdef __cplusplus
extern "C" {
#endif

31
#include <basetsd.h>
32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/* stupid #if can't handle casts... this __stupidity 
   is just a workaround for that limitation */

#define __NDR_CHAR_REP_MASK  0x000fL
#define __NDR_INT_REP_MASK   0x00f0L
#define __NDR_FLOAT_REP_MASK 0xff00L

#define __NDR_IEEE_FLOAT     0x0000L
#define __NDR_VAX_FLOAT      0x0100L
#define __NDR_IBM_FLOAT      0x0300L

#define __NDR_ASCII_CHAR     0x0000L
#define __NDR_EBCDIC_CHAR    0x0001L

#define __NDR_LITTLE_ENDIAN  0x0010L
#define __NDR_BIG_ENDIAN     0x0000L

/* Mac's are special */
#if defined(__RPC_MAC__)
52
# define __NDR_LOCAL_DATA_REPRESENTATION \
53 54
    (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_BIG_ENDIAN)
#else
55
# define __NDR_LOCAL_DATA_REPRESENTATION \
56 57 58 59 60 61 62 63
    (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_LITTLE_ENDIAN)
#endif

#define __NDR_LOCAL_ENDIAN \
  (__NDR_LOCAL_DATA_REPRESENTATION & __NDR_INT_REP_MASK)

/* for convenience, define NDR_LOCAL_IS_BIG_ENDIAN iff it is */
#if __NDR_LOCAL_ENDIAN == __NDR_BIG_ENDIAN
64
# define NDR_LOCAL_IS_BIG_ENDIAN
65
#elif __NDR_LOCAL_ENDIAN == __NDR_LITTLE_ENDIAN
66
# undef NDR_LOCAL_IS_BIG_ENDIAN
67
#else
68
# error alien NDR_LOCAL_ENDIAN - Greg botched the defines again, please report
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#endif

/* finally, do the casts like Microsoft */

#define NDR_CHAR_REP_MASK             ((unsigned long) __NDR_CHAR_REP_MASK)
#define NDR_INT_REP_MASK              ((unsigned long) __NDR_INT_REP_MASK)
#define NDR_FLOAT_REP_MASK            ((unsigned long) __NDR_FLOAT_REP_MASK)
#define NDR_IEEE_FLOAT                ((unsigned long) __NDR_IEEE_FLOAT)
#define NDR_VAX_FLOAT                 ((unsigned long) __NDR_VAX_FLOAT)
#define NDR_IBM_FLOAT                 ((unsigned long) __NDR_IBM_FLOAT)
#define NDR_ASCII_CHAR                ((unsigned long) __NDR_ASCII_CHAR)
#define NDR_EBCDIC_CHAR               ((unsigned long) __NDR_EBCDIC_CHAR)
#define NDR_LITTLE_ENDIAN             ((unsigned long) __NDR_LITTLE_ENDIAN)
#define NDR_BIG_ENDIAN                ((unsigned long) __NDR_BIG_ENDIAN)
#define NDR_LOCAL_DATA_REPRESENTATION ((unsigned long) __NDR_LOCAL_DATA_REPRESENTATION)
#define NDR_LOCAL_ENDIAN              ((unsigned long) __NDR_LOCAL_ENDIAN)
85 86


87
#define TARGET_IS_NT50_OR_LATER 1
Ove Kaaven's avatar
Ove Kaaven committed
88 89
#define TARGET_IS_NT40_OR_LATER 1
#define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
90

91
#define small char
92
typedef unsigned char byte;
93 94
#define hyper __int64
#define MIDL_uhyper unsigned __int64
Ove Kaaven's avatar
Ove Kaaven committed
95 96 97 98
/* 'boolean' tend to conflict, let's call it _wine_boolean */
typedef unsigned char _wine_boolean;
/* typedef _wine_boolean boolean; */

Ove Kaaven's avatar
Ove Kaaven committed
99
#define __RPC_CALLEE WINAPI
100
#define RPC_VAR_ENTRY __cdecl
101
#define NDR_SHAREABLE static
Ove Kaaven's avatar
Ove Kaaven committed
102

Ove Kaaven's avatar
Ove Kaaven committed
103 104 105
#define MIDL_ascii_strlen(s) strlen(s)
#define MIDL_ascii_strcpy(d,s) strcpy(d,s)
#define MIDL_memset(d,v,n) memset(d,v,n)
106 107
#define midl_user_free MIDL_user_free
#define midl_user_allocate MIDL_user_allocate
Ove Kaaven's avatar
Ove Kaaven committed
108 109 110 111 112

#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
#define NdrFcLong(s)  (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
  (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)

Ove Kaaven's avatar
Ove Kaaven committed
113 114 115 116 117 118 119 120 121
typedef struct
{
  void *pad[2];
  void *userContext;
} *NDR_SCONTEXT;

#define NDRSContextValue(hContext) (&(hContext)->userContext)
#define cbNDRContext 20

Patrik Stridvall's avatar
Patrik Stridvall committed
122 123 124
typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(_wine_boolean flag);
125 126 127 128

#define DECLSPEC_UUID(x)
#define MIDL_INTERFACE(x)   struct

Ove Kaaven's avatar
Ove Kaaven committed
129 130 131
struct _MIDL_STUB_MESSAGE;
struct _MIDL_STUB_DESC;
struct _FULL_PTR_XLAT_TABLES;
132 133
struct NDR_ALLOC_ALL_NODES_CONTEXT;
struct NDR_POINTER_QUEUE_STATE;
Ove Kaaven's avatar
Ove Kaaven committed
134

Patrik Stridvall's avatar
Patrik Stridvall committed
135
typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
Ove Kaaven's avatar
Ove Kaaven committed
136 137 138 139 140 141 142 143 144 145 146 147
typedef const unsigned char *PFORMAT_STRING;

typedef struct
{
  long Dimension;
  unsigned long *BufferConformanceMark;
  unsigned long *BufferVarianceMark;
  unsigned long *MaxCountArray;
  unsigned long *OffsetArray;
  unsigned long *ActualCountArray;
} ARRAY_INFO, *PARRAY_INFO;

148 149 150 151 152 153 154
typedef struct
{
  unsigned long WireCodeset;
  unsigned long DesiredReceivingCodeset;
  void *CSArrayInfo;
} CS_STUB_INFO;

Ove Kaaven's avatar
Ove Kaaven committed
155 156 157 158 159
typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;

160
#include <pshpack4.h>
Ove Kaaven's avatar
Ove Kaaven committed
161 162 163 164 165 166 167 168 169 170 171 172
typedef struct _MIDL_STUB_MESSAGE
{
  PRPC_MESSAGE RpcMsg;
  unsigned char *Buffer;
  unsigned char *BufferStart;
  unsigned char *BufferEnd;
  unsigned char *BufferMark;
  unsigned long BufferLength;
  unsigned long MemorySize;
  unsigned char *Memory;
  int IsClient;
  int ReuseBuffer;
173 174
  struct NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
  struct NDR_POINTER_QUEUE_STATE *pPointerQueueState;
Ove Kaaven's avatar
Ove Kaaven committed
175 176 177
  int IgnoreEmbeddedPointers;
  unsigned char *PointerBufferMark;
  unsigned char fBufferValid;
178 179
  unsigned char uFlags;
  unsigned short UniquePtrCount;
Ove Kaaven's avatar
Ove Kaaven committed
180 181 182
  ULONG_PTR MaxCount;
  unsigned long Offset;
  unsigned long ActualCount;
Patrik Stridvall's avatar
Patrik Stridvall committed
183 184
  void * (__RPC_API *pfnAllocate)(size_t);
  void (__RPC_API *pfnFree)(void *);
Ove Kaaven's avatar
Ove Kaaven committed
185 186 187 188 189 190 191
  unsigned char *StackTop;
  unsigned char *pPresentedType;
  unsigned char *pTransmitType;
  handle_t SavedHandle;
  const struct _MIDL_STUB_DESC *StubDesc;
  struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
  unsigned long FullPtrRefId;
192
  unsigned long PointerLength;
Ove Kaaven's avatar
Ove Kaaven committed
193 194 195 196 197 198 199
  int fInDontFree:1;
  int fDontCallFreeInst:1;
  int fInOnlyParam:1;
  int fHasReturn:1;
  int fHasExtensions:1;
  int fHasNewCorrDesc:1;
  int fUnused:10;
200
  int fUnused2:16;
Ove Kaaven's avatar
Ove Kaaven committed
201 202 203 204 205 206 207 208 209 210 211
  unsigned long dwDestContext;
  void *pvDestContext;
  NDR_SCONTEXT *SavedContextHandles;
  long ParamNumber;
  struct IRpcChannelBuffer *pRpcChannelBuffer;
  PARRAY_INFO pArrayInfo;
  unsigned long *SizePtrCountArray;
  unsigned long *SizePtrOffsetArray;
  unsigned long *SizePtrLengthArray;
  void *pArgQueue;
  unsigned long dwStubPhase;
212
  void *LowStackMark;
Ove Kaaven's avatar
Ove Kaaven committed
213 214 215 216
  PNDR_ASYNC_MESSAGE pAsyncMsg;
  PNDR_CORRELATION_INFO pCorrInfo;
  unsigned char *pCorrMemory;
  void *pMemoryList;
217 218 219 220 221 222 223 224 225 226
  CS_STUB_INFO *pCSInfo;
  unsigned char *ConformanceMark;
  unsigned char *VarianceMark;
  INT_PTR Unused;
  struct _NDR_PROC_CONTEXT *pContext;
  INT_PTR Reserved51_1;
  INT_PTR Reserved51_2;
  INT_PTR Reserved51_3;
  INT_PTR Reserved51_4;
  INT_PTR Reserved51_5;
Ove Kaaven's avatar
Ove Kaaven committed
227
} MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
228
#include <poppack.h>
Ove Kaaven's avatar
Ove Kaaven committed
229 230 231 232 233

typedef struct _GENERIC_BINDING_ROUTINE_PAIR GENERIC_BINDING_ROUTINE_PAIR, *PGENERIC_BINDING_ROUTINE_PAIR;

typedef struct __GENERIC_BINDING_INFO GENERIC_BINDING_INFO, *PGENERIC_BINDING_INFO;

234 235 236 237 238 239 240 241 242
typedef void (__RPC_USER *XMIT_HELPER_ROUTINE)(PMIDL_STUB_MESSAGE);

typedef struct _XMIT_ROUTINE_QUINTUPLE
{
  XMIT_HELPER_ROUTINE pfnTranslateToXmit;
  XMIT_HELPER_ROUTINE pfnTranslateFromXmit;
  XMIT_HELPER_ROUTINE pfnFreeXmit;
  XMIT_HELPER_ROUTINE pfnFreeInst;
} XMIT_ROUTINE_QUINTUPLE, *PXMIT_ROUTINE_QUINTUPLE;
Ove Kaaven's avatar
Ove Kaaven committed
243

Ove Kaaven's avatar
Ove Kaaven committed
244 245 246 247 248 249 250 251 252 253 254 255
typedef unsigned long (__RPC_USER *USER_MARSHAL_SIZING_ROUTINE)(unsigned long *, unsigned long, void *);
typedef unsigned char * (__RPC_USER *USER_MARSHAL_MARSHALLING_ROUTINE)(unsigned long *, unsigned char *, void *);
typedef unsigned char * (__RPC_USER *USER_MARSHAL_UNMARSHALLING_ROUTINE)(unsigned long *, unsigned char *, void *);
typedef void (__RPC_USER *USER_MARSHAL_FREEING_ROUTINE)(unsigned long *, void *);

typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
{
  USER_MARSHAL_SIZING_ROUTINE pfnBufferSize;
  USER_MARSHAL_MARSHALLING_ROUTINE pfnMarshall;
  USER_MARSHAL_UNMARSHALLING_ROUTINE pfnUnmarshall;
  USER_MARSHAL_FREEING_ROUTINE pfnFree;
} USER_MARSHAL_ROUTINE_QUADRUPLE;
Ove Kaaven's avatar
Ove Kaaven committed
256

257 258 259 260 261
typedef struct _MALLOC_FREE_STRUCT
{
  void * (__RPC_USER *pfnAllocate)(size_t);
  void   (__RPC_USER *pfnFree)(void *);
} MALLOC_FREE_STRUCT;
Ove Kaaven's avatar
Ove Kaaven committed
262

263 264 265 266 267
typedef struct _COMM_FAULT_OFFSETS
{
  short CommOffset;
  short FaultOffset;
} COMM_FAULT_OFFSETS;
Ove Kaaven's avatar
Ove Kaaven committed
268 269 270 271

typedef struct _MIDL_STUB_DESC
{
  void *RpcInterfaceInformation;
Patrik Stridvall's avatar
Patrik Stridvall committed
272 273
  void * (__RPC_API *pfnAllocate)(size_t);
  void (__RPC_API *pfnFree)(void *);
Ove Kaaven's avatar
Ove Kaaven committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
  union {
    handle_t *pAutoHandle;
    handle_t *pPrimitiveHandle;
    PGENERIC_BINDING_INFO pGenericBindingInfo;
  } IMPLICIT_HANDLE_INFO;
  const NDR_RUNDOWN *apfnNdrRundownRoutines;
  const GENERIC_BINDING_ROUTINE_PAIR *aGenericBindingRoutinePairs;
  const EXPR_EVAL *apfnExprEval;
  const XMIT_ROUTINE_QUINTUPLE *aXmitQuintuple;
  const unsigned char *pFormatTypes;
  int fCheckBounds;
  unsigned long Version;
  MALLOC_FREE_STRUCT *pMallocFreeStruct;
  long MIDLVersion;
  const COMM_FAULT_OFFSETS *CommFaultOffsets;
  const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
  const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
  ULONG_PTR mFlags;
  ULONG_PTR Reserved3;
  ULONG_PTR Reserved4;
  ULONG_PTR Reserved5;
} MIDL_STUB_DESC;
typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;

typedef struct _MIDL_FORMAT_STRING
{
  short Pad;
#if defined(__GNUC__)
  unsigned char Format[0];
#else
  unsigned char Format[1];
#endif
} MIDL_FORMAT_STRING;

308 309 310 311 312 313 314 315 316 317 318 319
typedef struct _MIDL_SYNTAX_INFO
{
  RPC_SYNTAX_IDENTIFIER TransferSyntax;
  RPC_DISPATCH_TABLE* DispatchTable;
  PFORMAT_STRING ProcString;
  const unsigned short* FmtStringOffset;
  PFORMAT_STRING TypeString;
  const void* aUserMarshalQuadruple;
  ULONG_PTR pReserved1;
  ULONG_PTR pReserved2;
} MIDL_SYNTAX_INFO, *PMIDL_SYNTAX_INFO;

Patrik Stridvall's avatar
Patrik Stridvall committed
320
typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
Ove Kaaven's avatar
Ove Kaaven committed
321

Patrik Stridvall's avatar
Patrik Stridvall committed
322
typedef long (__RPC_API *SERVER_ROUTINE)();
Ove Kaaven's avatar
Ove Kaaven committed
323 324 325 326 327 328 329 330

typedef struct _MIDL_SERVER_INFO_
{
  PMIDL_STUB_DESC pStubDesc;
  const SERVER_ROUTINE *DispatchTable;
  PFORMAT_STRING ProcString;
  const unsigned short *FmtStringOffset;
  const STUB_THUNK *ThunkTable;
331 332 333
  PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
  ULONG_PTR nCount;
  PMIDL_SYNTAX_INFO pSyntaxInfo;
Ove Kaaven's avatar
Ove Kaaven committed
334 335
} MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;

Ove Kaaven's avatar
Ove Kaaven committed
336 337 338 339 340
typedef struct _MIDL_STUBLESS_PROXY_INFO
{
  PMIDL_STUB_DESC pStubDesc;
  PFORMAT_STRING ProcFormatString;
  const unsigned short *FormatStringOffset;
341 342 343
  PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
  ULONG_PTR nCount;
  PMIDL_SYNTAX_INFO pSyntaxInfo;
Ove Kaaven's avatar
Ove Kaaven committed
344 345 346 347 348 349 350 351
} MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;

typedef union _CLIENT_CALL_RETURN
{
  void *Pointer;
  LONG_PTR Simple;
} CLIENT_CALL_RETURN;

Ove Kaaven's avatar
Ove Kaaven committed
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
typedef enum {
  STUB_UNMARSHAL,
  STUB_CALL_SERVER,
  STUB_MARSHAL,
  STUB_CALL_SERVER_NO_HRESULT
} STUB_PHASE;

typedef enum {
  PROXY_CALCSIZE,
  PROXY_GETBUFFER,
  PROXY_MARSHAL,
  PROXY_SENDRECEIVE,
  PROXY_UNMARSHAL
} PROXY_PHASE;

367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
typedef enum {
  XLAT_SERVER = 1,
  XLAT_CLIENT
} XLAT_SIDE;

typedef struct _FULL_PTR_TO_REFID_ELEMENT {
  struct _FULL_PTR_TO_REFID_ELEMENT *Next;
  void *Pointer;
  unsigned long RefId;
  unsigned char State;
} FULL_PTR_TO_REFID_ELEMENT, *PFULL_PTR_TO_REFID_ELEMENT;

/* Full pointer translation tables */
typedef struct _FULL_PTR_XLAT_TABLES {
  struct {
    void **XlatTable;
    unsigned char *StateTable;
    unsigned long NumberOfEntries;
  } RefIdToPointer;

  struct {
    PFULL_PTR_TO_REFID_ELEMENT *XlatTable;
    unsigned long NumberOfBuckets;
    unsigned long HashMask;
  } PointerToRefId;

  unsigned long           NextRefId;
  XLAT_SIDE               XlatSide;
} FULL_PTR_XLAT_TABLES,  *PFULL_PTR_XLAT_TABLES;

Ove Kaaven's avatar
Ove Kaaven committed
397 398
struct IRpcStubBuffer;

399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
typedef unsigned long error_status_t;
typedef void  * NDR_CCONTEXT;

typedef struct _SCONTEXT_QUEUE {
  unsigned long NumberOfObjects;
  NDR_SCONTEXT *ArrayOfObjects;
} SCONTEXT_QUEUE, *PSCONTEXT_QUEUE;

RPCRTAPI RPC_BINDING_HANDLE RPC_ENTRY
  NDRCContextBinding( IN NDR_CCONTEXT CContext );

RPCRTAPI void RPC_ENTRY
  NDRCContextMarshall( IN NDR_CCONTEXT CContext, OUT void *pBuff );

RPCRTAPI void RPC_ENTRY
  NDRCContextUnmarshall( OUT NDR_CCONTEXT *pCContext, IN RPC_BINDING_HANDLE hBinding,
                         IN void *pBuff, IN unsigned long DataRepresentation );

RPCRTAPI void RPC_ENTRY
  NDRSContextMarshall( IN NDR_SCONTEXT CContext, OUT void *pBuff, IN NDR_RUNDOWN userRunDownIn );

RPCRTAPI NDR_SCONTEXT RPC_ENTRY
  NDRSContextUnmarshall( IN void *pBuff, IN unsigned long DataRepresentation );

RPCRTAPI void RPC_ENTRY
  NDRSContextMarshallEx( IN RPC_BINDING_HANDLE BindingHandle, IN NDR_SCONTEXT CContext, 
                         OUT void *pBuff, IN NDR_RUNDOWN userRunDownIn );

RPCRTAPI void RPC_ENTRY
  NDRSContextMarshall2( IN RPC_BINDING_HANDLE BindingHandle, IN NDR_SCONTEXT CContext,
                        OUT void *pBuff, IN NDR_RUNDOWN userRunDownIn, IN void * CtxGuard,
                        IN unsigned long Flags );

RPCRTAPI NDR_SCONTEXT RPC_ENTRY
  NDRSContextUnmarshallEx( IN RPC_BINDING_HANDLE BindingHandle, IN void *pBuff, 
                           IN unsigned long DataRepresentation );

RPCRTAPI NDR_SCONTEXT RPC_ENTRY
  NDRSContextUnmarshall2( IN RPC_BINDING_HANDLE BindingHandle, IN void *pBuff,
                          IN unsigned long DataRepresentation, IN void *CtxGuard,
                          IN unsigned long Flags );

RPCRTAPI void RPC_ENTRY
  RpcSsDestroyClientContext( IN void **ContextHandle );

Ove Kaaven's avatar
Ove Kaaven committed
444 445 446 447 448 449
RPCRTAPI void RPC_ENTRY
  NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
RPCRTAPI void RPC_ENTRY
  NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );

/* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
450
#define SIMPLE_TYPE_MARSHAL(type) \
Ove Kaaven's avatar
Ove Kaaven committed
451 452 453 454 455 456 457
RPCRTAPI unsigned char* RPC_ENTRY \
  Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
RPCRTAPI unsigned char* RPC_ENTRY \
  Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
RPCRTAPI void RPC_ENTRY \
  Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
RPCRTAPI unsigned long RPC_ENTRY \
458 459 460 461
  Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );

#define TYPE_MARSHAL(type) \
  SIMPLE_TYPE_MARSHAL(type) \
Ove Kaaven's avatar
Ove Kaaven committed
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
RPCRTAPI void RPC_ENTRY \
  Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );

TYPE_MARSHAL(Pointer)
TYPE_MARSHAL(SimpleStruct)
TYPE_MARSHAL(ConformantStruct)
TYPE_MARSHAL(ConformantVaryingStruct)
TYPE_MARSHAL(ComplexStruct)
TYPE_MARSHAL(FixedArray)
TYPE_MARSHAL(ConformantArray)
TYPE_MARSHAL(ConformantVaryingArray)
TYPE_MARSHAL(VaryingArray)
TYPE_MARSHAL(ComplexArray)
TYPE_MARSHAL(EncapsulatedUnion)
TYPE_MARSHAL(NonEncapsulatedUnion)
TYPE_MARSHAL(ByteCountPointer)
TYPE_MARSHAL(XmitOrRepAs)
TYPE_MARSHAL(UserMarshal)
TYPE_MARSHAL(InterfacePointer)

482 483 484
SIMPLE_TYPE_MARSHAL(ConformantString)
SIMPLE_TYPE_MARSHAL(NonConformantString)

Ove Kaaven's avatar
Ove Kaaven committed
485
#undef TYPE_MARSHAL
486
#undef SIMPLE_TYPE_MARSHAL
Ove Kaaven's avatar
Ove Kaaven committed
487 488 489 490 491 492

RPCRTAPI void RPC_ENTRY
  NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams );
RPCRTAPI void RPC_ENTRY
  NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );

493 494
/* Note: this should return a CLIENT_CALL_RETURN, but calling convention for
 * returning structures/unions is different between Windows and gcc on i386. */
495
LONG_PTR RPC_VAR_ENTRY
Ove Kaaven's avatar
Ove Kaaven committed
496
  NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
497
LONG_PTR RPC_VAR_ENTRY
Ove Kaaven's avatar
Ove Kaaven committed
498 499 500 501 502 503 504 505
  NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );

RPCRTAPI void RPC_ENTRY
  NdrServerCall2( PRPC_MESSAGE pRpcMsg );
RPCRTAPI void RPC_ENTRY
  NdrServerCall( PRPC_MESSAGE pRpcMsg );

RPCRTAPI long RPC_ENTRY
506
  NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
Ove Kaaven's avatar
Ove Kaaven committed
507
RPCRTAPI long RPC_ENTRY
508
  NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
Ove Kaaven's avatar
Ove Kaaven committed
509

Ove Kaaven's avatar
Ove Kaaven committed
510 511 512 513 514 515
RPCRTAPI void* RPC_ENTRY
  NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, size_t Len );

RPCRTAPI void RPC_ENTRY
  NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
                            
Ove Kaaven's avatar
Ove Kaaven committed
516 517 518 519 520
RPCRTAPI void* RPC_ENTRY
  NdrOleAllocate( size_t Size );
RPCRTAPI void RPC_ENTRY
  NdrOleFree( void* NodeToFree );

521 522
RPCRTAPI void RPC_ENTRY
  NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg, 
523
                          PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
524 525
RPCRTAPI unsigned char* RPC_ENTRY
  NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );  
526
RPCRTAPI unsigned char* RPC_ENTRY
527 528 529
  NdrGetBuffer( MIDL_STUB_MESSAGE *stubmsg, unsigned long buflen, RPC_BINDING_HANDLE handle );
RPCRTAPI void RPC_ENTRY
  NdrFreeBuffer( MIDL_STUB_MESSAGE *pStubMsg );
530
RPCRTAPI unsigned char* RPC_ENTRY
531 532
  NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char *buffer );

533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
RPCRTAPI unsigned char * RPC_ENTRY
  NdrNsGetBuffer( PMIDL_STUB_MESSAGE pStubMsg, unsigned long BufferLength, RPC_BINDING_HANDLE Handle );
RPCRTAPI unsigned char * RPC_ENTRY
  NdrNsSendReceive( PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pBufferEnd, RPC_BINDING_HANDLE *pAutoHandle );

RPCRTAPI PFULL_PTR_XLAT_TABLES RPC_ENTRY
  NdrFullPointerXlatInit( unsigned long NumberOfPointers, XLAT_SIDE XlatSide );
RPCRTAPI void RPC_ENTRY
  NdrFullPointerXlatFree( PFULL_PTR_XLAT_TABLES pXlatTables );
RPCRTAPI int RPC_ENTRY
  NdrFullPointerQueryPointer( PFULL_PTR_XLAT_TABLES pXlatTables, void *pPointer,
                              unsigned char QueryType, unsigned long *pRefId );
RPCRTAPI int RPC_ENTRY
  NdrFullPointerQueryRefId( PFULL_PTR_XLAT_TABLES pXlatTables, unsigned long RefId,
                            unsigned char QueryType, void **ppPointer );
RPCRTAPI void RPC_ENTRY
  NdrFullPointerInsertRefId( PFULL_PTR_XLAT_TABLES pXlatTables, unsigned long RefId, void *pPointer );
RPCRTAPI int RPC_ENTRY
  NdrFullPointerFree( PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer );

RPCRTAPI void RPC_ENTRY
  NdrRpcSsEnableAllocate( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void RPC_ENTRY
  NdrRpcSsDisableAllocate( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void RPC_ENTRY
  NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void * RPC_ENTRY
  NdrRpcSmClientAllocate( IN size_t Size );
RPCRTAPI void RPC_ENTRY
  NdrRpcSmClientFree( IN void *NodeToFree );
RPCRTAPI void * RPC_ENTRY
  NdrRpcSsDefaultAllocate( IN size_t Size );
RPCRTAPI void RPC_ENTRY
  NdrRpcSsDefaultFree( IN void *NodeToFree );

Eric Pouech's avatar
Eric Pouech committed
568 569 570
#ifdef __cplusplus
}
#endif
571
#endif /*__WINE_RPCNDR_H */