ReactOS 0.4.16-dev-336-gb667d82
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.

247{
256};
@ STUBLESS_INITOUT
Definition: ndr_stubless.h:249
@ STUBLESS_GETBUFFER
Definition: ndr_stubless.h:252
@ STUBLESS_MARSHAL
Definition: ndr_stubless.h:253
@ STUBLESS_CALCSIZE
Definition: ndr_stubless.h:251
@ STUBLESS_UNMARSHAL
Definition: ndr_stubless.h:248
@ STUBLESS_CALLSERVER
Definition: ndr_stubless.h:250
@ STUBLESS_MUSTFREE
Definition: ndr_stubless.h:254
@ STUBLESS_FREE
Definition: ndr_stubless.h:255

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 ));
514 memset( *(unsigned char **)pArg, 0, basetype_arg_size( params[i].u.type_format_char ));
515 }
516 break;
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;
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}
void WINAPI NdrClearOutParameters(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr)
GLfloat f
Definition: glext.h:7540
GLenum const GLfloat * params
Definition: glext.h:5645
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
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
if(dx< 0)
Definition: linetemp.h:194
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
static BOOL param_needs_alloc(PARAM_ATTRIBUTES attr)
Definition: ndr_stubless.c:434
static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_stubless.c:149
static unsigned char * call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:81
static const char * debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes)
Definition: ndr_stubless.c:234
static BOOL param_is_out_basetype(PARAM_ATTRIBUTES attr)
Definition: ndr_stubless.c:439
static void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, const NDR_PARAM_OIF *param)
Definition: ndr_stubless.c:55
static size_t basetype_arg_size(unsigned char fc)
Definition: ndr_stubless.c:444
@ FC_FLOAT
Definition: ndrtypes.h:144
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:188
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char * StackTop
Definition: rpcndr.h:226
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
Definition: cookie.c:202
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074

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}
#define FIXME(fmt,...)
Definition: precomp.h:53
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
GLfloat param
Definition: glext.h:5796
int other
Definition: msacm.c:1376
static BOOL is_by_value(PFORMAT_STRING format)
Definition: ndr_stubless.c:573
static unsigned int type_stack_size(unsigned char fc)
Definition: ndr_stubless.c:542
struct _NDR_PARAM_OI_OTHER NDR_PARAM_OI_OTHER
struct _NDR_PARAM_OI_BASETYPE NDR_PARAM_OI_BASETYPE
@ FC_RETURN_PARAM_BASETYPE
Definition: ndrtypes.h:241
@ FC_IN_PARAM_NO_FREE_INST
Definition: ndrtypes.h:237
@ FC_OUT_PARAM
Definition: ndrtypes.h:239
@ FC_RETURN_PARAM
Definition: ndrtypes.h:240
@ FC_IN_OUT_PARAM
Definition: ndrtypes.h:238
@ FC_IN_PARAM_BASETYPE
Definition: ndrtypes.h:236
@ FC_IN_PARAM
Definition: ndrtypes.h:235
#define args
Definition: format.c:66
Definition: match.c:390
static unsigned stack_offset(compile_ctx_t *ctx)
Definition: compile.c:349

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 1801 of file ndr_stubless.c.

1803{
1804 LONG_PTR ret = 0;
1805 const NDR_PROC_HEADER *pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
1806
1807 TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
1808
1809 if (pProcHeader->Oi_flags & Oi_HAS_COMM_OR_FAULT)
1810 {
1811 __TRY
1812 {
1813 do_ndr_async_client_call( pStubDesc, pFormat, stack_top );
1814 }
1816 {
1817 FIXME("exception %x during ndr_async_client_call()\n", GetExceptionCode());
1819 }
1820 __ENDTRY
1821 }
1822 else
1823 do_ndr_async_client_call( pStubDesc, pFormat, stack_top);
1824
1825 TRACE("returning %ld\n", ret);
1826 return ret;
1827}
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
static jsval_t stack_top(script_ctx_t *ctx)
Definition: engine.c:104
#define GetExceptionCode
Definition: excpt.h:83
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static void do_ndr_async_client_call(const MIDL_STUB_DESC *pStubDesc, PFORMAT_STRING pFormat, void **stack_top)
#define Oi_HAS_COMM_OR_FAULT
Definition: ndrtypes.h:295
#define __EXCEPT_ALL
Definition: exception.h:87
unsigned char Oi_flags
Definition: ndr_stubless.h:64
int ret

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;
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
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,
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 }
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,
989 }
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}
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
Definition: cproxy.c:593
#define NULL
Definition: types.h:112
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
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
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
static const char * debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
Definition: ndr_stubless.c:255
static size_t get_handle_desc_size(const NDR_PROC_HEADER *proc_header, PFORMAT_STRING format)
Definition: ndr_stubless.c:273
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_PROC_HEADER_RPC NDR_PROC_HEADER_RPC
struct _NDR_PROC_HEADER NDR_PROC_HEADER
struct _NDR_PROC_PARTIAL_OIF_HEADER NDR_PROC_PARTIAL_OIF_HEADER
#define Oi_HAS_RPCFLAGS
Definition: ndrtypes.h:293
#define Oi_OBJECT_PROC
Definition: ndrtypes.h:292
unsigned char HasExtensions
Definition: ndrtypes.h:68
INTERPRETER_OPT_FLAGS2 Flags2
Definition: ndrtypes.h:99
unsigned char Size
Definition: ndrtypes.h:97
ULONG Version
Definition: rpcndr.h:376
LONG MIDLVersion
Definition: rpcndr.h:378
const COMM_FAULT_OFFSETS * CommFaultOffsets
Definition: rpcndr.h:379
unsigned short stack_size
Definition: ndr_stubless.h:93
unsigned short proc_num
Definition: ndr_stubless.h:92
unsigned short stack_size
Definition: ndr_stubless.h:71
unsigned short proc_num
Definition: ndr_stubless.h:67
INTERPRETER_OPT_FLAGS Oi2Flags
Definition: ndr_stubless.h:107
uint32_t ULONG
Definition: typedefs.h:59

Referenced by NdrClientCall2().

◆ NdrpCompleteAsyncClientCall()

RPC_STATUS NdrpCompleteAsyncClientCall ( RPC_ASYNC_STATE pAsync,
void Reply 
)

Definition at line 1829 of file ndr_stubless.c.

1830{
1831 /* pointer to start of stack where arguments start */
1832 PMIDL_STUB_MESSAGE pStubMsg;
1834 /* header for procedure string */
1837
1838 if (!pAsync->StubInfo)
1840
1841 async_call_data = pAsync->StubInfo;
1844
1845 /* order of phases:
1846 * 1. CALCSIZE - calculate the buffer size
1847 * 2. GETBUFFER - allocate the buffer
1848 * 3. MARSHAL - marshal [in] params into the buffer
1849 * 4. SENDRECEIVE - send buffer
1850 * Then in NdrpCompleteAsyncClientCall:
1851 * 1. SENDRECEIVE - receive buffer
1852 * 2. UNMARSHAL - unmarshal [out] params from buffer
1853 */
1854
1855 /* 1. SENDRECEIVE */
1856 TRACE( "RECEIVE\n" );
1858 /* receive the [out] params */
1860#if 0
1861 NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
1862#else
1863 FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
1864#endif
1865 else
1866 {
1868 if (status != RPC_S_OK)
1869 goto cleanup;
1874 }
1875
1876 /* convert strings, floating point values and endianness into our
1877 * preferred format */
1878#if 0
1880 NdrConvert(pStubMsg, pFormat);
1881#endif
1882
1883 /* 2. UNMARSHAL */
1884 TRACE( "UNMARSHAL\n" );
1887
1888cleanup:
1890 {
1891 /* free extra correlation package */
1893 }
1894
1895 /* free the full pointer translation tables */
1898
1899 /* free marshalling buffer */
1902
1905
1906 TRACE("-- 0x%x\n", status);
1907 return status;
1908}
static void cleanup(void)
Definition: main.c:1335
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
void WINAPI NdrConvert(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
void WINAPI NdrFreeBuffer(PMIDL_STUB_MESSAGE pStubMsg)
void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables)
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
@ FC_AUTO_HANDLE
Definition: ndrtypes.h:195
RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1857
#define RPC_BUFFER_ASYNC
Definition: rpcdcep.h:70
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
#define RPC_S_OK
Definition: rpcnterr.h:22
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:724
long RPC_STATUS
Definition: rpc.h:52
unsigned char * Buffer
Definition: rpcndr.h:203
struct _FULL_PTR_XLAT_TABLES * FullPtrXlatTables
Definition: rpcndr.h:231
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char * BufferEnd
Definition: rpcndr.h:205
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
unsigned char * BufferStart
Definition: rpcndr.h:204
unsigned int fHasNewCorrDesc
Definition: rpcndr.h:239
unsigned char handle_type
Definition: ndr_stubless.h:43
void * StubInfo
Definition: rpcasync.h:150
unsigned int BufferLength
Definition: rpcdcep.h:41
void * Buffer
Definition: rpcdcep.h:40
ULONG DataRepresentation
Definition: rpcdcep.h:39
ULONG RpcFlags
Definition: rpcdcep.h:48
RPC_BINDING_HANDLE hBinding
Definition: ndr_stubless.h:235
MIDL_STUB_MESSAGE * pStubMsg
Definition: ndr_stubless.h:231
PFORMAT_STRING pHandleFormat
Definition: ndr_stubless.h:233
PFORMAT_STRING pParamFormat
Definition: ndr_stubless.h:234
unsigned int number_of_params
Definition: ndr_stubless.h:239
const NDR_PROC_HEADER * pProcHeader
Definition: ndr_stubless.h:232
Definition: ps.c:97
#define RPC_S_INVALID_ASYNC_HANDLE
Definition: winerror.h:1156

Referenced by RpcAsyncCompleteCall().

◆ NdrpCompleteAsyncServerCall()

RPC_STATUS NdrpCompleteAsyncServerCall ( RPC_ASYNC_STATE pAsync,
void Reply 
)

Definition at line 2133 of file ndr_stubless.c.

2134{
2135 /* pointer to start of stack where arguments start */
2136 PMIDL_STUB_MESSAGE pStubMsg;
2138 /* the type of pass we are currently doing */
2139 enum stubless_phase phase;
2141
2142 if (!pAsync->StubInfo)
2144
2145 async_call_data = pAsync->StubInfo;
2147
2148 TRACE("pAsync %p, pAsync->StubInfo %p, pFormat %p\n", pAsync, pAsync->StubInfo, async_call_data->pHandleFormat);
2149
2151 {
2152 TRACE("stub implementation returned 0x%lx\n", *(LONG_PTR *)Reply);
2153 *async_call_data->retval_ptr = *(LONG_PTR *)Reply;
2154 }
2155 else
2156 TRACE("void stub implementation\n");
2157
2158 for (phase = STUBLESS_CALCSIZE; phase <= STUBLESS_FREE; phase++)
2159 {
2160 TRACE("phase = %d\n", phase);
2161 switch (phase)
2162 {
2163 case STUBLESS_GETBUFFER:
2165 {
2166 ERR("objects not supported\n");
2169 I_RpcFree(pAsync);
2171 }
2172 else
2173 {
2175 /* allocate buffer for [out] and [ret] params */
2177 if (status)
2180 }
2181 break;
2182
2183 case STUBLESS_CALCSIZE:
2184 case STUBLESS_MARSHAL:
2185 case STUBLESS_MUSTFREE:
2186 case STUBLESS_FREE:
2188 break;
2189 default:
2190 ERR("shouldn't reach here. phase %d\n", phase);
2191 break;
2192 }
2193 }
2194
2195#if 0 /* FIXME */
2196 if (ext_flags.HasNewCorrDesc)
2197 {
2198 /* free extra correlation package */
2200 }
2201
2202 if (Oif_flags.HasPipes)
2203 {
2204 /* NdrPipesDone(...) */
2205 }
2206
2207 /* free the full pointer translation tables */
2210#endif
2211
2212 /* free server function stack */
2215 I_RpcFree(pAsync);
2216
2217 return S_OK;
2218}
#define ERR(fmt,...)
Definition: precomp.h:57
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
#define S_OK
Definition: intsafe.h:52
static LONG_PTR * stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params)
stubless_phase
Definition: ndr_stubless.h:247
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1638
LONG_PTR * retval_ptr
Definition: ndr_stubless.h:241
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by RpcAsyncCompleteCall().