[PSDK]
[reactos.git] / include / psdk / rpcndr.h
index 9bf2840..60f66dc 100644 (file)
@@ -30,6 +30,13 @@ extern "C" {
 
 #include <basetsd.h>
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#pragma warning(disable:4255)
+#pragma warning(disable:4820)
+#endif
+
 #undef CONST_VTBL
 #ifdef CONST_VTABLE
 # define CONST_VTBL const
@@ -97,8 +104,8 @@ extern "C" {
 
 #define small char
 typedef unsigned char byte;
-#define hyper __int64
-#define MIDL_uhyper unsigned __int64
+typedef INT64 hyper;
+typedef UINT64 MIDL_uhyper;
 typedef unsigned char boolean;
 
 #define __RPC_CALLEE WINAPI
@@ -111,11 +118,20 @@ typedef unsigned char boolean;
 #define midl_user_free MIDL_user_free
 #define midl_user_allocate MIDL_user_allocate
 
+void  * __RPC_USER MIDL_user_allocate(size_t size);
+void             __RPC_USER MIDL_user_free( void  * );
+
 #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)
 
-typedef struct
+#define RPC_BAD_STUB_DATA_EXCEPTION_FILTER  \
+  ((RpcExceptionCode() == STATUS_ACCESS_VIOLATION) || \
+   (RpcExceptionCode() == STATUS_DATATYPE_MISALIGNMENT) || \
+   (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \
+   (RpcExceptionCode() == RPC_S_INVALID_BOUND))
+
+typedef struct tagNDR_SCONTEXT
 {
   void *pad[2];
   void *userContext;
@@ -138,7 +154,7 @@ struct NDR_ALLOC_ALL_NODES_CONTEXT;
 struct NDR_POINTER_QUEUE_STATE;
 
 typedef unsigned char *RPC_BUFPTR;
-typedef unsigned long RPC_LENGTH;
+typedef ULONG RPC_LENGTH;
 typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
 typedef const unsigned char *PFORMAT_STRING;
 
@@ -164,7 +180,6 @@ typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
 typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
 typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
 
-#include <pshpack4.h>
 typedef struct _MIDL_STUB_MESSAGE
 {
   PRPC_MESSAGE RpcMsg;
@@ -189,7 +204,7 @@ typedef struct _MIDL_STUB_MESSAGE
   ULONG_PTR MaxCount;
   ULONG Offset;
   ULONG ActualCount;
-  void * (__RPC_API *pfnAllocate)(size_t);
+  void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T);
   void (__RPC_API *pfnFree)(void *);
   unsigned char *StackTop;
   unsigned char *pPresentedType;
@@ -199,19 +214,19 @@ typedef struct _MIDL_STUB_MESSAGE
   struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
   ULONG FullPtrRefId;
   ULONG PointerLength;
-  int fInDontFree:1;
-  int fDontCallFreeInst:1;
-  int fInOnlyParam:1;
-  int fHasReturn:1;
-  int fHasExtensions:1;
-  int fHasNewCorrDesc:1;
-  int fIsIn:1;
-  int fIsOut:1;
-  int fIsOicf:1;
-  int fBufferValid:1;
-  int fHasMemoryValidateCallback:1;
-  int fInFree:1;
-  int fNeedMCCP:1;
+  unsigned int fInDontFree:1;
+  unsigned int fDontCallFreeInst:1;
+  unsigned int fInOnlyParam:1;
+  unsigned int fHasReturn:1;
+  unsigned int fHasExtensions:1;
+  unsigned int fHasNewCorrDesc:1;
+  unsigned int fIsIn:1;
+  unsigned int fIsOut:1;
+  unsigned int fIsOicf:1;
+  unsigned int fBufferValid:1;
+  unsigned int fHasMemoryValidateCallback:1;
+  unsigned int fInFree:1;
+  unsigned int fNeedMCCP:1;
   int fUnused:3;
   int fUnused2:16;
   DWORD dwDestContext;
@@ -241,7 +256,6 @@ typedef struct _MIDL_STUB_MESSAGE
   INT_PTR Reserved51_4;
   INT_PTR Reserved51_5;
 } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
-#include <poppack.h>
 
 typedef void * (__RPC_API * GENERIC_BINDING_ROUTINE)(void *);
 typedef void (__RPC_API * GENERIC_UNBIND_ROUTINE)(void *, unsigned char *);
@@ -316,7 +330,7 @@ typedef struct _USER_MARSHAL_CB
 
 typedef struct _MALLOC_FREE_STRUCT
 {
-  void * (__RPC_USER *pfnAllocate)(size_t);
+  void * (__WINE_ALLOC_SIZE(1) __RPC_USER *pfnAllocate)(SIZE_T);
   void   (__RPC_USER *pfnFree)(void *);
 } MALLOC_FREE_STRUCT;
 
@@ -329,7 +343,7 @@ typedef struct _COMM_FAULT_OFFSETS
 typedef struct _MIDL_STUB_DESC
 {
   void *RpcInterfaceInformation;
-  void * (__RPC_API *pfnAllocate)(size_t);
+  void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t);
   void (__RPC_API *pfnFree)(void *);
   union {
     handle_t *pAutoHandle;
@@ -379,7 +393,11 @@ typedef struct _MIDL_SYNTAX_INFO
 
 typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
 
+#ifdef WINE_STRICT_PROTOTYPES
+typedef LONG (__RPC_API *SERVER_ROUTINE)(void);
+#else
 typedef LONG (__RPC_API *SERVER_ROUTINE)();
+#endif
 
 typedef struct _MIDL_SERVER_INFO_
 {
@@ -468,7 +486,7 @@ typedef struct _NDR_USER_MARSHAL_INFO_LEVEL1
 {
     void *Buffer;
     ULONG BufferSize;
-    void * (__RPC_API *pfnAllocate)(size_t);
+    void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T);
     void (__RPC_API *pfnFree)(void *);
     struct IRpcChannelBuffer *pRpcChannelBuffer;
     ULONG_PTR Reserved[5];
@@ -556,6 +574,18 @@ RPCRTAPI void RPC_ENTRY
 RPCRTAPI void RPC_ENTRY
   NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
 
+RPCRTAPI unsigned char* RPC_ENTRY
+  NdrByteCountPointerMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
+RPCRTAPI unsigned char* RPC_ENTRY
+  NdrByteCountPointerUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc );
+RPCRTAPI void RPC_ENTRY
+  NdrByteCountPointerBufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
+RPCRTAPI void RPC_ENTRY
+  NdrByteCountPointerFree( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
+
+RPCRTAPI unsigned char* RPC_ENTRY
+  NdrRangeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc );
+
 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
 #define SIMPLE_TYPE_MARSHAL(type) \
 RPCRTAPI unsigned char* RPC_ENTRY \
@@ -584,11 +614,9 @@ TYPE_MARSHAL(VaryingArray)
 TYPE_MARSHAL(ComplexArray)
 TYPE_MARSHAL(EncapsulatedUnion)
 TYPE_MARSHAL(NonEncapsulatedUnion)
-TYPE_MARSHAL(ByteCountPointer)
 TYPE_MARSHAL(XmitOrRepAs)
 TYPE_MARSHAL(UserMarshal)
 TYPE_MARSHAL(InterfacePointer)
-TYPE_MARSHAL(Range)
 
 SIMPLE_TYPE_MARSHAL(ConformantString)
 SIMPLE_TYPE_MARSHAL(NonConformantString)
@@ -624,6 +652,7 @@ RPCRTAPI void RPC_ENTRY
 RPCRTAPI unsigned char* RPC_ENTRY
   NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar );
 
+#ifdef __GCC__
 /* Note: this should return a CLIENT_CALL_RETURN, but calling convention for
  * returning structures/unions is different between Windows and gcc on i386. */
 LONG_PTR RPC_VAR_ENTRY
@@ -634,6 +663,13 @@ LONG_PTR RPC_VAR_ENTRY
   NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
 LONG_PTR RPC_VAR_ENTRY
   NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
+#else
+CLIENT_CALL_RETURN RPC_VAR_ENTRY NdrClientCall2(
+  PMIDL_STUB_DESC pStubDescriptor,
+  PFORMAT_STRING pFormat,
+  ...
+);
+#endif
 
 RPCRTAPI void RPC_ENTRY
   NdrServerCall2( PRPC_MESSAGE pRpcMsg );
@@ -652,7 +688,7 @@ RPCRTAPI LONG RPC_ENTRY
   NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
 
 RPCRTAPI void* RPC_ENTRY
-  NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, size_t Len );
+  NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2);
 
 RPCRTAPI void RPC_ENTRY
   NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
@@ -662,7 +698,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
                             ULONG *pFaultStatus, RPC_STATUS Status_ );
 
 RPCRTAPI void* RPC_ENTRY
-  NdrOleAllocate( size_t Size );
+  NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
 RPCRTAPI void RPC_ENTRY
   NdrOleFree( void* NodeToFree );
 
@@ -723,17 +759,21 @@ RPCRTAPI void RPC_ENTRY
 RPCRTAPI void RPC_ENTRY
   NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
 RPCRTAPI void * RPC_ENTRY
-  NdrRpcSmClientAllocate( size_t Size );
+  NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
 RPCRTAPI void RPC_ENTRY
   NdrRpcSmClientFree( void *NodeToFree );
 RPCRTAPI void * RPC_ENTRY
-  NdrRpcSsDefaultAllocate( size_t Size );
+  NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
 RPCRTAPI void RPC_ENTRY
   NdrRpcSsDefaultFree( void *NodeToFree );
 
 RPCRTAPI RPC_STATUS RPC_ENTRY
   NdrGetUserMarshalInfo( ULONG *pFlags, ULONG InformationLevel, NDR_USER_MARSHAL_INFO *pMarshalInfo );
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 #ifdef __cplusplus
 }
 #endif