Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __NDRTYPES_H__
      7 #define __NDRTYPES_H__
      8 
      9 #include <limits.h>
     10 #ifdef __cplusplus
     11 extern "C" {
     12 #endif
     13 
     14 #define UNION_OFFSET16_MIN -32512
     15 
     16 #define PTR_WIRE_SIZE 4
     17 
     18 #define NT64_PTR_SIZE 8
     19 #define NT32_PTR_SIZE 4
     20 #define SIZEOF_PTR(f64) ((f64) ? NT64_PTR_SIZE : NT32_PTR_SIZE)
     21 #define SIZEOF_MEM_PTR() ((pCommand->Is64BitEnv()) ? NT64_PTR_SIZE : NT32_PTR_SIZE)
     22 
     23 #define SIZEOF_INT3264() ((pCommand->Is64BitEnv()) ? 8 : 4)
     24 
     25 #define NDR_MAJOR_VERSION __MSABI_LONG(5U)
     26 #define NDR_MINOR_VERSION __MSABI_LONG(4U)
     27 #define NDR_VERSION ((NDR_MAJOR_VERSION << 16) | NDR_MINOR_VERSION)
     28 
     29 #define NDR_VERSION_1_1 ((__MSABI_LONG(1U) << 16) | 1)
     30 #define NDR_VERSION_2_0 ((__MSABI_LONG(2U) << 16) | 0)
     31 #define NDR_VERSION_5_0 ((__MSABI_LONG(5U) << 16) | 0)
     32 #define NDR_VERSION_5_2 ((__MSABI_LONG(5U) << 16) | 2)
     33 #define NDR_VERSION_5_3 ((__MSABI_LONG(5U) << 16) | 3)
     34 #define NDR_VERSION_5_4 ((__MSABI_LONG(5U) << 16) | 4)
     35 
     36 #define LOAD_TLB_AS_64BIT 0
     37 #define LOAD_TLB_AS_32BIT 0
     38 
     39   typedef enum {
     40     FC_ZERO,FC_BYTE,FC_CHAR,FC_SMALL,FC_USMALL,FC_WCHAR,FC_SHORT,FC_USHORT,FC_LONG,FC_ULONG,FC_FLOAT,FC_HYPER,FC_DOUBLE,FC_ENUM16,FC_ENUM32,
     41     FC_IGNORE,FC_ERROR_STATUS_T,FC_RP,FC_UP,FC_OP,FC_FP,FC_STRUCT,FC_PSTRUCT,FC_CSTRUCT,FC_CPSTRUCT,FC_CVSTRUCT,FC_BOGUS_STRUCT,FC_CARRAY,
     42     FC_CVARRAY,FC_SMFARRAY,FC_LGFARRAY,FC_SMVARRAY,FC_LGVARRAY,FC_BOGUS_ARRAY,FC_C_CSTRING,FC_C_BSTRING,FC_C_SSTRING,FC_C_WSTRING,FC_CSTRING,
     43     FC_BSTRING,FC_SSTRING,FC_WSTRING,FC_ENCAPSULATED_UNION,FC_NON_ENCAPSULATED_UNION,FC_BYTE_COUNT_POINTER,FC_TRANSMIT_AS,FC_REPRESENT_AS,FC_IP,
     44     FC_BIND_CONTEXT,FC_BIND_GENERIC,FC_BIND_PRIMITIVE,FC_AUTO_HANDLE,FC_CALLBACK_HANDLE,FC_UNUSED1,FC_POINTER,FC_ALIGNM2,FC_ALIGNM4,FC_ALIGNM8,
     45     FC_UNUSED2,FC_UNUSED3,FC_UNUSED4,FC_STRUCTPAD1,FC_STRUCTPAD2,FC_STRUCTPAD3,FC_STRUCTPAD4,FC_STRUCTPAD5,FC_STRUCTPAD6,FC_STRUCTPAD7,
     46     FC_STRING_SIZED,FC_UNUSED5,FC_NO_REPEAT,FC_FIXED_REPEAT,FC_VARIABLE_REPEAT,FC_FIXED_OFFSET,FC_VARIABLE_OFFSET,FC_PP,FC_EMBEDDED_COMPLEX,
     47     FC_IN_PARAM,FC_IN_PARAM_BASETYPE,FC_IN_PARAM_NO_FREE_INST,FC_IN_OUT_PARAM,FC_OUT_PARAM,FC_RETURN_PARAM,FC_RETURN_PARAM_BASETYPE,FC_DEREFERENCE,
     48     FC_DIV_2,FC_MULT_2,FC_ADD_1,FC_SUB_1,FC_CALLBACK,FC_CONSTANT_IID,FC_END,FC_PAD,FC_SPLIT_DEREFERENCE = 0x74,FC_SPLIT_DIV_2,FC_SPLIT_MULT_2,
     49     FC_SPLIT_ADD_1,FC_SPLIT_SUB_1,FC_SPLIT_CALLBACK,FC_HARD_STRUCT = 0xb1,FC_TRANSMIT_AS_PTR,FC_REPRESENT_AS_PTR,FC_USER_MARSHAL,FC_PIPE,
     50     FC_BLKHOLE,FC_RANGE,FC_INT3264,FC_UINT3264,FC_END_OF_UNIVERSE
     51   } FORMAT_CHARACTER;
     52 
     53   typedef struct {
     54     unsigned char FullPtrUsed : 1;
     55     unsigned char RpcSsAllocUsed : 1;
     56     unsigned char ObjectProc : 1;
     57     unsigned char HasRpcFlags : 1;
     58     unsigned char IgnoreObjectException : 1;
     59     unsigned char HasCommOrFault : 1;
     60     unsigned char UseNewInitRoutines : 1;
     61     unsigned char Unused : 1;
     62   } INTERPRETER_FLAGS,*PINTERPRETER_FLAGS;
     63 
     64   typedef struct {
     65     unsigned short MustSize : 1;
     66     unsigned short MustFree : 1;
     67     unsigned short IsPipe : 1;
     68     unsigned short IsIn : 1;
     69     unsigned short IsOut : 1;
     70     unsigned short IsReturn : 1;
     71     unsigned short IsBasetype : 1;
     72     unsigned short IsByValue : 1;
     73     unsigned short IsSimpleRef : 1;
     74     unsigned short IsDontCallFreeInst : 1;
     75     unsigned short SaveForAsyncFinish : 1;
     76     unsigned short Unused : 2;
     77     unsigned short ServerAllocSize : 3;
     78   } PARAM_ATTRIBUTES,*PPARAM_ATTRIBUTES;
     79 
     80   typedef struct {
     81     unsigned char ServerMustSize : 1;
     82     unsigned char ClientMustSize : 1;
     83     unsigned char HasReturn : 1;
     84     unsigned char HasPipes : 1;
     85     unsigned char Unused : 1;
     86     unsigned char HasAsyncUuid : 1;
     87     unsigned char HasExtensions : 1;
     88     unsigned char HasAsyncHandle : 1;
     89   } INTERPRETER_OPT_FLAGS,*PINTERPRETER_OPT_FLAGS;
     90 
     91   typedef struct _NDR_DCOM_OI2_PROC_HEADER {
     92     unsigned char HandleType;
     93     INTERPRETER_FLAGS OldOiFlags;
     94     unsigned short RpcFlagsLow;
     95     unsigned short RpcFlagsHi;
     96     unsigned short ProcNum;
     97     unsigned short StackSize;
     98 
     99     unsigned short ClientBufferSize;
    100     unsigned short ServerBufferSize;
    101     INTERPRETER_OPT_FLAGS Oi2Flags;
    102     unsigned char NumberParams;
    103   } NDR_DCOM_OI2_PROC_HEADER,*PNDR_DCOM_OI2_PROC_HEADER;
    104 
    105   typedef struct {
    106     unsigned char HasNewCorrDesc : 1;
    107     unsigned char ClientCorrCheck : 1;
    108     unsigned char ServerCorrCheck : 1;
    109     unsigned char HasNotify : 1;
    110     unsigned char HasNotify2 : 1;
    111     unsigned char Unused : 3;
    112   } INTERPRETER_OPT_FLAGS2,*PINTERPRETER_OPT_FLAGS2;
    113 
    114   typedef struct {
    115     unsigned char Size;
    116     INTERPRETER_OPT_FLAGS2 Flags2;
    117     unsigned short ClientCorrHint;
    118     unsigned short ServerCorrHint;
    119     unsigned short NotifyIndex;
    120   } NDR_PROC_HEADER_EXTS,*PNDR_PROC_HEADER_EXTS;
    121 
    122   typedef struct {
    123     unsigned char Size;
    124     INTERPRETER_OPT_FLAGS2 Flags2;
    125     unsigned short ClientCorrHint;
    126     unsigned short ServerCorrHint;
    127     unsigned short NotifyIndex;
    128     unsigned short FloatArgMask;
    129   } NDR_PROC_HEADER_EXTS64,*PNDR_PROC_HEADER_EXTS64;
    130 
    131   typedef struct {
    132     unsigned char CannotBeNull : 1;
    133     unsigned char Serialize : 1;
    134     unsigned char NoSerialize : 1;
    135     unsigned char IsStrict : 1;
    136     unsigned char IsReturn : 1;
    137     unsigned char IsOut : 1;
    138     unsigned char IsIn : 1;
    139     unsigned char IsViaPtr : 1;
    140   } NDR_CONTEXT_HANDLE_FLAGS,*PNDR_CONTEXT_HANDLE_FLAGS;
    141 
    142   typedef struct _MIDL_TYPE_PICKLING_FLAGS {
    143     unsigned __LONG32 Oicf : 1;
    144     unsigned __LONG32 HasNewCorrDesc : 1;
    145     unsigned __LONG32 Unused : 30;
    146   } MIDL_TYPE_PICKLING_FLAGS,*PMIDL_TYPE_PICKLING_FLAGS;
    147 
    148 #define MAX_INTERPRETER_OUT_SIZE 128
    149 #define MAX_INTERPRETER_PARAM_OUT_SIZE 7*8
    150 
    151 #define INTERPRETER_THUNK_PARAM_SIZE_THRESHOLD (sizeof(__LONG32)*32)
    152 
    153 #define INTERPRETER_PROC_STACK_FRAME_SIZE_THRESHOLD ((64*1024) - 1)
    154 
    155 #define FC_NORMAL_CONFORMANCE (unsigned char) 0x00
    156 #define FC_POINTER_CONFORMANCE (unsigned char) 0x10
    157 #define FC_TOP_LEVEL_CONFORMANCE (unsigned char) 0x20
    158 #define FC_CONSTANT_CONFORMANCE (unsigned char) 0x40
    159 #define FC_TOP_LEVEL_MULTID_CONFORMANCE (unsigned char) 0x80
    160 
    161 #define FC_NORMAL_VARIANCE FC_NORMAL_CONFORMANCE
    162 #define FC_POINTER_VARIANCE FC_POINTER_CONFORMANCE
    163 #define FC_TOP_LEVEL_VARIANCE FC_TOP_LEVEL_CONFORMANCE
    164 #define FC_CONSTANT_VARIANCE FC_CONSTANT_CONFORMANCE
    165 #define FC_TOP_LEVEL_MULTID_VARIANCE FC_TOP_LEVEL_MULTID_CONFORMANCE
    166 
    167 #define FC_NORMAL_SWITCH_IS FC_NORMAL_CONFORMANCE
    168 #define FC_POINTER_SWITCH_IS FC_POINTER_CONFORMANCE
    169 #define FC_TOP_LEVEL_SWITCH_IS FC_TOP_LEVEL_CONFORMANCE
    170 #define FC_CONSTANT_SWITCH_IS FC_CONSTANT_CONFORMANCE
    171 
    172   typedef struct _NDR_CORRELATION_FLAGS
    173   {
    174     unsigned char Early : 1;
    175     unsigned char Split : 1;
    176     unsigned char IsIidIs : 1;
    177     unsigned char DontCheck: 1;
    178     unsigned char Unused : 4;
    179   } NDR_CORRELATION_FLAGS;
    180 
    181 #define FC_EARLY_CORRELATION (unsigned char) 0x01
    182 #define FC_SPLIT_CORRELATION (unsigned char) 0x02
    183 #define FC_IID_CORRELATION (unsigned char) 0x04
    184 #define FC_NOCHECK_CORRELATION (unsigned char) 0x08
    185 
    186 #define FC_ALLOCATE_ALL_NODES 0x01
    187 #define FC_DONT_FREE 0x02
    188 #define FC_ALLOCED_ON_STACK 0x04
    189 #define FC_SIMPLE_POINTER 0x08
    190 #define FC_POINTER_DEREF 0x10
    191 
    192 #define LOW_NIBBLE(Byte) (((unsigned char)Byte) & 0x0f)
    193 #define HIGH_NIBBLE(Byte) (((unsigned char)Byte) >> 4)
    194 
    195 #define INVALID_RUNDOWN_ROUTINE_INDEX 255
    196 
    197 #define OPERATION_MAYBE 0x0001
    198 #define OPERATION_BROADCAST 0x0002
    199 #define OPERATION_IDEMPOTENT 0x0004
    200 #define OPERATION_INPUT_SYNC 0x0008
    201 #define OPERATION_ASYNC 0x0010
    202 #define OPERATION_MESSAGE 0x0020
    203 
    204 #define PRESENTED_TYPE_NO_FLAG_SET 0x00
    205 #define PRESENTED_TYPE_IS_ARRAY 0x10
    206 #define PRESENTED_TYPE_ALIGN_4 0x20
    207 #define PRESENTED_TYPE_ALIGN_8 0x40
    208 
    209 #define USER_MARSHAL_POINTER 0xc0
    210 
    211 #define USER_MARSHAL_UNIQUE 0x80
    212 #define USER_MARSHAL_REF 0x40
    213 #define USER_MARSHAL_IID 0x20
    214 
    215 #define HANDLE_PARAM_IS_VIA_PTR 0x80
    216 #define HANDLE_PARAM_IS_IN 0x40
    217 #define HANDLE_PARAM_IS_OUT 0x20
    218 #define HANDLE_PARAM_IS_RETURN 0x10
    219 
    220 #define NDR_STRICT_CONTEXT_HANDLE 0x08
    221 #define NDR_CONTEXT_HANDLE_NOSERIALIZE 0x04
    222 #define NDR_CONTEXT_HANDLE_SERIALIZE 0x02
    223 #define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL 0x01
    224 
    225 #define Oi_FULL_PTR_USED 0x01
    226 #define Oi_RPCSS_ALLOC_USED 0x02
    227 #define Oi_OBJECT_PROC 0x04
    228 #define Oi_HAS_RPCFLAGS 0x08
    229 
    230 #define Oi_IGNORE_OBJECT_EXCEPTION_HANDLING 0x10
    231 
    232 #define ENCODE_IS_USED 0x10
    233 #define DECODE_IS_USED 0x20
    234 #define PICKLING_HAS_COMM_OR_FAULT 0x40
    235 
    236 #define Oi_HAS_COMM_OR_FAULT 0x20
    237 #define Oi_OBJ_USE_V2_INTERPRETER 0x20
    238 
    239 #define Oi_USE_NEW_INIT_ROUTINES 0x40
    240 #define Oi_UNUSED 0x80
    241 
    242 #define Oif_HAS_ASYNC_UUID 0x20
    243 
    244 #define UNION_CONSECUTIVE_ARMS 1
    245 #define UNION_SMALL_ARMS 2
    246 #define UNION_LARGE_ARMS 3
    247 
    248 #define FC_BIG_PIPE 0x80
    249 #define FC_OBJECT_PIPE 0x40
    250 #define FC_PIPE_HAS_RANGE 0x20
    251 
    252 #define BLKHOLE_BASETYPE 0x01
    253 #define BLKHOLE_FUNCTION 0x02
    254 #define BLKHOLE_XURTYPE 0x04
    255 
    256 #define MAGIC_UNION_SHORT ((unsigned short) 0x8000)
    257 
    258 #define NDR_DEFAULT_CORR_CACHE_SIZE 400
    259 
    260 #ifdef __cplusplus
    261 }
    262 #endif
    263 #endif
    264