ReactOS  0.4.13-dev-259-g5ca9c9c
ndr_typelib.c File Reference
#include <assert.h>
#include "oaidl.h"
#include "rpcproxy.h"
#include "ndrtypes.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "cpsf.h"
#include "initguid.h"
#include "ndr_types.h"
#include "ndr_stubless.h"
Include dependency graph for ndr_typelib.c:

Go to the source code of this file.

Classes

struct  typelib_proxy
 
struct  typelib_stub
 

Macros

#define COBJMACROS
 
#define USE_STUBLESS_PROXY
 
#define WRITE_CHAR(str, len, val)   do { if ((str)) (str)[(len)] = (val); (len)++; } while (0)
 
#define WRITE_SHORT(str, len, val)   do { if ((str)) *((short *)((str) + (len))) = (val); (len) += 2; } while (0)
 
#define WRITE_INT(str, len, val)   do { if ((str)) *((int *)((str) + (len))) = (val); (len) += 4; } while (0)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static size_t write_type_tfs (ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
 
static const MIDL_STUBLESS_PROXY_INFOget_ndr_types_proxy_info (void)
 
static const NDR_PARAM_OIFget_ndr_types_params (unsigned int *nb_params)
 
static unsigned short get_tfs_offset (int param)
 
static const unsigned charget_type_format_string (size_t *size)
 
static unsigned short write_oleaut_tfs (VARTYPE vt)
 
static unsigned char get_base_type (VARTYPE vt)
 
static unsigned int type_memsize (ITypeInfo *typeinfo, TYPEDESC *desc)
 
static unsigned char get_array_fc (ITypeInfo *typeinfo, TYPEDESC *desc)
 
static unsigned char get_struct_fc (ITypeInfo *typeinfo, TYPEATTR *attr)
 
static size_t write_struct_tfs (ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEATTR *attr)
 
static size_t write_array_tfs (ITypeInfo *typeinfo, unsigned char *str, size_t *len, ARRAYDESC *desc)
 
static size_t write_ip_tfs (unsigned char *str, size_t *len, const GUID *iid)
 
static void get_default_iface (ITypeInfo *typeinfo, WORD count, GUID *iid)
 
static size_t write_pointer_tfs (ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
 
static unsigned short get_stack_size (ITypeInfo *typeinfo, TYPEDESC *desc)
 
static HRESULT get_param_pointer_info (ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
 
static HRESULT get_param_info (ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
 
static HRESULT write_param_fs (ITypeInfo *typeinfo, unsigned char *type, size_t *typelen, unsigned char *proc, size_t *proclen, ELEMDESC *desc, BOOL is_return, unsigned short *stack_offset)
 
static void write_proc_func_header (ITypeInfo *typeinfo, FUNCDESC *desc, WORD proc_idx, unsigned char *proc, size_t *proclen)
 
static HRESULT write_iface_fs (ITypeInfo *typeinfo, WORD funcs, WORD parentfuncs, unsigned char *type, size_t *typelen, unsigned char *proc, size_t *proclen, unsigned short *offset)
 
static HRESULT build_format_strings (ITypeInfo *typeinfo, WORD funcs, WORD parentfuncs, const unsigned char **type_ret, const unsigned char **proc_ret, unsigned short **offset_ret)
 
static HRESULT get_iface_info (ITypeInfo **typeinfo, WORD *funcs, WORD *parentfuncs, GUID *parentiid)
 
static void init_stub_desc (MIDL_STUB_DESC *desc)
 
static ULONG WINAPI typelib_proxy_Release (IRpcProxyBuffer *iface)
 
static HRESULT typelib_proxy_init (struct typelib_proxy *proxy, IUnknown *outer, ULONG count, const GUID *parentiid, IRpcProxyBuffer **proxy_buffer, void **out)
 
HRESULT WINAPI CreateProxyFromTypeInfo (ITypeInfo *typeinfo, IUnknown *outer, REFIID iid, IRpcProxyBuffer **proxy_buffer, void **out)
 
static ULONG WINAPI typelib_stub_Release (IRpcStubBuffer *iface)
 
static HRESULT typelib_stub_init (struct typelib_stub *stub, IUnknown *server, const GUID *parentiid, IRpcStubBuffer **stub_buffer)
 
HRESULT WINAPI CreateStubFromTypeInfo (ITypeInfo *typeinfo, REFIID iid, IUnknown *server, IRpcStubBuffer **stub_buffer)
 

Variables

const ExtendedProxyFileInfo ndr_types_ProxyFileInfo
 
static const unsigned short MustSize = 0x0001
 
static const unsigned short MustFree = 0x0002
 
static const unsigned short IsIn = 0x0008
 
static const unsigned short IsOut = 0x0010
 
static const unsigned short IsReturn = 0x0020
 
static const unsigned short IsBasetype = 0x0040
 
static const unsigned short IsByValue = 0x0080
 
static const unsigned short IsSimpleRef = 0x0100
 
static const IRpcProxyBufferVtbl typelib_proxy_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file ndr_typelib.c.

◆ USE_STUBLESS_PROXY

#define USE_STUBLESS_PROXY

Definition at line 28 of file ndr_typelib.c.

◆ WRITE_CHAR

#define WRITE_CHAR (   str,
  len,
  val 
)    do { if ((str)) (str)[(len)] = (val); (len)++; } while (0)

Definition at line 44 of file ndr_typelib.c.

◆ WRITE_INT

#define WRITE_INT (   str,
  len,
  val 
)    do { if ((str)) *((int *)((str) + (len))) = (val); (len) += 4; } while (0)

Definition at line 48 of file ndr_typelib.c.

◆ WRITE_SHORT

#define WRITE_SHORT (   str,
  len,
  val 
)    do { if ((str)) *((short *)((str) + (len))) = (val); (len) += 2; } while (0)

Definition at line 46 of file ndr_typelib.c.

Function Documentation

◆ build_format_strings()

static HRESULT build_format_strings ( ITypeInfo typeinfo,
WORD  funcs,
WORD  parentfuncs,
const unsigned char **  type_ret,
const unsigned char **  proc_ret,
unsigned short **  offset_ret 
)
static

Definition at line 814 of file ndr_typelib.c.

817 {
818  size_t tfs_size;
819  const unsigned char *tfs = get_type_format_string( &tfs_size );
820  size_t typelen = tfs_size, proclen = 0;
821  unsigned char *type, *proc;
822  unsigned short *offset;
823  HRESULT hr;
824 
825  hr = write_iface_fs(typeinfo, funcs, parentfuncs, NULL, &typelen, NULL, &proclen, NULL);
826  if (FAILED(hr)) return hr;
827 
828  type = heap_alloc(typelen);
829  proc = heap_alloc(proclen);
830  offset = heap_alloc((parentfuncs + funcs - 3) * sizeof(*offset));
831  if (!type || !proc || !offset)
832  {
833  ERR("Failed to allocate format strings.\n");
834  hr = E_OUTOFMEMORY;
835  goto err;
836  }
837 
838  memcpy(type, tfs, tfs_size);
839  typelen = tfs_size;
840  proclen = 0;
841 
842  hr = write_iface_fs(typeinfo, funcs, parentfuncs, type, &typelen, proc, &proclen, offset);
843  if (SUCCEEDED(hr))
844  {
845  *type_ret = type;
846  *proc_ret = proc;
847  *offset_ret = offset;
848  return S_OK;
849  }
850 
851 err:
852  heap_free(type);
853  heap_free(proc);
854  heap_free(offset);
855  return hr;
856 }
HRESULT hr
Definition: shlfolder.c:183
GLintptr offset
Definition: glext.h:5920
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HRESULT write_iface_fs(ITypeInfo *typeinfo, WORD funcs, WORD parentfuncs, unsigned char *type, size_t *typelen, unsigned char *proc, size_t *proclen, unsigned short *offset)
Definition: ndr_typelib.c:765
static HANDLE proc()
Definition: pdb.c:32
static const unsigned char * get_type_format_string(size_t *size)
Definition: ndr_typelib.c:90
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static struct __wine_debug_functions funcs
Definition: debug.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define err(...)
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by CreateProxyFromTypeInfo(), and CreateStubFromTypeInfo().

◆ CreateProxyFromTypeInfo()

HRESULT WINAPI CreateProxyFromTypeInfo ( ITypeInfo typeinfo,
IUnknown outer,
REFIID  iid,
IRpcProxyBuffer **  proxy_buffer,
void **  out 
)

Definition at line 1010 of file ndr_typelib.c.

1012 {
1013  struct typelib_proxy *proxy;
1014  WORD funcs, parentfuncs, i;
1015  GUID parentiid;
1016  HRESULT hr;
1017 
1018  TRACE("typeinfo %p, outer %p, iid %s, proxy_buffer %p, out %p.\n",
1019  typeinfo, outer, debugstr_guid(iid), proxy_buffer, out);
1020 
1021  hr = get_iface_info(&typeinfo, &funcs, &parentfuncs, &parentiid);
1022  if (FAILED(hr))
1023  return hr;
1024 
1025  if (!(proxy = heap_alloc_zero(sizeof(*proxy))))
1026  {
1027  ERR("Failed to allocate proxy object.\n");
1028  return E_OUTOFMEMORY;
1029  }
1030 
1031  init_stub_desc(&proxy->stub_desc);
1032  proxy->proxy_info.pStubDesc = &proxy->stub_desc;
1033 
1034  proxy->proxy_vtbl = heap_alloc_zero(sizeof(proxy->proxy_vtbl->header) + (funcs + parentfuncs) * sizeof(void *));
1035  if (!proxy->proxy_vtbl)
1036  {
1037  ERR("Failed to allocate proxy vtbl.\n");
1038  heap_free(proxy);
1039  return E_OUTOFMEMORY;
1040  }
1041  proxy->proxy_vtbl->header.pStublessProxyInfo = &proxy->proxy_info;
1042  proxy->iid = *iid;
1043  proxy->proxy_vtbl->header.piid = &proxy->iid;
1044  fill_delegated_proxy_table((IUnknownVtbl *)proxy->proxy_vtbl->Vtbl, parentfuncs);
1045  for (i = 0; i < funcs; i++)
1046  proxy->proxy_vtbl->Vtbl[parentfuncs + i] = (void *)-1;
1047 
1048  hr = build_format_strings(typeinfo, funcs, parentfuncs, &proxy->stub_desc.pFormatTypes,
1049  &proxy->proxy_info.ProcFormatString, &proxy->offset_table);
1050  if (FAILED(hr))
1051  {
1052  heap_free(proxy->proxy_vtbl);
1053  heap_free(proxy);
1054  return hr;
1055  }
1056  proxy->proxy_info.FormatStringOffset = &proxy->offset_table[-3];
1057 
1058  hr = typelib_proxy_init(proxy, outer, funcs + parentfuncs, &parentiid, proxy_buffer, out);
1059  if (FAILED(hr))
1060  {
1061  heap_free((void *)proxy->stub_desc.pFormatTypes);
1062  heap_free((void *)proxy->proxy_info.ProcFormatString);
1063  heap_free((void *)proxy->offset_table);
1064  heap_free(proxy->proxy_vtbl);
1065  heap_free(proxy);
1066  }
1067 
1068  return hr;
1069 }
int proxy
Definition: main.c:67
static HRESULT get_iface_info(ITypeInfo **typeinfo, WORD *funcs, WORD *parentfuncs, GUID *parentiid)
Definition: ndr_typelib.c:859
BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN
Definition: cstub.c:252
static HRESULT build_format_strings(ITypeInfo *typeinfo, WORD funcs, WORD parentfuncs, const unsigned char **type_ret, const unsigned char **proc_ret, unsigned short **offset_ret)
Definition: ndr_typelib.c:814
HRESULT hr
Definition: shlfolder.c:183
static void init_stub_desc(MIDL_STUB_DESC *desc)
Definition: ndr_typelib.c:930
static HRESULT typelib_proxy_init(struct typelib_proxy *proxy, IUnknown *outer, ULONG count, const GUID *parentiid, IRpcProxyBuffer **proxy_buffer, void **out)
Definition: ndr_typelib.c:982
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
#define ERR(fmt,...)
Definition: debug.h:109
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by typelib_ps_CreateProxy().

◆ CreateStubFromTypeInfo()

HRESULT WINAPI CreateStubFromTypeInfo ( ITypeInfo typeinfo,
REFIID  iid,
IUnknown server,
IRpcStubBuffer **  stub_buffer 
)

Definition at line 1145 of file ndr_typelib.c.

1147 {
1148  WORD funcs, parentfuncs, i;
1149  struct typelib_stub *stub;
1150  GUID parentiid;
1151  HRESULT hr;
1152 
1153  TRACE("typeinfo %p, iid %s, server %p, stub_buffer %p.\n",
1154  typeinfo, debugstr_guid(iid), server, stub_buffer);
1155 
1156  hr = get_iface_info(&typeinfo, &funcs, &parentfuncs, &parentiid);
1157  if (FAILED(hr))
1158  return hr;
1159 
1160  if (!(stub = heap_alloc_zero(sizeof(*stub))))
1161  {
1162  ERR("Failed to allocate stub object.\n");
1163  return E_OUTOFMEMORY;
1164  }
1165 
1166  init_stub_desc(&stub->stub_desc);
1167  stub->server_info.pStubDesc = &stub->stub_desc;
1168 
1169  hr = build_format_strings(typeinfo, funcs, parentfuncs, &stub->stub_desc.pFormatTypes,
1170  &stub->server_info.ProcString, &stub->offset_table);
1171  if (FAILED(hr))
1172  {
1173  heap_free(stub);
1174  return hr;
1175  }
1176  stub->server_info.FmtStringOffset = &stub->offset_table[-3];
1177 
1178  stub->iid = *iid;
1179  stub->stub_vtbl.header.piid = &stub->iid;
1180  stub->stub_vtbl.header.pServerInfo = &stub->server_info;
1181  stub->stub_vtbl.header.DispatchTableCount = funcs + parentfuncs;
1182 
1183  if (!IsEqualGUID(&parentiid, &IID_IUnknown))
1184  {
1185  stub->dispatch_table = heap_alloc((funcs + parentfuncs) * sizeof(void *));
1186  for (i = 3; i < parentfuncs; i++)
1187  stub->dispatch_table[i - 3] = NdrStubForwardingFunction;
1188  for (; i < funcs + parentfuncs; i++)
1189  stub->dispatch_table[i - 3] = (PRPC_STUB_FUNCTION)NdrStubCall2;
1190  stub->stub_vtbl.header.pDispatchTable = &stub->dispatch_table[-3];
1191  stub->stub_vtbl.Vtbl = CStdStubBuffer_Delegating_Vtbl;
1192  }
1193  else
1194  stub->stub_vtbl.Vtbl = CStdStubBuffer_Vtbl;
1195  stub->stub_vtbl.Vtbl.Release = typelib_stub_Release;
1196 
1197  hr = typelib_stub_init(stub, server, &parentiid, stub_buffer);
1198  if (FAILED(hr))
1199  {
1200  heap_free((void *)stub->stub_desc.pFormatTypes);
1201  heap_free((void *)stub->server_info.ProcString);
1202  heap_free(stub->offset_table);
1203  heap_free(stub);
1204  }
1205 
1206  return hr;
1207 }
LONG WINAPI NdrStubCall2(struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
static rfbScreenInfoPtr server
Definition: vnc.c:74
static HRESULT get_iface_info(ITypeInfo **typeinfo, WORD *funcs, WORD *parentfuncs, GUID *parentiid)
Definition: ndr_typelib.c:859
static HRESULT build_format_strings(ITypeInfo *typeinfo, WORD funcs, WORD parentfuncs, const unsigned char **type_ret, const unsigned char **proc_ret, unsigned short **offset_ret)
Definition: ndr_typelib.c:814
HRESULT hr
Definition: shlfolder.c:183
static ULONG WINAPI typelib_stub_Release(IRpcStubBuffer *iface)
Definition: ndr_typelib.c:1082
static void init_stub_desc(MIDL_STUB_DESC *desc)
Definition: ndr_typelib.c:930
Definition: stubgen.c:11
void(__RPC_STUB * PRPC_STUB_FUNCTION)(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *pdwStubPhase)
Definition: rpcproxy.h:88
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
struct _stub stub
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl
Definition: cstub.c:538
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static HRESULT typelib_stub_init(struct typelib_stub *stub, IUnknown *server, const GUID *parentiid, IRpcStubBuffer **stub_buffer)
Definition: ndr_typelib.c:1111
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
void __RPC_STUB NdrStubForwardingFunction(IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase)
Definition: cstub.c:610
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl
Definition: cstub.c:587
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by typelib_ps_CreateStub().

◆ get_array_fc()

static unsigned char get_array_fc ( ITypeInfo typeinfo,
TYPEDESC *  desc 
)
static

Definition at line 230 of file ndr_typelib.c.

231 {
232  if (get_base_type(desc->vt))
233  return FC_LGFARRAY;
234  else if (desc->vt == VT_USERDEFINED)
235  {
236  ITypeInfo *refinfo;
237  TYPEATTR *attr;
238  unsigned char fc;
239 
240  ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
241  ITypeInfo_GetTypeAttr(refinfo, &attr);
242 
243  if (attr->typekind == TKIND_ENUM)
244  fc = FC_LGFARRAY;
245  else if (attr->typekind == TKIND_RECORD && get_struct_fc(refinfo, attr) == FC_STRUCT)
246  fc = FC_LGFARRAY;
247  else
248  fc = FC_BOGUS_ARRAY;
249 
250  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
251  ITypeInfo_Release(refinfo);
252 
253  return fc;
254  }
255  else
256  return FC_BOGUS_ARRAY;
257 }
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
LPFOR_CONTEXT fc
Definition: for.c:53
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr)
Definition: ndr_typelib.c:197
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112

Referenced by get_struct_fc(), and write_array_tfs().

◆ get_base_type()

static unsigned char get_base_type ( VARTYPE  vt)
static

Definition at line 112 of file ndr_typelib.c.

113 {
114  switch (vt)
115  {
116  case VT_I1: return FC_SMALL;
117  case VT_BOOL:
118  case VT_I2: return FC_SHORT;
119  case VT_INT:
120  case VT_ERROR:
121  case VT_HRESULT:
122  case VT_I4: return FC_LONG;
123  case VT_I8:
124  case VT_UI8: return FC_HYPER;
125  case VT_UI1: return FC_USMALL;
126  case VT_UI2: return FC_USHORT;
127  case VT_UINT:
128  case VT_UI4: return FC_ULONG;
129  case VT_R4: return FC_FLOAT;
130  case VT_DATE:
131  case VT_R8: return FC_DOUBLE;
132  default: return 0;
133  }
134 }
Definition: compat.h:1939
Definition: compat.h:1955
Definition: compat.h:1951
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
Definition: compat.h:1940
Definition: compat.h:1941
Definition: compat.h:1938

Referenced by get_array_fc(), get_param_info(), get_param_pointer_info(), get_struct_fc(), write_array_tfs(), write_pointer_tfs(), write_proc_func_header(), and write_type_tfs().

◆ get_default_iface()

static void get_default_iface ( ITypeInfo typeinfo,
WORD  count,
GUID iid 
)
static

Definition at line 330 of file ndr_typelib.c.

331 {
332  ITypeInfo *refinfo;
333  HREFTYPE reftype;
334  TYPEATTR *attr;
335  int flags, i;
336 
337  for (i = 0; i < count; ++i)
338  {
339  ITypeInfo_GetImplTypeFlags(typeinfo, i, &flags);
340  if (flags & IMPLTYPEFLAG_FDEFAULT)
341  break;
342  }
343 
344  /* If no interface was explicitly marked default, choose the first one. */
345  if (i == count)
346  i = 0;
347 
348  ITypeInfo_GetRefTypeOfImplType(typeinfo, i, &reftype);
349  ITypeInfo_GetRefTypeInfo(typeinfo, reftype, &refinfo);
350  ITypeInfo_GetTypeAttr(refinfo, &attr);
351  *iid = attr->guid;
352  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
353  ITypeInfo_Release(refinfo);
354 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: cookie.c:170
GLbitfield flags
Definition: glext.h:7161
__u8 attr
Definition: mkdosfs.c:359

Referenced by write_pointer_tfs().

◆ get_iface_info()

static HRESULT get_iface_info ( ITypeInfo **  typeinfo,
WORD funcs,
WORD parentfuncs,
GUID parentiid 
)
static

Definition at line 859 of file ndr_typelib.c.

861 {
862  ITypeInfo *real_typeinfo, *parentinfo;
863  TYPEATTR *typeattr;
864  ITypeLib *typelib;
865  TLIBATTR *libattr;
866  TYPEKIND typekind;
867  HREFTYPE reftype;
868  SYSKIND syskind;
869  HRESULT hr;
870 
871  /* Dual interfaces report their size to be sizeof(IDispatchVtbl) and their
872  * implemented type to be IDispatch. We need to retrieve the underlying
873  * interface to get that information. */
874  hr = ITypeInfo_GetTypeAttr(*typeinfo, &typeattr);
875  if (FAILED(hr))
876  return hr;
877  typekind = typeattr->typekind;
878  ITypeInfo_ReleaseTypeAttr(*typeinfo, typeattr);
879  if (typekind == TKIND_DISPATCH)
880  {
881  hr = ITypeInfo_GetRefTypeOfImplType(*typeinfo, -1, &reftype);
882  if (FAILED(hr))
883  return hr;
884 
885  hr = ITypeInfo_GetRefTypeInfo(*typeinfo, reftype, &real_typeinfo);
886  if (FAILED(hr))
887  return hr;
888 
889  ITypeInfo_Release(*typeinfo);
890  *typeinfo = real_typeinfo;
891  }
892 
893  hr = ITypeInfo_GetContainingTypeLib(*typeinfo, &typelib, NULL);
894  if (FAILED(hr))
895  return hr;
896 
897  hr = ITypeLib_GetLibAttr(typelib, &libattr);
898  if (FAILED(hr))
899  {
900  ITypeLib_Release(typelib);
901  return hr;
902  }
903  syskind = libattr->syskind;
904  ITypeLib_ReleaseTLibAttr(typelib, libattr);
905  ITypeLib_Release(typelib);
906 
907  hr = ITypeInfo_GetTypeAttr(*typeinfo, &typeattr);
908  if (FAILED(hr))
909  return hr;
910  *funcs = typeattr->cFuncs;
911  *parentfuncs = typeattr->cbSizeVft / (syskind == SYS_WIN64 ? 8 : 4) - *funcs;
912  ITypeInfo_ReleaseTypeAttr(*typeinfo, typeattr);
913 
914  hr = ITypeInfo_GetRefTypeOfImplType(*typeinfo, 0, &reftype);
915  if (FAILED(hr))
916  return hr;
917  hr = ITypeInfo_GetRefTypeInfo(*typeinfo, reftype, &parentinfo);
918  if (FAILED(hr))
919  return hr;
920  hr = ITypeInfo_GetTypeAttr(parentinfo, &typeattr);
921  if (FAILED(hr))
922  return hr;
923  *parentiid = typeattr->guid;
924  ITypeInfo_ReleaseTypeAttr(parentinfo, typeattr);
925  ITypeInfo_Release(parentinfo);
926 
927  return hr;
928 }
HRESULT hr
Definition: shlfolder.c:183
static ITypeLib * typelib
Definition: apps.c:105
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static struct __wine_debug_functions funcs
Definition: debug.c:59
static OLECHAR OLECHAR *static SYSKIND
Definition: typelib.c:80

Referenced by CreateProxyFromTypeInfo(), and CreateStubFromTypeInfo().

◆ get_ndr_types_params()

static const NDR_PARAM_OIF* get_ndr_types_params ( unsigned int nb_params)
static

Definition at line 58 of file ndr_typelib.c.

59 {
61  const unsigned char *format = proxy->ProcFormatString + proxy->FormatStringOffset[3];
62  const NDR_PROC_HEADER *proc = (const NDR_PROC_HEADER *)format;
64 
65  if (proc->Oi_flags & Oi_HAS_RPCFLAGS)
66  format += sizeof(NDR_PROC_HEADER_RPC);
67  else
68  format += sizeof(NDR_PROC_HEADER);
69 
71  format += sizeof(*header);
72  if (header->Oi2Flags.HasExtensions)
73  {
75  format += ext->Size;
76  }
77  *nb_params = header->number_of_params;
78  return (const NDR_PARAM_OIF *)format;
79 }
int proxy
Definition: main.c:67
static HANDLE proc()
Definition: pdb.c:32
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
char ext[3]
Definition: mkdosfs.c:358
struct _NDR_PROC_HEADER NDR_PROC_HEADER
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
static const MIDL_STUBLESS_PROXY_INFO * get_ndr_types_proxy_info(void)
Definition: ndr_typelib.c:53
struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
struct CFHEADER header
Definition: fdi.c:109

Referenced by get_tfs_offset(), and get_type_format_string().

◆ get_ndr_types_proxy_info()

static const MIDL_STUBLESS_PROXY_INFO* get_ndr_types_proxy_info ( void  )
static

Definition at line 53 of file ndr_typelib.c.

54 {
55  return ndr_types_ProxyFileInfo.pProxyVtblList[0]->header.pStublessProxyInfo;
56 }
CInterfaceProxyHeader header
Definition: rpcproxy.h:80
const ExtendedProxyFileInfo ndr_types_ProxyFileInfo
const PCInterfaceProxyVtblList * pProxyVtblList
Definition: rpcproxy.h:48

Referenced by get_ndr_types_params(), get_type_format_string(), and init_stub_desc().

◆ get_param_info()

static HRESULT get_param_info ( ITypeInfo typeinfo,
TYPEDESC *  tdesc,
int  is_in,
int  is_out,
unsigned short server_size,
unsigned short flags,
unsigned char basetype,
TYPEDESC **  tfs_tdesc 
)
static

Definition at line 598 of file ndr_typelib.c.

601 {
602  ITypeInfo *refinfo;
603  HRESULT hr = S_OK;
604  TYPEATTR *attr;
605 
606  *server_size = 0;
607  *flags = MustSize;
608  *basetype = 0;
609  *tfs_tdesc = tdesc;
610 
611  TRACE("vt %u\n", tdesc->vt);
612 
613  switch (tdesc->vt)
614  {
615  case VT_VARIANT:
616 #if !defined(__i386__) && !defined(__arm__)
617  *flags |= IsSimpleRef | MustFree;
618  break;
619 #endif
620  /* otherwise fall through */
621  case VT_BSTR:
622  case VT_SAFEARRAY:
623  case VT_CY:
624  *flags |= IsByValue | MustFree;
625  break;
626  case VT_UNKNOWN:
627  case VT_DISPATCH:
628  case VT_CARRAY:
629  *flags |= MustFree;
630  break;
631  case VT_PTR:
632  return get_param_pointer_info(typeinfo, tdesc->lptdesc, is_in, is_out,
633  server_size, flags, basetype, tfs_tdesc);
634  case VT_USERDEFINED:
635  ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->hreftype, &refinfo);
636  ITypeInfo_GetTypeAttr(refinfo, &attr);
637 
638  switch (attr->typekind)
639  {
640  case TKIND_ENUM:
641  *flags |= IsBasetype;
642  *basetype = FC_ENUM32;
643  break;
644  case TKIND_RECORD:
645 #if defined(__i386__) || defined(__arm__)
646  *flags |= IsByValue | MustFree;
647 #else
648  if (attr->cbSizeInstance <= 8)
649  *flags |= IsByValue | MustFree;
650  else
651  *flags |= IsSimpleRef | MustFree;
652 #endif
653  break;
654  case TKIND_ALIAS:
655  hr = get_param_info(refinfo, &attr->tdescAlias, is_in, is_out,
656  server_size, flags, basetype, tfs_tdesc);
657  break;
658  default:
659  FIXME("unhandled kind %#x\n", attr->typekind);
660  hr = E_NOTIMPL;
661  break;
662  }
663 
664  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
665  ITypeInfo_Release(refinfo);
666  break;
667  default:
668  if ((*basetype = get_base_type(tdesc->vt)))
669  *flags |= IsBasetype;
670  else
671  {
672  FIXME("unhandled type %u\n", tdesc->vt);
673  return E_NOTIMPL;
674  }
675  break;
676  }
677 
678  return hr;
679 }
static const unsigned short MustSize
Definition: ndr_typelib.c:493
HRESULT hr
Definition: shlfolder.c:183
static const unsigned short IsBasetype
Definition: ndr_typelib.c:498
#define FIXME(fmt,...)
Definition: debug.h:110
static const unsigned short MustFree
Definition: ndr_typelib.c:494
static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
Definition: ndr_typelib.c:598
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: cookie.c:170
GLbitfield flags
Definition: glext.h:7161
__u8 attr
Definition: mkdosfs.c:359
Definition: compat.h:1942
static const unsigned short IsByValue
Definition: ndr_typelib.c:499
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
Definition: ndr_typelib.c:502
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112
static const unsigned short IsSimpleRef
Definition: ndr_typelib.c:500

Referenced by write_param_fs().

◆ get_param_pointer_info()

static HRESULT get_param_pointer_info ( ITypeInfo typeinfo,
TYPEDESC *  tdesc,
int  is_in,
int  is_out,
unsigned short server_size,
unsigned short flags,
unsigned char basetype,
TYPEDESC **  tfs_tdesc 
)
static

Definition at line 502 of file ndr_typelib.c.

505 {
506  ITypeInfo *refinfo;
507  HRESULT hr = S_OK;
508  TYPEATTR *attr;
509 
510  switch (tdesc->vt)
511  {
512  case VT_UNKNOWN:
513  case VT_DISPATCH:
514  *flags |= MustFree;
515  if (is_in && is_out)
516  *server_size = sizeof(void *);
517  break;
518  case VT_PTR:
519  *flags |= MustFree;
520 
521  if (tdesc->lptdesc->vt == VT_USERDEFINED)
522  {
523  ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->lptdesc->hreftype, &refinfo);
524  ITypeInfo_GetTypeAttr(refinfo, &attr);
525 
526  switch (attr->typekind)
527  {
528  case TKIND_INTERFACE:
529  case TKIND_DISPATCH:
530  case TKIND_COCLASS:
531  if (is_in && is_out)
532  *server_size = sizeof(void *);
533  break;
534  default:
535  *server_size = sizeof(void *);
536  }
537 
538  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
539  ITypeInfo_Release(refinfo);
540  }
541  else
542  *server_size = sizeof(void *);
543  break;
544  case VT_CARRAY:
545  *flags |= IsSimpleRef | MustFree;
546  *server_size = type_memsize(typeinfo, tdesc);
547  *tfs_tdesc = tdesc;
548  break;
549  case VT_USERDEFINED:
550  ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->hreftype, &refinfo);
551  ITypeInfo_GetTypeAttr(refinfo, &attr);
552 
553  switch (attr->typekind)
554  {
555  case TKIND_ENUM:
557  if (!is_in && is_out)
558  *server_size = sizeof(void *);
559  *basetype = FC_ENUM32;
560  break;
561  case TKIND_RECORD:
562  *flags |= IsSimpleRef | MustFree;
563  if (!is_in && is_out)
564  *server_size = attr->cbSizeInstance;
565  *tfs_tdesc = tdesc;
566  break;
567  case TKIND_INTERFACE:
568  case TKIND_DISPATCH:
569  case TKIND_COCLASS:
570  *flags |= MustFree;
571  break;
572  case TKIND_ALIAS:
573  hr = get_param_pointer_info(refinfo, &attr->tdescAlias, is_in,
574  is_out, server_size, flags, basetype, tfs_tdesc);
575  break;
576  default:
577  FIXME("unhandled kind %#x\n", attr->typekind);
578  hr = E_NOTIMPL;
579  break;
580  }
581 
582  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
583  ITypeInfo_Release(refinfo);
584  break;
585  default:
586  *flags |= IsSimpleRef;
587  *tfs_tdesc = tdesc;
588  if (!is_in && is_out)
589  *server_size = type_memsize(typeinfo, tdesc);
590  if ((*basetype = get_base_type(tdesc->vt)))
591  *flags |= IsBasetype;
592  break;
593  }
594 
595  return hr;
596 }
HRESULT hr
Definition: shlfolder.c:183
static const unsigned short IsBasetype
Definition: ndr_typelib.c:498
#define FIXME(fmt,...)
Definition: debug.h:110
static const unsigned short MustFree
Definition: ndr_typelib.c:494
LONG HRESULT
Definition: typedefs.h:77
Definition: cookie.c:170
GLbitfield flags
Definition: glext.h:7161
__u8 attr
Definition: mkdosfs.c:359
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:136
static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
Definition: ndr_typelib.c:502
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112
static const unsigned short IsSimpleRef
Definition: ndr_typelib.c:500

Referenced by get_param_info().

◆ get_stack_size()

static unsigned short get_stack_size ( ITypeInfo typeinfo,
TYPEDESC *  desc 
)
static

Definition at line 482 of file ndr_typelib.c.

483 {
484 #if defined(__i386__) || defined(__arm__)
485  if (desc->vt == VT_CARRAY)
486  return sizeof(void *);
487  return (type_memsize(typeinfo, desc) + 3) & ~3;
488 #else
489  return sizeof(void *);
490 #endif
491 }
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:136

Referenced by write_param_fs(), and write_proc_func_header().

◆ get_struct_fc()

static unsigned char get_struct_fc ( ITypeInfo typeinfo,
TYPEATTR *  attr 
)
static

Definition at line 197 of file ndr_typelib.c.

198 {
199  unsigned char fc = FC_STRUCT;
200  VARDESC *desc;
201  VARTYPE vt;
202  WORD i;
203 
204  for (i = 0; i < attr->cVars; i++)
205  {
206  ITypeInfo_GetVarDesc(typeinfo, i, &desc);
207  vt = desc->elemdescVar.tdesc.vt;
208 
209  switch (vt)
210  {
211  case VT_CARRAY:
212  if (get_array_fc(typeinfo, &desc->elemdescVar.tdesc.lpadesc->tdescElem) == FC_BOGUS_ARRAY)
214  break;
215  default:
216  if (!get_base_type(vt))
217  {
218  FIXME("unhandled type %u\n", vt);
220  }
221  break;
222  }
223 
224  ITypeInfo_ReleaseVarDesc(typeinfo, desc);
225  }
226 
227  return fc;
228 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
unsigned short WORD
Definition: ntddk_ex.h:93
LPFOR_CONTEXT fc
Definition: for.c:53
Definition: cookie.c:170
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
unsigned short VARTYPE
Definition: compat.h:1895
static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:230
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112

Referenced by free_variable(), get_array_fc(), and write_struct_tfs().

◆ get_tfs_offset()

static unsigned short get_tfs_offset ( int  param)
static

Definition at line 81 of file ndr_typelib.c.

82 {
83  unsigned int nb_params;
84  const NDR_PARAM_OIF *params = get_ndr_types_params( &nb_params );
85 
86  assert( param < nb_params );
87  return params[param].u.type_offset;
88 }
#define assert(x)
Definition: debug.h:53
static const NDR_PARAM_OIF * get_ndr_types_params(unsigned int *nb_params)
Definition: ndr_typelib.c:58
GLenum const GLfloat * params
Definition: glext.h:5645
GLfloat param
Definition: glext.h:5796

Referenced by write_oleaut_tfs().

◆ get_type_format_string()

static const unsigned char* get_type_format_string ( size_t size)
static

Definition at line 90 of file ndr_typelib.c.

91 {
92  unsigned int nb_params;
93  const NDR_PARAM_OIF *params = get_ndr_types_params( &nb_params );
94 
95  *size = params[nb_params - 1].u.type_offset;
97 }
static const NDR_PARAM_OIF * get_ndr_types_params(unsigned int *nb_params)
Definition: ndr_typelib.c:58
GLenum const GLfloat * params
Definition: glext.h:5645
GLsizeiptr size
Definition: glext.h:5919
const unsigned char * pFormatTypes
Definition: rpcndr.h:374
static const MIDL_STUBLESS_PROXY_INFO * get_ndr_types_proxy_info(void)
Definition: ndr_typelib.c:53
PMIDL_STUB_DESC pStubDesc
Definition: rpcndr.h:433

Referenced by build_format_strings().

◆ init_stub_desc()

static void init_stub_desc ( MIDL_STUB_DESC desc)
static

Definition at line 930 of file ndr_typelib.c.

931 {
932  desc->pfnAllocate = NdrOleAllocate;
933  desc->pfnFree = NdrOleFree;
934  desc->Version = 0x50002;
935  desc->aUserMarshalQuadruple = get_ndr_types_proxy_info()->pStubDesc->aUserMarshalQuadruple;
936  /* type format string is initialized with proc format string and offset table */
937 }
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
void *WINAPI NdrOleAllocate(SIZE_T Size)
Definition: ndr_ole.c:423
static const MIDL_STUBLESS_PROXY_INFO * get_ndr_types_proxy_info(void)
Definition: ndr_typelib.c:53
void WINAPI NdrOleFree(void *NodeToFree)
Definition: ndr_ole.c:432
PMIDL_STUB_DESC pStubDesc
Definition: rpcndr.h:433
const USER_MARSHAL_ROUTINE_QUADRUPLE * aUserMarshalQuadruple
Definition: rpcndr.h:380

Referenced by CreateProxyFromTypeInfo(), and CreateStubFromTypeInfo().

◆ type_memsize()

static unsigned int type_memsize ( ITypeInfo typeinfo,
TYPEDESC *  desc 
)
static

Definition at line 136 of file ndr_typelib.c.

137 {
138  switch (desc->vt)
139  {
140  case VT_I1:
141  case VT_UI1:
142  return 1;
143  case VT_I2:
144  case VT_UI2:
145  case VT_BOOL:
146  return 2;
147  case VT_I4:
148  case VT_UI4:
149  case VT_R4:
150  case VT_INT:
151  case VT_UINT:
152  case VT_ERROR:
153  case VT_HRESULT:
154  return 4;
155  case VT_I8:
156  case VT_UI8:
157  case VT_R8:
158  case VT_DATE:
159  return 8;
160  case VT_BSTR:
161  case VT_SAFEARRAY:
162  case VT_PTR:
163  case VT_UNKNOWN:
164  case VT_DISPATCH:
165  return sizeof(void *);
166  case VT_VARIANT:
167  return sizeof(VARIANT);
168  case VT_CARRAY:
169  {
170  unsigned int size = type_memsize(typeinfo, &desc->lpadesc->tdescElem);
171  unsigned int i;
172  for (i = 0; i < desc->lpadesc->cDims; i++)
173  size *= desc->lpadesc->rgbounds[i].cElements;
174  return size;
175  }
176  case VT_USERDEFINED:
177  {
178  unsigned int size = 0;
179  ITypeInfo *refinfo;
180  TYPEATTR *attr;
181 
182  ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
183  ITypeInfo_GetTypeAttr(refinfo, &attr);
184  size = attr->cbSizeInstance;
185  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
186  ITypeInfo_Release(refinfo);
187  return size;
188  }
189  default:
190  FIXME("unhandled type %u\n", desc->vt);
191  return 0;
192  }
193 }
struct tagVARIANT VARIANT
Definition: compat.h:2018
Definition: compat.h:1939
Definition: compat.h:1955
Definition: compat.h:1951
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
GLsizeiptr size
Definition: glext.h:5919
Definition: cookie.c:170
Definition: compat.h:1940
__u8 attr
Definition: mkdosfs.c:359
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:136
Definition: compat.h:1941
Definition: compat.h:1938

Referenced by get_param_pointer_info(), get_stack_size(), is_ptr_guid_type(), make_exprt(), and write_array_tfs().

◆ typelib_proxy_init()

static HRESULT typelib_proxy_init ( struct typelib_proxy proxy,
IUnknown outer,
ULONG  count,
const GUID parentiid,
IRpcProxyBuffer **  proxy_buffer,
void **  out 
)
static

Definition at line 982 of file ndr_typelib.c.

984 {
985  if (!fill_stubless_table((IUnknownVtbl *)proxy->proxy_vtbl->Vtbl, count))
986  return E_OUTOFMEMORY;
987 
988  if (!outer) outer = (IUnknown *)&proxy->proxy;
989 
990  proxy->proxy.IRpcProxyBuffer_iface.lpVtbl = &typelib_proxy_vtbl;
991  proxy->proxy.PVtbl = proxy->proxy_vtbl->Vtbl;
992  proxy->proxy.RefCount = 1;
993  proxy->proxy.piid = proxy->proxy_vtbl->header.piid;
994  proxy->proxy.pUnkOuter = outer;
995 
996  if (!IsEqualGUID(parentiid, &IID_IUnknown))
997  {
998  HRESULT hr = create_proxy(parentiid, NULL, &proxy->proxy.base_proxy,
999  (void **)&proxy->proxy.base_object);
1000  if (FAILED(hr)) return hr;
1001  }
1002 
1003  *proxy_buffer = &proxy->proxy.IRpcProxyBuffer_iface;
1004  *out = &proxy->proxy.PVtbl;
1005  IUnknown_AddRef((IUnknown *)*out);
1006 
1007  return S_OK;
1008 }
int proxy
Definition: main.c:67
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cproxy.c:241
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
static const IRpcProxyBufferVtbl typelib_proxy_vtbl
Definition: ndr_typelib.c:973
#define S_OK
Definition: intsafe.h:59
HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN
Definition: ndr_ole.c:442
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

Referenced by CreateProxyFromTypeInfo().

◆ typelib_proxy_Release()

static ULONG WINAPI typelib_proxy_Release ( IRpcProxyBuffer iface)
static

Definition at line 949 of file ndr_typelib.c.

950 {
951  struct typelib_proxy *proxy = CONTAINING_RECORD(iface, struct typelib_proxy, proxy.IRpcProxyBuffer_iface);
952  ULONG refcount = InterlockedDecrement(&proxy->proxy.RefCount);
953 
954  TRACE("(%p) decreasing refs to %d\n", proxy, refcount);
955 
956  if (!refcount)
957  {
958  if (proxy->proxy.pChannel)
959  IRpcProxyBuffer_Disconnect(&proxy->proxy.IRpcProxyBuffer_iface);
960  if (proxy->proxy.base_object)
961  IUnknown_Release(proxy->proxy.base_object);
962  if (proxy->proxy.base_proxy)
963  IRpcProxyBuffer_Release(proxy->proxy.base_proxy);
964  heap_free((void *)proxy->stub_desc.pFormatTypes);
965  heap_free((void *)proxy->proxy_info.ProcFormatString);
966  heap_free(proxy->offset_table);
967  heap_free(proxy->proxy_vtbl);
968  heap_free(proxy);
969  }
970  return refcount;
971 }
int proxy
Definition: main.c:67
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ typelib_stub_init()

static HRESULT typelib_stub_init ( struct typelib_stub stub,
IUnknown server,
const GUID parentiid,
IRpcStubBuffer **  stub_buffer 
)
static

Definition at line 1111 of file ndr_typelib.c.

1113 {
1114  HRESULT hr;
1115 
1116  hr = IUnknown_QueryInterface(server, stub->stub_vtbl.header.piid,
1117  (void **)&stub->stub.stub_buffer.pvServerObject);
1118  if (FAILED(hr))
1119  {
1120  WARN("Failed to get interface %s, hr %#x.\n",
1121  debugstr_guid(stub->stub_vtbl.header.piid), hr);
1122  stub->stub.stub_buffer.pvServerObject = server;
1123  IUnknown_AddRef(server);
1124  }
1125 
1126  if (!IsEqualGUID(parentiid, &IID_IUnknown))
1127  {
1128  stub->stub.base_obj = get_delegating_vtbl(stub->stub_vtbl.header.DispatchTableCount);
1129  hr = create_stub(parentiid, (IUnknown *)&stub->stub.base_obj, &stub->stub.base_stub);
1130  if (FAILED(hr))
1131  {
1132  release_delegating_vtbl(stub->stub.base_obj);
1133  IUnknown_Release(stub->stub.stub_buffer.pvServerObject);
1134  return hr;
1135  }
1136  }
1137 
1138  stub->stub.stub_buffer.lpVtbl = &stub->stub_vtbl.Vtbl;
1139  stub->stub.stub_buffer.RefCount = 1;
1140 
1141  *stub_buffer = (IRpcStubBuffer *)&stub->stub.stub_buffer;
1142  return S_OK;
1143 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
Definition: stubgen.c:11
IUnknownVtbl * get_delegating_vtbl(DWORD num_methods) DECLSPEC_HIDDEN
Definition: cstub.c:275
#define debugstr_guid
Definition: kernel32.h:35
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
void release_delegating_vtbl(IUnknownVtbl *vtbl) DECLSPEC_HIDDEN
Definition: cstub.c:311
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN
Definition: ndr_ole.c:466

Referenced by CreateStubFromTypeInfo().

◆ typelib_stub_Release()

static ULONG WINAPI typelib_stub_Release ( IRpcStubBuffer iface)
static

Definition at line 1082 of file ndr_typelib.c.

1083 {
1084  struct typelib_stub *stub = CONTAINING_RECORD(iface, struct typelib_stub, stub.stub_buffer);
1085  ULONG refcount = InterlockedDecrement(&stub->stub.stub_buffer.RefCount);
1086 
1087  TRACE("(%p) decreasing refs to %d\n", stub, refcount);
1088 
1089  if (!refcount)
1090  {
1091  /* test_Release shows that native doesn't call Disconnect here.
1092  We'll leave it in for the time being. */
1093  IRpcStubBuffer_Disconnect(iface);
1094 
1095  if (stub->stub.base_stub)
1096  {
1097  IRpcStubBuffer_Release(stub->stub.base_stub);
1098  release_delegating_vtbl(stub->stub.base_obj);
1099  heap_free(stub->dispatch_table);
1100  }
1101 
1102  heap_free((void *)stub->stub_desc.pFormatTypes);
1103  heap_free((void *)stub->server_info.ProcString);
1104  heap_free(stub->offset_table);
1105  heap_free(stub);
1106  }
1107 
1108  return refcount;
1109 }
Definition: stubgen.c:11
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
void release_delegating_vtbl(IUnknownVtbl *vtbl) DECLSPEC_HIDDEN
Definition: cstub.c:311
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by CreateStubFromTypeInfo().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

◆ write_array_tfs()

static size_t write_array_tfs ( ITypeInfo typeinfo,
unsigned char str,
size_t len,
ARRAYDESC *  desc 
)
static

Definition at line 277 of file ndr_typelib.c.

279 {
280  unsigned char fc = get_array_fc(typeinfo, &desc->tdescElem);
281  ULONG size = type_memsize(typeinfo, &desc->tdescElem);
282  unsigned char basetype;
283  size_t ref = 0, off;
284  USHORT i;
285 
286  if (fc != FC_LGFARRAY)
287  FIXME("complex arrays not implemented\n");
288 
289  if (!(basetype = get_base_type(desc->tdescElem.vt)))
290  ref = write_type_tfs(typeinfo, str, len, &desc->tdescElem, FALSE, FALSE);
291 
292  /* In theory arrays should be nested, but there's no reason not to marshal
293  * [x][y] as [x*y]. */
294  for (i = 0; i < desc->cDims; i++) size *= desc->rgbounds[i].cElements;
295 
296  off = *len;
297 
299  WRITE_CHAR(str, *len, 0);
300  WRITE_INT (str, *len, size);
301  if (basetype)
302  WRITE_CHAR(str, *len, basetype);
303  else
304  {
306  WRITE_CHAR (str, *len, 0);
307  WRITE_SHORT(str, *len, ref - *len);
308  WRITE_CHAR (str, *len, FC_PAD);
309  }
310  WRITE_CHAR(str, *len, FC_END);
311 
312  return off;
313 }
static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
Definition: ndr_typelib.c:433
#define WRITE_CHAR(str, len, val)
Definition: ndr_typelib.c:44
Definition: send.c:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
GLsizeiptr size
Definition: glext.h:5919
LPFOR_CONTEXT fc
Definition: for.c:53
GLenum GLsizei len
Definition: glext.h:6722
unsigned short USHORT
Definition: pedump.c:61
#define WRITE_INT(str, len, val)
Definition: ndr_typelib.c:48
static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:136
static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:230
unsigned int ULONG
Definition: retypes.h:1
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112
off
Definition: i386-dis.c:3909

Referenced by write_type_tfs().

◆ write_iface_fs()

static HRESULT write_iface_fs ( ITypeInfo typeinfo,
WORD  funcs,
WORD  parentfuncs,
unsigned char type,
size_t typelen,
unsigned char proc,
size_t proclen,
unsigned short offset 
)
static

Definition at line 765 of file ndr_typelib.c.

768 {
769  unsigned short stack_offset;
770  WORD proc_idx, param_idx;
771  FUNCDESC *desc;
772  HRESULT hr;
773 
774  for (proc_idx = 3; proc_idx < parentfuncs; proc_idx++)
775  {
776  if (offset)
777  offset[proc_idx - 3] = -1;
778  }
779 
780  for (proc_idx = 0; proc_idx < funcs; proc_idx++)
781  {
782  TRACE("Writing procedure %d.\n", proc_idx);
783 
784  hr = ITypeInfo_GetFuncDesc(typeinfo, proc_idx, &desc);
785  if (FAILED(hr)) return hr;
786 
787  if (offset)
788  offset[proc_idx + parentfuncs - 3] = *proclen;
789 
790  write_proc_func_header(typeinfo, desc, proc_idx + parentfuncs, proc, proclen);
791 
792  stack_offset = sizeof(void *); /* This */
793  for (param_idx = 0; param_idx < desc->cParams; param_idx++)
794  {
795  TRACE("Writing parameter %d.\n", param_idx);
796  hr = write_param_fs(typeinfo, type, typelen, proc, proclen,
797  &desc->lprgelemdescParam[param_idx], FALSE, &stack_offset);
798  if (FAILED(hr))
799  {
800  ITypeInfo_ReleaseFuncDesc(typeinfo, desc);
801  return hr;
802  }
803  }
804 
805  hr = write_param_fs(typeinfo, type, typelen, proc, proclen,
806  &desc->elemdescFunc, TRUE, &stack_offset);
807  ITypeInfo_ReleaseFuncDesc(typeinfo, desc);
808  if (FAILED(hr)) return hr;
809  }
810 
811  return S_OK;
812 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static HRESULT write_param_fs(ITypeInfo *typeinfo, unsigned char *type, size_t *typelen, unsigned char *proc, size_t *proclen, ELEMDESC *desc, BOOL is_return, unsigned short *stack_offset)
Definition: ndr_typelib.c:681
GLintptr offset
Definition: glext.h:5920
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HANDLE proc()
Definition: pdb.c:32
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define TRACE(s)
Definition: solgame.cpp:4
static unsigned stack_offset(compile_ctx_t *ctx)
Definition: compile.c:349
LONG HRESULT
Definition: typedefs.h:77
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned short WORD
Definition: ntddk_ex.h:93
#define S_OK
Definition: intsafe.h:59
static void write_proc_func_header(ITypeInfo *typeinfo, FUNCDESC *desc, WORD proc_idx, unsigned char *proc, size_t *proclen)
Definition: ndr_typelib.c:722

Referenced by build_format_strings().

◆ write_ip_tfs()

static size_t write_ip_tfs ( unsigned char str,
size_t len,
const GUID iid 
)
static

Definition at line 315 of file ndr_typelib.c.

316 {
317  size_t off = *len;
318 
319  if (str)
320  {
321  str[*len] = FC_IP;
322  str[*len+1] = FC_CONSTANT_IID;
323  memcpy(str + *len + 2, iid, sizeof(*iid));
324  }
325  *len += 2 + sizeof(*iid);
326 
327  return off;
328 }
const WCHAR * str
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
off
Definition: i386-dis.c:3909

Referenced by write_pointer_tfs().

◆ write_oleaut_tfs()

static unsigned short write_oleaut_tfs ( VARTYPE  vt)
static

Definition at line 99 of file ndr_typelib.c.

100 {
101  switch (vt)
102  {
103  case VT_BSTR: return get_tfs_offset( 0 );
104  case VT_UNKNOWN: return get_tfs_offset( 1 );
105  case VT_DISPATCH: return get_tfs_offset( 2 );
106  case VT_VARIANT: return get_tfs_offset( 3 );
107  case VT_SAFEARRAY: return get_tfs_offset( 4 );
108  }
109  return 0;
110 }
static unsigned short get_tfs_offset(int param)
Definition: ndr_typelib.c:81
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85

Referenced by write_type_tfs().

◆ write_param_fs()

static HRESULT write_param_fs ( ITypeInfo typeinfo,
unsigned char type,
size_t typelen,
unsigned char proc,
size_t proclen,
ELEMDESC *  desc,
BOOL  is_return,
unsigned short stack_offset 
)
static

Definition at line 681 of file ndr_typelib.c.

684 {
685  USHORT param_flags = desc->paramdesc.wParamFlags;
686  int is_in = param_flags & PARAMFLAG_FIN;
687  int is_out = param_flags & PARAMFLAG_FOUT;
688  TYPEDESC *tdesc = &desc->tdesc, *tfs_tdesc;
689  unsigned short server_size;
690  unsigned short stack_size = get_stack_size(typeinfo, tdesc);
691  unsigned char basetype;
692  unsigned short flags;
693  size_t off = 0;
694  HRESULT hr;
695 
696  hr = get_param_info(typeinfo, tdesc, is_in, is_out, &server_size, &flags,
697  &basetype, &tfs_tdesc);
698 
699  if (is_in) flags |= IsIn;
700  if (is_out) flags |= IsOut;
701  if (is_return) flags |= IsOut | IsReturn;
702 
703  server_size = (server_size + 7) / 8;
704  if (server_size >= 8) server_size = 0;
705  flags |= server_size << 13;
706 
707  if (!basetype)
708  off = write_type_tfs(typeinfo, type, typelen, tfs_tdesc, TRUE, server_size != 0);
709 
710  if (SUCCEEDED(hr))
711  {
712  WRITE_SHORT(proc, *proclen, flags);
713  WRITE_SHORT(proc, *proclen, *stack_offset);
714  WRITE_SHORT(proc, *proclen, basetype ? basetype : off);
715 
716  *stack_offset += stack_size;
717  }
718 
719  return hr;
720 }
#define TRUE
Definition: types.h:120
static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
Definition: ndr_typelib.c:433
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HANDLE proc()
Definition: pdb.c:32
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in, int is_out, unsigned short *server_size, unsigned short *flags, unsigned char *basetype, TYPEDESC **tfs_tdesc)
Definition: ndr_typelib.c:598
static unsigned stack_offset(compile_ctx_t *ctx)
Definition: compile.c:349
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
static const unsigned short IsReturn
Definition: ndr_typelib.c:497
unsigned short USHORT
Definition: pedump.c:61
static const unsigned short IsIn
Definition: ndr_typelib.c:495
static const unsigned short IsOut
Definition: ndr_typelib.c:496
static unsigned short get_stack_size(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:482
#define SUCCEEDED(hr)
Definition: intsafe.h:57
off
Definition: i386-dis.c:3909

Referenced by write_iface_fs().

◆ write_pointer_tfs()

static size_t write_pointer_tfs ( ITypeInfo typeinfo,
unsigned char str,
size_t len,
TYPEDESC *  desc,
BOOL  toplevel,
BOOL  onstack 
)
static

Definition at line 356 of file ndr_typelib.c.

358 {
359  unsigned char basetype, flags = 0;
360  size_t ref, off = *len;
361  ITypeInfo *refinfo;
362  TYPEATTR *attr;
363  GUID guid;
364 
365  if (desc->vt == VT_USERDEFINED)
366  {
367  ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
368  ITypeInfo_GetTypeAttr(refinfo, &attr);
369 
370  switch (attr->typekind)
371  {
372  case TKIND_ENUM:
373  assert(!toplevel); /* toplevel base-type pointers should use IsSimpleRef */
374  WRITE_CHAR(str, *len, FC_UP);
377  WRITE_CHAR(str, *len, FC_PAD);
378  break;
379  case TKIND_RECORD:
380  assert(!toplevel); /* toplevel struct pointers should use IsSimpleRef */
381  ref = write_struct_tfs(refinfo, str, len, attr);
382  off = *len;
383  WRITE_CHAR (str, *len, FC_UP);
384  WRITE_CHAR (str, *len, 0);
385  WRITE_SHORT(str, *len, ref - *len);
386  break;
387  case TKIND_INTERFACE:
388  case TKIND_DISPATCH:
389  write_ip_tfs(str, len, &attr->guid);
390  break;
391  case TKIND_COCLASS:
392  get_default_iface(refinfo, attr->cImplTypes, &guid);
393  write_ip_tfs(str, len, &guid);
394  break;
395  case TKIND_ALIAS:
396  off = write_pointer_tfs(refinfo, str, len, &attr->tdescAlias, toplevel, onstack);
397  break;
398  default:
399  FIXME("unhandled kind %#x\n", attr->typekind);
400  WRITE_SHORT(str, *len, 0);
401  break;
402  }
403 
404  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
405  ITypeInfo_Release(refinfo);
406  }
407  else if ((basetype = get_base_type(desc->vt)))
408  {
409  assert(!toplevel); /* toplevel base-type pointers should use IsSimpleRef */
410  WRITE_CHAR(str, *len, FC_UP);
412  WRITE_CHAR(str, *len, basetype);
413  WRITE_CHAR(str, *len, FC_PAD);
414  }
415  else
416  {
418 
419  if (onstack) flags |= FC_ALLOCED_ON_STACK;
420  if (desc->vt == VT_PTR || desc->vt == VT_UNKNOWN || desc->vt == VT_DISPATCH)
422 
423  off = *len;
424 
426  WRITE_CHAR (str, *len, flags);
427  WRITE_SHORT(str, *len, ref - *len);
428  }
429 
430  return off;
431 }
#define FC_POINTER_DEREF
Definition: ndrtypes.h:276
static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
Definition: ndr_typelib.c:433
#define assert(x)
Definition: debug.h:53
#define WRITE_CHAR(str, len, val)
Definition: ndr_typelib.c:44
Definition: send.c:47
const GUID * guid
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
jmp_buf toplevel
Definition: main.c:95
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
#define FC_ALLOCED_ON_STACK
Definition: ndrtypes.h:274
static size_t write_pointer_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
Definition: ndr_typelib.c:356
static void get_default_iface(ITypeInfo *typeinfo, WORD count, GUID *iid)
Definition: ndr_typelib.c:330
Definition: cookie.c:170
GLbitfield flags
Definition: glext.h:7161
#define FC_SIMPLE_POINTER
Definition: ndrtypes.h:275
__u8 attr
Definition: mkdosfs.c:359
GLenum GLsizei len
Definition: glext.h:6722
static size_t write_ip_tfs(unsigned char *str, size_t *len, const GUID *iid)
Definition: ndr_typelib.c:315
static size_t write_struct_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEATTR *attr)
Definition: ndr_typelib.c:259
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112
off
Definition: i386-dis.c:3909

Referenced by write_type_tfs().

◆ write_proc_func_header()

static void write_proc_func_header ( ITypeInfo typeinfo,
FUNCDESC *  desc,
WORD  proc_idx,
unsigned char proc,
size_t proclen 
)
static

Definition at line 722 of file ndr_typelib.c.

724 {
725  unsigned short stack_size = 2 * sizeof(void *); /* This + return */
726 #ifdef __x86_64__
727  unsigned short float_mask = 0;
728  unsigned char basetype;
729 #endif
730  WORD param_idx;
731 
732  WRITE_CHAR (proc, *proclen, FC_AUTO_HANDLE);
734  WRITE_SHORT(proc, *proclen, proc_idx);
735  for (param_idx = 0; param_idx < desc->cParams; param_idx++)
736  stack_size += get_stack_size(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);
737  WRITE_SHORT(proc, *proclen, stack_size);
738 
739  WRITE_SHORT(proc, *proclen, 0); /* constant_client_buffer_size */
740  WRITE_SHORT(proc, *proclen, 0); /* constant_server_buffer_size */
741 #ifdef __x86_64__
742  WRITE_CHAR (proc, *proclen, 0x47); /* HasExtensions | HasReturn | ClientMustSize | ServerMustSize */
743 #else
744  WRITE_CHAR (proc, *proclen, 0x07); /* HasReturn | ClientMustSize | ServerMustSize */
745 #endif
746  WRITE_CHAR (proc, *proclen, desc->cParams + 1); /* incl. return value */
747 #ifdef __x86_64__
748  WRITE_CHAR (proc, *proclen, 10); /* extension size */
749  WRITE_CHAR (proc, *proclen, 0); /* INTERPRETER_OPT_FLAGS2 */
750  WRITE_SHORT(proc, *proclen, 0); /* ClientCorrHint */
751  WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
752  WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
753  for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++)
754  {
755  basetype = get_base_type(desc->lprgelemdescParam[param_idx].tdesc.vt);
756  if (basetype == FC_FLOAT)
757  float_mask |= (1 << ((param_idx + 1) * 2));
758  else if (basetype == FC_DOUBLE)
759  float_mask |= (2 << ((param_idx + 1) * 2));
760  }
761  WRITE_SHORT(proc, *proclen, float_mask);
762 #endif
763 }
static HANDLE proc()
Definition: pdb.c:32
#define WRITE_CHAR(str, len, val)
Definition: ndr_typelib.c:44
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
unsigned short WORD
Definition: ntddk_ex.h:93
#define Oi_OBJ_USE_V2_INTERPRETER
Definition: ndrtypes.h:294
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
static unsigned short get_stack_size(ITypeInfo *typeinfo, TYPEDESC *desc)
Definition: ndr_typelib.c:482
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112

Referenced by write_iface_fs().

◆ write_struct_tfs()

static size_t write_struct_tfs ( ITypeInfo typeinfo,
unsigned char str,
size_t len,
TYPEATTR *  attr 
)
static

Definition at line 259 of file ndr_typelib.c.

261 {
262  unsigned char fc = get_struct_fc(typeinfo, attr);
263  size_t off = *len;
264 
265  if (fc != FC_STRUCT)
266  FIXME("fc %02x not implemented\n", fc);
267 
269  WRITE_CHAR (str, *len, attr->cbAlignment - 1);
270  WRITE_SHORT(str, *len, attr->cbSizeInstance);
271  WRITE_CHAR (str, *len, FC_PAD);
272  WRITE_CHAR (str, *len, FC_END);
273 
274  return off;
275 }
#define WRITE_CHAR(str, len, val)
Definition: ndr_typelib.c:44
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
LPFOR_CONTEXT fc
Definition: for.c:53
Definition: cookie.c:170
GLenum GLsizei len
Definition: glext.h:6722
static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr)
Definition: ndr_typelib.c:197
off
Definition: i386-dis.c:3909

Referenced by write_pointer_tfs(), and write_type_tfs().

◆ write_type_tfs()

static size_t write_type_tfs ( ITypeInfo typeinfo,
unsigned char str,
size_t len,
TYPEDESC *  desc,
BOOL  toplevel,
BOOL  onstack 
)
static

Definition at line 433 of file ndr_typelib.c.

435 {
436  ITypeInfo *refinfo;
437  TYPEATTR *attr;
438  size_t off;
439 
440  TRACE("vt %d%s\n", desc->vt, toplevel ? " (toplevel)" : "");
441 
442  if ((off = write_oleaut_tfs(desc->vt)))
443  return off;
444 
445  switch (desc->vt)
446  {
447  case VT_PTR:
448  return write_pointer_tfs(typeinfo, str, len, desc->lptdesc, toplevel, onstack);
449  case VT_CARRAY:
450  return write_array_tfs(typeinfo, str, len, desc->lpadesc);
451  case VT_USERDEFINED:
452  ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
453  ITypeInfo_GetTypeAttr(refinfo, &attr);
454 
455  switch (attr->typekind)
456  {
457  case TKIND_RECORD:
458  off = write_struct_tfs(refinfo, str, len, attr);
459  break;
460  default:
461  FIXME("unhandled kind %u\n", attr->typekind);
462  off = *len;
463  WRITE_SHORT(str, *len, 0);
464  break;
465  }
466 
467  ITypeInfo_ReleaseTypeAttr(refinfo, attr);
468  ITypeInfo_Release(refinfo);
469  break;
470  default:
471  /* base types are always embedded directly */
472  assert(!get_base_type(desc->vt));
473  FIXME("unhandled type %u\n", desc->vt);
474  off = *len;
475  WRITE_SHORT(str, *len, 0);
476  break;
477  }
478 
479  return off;
480 }
static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, ARRAYDESC *desc)
Definition: ndr_typelib.c:277
#define assert(x)
Definition: debug.h:53
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
jmp_buf toplevel
Definition: main.c:95
#define WRITE_SHORT(str, len, val)
Definition: ndr_typelib.c:46
static size_t write_pointer_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEDESC *desc, BOOL toplevel, BOOL onstack)
Definition: ndr_typelib.c:356
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
GLenum GLsizei len
Definition: glext.h:6722
static unsigned short write_oleaut_tfs(VARTYPE vt)
Definition: ndr_typelib.c:99
static size_t write_struct_tfs(ITypeInfo *typeinfo, unsigned char *str, size_t *len, TYPEATTR *attr)
Definition: ndr_typelib.c:259
static unsigned char get_base_type(VARTYPE vt)
Definition: ndr_typelib.c:112
off
Definition: i386-dis.c:3909

Referenced by write_array_tfs(), write_param_fs(), and write_pointer_tfs().

Variable Documentation

◆ IsBasetype

const unsigned short IsBasetype = 0x0040
static

Definition at line 498 of file ndr_typelib.c.

Referenced by get_param_info(), and get_param_pointer_info().

◆ IsByValue

const unsigned short IsByValue = 0x0080
static

Definition at line 499 of file ndr_typelib.c.

Referenced by get_param_info().

◆ IsIn

const unsigned short IsIn = 0x0008
static

Definition at line 495 of file ndr_typelib.c.

Referenced by write_param_fs().

◆ IsOut

const unsigned short IsOut = 0x0010
static

Definition at line 496 of file ndr_typelib.c.

Referenced by write_param_fs().

◆ IsReturn

const unsigned short IsReturn = 0x0020
static

Definition at line 497 of file ndr_typelib.c.

Referenced by write_param_fs().

◆ IsSimpleRef

const unsigned short IsSimpleRef = 0x0100
static

Definition at line 500 of file ndr_typelib.c.

Referenced by get_param_info(), and get_param_pointer_info().

◆ MustFree

const unsigned short MustFree = 0x0002
static

Definition at line 494 of file ndr_typelib.c.

Referenced by get_param_info(), and get_param_pointer_info().

◆ MustSize

const unsigned short MustSize = 0x0001
static

Definition at line 493 of file ndr_typelib.c.

Referenced by get_param_info().

◆ ndr_types_ProxyFileInfo

const ExtendedProxyFileInfo ndr_types_ProxyFileInfo

◆ typelib_proxy_vtbl

const IRpcProxyBufferVtbl typelib_proxy_vtbl
static
Initial value:
=
{
}
void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface)
Definition: cproxy.c:387
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface)
Definition: cproxy.c:346
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel)
Definition: cproxy.c:376
static ULONG WINAPI typelib_proxy_Release(IRpcProxyBuffer *iface)
Definition: ndr_typelib.c:949
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID riid, void **obj)
Definition: cproxy.c:325

Definition at line 973 of file ndr_typelib.c.

Referenced by typelib_proxy_init().