ReactOS  0.4.15-dev-489-g75a0787
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 474 of file ndr_stubless.c.

476 {
477  const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat;
478  unsigned int i;
479 
480  for (i = 0; i < number_of_params; i++)
481  {
482  unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset;
483  PFORMAT_STRING pTypeFormat = (PFORMAT_STRING)&pStubMsg->StubDesc->pFormatTypes[params[i].u.type_offset];
484 
485 #ifdef __x86_64__ /* floats are passed as doubles through varargs functions */
486  float f;
487 
488  if (params[i].attr.IsBasetype &&
489  params[i].u.type_format_char == FC_FLOAT &&
490  !params[i].attr.IsSimpleRef &&
491  !fpu_args)
492  {
493  f = *(double *)pArg;
494  pArg = (unsigned char *)&f;
495  }
496 #endif
497 
498  TRACE("param[%d]: %p type %02x %s\n", i, pArg,
499  params[i].attr.IsBasetype ? params[i].u.type_format_char : *pTypeFormat,
501 
502  switch (phase)
503  {
504  case STUBLESS_INITOUT:
505  if (*(unsigned char **)pArg)
506  {
508  memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat ));
509  else if (param_is_out_basetype(params[i].attr))
510  memset( *(unsigned char **)pArg, 0, basetype_arg_size( params[i].u.type_format_char ));
511  }
512  break;
513  case STUBLESS_CALCSIZE:
514  if (params[i].attr.IsSimpleRef && !*(unsigned char **)pArg)
516  if (params[i].attr.IsIn) call_buffer_sizer(pStubMsg, pArg, &params[i]);
517  break;
518  case STUBLESS_MARSHAL:
519  if (params[i].attr.IsIn) call_marshaller(pStubMsg, pArg, &params[i]);
520  break;
521  case STUBLESS_UNMARSHAL:
522  if (params[i].attr.IsOut)
523  {
524  if (params[i].attr.IsReturn && pRetVal) pArg = pRetVal;
525  call_unmarshaller(pStubMsg, &pArg, &params[i], 0);
526  }
527  break;
528  case STUBLESS_FREE:
529  if (!params[i].attr.IsBasetype && params[i].attr.IsOut && !params[i].attr.IsByValue)
530  NdrClearOutParameters( pStubMsg, pTypeFormat, *(unsigned char **)pArg );
531  break;
532  default:
534  }
535  }
536 }
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:435
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:430
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:440
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 586 of file ndr_stubless.c.

589 {
591  unsigned int i, stack_offset = object_proc ? sizeof(void *) : 0;
592 
593  for (i = 0; stack_offset < stack_size; i++)
594  {
595  const NDR_PARAM_OI_BASETYPE *param = (const NDR_PARAM_OI_BASETYPE *)pFormat;
596  const NDR_PARAM_OI_OTHER *other = (const NDR_PARAM_OI_OTHER *)pFormat;
597 
598  if (i + 1 > size / sizeof(*args))
599  {
600  FIXME( "%u args not supported\n", i );
602  }
603 
604  args[i].stack_offset = stack_offset;
605  memset( &args[i].attr, 0, sizeof(args[i].attr) );
606 
607  switch (param->param_direction)
608  {
610  args[i].attr.IsIn = 1;
611  args[i].attr.IsBasetype = 1;
612  break;
614  args[i].attr.IsOut = 1;
615  args[i].attr.IsReturn = 1;
616  args[i].attr.IsBasetype = 1;
617  break;
618  case FC_IN_PARAM:
619  args[i].attr.IsIn = 1;
620  args[i].attr.MustFree = 1;
621  break;
623  args[i].attr.IsIn = 1;
624  args[i].attr.IsDontCallFreeInst = 1;
625  break;
626  case FC_IN_OUT_PARAM:
627  args[i].attr.IsIn = 1;
628  args[i].attr.IsOut = 1;
629  args[i].attr.MustFree = 1;
630  break;
631  case FC_OUT_PARAM:
632  args[i].attr.IsOut = 1;
633  break;
634  case FC_RETURN_PARAM:
635  args[i].attr.IsOut = 1;
636  args[i].attr.IsReturn = 1;
637  break;
638  }
639  if (args[i].attr.IsBasetype)
640  {
641  args[i].u.type_format_char = param->type_format_char;
642  stack_offset += type_stack_size( param->type_format_char );
643  pFormat += sizeof(NDR_PARAM_OI_BASETYPE);
644  }
645  else
646  {
647  args[i].u.type_offset = other->type_offset;
648  args[i].attr.IsByValue = is_by_value( &pStubMsg->StubDesc->pFormatTypes[other->type_offset] );
649  stack_offset += other->stack_size * sizeof(void *);
650  pFormat += sizeof(NDR_PARAM_OI_OTHER);
651  }
652  }
653  *count = i;
654  return (PFORMAT_STRING)args;
655 }
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
static BOOL is_by_value(PFORMAT_STRING format)
Definition: ndr_stubless.c:569
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:538
#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 1789 of file ndr_stubless.c.

1791 {
1792  LONG_PTR ret = 0;
1793  const NDR_PROC_HEADER *pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1794 
1795  TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
1796 
1798  {
1799  __TRY
1800  {
1801  do_ndr_async_client_call( pStubDesc, pFormat, stack_top );
1802  }
1803  __EXCEPT_ALL
1804  {
1805  FIXME("exception %x during ndr_async_client_call()\n", GetExceptionCode());
1806  ret = GetExceptionCode();
1807  }
1808  __ENDTRY
1809  }
1810  else
1811  do_ndr_async_client_call( pStubDesc, pFormat, stack_top);
1812 
1813  TRACE("returning %ld\n", ret);
1814  return ret;
1815 }
#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:70
#define GetExceptionCode()
Definition: exception.h:69
#define TRACE(s)
Definition: solgame.cpp:4
#define __ENDTRY
Definition: compat.h:72
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 846 of file ndr_stubless.c.

848 {
849  /* pointer to start of stack where arguments start */
850  MIDL_STUB_MESSAGE stubMsg;
851  /* procedure number */
852  unsigned short procedure_number;
853  /* size of stack */
854  unsigned short stack_size;
855  /* number of parameters. optional for client to give it to us */
856  unsigned int number_of_params;
857  /* cache of Oif_flags from v2 procedure header */
858  INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
859  /* cache of extension flags from NDR_PROC_HEADER_EXTS */
860  INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
861  /* header for procedure string */
862  const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
863  /* the value to return to the client from the remote procedure */
864  LONG_PTR RetVal = 0;
866  NDR_PARAM_OIF old_args[256];
867 
868  TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
869 
870  TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
871 
873  {
874  const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
875  stack_size = header_rpc->stack_size;
876  procedure_number = header_rpc->proc_num;
877  pFormat += sizeof(NDR_PROC_HEADER_RPC);
878  }
879  else
880  {
882  procedure_number = pProcHeader->proc_num;
883  pFormat += sizeof(NDR_PROC_HEADER);
884  }
885  TRACE("stack size: 0x%x\n", stack_size);
886  TRACE("proc num: %d\n", procedure_number);
887  TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
888  TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
889 
890  pHandleFormat = pFormat;
891 
892  /* we only need a handle if this isn't an object method */
894  pFormat += get_handle_desc_size(pProcHeader, pFormat);
895 
896  if (is_oicf_stubdesc(pStubDesc)) /* -Oicf format */
897  {
898  const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader =
899  (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat;
900 
901  Oif_flags = pOIFHeader->Oi2Flags;
902  number_of_params = pOIFHeader->number_of_params;
903 
904  pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER);
905 
906  TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) );
907 
908  if (Oif_flags.HasExtensions)
909  {
910  const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat;
911  ext_flags = pExtensions->Flags2;
912  pFormat += pExtensions->Size;
913 #ifdef __x86_64__
914  if (pExtensions->Size > sizeof(*pExtensions) && fpu_stack)
915  {
916  int i;
917  unsigned short fpu_mask = *(unsigned short *)(pExtensions + 1);
918  for (i = 0; i < 4; i++, fpu_mask >>= 2)
919  switch (fpu_mask & 3)
920  {
921  case 1: *(float *)&stack_top[i] = *(float *)&fpu_stack[i]; break;
922  case 2: *(double *)&stack_top[i] = *(double *)&fpu_stack[i]; break;
923  }
924  }
925 #endif
926  }
927  }
928  else
929  {
930  pFormat = convert_old_args( &stubMsg, pFormat, stack_size,
932  old_args, sizeof(old_args), &number_of_params );
933  }
934 
936  {
937  __TRY
938  {
939  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
940  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
941  number_of_params, Oif_flags, ext_flags, pProcHeader);
942  }
944  {
945  /* 7. FREE */
946  TRACE( "FREE\n" );
947  client_do_args(&stubMsg, pFormat, STUBLESS_FREE, fpu_stack,
948  number_of_params, (unsigned char *)&RetVal);
950  }
951  __ENDTRY
952  }
954  {
955  __TRY
956  {
957  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
958  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
959  number_of_params, Oif_flags, ext_flags, pProcHeader);
960  }
962  {
963  const COMM_FAULT_OFFSETS *comm_fault_offsets = &pStubDesc->CommFaultOffsets[procedure_number];
964  ULONG *comm_status;
965  ULONG *fault_status;
966 
967  TRACE("comm_fault_offsets = {0x%hx, 0x%hx}\n", comm_fault_offsets->CommOffset, comm_fault_offsets->FaultOffset);
968 
969  if (comm_fault_offsets->CommOffset == -1)
970  comm_status = (ULONG *)&RetVal;
971  else if (comm_fault_offsets->CommOffset >= 0)
972  comm_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->CommOffset);
973  else
974  comm_status = NULL;
975 
976  if (comm_fault_offsets->FaultOffset == -1)
977  fault_status = (ULONG *)&RetVal;
978  else if (comm_fault_offsets->FaultOffset >= 0)
979  fault_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->FaultOffset);
980  else
981  fault_status = NULL;
982 
983  NdrMapCommAndFaultStatus(&stubMsg, comm_status, fault_status,
984  GetExceptionCode());
985  }
986  __ENDTRY
987  }
988  else
989  {
990  RetVal = do_ndr_client_call(pStubDesc, pFormat, pHandleFormat,
991  stack_top, fpu_stack, &stubMsg, procedure_number, stack_size,
992  number_of_params, Oif_flags, ext_flags, pProcHeader);
993  }
994 
995  TRACE("RetVal = 0x%lx\n", RetVal);
996  return RetVal;
997 }
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:474
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:70
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:586
#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:72
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:699
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 1817 of file ndr_stubless.c.

1818 {
1819  /* pointer to start of stack where arguments start */
1822  /* header for procedure string */
1823  const NDR_PROC_HEADER * pProcHeader;
1825 
1826  if (!pAsync->StubInfo)
1828 
1829  async_call_data = pAsync->StubInfo;
1832 
1833  /* order of phases:
1834  * 1. CALCSIZE - calculate the buffer size
1835  * 2. GETBUFFER - allocate the buffer
1836  * 3. MARSHAL - marshal [in] params into the buffer
1837  * 4. SENDRECEIVE - send buffer
1838  * Then in NdrpCompleteAsyncClientCall:
1839  * 1. SENDRECEIVE - receive buffer
1840  * 2. UNMARSHAL - unmarshal [out] params from buffer
1841  */
1842 
1843  /* 1. SENDRECEIVE */
1844  TRACE( "RECEIVE\n" );
1846  /* receive the [out] params */
1848 #if 0
1849  NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
1850 #else
1851  FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
1852 #endif
1853  else
1854  {
1856  if (status != RPC_S_OK)
1857  goto cleanup;
1862  }
1863 
1864  /* convert strings, floating point values and endianness into our
1865  * preferred format */
1866 #if 0
1868  NdrConvert(pStubMsg, pFormat);
1869 #endif
1870 
1871  /* 2. UNMARSHAL */
1872  TRACE( "UNMARSHAL\n" );
1875 
1876 cleanup:
1878  {
1879  /* free extra correlation package */
1881  }
1882 
1883  /* free the full pointer translation tables */
1886 
1887  /* free marshalling buffer */
1890 
1893 
1894  TRACE("-- 0x%x\n", status);
1895  return status;
1896 }
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:474
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 2121 of file ndr_stubless.c.

2122 {
2123  /* pointer to start of stack where arguments start */
2126  /* the type of pass we are currently doing */
2127  enum stubless_phase phase;
2129 
2130  if (!pAsync->StubInfo)
2132 
2133  async_call_data = pAsync->StubInfo;
2135 
2136  TRACE("pAsync %p, pAsync->StubInfo %p, pFormat %p\n", pAsync, pAsync->StubInfo, async_call_data->pHandleFormat);
2137 
2139  {
2140  TRACE("stub implementation returned 0x%lx\n", *(LONG_PTR *)Reply);
2141  *async_call_data->retval_ptr = *(LONG_PTR *)Reply;
2142  }
2143  else
2144  TRACE("void stub implementation\n");
2145 
2146  for (phase = STUBLESS_CALCSIZE; phase <= STUBLESS_FREE; phase++)
2147  {
2148  TRACE("phase = %d\n", phase);
2149  switch (phase)
2150  {
2151  case STUBLESS_GETBUFFER:
2153  {
2154  ERR("objects not supported\n");
2157  I_RpcFree(pAsync);
2159  }
2160  else
2161  {
2163  /* allocate buffer for [out] and [ret] params */
2165  if (status)
2168  }
2169  break;
2170 
2171  case STUBLESS_CALCSIZE:
2172  case STUBLESS_MARSHAL:
2173  case STUBLESS_MUSTFREE:
2174  case STUBLESS_FREE:
2176  break;
2177  default:
2178  ERR("shouldn't reach here. phase %d\n", phase);
2179  break;
2180  }
2181  }
2182 
2183 #if 0 /* FIXME */
2184  if (ext_flags.HasNewCorrDesc)
2185  {
2186  /* free extra correlation package */
2188  }
2189 
2190  if (Oif_flags.HasPipes)
2191  {
2192  /* NdrPipesDone(...) */
2193  }
2194 
2195  /* free the full pointer translation tables */
2198 #endif
2199 
2200  /* free server function stack */
2203  I_RpcFree(pAsync);
2204 
2205  return S_OK;
2206 }
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:404
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:59
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:403
#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().