2 * NDR -Oi,-Oif,-Oicf Interpreter
4 * Copyright 2001 Ove Kåven, TransGaming Technologies
5 * Copyright 2003-5 Robert Shearman (for CodeWeavers)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * - Some types of binding handles
27 #include "wine/port.h"
41 #include "wine/exception.h"
42 #include "wine/debug.h"
43 #include "wine/rpcfc.h"
47 #include "ndr_stubless.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(rpc
);
51 #define NDR_TABLE_MASK 127
53 static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
54 const NDR_PARAM_OIF
*param
)
56 PFORMAT_STRING pFormat
;
59 if (param
->attr
.IsBasetype
)
61 pFormat
= ¶m
->u
.type_format_char
;
62 if (param
->attr
.IsSimpleRef
) pMemory
= *(unsigned char **)pMemory
;
66 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
67 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
70 m
= NdrBufferSizer
[pFormat
[0] & NDR_TABLE_MASK
];
71 if (m
) m(pStubMsg
, pMemory
, pFormat
);
74 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
75 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
79 static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
80 const NDR_PARAM_OIF
*param
)
82 PFORMAT_STRING pFormat
;
85 if (param
->attr
.IsBasetype
)
87 pFormat
= ¶m
->u
.type_format_char
;
88 if (param
->attr
.IsSimpleRef
) pMemory
= *(unsigned char **)pMemory
;
92 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
93 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
96 m
= NdrMarshaller
[pFormat
[0] & NDR_TABLE_MASK
];
97 if (m
) return m(pStubMsg
, pMemory
, pFormat
);
100 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
101 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
106 static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char **ppMemory
,
107 const NDR_PARAM_OIF
*param
, unsigned char fMustAlloc
)
109 PFORMAT_STRING pFormat
;
112 if (param
->attr
.IsBasetype
)
114 pFormat
= ¶m
->u
.type_format_char
;
115 if (param
->attr
.IsSimpleRef
) ppMemory
= (unsigned char **)*ppMemory
;
119 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
120 if (!param
->attr
.IsByValue
) ppMemory
= (unsigned char **)*ppMemory
;
123 m
= NdrUnmarshaller
[pFormat
[0] & NDR_TABLE_MASK
];
124 if (m
) return m(pStubMsg
, ppMemory
, pFormat
, fMustAlloc
);
127 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
128 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
133 static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
134 const NDR_PARAM_OIF
*param
)
136 PFORMAT_STRING pFormat
;
139 if (param
->attr
.IsBasetype
) return; /* nothing to do */
140 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
141 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
143 m
= NdrFreer
[pFormat
[0] & NDR_TABLE_MASK
];
144 if (m
) m(pStubMsg
, pMemory
, pFormat
);
147 static DWORD
calc_arg_size(MIDL_STUB_MESSAGE
*pStubMsg
, PFORMAT_STRING pFormat
)
154 size
= *(const WORD
*)(pFormat
+ 2);
156 case RPC_FC_BOGUS_STRUCT
:
157 size
= *(const WORD
*)(pFormat
+ 2);
158 if(*(const WORD
*)(pFormat
+ 4))
159 FIXME("Unhandled conformant description\n");
163 size
= *(const WORD
*)(pFormat
+ 2);
164 ComputeConformance(pStubMsg
, NULL
, pFormat
+ 4, 0);
165 size
*= pStubMsg
->MaxCount
;
167 case RPC_FC_SMFARRAY
:
168 case RPC_FC_SMVARRAY
:
169 size
= *(const WORD
*)(pFormat
+ 2);
171 case RPC_FC_LGFARRAY
:
172 case RPC_FC_LGVARRAY
:
173 size
= *(const DWORD
*)(pFormat
+ 2);
175 case RPC_FC_BOGUS_ARRAY
:
176 pFormat
= ComputeConformance(pStubMsg
, NULL
, pFormat
+ 4, *(const WORD
*)&pFormat
[2]);
177 TRACE("conformance = %ld\n", pStubMsg
->MaxCount
);
178 pFormat
= ComputeVariance(pStubMsg
, NULL
, pFormat
, pStubMsg
->MaxCount
);
179 size
= ComplexStructSize(pStubMsg
, pFormat
);
180 size
*= pStubMsg
->MaxCount
;
182 case RPC_FC_USER_MARSHAL
:
183 size
= *(const WORD
*)(pFormat
+ 4);
186 size
= *(const WORD
*)(pFormat
+ 2);
189 size
= *(const WORD
*)(pFormat
+ 2) * sizeof(WCHAR
);
191 case RPC_FC_C_CSTRING
:
192 case RPC_FC_C_WSTRING
:
193 if (*pFormat
== RPC_FC_C_CSTRING
)
196 size
= sizeof(WCHAR
);
197 if (pFormat
[1] == RPC_FC_STRING_SIZED
)
198 ComputeConformance(pStubMsg
, NULL
, pFormat
+ 2, 0);
200 pStubMsg
->MaxCount
= 0;
201 size
*= pStubMsg
->MaxCount
;
204 FIXME("Unhandled type %02x\n", *pFormat
);
207 size
= sizeof(void *);
213 void WINAPI
NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage
)
215 #if 0 /* these functions are not defined yet */
216 pMessage
->pfnAllocate
= NdrRpcSmClientAllocate
;
217 pMessage
->pfnFree
= NdrRpcSmClientFree
;
221 static const char *debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes
)
226 if (param_attributes
.MustSize
) strcat(buffer
, " MustSize");
227 if (param_attributes
.MustFree
) strcat(buffer
, " MustFree");
228 if (param_attributes
.IsPipe
) strcat(buffer
, " IsPipe");
229 if (param_attributes
.IsIn
) strcat(buffer
, " IsIn");
230 if (param_attributes
.IsOut
) strcat(buffer
, " IsOut");
231 if (param_attributes
.IsReturn
) strcat(buffer
, " IsReturn");
232 if (param_attributes
.IsBasetype
) strcat(buffer
, " IsBasetype");
233 if (param_attributes
.IsByValue
) strcat(buffer
, " IsByValue");
234 if (param_attributes
.IsSimpleRef
) strcat(buffer
, " IsSimpleRef");
235 if (param_attributes
.IsDontCallFreeInst
) strcat(buffer
, " IsDontCallFreeInst");
236 if (param_attributes
.SaveForAsyncFinish
) strcat(buffer
, " SaveForAsyncFinish");
237 if (param_attributes
.ServerAllocSize
)
238 sprintf( buffer
+ strlen(buffer
), " ServerAllocSize = %d", param_attributes
.ServerAllocSize
* 8);
239 return buffer
[0] ? wine_dbg_sprintf( "%s", buffer
+ 1 ) : "";
242 static const char *debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags
)
247 if (Oi2Flags
.ServerMustSize
) strcat(buffer
, " ServerMustSize");
248 if (Oi2Flags
.ClientMustSize
) strcat(buffer
, " ClientMustSize");
249 if (Oi2Flags
.HasReturn
) strcat(buffer
, " HasReturn");
250 if (Oi2Flags
.HasPipes
) strcat(buffer
, " HasPipes");
251 if (Oi2Flags
.Unused
) strcat(buffer
, " Unused");
252 if (Oi2Flags
.HasAsyncUuid
) strcat(buffer
, " HasAsyncUuid");
253 if (Oi2Flags
.HasExtensions
) strcat(buffer
, " HasExtensions");
254 if (Oi2Flags
.HasAsyncHandle
) strcat(buffer
, " HasAsyncHandle");
255 return buffer
[0] ? wine_dbg_sprintf( "%s", buffer
+ 1 ) : "";
258 #define ARG_FROM_OFFSET(args, offset) ((args) + (offset))
260 static PFORMAT_STRING
client_get_handle(
261 PMIDL_STUB_MESSAGE pStubMsg
, const NDR_PROC_HEADER
*pProcHeader
,
262 PFORMAT_STRING pFormat
, handle_t
*phBinding
)
265 switch (pProcHeader
->handle_type
)
267 /* explicit binding: parse additional section */
268 case RPC_FC_BIND_EXPLICIT
:
269 switch (*pFormat
) /* handle_type */
271 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
273 const NDR_EHD_PRIMITIVE
*pDesc
= (const NDR_EHD_PRIMITIVE
*)pFormat
;
275 TRACE("Explicit primitive handle @ %d\n", pDesc
->offset
);
277 if (pDesc
->flag
) /* pointer to binding */
278 *phBinding
= **(handle_t
**)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
280 *phBinding
= *(handle_t
*)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
281 return pFormat
+ sizeof(NDR_EHD_PRIMITIVE
);
283 case RPC_FC_BIND_GENERIC
: /* explicit generic */
285 const NDR_EHD_GENERIC
*pDesc
= (const NDR_EHD_GENERIC
*)pFormat
;
286 void *pObject
= NULL
;
288 const GENERIC_BINDING_ROUTINE_PAIR
*pGenPair
;
290 TRACE("Explicit generic binding handle #%d\n", pDesc
->binding_routine_pair_index
);
292 if (pDesc
->flag_and_size
& HANDLE_PARAM_IS_VIA_PTR
)
293 pArg
= *(void **)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
295 pArg
= ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
296 memcpy(&pObject
, pArg
, pDesc
->flag_and_size
& 0xf);
297 pGenPair
= &pStubMsg
->StubDesc
->aGenericBindingRoutinePairs
[pDesc
->binding_routine_pair_index
];
298 *phBinding
= pGenPair
->pfnBind(pObject
);
299 return pFormat
+ sizeof(NDR_EHD_GENERIC
);
301 case RPC_FC_BIND_CONTEXT
: /* explicit context */
303 const NDR_EHD_CONTEXT
*pDesc
= (const NDR_EHD_CONTEXT
*)pFormat
;
304 NDR_CCONTEXT context_handle
;
305 TRACE("Explicit bind context\n");
306 if (pDesc
->flags
& HANDLE_PARAM_IS_VIA_PTR
)
308 TRACE("\tHANDLE_PARAM_IS_VIA_PTR\n");
309 context_handle
= **(NDR_CCONTEXT
**)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
312 context_handle
= *(NDR_CCONTEXT
*)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
314 if (context_handle
) *phBinding
= NDRCContextBinding(context_handle
);
315 else if (pDesc
->flags
& NDR_CONTEXT_HANDLE_CANNOT_BE_NULL
)
317 ERR("null context handle isn't allowed\n");
318 RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT
);
321 /* FIXME: should we store this structure in stubMsg.pContext? */
322 return pFormat
+ sizeof(NDR_EHD_CONTEXT
);
325 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
326 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
329 case RPC_FC_BIND_GENERIC
: /* implicit generic */
330 FIXME("RPC_FC_BIND_GENERIC\n");
331 RpcRaiseException(RPC_X_BAD_STUB_DATA
); /* FIXME: remove when implemented */
333 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
334 TRACE("Implicit primitive handle\n");
335 *phBinding
= *pStubMsg
->StubDesc
->IMPLICIT_HANDLE_INFO
.pPrimitiveHandle
;
337 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
338 FIXME("RPC_FC_CALLBACK_HANDLE\n");
340 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
341 /* strictly speaking, it isn't necessary to set hBinding here
342 * since it isn't actually used (hence the automatic in its name),
343 * but then why does MIDL generate a valid entry in the
344 * MIDL_STUB_DESC for it? */
345 TRACE("Implicit auto handle\n");
346 *phBinding
= *pStubMsg
->StubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
;
349 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
350 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
355 static void client_free_handle(
356 PMIDL_STUB_MESSAGE pStubMsg
, const NDR_PROC_HEADER
*pProcHeader
,
357 PFORMAT_STRING pFormat
, handle_t hBinding
)
360 switch (pProcHeader
->handle_type
)
362 /* explicit binding: parse additional section */
363 case RPC_FC_BIND_EXPLICIT
:
364 switch (*pFormat
) /* handle_type */
366 case RPC_FC_BIND_GENERIC
: /* explicit generic */
368 const NDR_EHD_GENERIC
*pDesc
= (const NDR_EHD_GENERIC
*)pFormat
;
369 void *pObject
= NULL
;
371 const GENERIC_BINDING_ROUTINE_PAIR
*pGenPair
;
373 TRACE("Explicit generic binding handle #%d\n", pDesc
->binding_routine_pair_index
);
375 if (pDesc
->flag_and_size
& HANDLE_PARAM_IS_VIA_PTR
)
376 pArg
= *(void **)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
378 pArg
= ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
379 memcpy(&pObject
, pArg
, pDesc
->flag_and_size
& 0xf);
380 pGenPair
= &pStubMsg
->StubDesc
->aGenericBindingRoutinePairs
[pDesc
->binding_routine_pair_index
];
381 pGenPair
->pfnUnbind(pObject
, hBinding
);
384 case RPC_FC_BIND_CONTEXT
: /* explicit context */
385 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
388 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
389 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
392 case RPC_FC_BIND_GENERIC
: /* implicit generic */
393 FIXME("RPC_FC_BIND_GENERIC\n");
394 RpcRaiseException(RPC_X_BAD_STUB_DATA
); /* FIXME: remove when implemented */
396 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
397 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
398 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
401 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
402 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
406 void client_do_args( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
, enum stubless_phase phase
,
407 void **fpu_args
, unsigned short number_of_params
, unsigned char *pRetVal
)
409 const NDR_PARAM_OIF
*params
= (const NDR_PARAM_OIF
*)pFormat
;
412 for (i
= 0; i
< number_of_params
; i
++)
414 unsigned char *pArg
= pStubMsg
->StackTop
+ params
[i
].stack_offset
;
415 PFORMAT_STRING pTypeFormat
= (PFORMAT_STRING
)&pStubMsg
->StubDesc
->pFormatTypes
[params
[i
].u
.type_offset
];
417 #ifdef __x86_64__ /* floats are passed as doubles through varargs functions */
420 if (params
[i
].attr
.IsBasetype
&&
421 params
[i
].u
.type_format_char
== RPC_FC_FLOAT
&&
422 !params
[i
].attr
.IsSimpleRef
&&
426 pArg
= (unsigned char *)&f
;
430 TRACE("param[%d]: %p type %02x %s\n", i
, pArg
,
431 params
[i
].attr
.IsBasetype
? params
[i
].u
.type_format_char
: *pTypeFormat
,
432 debugstr_PROC_PF( params
[i
].attr
));
436 case STUBLESS_INITOUT
:
437 if (!params
[i
].attr
.IsBasetype
&& params
[i
].attr
.IsOut
&&
438 !params
[i
].attr
.IsIn
&& !params
[i
].attr
.IsByValue
)
440 memset( *(unsigned char **)pArg
, 0, calc_arg_size( pStubMsg
, pTypeFormat
));
443 case STUBLESS_CALCSIZE
:
444 if (params
[i
].attr
.IsSimpleRef
&& !*(unsigned char **)pArg
)
445 RpcRaiseException(RPC_X_NULL_REF_POINTER
);
446 if (params
[i
].attr
.IsIn
) call_buffer_sizer(pStubMsg
, pArg
, ¶ms
[i
]);
448 case STUBLESS_MARSHAL
:
449 if (params
[i
].attr
.IsIn
) call_marshaller(pStubMsg
, pArg
, ¶ms
[i
]);
451 case STUBLESS_UNMARSHAL
:
452 if (params
[i
].attr
.IsOut
)
454 if (params
[i
].attr
.IsReturn
&& pRetVal
) pArg
= pRetVal
;
455 call_unmarshaller(pStubMsg
, &pArg
, ¶ms
[i
], 0);
459 if (!params
[i
].attr
.IsBasetype
&& params
[i
].attr
.IsOut
&& !params
[i
].attr
.IsByValue
)
460 NdrClearOutParameters( pStubMsg
, pTypeFormat
, *(unsigned char **)pArg
);
463 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
468 static unsigned int type_stack_size(unsigned char fc
)
482 case RPC_FC_UINT3264
:
486 case RPC_FC_ERROR_STATUS_T
:
488 return sizeof(void *);
490 return sizeof(double);
492 return sizeof(ULONGLONG
);
494 ERR("invalid base type 0x%x\n", fc
);
495 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
499 static BOOL
is_by_value( PFORMAT_STRING format
)
503 case RPC_FC_USER_MARSHAL
:
507 case RPC_FC_CPSTRUCT
:
508 case RPC_FC_CVSTRUCT
:
509 case RPC_FC_BOGUS_STRUCT
:
516 PFORMAT_STRING
convert_old_args( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
,
517 unsigned int stack_size
, BOOL object_proc
,
518 void *buffer
, unsigned int size
, unsigned int *count
)
520 NDR_PARAM_OIF
*args
= buffer
;
521 unsigned int i
, stack_offset
= object_proc
? sizeof(void *) : 0;
523 for (i
= 0; stack_offset
< stack_size
; i
++)
525 const NDR_PARAM_OI_BASETYPE
*param
= (const NDR_PARAM_OI_BASETYPE
*)pFormat
;
526 const NDR_PARAM_OI_OTHER
*other
= (const NDR_PARAM_OI_OTHER
*)pFormat
;
528 if (i
+ 1 > size
/ sizeof(*args
))
530 FIXME( "%u args not supported\n", i
);
531 RpcRaiseException( RPC_S_INTERNAL_ERROR
);
534 args
[i
].stack_offset
= stack_offset
;
535 memset( &args
[i
].attr
, 0, sizeof(args
[i
].attr
) );
537 switch (param
->param_direction
)
539 case RPC_FC_IN_PARAM_BASETYPE
:
540 args
[i
].attr
.IsIn
= 1;
541 args
[i
].attr
.IsBasetype
= 1;
543 case RPC_FC_RETURN_PARAM_BASETYPE
:
544 args
[i
].attr
.IsOut
= 1;
545 args
[i
].attr
.IsReturn
= 1;
546 args
[i
].attr
.IsBasetype
= 1;
548 case RPC_FC_IN_PARAM
:
549 args
[i
].attr
.IsIn
= 1;
550 args
[i
].attr
.MustFree
= 1;
552 case RPC_FC_IN_PARAM_NO_FREE_INST
:
553 args
[i
].attr
.IsIn
= 1;
554 args
[i
].attr
.IsDontCallFreeInst
= 1;
556 case RPC_FC_IN_OUT_PARAM
:
557 args
[i
].attr
.IsIn
= 1;
558 args
[i
].attr
.IsOut
= 1;
559 args
[i
].attr
.MustFree
= 1;
561 case RPC_FC_OUT_PARAM
:
562 args
[i
].attr
.IsOut
= 1;
564 case RPC_FC_RETURN_PARAM
:
565 args
[i
].attr
.IsOut
= 1;
566 args
[i
].attr
.IsReturn
= 1;
569 if (args
[i
].attr
.IsBasetype
)
571 args
[i
].u
.type_format_char
= param
->type_format_char
;
572 stack_offset
+= type_stack_size( param
->type_format_char
);
573 pFormat
+= sizeof(NDR_PARAM_OI_BASETYPE
);
577 args
[i
].u
.type_offset
= other
->type_offset
;
578 args
[i
].attr
.IsByValue
= is_by_value( &pStubMsg
->StubDesc
->pFormatTypes
[other
->type_offset
] );
579 stack_offset
+= other
->stack_size
* sizeof(void *);
580 pFormat
+= sizeof(NDR_PARAM_OI_OTHER
);
584 return (PFORMAT_STRING
)args
;
587 LONG_PTR CDECL
ndr_client_call( PMIDL_STUB_DESC pStubDesc
, PFORMAT_STRING pFormat
,
588 void **stack_top
, void **fpu_stack
)
590 /* pointer to start of stack where arguments start */
592 MIDL_STUB_MESSAGE stubMsg
;
593 handle_t hBinding
= NULL
;
594 /* procedure number */
595 unsigned short procedure_number
;
597 unsigned short stack_size
;
598 /* number of parameters. optional for client to give it to us */
599 unsigned int number_of_params
;
600 /* cache of Oif_flags from v2 procedure header */
601 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
602 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
603 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
604 /* header for procedure string */
605 const NDR_PROC_HEADER
* pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
606 /* the value to return to the client from the remote procedure */
608 /* the pointer to the object when in OLE mode */
610 PFORMAT_STRING pHandleFormat
;
611 /* correlation cache */
612 ULONG_PTR NdrCorrCache
[256];
614 TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc
, pFormat
);
616 TRACE("NDR Version: 0x%x\n", pStubDesc
->Version
);
618 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
620 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
621 stack_size
= pProcHeader
->stack_size
;
622 procedure_number
= pProcHeader
->proc_num
;
623 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
627 stack_size
= pProcHeader
->stack_size
;
628 procedure_number
= pProcHeader
->proc_num
;
629 pFormat
+= sizeof(NDR_PROC_HEADER
);
631 TRACE("stack size: 0x%x\n", stack_size
);
632 TRACE("proc num: %d\n", procedure_number
);
634 /* create the full pointer translation tables, if requested */
635 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
636 stubMsg
.FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_CLIENT
);
638 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
640 /* object is always the first argument */
642 NdrProxyInitialize(This
, &rpcMsg
, &stubMsg
, pStubDesc
, procedure_number
);
645 NdrClientInitializeNew(&rpcMsg
, &stubMsg
, pStubDesc
, procedure_number
);
647 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
648 TRACE("MIDL stub version = 0x%x\n", pStubDesc
->MIDLVersion
);
650 stubMsg
.StackTop
= (unsigned char *)stack_top
;
651 pHandleFormat
= pFormat
;
653 /* we only need a handle if this isn't an object method */
654 if (!(pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
))
656 pFormat
= client_get_handle(&stubMsg
, pProcHeader
, pHandleFormat
, &hBinding
);
657 if (!pFormat
) goto done
;
660 if (pStubDesc
->Version
>= 0x20000) /* -Oicf format */
662 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
=
663 (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
665 Oif_flags
= pOIFHeader
->Oi2Flags
;
666 number_of_params
= pOIFHeader
->number_of_params
;
668 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
670 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
672 if (Oif_flags
.HasExtensions
)
674 const NDR_PROC_HEADER_EXTS
*pExtensions
= (const NDR_PROC_HEADER_EXTS
*)pFormat
;
675 ext_flags
= pExtensions
->Flags2
;
676 pFormat
+= pExtensions
->Size
;
678 if (pExtensions
->Size
> sizeof(*pExtensions
) && fpu_stack
)
681 unsigned short fpu_mask
= *(unsigned short *)(pExtensions
+ 1);
682 for (i
= 0; i
< 4; i
++, fpu_mask
>>= 2)
683 switch (fpu_mask
& 3)
685 case 1: *(float *)&stack_top
[i
] = *(float *)&fpu_stack
[i
]; break;
686 case 2: *(double *)&stack_top
[i
] = *(double *)&fpu_stack
[i
]; break;
694 pFormat
= convert_old_args( &stubMsg
, pFormat
, stack_size
,
695 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
696 /* reuse the correlation cache, it's not needed for v1 format */
697 NdrCorrCache
, sizeof(NdrCorrCache
), &number_of_params
);
700 stubMsg
.BufferLength
= 0;
702 /* store the RPC flags away */
703 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
704 rpcMsg
.RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
706 /* use alternate memory allocation routines */
707 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
708 NdrRpcSmSetClientToOsf(&stubMsg
);
710 if (Oif_flags
.HasPipes
)
712 FIXME("pipes not supported yet\n");
713 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
714 /* init pipes package */
715 /* NdrPipesInitialize(...) */
717 if (ext_flags
.HasNewCorrDesc
)
719 /* initialize extra correlation package */
720 NdrCorrelationInitialize(&stubMsg
, NdrCorrCache
, sizeof(NdrCorrCache
), 0);
724 * 1. INITOUT - zero [out] parameters (proxies only)
725 * 2. CALCSIZE - calculate the buffer size
726 * 3. GETBUFFER - allocate the buffer
727 * 4. MARSHAL - marshal [in] params into the buffer
728 * 5. SENDRECEIVE - send/receive buffer
729 * 6. UNMARSHAL - unmarshal [out] params from buffer
730 * 7. FREE - clear [out] parameters (for proxies, and only on error)
732 if ((pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
) ||
733 (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT
))
736 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
738 TRACE( "INITOUT\n" );
739 client_do_args(&stubMsg
, pFormat
, STUBLESS_INITOUT
, fpu_stack
,
740 number_of_params
, (unsigned char *)&RetVal
);
746 TRACE( "CALCSIZE\n" );
747 client_do_args(&stubMsg
, pFormat
, STUBLESS_CALCSIZE
, fpu_stack
,
748 number_of_params
, (unsigned char *)&RetVal
);
751 TRACE( "GETBUFFER\n" );
752 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
754 /* allocate the buffer */
755 NdrProxyGetBuffer(This
, &stubMsg
);
759 /* allocate the buffer */
760 if (Oif_flags
.HasPipes
)
761 /* NdrGetPipeBuffer(...) */
762 FIXME("pipes not supported yet\n");
765 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
767 NdrNsGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
769 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
772 NdrGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
777 TRACE( "MARSHAL\n" );
778 client_do_args(&stubMsg
, pFormat
, STUBLESS_MARSHAL
, fpu_stack
,
779 number_of_params
, (unsigned char *)&RetVal
);
782 TRACE( "SENDRECEIVE\n" );
783 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
785 /* send the [in] params and receive the [out] and [retval]
787 NdrProxySendReceive(This
, &stubMsg
);
791 /* send the [in] params and receive the [out] and [retval]
793 if (Oif_flags
.HasPipes
)
794 /* NdrPipesSendReceive(...) */
795 FIXME("pipes not supported yet\n");
798 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
800 NdrNsSendReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
802 FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
805 NdrSendReceive(&stubMsg
, stubMsg
.Buffer
);
809 /* convert strings, floating point values and endianess into our
810 * preferred format */
811 if ((rpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
812 NdrConvert(&stubMsg
, pFormat
);
815 TRACE( "UNMARSHAL\n" );
816 client_do_args(&stubMsg
, pFormat
, STUBLESS_UNMARSHAL
, fpu_stack
,
817 number_of_params
, (unsigned char *)&RetVal
);
821 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
825 client_do_args(&stubMsg
, pFormat
, STUBLESS_FREE
, fpu_stack
,
826 number_of_params
, (unsigned char *)&RetVal
);
827 RetVal
= NdrProxyErrorHandler(GetExceptionCode());
831 const COMM_FAULT_OFFSETS
*comm_fault_offsets
= &pStubDesc
->CommFaultOffsets
[procedure_number
];
835 TRACE("comm_fault_offsets = {0x%hx, 0x%hx}\n", comm_fault_offsets
->CommOffset
, comm_fault_offsets
->FaultOffset
);
837 if (comm_fault_offsets
->CommOffset
== -1)
838 comm_status
= (ULONG
*)&RetVal
;
839 else if (comm_fault_offsets
->CommOffset
>= 0)
840 comm_status
= *(ULONG
**)ARG_FROM_OFFSET(stubMsg
.StackTop
, comm_fault_offsets
->CommOffset
);
844 if (comm_fault_offsets
->FaultOffset
== -1)
845 fault_status
= (ULONG
*)&RetVal
;
846 else if (comm_fault_offsets
->FaultOffset
>= 0)
847 fault_status
= *(ULONG
**)ARG_FROM_OFFSET(stubMsg
.StackTop
, comm_fault_offsets
->CommOffset
);
851 NdrMapCommAndFaultStatus(&stubMsg
, comm_status
, fault_status
,
860 TRACE( "CALCSIZE\n" );
861 client_do_args(&stubMsg
, pFormat
, STUBLESS_CALCSIZE
, fpu_stack
,
862 number_of_params
, (unsigned char *)&RetVal
);
865 TRACE( "GETBUFFER\n" );
866 if (Oif_flags
.HasPipes
)
867 /* NdrGetPipeBuffer(...) */
868 FIXME("pipes not supported yet\n");
871 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
873 NdrNsGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
875 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
878 NdrGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
882 TRACE( "MARSHAL\n" );
883 client_do_args(&stubMsg
, pFormat
, STUBLESS_MARSHAL
, fpu_stack
,
884 number_of_params
, (unsigned char *)&RetVal
);
887 TRACE( "SENDRECEIVE\n" );
888 if (Oif_flags
.HasPipes
)
889 /* NdrPipesSendReceive(...) */
890 FIXME("pipes not supported yet\n");
893 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
895 NdrNsSendReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
897 FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
900 NdrSendReceive(&stubMsg
, stubMsg
.Buffer
);
903 /* convert strings, floating point values and endianness into our
904 * preferred format */
905 if ((rpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
906 NdrConvert(&stubMsg
, pFormat
);
909 TRACE( "UNMARSHAL\n" );
910 client_do_args(&stubMsg
, pFormat
, STUBLESS_UNMARSHAL
, fpu_stack
,
911 number_of_params
, (unsigned char *)&RetVal
);
914 if (ext_flags
.HasNewCorrDesc
)
916 /* free extra correlation package */
917 NdrCorrelationFree(&stubMsg
);
920 if (Oif_flags
.HasPipes
)
922 /* NdrPipesDone(...) */
925 /* free the full pointer translation tables */
926 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
927 NdrFullPointerXlatFree(stubMsg
.FullPtrXlatTables
);
929 /* free marshalling buffer */
930 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
931 NdrProxyFreeBuffer(This
, &stubMsg
);
934 NdrFreeBuffer(&stubMsg
);
935 client_free_handle(&stubMsg
, pProcHeader
, pHandleFormat
, hBinding
);
939 TRACE("RetVal = 0x%lx\n", RetVal
);
945 __ASM_GLOBAL_FUNC( NdrClientCall2
,
946 "movq %r8,0x18(%rsp)\n\t"
947 "movq %r9,0x20(%rsp)\n\t"
948 "leaq 0x18(%rsp),%r8\n\t"
950 "subq $0x28,%rsp\n\t"
951 __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
952 "call " __ASM_NAME("ndr_client_call") "\n\t"
953 "addq $0x28,%rsp\n\t"
954 __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
957 #else /* __x86_64__ */
959 /***********************************************************************
960 * NdrClientCall2 [RPCRT4.@]
962 CLIENT_CALL_RETURN WINAPIV
NdrClientCall2( PMIDL_STUB_DESC desc
, PFORMAT_STRING format
, ... )
967 __ms_va_start( args
, format
);
968 ret
= ndr_client_call( desc
, format
, va_arg( args
, void ** ), NULL
);
970 return *(CLIENT_CALL_RETURN
*)&ret
;
973 #endif /* __x86_64__ */
975 /* Calls a function with the specified arguments, restoring the stack
976 * properly afterwards as we don't know the calling convention of the
978 #if defined __i386__ && defined _MSC_VER
979 __declspec(naked
) LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
)
985 push edi
; Save registers
987 mov eax
, [ebp
+16] ; Get stack size
988 sub esp
, eax
; Make room in stack
for arguments
995 rep movsd
; Copy dword blocks
996 call
[ebp
+8] ; Call function
997 lea esp
, [ebp
-8] ; Restore stack
998 pop esi
; Restore registers
1004 #elif defined __i386__ && defined __GNUC__
1005 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
);
1006 __ASM_GLOBAL_FUNC(call_server_func
,
1008 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
1009 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
1010 "movl %esp,%ebp\n\t"
1011 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
1012 "pushl %edi\n\t" /* Save registers */
1013 __ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
1015 __ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
1016 "movl 16(%ebp), %eax\n\t" /* Get stack size */
1017 "subl %eax, %esp\n\t" /* Make room in stack for arguments */
1018 "andl $~15, %esp\n\t" /* Make sure stack has 16-byte alignment for Mac OS X */
1019 "movl %esp, %edi\n\t"
1020 "movl %eax, %ecx\n\t"
1021 "movl 12(%ebp), %esi\n\t"
1022 "shrl $2, %ecx\n\t" /* divide by 4 */
1024 "rep; movsl\n\t" /* Copy dword blocks */
1025 "call *8(%ebp)\n\t" /* Call function */
1026 "leal -8(%ebp), %esp\n\t" /* Restore stack */
1027 "popl %esi\n\t" /* Restore registers */
1028 __ASM_CFI(".cfi_same_value %esi\n\t")
1030 __ASM_CFI(".cfi_same_value %edi\n\t")
1032 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
1033 __ASM_CFI(".cfi_same_value %ebp\n\t")
1035 #elif defined __x86_64__
1036 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
);
1037 __ASM_GLOBAL_FUNC( call_server_func
,
1039 __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
1040 __ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
1041 "movq %rsp,%rbp\n\t"
1042 __ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
1044 __ASM_CFI(".cfi_rel_offset %rsi,-8\n\t")
1046 __ASM_CFI(".cfi_rel_offset %rdi,-16\n\t")
1047 "movq %rcx,%rax\n\t" /* function to call */
1048 "movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */
1050 "cmovgq %r8,%rcx\n\t"
1051 "subq %rcx,%rsp\n\t"
1052 "andq $~15,%rsp\n\t"
1055 "movq %rsp,%rdi\n\t"
1056 "movq %rdx,%rsi\n\t"
1057 "rep; movsq\n\t" /* copy arguments */
1058 "movq 0(%rsp),%rcx\n\t"
1059 "movq 8(%rsp),%rdx\n\t"
1060 "movq 16(%rsp),%r8\n\t"
1061 "movq 24(%rsp),%r9\n\t"
1062 "movq %rcx,%xmm0\n\t"
1063 "movq %rdx,%xmm1\n\t"
1064 "movq %r8,%xmm2\n\t"
1065 "movq %r9,%xmm3\n\t"
1067 "leaq -16(%rbp),%rsp\n\t" /* restore stack */
1069 __ASM_CFI(".cfi_same_value %rdi\n\t")
1071 __ASM_CFI(".cfi_same_value %rsi\n\t")
1072 __ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
1074 __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
1075 __ASM_CFI(".cfi_same_value %rbp\n\t")
1078 #warning call_server_func not implemented for your architecture
1079 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned short stack_size
)
1081 FIXME("Not implemented for your architecture\n");
1086 static LONG_PTR
*stub_do_args(MIDL_STUB_MESSAGE
*pStubMsg
,
1087 PFORMAT_STRING pFormat
, enum stubless_phase phase
,
1088 unsigned short number_of_params
)
1090 const NDR_PARAM_OIF
*params
= (const NDR_PARAM_OIF
*)pFormat
;
1092 LONG_PTR
*retval_ptr
= NULL
;
1094 for (i
= 0; i
< number_of_params
; i
++)
1096 unsigned char *pArg
= pStubMsg
->StackTop
+ params
[i
].stack_offset
;
1097 const unsigned char *pTypeFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[params
[i
].u
.type_offset
];
1099 TRACE("param[%d]: %p -> %p type %02x %s\n", i
,
1100 pArg
, *(unsigned char **)pArg
,
1101 params
[i
].attr
.IsBasetype
? params
[i
].u
.type_format_char
: *pTypeFormat
,
1102 debugstr_PROC_PF( params
[i
].attr
));
1106 case STUBLESS_MARSHAL
:
1107 if (params
[i
].attr
.IsOut
|| params
[i
].attr
.IsReturn
)
1108 call_marshaller(pStubMsg
, pArg
, ¶ms
[i
]);
1111 if (params
[i
].attr
.MustFree
)
1113 call_freer(pStubMsg
, pArg
, ¶ms
[i
]);
1115 else if (params
[i
].attr
.ServerAllocSize
)
1117 HeapFree(GetProcessHeap(), 0, *(void **)pArg
);
1119 else if (params
[i
].attr
.IsOut
&&
1120 !params
[i
].attr
.IsIn
&&
1121 !params
[i
].attr
.IsBasetype
&&
1122 !params
[i
].attr
.IsByValue
)
1124 if (*pTypeFormat
!= RPC_FC_BIND_CONTEXT
) pStubMsg
->pfnFree(*(void **)pArg
);
1127 case STUBLESS_INITOUT
:
1128 if (!params
[i
].attr
.IsIn
&&
1129 params
[i
].attr
.IsOut
&&
1130 !params
[i
].attr
.IsBasetype
&&
1131 !params
[i
].attr
.ServerAllocSize
&&
1132 !params
[i
].attr
.IsByValue
)
1134 if (*pTypeFormat
== RPC_FC_BIND_CONTEXT
)
1136 NDR_SCONTEXT ctxt
= NdrContextHandleInitialize(pStubMsg
, pTypeFormat
);
1137 *(void **)pArg
= NDRSContextValue(ctxt
);
1141 DWORD size
= calc_arg_size(pStubMsg
, pTypeFormat
);
1144 *(void **)pArg
= NdrAllocate(pStubMsg
, size
);
1145 memset(*(void **)pArg
, 0, size
);
1150 case STUBLESS_UNMARSHAL
:
1151 if (params
[i
].attr
.ServerAllocSize
)
1152 *(void **)pArg
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
1153 params
[i
].attr
.ServerAllocSize
* 8);
1155 if (params
[i
].attr
.IsIn
)
1156 call_unmarshaller(pStubMsg
, &pArg
, ¶ms
[i
], 0);
1158 case STUBLESS_CALCSIZE
:
1159 if (params
[i
].attr
.IsOut
|| params
[i
].attr
.IsReturn
)
1160 call_buffer_sizer(pStubMsg
, pArg
, ¶ms
[i
]);
1163 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
1165 TRACE("\tmemory addr (after): %p -> %p\n", pArg
, *(unsigned char **)pArg
);
1167 /* make a note of the address of the return value parameter for later */
1168 if (params
[i
].attr
.IsReturn
) retval_ptr
= (LONG_PTR
*)pArg
;
1173 /***********************************************************************
1174 * NdrStubCall2 [RPCRT4.@]
1176 * Unmarshals [in] parameters, calls either a method in an object or a server
1177 * function, marshals any [out] parameters and frees any allocated data.
1180 * Used by stubless MIDL-generated code.
1182 LONG WINAPI
NdrStubCall2(
1183 struct IRpcStubBuffer
* pThis
,
1184 struct IRpcChannelBuffer
* pChannel
,
1185 PRPC_MESSAGE pRpcMsg
,
1186 DWORD
* pdwStubPhase
)
1188 const MIDL_SERVER_INFO
*pServerInfo
;
1189 const MIDL_STUB_DESC
*pStubDesc
;
1190 PFORMAT_STRING pFormat
;
1191 MIDL_STUB_MESSAGE stubMsg
;
1192 /* pointer to start of stack to pass into stub implementation */
1193 unsigned char * args
;
1195 unsigned short stack_size
;
1196 /* number of parameters. optional for client to give it to us */
1197 unsigned int number_of_params
;
1198 /* cache of Oif_flags from v2 procedure header */
1199 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
1200 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1201 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
1202 /* the type of pass we are currently doing */
1203 enum stubless_phase phase
;
1204 /* header for procedure string */
1205 const NDR_PROC_HEADER
*pProcHeader
;
1206 /* location to put retval into */
1207 LONG_PTR
*retval_ptr
= NULL
;
1208 /* correlation cache */
1209 ULONG_PTR NdrCorrCache
[256];
1211 TRACE("pThis %p, pChannel %p, pRpcMsg %p, pdwStubPhase %p\n", pThis
, pChannel
, pRpcMsg
, pdwStubPhase
);
1214 pServerInfo
= CStdStubBuffer_GetServerInfo(pThis
);
1216 pServerInfo
= ((RPC_SERVER_INTERFACE
*)pRpcMsg
->RpcInterfaceInformation
)->InterpreterInfo
;
1218 pStubDesc
= pServerInfo
->pStubDesc
;
1219 pFormat
= pServerInfo
->ProcString
+ pServerInfo
->FmtStringOffset
[pRpcMsg
->ProcNum
];
1220 pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
1222 TRACE("NDR Version: 0x%x\n", pStubDesc
->Version
);
1224 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1226 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
1227 stack_size
= pProcHeader
->stack_size
;
1228 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
1233 stack_size
= pProcHeader
->stack_size
;
1234 pFormat
+= sizeof(NDR_PROC_HEADER
);
1237 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
1240 switch (pProcHeader
->handle_type
)
1242 /* explicit binding: parse additional section */
1243 case RPC_FC_BIND_EXPLICIT
:
1244 switch (*pFormat
) /* handle_type */
1246 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
1247 pFormat
+= sizeof(NDR_EHD_PRIMITIVE
);
1249 case RPC_FC_BIND_GENERIC
: /* explicit generic */
1250 pFormat
+= sizeof(NDR_EHD_GENERIC
);
1252 case RPC_FC_BIND_CONTEXT
: /* explicit context */
1253 pFormat
+= sizeof(NDR_EHD_CONTEXT
);
1256 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
1257 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1260 case RPC_FC_BIND_GENERIC
: /* implicit generic */
1261 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
1262 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
1263 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
1266 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
1267 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1270 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1271 NdrStubInitialize(pRpcMsg
, &stubMsg
, pStubDesc
, pChannel
);
1273 NdrServerInitializeNew(pRpcMsg
, &stubMsg
, pStubDesc
);
1275 /* create the full pointer translation tables, if requested */
1276 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1277 stubMsg
.FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_SERVER
);
1279 /* store the RPC flags away */
1280 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1281 pRpcMsg
->RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
1283 /* use alternate memory allocation routines */
1284 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
1286 NdrRpcSsEnableAllocate(&stubMsg
);
1288 FIXME("Set RPCSS memory allocation routines\n");
1291 TRACE("allocating memory for stack of size %x\n", stack_size
);
1293 args
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, stack_size
);
1294 stubMsg
.StackTop
= args
; /* used by conformance of top-level objects */
1296 /* add the implicit This pointer as the first arg to the function if we
1297 * are calling an object method */
1299 *(void **)args
= ((CStdStubBuffer
*)pThis
)->pvServerObject
;
1301 if (pStubDesc
->Version
>= 0x20000) /* -Oicf format */
1303 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
= (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
1305 Oif_flags
= pOIFHeader
->Oi2Flags
;
1306 number_of_params
= pOIFHeader
->number_of_params
;
1308 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
1310 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
1312 if (Oif_flags
.HasExtensions
)
1314 const NDR_PROC_HEADER_EXTS
*pExtensions
= (const NDR_PROC_HEADER_EXTS
*)pFormat
;
1315 ext_flags
= pExtensions
->Flags2
;
1316 pFormat
+= pExtensions
->Size
;
1319 if (Oif_flags
.HasPipes
)
1321 FIXME("pipes not supported yet\n");
1322 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
1323 /* init pipes package */
1324 /* NdrPipesInitialize(...) */
1326 if (ext_flags
.HasNewCorrDesc
)
1328 /* initialize extra correlation package */
1329 FIXME("new correlation description not implemented\n");
1330 stubMsg
.fHasNewCorrDesc
= TRUE
;
1335 pFormat
= convert_old_args( &stubMsg
, pFormat
, stack_size
,
1336 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
1337 /* reuse the correlation cache, it's not needed for v1 format */
1338 NdrCorrCache
, sizeof(NdrCorrCache
), &number_of_params
);
1341 /* convert strings, floating point values and endianess into our
1342 * preferred format */
1343 if ((pRpcMsg
->DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
1344 NdrConvert(&stubMsg
, pFormat
);
1346 for (phase
= STUBLESS_UNMARSHAL
; phase
<= STUBLESS_FREE
; phase
++)
1348 TRACE("phase = %d\n", phase
);
1351 case STUBLESS_CALLSERVER
:
1352 /* call the server function */
1353 if (pServerInfo
->ThunkTable
&& pServerInfo
->ThunkTable
[pRpcMsg
->ProcNum
])
1354 pServerInfo
->ThunkTable
[pRpcMsg
->ProcNum
](&stubMsg
);
1357 SERVER_ROUTINE func
;
1360 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1362 SERVER_ROUTINE
*vtbl
= *(SERVER_ROUTINE
**)((CStdStubBuffer
*)pThis
)->pvServerObject
;
1363 func
= vtbl
[pRpcMsg
->ProcNum
];
1366 func
= pServerInfo
->DispatchTable
[pRpcMsg
->ProcNum
];
1368 /* FIXME: what happens with return values that don't fit into a single register on x86? */
1369 retval
= call_server_func(func
, args
, stack_size
);
1373 TRACE("stub implementation returned 0x%lx\n", retval
);
1374 *retval_ptr
= retval
;
1377 TRACE("void stub implementation\n");
1380 stubMsg
.Buffer
= NULL
;
1381 stubMsg
.BufferLength
= 0;
1384 case STUBLESS_GETBUFFER
:
1385 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1386 NdrStubGetBuffer(pThis
, pChannel
, &stubMsg
);
1391 pRpcMsg
->BufferLength
= stubMsg
.BufferLength
;
1392 /* allocate buffer for [out] and [ret] params */
1393 Status
= I_RpcGetBuffer(pRpcMsg
);
1395 RpcRaiseException(Status
);
1396 stubMsg
.Buffer
= pRpcMsg
->Buffer
;
1399 case STUBLESS_UNMARSHAL
:
1400 case STUBLESS_INITOUT
:
1401 case STUBLESS_CALCSIZE
:
1402 case STUBLESS_MARSHAL
:
1404 retval_ptr
= stub_do_args(&stubMsg
, pFormat
, phase
, number_of_params
);
1407 ERR("shouldn't reach here. phase %d\n", phase
);
1412 pRpcMsg
->BufferLength
= (unsigned int)(stubMsg
.Buffer
- (unsigned char *)pRpcMsg
->Buffer
);
1414 if (ext_flags
.HasNewCorrDesc
)
1416 /* free extra correlation package */
1417 /* NdrCorrelationFree(&stubMsg); */
1420 if (Oif_flags
.HasPipes
)
1422 /* NdrPipesDone(...) */
1425 /* free the full pointer translation tables */
1426 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1427 NdrFullPointerXlatFree(stubMsg
.FullPtrXlatTables
);
1429 /* free server function stack */
1430 HeapFree(GetProcessHeap(), 0, args
);
1435 /***********************************************************************
1436 * NdrServerCall2 [RPCRT4.@]
1438 void WINAPI
NdrServerCall2(PRPC_MESSAGE pRpcMsg
)
1441 NdrStubCall2(NULL
, NULL
, pRpcMsg
, &dwPhase
);
1444 /***********************************************************************
1445 * NdrStubCall [RPCRT4.@]
1447 LONG WINAPI
NdrStubCall( struct IRpcStubBuffer
*This
, struct IRpcChannelBuffer
*channel
,
1448 PRPC_MESSAGE msg
, DWORD
*phase
)
1450 return NdrStubCall2( This
, channel
, msg
, phase
);
1453 /***********************************************************************
1454 * NdrServerCall [RPCRT4.@]
1456 void WINAPI
NdrServerCall( PRPC_MESSAGE msg
)
1459 NdrStubCall( NULL
, NULL
, msg
, &phase
);
1462 struct async_call_data
1464 MIDL_STUB_MESSAGE
*pStubMsg
;
1465 const NDR_PROC_HEADER
*pProcHeader
;
1466 PFORMAT_STRING pHandleFormat
;
1467 PFORMAT_STRING pParamFormat
;
1468 RPC_BINDING_HANDLE hBinding
;
1470 unsigned short stack_size
;
1471 /* number of parameters. optional for client to give it to us */
1472 unsigned int number_of_params
;
1473 /* correlation cache */
1474 ULONG_PTR NdrCorrCache
[256];
1477 LONG_PTR CDECL
ndr_async_client_call( PMIDL_STUB_DESC pStubDesc
, PFORMAT_STRING pFormat
, void **stack_top
)
1479 /* pointer to start of stack where arguments start */
1480 PRPC_MESSAGE pRpcMsg
;
1481 PMIDL_STUB_MESSAGE pStubMsg
;
1482 RPC_ASYNC_STATE
*pAsync
;
1483 struct async_call_data
*async_call_data
;
1484 /* procedure number */
1485 unsigned short procedure_number
;
1486 /* cache of Oif_flags from v2 procedure header */
1487 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
1488 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1489 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
1490 /* header for procedure string */
1491 const NDR_PROC_HEADER
* pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
1492 /* -Oif or -Oicf generated format */
1493 BOOL bV2Format
= FALSE
;
1496 TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc
, pFormat
);
1498 /* Later NDR language versions probably won't be backwards compatible */
1499 if (pStubDesc
->Version
> 0x50002)
1501 FIXME("Incompatible stub description version: 0x%x\n", pStubDesc
->Version
);
1502 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
);
1505 async_call_data
= I_RpcAllocate(sizeof(*async_call_data
) + sizeof(MIDL_STUB_MESSAGE
) + sizeof(RPC_MESSAGE
));
1506 if (!async_call_data
) RpcRaiseException(ERROR_OUTOFMEMORY
);
1507 async_call_data
->pProcHeader
= pProcHeader
;
1509 async_call_data
->pStubMsg
= pStubMsg
= (PMIDL_STUB_MESSAGE
)(async_call_data
+ 1);
1510 pRpcMsg
= (PRPC_MESSAGE
)(pStubMsg
+ 1);
1512 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1514 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
1515 async_call_data
->stack_size
= pProcHeader
->stack_size
;
1516 procedure_number
= pProcHeader
->proc_num
;
1517 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
1521 async_call_data
->stack_size
= pProcHeader
->stack_size
;
1522 procedure_number
= pProcHeader
->proc_num
;
1523 pFormat
+= sizeof(NDR_PROC_HEADER
);
1525 TRACE("stack size: 0x%x\n", async_call_data
->stack_size
);
1526 TRACE("proc num: %d\n", procedure_number
);
1528 /* create the full pointer translation tables, if requested */
1529 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1530 pStubMsg
->FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_CLIENT
);
1532 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1534 ERR("objects not supported\n");
1535 I_RpcFree(async_call_data
);
1536 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1539 NdrClientInitializeNew(pRpcMsg
, pStubMsg
, pStubDesc
, procedure_number
);
1541 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
1542 TRACE("MIDL stub version = 0x%x\n", pStubDesc
->MIDLVersion
);
1544 /* needed for conformance of top-level objects */
1545 pStubMsg
->StackTop
= I_RpcAllocate(async_call_data
->stack_size
);
1546 memcpy(pStubMsg
->StackTop
, stack_top
, async_call_data
->stack_size
);
1548 pAsync
= *(RPC_ASYNC_STATE
**)pStubMsg
->StackTop
;
1549 pAsync
->StubInfo
= async_call_data
;
1550 async_call_data
->pHandleFormat
= pFormat
;
1552 pFormat
= client_get_handle(pStubMsg
, pProcHeader
, async_call_data
->pHandleFormat
, &async_call_data
->hBinding
);
1553 if (!pFormat
) goto done
;
1555 bV2Format
= (pStubDesc
->Version
>= 0x20000);
1559 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
=
1560 (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
1562 Oif_flags
= pOIFHeader
->Oi2Flags
;
1563 async_call_data
->number_of_params
= pOIFHeader
->number_of_params
;
1565 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
1567 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
1569 if (Oif_flags
.HasExtensions
)
1571 const NDR_PROC_HEADER_EXTS
*pExtensions
=
1572 (const NDR_PROC_HEADER_EXTS
*)pFormat
;
1573 ext_flags
= pExtensions
->Flags2
;
1574 pFormat
+= pExtensions
->Size
;
1579 pFormat
= convert_old_args( pStubMsg
, pFormat
, async_call_data
->stack_size
,
1580 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
1581 async_call_data
->NdrCorrCache
, sizeof(async_call_data
->NdrCorrCache
),
1582 &async_call_data
->number_of_params
);
1585 async_call_data
->pParamFormat
= pFormat
;
1587 pStubMsg
->BufferLength
= 0;
1589 /* store the RPC flags away */
1590 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1591 pRpcMsg
->RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
1593 /* use alternate memory allocation routines */
1594 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
1595 NdrRpcSmSetClientToOsf(pStubMsg
);
1597 if (Oif_flags
.HasPipes
)
1599 FIXME("pipes not supported yet\n");
1600 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
1601 /* init pipes package */
1602 /* NdrPipesInitialize(...) */
1604 if (ext_flags
.HasNewCorrDesc
)
1606 /* initialize extra correlation package */
1607 NdrCorrelationInitialize(pStubMsg
, async_call_data
->NdrCorrCache
, sizeof(async_call_data
->NdrCorrCache
), 0);
1611 * 1. CALCSIZE - calculate the buffer size
1612 * 2. GETBUFFER - allocate the buffer
1613 * 3. MARSHAL - marshal [in] params into the buffer
1614 * 4. SENDRECEIVE - send buffer
1615 * Then in NdrpCompleteAsyncClientCall:
1616 * 1. SENDRECEIVE - receive buffer
1617 * 2. UNMARSHAL - unmarshal [out] params from buffer
1621 TRACE( "CALCSIZE\n" );
1622 client_do_args(pStubMsg
, pFormat
, STUBLESS_CALCSIZE
, NULL
, async_call_data
->number_of_params
, NULL
);
1625 TRACE( "GETBUFFER\n" );
1626 if (Oif_flags
.HasPipes
)
1627 /* NdrGetPipeBuffer(...) */
1628 FIXME("pipes not supported yet\n");
1631 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1633 NdrNsGetBuffer(pStubMsg
, pStubMsg
->BufferLength
, async_call_data
->hBinding
);
1635 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
1638 NdrGetBuffer(pStubMsg
, pStubMsg
->BufferLength
, async_call_data
->hBinding
);
1640 pRpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1641 status
= I_RpcAsyncSetHandle(pRpcMsg
, pAsync
);
1642 if (status
!= RPC_S_OK
)
1643 RpcRaiseException(status
);
1646 TRACE( "MARSHAL\n" );
1647 client_do_args(pStubMsg
, pFormat
, STUBLESS_MARSHAL
, NULL
, async_call_data
->number_of_params
, NULL
);
1649 /* 4. SENDRECEIVE */
1651 pRpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1652 /* send the [in] params only */
1653 if (Oif_flags
.HasPipes
)
1654 /* NdrPipesSend(...) */
1655 FIXME("pipes not supported yet\n");
1658 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1660 NdrNsSend(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
1662 FIXME("using auto handle - call NdrNsSend when it gets implemented\n");
1666 pStubMsg
->RpcMsg
->BufferLength
= pStubMsg
->Buffer
- (unsigned char *)pStubMsg
->RpcMsg
->Buffer
;
1667 status
= I_RpcSend(pStubMsg
->RpcMsg
);
1668 if (status
!= RPC_S_OK
)
1669 RpcRaiseException(status
);
1674 TRACE("returning 0\n");
1678 RPC_STATUS
NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE
*pAsync
, void *Reply
)
1680 /* pointer to start of stack where arguments start */
1681 PMIDL_STUB_MESSAGE pStubMsg
;
1682 struct async_call_data
*async_call_data
;
1683 /* header for procedure string */
1684 const NDR_PROC_HEADER
* pProcHeader
;
1685 RPC_STATUS status
= RPC_S_OK
;
1687 if (!pAsync
->StubInfo
)
1688 return RPC_S_INVALID_ASYNC_HANDLE
;
1690 async_call_data
= pAsync
->StubInfo
;
1691 pStubMsg
= async_call_data
->pStubMsg
;
1692 pProcHeader
= async_call_data
->pProcHeader
;
1695 * 1. CALCSIZE - calculate the buffer size
1696 * 2. GETBUFFER - allocate the buffer
1697 * 3. MARSHAL - marshal [in] params into the buffer
1698 * 4. SENDRECEIVE - send buffer
1699 * Then in NdrpCompleteAsyncClientCall:
1700 * 1. SENDRECEIVE - receive buffer
1701 * 2. UNMARSHAL - unmarshal [out] params from buffer
1704 /* 1. SENDRECEIVE */
1705 TRACE( "RECEIVE\n" );
1706 pStubMsg
->RpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1707 /* receive the [out] params */
1708 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1710 NdrNsReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
1712 FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
1716 status
= I_RpcReceive(pStubMsg
->RpcMsg
);
1717 if (status
!= RPC_S_OK
)
1719 pStubMsg
->BufferLength
= pStubMsg
->RpcMsg
->BufferLength
;
1720 pStubMsg
->BufferStart
= pStubMsg
->RpcMsg
->Buffer
;
1721 pStubMsg
->BufferEnd
= pStubMsg
->BufferStart
+ pStubMsg
->BufferLength
;
1722 pStubMsg
->Buffer
= pStubMsg
->BufferStart
;
1725 /* convert strings, floating point values and endianness into our
1726 * preferred format */
1728 if ((pStubMsg
->RpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
1729 NdrConvert(pStubMsg
, pFormat
);
1733 TRACE( "UNMARSHAL\n" );
1734 client_do_args(pStubMsg
, async_call_data
->pParamFormat
, STUBLESS_UNMARSHAL
,
1735 NULL
, async_call_data
->number_of_params
, Reply
);
1738 if (pStubMsg
->fHasNewCorrDesc
)
1740 /* free extra correlation package */
1741 NdrCorrelationFree(pStubMsg
);
1744 /* free the full pointer translation tables */
1745 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1746 NdrFullPointerXlatFree(pStubMsg
->FullPtrXlatTables
);
1748 /* free marshalling buffer */
1749 NdrFreeBuffer(pStubMsg
);
1750 client_free_handle(pStubMsg
, pProcHeader
, async_call_data
->pHandleFormat
, async_call_data
->hBinding
);
1752 I_RpcFree(pStubMsg
->StackTop
);
1753 I_RpcFree(async_call_data
);
1755 TRACE("-- 0x%x\n", status
);
1761 __ASM_GLOBAL_FUNC( NdrAsyncClientCall
,
1762 "movq %r8,0x18(%rsp)\n\t"
1763 "movq %r9,0x20(%rsp)\n\t"
1764 "leaq 0x18(%rsp),%r8\n\t"
1765 "subq $0x28,%rsp\n\t"
1766 __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
1767 "call " __ASM_NAME("ndr_async_client_call") "\n\t"
1768 "addq $0x28,%rsp\n\t"
1769 __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
1772 #else /* __x86_64__ */
1774 /***********************************************************************
1775 * NdrAsyncClientCall [RPCRT4.@]
1777 CLIENT_CALL_RETURN WINAPIV
NdrAsyncClientCall( PMIDL_STUB_DESC desc
, PFORMAT_STRING format
, ... )
1782 __ms_va_start( args
, format
);
1783 ret
= ndr_async_client_call( desc
, format
, va_arg( args
, void ** ));
1784 __ms_va_end( args
);
1785 return *(CLIENT_CALL_RETURN
*)&ret
;
1788 #endif /* __x86_64__ */
1790 RPCRTAPI LONG RPC_ENTRY
NdrAsyncStubCall(struct IRpcStubBuffer
* pThis
,
1791 struct IRpcChannelBuffer
* pChannel
, PRPC_MESSAGE pRpcMsg
,
1792 DWORD
* pdwStubPhase
)
1794 FIXME("unimplemented, expect crash!\n");