ReactOS  0.4.15-dev-1203-g0e5a4d5
ndr_stubless.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "objbase.h"
#include "rpc.h"
#include "rpcproxy.h"
#include "wine/exception.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "cpsf.h"
#include "ndr_misc.h"
#include "ndr_stubless.h"
Include dependency graph for ndr_stubless.c:

Go to the source code of this file.

Classes

struct  ndr_client_call_ctx
 

Macros

#define NDR_TABLE_MASK   127
 
#define ARG_FROM_OFFSET(args, offset)   ((args) + (offset))
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (rpc)
 
static BOOL is_oicf_stubdesc (const PMIDL_STUB_DESC pStubDesc)
 
static void call_buffer_sizer (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
 
static unsigned charcall_marshaller (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
 
static unsigned charcall_unmarshaller (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, const NDR_PARAM_OIF *param, unsigned char fMustAlloc)
 
static void call_freer (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
 
static DWORD calc_arg_size (MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrRpcSmSetClientToOsf (PMIDL_STUB_MESSAGE pMessage)
 
static const chardebugstr_PROC_PF (PARAM_ATTRIBUTES param_attributes)
 
static const chardebugstr_INTERPRETER_OPT_FLAGS (INTERPRETER_OPT_FLAGS Oi2Flags)
 
static size_t get_handle_desc_size (const NDR_PROC_HEADER *proc_header, PFORMAT_STRING format)
 
static handle_t client_get_handle (const MIDL_STUB_MESSAGE *pStubMsg, const NDR_PROC_HEADER *pProcHeader, const PFORMAT_STRING pFormat)
 
static void client_free_handle (PMIDL_STUB_MESSAGE pStubMsg, const NDR_PROC_HEADER *pProcHeader, PFORMAT_STRING pFormat, handle_t hBinding)
 
static BOOL param_needs_alloc (PARAM_ATTRIBUTES attr)
 
static BOOL param_is_out_basetype (PARAM_ATTRIBUTES attr)
 
static size_t basetype_arg_size (unsigned char fc)
 
void client_do_args (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal)
 
static unsigned int type_stack_size (unsigned char fc)
 
static BOOL is_by_value (PFORMAT_STRING format)
 
PFORMAT_STRING convert_old_args (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned int stack_size, BOOL object_proc, void *buffer, unsigned int size, unsigned int *count)
 
static void CALLBACK ndr_client_call_finally (BOOL normal, void *arg)
 
static LONG_PTR do_ndr_client_call (const MIDL_STUB_DESC *stub_desc, const PFORMAT_STRING format, const PFORMAT_STRING handle_format, void **stack_top, void **fpu_stack, MIDL_STUB_MESSAGE *stub_msg, unsigned short procedure_number, unsigned short stack_size, unsigned int number_of_params, INTERPRETER_OPT_FLAGS Oif_flags, INTERPRETER_OPT_FLAGS2 ext_flags, const NDR_PROC_HEADER *proc_header)
 
LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call (PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top, void **fpu_stack)
 
CLIENT_CALL_RETURN WINAPIV NdrClientCall2 (PMIDL_STUB_DESC desc, PFORMAT_STRING format,...)
 
LONG_PTR __cdecl call_server_func (SERVER_ROUTINE func, unsigned char *args, unsigned short stack_size)
 
static LONG_PTRstub_do_args (MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params)
 
LONG WINAPI NdrStubCall2 (struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
 
void WINAPI NdrServerCall2 (PRPC_MESSAGE pRpcMsg)
 
LONG WINAPI NdrStubCall (struct IRpcStubBuffer *This, struct IRpcChannelBuffer *channel, PRPC_MESSAGE msg, DWORD *phase)
 
void WINAPI NdrServerCall (PRPC_MESSAGE msg)
 
void WINAPI NdrServerCallAll (PRPC_MESSAGE msg)
 
static void do_ndr_async_client_call (const MIDL_STUB_DESC *pStubDesc, PFORMAT_STRING pFormat, void **stack_top)
 
LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call (PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top)
 
RPC_STATUS NdrpCompleteAsyncClientCall (RPC_ASYNC_STATE *pAsync, void *Reply)
 
CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall (PMIDL_STUB_DESC desc, PFORMAT_STRING format,...)
 
RPCRTAPI LONG RPC_ENTRY NdrAsyncStubCall (struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
 
void RPC_ENTRY NdrAsyncServerCall (PRPC_MESSAGE pRpcMsg)
 
RPC_STATUS NdrpCompleteAsyncServerCall (RPC_ASYNC_STATE *pAsync, void *Reply)
 

Macro Definition Documentation

◆ ARG_FROM_OFFSET

#define ARG_FROM_OFFSET (   args,
  offset 
)    ((args) + (offset))

Definition at line 271 of file ndr_stubless.c.

◆ NDR_TABLE_MASK

#define NDR_TABLE_MASK   127

Definition at line 48 of file ndr_stubless.c.

Function Documentation

◆ basetype_arg_size()

static size_t basetype_arg_size ( unsigned char  fc)
static

Definition at line 444 of file ndr_stubless.c.

445 {
446  switch (fc)
447  {
448  case FC_BYTE:
449  case FC_CHAR:
450  case FC_SMALL:
451  case FC_USMALL:
452  return sizeof(char);
453  case FC_WCHAR:
454  case FC_SHORT:
455  case FC_USHORT:
456  return sizeof(short);
457  case FC_LONG:
458  case FC_ULONG:
459  case FC_ENUM16:
460  case FC_ENUM32:
461  case FC_ERROR_STATUS_T:
462  return sizeof(int);
463  case FC_FLOAT:
464  return sizeof(float);
465  case FC_HYPER:
466  return sizeof(LONGLONG);
467  case FC_DOUBLE:
468  return sizeof(double);
469  case FC_INT3264:
470  case FC_UINT3264:
471  return sizeof(INT_PTR);
472  default:
473  FIXME("Unhandled basetype %#x.\n", fc);
474  return 0;
475  }
476 }
int32_t INT_PTR
Definition: typedefs.h:64
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
unsigned char
Definition: typeof.h:29
int64_t LONGLONG
Definition: typedefs.h:68
PFOR_CONTEXT fc
Definition: for.c:57
static float(__cdecl *square_half_float)(float x
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by client_do_args().

◆ calc_arg_size()

static DWORD calc_arg_size ( MIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING  pFormat 
)
static

Definition at line 149 of file ndr_stubless.c.

150 {
151  DWORD size;
152  switch(*pFormat)
153  {
154  case FC_RP:
155  if (pFormat[1] & FC_SIMPLE_POINTER)
156  {
157  size = 0;
158  break;
159  }
160  size = calc_arg_size(pStubMsg, &pFormat[2] + *(const SHORT*)&pFormat[2]);
161  break;
162  case FC_STRUCT:
163  case FC_PSTRUCT:
164  size = *(const WORD*)(pFormat + 2);
165  break;
166  case FC_BOGUS_STRUCT:
167  size = *(const WORD*)(pFormat + 2);
168  if(*(const WORD*)(pFormat + 4))
169  FIXME("Unhandled conformant description\n");
170  break;
171  case FC_CARRAY:
172  case FC_CVARRAY:
173  size = *(const WORD*)(pFormat + 2);
174  ComputeConformance(pStubMsg, NULL, pFormat + 4, 0);
175  size *= pStubMsg->MaxCount;
176  break;
177  case FC_SMFARRAY:
178  case FC_SMVARRAY:
179  size = *(const WORD*)(pFormat + 2);
180  break;
181  case FC_LGFARRAY:
182  case FC_LGVARRAY:
183  size = *(const DWORD*)(pFormat + 2);
184  break;
185  case FC_BOGUS_ARRAY:
186  pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]);
187  TRACE("conformance = %ld\n", pStubMsg->MaxCount);
188  pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount);
189  size = ComplexStructSize(pStubMsg, pFormat);
190  size *= pStubMsg->MaxCount;
191  break;
192  case FC_USER_MARSHAL:
193  size = *(const WORD*)(pFormat + 4);
194  break;
195  case FC_CSTRING:
196  size = *(const WORD*)(pFormat + 2);
197  break;
198  case FC_WSTRING:
199  size = *(const WORD*)(pFormat + 2) * sizeof(WCHAR);
200  break;
201  case FC_C_CSTRING:
202  case FC_C_WSTRING:
203  if (*pFormat == FC_C_CSTRING)
204  size = sizeof(CHAR);
205  else
206  size = sizeof(WCHAR);
207  if (pFormat[1] == FC_STRING_SIZED)
208  ComputeConformance(pStubMsg, NULL, pFormat + 2, 0);
209  else
210  pStubMsg->MaxCount = 0;
211  size *= pStubMsg->MaxCount;
212  break;
213  default:
214  FIXME("Unhandled type %02x\n", *pFormat);
215  /* fallthrough */
216  case FC_UP:
217  case FC_OP:
218  case FC_FP:
219  case FC_IP:
220  size = sizeof(void *);
221  break;
222  }
223  return size;
224 }
static PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:37
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
static PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:42
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR MaxCount
Definition: rpcndr.h:221
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FC_SIMPLE_POINTER
Definition: ndrtypes.h:275
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define CHAR(Char)
static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:149

Referenced by client_do_args(), and stub_do_args().

◆ call_buffer_sizer()

static void call_buffer_sizer ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
const NDR_PARAM_OIF param 
)
inlinestatic

Definition at line 55 of file ndr_stubless.c.

57 {
58  PFORMAT_STRING pFormat;
60 
61  if (param->attr.IsBasetype)
62  {
63  pFormat = &param->u.type_format_char;
64  if (param->attr.IsSimpleRef) pMemory = *(unsigned char **)pMemory;
65  }
66  else
67  {
68  pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset];
69  if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory;
70  }
71 
72  m = NdrBufferSizer[pFormat[0] & NDR_TABLE_MASK];
73  if (m) m(pStubMsg, pMemory, pFormat);
74  else
75  {
76  FIXME("format type 0x%x not implemented\n", pFormat[0]);
78  }
79 }
#define NDR_TABLE_MASK
Definition: ndr_stubless.c:48
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
const GLfloat * m
Definition: glext.h:10848
#define FIXME(fmt,...)
Definition: debug.h:111
void(WINAPI * NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:55
GLfloat param
Definition: glext.h:5796
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:260
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by client_do_args(), and stub_do_args().

◆ call_freer()

static void call_freer ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
const NDR_PARAM_OIF param 
)
inlinestatic

Definition at line 135 of file ndr_stubless.c.

137 {
138  PFORMAT_STRING pFormat;
139  NDR_FREE m;
140 
141  if (param->attr.IsBasetype) return; /* nothing to do */
142  pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset];
143  if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory;
144 
145  m = NdrFreer[pFormat[0] & NDR_TABLE_MASK];
146  if (m) m(pStubMsg, pMemory, pFormat);
147 }
const NDR_FREE NdrFreer[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:348
#define NDR_TABLE_MASK
Definition: ndr_stubless.c:48
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
const GLfloat * m
Definition: glext.h:10848
GLfloat param
Definition: glext.h:5796
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
void(WINAPI * NDR_FREE)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:57

Referenced by stub_do_args().

◆ call_marshaller()

static unsigned char* call_marshaller ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
const NDR_PARAM_OIF param 
)
inlinestatic

Definition at line 81 of file ndr_stubless.c.

83 {
84  PFORMAT_STRING pFormat;
86 
87  if (param->attr.IsBasetype)
88  {
89  pFormat = &param->u.type_format_char;
90  if (param->attr.IsSimpleRef) pMemory = *(unsigned char **)pMemory;
91  }
92  else
93  {
94  pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset];
95  if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory;
96  }
97 
98  m = NdrMarshaller[pFormat[0] & NDR_TABLE_MASK];
99  if (m) return m(pStubMsg, pMemory, pFormat);
100  else
101  {
102  FIXME("format type 0x%x not implemented\n", pFormat[0]);
104  return NULL;
105  }
106 }
#define NDR_TABLE_MASK
Definition: ndr_stubless.c:48
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
unsigned char *(WINAPI * NDR_MARSHALL)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:53
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
const GLfloat * m
Definition: glext.h:10848
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
GLfloat param
Definition: glext.h:5796
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:172
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by client_do_args(), and stub_do_args().

◆ call_server_func()

LONG_PTR __cdecl call_server_func ( SERVER_ROUTINE  func,
unsigned char args,
unsigned short  stack_size 
)

Definition at line 1207 of file ndr_stubless.c.

1208 {
1209  FIXME("Not implemented for your architecture\n");
1210  return 0;
1211 }
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by NdrAsyncServerCall(), and NdrStubCall2().

◆ call_unmarshaller()

static unsigned char* call_unmarshaller ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char **  ppMemory,
const NDR_PARAM_OIF param,
unsigned char  fMustAlloc 
)
inlinestatic

Definition at line 108 of file ndr_stubless.c.

110 {
111  PFORMAT_STRING pFormat;
113 
114  if (param->attr.IsBasetype)
115  {
116  pFormat = &param->u.type_format_char;
117  if (param->attr.IsSimpleRef) ppMemory = (unsigned char **)*ppMemory;
118  }
119  else
120  {
121  pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset];
122  if (!param->attr.IsByValue) ppMemory = (unsigned char **)*ppMemory;
123  }
124 
125  m = NdrUnmarshaller[pFormat[0] & NDR_TABLE_MASK];
126  if (m) return m(pStubMsg, ppMemory, pFormat, fMustAlloc);
127  else
128  {
129  FIXME("format type 0x%x not implemented\n", pFormat[0]);
131  return NULL;
132  }
133 }
#define NDR_TABLE_MASK
Definition: ndr_stubless.c:48
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
const GLfloat * m
Definition: glext.h:10848
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:216
GLfloat param
Definition: glext.h:5796
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned char *(WINAPI * NDR_UNMARSHALL)(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char)
Definition: ndr_misc.h:54
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by client_do_args(), and stub_do_args().

◆ client_do_args()

void client_do_args ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat,
enum stubless_phase  phase,
void **  fpu_args,
unsigned short  number_of_params,
unsigned char pRetVal 
)

Definition at line 478 of file ndr_stubless.c.

480 {
481  const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat;
482  unsigned int i;
483 
484  for (i = 0; i < number_of_params; i++)
485  {
486  unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset;
487  PFORMAT_STRING pTypeFormat = (PFORMAT_STRING)&pStubMsg->StubDesc->pFormatTypes[params[i].u.type_offset];
488 
489 #ifdef __x86_64__ /* floats are passed as doubles through varargs functions */
490  float f;
491 
492  if (params[i].attr.IsBasetype &&
493  params[i].u.type_format_char == FC_FLOAT &&
494  !params[i].attr.IsSimpleRef &&
495  !fpu_args)
496  {
497  f = *(double *)pArg;
498  pArg = (unsigned char *)&f;
499  }
500 #endif
501 
502  TRACE("param[%d]: %p type %02x %s\n", i, pArg,
503  params[i].attr.IsBasetype ? params[i].u.type_format_char : *pTypeFormat,
505 
506  switch (phase)
507  {
508  case STUBLESS_INITOUT:
509  if (*(unsigned char **)pArg)
510  {
512  memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat ));
513  else if (param_is_out_basetype(params[i].attr))
514  memset( *(unsigned char **)pArg, 0, basetype_arg_size( params[i].u.type_format_char ));
515  }
516  break;
517  case STUBLESS_CALCSIZE:
518  if (params[i].attr.IsSimpleRef && !*(unsigned char **)pArg)
520  if (params[i].attr.IsIn) call_buffer_sizer(pStubMsg, pArg, &params[i]);
521  break;
522  case STUBLESS_MARSHAL:
523  if (params[i].attr.IsIn) call_marshaller(pStubMsg, pArg, &params[i]);
524  break;
525  case STUBLESS_UNMARSHAL:
526  if (params[i].attr.IsOut)
527  {
528  if (params[i].attr.IsReturn && pRetVal) pArg = pRetVal;
529  call_unmarshaller(pStubMsg, &pArg, &params[i], 0);
530  }
531  break;
532  case STUBLESS_FREE:
533  if (!params[i].attr.IsBasetype && params[i].attr.IsOut && !params[i].attr.IsByValue)
534  NdrClearOutParameters( pStubMsg, pTypeFormat, *(unsigned char **)pArg );
535  break;
536  default:
538  }
539  }
540 }
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 * u
Definition: glfuncs.h:240
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
static void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:55
static BOOL param_is_out_basetype(PARAM_ATTRIBUTES attr)
Definition: ndr_stubless.c:439
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
static BOOL param_needs_alloc(PARAM_ATTRIBUTES attr)
Definition: ndr_stubless.c:434
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
static unsigned char * call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:81
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
GLenum const GLfloat * params
Definition: glext.h:5645
static size_t basetype_arg_size(unsigned char fc)
Definition: ndr_stubless.c:444
static const char * debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes)
Definition: ndr_stubless.c:234
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
if(!(yy_init))
Definition: macro.lex.yy.c:714
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
Definition: cookie.c:201
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
static unsigned char * call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, const NDR_PARAM_OIF *param, unsigned char fMustAlloc)
Definition: ndr_stubless.c:108
unsigned char * StackTop
Definition: rpcndr.h:226
void WINAPI NdrClearOutParameters(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr)
#define memset(x, y, z)
Definition: compat.h:39
static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:149

Referenced by do_ndr_async_client_call(), do_ndr_client_call(), ndr_client_call(), NdrMesProcEncodeDecode(), and NdrpCompleteAsyncClientCall().

◆ client_free_handle()

static void client_free_handle ( PMIDL_STUB_MESSAGE  pStubMsg,
const NDR_PROC_HEADER pProcHeader,
PFORMAT_STRING  pFormat,
handle_t  hBinding 
)
static

Definition at line 379 of file ndr_stubless.c.

382 {
383  /* binding */
384  switch (pProcHeader->handle_type)
385  {
386  /* explicit binding: parse additional section */
387  case 0:
388  switch (*pFormat) /* handle_type */
389  {
390  case FC_BIND_GENERIC: /* explicit generic */
391  {
392  const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat;
393  void *pObject = NULL;
394  void *pArg;
395  const GENERIC_BINDING_ROUTINE_PAIR *pGenPair;
396 
397  TRACE("Explicit generic binding handle #%d\n", pDesc->binding_routine_pair_index);
398 
400  pArg = *(void **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
401  else
402  pArg = ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
403  memcpy(&pObject, pArg, pDesc->flag_and_size & 0xf);
404  pGenPair = &pStubMsg->StubDesc->aGenericBindingRoutinePairs[pDesc->binding_routine_pair_index];
405 #ifdef __REACTOS__
406  if (hBinding) pGenPair->pfnUnbind(pObject, hBinding);
407 #else
408  pGenPair->pfnUnbind(pObject, hBinding);
409 #endif
410  break;
411  }
412  case FC_BIND_CONTEXT: /* explicit context */
413  case FC_BIND_PRIMITIVE: /* explicit primitive */
414  break;
415  default:
416  ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
418  }
419  break;
420  case FC_BIND_GENERIC: /* implicit generic */
421  FIXME("FC_BIND_GENERIC\n");
422  RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */
423  break;
424  case FC_CALLBACK_HANDLE: /* implicit callback */
425  case FC_BIND_PRIMITIVE: /* implicit primitive */
426  case FC_AUTO_HANDLE: /* implicit auto handle */
427  break;
428  default:
429  ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
431  }
432 }
unsigned short offset
Definition: ndr_stubless.h:186
handle_t hBinding
Definition: ctx_c.c:54
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char handle_type
Definition: ndr_stubless.h:43
unsigned char binding_routine_pair_index
Definition: ndr_stubless.h:190
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:110
unsigned char flag_and_size
Definition: ndr_stubless.h:183
unsigned char * StackTop
Definition: rpcndr.h:226
#define HANDLE_PARAM_IS_VIA_PTR
Definition: ndrtypes.h:279
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
GENERIC_UNBIND_ROUTINE pfnUnbind
Definition: rpcndr.h:283
#define ARG_FROM_OFFSET(args, offset)
Definition: ndr_stubless.c:271

Referenced by ndr_client_call_finally(), and NdrpCompleteAsyncClientCall().

◆ client_get_handle()

static handle_t client_get_handle ( const MIDL_STUB_MESSAGE pStubMsg,
const NDR_PROC_HEADER pProcHeader,
const PFORMAT_STRING  pFormat 
)
static

Definition at line 287 of file ndr_stubless.c.

289 {
290  /* binding */
291  switch (pProcHeader->handle_type)
292  {
293  /* explicit binding: parse additional section */
294  case 0:
295  switch (*pFormat) /* handle_type */
296  {
297  case FC_BIND_PRIMITIVE: /* explicit primitive */
298  {
299  const NDR_EHD_PRIMITIVE *pDesc = (const NDR_EHD_PRIMITIVE *)pFormat;
300 
301  TRACE("Explicit primitive handle @ %d\n", pDesc->offset);
302 
303  if (pDesc->flag) /* pointer to binding */
304  return **(handle_t **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
305  else
306  return *(handle_t *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
307  }
308  case FC_BIND_GENERIC: /* explicit generic */
309  {
310  const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat;
311  void *pObject = NULL;
312  void *pArg;
313  const GENERIC_BINDING_ROUTINE_PAIR *pGenPair;
314 
315  TRACE("Explicit generic binding handle #%d\n", pDesc->binding_routine_pair_index);
316 
318  pArg = *(void **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
319  else
320  pArg = ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
321  memcpy(&pObject, pArg, pDesc->flag_and_size & 0xf);
322  pGenPair = &pStubMsg->StubDesc->aGenericBindingRoutinePairs[pDesc->binding_routine_pair_index];
323  return pGenPair->pfnBind(pObject);
324  }
325  case FC_BIND_CONTEXT: /* explicit context */
326  {
327  const NDR_EHD_CONTEXT *pDesc = (const NDR_EHD_CONTEXT *)pFormat;
328  NDR_CCONTEXT context_handle;
329  TRACE("Explicit bind context\n");
330  if (pDesc->flags & HANDLE_PARAM_IS_VIA_PTR)
331  {
332  TRACE("\tHANDLE_PARAM_IS_VIA_PTR\n");
333  context_handle = **(NDR_CCONTEXT **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
334  }
335  else
336  context_handle = *(NDR_CCONTEXT *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
337 
338  if (context_handle) return NDRCContextBinding(context_handle);
339  else if (pDesc->flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL)
340  {
341  ERR("null context handle isn't allowed\n");
343  return NULL;
344  }
345  /* FIXME: should we store this structure in stubMsg.pContext? */
346  }
347  default:
348  ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
350  }
351  break;
352  case FC_BIND_GENERIC: /* implicit generic */
353  FIXME("FC_BIND_GENERIC\n");
354  RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */
355  break;
356  case FC_BIND_PRIMITIVE: /* implicit primitive */
357  TRACE("Implicit primitive handle\n");
358  return *pStubMsg->StubDesc->IMPLICIT_HANDLE_INFO.pPrimitiveHandle;
359  case FC_CALLBACK_HANDLE: /* implicit callback */
360  TRACE("FC_CALLBACK_HANDLE\n");
361  /* server calls callback procedures only in response to remote call, and most recent
362  binding handle is used. Calling back to a client can potentially result in another
363  callback with different current handle. */
364  return I_RpcGetCurrentCallHandle();
365  case FC_AUTO_HANDLE: /* implicit auto handle */
366  /* strictly speaking, it isn't necessary to set hBinding here
367  * since it isn't actually used (hence the automatic in its name),
368  * but then why does MIDL generate a valid entry in the
369  * MIDL_STUB_DESC for it? */
370  TRACE("Implicit auto handle\n");
371  return *pStubMsg->StubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle;
372  default:
373  ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
375  }
376  return NULL;
377 }
#define RPC_X_SS_IN_NULL_CONTEXT
Definition: winerror.h:1083
unsigned short offset
Definition: ndr_stubless.h:186
GENERIC_BINDING_ROUTINE pfnBind
Definition: rpcndr.h:282
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
#define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL
Definition: ndrtypes.h:288
unsigned char flag
Definition: ndr_stubless.h:167
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char handle_type
Definition: ndr_stubless.h:43
unsigned char flags
Definition: ndr_stubless.h:212
unsigned char binding_routine_pair_index
Definition: ndr_stubless.h:190
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743
unsigned short offset
Definition: ndr_stubless.h:170
#define ERR(fmt,...)
Definition: debug.h:110
unsigned char flag_and_size
Definition: ndr_stubless.h:183
unsigned char * StackTop
Definition: rpcndr.h:226
#define HANDLE_PARAM_IS_VIA_PTR
Definition: ndrtypes.h:279
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
#define ARG_FROM_OFFSET(args, offset)
Definition: ndr_stubless.c:271
unsigned short offset
Definition: ndr_stubless.h:215

Referenced by do_ndr_async_client_call(), and do_ndr_client_call().

◆ convert_old_args()

PFORMAT_STRING convert_old_args ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat,
unsigned int  stack_size,
BOOL  object_proc,
void buffer,
unsigned int  size,
unsigned int count 
)

Definition at line 590 of file ndr_stubless.c.

593 {
595  unsigned int i, stack_offset = object_proc ? sizeof(void *) : 0;
596 
597  for (i = 0; stack_offset < stack_size; i++)
598  {
599  const NDR_PARAM_OI_BASETYPE *param = (const NDR_PARAM_OI_BASETYPE *)pFormat;
600  const NDR_PARAM_OI_OTHER *other = (const NDR_PARAM_OI_OTHER *)pFormat;
601 
602  if (i + 1 > size / sizeof(*args))
603  {
604  FIXME( "%u args not supported\n", i );
606  }
607 
608  args[i].stack_offset = stack_offset;
609  memset( &args[i].attr, 0, sizeof(args[i].attr) );
610 
611  switch (param->param_direction)
612  {
614  args[i].attr.IsIn = 1;
615  args[i].attr.IsBasetype = 1;
616  break;
618  args[i].attr.IsOut = 1;
619  args[i].attr.IsReturn = 1;
620  args[i].attr.IsBasetype = 1;
621  break;
622  case FC_IN_PARAM:
623  args[i].attr.IsIn = 1;
624  args[i].attr.MustFree = 1;
625  break;
627  args[i].attr.IsIn = 1;
628  args[i].attr.IsDontCallFreeInst = 1;
629  break;
630  case FC_IN_OUT_PARAM:
631  args[i].attr.IsIn = 1;
632  args[i].attr.IsOut = 1;
633  args[i].attr.MustFree = 1;
634  break;
635  case FC_OUT_PARAM:
636  args[i].attr.IsOut = 1;
637  break;
638  case FC_RETURN_PARAM:
639  args[i].attr.IsOut = 1;
640  args[i].attr.IsReturn = 1;
641  break;
642  }
643  if (args[i].attr.IsBasetype)
644  {
645  args[i].u.type_format_char = param->type_format_char;
646  stack_offset += type_stack_size( param->type_format_char );
647  pFormat += sizeof(NDR_PARAM_OI_BASETYPE);
648  }
649  else
650  {
651  args[i].u.type_offset = other->type_offset;
652  args[i].attr.IsByValue = is_by_value( &pStubMsg->StubDesc->pFormatTypes[other->type_offset] );
653  stack_offset += other->stack_size * sizeof(void *);
654  pFormat += sizeof(NDR_PARAM_OI_OTHER);
655  }
656  }
657  *count = i;
658  return (PFORMAT_STRING)args;
659 }
static BOOL is_by_value(PFORMAT_STRING format)
Definition: ndr_stubless.c:573
GLuint GLuint GLsizei count
Definition: gl.h:1545
int other
Definition: msacm.c:1376
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
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:111
GLsizeiptr size
Definition: glext.h:5919
static unsigned stack_offset(compile_ctx_t *ctx)
Definition: compile.c:349
GLfloat param
Definition: glext.h:5796
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
Definition: cookie.c:201
static unsigned int type_stack_size(unsigned char fc)
Definition: ndr_stubless.c:542
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
struct _NDR_PARAM_OI_OTHER NDR_PARAM_OI_OTHER
struct _NDR_PARAM_OI_BASETYPE NDR_PARAM_OI_BASETYPE
#define memset(x, y, z)
Definition: compat.h:39
#define args
Definition: format.c:66

Referenced by do_ndr_async_client_call(), ndr_client_call(), NdrAsyncServerCall(), NdrMesProcEncodeDecode(), and NdrStubCall2().

◆ debugstr_INTERPRETER_OPT_FLAGS()

static const char* debugstr_INTERPRETER_OPT_FLAGS ( INTERPRETER_OPT_FLAGS  Oi2Flags)
static

Definition at line 255 of file ndr_stubless.c.

256 {
257  char buffer[160];
258 
259  buffer[0] = 0;
260  if (Oi2Flags.ServerMustSize) strcat(buffer, " ServerMustSize");
261  if (Oi2Flags.ClientMustSize) strcat(buffer, " ClientMustSize");
262  if (Oi2Flags.HasReturn) strcat(buffer, " HasReturn");
263  if (Oi2Flags.HasPipes) strcat(buffer, " HasPipes");
264  if (Oi2Flags.Unused) strcat(buffer, " Unused");
265  if (Oi2Flags.HasAsyncUuid) strcat(buffer, " HasAsyncUuid");
266  if (Oi2Flags.HasExtensions) strcat(buffer, " HasExtensions");
267  if (Oi2Flags.HasAsyncHandle) strcat(buffer, " HasAsyncHandle");
268  return buffer[0] ? wine_dbg_sprintf( "%s", buffer + 1 ) : "";
269 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
unsigned char HasAsyncUuid
Definition: ndrtypes.h:66
GLuint buffer
Definition: glext.h:5915
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
unsigned char HasReturn
Definition: ndrtypes.h:63
unsigned char Unused
Definition: ndrtypes.h:65
unsigned char ServerMustSize
Definition: ndrtypes.h:59
unsigned char HasAsyncHandle
Definition: ndrtypes.h:70
unsigned char HasPipes
Definition: ndrtypes.h:64
unsigned char ClientMustSize
Definition: ndrtypes.h:61
unsigned char HasExtensions
Definition: ndrtypes.h:68

Referenced by do_ndr_async_client_call(), ndr_client_call(), NdrAsyncServerCall(), and NdrStubCall2().

◆ debugstr_PROC_PF()

static const char* debugstr_PROC_PF ( PARAM_ATTRIBUTES  param_attributes)
static

Definition at line 234 of file ndr_stubless.c.

235 {
236  char buffer[160];
237 
238  buffer[0] = 0;
239  if (param_attributes.MustSize) strcat(buffer, " MustSize");
240  if (param_attributes.MustFree) strcat(buffer, " MustFree");
241  if (param_attributes.IsPipe) strcat(buffer, " IsPipe");
242  if (param_attributes.IsIn) strcat(buffer, " IsIn");
243  if (param_attributes.IsOut) strcat(buffer, " IsOut");
244  if (param_attributes.IsReturn) strcat(buffer, " IsReturn");
245  if (param_attributes.IsBasetype) strcat(buffer, " IsBasetype");
246  if (param_attributes.IsByValue) strcat(buffer, " IsByValue");
247  if (param_attributes.IsSimpleRef) strcat(buffer, " IsSimpleRef");
248  if (param_attributes.IsDontCallFreeInst) strcat(buffer, " IsDontCallFreeInst");
249  if (param_attributes.SaveForAsyncFinish) strcat(buffer, " SaveForAsyncFinish");
250  if (param_attributes.ServerAllocSize)
251  sprintf( buffer + strlen(buffer), " ServerAllocSize = %d", param_attributes.ServerAllocSize * 8);
252  return buffer[0] ? wine_dbg_sprintf( "%s", buffer + 1 ) : "";
253 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned short IsPipe
Definition: ndrtypes.h:34
GLuint buffer
Definition: glext.h:5915
unsigned short IsReturn
Definition: ndrtypes.h:37
unsigned short IsByValue
Definition: ndrtypes.h:41
unsigned short SaveForAsyncFinish
Definition: ndrtypes.h:49
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned short ServerAllocSize
Definition: ndrtypes.h:51
unsigned short MustSize
Definition: ndrtypes.h:28
unsigned short IsSimpleRef
Definition: ndrtypes.h:44
unsigned short IsDontCallFreeInst
Definition: ndrtypes.h:47
unsigned short MustFree
Definition: ndrtypes.h:31
unsigned short IsBasetype
Definition: ndrtypes.h:38
unsigned short IsOut
Definition: ndrtypes.h:36
unsigned short IsIn
Definition: ndrtypes.h:35

Referenced by client_do_args(), and stub_do_args().

◆ do_ndr_async_client_call()

static void do_ndr_async_client_call ( const MIDL_STUB_DESC pStubDesc,
PFORMAT_STRING  pFormat,
void **  stack_top 
)
static

Definition at line 1597 of file ndr_stubless.c.

1598 {
1599  /* pointer to start of stack where arguments start */
1600  PRPC_MESSAGE pRpcMsg;
1601  PMIDL_STUB_MESSAGE pStubMsg;
1602  RPC_ASYNC_STATE *pAsync;
1604  /* procedure number */
1605  unsigned short procedure_number;
1606  /* cache of Oif_flags from v2 procedure header */
1607  INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
1608  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1609  INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
1610  /* header for procedure string */
1611  const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1613 
1614  /* Later NDR language versions probably won't be backwards compatible */
1615  if (pStubDesc->Version > 0x50002)
1616  {
1617  FIXME("Incompatible stub description version: 0x%x\n", pStubDesc->Version);
1619  }
1620 
1624 
1626  pRpcMsg = (PRPC_MESSAGE)(pStubMsg + 1);
1627 
1629  {
1630  const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
1631  async_call_data->stack_size = header_rpc->stack_size;
1632  procedure_number = header_rpc->proc_num;
1633  pFormat += sizeof(NDR_PROC_HEADER_RPC);
1634  }
1635  else
1636  {
1638  procedure_number = pProcHeader->proc_num;
1639  pFormat += sizeof(NDR_PROC_HEADER);
1640  }
1641  TRACE("stack size: 0x%x\n", async_call_data->stack_size);
1642  TRACE("proc num: %d\n", procedure_number);
1643 
1644  /* create the full pointer translation tables, if requested */
1647 
1649  {
1650  ERR("objects not supported\n");
1653  }
1654 
1655  NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDesc, procedure_number);
1656 
1657  TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
1658  TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
1659 
1660  /* needed for conformance of top-level objects */
1663 
1664  pAsync = *(RPC_ASYNC_STATE **)pStubMsg->StackTop;
1665  pAsync->StubInfo = async_call_data;
1666  async_call_data->pHandleFormat = pFormat;
1667 
1668  TRACE("pAsync %p, pAsync->StubInfo %p, NotificationType %d\n", pAsync, pAsync->StubInfo, pAsync->NotificationType);
1669 
1670  pFormat += get_handle_desc_size(pProcHeader, pFormat);
1672  if (!async_call_data->hBinding) return;
1673 
1674  if (is_oicf_stubdesc(pStubDesc))
1675  {
1676  const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader =
1677  (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
1678 
1679  Oif_flags = pOIFHeader->Oi2Flags;
1681 
1682  pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER);
1683 
1684  TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) );
1685 
1686  if (Oif_flags.HasExtensions)
1687  {
1688  const NDR_PROC_HEADER_EXTS *pExtensions =
1689  (const NDR_PROC_HEADER_EXTS *)pFormat;
1690  ext_flags = pExtensions->Flags2;
1691  pFormat += pExtensions->Size;
1692  }
1693  }
1694  else
1695  {
1696  pFormat = convert_old_args( pStubMsg, pFormat, async_call_data->stack_size,
1700  }
1701 
1702  async_call_data->pParamFormat = pFormat;
1703 
1704  pStubMsg->BufferLength = 0;
1705 
1706  /* store the RPC flags away */
1708  pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags;
1709 
1710  /* use alternate memory allocation routines */
1713 
1714  if (Oif_flags.HasPipes)
1715  {
1716  FIXME("pipes not supported yet\n");
1717  RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */
1718  /* init pipes package */
1719  /* NdrPipesInitialize(...) */
1720  }
1721  if (ext_flags.HasNewCorrDesc)
1722  {
1723  /* initialize extra correlation package */
1725  if (ext_flags.Unused & 0x2) /* has range on conformance */
1727  }
1728 
1729  /* order of phases:
1730  * 1. CALCSIZE - calculate the buffer size
1731  * 2. GETBUFFER - allocate the buffer
1732  * 3. MARSHAL - marshal [in] params into the buffer
1733  * 4. SENDRECEIVE - send buffer
1734  * Then in NdrpCompleteAsyncClientCall:
1735  * 1. SENDRECEIVE - receive buffer
1736  * 2. UNMARSHAL - unmarshal [out] params from buffer
1737  */
1738 
1739  /* 1. CALCSIZE */
1740  TRACE( "CALCSIZE\n" );
1742 
1743  /* 2. GETBUFFER */
1744  TRACE( "GETBUFFER\n" );
1745  if (Oif_flags.HasPipes)
1746  /* NdrGetPipeBuffer(...) */
1747  FIXME("pipes not supported yet\n");
1748  else
1749  {
1751 #if 0
1753 #else
1754  FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
1755 #endif
1756  else
1758  }
1759  pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
1760  status = I_RpcAsyncSetHandle(pRpcMsg, pAsync);
1761  if (status != RPC_S_OK)
1763 
1764  /* 3. MARSHAL */
1765  TRACE( "MARSHAL\n" );
1767 
1768  /* 4. SENDRECEIVE */
1769  TRACE( "SEND\n" );
1770  pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
1771  /* send the [in] params only */
1772  if (Oif_flags.HasPipes)
1773  /* NdrPipesSend(...) */
1774  FIXME("pipes not supported yet\n");
1775  else
1776  {
1778 #if 0
1779  NdrNsSend(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
1780 #else
1781  FIXME("using auto handle - call NdrNsSend when it gets implemented\n");
1782 #endif
1783  else
1784  {
1785  pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
1787  if (status != RPC_S_OK)
1789  }
1790  }
1791 }
unsigned short stack_size
Definition: ndr_stubless.h:93
void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal)
Definition: ndr_stubless.c:478
#define RPC_X_NO_MEMORY
Definition: rpcnterr.h:35
ULONG_PTR NdrCorrCache[256]
Definition: ndr_stubless.h:243
RPCRTAPI unsigned char *RPC_ENTRY NdrNsGetBuffer(PMIDL_STUB_MESSAGE pStubMsg, ULONG BufferLength, RPC_BINDING_HANDLE Handle)
RPC_NOTIFICATION_TYPES NotificationType
Definition: rpcasync.h:154
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
static handle_t client_get_handle(const MIDL_STUB_MESSAGE *pStubMsg, const NDR_PROC_HEADER *pProcHeader, const PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:287
INTERPRETER_OPT_FLAGS2 Flags2
Definition: ndrtypes.h:99
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
unsigned char * Buffer
Definition: rpcndr.h:203
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
unsigned char Unused
Definition: ndrtypes.h:89
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
static size_t get_handle_desc_size(const NDR_PROC_HEADER *proc_header, PFORMAT_STRING format)
Definition: ndr_stubless.c:273
#define Oi_RPCSS_ALLOC_USED
Definition: ndrtypes.h:291
unsigned int number_of_params
Definition: ndr_stubless.h:239
RPC_BINDING_HANDLE hBinding
Definition: ndr_stubless.h:235
unsigned int BufferLength
Definition: rpcdcep.h:41
long RPC_STATUS
Definition: rpc.h:52
void * Buffer
Definition: rpcdcep.h:40
void * StubInfo
Definition: rpcasync.h:150
struct _RPC_MESSAGE * PRPC_MESSAGE
#define FIXME(fmt,...)
Definition: debug.h:111
INTERPRETER_OPT_FLAGS Oi2Flags
Definition: ndr_stubless.h:107
unsigned short proc_num
Definition: ndr_stubless.h:67
smooth NULL
Definition: ftsmooth.c:416
unsigned short proc_num
Definition: ndr_stubless.h:92
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
static jsval_t stack_top(script_ctx_t *ctx)
Definition: engine.c:104
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
PFORMAT_STRING convert_old_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned int stack_size, BOOL object_proc, void *buffer, unsigned int size, unsigned int *count)
Definition: ndr_stubless.c:590
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char handle_type
Definition: ndr_stubless.h:43
struct _NDR_PROC_HEADER NDR_PROC_HEADER
unsigned char HasPipes
Definition: ndrtypes.h:64
RPC_STATUS WINAPI I_RpcAsyncSetHandle(PRPC_MESSAGE pMsg, PRPC_ASYNC_STATE pAsync)
Definition: rpc_message.c:1949
ULONG RpcFlags
Definition: rpcdcep.h:48
unsigned short stack_size
Definition: ndr_stubless.h:237
LONG MIDLVersion
Definition: rpcndr.h:378
struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
#define RPC_BUFFER_ASYNC
Definition: rpcdcep.h:70
unsigned char HasNewCorrDesc
Definition: ndrtypes.h:76
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
ULONG BufferLength
Definition: rpcndr.h:207
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char Oi_flags
Definition: ndr_stubless.h:64
PFORMAT_STRING pParamFormat
Definition: ndr_stubless.h:234
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short stack_size
Definition: ndr_stubless.h:71
static const char * debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
Definition: ndr_stubless.c:255
PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers, XLAT_SIDE XlatSide)
handle_t * pAutoHandle
Definition: rpcndr.h:366
struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
unsigned char * StackTop
Definition: rpcndr.h:226
ULONG Version
Definition: rpcndr.h:376
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
#define RPC_X_WRONG_STUB_VERSION
Definition: winerror.h:1136
void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage)
Definition: ndr_stubless.c:226
unsigned char *WINAPI NdrGetBuffer(PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle)
RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1790
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
unsigned char CorrDespIncrement
Definition: rpcndr.h:218
union _MIDL_STUB_DESC::@3174 IMPLICIT_HANDLE_INFO
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
void WINAPI NdrClientInitializeNew(PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum)
unsigned char HasExtensions
Definition: ndrtypes.h:68
struct _MIDL_STUB_MESSAGE * PMIDL_STUB_MESSAGE
static SERVICE_STATUS status
Definition: service.c:31
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714
static BOOL is_oicf_stubdesc(const PMIDL_STUB_DESC pStubDesc)
Definition: ndr_stubless.c:50
#define RPC_S_OK
Definition: rpcnterr.h:22
unsigned char Size
Definition: ndrtypes.h:97
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233
Definition: ps.c:97

Referenced by ndr_async_client_call().

◆ do_ndr_client_call()

static LONG_PTR do_ndr_client_call ( const MIDL_STUB_DESC stub_desc,
const PFORMAT_STRING  format,
const PFORMAT_STRING  handle_format,
void **  stack_top,
void **  fpu_stack,
MIDL_STUB_MESSAGE stub_msg,
unsigned short  procedure_number,
unsigned short  stack_size,
unsigned int  number_of_params,
INTERPRETER_OPT_FLAGS  Oif_flags,
INTERPRETER_OPT_FLAGS2  ext_flags,
const NDR_PROC_HEADER proc_header 
)
static

Definition at line 703 of file ndr_stubless.c.

707 {
708  struct ndr_client_call_ctx finally_ctx;
711  /* the value to return to the client from the remote procedure */
712  LONG_PTR retval = 0;
713  /* the pointer to the object when in OLE mode */
714  void *This = NULL;
715  /* correlation cache */
716  ULONG_PTR NdrCorrCache[256];
717 
718  /* create the full pointer translation tables, if requested */
721 
723  {
724  /* object is always the first argument */
725  This = stack_top[0];
726  NdrProxyInitialize(This, &rpc_msg, stub_msg, stub_desc, procedure_number);
727  }
728 
729  finally_ctx.stub_msg = stub_msg;
730  finally_ctx.Oif_flags = Oif_flags;
731  finally_ctx.ext_flags = ext_flags;
732  finally_ctx.proc_header = proc_header;
733  finally_ctx.This = This;
734  finally_ctx.handle_format = handle_format;
735  finally_ctx.hbinding = hbinding;
736 
737  __TRY
738  {
740  NdrClientInitializeNew(&rpc_msg, stub_msg, stub_desc, procedure_number);
741 
742  stub_msg->StackTop = (unsigned char *)stack_top;
743 
744  /* we only need a handle if this isn't an object method */
746  {
748  if (!hbinding) return 0;
749  }
750 
751  stub_msg->BufferLength = 0;
752 
753  /* store the RPC flags away */
755  rpc_msg.RpcFlags = ((const NDR_PROC_HEADER_RPC *)proc_header)->rpc_flags;
756 
757  /* use alternate memory allocation routines */
760 
761  if (Oif_flags.HasPipes)
762  {
763  FIXME("pipes not supported yet\n");
764  RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */
765  /* init pipes package */
766  /* NdrPipesInitialize(...) */
767  }
769  {
770  /* initialize extra correlation package */
771  NdrCorrelationInitialize(stub_msg, NdrCorrCache, sizeof(NdrCorrCache), 0);
772  if (ext_flags.Unused & 0x2) /* has range on conformance */
774  }
775 
776  /* order of phases:
777  * 1. INITOUT - zero [out] parameters (proxies only)
778  * 2. CALCSIZE - calculate the buffer size
779  * 3. GETBUFFER - allocate the buffer
780  * 4. MARSHAL - marshal [in] params into the buffer
781  * 5. SENDRECEIVE - send/receive buffer
782  * 6. UNMARSHAL - unmarshal [out] params from buffer
783  * 7. FREE - clear [out] parameters (for proxies, and only on error)
784  */
785 
786  /* 1. INITOUT */
788  {
789  TRACE( "INITOUT\n" );
791  number_of_params, (unsigned char *)&retval);
792  }
793 
794  /* 2. CALCSIZE */
795  TRACE( "CALCSIZE\n" );
797  number_of_params, (unsigned char *)&retval);
798 
799  /* 3. GETBUFFER */
800  TRACE( "GETBUFFER\n" );
803  else if (Oif_flags.HasPipes)
804  FIXME("pipes not supported yet\n");
806 #if 0
808 #else
809  FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
810 #endif
811  else
813 
814  /* 4. MARSHAL */
815  TRACE( "MARSHAL\n" );
817  number_of_params, (unsigned char *)&retval);
818 
819  /* 5. SENDRECEIVE */
820  TRACE( "SENDRECEIVE\n" );
823  else if (Oif_flags.HasPipes)
824  /* NdrPipesSendReceive(...) */
825  FIXME("pipes not supported yet\n");
827 #if 0
828  NdrNsSendReceive(stub_msg, stub_msg->Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
829 #else
830  FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
831 #endif
832  else
834 
835  /* convert strings, floating point values and endianness into our
836  * preferred format */
837  if ((rpc_msg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
839 
840  /* 6. UNMARSHAL */
841  TRACE( "UNMARSHAL\n" );
843  number_of_params, (unsigned char *)&retval);
844  }
846 
847  return retval;
848 }
PFORMAT_STRING handle_format
Definition: ndr_stubless.c:668
void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal)
Definition: ndr_stubless.c:478
#define __FINALLY_CTX(func, ctx)
Definition: exception.h:66
RPCRTAPI unsigned char *RPC_ENTRY NdrNsGetBuffer(PMIDL_STUB_MESSAGE pStubMsg, ULONG BufferLength, RPC_BINDING_HANDLE Handle)
handle_t hBinding
Definition: ctx_c.c:54
static handle_t client_get_handle(const MIDL_STUB_MESSAGE *pStubMsg, const NDR_PROC_HEADER *pProcHeader, const PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:287
void WINAPI NdrProxySendReceive(void *This, PMIDL_STUB_MESSAGE pStubMsg)
Definition: cproxy.c:543
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
INTERPRETER_OPT_FLAGS2 ext_flags
Definition: ndr_stubless.c:665
unsigned char * Buffer
Definition: rpcndr.h:203
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
unsigned char Unused
Definition: ndrtypes.h:89
void WINAPI NdrConvert(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define Oi_RPCSS_ALLOC_USED
Definition: ndrtypes.h:291
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
void WINAPI NdrProxyGetBuffer(void *This, PMIDL_STUB_MESSAGE pStubMsg)
Definition: cproxy.c:515
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
static jsval_t stack_top(script_ctx_t *ctx)
Definition: engine.c:104
#define __TRY
Definition: compat.h:80
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char handle_type
Definition: ndr_stubless.h:43
unsigned char HasPipes
Definition: ndrtypes.h:64
unsigned char HasNewCorrDesc
Definition: ndrtypes.h:76
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char Oi_flags
Definition: ndr_stubless.h:64
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers, XLAT_SIDE XlatSide)
RPCRTAPI unsigned char *RPC_ENTRY NdrNsSendReceive(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pBufferEnd, RPC_BINDING_HANDLE *pAutoHandle)
unsigned char * StackTop
Definition: rpcndr.h:226
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
static void CALLBACK ndr_client_call_finally(BOOL normal, void *arg)
Definition: ndr_stubless.c:672
#define RPC_X_WRONG_STUB_VERSION
Definition: winerror.h:1136
void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage)
Definition: ndr_stubless.c:226
unsigned char *WINAPI NdrGetBuffer(PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
unsigned char *WINAPI NdrSendReceive(PMIDL_STUB_MESSAGE stubmsg, unsigned char *buffer)
unsigned char CorrDespIncrement
Definition: rpcndr.h:218
MIDL_STUB_MESSAGE * stub_msg
Definition: ndr_stubless.c:663
void WINAPI NdrClientInitializeNew(PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum)
void WINAPI NdrProxyInitialize(void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum)
Definition: cproxy.c:495
const NDR_PROC_HEADER * proc_header
Definition: ndr_stubless.c:666
INTERPRETER_OPT_FLAGS Oif_flags
Definition: ndr_stubless.c:664

Referenced by ndr_client_call().

◆ get_handle_desc_size()

static size_t get_handle_desc_size ( const NDR_PROC_HEADER proc_header,
PFORMAT_STRING  format 
)
static

Definition at line 273 of file ndr_stubless.c.

274 {
275  if (!proc_header->handle_type)
276  {
277  if (*format == FC_BIND_PRIMITIVE)
278  return sizeof(NDR_EHD_PRIMITIVE);
279  else if (*format == FC_BIND_GENERIC)
280  return sizeof(NDR_EHD_GENERIC);
281  else if (*format == FC_BIND_CONTEXT)
282  return sizeof(NDR_EHD_CONTEXT);
283  }
284  return 0;
285 }
struct _NDR_EHD_GENERIC NDR_EHD_GENERIC
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
struct _NDR_EHD_CONTEXT NDR_EHD_CONTEXT
unsigned char handle_type
Definition: ndr_stubless.h:43
struct _NDR_EHD_PRIMITIVE NDR_EHD_PRIMITIVE
const NDR_PROC_HEADER * proc_header
Definition: ndr_stubless.c:666

Referenced by do_ndr_async_client_call(), and ndr_client_call().

◆ is_by_value()

static BOOL is_by_value ( PFORMAT_STRING  format)
static

Definition at line 573 of file ndr_stubless.c.

574 {
575  switch (*format)
576  {
577  case FC_USER_MARSHAL:
578  case FC_STRUCT:
579  case FC_PSTRUCT:
580  case FC_CSTRUCT:
581  case FC_CPSTRUCT:
582  case FC_CVSTRUCT:
583  case FC_BOGUS_STRUCT:
584  return TRUE;
585  default:
586  return FALSE;
587  }
588 }
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FALSE
Definition: types.h:117

Referenced by convert_old_args().

◆ is_oicf_stubdesc()

static BOOL is_oicf_stubdesc ( const PMIDL_STUB_DESC  pStubDesc)
inlinestatic

Definition at line 50 of file ndr_stubless.c.

51 {
52  return pStubDesc->Version >= 0x20000;
53 }
ULONG Version
Definition: rpcndr.h:376

Referenced by do_ndr_async_client_call(), ndr_client_call(), NdrAsyncServerCall(), and NdrStubCall2().

◆ ndr_async_client_call()

LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call ( PMIDL_STUB_DESC  pStubDesc,
PFORMAT_STRING  pFormat,
void **  stack_top 
)

Definition at line 1793 of file ndr_stubless.c.

1795 {
1796  LONG_PTR ret = 0;
1797  const NDR_PROC_HEADER *pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1798 
1799  TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
1800 
1801  if (pProcHeader->Oi_flags & Oi_HAS_COMM_OR_FAULT)
1802  {
1803  __TRY
1804  {
1805  do_ndr_async_client_call( pStubDesc, pFormat, stack_top );
1806  }
1807  __EXCEPT_ALL
1808  {
1809  FIXME("exception %x during ndr_async_client_call()\n", GetExceptionCode());
1810  ret = GetExceptionCode();
1811  }
1812  __ENDTRY
1813  }
1814  else
1815  do_ndr_async_client_call( pStubDesc, pFormat, stack_top);
1816 
1817  TRACE("returning %ld\n", ret);
1818  return ret;
1819 }
#define FIXME(fmt,...)
Definition: debug.h:111
static jsval_t stack_top(script_ctx_t *ctx)
Definition: engine.c:104
#define __TRY
Definition: compat.h:80
#define GetExceptionCode()
Definition: exception.h:69
#define TRACE(s)
Definition: solgame.cpp:4
#define __ENDTRY
Definition: compat.h:82
int ret
unsigned char Oi_flags
Definition: ndr_stubless.h:64
static void do_ndr_async_client_call(const MIDL_STUB_DESC *pStubDesc, PFORMAT_STRING pFormat, void **stack_top)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define Oi_HAS_COMM_OR_FAULT
Definition: ndrtypes.h:295
#define __EXCEPT_ALL
Definition: exception.h:63

Referenced by NdrAsyncClientCall().

◆ ndr_client_call()

LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call ( PMIDL_STUB_DESC  pStubDesc,
PFORMAT_STRING  pFormat,
void **  stack_top,
void **  fpu_stack 
)

Definition at line 850 of file ndr_stubless.c.

852 {
853  /* pointer to start of stack where arguments start */
854  MIDL_STUB_MESSAGE stubMsg;
855  /* procedure number */
856  unsigned short procedure_number;
857  /* size of stack */
858  unsigned short stack_size;
859  /* number of parameters. optional for client to give it to us */
860  unsigned int number_of_params;
861  /* cache of Oif_flags from v2 procedure header */
863  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
865  /* header for procedure string */
866  const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
867  /* the value to return to the client from the remote procedure */
868  LONG_PTR RetVal = 0;
869  PFORMAT_STRING pHandleFormat;
870  NDR_PARAM_OIF old_args[256];
871 
872  TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
873 
874  TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
875 
876  if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
877  {
878  const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
879  stack_size = header_rpc->stack_size;
880  procedure_number = header_rpc->proc_num;
881  pFormat += sizeof(NDR_PROC_HEADER_RPC);
882  }
883  else
884  {
885  stack_size = pProcHeader->stack_size;
886  procedure_number = pProcHeader->proc_num;
887  pFormat += sizeof(NDR_PROC_HEADER);
888  }
889  TRACE("stack size: 0x%x\n", stack_size);
890  TRACE("proc num: %d\n", procedure_number);
891  TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
892  TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
893 
894  pHandleFormat = pFormat;
895 
896  /* we only need a handle if this isn't an object method */
897  if (!(pProcHeader->Oi_flags & Oi_OBJECT_PROC))
898  pFormat += get_handle_desc_size(pProcHeader, pFormat);
899 
900  if (is_oicf_stubdesc(pStubDesc)) /* -Oicf format */
901  {
902  const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader =
903  (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
904 
905  Oif_flags = pOIFHeader->Oi2Flags;
906  number_of_params = pOIFHeader->number_of_params;
907 
908  pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER);
909 
910  TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) );
911 
913  {
914  const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat;
915  ext_flags = pExtensions->Flags2;
916  pFormat += pExtensions->Size;
917 #ifdef __x86_64__
918  if (pExtensions->Size > sizeof(*pExtensions) && fpu_stack)
919  {
920  int i;
921  unsigned short fpu_mask = *(unsigned short *)(pExtensions + 1);
922  for (i = 0; i < 4; i++, fpu_mask >>= 2)
923  switch (fpu_mask & 3)
924  {
925  case 1: *(float *)&stack_top[i] = *(float *)&fpu_stack[i]; break;
926  case 2: *(double *)&stack_top[i] = *(double *)&fpu_stack[i]; break;
927  }
928  }
929 #endif
930  }
931  }
932  else
933  {
934  pFormat = convert_old_args( &stubMsg, pFormat, stack_size,
935  pProcHeader->Oi_flags & Oi_OBJECT_PROC,
936  old_args, sizeof(old_args), &number_of_params );
937  }
938 
939  if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
940  {
941  __TRY
942  {
943  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
944  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
945  number_of_params, Oif_flags, ext_flags, pProcHeader);
946  }
948  {
949  /* 7. FREE */
950  TRACE( "FREE\n" );
951  client_do_args(&stubMsg, pFormat, STUBLESS_FREE, fpu_stack,
952  number_of_params, (unsigned char *)&RetVal);
954  }
955  __ENDTRY
956  }
957  else if (pProcHeader->Oi_flags & Oi_HAS_COMM_OR_FAULT)
958  {
959  __TRY
960  {
961  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
962  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
963  number_of_params, Oif_flags, ext_flags, pProcHeader);
964  }
966  {
967  const COMM_FAULT_OFFSETS *comm_fault_offsets = &pStubDesc->CommFaultOffsets[procedure_number];
968  ULONG *comm_status;
969  ULONG *fault_status;
970 
971  TRACE("comm_fault_offsets = {0x%hx, 0x%hx}\n", comm_fault_offsets->CommOffset, comm_fault_offsets->FaultOffset);
972 
973  if (comm_fault_offsets->CommOffset == -1)
974  comm_status = (ULONG *)&RetVal;
975  else if (comm_fault_offsets->CommOffset >= 0)
976  comm_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->CommOffset);
977  else
978  comm_status = NULL;
979 
980  if (comm_fault_offsets->FaultOffset == -1)
981  fault_status = (ULONG *)&RetVal;
982  else if (comm_fault_offsets->FaultOffset >= 0)
983  fault_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->FaultOffset);
984  else
985  fault_status = NULL;
986 
987  NdrMapCommAndFaultStatus(&stubMsg, comm_status, fault_status,
988  GetExceptionCode());
989  }
990  __ENDTRY
991  }
992  else
993  {
994  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
995  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
996  number_of_params, Oif_flags, ext_flags, pProcHeader);
997  }
998 
999  TRACE("RetVal = 0x%lx\n", RetVal);
1000  return RetVal;
1001 }
unsigned short stack_size
Definition: ndr_stubless.h:93
void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal)
Definition: ndr_stubless.c:478
INTERPRETER_OPT_FLAGS2 Flags2
Definition: ndrtypes.h:99
INTERPRETER_OPT_FLAGS2 ext_flags
Definition: ndr_stubless.c:665
static size_t get_handle_desc_size(const NDR_PROC_HEADER *proc_header, PFORMAT_STRING format)
Definition: ndr_stubless.c:273
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
INTERPRETER_OPT_FLAGS Oi2Flags
Definition: ndr_stubless.h:107
unsigned short proc_num
Definition: ndr_stubless.h:67
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
Definition: cproxy.c:593
smooth NULL
Definition: ftsmooth.c:416
unsigned short proc_num
Definition: ndr_stubless.h:92
static jsval_t stack_top(script_ctx_t *ctx)
Definition: engine.c:104
#define __TRY
Definition: compat.h:80
PFORMAT_STRING convert_old_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned int stack_size, BOOL object_proc, void *buffer, unsigned int size, unsigned int *count)
Definition: ndr_stubless.c:590
#define GetExceptionCode()
Definition: exception.h:69
#define TRACE(s)
Definition: solgame.cpp:4
struct _NDR_PROC_HEADER NDR_PROC_HEADER
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
LONG MIDLVersion
Definition: rpcndr.h:378
struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
const COMM_FAULT_OFFSETS * CommFaultOffsets
Definition: rpcndr.h:379
#define __ENDTRY
Definition: compat.h:82
unsigned char Oi_flags
Definition: ndr_stubless.h:64
unsigned short stack_size
Definition: ndr_stubless.h:71
static const char * debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
Definition: ndr_stubless.c:255
struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
unsigned char * StackTop
Definition: rpcndr.h:226
ULONG Version
Definition: rpcndr.h:376
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define Oi_HAS_COMM_OR_FAULT
Definition: ndrtypes.h:295
unsigned int ULONG
Definition: retypes.h:1
static LONG_PTR do_ndr_client_call(const MIDL_STUB_DESC *stub_desc, const PFORMAT_STRING format, const PFORMAT_STRING handle_format, void **stack_top, void **fpu_stack, MIDL_STUB_MESSAGE *stub_msg, unsigned short procedure_number, unsigned short stack_size, unsigned int number_of_params, INTERPRETER_OPT_FLAGS Oif_flags, INTERPRETER_OPT_FLAGS2 ext_flags, const NDR_PROC_HEADER *proc_header)
Definition: ndr_stubless.c:703
unsigned char HasExtensions
Definition: ndrtypes.h:68
RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus(PMIDL_STUB_MESSAGE pStubMsg, ULONG *pCommStatus, ULONG *pFaultStatus, RPC_STATUS Status)
#define ARG_FROM_OFFSET(args, offset)
Definition: ndr_stubless.c:271
static BOOL is_oicf_stubdesc(const PMIDL_STUB_DESC pStubDesc)
Definition: ndr_stubless.c:50
unsigned char Size
Definition: ndrtypes.h:97
INTERPRETER_OPT_FLAGS Oif_flags
Definition: ndr_stubless.c:664
#define __EXCEPT_ALL
Definition: exception.h:63

Referenced by NdrClientCall2().

◆ ndr_client_call_finally()

static void CALLBACK ndr_client_call_finally ( BOOL  normal,
void arg 
)
static

Definition at line 672 of file ndr_stubless.c.

673 {
674  struct ndr_client_call_ctx *ctx = arg;
675 
676  if (ctx->ext_flags.HasNewCorrDesc)
677  {
678  /* free extra correlation package */
679  NdrCorrelationFree(ctx->stub_msg);
680  }
681 
682  if (ctx->Oif_flags.HasPipes)
683  {
684  /* NdrPipesDone(...) */
685  }
686 
687  /* free the full pointer translation tables */
688  if (ctx->proc_header->Oi_flags & Oi_FULL_PTR_USED)
689  NdrFullPointerXlatFree(ctx->stub_msg->FullPtrXlatTables);
690 
691  /* free marshalling buffer */
692  if (ctx->proc_header->Oi_flags & Oi_OBJECT_PROC)
693  NdrProxyFreeBuffer(ctx->This, ctx->stub_msg);
694  else
695  {
696  NdrFreeBuffer(ctx->stub_msg);
697  client_free_handle(ctx->stub_msg, ctx->proc_header, ctx->handle_format, ctx->hbinding);
698  }
699 }
void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
void WINAPI NdrProxyFreeBuffer(void *This, PMIDL_STUB_MESSAGE pStubMsg)
Definition: cproxy.c:577
void * arg
Definition: msvc.h:10
static void client_free_handle(PMIDL_STUB_MESSAGE pStubMsg, const NDR_PROC_HEADER *pProcHeader, PFORMAT_STRING pFormat, handle_t hBinding)
Definition: ndr_stubless.c:379
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
void WINAPI NdrFreeBuffer(PMIDL_STUB_MESSAGE pStubMsg)
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)

Referenced by do_ndr_client_call().

◆ NdrAsyncClientCall()

CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall ( PMIDL_STUB_DESC  desc,
PFORMAT_STRING  format,
  ... 
)

Definition at line 1922 of file ndr_stubless.c.

1923 {
1925  LONG_PTR ret;
1926 
1928  ret = ndr_async_client_call( desc, format, va_arg( args, void ** ));
1929  __ms_va_end( args );
1930  return *(CLIENT_CALL_RETURN *)&ret;
1931 }
static static const char __ms_va_list
Definition: printf.c:76
Definition: match.c:390
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static const WCHAR desc[]
Definition: protectdata.c:36
LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top)
int ret
#define va_arg(ap, T)
Definition: acmsvcex.h:89
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define __ms_va_end(list)
Definition: windef.h:458
#define __ms_va_start(list, arg)
Definition: windef.h:457
#define args
Definition: format.c:66

◆ NdrAsyncServerCall()

void RPC_ENTRY NdrAsyncServerCall ( PRPC_MESSAGE  pRpcMsg)

Definition at line 1943 of file ndr_stubless.c.

1944 {
1945  const MIDL_SERVER_INFO *pServerInfo;
1946  const MIDL_STUB_DESC *pStubDesc;
1947  PFORMAT_STRING pFormat;
1948  /* pointer to start of stack to pass into stub implementation */
1949  unsigned char *args;
1950  /* header for procedure string */
1951  const NDR_PROC_HEADER *pProcHeader;
1953  PRPC_ASYNC_STATE pAsync;
1955 
1956  TRACE("%p\n", pRpcMsg);
1957 
1958  pServerInfo = ((RPC_SERVER_INTERFACE *)pRpcMsg->RpcInterfaceInformation)->InterpreterInfo;
1959 
1960  pStubDesc = pServerInfo->pStubDesc;
1961  pFormat = pServerInfo->ProcString + pServerInfo->FmtStringOffset[pRpcMsg->ProcNum];
1962  pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1963 
1964  TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
1965 
1969 
1971  *(PRPC_MESSAGE)(async_call_data->pStubMsg + 1) = *pRpcMsg;
1972 
1974  {
1975  const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
1976  async_call_data->stack_size = header_rpc->stack_size;
1977  pFormat += sizeof(NDR_PROC_HEADER_RPC);
1978  }
1979  else
1980  {
1982  pFormat += sizeof(NDR_PROC_HEADER);
1983  }
1984 
1985  TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
1986 
1987  /* binding */
1988  switch (pProcHeader->handle_type)
1989  {
1990  /* explicit binding: parse additional section */
1991  case 0:
1992  switch (*pFormat) /* handle_type */
1993  {
1994  case FC_BIND_PRIMITIVE: /* explicit primitive */
1995  pFormat += sizeof(NDR_EHD_PRIMITIVE);
1996  break;
1997  case FC_BIND_GENERIC: /* explicit generic */
1998  pFormat += sizeof(NDR_EHD_GENERIC);
1999  break;
2000  case FC_BIND_CONTEXT: /* explicit context */
2001  pFormat += sizeof(NDR_EHD_CONTEXT);
2002  break;
2003  default:
2004  ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
2006  }
2007  break;
2008  case FC_BIND_GENERIC: /* implicit generic */
2009  case FC_BIND_PRIMITIVE: /* implicit primitive */
2010  case FC_CALLBACK_HANDLE: /* implicit callback */
2011  case FC_AUTO_HANDLE: /* implicit auto handle */
2012  break;
2013  default:
2014  ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
2016  }
2017 
2019  {
2020  ERR("objects not supported\n");
2023  }
2024 
2025  NdrServerInitializeNew(pRpcMsg, async_call_data->pStubMsg, pStubDesc);
2026 
2027  /* create the full pointer translation tables, if requested */
2030 
2031  /* use alternate memory allocation routines */
2033 #if 0
2034  NdrRpcSsEnableAllocate(&stubMsg);
2035 #else
2036  FIXME("Set RPCSS memory allocation routines\n");
2037 #endif
2038 
2039  TRACE("allocating memory for stack of size %x\n", async_call_data->stack_size);
2040 
2042  async_call_data->pStubMsg->StackTop = args; /* used by conformance of top-level objects */
2043 
2044  pAsync = I_RpcAllocate(sizeof(*pAsync));
2045  if (!pAsync) RpcRaiseException(RPC_X_NO_MEMORY);
2046 
2047  status = RpcAsyncInitializeHandle(pAsync, sizeof(*pAsync));
2048  if (status != RPC_S_OK)
2050 
2051  pAsync->StubInfo = async_call_data;
2052  TRACE("pAsync %p, pAsync->StubInfo %p, pFormat %p\n", pAsync, pAsync->StubInfo, async_call_data->pHandleFormat);
2053 
2054  /* add the implicit pAsync pointer as the first arg to the function */
2055  *(void **)args = pAsync;
2056 
2057  if (is_oicf_stubdesc(pStubDesc))
2058  {
2059  const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
2060  /* cache of Oif_flags from v2 procedure header */
2061  INTERPRETER_OPT_FLAGS Oif_flags;
2062  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
2063  INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
2064 
2065  Oif_flags = pOIFHeader->Oi2Flags;
2067 
2068  pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER);
2069 
2070  TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) );
2071 
2072  if (Oif_flags.HasExtensions)
2073  {
2074  const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat;
2075  ext_flags = pExtensions->Flags2;
2076  pFormat += pExtensions->Size;
2077  }
2078 
2079  if (Oif_flags.HasPipes)
2080  {
2081  FIXME("pipes not supported yet\n");
2082  RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */
2083  /* init pipes package */
2084  /* NdrPipesInitialize(...) */
2085  }
2086  if (ext_flags.HasNewCorrDesc)
2087  {
2088  /* initialize extra correlation package */
2090  if (ext_flags.Unused & 0x2) /* has range on conformance */
2092  }
2093  }
2094  else
2095  {
2098  /* reuse the correlation cache, it's not needed for v1 format */
2100  }
2101 
2102  /* convert strings, floating point values and endianness into our
2103  * preferred format */
2104  if ((pRpcMsg->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
2105  NdrConvert(async_call_data->pStubMsg, pFormat);
2106 
2107  async_call_data->pHandleFormat = pFormat;
2108 
2109  /* 1. UNMARSHAL */
2110  TRACE("UNMARSHAL\n");
2112 
2113  /* 2. INITOUT */
2114  TRACE("INITOUT\n");
2116 
2117  /* 3. CALLSERVER */
2118  TRACE("CALLSERVER\n");
2119  if (pServerInfo->ThunkTable && pServerInfo->ThunkTable[pRpcMsg->ProcNum])
2120  pServerInfo->ThunkTable[pRpcMsg->ProcNum](async_call_data->pStubMsg);
2121  else
2123 }
unsigned short stack_size
Definition: ndr_stubless.h:93
void * RpcInterfaceInformation
Definition: rpcdcep.h:44
#define RPC_X_NO_MEMORY
Definition: rpcnterr.h:35
ULONG_PTR NdrCorrCache[256]
Definition: ndr_stubless.h:243
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
struct _NDR_EHD_GENERIC NDR_EHD_GENERIC
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
INTERPRETER_OPT_FLAGS2 Flags2
Definition: ndrtypes.h:99
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const SERVER_ROUTINE * DispatchTable
Definition: rpcndr.h:422
unsigned char *WINAPI NdrServerInitializeNew(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc)
const unsigned short * FmtStringOffset
Definition: rpcndr.h:424
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
unsigned char Unused
Definition: ndrtypes.h:89
void WINAPI NdrConvert(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define Oi_RPCSS_ALLOC_USED
Definition: ndrtypes.h:291
unsigned int number_of_params
Definition: ndr_stubless.h:239
Definition: match.c:390
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI RpcAsyncInitializeHandle(PRPC_ASYNC_STATE pAsync, unsigned int Size)
Definition: rpc_async.c:57
void * StubInfo
Definition: rpcasync.h:150
PFORMAT_STRING ProcString
Definition: rpcndr.h:423
struct _RPC_MESSAGE * PRPC_MESSAGE
#define FIXME(fmt,...)
Definition: debug.h:111
INTERPRETER_OPT_FLAGS Oi2Flags
Definition: ndr_stubless.h:107
unsigned int ProcNum
Definition: rpcdcep.h:42
LONG_PTR * retval_ptr
Definition: ndr_stubless.h:241
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
PFORMAT_STRING convert_old_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned int stack_size, BOOL object_proc, void *buffer, unsigned int size, unsigned int *count)
Definition: ndr_stubless.c:590
struct _NDR_EHD_CONTEXT NDR_EHD_CONTEXT
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned char handle_type
Definition: ndr_stubless.h:43
struct _NDR_PROC_HEADER NDR_PROC_HEADER
unsigned char HasPipes
Definition: ndrtypes.h:64
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short stack_size
Definition: ndr_stubless.h:237
struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
unsigned char HasNewCorrDesc
Definition: ndrtypes.h:76
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
const STUB_THUNK * ThunkTable
Definition: rpcndr.h:425
static LONG_PTR * stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params)
unsigned char Oi_flags
Definition: ndr_stubless.h:64
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short stack_size
Definition: ndr_stubless.h:71
RPCRTAPI void RPC_ENTRY NdrRpcSsEnableAllocate(PMIDL_STUB_MESSAGE pMessage)
static const char * debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
Definition: ndr_stubless.c:255
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers, XLAT_SIDE XlatSide)
struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
unsigned char * StackTop
Definition: rpcndr.h:226
ULONG Version
Definition: rpcndr.h:376
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
#define RPC_X_WRONG_STUB_VERSION
Definition: winerror.h:1136
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
unsigned char CorrDespIncrement
Definition: rpcndr.h:218
struct _NDR_EHD_PRIMITIVE NDR_EHD_PRIMITIVE
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
PMIDL_STUB_DESC pStubDesc
Definition: rpcndr.h:421
LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char *args, unsigned short stack_size)
unsigned char HasExtensions
Definition: ndrtypes.h:68
struct _MIDL_STUB_MESSAGE * PMIDL_STUB_MESSAGE
ULONG DataRepresentation
Definition: rpcdcep.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define args
Definition: format.c:66
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714
static BOOL is_oicf_stubdesc(const PMIDL_STUB_DESC pStubDesc)
Definition: ndr_stubless.c:50
#define RPC_S_OK
Definition: rpcnterr.h:22
unsigned char Size
Definition: ndrtypes.h:97
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233
Definition: ps.c:97

◆ NdrAsyncStubCall()

RPCRTAPI LONG RPC_ENTRY NdrAsyncStubCall ( struct IRpcStubBuffer pThis,
struct IRpcChannelBuffer pChannel,
PRPC_MESSAGE  pRpcMsg,
DWORD pdwStubPhase 
)

Definition at line 1935 of file ndr_stubless.c.

1938 {
1939  FIXME("unimplemented, expect crash!\n");
1940  return 0;
1941 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ NdrClientCall2()

CLIENT_CALL_RETURN WINAPIV NdrClientCall2 ( PMIDL_STUB_DESC  desc,
PFORMAT_STRING  format,
  ... 
)

Definition at line 1022 of file ndr_stubless.c.

1023 {
1025  LONG_PTR ret;
1026 
1028  ret = ndr_client_call( desc, format, va_arg( args, void ** ), NULL );
1029  __ms_va_end( args );
1030  return *(CLIENT_CALL_RETURN *)&ret;
1031 }
static static const char __ms_va_list
Definition: printf.c:76
Definition: match.c:390
LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top, void **fpu_stack)
Definition: ndr_stubless.c:850
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
int ret
#define va_arg(ap, T)
Definition: acmsvcex.h:89
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define __ms_va_end(list)
Definition: windef.h:458
#define __ms_va_start(list, arg)
Definition: windef.h:457
#define args
Definition: format.c:66

◆ NdrpCompleteAsyncClientCall()

RPC_STATUS NdrpCompleteAsyncClientCall ( RPC_ASYNC_STATE pAsync,
void Reply 
)

Definition at line 1821 of file ndr_stubless.c.

1822 {
1823  /* pointer to start of stack where arguments start */
1826  /* header for procedure string */
1827  const NDR_PROC_HEADER * pProcHeader;
1829 
1830  if (!pAsync->StubInfo)
1832 
1833  async_call_data = pAsync->StubInfo;
1836 
1837  /* order of phases:
1838  * 1. CALCSIZE - calculate the buffer size
1839  * 2. GETBUFFER - allocate the buffer
1840  * 3. MARSHAL - marshal [in] params into the buffer
1841  * 4. SENDRECEIVE - send buffer
1842  * Then in NdrpCompleteAsyncClientCall:
1843  * 1. SENDRECEIVE - receive buffer
1844  * 2. UNMARSHAL - unmarshal [out] params from buffer
1845  */
1846 
1847  /* 1. SENDRECEIVE */
1848  TRACE( "RECEIVE\n" );
1850  /* receive the [out] params */
1852 #if 0
1853  NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
1854 #else
1855  FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
1856 #endif
1857  else
1858  {
1860  if (status != RPC_S_OK)
1861  goto cleanup;
1866  }
1867 
1868  /* convert strings, floating point values and endianness into our
1869  * preferred format */
1870 #if 0
1872  NdrConvert(pStubMsg, pFormat);
1873 #endif
1874 
1875  /* 2. UNMARSHAL */
1876  TRACE( "UNMARSHAL\n" );
1879 
1880 cleanup:
1882  {
1883  /* free extra correlation package */
1885  }
1886 
1887  /* free the full pointer translation tables */
1890 
1891  /* free marshalling buffer */
1894 
1897 
1898  TRACE("-- 0x%x\n", status);
1899  return status;
1900 }
void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal)
Definition: ndr_stubless.c:478
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
unsigned char * Buffer
Definition: rpcndr.h:203
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
void WINAPI NdrConvert(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
unsigned int number_of_params
Definition: ndr_stubless.h:239
RPC_BINDING_HANDLE hBinding
Definition: ndr_stubless.h:235
unsigned int BufferLength
Definition: rpcdcep.h:41
static void client_free_handle(PMIDL_STUB_MESSAGE pStubMsg, const NDR_PROC_HEADER *pProcHeader, PFORMAT_STRING pFormat, handle_t hBinding)
Definition: ndr_stubless.c:379
long RPC_STATUS
Definition: rpc.h:52
void * Buffer
Definition: rpcdcep.h:40
void * StubInfo
Definition: rpcasync.h:150
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
unsigned int fHasNewCorrDesc
Definition: rpcndr.h:239
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char handle_type
Definition: ndr_stubless.h:43
ULONG RpcFlags
Definition: rpcdcep.h:48
#define RPC_BUFFER_ASYNC
Definition: rpcdcep.h:70
unsigned char * BufferStart
Definition: rpcndr.h:204
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char * BufferEnd
Definition: rpcndr.h:205
unsigned char Oi_flags
Definition: ndr_stubless.h:64
PFORMAT_STRING pParamFormat
Definition: ndr_stubless.h:234
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
void WINAPI NdrFreeBuffer(PMIDL_STUB_MESSAGE pStubMsg)
unsigned char * StackTop
Definition: rpcndr.h:226
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
char * cleanup(char *str)
Definition: wpickclick.c:99
ULONG DataRepresentation
Definition: rpcdcep.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_INVALID_ASYNC_HANDLE
Definition: winerror.h:1156
#define RPC_S_OK
Definition: rpcnterr.h:22
RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1857
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233
Definition: ps.c:97

Referenced by RpcAsyncCompleteCall().

◆ NdrpCompleteAsyncServerCall()

RPC_STATUS NdrpCompleteAsyncServerCall ( RPC_ASYNC_STATE pAsync,
void Reply 
)

Definition at line 2125 of file ndr_stubless.c.

2126 {
2127  /* pointer to start of stack where arguments start */
2130  /* the type of pass we are currently doing */
2131  enum stubless_phase phase;
2133 
2134  if (!pAsync->StubInfo)
2136 
2137  async_call_data = pAsync->StubInfo;
2139 
2140  TRACE("pAsync %p, pAsync->StubInfo %p, pFormat %p\n", pAsync, pAsync->StubInfo, async_call_data->pHandleFormat);
2141 
2143  {
2144  TRACE("stub implementation returned 0x%lx\n", *(LONG_PTR *)Reply);
2145  *async_call_data->retval_ptr = *(LONG_PTR *)Reply;
2146  }
2147  else
2148  TRACE("void stub implementation\n");
2149 
2150  for (phase = STUBLESS_CALCSIZE; phase <= STUBLESS_FREE; phase++)
2151  {
2152  TRACE("phase = %d\n", phase);
2153  switch (phase)
2154  {
2155  case STUBLESS_GETBUFFER:
2157  {
2158  ERR("objects not supported\n");
2161  I_RpcFree(pAsync);
2163  }
2164  else
2165  {
2167  /* allocate buffer for [out] and [ret] params */
2169  if (status)
2172  }
2173  break;
2174 
2175  case STUBLESS_CALCSIZE:
2176  case STUBLESS_MARSHAL:
2177  case STUBLESS_MUSTFREE:
2178  case STUBLESS_FREE:
2180  break;
2181  default:
2182  ERR("shouldn't reach here. phase %d\n", phase);
2183  break;
2184  }
2185  }
2186 
2187 #if 0 /* FIXME */
2188  if (ext_flags.HasNewCorrDesc)
2189  {
2190  /* free extra correlation package */
2192  }
2193 
2194  if (Oif_flags.HasPipes)
2195  {
2196  /* NdrPipesDone(...) */
2197  }
2198 
2199  /* free the full pointer translation tables */
2202 #endif
2203 
2204  /* free server function stack */
2207  I_RpcFree(pAsync);
2208 
2209  return S_OK;
2210 }
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
unsigned char * Buffer
Definition: rpcndr.h:203
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1638
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
unsigned int number_of_params
Definition: ndr_stubless.h:239
unsigned int BufferLength
Definition: rpcdcep.h:41
long RPC_STATUS
Definition: rpc.h:52
void * Buffer
Definition: rpcdcep.h:40
void * StubInfo
Definition: rpcasync.h:150
LONG_PTR * retval_ptr
Definition: ndr_stubless.h:241
stubless_phase
Definition: ndr_stubless.h:246
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
ULONG BufferLength
Definition: rpcndr.h:207
static LONG_PTR * stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params)
unsigned char Oi_flags
Definition: ndr_stubless.h:64
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
unsigned char * StackTop
Definition: rpcndr.h:226
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RPC_S_INVALID_ASYNC_HANDLE
Definition: winerror.h:1156
#define RPC_S_OK
Definition: rpcnterr.h:22
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233
Definition: ps.c:97

Referenced by RpcAsyncCompleteCall().

◆ NdrRpcSmSetClientToOsf()

void WINAPI NdrRpcSmSetClientToOsf ( PMIDL_STUB_MESSAGE  pMessage)

Definition at line 226 of file ndr_stubless.c.

227 {
228 #if 0 /* these functions are not defined yet */
229  pMessage->pfnAllocate = NdrRpcSmClientAllocate;
230  pMessage->pfnFree = NdrRpcSmClientFree;
231 #endif
232 }
RPCRTAPI void RPC_ENTRY NdrRpcSmClientFree(void *NodeToFree)
RPCRTAPI void *RPC_ENTRY NdrRpcSmClientAllocate(SIZE_T Size) __WINE_ALLOC_SIZE(1)

Referenced by do_ndr_async_client_call(), and do_ndr_client_call().

◆ NdrServerCall()

void WINAPI NdrServerCall ( PRPC_MESSAGE  msg)

Definition at line 1581 of file ndr_stubless.c.

1582 {
1583  DWORD phase;
1584  NdrStubCall( NULL, NULL, msg, &phase );
1585 }
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define msg(x)
Definition: auth_time.c:54
LONG WINAPI NdrStubCall(struct IRpcStubBuffer *This, struct IRpcChannelBuffer *channel, PRPC_MESSAGE msg, DWORD *phase)

◆ NdrServerCall2()

void WINAPI NdrServerCall2 ( PRPC_MESSAGE  pRpcMsg)

Definition at line 1563 of file ndr_stubless.c.

1564 {
1565  DWORD dwPhase;
1566  NdrStubCall2(NULL, NULL, pRpcMsg, &dwPhase);
1567 }
LONG WINAPI NdrStubCall2(struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ NdrServerCallAll()

void WINAPI NdrServerCallAll ( PRPC_MESSAGE  msg)

Definition at line 1590 of file ndr_stubless.c.

1591 {
1592  FIXME("%p stub\n", msg);
1593 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define msg(x)
Definition: auth_time.c:54

◆ NdrStubCall()

LONG WINAPI NdrStubCall ( struct IRpcStubBuffer This,
struct IRpcChannelBuffer channel,
PRPC_MESSAGE  msg,
DWORD phase 
)

Definition at line 1572 of file ndr_stubless.c.

1574 {
1575  return NdrStubCall2( This, channel, msg, phase );
1576 }
LONG WINAPI NdrStubCall2(struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
#define msg(x)
Definition: auth_time.c:54

Referenced by NdrServerCall().

◆ NdrStubCall2()

LONG WINAPI NdrStubCall2 ( struct IRpcStubBuffer pThis,
struct IRpcChannelBuffer pChannel,
PRPC_MESSAGE  pRpcMsg,
DWORD pdwStubPhase 
)

Definition at line 1305 of file ndr_stubless.c.

1310 {
1311  const MIDL_SERVER_INFO *pServerInfo;
1312  const MIDL_STUB_DESC *pStubDesc;
1313  PFORMAT_STRING pFormat;
1314  MIDL_STUB_MESSAGE stubMsg;
1315  /* pointer to start of stack to pass into stub implementation */
1316  unsigned char * args;
1317  /* size of stack */
1318  unsigned short stack_size;
1319  /* number of parameters. optional for client to give it to us */
1320  unsigned int number_of_params;
1321  /* cache of Oif_flags from v2 procedure header */
1322  INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
1323  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1324  INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
1325  /* the type of pass we are currently doing */
1326  enum stubless_phase phase;
1327  /* header for procedure string */
1329  /* location to put retval into */
1331  /* correlation cache */
1332  ULONG_PTR NdrCorrCache[256];
1333 
1334  TRACE("pThis %p, pChannel %p, pRpcMsg %p, pdwStubPhase %p\n", pThis, pChannel, pRpcMsg, pdwStubPhase);
1335 
1336  if (pThis)
1337  pServerInfo = CStdStubBuffer_GetServerInfo(pThis);
1338  else
1339  pServerInfo = ((RPC_SERVER_INTERFACE *)pRpcMsg->RpcInterfaceInformation)->InterpreterInfo;
1340 
1341  pStubDesc = pServerInfo->pStubDesc;
1342  pFormat = pServerInfo->ProcString + pServerInfo->FmtStringOffset[pRpcMsg->ProcNum];
1343  pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1344 
1345  TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
1346 
1348  {
1349  const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
1350  stack_size = header_rpc->stack_size;
1351  pFormat += sizeof(NDR_PROC_HEADER_RPC);
1352 
1353  }
1354  else
1355  {
1357  pFormat += sizeof(NDR_PROC_HEADER);
1358  }
1359 
1360  TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
1361 
1362  /* binding */
1363  switch (pProcHeader->handle_type)
1364  {
1365  /* explicit binding: parse additional section */
1366  case 0:
1367  switch (*pFormat) /* handle_type */
1368  {
1369  case FC_BIND_PRIMITIVE: /* explicit primitive */
1370  pFormat += sizeof(NDR_EHD_PRIMITIVE);
1371  break;
1372  case FC_BIND_GENERIC: /* explicit generic */
1373  pFormat += sizeof(NDR_EHD_GENERIC);
1374  break;
1375  case FC_BIND_CONTEXT: /* explicit context */
1376  pFormat += sizeof(NDR_EHD_CONTEXT);
1377  break;
1378  default:
1379  ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
1381  }
1382  break;
1383  case FC_BIND_GENERIC: /* implicit generic */
1384  case FC_BIND_PRIMITIVE: /* implicit primitive */
1385  case FC_CALLBACK_HANDLE: /* implicit callback */
1386  case FC_AUTO_HANDLE: /* implicit auto handle */
1387  break;
1388  default:
1389  ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
1391  }
1392 
1394  NdrStubInitialize(pRpcMsg, &stubMsg, pStubDesc, pChannel);
1395  else
1396  NdrServerInitializeNew(pRpcMsg, &stubMsg, pStubDesc);
1397 
1398  /* create the full pointer translation tables, if requested */
1401 
1402  /* store the RPC flags away */
1404  pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags;
1405 
1406  /* use alternate memory allocation routines */
1408 #if 0
1409  NdrRpcSsEnableAllocate(&stubMsg);
1410 #else
1411  FIXME("Set RPCSS memory allocation routines\n");
1412 #endif
1413 
1414  TRACE("allocating memory for stack of size %x\n", stack_size);
1415 
1417  stubMsg.StackTop = args; /* used by conformance of top-level objects */
1418 
1419  /* add the implicit This pointer as the first arg to the function if we
1420  * are calling an object method */
1421  if (pThis)
1422  *(void **)args = ((CStdStubBuffer *)pThis)->pvServerObject;
1423 
1424  if (is_oicf_stubdesc(pStubDesc))
1425  {
1426  const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
1427 
1428  Oif_flags = pOIFHeader->Oi2Flags;
1429  number_of_params = pOIFHeader->number_of_params;
1430 
1431  pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER);
1432 
1433  TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) );
1434 
1435  if (Oif_flags.HasExtensions)
1436  {
1437  const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat;
1438  ext_flags = pExtensions->Flags2;
1439  pFormat += pExtensions->Size;
1440  }
1441 
1442  if (Oif_flags.HasPipes)
1443  {
1444  FIXME("pipes not supported yet\n");
1445  RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */
1446  /* init pipes package */
1447  /* NdrPipesInitialize(...) */
1448  }
1449  if (ext_flags.HasNewCorrDesc)
1450  {
1451  /* initialize extra correlation package */
1452  NdrCorrelationInitialize(&stubMsg, NdrCorrCache, sizeof(NdrCorrCache), 0);
1453  if (ext_flags.Unused & 0x2) /* has range on conformance */
1454  stubMsg.CorrDespIncrement = 12;
1455  }
1456  }
1457  else
1458  {
1459  pFormat = convert_old_args( &stubMsg, pFormat, stack_size,
1461  /* reuse the correlation cache, it's not needed for v1 format */
1463  }
1464 
1465  /* convert strings, floating point values and endianness into our
1466  * preferred format */
1467  if ((pRpcMsg->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
1468  NdrConvert(&stubMsg, pFormat);
1469 
1470  for (phase = STUBLESS_UNMARSHAL; phase <= STUBLESS_FREE; phase++)
1471  {
1472  TRACE("phase = %d\n", phase);
1473  switch (phase)
1474  {
1475  case STUBLESS_CALLSERVER:
1476  /* call the server function */
1477  if (pServerInfo->ThunkTable && pServerInfo->ThunkTable[pRpcMsg->ProcNum])
1478  pServerInfo->ThunkTable[pRpcMsg->ProcNum](&stubMsg);
1479  else
1480  {
1482  LONG_PTR retval;
1483 
1485  {
1486  SERVER_ROUTINE *vtbl = *(SERVER_ROUTINE **)((CStdStubBuffer *)pThis)->pvServerObject;
1487  func = vtbl[pRpcMsg->ProcNum];
1488  }
1489  else
1490  func = pServerInfo->DispatchTable[pRpcMsg->ProcNum];
1491 
1492  /* FIXME: what happens with return values that don't fit into a single register on x86? */
1493  retval = call_server_func(func, args, stack_size);
1494 
1495  if (retval_ptr)
1496  {
1497  TRACE("stub implementation returned 0x%lx\n", retval);
1498  *retval_ptr = retval;
1499  }
1500  else
1501  TRACE("void stub implementation\n");
1502  }
1503 
1504  stubMsg.Buffer = NULL;
1505  stubMsg.BufferLength = 0;
1506 
1507  break;
1508  case STUBLESS_GETBUFFER:
1510  NdrStubGetBuffer(pThis, pChannel, &stubMsg);
1511  else
1512  {
1514 
1515  pRpcMsg->BufferLength = stubMsg.BufferLength;
1516  /* allocate buffer for [out] and [ret] params */
1517  Status = I_RpcGetBuffer(pRpcMsg);
1518  if (Status)
1520  stubMsg.Buffer = pRpcMsg->Buffer;
1521  }
1522  break;
1523  case STUBLESS_UNMARSHAL:
1524  case STUBLESS_INITOUT:
1525  case STUBLESS_CALCSIZE:
1526  case STUBLESS_MARSHAL:
1527  case STUBLESS_MUSTFREE:
1528  case STUBLESS_FREE:
1529  retval_ptr = stub_do_args(&stubMsg, pFormat, phase, number_of_params);
1530  break;
1531  default:
1532  ERR("shouldn't reach here. phase %d\n", phase);
1533  break;
1534  }
1535  }
1536 
1537  pRpcMsg->BufferLength = (unsigned int)(stubMsg.Buffer - (unsigned char *)pRpcMsg->Buffer);
1538 
1539  if (ext_flags.HasNewCorrDesc)
1540  {
1541  /* free extra correlation package */
1542  NdrCorrelationFree(&stubMsg);
1543  }
1544 
1545  if (Oif_flags.HasPipes)
1546  {
1547  /* NdrPipesDone(...) */
1548  }
1549 
1550  /* free the full pointer translation tables */
1553 
1554  /* free server function stack */
1555  HeapFree(GetProcessHeap(), 0, args);
1556 
1557  return S_OK;
1558 }
GLenum func
Definition: glext.h:6028
unsigned short stack_size
Definition: ndr_stubless.h:93
void * RpcInterfaceInformation
Definition: rpcdcep.h:44
ULONG_PTR NdrCorrCache[256]
Definition: ndr_stubless.h:243
struct _NDR_EHD_GENERIC NDR_EHD_GENERIC
const MIDL_SERVER_INFO * CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface) DECLSPEC_HIDDEN
Definition: cstub.c:615
void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
INTERPRETER_OPT_FLAGS2 Flags2
Definition: ndrtypes.h:99
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
const SERVER_ROUTINE * DispatchTable
Definition: rpcndr.h:422
unsigned char *WINAPI NdrServerInitializeNew(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc)
unsigned char * Buffer
Definition: rpcndr.h:203
const unsigned short * FmtStringOffset
Definition: rpcndr.h:424
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
unsigned char Unused
Definition: ndrtypes.h:89
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1638
void WINAPI NdrConvert(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define Oi_RPCSS_ALLOC_USED
Definition: ndrtypes.h:291
unsigned int number_of_params
Definition: ndr_stubless.h:239
Definition: match.c:390
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned int BufferLength
Definition: rpcdcep.h:41
long RPC_STATUS
Definition: rpc.h:52
void * Buffer
Definition: rpcdcep.h:40
PFORMAT_STRING ProcString
Definition: rpcndr.h:423
#define FIXME(fmt,...)
Definition: debug.h:111
INTERPRETER_OPT_FLAGS Oi2Flags
Definition: ndr_stubless.h:107
unsigned int ProcNum
Definition: rpcdcep.h:42
void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDescriptor, LPRPCCHANNELBUFFER pRpcChannelBuffer)
Definition: cstub.c:638
LONG_PTR * retval_ptr
Definition: ndr_stubless.h:241
smooth NULL
Definition: ftsmooth.c:416
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
stubless_phase
Definition: ndr_stubless.h:246
void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface, LPRPCCHANNELBUFFER pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg)
Definition: cstub.c:654
#define Oi_FULL_PTR_USED
Definition: ndrtypes.h:290
PFORMAT_STRING convert_old_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned int stack_size, BOOL object_proc, void *buffer, unsigned int size, unsigned int *count)
Definition: ndr_stubless.c:590
struct _NDR_EHD_CONTEXT NDR_EHD_CONTEXT
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned char handle_type
Definition: ndr_stubless.h:43
struct _NDR_PROC_HEADER NDR_PROC_HEADER
unsigned char HasPipes
Definition: ndrtypes.h:64
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
ULONG RpcFlags
Definition: rpcdcep.h:48
unsigned short stack_size
Definition: ndr_stubless.h:237
struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
unsigned char HasNewCorrDesc
Definition: ndrtypes.h:76
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
ULONG BufferLength
Definition: rpcndr.h:207
Status
Definition: gdiplustypes.h:24
const STUB_THUNK * ThunkTable
Definition: rpcndr.h:425
static LONG_PTR * stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params)
unsigned char Oi_flags
Definition: ndr_stubless.h:64
LONG(__RPC_API * SERVER_ROUTINE)()
Definition: rpcndr.h:416
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short stack_size
Definition: ndr_stubless.h:71
RPCRTAPI void RPC_ENTRY NdrRpcSsEnableAllocate(PMIDL_STUB_MESSAGE pMessage)
#define S_OK
Definition: intsafe.h:51
static const char * debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
Definition: ndr_stubless.c:255
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers, XLAT_SIDE XlatSide)
struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
unsigned char * StackTop
Definition: rpcndr.h:226
ULONG Version
Definition: rpcndr.h:376
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
#define RPC_X_WRONG_STUB_VERSION
Definition: winerror.h:1136
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
unsigned char CorrDespIncrement
Definition: rpcndr.h:218
struct _NDR_EHD_PRIMITIVE NDR_EHD_PRIMITIVE
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
PMIDL_STUB_DESC pStubDesc
Definition: rpcndr.h:421
LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char *args, unsigned short stack_size)
unsigned char HasExtensions
Definition: ndrtypes.h:68
ULONG DataRepresentation
Definition: rpcdcep.h:39
#define args
Definition: format.c:66
#define HeapFree(x, y, z)
Definition: compat.h:594
static BOOL is_oicf_stubdesc(const PMIDL_STUB_DESC pStubDesc)
Definition: ndr_stubless.c:50
unsigned char Size
Definition: ndrtypes.h:97
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by CreateStubFromTypeInfo(), CStdStubBuffer_Invoke(), NdrServerCall2(), and NdrStubCall().

◆ param_is_out_basetype()

static BOOL param_is_out_basetype ( PARAM_ATTRIBUTES  attr)
inlinestatic

Definition at line 439 of file ndr_stubless.c.

440 {
441  return attr.IsOut && !attr.IsIn && attr.IsBasetype && attr.IsSimpleRef;
442 }
Definition: cookie.c:201

Referenced by client_do_args().

◆ param_needs_alloc()

static BOOL param_needs_alloc ( PARAM_ATTRIBUTES  attr)
inlinestatic

Definition at line 434 of file ndr_stubless.c.

435 {
436  return attr.IsOut && !attr.IsIn && !attr.IsBasetype && !attr.IsByValue;
437 }
Definition: cookie.c:201

Referenced by client_do_args(), and stub_do_args().

◆ stub_do_args()

static LONG_PTR* stub_do_args ( MIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING  pFormat,
enum stubless_phase  phase,
unsigned short  number_of_params 
)
static

Definition at line 1214 of file ndr_stubless.c.

1217 {
1218  const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat;
1219  unsigned int i;
1221 
1222  for (i = 0; i < number_of_params; i++)
1223  {
1224  unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset;
1225  const unsigned char *pTypeFormat = &pStubMsg->StubDesc->pFormatTypes[params[i].u.type_offset];
1226 
1227  TRACE("param[%d]: %p -> %p type %02x %s\n", i,
1228  pArg, *(unsigned char **)pArg,
1229  params[i].attr.IsBasetype ? params[i].u.type_format_char : *pTypeFormat,
1231 
1232  switch (phase)
1233  {
1234  case STUBLESS_MARSHAL:
1235  if (params[i].attr.IsOut || params[i].attr.IsReturn)
1236  call_marshaller(pStubMsg, pArg, &params[i]);
1237  break;
1238  case STUBLESS_MUSTFREE:
1239  if (params[i].attr.MustFree)
1240  {
1241  call_freer(pStubMsg, pArg, &params[i]);
1242  }
1243  break;
1244  case STUBLESS_FREE:
1245  if (params[i].attr.ServerAllocSize)
1246  {
1247  HeapFree(GetProcessHeap(), 0, *(void **)pArg);
1248  }
1249  else if (param_needs_alloc(params[i].attr) &&
1250  (!params[i].attr.MustFree || params[i].attr.IsSimpleRef))
1251  {
1252  if (*pTypeFormat != FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg);
1253  }
1254  break;
1255  case STUBLESS_INITOUT:
1256  if (param_needs_alloc(params[i].attr) && !params[i].attr.ServerAllocSize)
1257  {
1258  if (*pTypeFormat == FC_BIND_CONTEXT)
1259  {
1260  NDR_SCONTEXT ctxt = NdrContextHandleInitialize(pStubMsg, pTypeFormat);
1261  *(void **)pArg = NDRSContextValue(ctxt);
1262  if (params[i].attr.IsReturn) retval_ptr = (LONG_PTR *)NDRSContextValue(ctxt);
1263  }
1264  else
1265  {
1266  DWORD size = calc_arg_size(pStubMsg, pTypeFormat);
1267  if (size)
1268  {
1269  *(void **)pArg = NdrAllocate(pStubMsg, size);
1270  memset(*(void **)pArg, 0, size);
1271  }
1272  }
1273  }
1274  if (!retval_ptr && params[i].attr.IsReturn) retval_ptr = (LONG_PTR *)pArg;
1275  break;
1276  case STUBLESS_UNMARSHAL:
1277  if (params[i].attr.ServerAllocSize)
1278  *(void **)pArg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
1279  params[i].attr.ServerAllocSize * 8);
1280 
1281  if (params[i].attr.IsIn)
1282  call_unmarshaller(pStubMsg, &pArg, &params[i], 0);
1283  break;
1284  case STUBLESS_CALCSIZE:
1285  if (params[i].attr.IsOut || params[i].attr.IsReturn)
1286  call_buffer_sizer(pStubMsg, pArg, &params[i]);
1287  break;
1288  default:
1290  }
1291  TRACE("\tmemory addr (after): %p -> %p\n", pArg, *(unsigned char **)pArg);
1292  }
1293  return retval_ptr;
1294 }
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
static void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:55
#define NDRSContextValue(hContext)
Definition: rpcndr.h:150
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
static BOOL param_needs_alloc(PARAM_ATTRIBUTES attr)
Definition: ndr_stubless.c:434
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
unsigned int number_of_params
Definition: ndr_stubless.h:239
static void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:135
static unsigned char * call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:81
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
GLenum const GLfloat * params
Definition: glext.h:5645
void *WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
Definition: ndr_marshall.c:419
LONG_PTR * retval_ptr
Definition: ndr_stubless.h:241
smooth NULL
Definition: ftsmooth.c:416
static const char * debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes)
Definition: ndr_stubless.c:234
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: cookie.c:201
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
static unsigned char * call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, const NDR_PARAM_OIF *param, unsigned char fMustAlloc)
Definition: ndr_stubless.c:108
unsigned char * StackTop
Definition: rpcndr.h:226
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:594
static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:149

Referenced by NdrAsyncServerCall(), NdrpCompleteAsyncServerCall(), and NdrStubCall2().

◆ type_stack_size()

static unsigned int type_stack_size ( unsigned char  fc)
static

Definition at line 542 of file ndr_stubless.c.

543 {
544  switch (fc)
545  {
546  case FC_BYTE:
547  case FC_CHAR:
548  case FC_SMALL:
549  case FC_USMALL:
550  case FC_WCHAR:
551  case FC_SHORT:
552  case FC_USHORT:
553  case FC_LONG:
554  case FC_ULONG:
555  case FC_INT3264:
556  case FC_UINT3264:
557  case FC_ENUM16:
558  case FC_ENUM32:
559  case FC_FLOAT:
560  case FC_ERROR_STATUS_T:
561  case FC_IGNORE:
562  return sizeof(void *);
563  case FC_DOUBLE:
564  return sizeof(double);
565  case FC_HYPER:
566  return sizeof(ULONGLONG);
567  default:
568  ERR("invalid base type 0x%x\n", fc);
570  }
571 }
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
uint64_t ULONGLONG
Definition: typedefs.h:67
PFOR_CONTEXT fc
Definition: for.c:57
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
#define ERR(fmt,...)
Definition: debug.h:110

Referenced by convert_old_args().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( rpc  )