ReactOS  0.4.15-dev-1203-g0e5a4d5
ndr_stubless.h File Reference
#include "ndrtypes.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for ndr_stubless.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _NDR_PROC_HEADER
 
struct  _NDR_PROC_HEADER_RPC
 
struct  _NDR_PROC_PARTIAL_OIF_HEADER
 
struct  _NDR_PARAM_OI_BASETYPE
 
struct  _NDR_PARAM_OI_OTHER
 
struct  NDR_PARAM_OIF
 
struct  _NDR_EHD_PRIMITIVE
 
struct  _NDR_EHD_GENERIC
 
struct  _NDR_EHD_CONTEXT
 
struct  async_call_data
 

Typedefs

typedef struct _NDR_PROC_HEADER NDR_PROC_HEADER
 
typedef struct _NDR_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
 
typedef struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
 
typedef struct _NDR_PARAM_OI_BASETYPE NDR_PARAM_OI_BASETYPE
 
typedef struct _NDR_PARAM_OI_OTHER NDR_PARAM_OI_OTHER
 
typedef struct _NDR_EHD_PRIMITIVE NDR_EHD_PRIMITIVE
 
typedef struct _NDR_EHD_GENERIC NDR_EHD_GENERIC
 
typedef struct _NDR_EHD_CONTEXT NDR_EHD_CONTEXT
 

Enumerations

enum  stubless_phase {
  STUBLESS_UNMARSHAL, STUBLESS_INITOUT, STUBLESS_CALLSERVER, STUBLESS_CALCSIZE,
  STUBLESS_GETBUFFER, STUBLESS_MARSHAL, STUBLESS_MUSTFREE, STUBLESS_FREE
}
 

Functions

LONG_PTR CDECL ndr_client_call (PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top, void **fpu_stack) DECLSPEC_HIDDEN
 
LONG_PTR CDECL ndr_async_client_call (PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top) DECLSPEC_HIDDEN
 
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) DECLSPEC_HIDDEN
 
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) DECLSPEC_HIDDEN
 
RPC_STATUS NdrpCompleteAsyncClientCall (RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN
 
RPC_STATUS NdrpCompleteAsyncServerCall (RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ NDR_EHD_CONTEXT

◆ NDR_EHD_GENERIC

◆ NDR_EHD_PRIMITIVE

◆ NDR_PARAM_OI_BASETYPE

◆ NDR_PARAM_OI_OTHER

◆ NDR_PROC_HEADER

◆ NDR_PROC_HEADER_RPC

◆ NDR_PROC_PARTIAL_OIF_HEADER

Enumeration Type Documentation

◆ stubless_phase

Enumerator
STUBLESS_UNMARSHAL 
STUBLESS_INITOUT 
STUBLESS_CALLSERVER 
STUBLESS_CALCSIZE 
STUBLESS_GETBUFFER 
STUBLESS_MARSHAL 
STUBLESS_MUSTFREE 
STUBLESS_FREE 

Definition at line 246 of file ndr_stubless.h.

Function Documentation

◆ 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
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
#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
unsigned int number_of_params
Definition: ndr_stubless.h:239
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().

◆ 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 }
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
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
unsigned short stack_size
Definition: ndr_stubless.h:237
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().

◆ ndr_async_client_call()

LONG_PTR CDECL 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 
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
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
#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 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 */
862  INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
863  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
864  INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
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;
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 
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  {
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 */
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 
912  if (Oif_flags.HasExtensions)
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,
936  old_args, sizeof(old_args), &number_of_params );
937  }
938 
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  }
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
static size_t get_handle_desc_size(const NDR_PROC_HEADER *proc_header, PFORMAT_STRING format)
Definition: ndr_stubless.c:273
unsigned int number_of_params
Definition: ndr_stubless.h:239
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
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 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
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
#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
#define __EXCEPT_ALL
Definition: exception.h:63
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233

Referenced by NdrClientCall2().

◆ 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().