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
26 #define WIN32_NO_STATUS
30 //#include "wine/port.h"
38 //#include "winerror.h"
44 #include <wine/exception.h>
45 #include <wine/debug.h>
46 #include <wine/rpcfc.h>
50 #include "ndr_stubless.h"
52 WINE_DEFAULT_DEBUG_CHANNEL(rpc
);
54 #define NDR_TABLE_MASK 127
56 static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
57 const NDR_PARAM_OIF
*param
)
59 PFORMAT_STRING pFormat
;
62 if (param
->attr
.IsBasetype
)
64 pFormat
= ¶m
->u
.type_format_char
;
65 if (param
->attr
.IsSimpleRef
) pMemory
= *(unsigned char **)pMemory
;
69 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
70 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
73 m
= NdrBufferSizer
[pFormat
[0] & NDR_TABLE_MASK
];
74 if (m
) m(pStubMsg
, pMemory
, pFormat
);
77 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
78 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
82 static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
83 const NDR_PARAM_OIF
*param
)
85 PFORMAT_STRING pFormat
;
88 if (param
->attr
.IsBasetype
)
90 pFormat
= ¶m
->u
.type_format_char
;
91 if (param
->attr
.IsSimpleRef
) pMemory
= *(unsigned char **)pMemory
;
95 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
96 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
99 m
= NdrMarshaller
[pFormat
[0] & NDR_TABLE_MASK
];
100 if (m
) return m(pStubMsg
, pMemory
, pFormat
);
103 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
104 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
109 static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char **ppMemory
,
110 const NDR_PARAM_OIF
*param
, unsigned char fMustAlloc
)
112 PFORMAT_STRING pFormat
;
115 if (param
->attr
.IsBasetype
)
117 pFormat
= ¶m
->u
.type_format_char
;
118 if (param
->attr
.IsSimpleRef
) ppMemory
= (unsigned char **)*ppMemory
;
122 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
123 if (!param
->attr
.IsByValue
) ppMemory
= (unsigned char **)*ppMemory
;
126 m
= NdrUnmarshaller
[pFormat
[0] & NDR_TABLE_MASK
];
127 if (m
) return m(pStubMsg
, ppMemory
, pFormat
, fMustAlloc
);
130 FIXME("format type 0x%x not implemented\n", pFormat
[0]);
131 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
136 static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg
, unsigned char *pMemory
,
137 const NDR_PARAM_OIF
*param
)
139 PFORMAT_STRING pFormat
;
142 if (param
->attr
.IsBasetype
) return; /* nothing to do */
143 pFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[param
->u
.type_offset
];
144 if (!param
->attr
.IsByValue
) pMemory
= *(unsigned char **)pMemory
;
146 m
= NdrFreer
[pFormat
[0] & NDR_TABLE_MASK
];
147 if (m
) m(pStubMsg
, pMemory
, pFormat
);
150 static DWORD
calc_arg_size(MIDL_STUB_MESSAGE
*pStubMsg
, PFORMAT_STRING pFormat
)
157 size
= *(const WORD
*)(pFormat
+ 2);
159 case RPC_FC_BOGUS_STRUCT
:
160 size
= *(const WORD
*)(pFormat
+ 2);
161 if(*(const WORD
*)(pFormat
+ 4))
162 FIXME("Unhandled conformant description\n");
166 size
= *(const WORD
*)(pFormat
+ 2);
167 ComputeConformance(pStubMsg
, NULL
, pFormat
+ 4, 0);
168 size
*= pStubMsg
->MaxCount
;
170 case RPC_FC_SMFARRAY
:
171 case RPC_FC_SMVARRAY
:
172 size
= *(const WORD
*)(pFormat
+ 2);
174 case RPC_FC_LGFARRAY
:
175 case RPC_FC_LGVARRAY
:
176 size
= *(const DWORD
*)(pFormat
+ 2);
178 case RPC_FC_BOGUS_ARRAY
:
179 pFormat
= ComputeConformance(pStubMsg
, NULL
, pFormat
+ 4, *(const WORD
*)&pFormat
[2]);
180 TRACE("conformance = %ld\n", pStubMsg
->MaxCount
);
181 pFormat
= ComputeVariance(pStubMsg
, NULL
, pFormat
, pStubMsg
->MaxCount
);
182 size
= ComplexStructSize(pStubMsg
, pFormat
);
183 size
*= pStubMsg
->MaxCount
;
185 case RPC_FC_USER_MARSHAL
:
186 size
= *(const WORD
*)(pFormat
+ 4);
189 size
= *(const WORD
*)(pFormat
+ 2);
192 size
= *(const WORD
*)(pFormat
+ 2) * sizeof(WCHAR
);
194 case RPC_FC_C_CSTRING
:
195 case RPC_FC_C_WSTRING
:
196 if (*pFormat
== RPC_FC_C_CSTRING
)
199 size
= sizeof(WCHAR
);
200 if (pFormat
[1] == RPC_FC_STRING_SIZED
)
201 ComputeConformance(pStubMsg
, NULL
, pFormat
+ 2, 0);
203 pStubMsg
->MaxCount
= 0;
204 size
*= pStubMsg
->MaxCount
;
207 FIXME("Unhandled type %02x\n", *pFormat
);
210 size
= sizeof(void *);
216 void WINAPI
NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage
)
218 #if 0 /* these functions are not defined yet */
219 pMessage
->pfnAllocate
= NdrRpcSmClientAllocate
;
220 pMessage
->pfnFree
= NdrRpcSmClientFree
;
224 static const char *debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes
)
229 if (param_attributes
.MustSize
) strcat(buffer
, " MustSize");
230 if (param_attributes
.MustFree
) strcat(buffer
, " MustFree");
231 if (param_attributes
.IsPipe
) strcat(buffer
, " IsPipe");
232 if (param_attributes
.IsIn
) strcat(buffer
, " IsIn");
233 if (param_attributes
.IsOut
) strcat(buffer
, " IsOut");
234 if (param_attributes
.IsReturn
) strcat(buffer
, " IsReturn");
235 if (param_attributes
.IsBasetype
) strcat(buffer
, " IsBasetype");
236 if (param_attributes
.IsByValue
) strcat(buffer
, " IsByValue");
237 if (param_attributes
.IsSimpleRef
) strcat(buffer
, " IsSimpleRef");
238 if (param_attributes
.IsDontCallFreeInst
) strcat(buffer
, " IsDontCallFreeInst");
239 if (param_attributes
.SaveForAsyncFinish
) strcat(buffer
, " SaveForAsyncFinish");
240 if (param_attributes
.ServerAllocSize
)
241 sprintf( buffer
+ strlen(buffer
), " ServerAllocSize = %d", param_attributes
.ServerAllocSize
* 8);
242 return buffer
[0] ? wine_dbg_sprintf( "%s", buffer
+ 1 ) : "";
245 static const char *debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags
)
250 if (Oi2Flags
.ServerMustSize
) strcat(buffer
, " ServerMustSize");
251 if (Oi2Flags
.ClientMustSize
) strcat(buffer
, " ClientMustSize");
252 if (Oi2Flags
.HasReturn
) strcat(buffer
, " HasReturn");
253 if (Oi2Flags
.HasPipes
) strcat(buffer
, " HasPipes");
254 if (Oi2Flags
.Unused
) strcat(buffer
, " Unused");
255 if (Oi2Flags
.HasAsyncUuid
) strcat(buffer
, " HasAsyncUuid");
256 if (Oi2Flags
.HasExtensions
) strcat(buffer
, " HasExtensions");
257 if (Oi2Flags
.HasAsyncHandle
) strcat(buffer
, " HasAsyncHandle");
258 return buffer
[0] ? wine_dbg_sprintf( "%s", buffer
+ 1 ) : "";
261 #define ARG_FROM_OFFSET(args, offset) ((args) + (offset))
263 static PFORMAT_STRING
client_get_handle(
264 PMIDL_STUB_MESSAGE pStubMsg
, const NDR_PROC_HEADER
*pProcHeader
,
265 PFORMAT_STRING pFormat
, handle_t
*phBinding
)
268 switch (pProcHeader
->handle_type
)
270 /* explicit binding: parse additional section */
271 case RPC_FC_BIND_EXPLICIT
:
272 switch (*pFormat
) /* handle_type */
274 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
276 const NDR_EHD_PRIMITIVE
*pDesc
= (const NDR_EHD_PRIMITIVE
*)pFormat
;
278 TRACE("Explicit primitive handle @ %d\n", pDesc
->offset
);
280 if (pDesc
->flag
) /* pointer to binding */
281 *phBinding
= **(handle_t
**)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
283 *phBinding
= *(handle_t
*)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
284 return pFormat
+ sizeof(NDR_EHD_PRIMITIVE
);
286 case RPC_FC_BIND_GENERIC
: /* explicit generic */
288 const NDR_EHD_GENERIC
*pDesc
= (const NDR_EHD_GENERIC
*)pFormat
;
289 void *pObject
= NULL
;
291 const GENERIC_BINDING_ROUTINE_PAIR
*pGenPair
;
293 TRACE("Explicit generic binding handle #%d\n", pDesc
->binding_routine_pair_index
);
295 if (pDesc
->flag_and_size
& HANDLE_PARAM_IS_VIA_PTR
)
296 pArg
= *(void **)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
298 pArg
= ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
299 memcpy(&pObject
, pArg
, pDesc
->flag_and_size
& 0xf);
300 pGenPair
= &pStubMsg
->StubDesc
->aGenericBindingRoutinePairs
[pDesc
->binding_routine_pair_index
];
301 *phBinding
= pGenPair
->pfnBind(pObject
);
302 return pFormat
+ sizeof(NDR_EHD_GENERIC
);
304 case RPC_FC_BIND_CONTEXT
: /* explicit context */
306 const NDR_EHD_CONTEXT
*pDesc
= (const NDR_EHD_CONTEXT
*)pFormat
;
307 NDR_CCONTEXT context_handle
;
308 TRACE("Explicit bind context\n");
309 if (pDesc
->flags
& HANDLE_PARAM_IS_VIA_PTR
)
311 TRACE("\tHANDLE_PARAM_IS_VIA_PTR\n");
312 context_handle
= **(NDR_CCONTEXT
**)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
315 context_handle
= *(NDR_CCONTEXT
*)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
317 if (context_handle
) *phBinding
= NDRCContextBinding(context_handle
);
318 else if (pDesc
->flags
& NDR_CONTEXT_HANDLE_CANNOT_BE_NULL
)
320 ERR("null context handle isn't allowed\n");
321 RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT
);
324 /* FIXME: should we store this structure in stubMsg.pContext? */
325 return pFormat
+ sizeof(NDR_EHD_CONTEXT
);
328 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
329 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
332 case RPC_FC_BIND_GENERIC
: /* implicit generic */
333 FIXME("RPC_FC_BIND_GENERIC\n");
334 RpcRaiseException(RPC_X_BAD_STUB_DATA
); /* FIXME: remove when implemented */
336 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
337 TRACE("Implicit primitive handle\n");
338 *phBinding
= *pStubMsg
->StubDesc
->IMPLICIT_HANDLE_INFO
.pPrimitiveHandle
;
340 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
341 FIXME("RPC_FC_CALLBACK_HANDLE\n");
343 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
344 /* strictly speaking, it isn't necessary to set hBinding here
345 * since it isn't actually used (hence the automatic in its name),
346 * but then why does MIDL generate a valid entry in the
347 * MIDL_STUB_DESC for it? */
348 TRACE("Implicit auto handle\n");
349 *phBinding
= *pStubMsg
->StubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
;
352 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
353 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
358 static void client_free_handle(
359 PMIDL_STUB_MESSAGE pStubMsg
, const NDR_PROC_HEADER
*pProcHeader
,
360 PFORMAT_STRING pFormat
, handle_t hBinding
)
363 switch (pProcHeader
->handle_type
)
365 /* explicit binding: parse additional section */
366 case RPC_FC_BIND_EXPLICIT
:
367 switch (*pFormat
) /* handle_type */
369 case RPC_FC_BIND_GENERIC
: /* explicit generic */
371 const NDR_EHD_GENERIC
*pDesc
= (const NDR_EHD_GENERIC
*)pFormat
;
372 void *pObject
= NULL
;
374 const GENERIC_BINDING_ROUTINE_PAIR
*pGenPair
;
376 TRACE("Explicit generic binding handle #%d\n", pDesc
->binding_routine_pair_index
);
378 if (pDesc
->flag_and_size
& HANDLE_PARAM_IS_VIA_PTR
)
379 pArg
= *(void **)ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
381 pArg
= ARG_FROM_OFFSET(pStubMsg
->StackTop
, pDesc
->offset
);
382 memcpy(&pObject
, pArg
, pDesc
->flag_and_size
& 0xf);
383 pGenPair
= &pStubMsg
->StubDesc
->aGenericBindingRoutinePairs
[pDesc
->binding_routine_pair_index
];
384 pGenPair
->pfnUnbind(pObject
, hBinding
);
387 case RPC_FC_BIND_CONTEXT
: /* explicit context */
388 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
391 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
392 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
395 case RPC_FC_BIND_GENERIC
: /* implicit generic */
396 FIXME("RPC_FC_BIND_GENERIC\n");
397 RpcRaiseException(RPC_X_BAD_STUB_DATA
); /* FIXME: remove when implemented */
399 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
400 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
401 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
404 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
405 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
409 void client_do_args( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
, enum stubless_phase phase
,
410 void **fpu_args
, unsigned short number_of_params
, unsigned char *pRetVal
)
412 const NDR_PARAM_OIF
*params
= (const NDR_PARAM_OIF
*)pFormat
;
415 for (i
= 0; i
< number_of_params
; i
++)
417 unsigned char *pArg
= pStubMsg
->StackTop
+ params
[i
].stack_offset
;
418 PFORMAT_STRING pTypeFormat
= (PFORMAT_STRING
)&pStubMsg
->StubDesc
->pFormatTypes
[params
[i
].u
.type_offset
];
420 #ifdef __x86_64__ /* floats are passed as doubles through varargs functions */
423 if (params
[i
].attr
.IsBasetype
&&
424 params
[i
].u
.type_format_char
== RPC_FC_FLOAT
&&
425 !params
[i
].attr
.IsSimpleRef
&&
429 pArg
= (unsigned char *)&f
;
433 TRACE("param[%d]: %p type %02x %s\n", i
, pArg
,
434 params
[i
].attr
.IsBasetype
? params
[i
].u
.type_format_char
: *pTypeFormat
,
435 debugstr_PROC_PF( params
[i
].attr
));
439 case STUBLESS_INITOUT
:
440 if (!params
[i
].attr
.IsBasetype
&& params
[i
].attr
.IsOut
&&
441 !params
[i
].attr
.IsIn
&& !params
[i
].attr
.IsByValue
)
443 memset( *(unsigned char **)pArg
, 0, calc_arg_size( pStubMsg
, pTypeFormat
));
446 case STUBLESS_CALCSIZE
:
447 if (params
[i
].attr
.IsSimpleRef
&& !*(unsigned char **)pArg
)
448 RpcRaiseException(RPC_X_NULL_REF_POINTER
);
449 if (params
[i
].attr
.IsIn
) call_buffer_sizer(pStubMsg
, pArg
, ¶ms
[i
]);
451 case STUBLESS_MARSHAL
:
452 if (params
[i
].attr
.IsIn
) call_marshaller(pStubMsg
, pArg
, ¶ms
[i
]);
454 case STUBLESS_UNMARSHAL
:
455 if (params
[i
].attr
.IsOut
)
457 if (params
[i
].attr
.IsReturn
&& pRetVal
) pArg
= pRetVal
;
458 call_unmarshaller(pStubMsg
, &pArg
, ¶ms
[i
], 0);
462 if (!params
[i
].attr
.IsBasetype
&& params
[i
].attr
.IsOut
&& !params
[i
].attr
.IsByValue
)
463 NdrClearOutParameters( pStubMsg
, pTypeFormat
, *(unsigned char **)pArg
);
466 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
471 static unsigned int type_stack_size(unsigned char fc
)
485 case RPC_FC_UINT3264
:
489 case RPC_FC_ERROR_STATUS_T
:
491 return sizeof(void *);
493 return sizeof(double);
495 return sizeof(ULONGLONG
);
497 ERR("invalid base type 0x%x\n", fc
);
498 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
502 static BOOL
is_by_value( PFORMAT_STRING format
)
506 case RPC_FC_USER_MARSHAL
:
510 case RPC_FC_CPSTRUCT
:
511 case RPC_FC_CVSTRUCT
:
512 case RPC_FC_BOGUS_STRUCT
:
519 PFORMAT_STRING
convert_old_args( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
,
520 unsigned int stack_size
, BOOL object_proc
,
521 void *buffer
, unsigned int size
, unsigned int *count
)
523 NDR_PARAM_OIF
*args
= buffer
;
524 unsigned int i
, stack_offset
= object_proc
? sizeof(void *) : 0;
526 for (i
= 0; stack_offset
< stack_size
; i
++)
528 const NDR_PARAM_OI_BASETYPE
*param
= (const NDR_PARAM_OI_BASETYPE
*)pFormat
;
529 const NDR_PARAM_OI_OTHER
*other
= (const NDR_PARAM_OI_OTHER
*)pFormat
;
531 if (i
+ 1 > size
/ sizeof(*args
))
533 FIXME( "%u args not supported\n", i
);
534 RpcRaiseException( RPC_S_INTERNAL_ERROR
);
537 args
[i
].stack_offset
= stack_offset
;
538 memset( &args
[i
].attr
, 0, sizeof(args
[i
].attr
) );
540 switch (param
->param_direction
)
542 case RPC_FC_IN_PARAM_BASETYPE
:
543 args
[i
].attr
.IsIn
= 1;
544 args
[i
].attr
.IsBasetype
= 1;
546 case RPC_FC_RETURN_PARAM_BASETYPE
:
547 args
[i
].attr
.IsOut
= 1;
548 args
[i
].attr
.IsReturn
= 1;
549 args
[i
].attr
.IsBasetype
= 1;
551 case RPC_FC_IN_PARAM
:
552 args
[i
].attr
.IsIn
= 1;
553 args
[i
].attr
.MustFree
= 1;
555 case RPC_FC_IN_PARAM_NO_FREE_INST
:
556 args
[i
].attr
.IsIn
= 1;
557 args
[i
].attr
.IsDontCallFreeInst
= 1;
559 case RPC_FC_IN_OUT_PARAM
:
560 args
[i
].attr
.IsIn
= 1;
561 args
[i
].attr
.IsOut
= 1;
562 args
[i
].attr
.MustFree
= 1;
564 case RPC_FC_OUT_PARAM
:
565 args
[i
].attr
.IsOut
= 1;
567 case RPC_FC_RETURN_PARAM
:
568 args
[i
].attr
.IsOut
= 1;
569 args
[i
].attr
.IsReturn
= 1;
572 if (args
[i
].attr
.IsBasetype
)
574 args
[i
].u
.type_format_char
= param
->type_format_char
;
575 stack_offset
+= type_stack_size( param
->type_format_char
);
576 pFormat
+= sizeof(NDR_PARAM_OI_BASETYPE
);
580 args
[i
].u
.type_offset
= other
->type_offset
;
581 args
[i
].attr
.IsByValue
= is_by_value( &pStubMsg
->StubDesc
->pFormatTypes
[other
->type_offset
] );
582 stack_offset
+= other
->stack_size
* sizeof(void *);
583 pFormat
+= sizeof(NDR_PARAM_OI_OTHER
);
587 return (PFORMAT_STRING
)args
;
590 LONG_PTR CDECL
ndr_client_call( PMIDL_STUB_DESC pStubDesc
, PFORMAT_STRING pFormat
,
591 void **stack_top
, void **fpu_stack
)
593 /* pointer to start of stack where arguments start */
595 MIDL_STUB_MESSAGE stubMsg
;
596 handle_t hBinding
= NULL
;
597 /* procedure number */
598 unsigned short procedure_number
;
600 unsigned short stack_size
;
601 /* number of parameters. optional for client to give it to us */
602 unsigned int number_of_params
;
603 /* cache of Oif_flags from v2 procedure header */
604 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
605 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
606 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
607 /* header for procedure string */
608 const NDR_PROC_HEADER
* pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
609 /* the value to return to the client from the remote procedure */
611 /* the pointer to the object when in OLE mode */
613 PFORMAT_STRING pHandleFormat
;
614 /* correlation cache */
615 ULONG_PTR NdrCorrCache
[256];
617 TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc
, pFormat
);
619 TRACE("NDR Version: 0x%x\n", pStubDesc
->Version
);
621 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
623 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
624 stack_size
= pProcHeader
->stack_size
;
625 procedure_number
= pProcHeader
->proc_num
;
626 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
630 stack_size
= pProcHeader
->stack_size
;
631 procedure_number
= pProcHeader
->proc_num
;
632 pFormat
+= sizeof(NDR_PROC_HEADER
);
634 TRACE("stack size: 0x%x\n", stack_size
);
635 TRACE("proc num: %d\n", procedure_number
);
637 /* create the full pointer translation tables, if requested */
638 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
639 stubMsg
.FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_CLIENT
);
641 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
643 /* object is always the first argument */
645 NdrProxyInitialize(This
, &rpcMsg
, &stubMsg
, pStubDesc
, procedure_number
);
648 NdrClientInitializeNew(&rpcMsg
, &stubMsg
, pStubDesc
, procedure_number
);
650 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
651 TRACE("MIDL stub version = 0x%x\n", pStubDesc
->MIDLVersion
);
653 stubMsg
.StackTop
= (unsigned char *)stack_top
;
654 pHandleFormat
= pFormat
;
656 /* we only need a handle if this isn't an object method */
657 if (!(pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
))
659 pFormat
= client_get_handle(&stubMsg
, pProcHeader
, pHandleFormat
, &hBinding
);
660 if (!pFormat
) goto done
;
663 if (pStubDesc
->Version
>= 0x20000) /* -Oicf format */
665 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
=
666 (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
668 Oif_flags
= pOIFHeader
->Oi2Flags
;
669 number_of_params
= pOIFHeader
->number_of_params
;
671 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
673 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
675 if (Oif_flags
.HasExtensions
)
677 const NDR_PROC_HEADER_EXTS
*pExtensions
= (const NDR_PROC_HEADER_EXTS
*)pFormat
;
678 ext_flags
= pExtensions
->Flags2
;
679 pFormat
+= pExtensions
->Size
;
681 if (pExtensions
->Size
> sizeof(*pExtensions
) && fpu_stack
)
684 unsigned short fpu_mask
= *(unsigned short *)(pExtensions
+ 1);
685 for (i
= 0; i
< 4; i
++, fpu_mask
>>= 2)
686 switch (fpu_mask
& 3)
688 case 1: *(float *)&stack_top
[i
] = *(float *)&fpu_stack
[i
]; break;
689 case 2: *(double *)&stack_top
[i
] = *(double *)&fpu_stack
[i
]; break;
697 pFormat
= convert_old_args( &stubMsg
, pFormat
, stack_size
,
698 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
699 /* reuse the correlation cache, it's not needed for v1 format */
700 NdrCorrCache
, sizeof(NdrCorrCache
), &number_of_params
);
703 stubMsg
.BufferLength
= 0;
705 /* store the RPC flags away */
706 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
707 rpcMsg
.RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
709 /* use alternate memory allocation routines */
710 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
711 NdrRpcSmSetClientToOsf(&stubMsg
);
713 if (Oif_flags
.HasPipes
)
715 FIXME("pipes not supported yet\n");
716 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
717 /* init pipes package */
718 /* NdrPipesInitialize(...) */
720 if (ext_flags
.HasNewCorrDesc
)
722 /* initialize extra correlation package */
723 NdrCorrelationInitialize(&stubMsg
, NdrCorrCache
, sizeof(NdrCorrCache
), 0);
727 * 1. INITOUT - zero [out] parameters (proxies only)
728 * 2. CALCSIZE - calculate the buffer size
729 * 3. GETBUFFER - allocate the buffer
730 * 4. MARSHAL - marshal [in] params into the buffer
731 * 5. SENDRECEIVE - send/receive buffer
732 * 6. UNMARSHAL - unmarshal [out] params from buffer
733 * 7. FREE - clear [out] parameters (for proxies, and only on error)
735 if ((pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
) ||
736 (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT
))
739 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
741 TRACE( "INITOUT\n" );
742 client_do_args(&stubMsg
, pFormat
, STUBLESS_INITOUT
, fpu_stack
,
743 number_of_params
, (unsigned char *)&RetVal
);
749 TRACE( "CALCSIZE\n" );
750 client_do_args(&stubMsg
, pFormat
, STUBLESS_CALCSIZE
, fpu_stack
,
751 number_of_params
, (unsigned char *)&RetVal
);
754 TRACE( "GETBUFFER\n" );
755 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
757 /* allocate the buffer */
758 NdrProxyGetBuffer(This
, &stubMsg
);
762 /* allocate the buffer */
763 if (Oif_flags
.HasPipes
)
764 /* NdrGetPipeBuffer(...) */
765 FIXME("pipes not supported yet\n");
768 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
770 NdrNsGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
772 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
775 NdrGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
780 TRACE( "MARSHAL\n" );
781 client_do_args(&stubMsg
, pFormat
, STUBLESS_MARSHAL
, fpu_stack
,
782 number_of_params
, (unsigned char *)&RetVal
);
785 TRACE( "SENDRECEIVE\n" );
786 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
788 /* send the [in] params and receive the [out] and [retval]
790 NdrProxySendReceive(This
, &stubMsg
);
794 /* send the [in] params and receive the [out] and [retval]
796 if (Oif_flags
.HasPipes
)
797 /* NdrPipesSendReceive(...) */
798 FIXME("pipes not supported yet\n");
801 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
803 NdrNsSendReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
805 FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
808 NdrSendReceive(&stubMsg
, stubMsg
.Buffer
);
812 /* convert strings, floating point values and endianess into our
813 * preferred format */
814 if ((rpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
815 NdrConvert(&stubMsg
, pFormat
);
818 TRACE( "UNMARSHAL\n" );
819 client_do_args(&stubMsg
, pFormat
, STUBLESS_UNMARSHAL
, fpu_stack
,
820 number_of_params
, (unsigned char *)&RetVal
);
824 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
828 client_do_args(&stubMsg
, pFormat
, STUBLESS_FREE
, fpu_stack
,
829 number_of_params
, (unsigned char *)&RetVal
);
830 RetVal
= NdrProxyErrorHandler(GetExceptionCode());
834 const COMM_FAULT_OFFSETS
*comm_fault_offsets
= &pStubDesc
->CommFaultOffsets
[procedure_number
];
838 TRACE("comm_fault_offsets = {0x%hx, 0x%hx}\n", comm_fault_offsets
->CommOffset
, comm_fault_offsets
->FaultOffset
);
840 if (comm_fault_offsets
->CommOffset
== -1)
841 comm_status
= (ULONG
*)&RetVal
;
842 else if (comm_fault_offsets
->CommOffset
>= 0)
843 comm_status
= *(ULONG
**)ARG_FROM_OFFSET(stubMsg
.StackTop
, comm_fault_offsets
->CommOffset
);
847 if (comm_fault_offsets
->FaultOffset
== -1)
848 fault_status
= (ULONG
*)&RetVal
;
849 else if (comm_fault_offsets
->FaultOffset
>= 0)
850 fault_status
= *(ULONG
**)ARG_FROM_OFFSET(stubMsg
.StackTop
, comm_fault_offsets
->CommOffset
);
854 NdrMapCommAndFaultStatus(&stubMsg
, comm_status
, fault_status
,
863 TRACE( "CALCSIZE\n" );
864 client_do_args(&stubMsg
, pFormat
, STUBLESS_CALCSIZE
, fpu_stack
,
865 number_of_params
, (unsigned char *)&RetVal
);
868 TRACE( "GETBUFFER\n" );
869 if (Oif_flags
.HasPipes
)
870 /* NdrGetPipeBuffer(...) */
871 FIXME("pipes not supported yet\n");
874 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
876 NdrNsGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
878 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
881 NdrGetBuffer(&stubMsg
, stubMsg
.BufferLength
, hBinding
);
885 TRACE( "MARSHAL\n" );
886 client_do_args(&stubMsg
, pFormat
, STUBLESS_MARSHAL
, fpu_stack
,
887 number_of_params
, (unsigned char *)&RetVal
);
890 TRACE( "SENDRECEIVE\n" );
891 if (Oif_flags
.HasPipes
)
892 /* NdrPipesSendReceive(...) */
893 FIXME("pipes not supported yet\n");
896 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
898 NdrNsSendReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
900 FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
903 NdrSendReceive(&stubMsg
, stubMsg
.Buffer
);
906 /* convert strings, floating point values and endianness into our
907 * preferred format */
908 if ((rpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
909 NdrConvert(&stubMsg
, pFormat
);
912 TRACE( "UNMARSHAL\n" );
913 client_do_args(&stubMsg
, pFormat
, STUBLESS_UNMARSHAL
, fpu_stack
,
914 number_of_params
, (unsigned char *)&RetVal
);
917 if (ext_flags
.HasNewCorrDesc
)
919 /* free extra correlation package */
920 NdrCorrelationFree(&stubMsg
);
923 if (Oif_flags
.HasPipes
)
925 /* NdrPipesDone(...) */
928 /* free the full pointer translation tables */
929 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
930 NdrFullPointerXlatFree(stubMsg
.FullPtrXlatTables
);
932 /* free marshalling buffer */
933 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
934 NdrProxyFreeBuffer(This
, &stubMsg
);
937 NdrFreeBuffer(&stubMsg
);
938 client_free_handle(&stubMsg
, pProcHeader
, pHandleFormat
, hBinding
);
942 TRACE("RetVal = 0x%lx\n", RetVal
);
948 __ASM_GLOBAL_FUNC( NdrClientCall2
,
949 "movq %r8,0x18(%rsp)\n\t"
950 "movq %r9,0x20(%rsp)\n\t"
951 "leaq 0x18(%rsp),%r8\n\t"
953 "subq $0x28,%rsp\n\t"
954 __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
955 "call " __ASM_NAME("ndr_client_call") "\n\t"
956 "addq $0x28,%rsp\n\t"
957 __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
960 #else /* __x86_64__ */
962 /***********************************************************************
963 * NdrClientCall2 [RPCRT4.@]
965 CLIENT_CALL_RETURN WINAPIV
NdrClientCall2( PMIDL_STUB_DESC desc
, PFORMAT_STRING format
, ... )
970 __ms_va_start( args
, format
);
971 ret
= ndr_client_call( desc
, format
, va_arg( args
, void ** ), NULL
);
973 return *(CLIENT_CALL_RETURN
*)&ret
;
976 #endif /* __x86_64__ */
978 /* Calls a function with the specified arguments, restoring the stack
979 * properly afterwards as we don't know the calling convention of the
981 #if defined __i386__ && defined _MSC_VER
982 __declspec(naked
) LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
)
988 push edi
; Save registers
990 mov eax
, [ebp
+16] ; Get stack size
991 sub esp
, eax
; Make room in stack
for arguments
998 rep movsd
; Copy dword blocks
999 call
[ebp
+8] ; Call function
1000 lea esp
, [ebp
-8] ; Restore stack
1001 pop esi
; Restore registers
1007 #elif defined __i386__ && defined __GNUC__
1008 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
);
1009 __ASM_GLOBAL_FUNC(call_server_func
,
1011 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
1012 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
1013 "movl %esp,%ebp\n\t"
1014 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
1015 "pushl %edi\n\t" /* Save registers */
1016 __ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
1018 __ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
1019 "movl 16(%ebp), %eax\n\t" /* Get stack size */
1020 "subl %eax, %esp\n\t" /* Make room in stack for arguments */
1021 "andl $~15, %esp\n\t" /* Make sure stack has 16-byte alignment for Mac OS X */
1022 "movl %esp, %edi\n\t"
1023 "movl %eax, %ecx\n\t"
1024 "movl 12(%ebp), %esi\n\t"
1025 "shrl $2, %ecx\n\t" /* divide by 4 */
1027 "rep; movsl\n\t" /* Copy dword blocks */
1028 "call *8(%ebp)\n\t" /* Call function */
1029 "leal -8(%ebp), %esp\n\t" /* Restore stack */
1030 "popl %esi\n\t" /* Restore registers */
1031 __ASM_CFI(".cfi_same_value %esi\n\t")
1033 __ASM_CFI(".cfi_same_value %edi\n\t")
1035 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
1036 __ASM_CFI(".cfi_same_value %ebp\n\t")
1038 #elif defined __x86_64__
1039 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned int stack_size
);
1040 __ASM_GLOBAL_FUNC( call_server_func
,
1042 __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
1043 __ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
1044 "movq %rsp,%rbp\n\t"
1045 __ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
1047 __ASM_CFI(".cfi_rel_offset %rsi,-8\n\t")
1049 __ASM_CFI(".cfi_rel_offset %rdi,-16\n\t")
1050 "movq %rcx,%rax\n\t" /* function to call */
1051 "movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */
1053 "cmovgq %r8,%rcx\n\t"
1054 "subq %rcx,%rsp\n\t"
1055 "andq $~15,%rsp\n\t"
1058 "movq %rsp,%rdi\n\t"
1059 "movq %rdx,%rsi\n\t"
1060 "rep; movsq\n\t" /* copy arguments */
1061 "movq 0(%rsp),%rcx\n\t"
1062 "movq 8(%rsp),%rdx\n\t"
1063 "movq 16(%rsp),%r8\n\t"
1064 "movq 24(%rsp),%r9\n\t"
1065 "movq %rcx,%xmm0\n\t"
1066 "movq %rdx,%xmm1\n\t"
1067 "movq %r8,%xmm2\n\t"
1068 "movq %r9,%xmm3\n\t"
1070 "leaq -16(%rbp),%rsp\n\t" /* restore stack */
1072 __ASM_CFI(".cfi_same_value %rdi\n\t")
1074 __ASM_CFI(".cfi_same_value %rsi\n\t")
1075 __ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
1077 __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
1078 __ASM_CFI(".cfi_same_value %rbp\n\t")
1081 #warning call_server_func not implemented for your architecture
1082 LONG_PTR __cdecl
call_server_func(SERVER_ROUTINE func
, unsigned char * args
, unsigned short stack_size
)
1084 FIXME("Not implemented for your architecture\n");
1089 static LONG_PTR
*stub_do_args(MIDL_STUB_MESSAGE
*pStubMsg
,
1090 PFORMAT_STRING pFormat
, enum stubless_phase phase
,
1091 unsigned short number_of_params
)
1093 const NDR_PARAM_OIF
*params
= (const NDR_PARAM_OIF
*)pFormat
;
1095 LONG_PTR
*retval_ptr
= NULL
;
1097 for (i
= 0; i
< number_of_params
; i
++)
1099 unsigned char *pArg
= pStubMsg
->StackTop
+ params
[i
].stack_offset
;
1100 const unsigned char *pTypeFormat
= &pStubMsg
->StubDesc
->pFormatTypes
[params
[i
].u
.type_offset
];
1102 TRACE("param[%d]: %p -> %p type %02x %s\n", i
,
1103 pArg
, *(unsigned char **)pArg
,
1104 params
[i
].attr
.IsBasetype
? params
[i
].u
.type_format_char
: *pTypeFormat
,
1105 debugstr_PROC_PF( params
[i
].attr
));
1109 case STUBLESS_MARSHAL
:
1110 if (params
[i
].attr
.IsOut
|| params
[i
].attr
.IsReturn
)
1111 call_marshaller(pStubMsg
, pArg
, ¶ms
[i
]);
1114 if (params
[i
].attr
.MustFree
)
1116 call_freer(pStubMsg
, pArg
, ¶ms
[i
]);
1118 else if (params
[i
].attr
.ServerAllocSize
)
1120 HeapFree(GetProcessHeap(), 0, *(void **)pArg
);
1122 else if (params
[i
].attr
.IsOut
&&
1123 !params
[i
].attr
.IsIn
&&
1124 !params
[i
].attr
.IsBasetype
&&
1125 !params
[i
].attr
.IsByValue
)
1127 if (*pTypeFormat
!= RPC_FC_BIND_CONTEXT
) pStubMsg
->pfnFree(*(void **)pArg
);
1130 case STUBLESS_INITOUT
:
1131 if (!params
[i
].attr
.IsIn
&&
1132 params
[i
].attr
.IsOut
&&
1133 !params
[i
].attr
.IsBasetype
&&
1134 !params
[i
].attr
.ServerAllocSize
&&
1135 !params
[i
].attr
.IsByValue
)
1137 if (*pTypeFormat
== RPC_FC_BIND_CONTEXT
)
1139 NDR_SCONTEXT ctxt
= NdrContextHandleInitialize(pStubMsg
, pTypeFormat
);
1140 *(void **)pArg
= NDRSContextValue(ctxt
);
1144 DWORD size
= calc_arg_size(pStubMsg
, pTypeFormat
);
1147 *(void **)pArg
= NdrAllocate(pStubMsg
, size
);
1148 memset(*(void **)pArg
, 0, size
);
1153 case STUBLESS_UNMARSHAL
:
1154 if (params
[i
].attr
.ServerAllocSize
)
1155 *(void **)pArg
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
1156 params
[i
].attr
.ServerAllocSize
* 8);
1158 if (params
[i
].attr
.IsIn
)
1159 call_unmarshaller(pStubMsg
, &pArg
, ¶ms
[i
], 0);
1161 case STUBLESS_CALCSIZE
:
1162 if (params
[i
].attr
.IsOut
|| params
[i
].attr
.IsReturn
)
1163 call_buffer_sizer(pStubMsg
, pArg
, ¶ms
[i
]);
1166 RpcRaiseException(RPC_S_INTERNAL_ERROR
);
1168 TRACE("\tmemory addr (after): %p -> %p\n", pArg
, *(unsigned char **)pArg
);
1170 /* make a note of the address of the return value parameter for later */
1171 if (params
[i
].attr
.IsReturn
) retval_ptr
= (LONG_PTR
*)pArg
;
1176 /***********************************************************************
1177 * NdrStubCall2 [RPCRT4.@]
1179 * Unmarshals [in] parameters, calls either a method in an object or a server
1180 * function, marshals any [out] parameters and frees any allocated data.
1183 * Used by stubless MIDL-generated code.
1185 LONG WINAPI
NdrStubCall2(
1186 struct IRpcStubBuffer
* pThis
,
1187 struct IRpcChannelBuffer
* pChannel
,
1188 PRPC_MESSAGE pRpcMsg
,
1189 DWORD
* pdwStubPhase
)
1191 const MIDL_SERVER_INFO
*pServerInfo
;
1192 const MIDL_STUB_DESC
*pStubDesc
;
1193 PFORMAT_STRING pFormat
;
1194 MIDL_STUB_MESSAGE stubMsg
;
1195 /* pointer to start of stack to pass into stub implementation */
1196 unsigned char * args
;
1198 unsigned short stack_size
;
1199 /* number of parameters. optional for client to give it to us */
1200 unsigned int number_of_params
;
1201 /* cache of Oif_flags from v2 procedure header */
1202 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
1203 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1204 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
1205 /* the type of pass we are currently doing */
1206 enum stubless_phase phase
;
1207 /* header for procedure string */
1208 const NDR_PROC_HEADER
*pProcHeader
;
1209 /* location to put retval into */
1210 LONG_PTR
*retval_ptr
= NULL
;
1211 /* correlation cache */
1212 ULONG_PTR NdrCorrCache
[256];
1214 TRACE("pThis %p, pChannel %p, pRpcMsg %p, pdwStubPhase %p\n", pThis
, pChannel
, pRpcMsg
, pdwStubPhase
);
1217 pServerInfo
= CStdStubBuffer_GetServerInfo(pThis
);
1219 pServerInfo
= ((RPC_SERVER_INTERFACE
*)pRpcMsg
->RpcInterfaceInformation
)->InterpreterInfo
;
1221 pStubDesc
= pServerInfo
->pStubDesc
;
1222 pFormat
= pServerInfo
->ProcString
+ pServerInfo
->FmtStringOffset
[pRpcMsg
->ProcNum
];
1223 pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
1225 TRACE("NDR Version: 0x%x\n", pStubDesc
->Version
);
1227 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1229 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
1230 stack_size
= pProcHeader
->stack_size
;
1231 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
1236 stack_size
= pProcHeader
->stack_size
;
1237 pFormat
+= sizeof(NDR_PROC_HEADER
);
1240 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
1243 switch (pProcHeader
->handle_type
)
1245 /* explicit binding: parse additional section */
1246 case RPC_FC_BIND_EXPLICIT
:
1247 switch (*pFormat
) /* handle_type */
1249 case RPC_FC_BIND_PRIMITIVE
: /* explicit primitive */
1250 pFormat
+= sizeof(NDR_EHD_PRIMITIVE
);
1252 case RPC_FC_BIND_GENERIC
: /* explicit generic */
1253 pFormat
+= sizeof(NDR_EHD_GENERIC
);
1255 case RPC_FC_BIND_CONTEXT
: /* explicit context */
1256 pFormat
+= sizeof(NDR_EHD_CONTEXT
);
1259 ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
1260 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1263 case RPC_FC_BIND_GENERIC
: /* implicit generic */
1264 case RPC_FC_BIND_PRIMITIVE
: /* implicit primitive */
1265 case RPC_FC_CALLBACK_HANDLE
: /* implicit callback */
1266 case RPC_FC_AUTO_HANDLE
: /* implicit auto handle */
1269 ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader
->handle_type
);
1270 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1273 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1274 NdrStubInitialize(pRpcMsg
, &stubMsg
, pStubDesc
, pChannel
);
1276 NdrServerInitializeNew(pRpcMsg
, &stubMsg
, pStubDesc
);
1278 /* create the full pointer translation tables, if requested */
1279 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1280 stubMsg
.FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_SERVER
);
1282 /* store the RPC flags away */
1283 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1284 pRpcMsg
->RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
1286 /* use alternate memory allocation routines */
1287 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
1289 NdrRpcSsEnableAllocate(&stubMsg
);
1291 FIXME("Set RPCSS memory allocation routines\n");
1294 TRACE("allocating memory for stack of size %x\n", stack_size
);
1296 args
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, stack_size
);
1297 stubMsg
.StackTop
= args
; /* used by conformance of top-level objects */
1299 /* add the implicit This pointer as the first arg to the function if we
1300 * are calling an object method */
1302 *(void **)args
= ((CStdStubBuffer
*)pThis
)->pvServerObject
;
1304 if (pStubDesc
->Version
>= 0x20000) /* -Oicf format */
1306 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
= (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
1308 Oif_flags
= pOIFHeader
->Oi2Flags
;
1309 number_of_params
= pOIFHeader
->number_of_params
;
1311 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
1313 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
1315 if (Oif_flags
.HasExtensions
)
1317 const NDR_PROC_HEADER_EXTS
*pExtensions
= (const NDR_PROC_HEADER_EXTS
*)pFormat
;
1318 ext_flags
= pExtensions
->Flags2
;
1319 pFormat
+= pExtensions
->Size
;
1322 if (Oif_flags
.HasPipes
)
1324 FIXME("pipes not supported yet\n");
1325 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
1326 /* init pipes package */
1327 /* NdrPipesInitialize(...) */
1329 if (ext_flags
.HasNewCorrDesc
)
1331 /* initialize extra correlation package */
1332 FIXME("new correlation description not implemented\n");
1333 stubMsg
.fHasNewCorrDesc
= TRUE
;
1338 pFormat
= convert_old_args( &stubMsg
, pFormat
, stack_size
,
1339 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
1340 /* reuse the correlation cache, it's not needed for v1 format */
1341 NdrCorrCache
, sizeof(NdrCorrCache
), &number_of_params
);
1344 /* convert strings, floating point values and endianess into our
1345 * preferred format */
1346 if ((pRpcMsg
->DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
1347 NdrConvert(&stubMsg
, pFormat
);
1349 for (phase
= STUBLESS_UNMARSHAL
; phase
<= STUBLESS_FREE
; phase
++)
1351 TRACE("phase = %d\n", phase
);
1354 case STUBLESS_CALLSERVER
:
1355 /* call the server function */
1356 if (pServerInfo
->ThunkTable
&& pServerInfo
->ThunkTable
[pRpcMsg
->ProcNum
])
1357 pServerInfo
->ThunkTable
[pRpcMsg
->ProcNum
](&stubMsg
);
1360 SERVER_ROUTINE func
;
1363 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1365 SERVER_ROUTINE
*vtbl
= *(SERVER_ROUTINE
**)((CStdStubBuffer
*)pThis
)->pvServerObject
;
1366 func
= vtbl
[pRpcMsg
->ProcNum
];
1369 func
= pServerInfo
->DispatchTable
[pRpcMsg
->ProcNum
];
1371 /* FIXME: what happens with return values that don't fit into a single register on x86? */
1372 retval
= call_server_func(func
, args
, stack_size
);
1376 TRACE("stub implementation returned 0x%lx\n", retval
);
1377 *retval_ptr
= retval
;
1380 TRACE("void stub implementation\n");
1383 stubMsg
.Buffer
= NULL
;
1384 stubMsg
.BufferLength
= 0;
1387 case STUBLESS_GETBUFFER
:
1388 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1389 NdrStubGetBuffer(pThis
, pChannel
, &stubMsg
);
1394 pRpcMsg
->BufferLength
= stubMsg
.BufferLength
;
1395 /* allocate buffer for [out] and [ret] params */
1396 Status
= I_RpcGetBuffer(pRpcMsg
);
1398 RpcRaiseException(Status
);
1399 stubMsg
.Buffer
= pRpcMsg
->Buffer
;
1402 case STUBLESS_UNMARSHAL
:
1403 case STUBLESS_INITOUT
:
1404 case STUBLESS_CALCSIZE
:
1405 case STUBLESS_MARSHAL
:
1407 retval_ptr
= stub_do_args(&stubMsg
, pFormat
, phase
, number_of_params
);
1410 ERR("shouldn't reach here. phase %d\n", phase
);
1415 pRpcMsg
->BufferLength
= (unsigned int)(stubMsg
.Buffer
- (unsigned char *)pRpcMsg
->Buffer
);
1417 if (ext_flags
.HasNewCorrDesc
)
1419 /* free extra correlation package */
1420 /* NdrCorrelationFree(&stubMsg); */
1423 if (Oif_flags
.HasPipes
)
1425 /* NdrPipesDone(...) */
1428 /* free the full pointer translation tables */
1429 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1430 NdrFullPointerXlatFree(stubMsg
.FullPtrXlatTables
);
1432 /* free server function stack */
1433 HeapFree(GetProcessHeap(), 0, args
);
1438 /***********************************************************************
1439 * NdrServerCall2 [RPCRT4.@]
1441 void WINAPI
NdrServerCall2(PRPC_MESSAGE pRpcMsg
)
1444 NdrStubCall2(NULL
, NULL
, pRpcMsg
, &dwPhase
);
1447 /***********************************************************************
1448 * NdrStubCall [RPCRT4.@]
1450 LONG WINAPI
NdrStubCall( struct IRpcStubBuffer
*This
, struct IRpcChannelBuffer
*channel
,
1451 PRPC_MESSAGE msg
, DWORD
*phase
)
1453 return NdrStubCall2( This
, channel
, msg
, phase
);
1456 /***********************************************************************
1457 * NdrServerCall [RPCRT4.@]
1459 void WINAPI
NdrServerCall( PRPC_MESSAGE msg
)
1462 NdrStubCall( NULL
, NULL
, msg
, &phase
);
1465 struct async_call_data
1467 MIDL_STUB_MESSAGE
*pStubMsg
;
1468 const NDR_PROC_HEADER
*pProcHeader
;
1469 PFORMAT_STRING pHandleFormat
;
1470 PFORMAT_STRING pParamFormat
;
1471 RPC_BINDING_HANDLE hBinding
;
1473 unsigned short stack_size
;
1474 /* number of parameters. optional for client to give it to us */
1475 unsigned int number_of_params
;
1476 /* correlation cache */
1477 ULONG_PTR NdrCorrCache
[256];
1480 LONG_PTR CDECL
ndr_async_client_call( PMIDL_STUB_DESC pStubDesc
, PFORMAT_STRING pFormat
, void **stack_top
)
1482 /* pointer to start of stack where arguments start */
1483 PRPC_MESSAGE pRpcMsg
;
1484 PMIDL_STUB_MESSAGE pStubMsg
;
1485 RPC_ASYNC_STATE
*pAsync
;
1486 struct async_call_data
*async_call_data
;
1487 /* procedure number */
1488 unsigned short procedure_number
;
1489 /* cache of Oif_flags from v2 procedure header */
1490 INTERPRETER_OPT_FLAGS Oif_flags
= { 0 };
1491 /* cache of extension flags from NDR_PROC_HEADER_EXTS */
1492 INTERPRETER_OPT_FLAGS2 ext_flags
= { 0 };
1493 /* header for procedure string */
1494 const NDR_PROC_HEADER
* pProcHeader
= (const NDR_PROC_HEADER
*)&pFormat
[0];
1495 /* -Oif or -Oicf generated format */
1496 BOOL bV2Format
= FALSE
;
1499 TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc
, pFormat
);
1501 /* Later NDR language versions probably won't be backwards compatible */
1502 if (pStubDesc
->Version
> 0x50002)
1504 FIXME("Incompatible stub description version: 0x%x\n", pStubDesc
->Version
);
1505 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
);
1508 async_call_data
= I_RpcAllocate(sizeof(*async_call_data
) + sizeof(MIDL_STUB_MESSAGE
) + sizeof(RPC_MESSAGE
));
1509 if (!async_call_data
) RpcRaiseException(ERROR_OUTOFMEMORY
);
1510 async_call_data
->pProcHeader
= pProcHeader
;
1512 async_call_data
->pStubMsg
= pStubMsg
= (PMIDL_STUB_MESSAGE
)(async_call_data
+ 1);
1513 pRpcMsg
= (PRPC_MESSAGE
)(pStubMsg
+ 1);
1515 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1517 const NDR_PROC_HEADER_RPC
*pProcHeader
= (const NDR_PROC_HEADER_RPC
*)&pFormat
[0];
1518 async_call_data
->stack_size
= pProcHeader
->stack_size
;
1519 procedure_number
= pProcHeader
->proc_num
;
1520 pFormat
+= sizeof(NDR_PROC_HEADER_RPC
);
1524 async_call_data
->stack_size
= pProcHeader
->stack_size
;
1525 procedure_number
= pProcHeader
->proc_num
;
1526 pFormat
+= sizeof(NDR_PROC_HEADER
);
1528 TRACE("stack size: 0x%x\n", async_call_data
->stack_size
);
1529 TRACE("proc num: %d\n", procedure_number
);
1531 /* create the full pointer translation tables, if requested */
1532 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1533 pStubMsg
->FullPtrXlatTables
= NdrFullPointerXlatInit(0,XLAT_CLIENT
);
1535 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
)
1537 ERR("objects not supported\n");
1538 I_RpcFree(async_call_data
);
1539 RpcRaiseException(RPC_X_BAD_STUB_DATA
);
1542 NdrClientInitializeNew(pRpcMsg
, pStubMsg
, pStubDesc
, procedure_number
);
1544 TRACE("Oi_flags = 0x%02x\n", pProcHeader
->Oi_flags
);
1545 TRACE("MIDL stub version = 0x%x\n", pStubDesc
->MIDLVersion
);
1547 /* needed for conformance of top-level objects */
1548 pStubMsg
->StackTop
= I_RpcAllocate(async_call_data
->stack_size
);
1549 memcpy(pStubMsg
->StackTop
, stack_top
, async_call_data
->stack_size
);
1551 pAsync
= *(RPC_ASYNC_STATE
**)pStubMsg
->StackTop
;
1552 pAsync
->StubInfo
= async_call_data
;
1553 async_call_data
->pHandleFormat
= pFormat
;
1555 pFormat
= client_get_handle(pStubMsg
, pProcHeader
, async_call_data
->pHandleFormat
, &async_call_data
->hBinding
);
1556 if (!pFormat
) goto done
;
1558 bV2Format
= (pStubDesc
->Version
>= 0x20000);
1562 const NDR_PROC_PARTIAL_OIF_HEADER
*pOIFHeader
=
1563 (const NDR_PROC_PARTIAL_OIF_HEADER
*)pFormat
;
1565 Oif_flags
= pOIFHeader
->Oi2Flags
;
1566 async_call_data
->number_of_params
= pOIFHeader
->number_of_params
;
1568 pFormat
+= sizeof(NDR_PROC_PARTIAL_OIF_HEADER
);
1570 TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags
) );
1572 if (Oif_flags
.HasExtensions
)
1574 const NDR_PROC_HEADER_EXTS
*pExtensions
=
1575 (const NDR_PROC_HEADER_EXTS
*)pFormat
;
1576 ext_flags
= pExtensions
->Flags2
;
1577 pFormat
+= pExtensions
->Size
;
1582 pFormat
= convert_old_args( pStubMsg
, pFormat
, async_call_data
->stack_size
,
1583 pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_OBJECT
,
1584 async_call_data
->NdrCorrCache
, sizeof(async_call_data
->NdrCorrCache
),
1585 &async_call_data
->number_of_params
);
1588 async_call_data
->pParamFormat
= pFormat
;
1590 pStubMsg
->BufferLength
= 0;
1592 /* store the RPC flags away */
1593 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCFLAGS
)
1594 pRpcMsg
->RpcFlags
= ((const NDR_PROC_HEADER_RPC
*)pProcHeader
)->rpc_flags
;
1596 /* use alternate memory allocation routines */
1597 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_RPCSSALLOC
)
1598 NdrRpcSmSetClientToOsf(pStubMsg
);
1600 if (Oif_flags
.HasPipes
)
1602 FIXME("pipes not supported yet\n");
1603 RpcRaiseException(RPC_X_WRONG_STUB_VERSION
); /* FIXME: remove when implemented */
1604 /* init pipes package */
1605 /* NdrPipesInitialize(...) */
1607 if (ext_flags
.HasNewCorrDesc
)
1609 /* initialize extra correlation package */
1610 NdrCorrelationInitialize(pStubMsg
, async_call_data
->NdrCorrCache
, sizeof(async_call_data
->NdrCorrCache
), 0);
1614 * 1. CALCSIZE - calculate the buffer size
1615 * 2. GETBUFFER - allocate the buffer
1616 * 3. MARSHAL - marshal [in] params into the buffer
1617 * 4. SENDRECEIVE - send buffer
1618 * Then in NdrpCompleteAsyncClientCall:
1619 * 1. SENDRECEIVE - receive buffer
1620 * 2. UNMARSHAL - unmarshal [out] params from buffer
1624 TRACE( "CALCSIZE\n" );
1625 client_do_args(pStubMsg
, pFormat
, STUBLESS_CALCSIZE
, NULL
, async_call_data
->number_of_params
, NULL
);
1628 TRACE( "GETBUFFER\n" );
1629 if (Oif_flags
.HasPipes
)
1630 /* NdrGetPipeBuffer(...) */
1631 FIXME("pipes not supported yet\n");
1634 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1636 NdrNsGetBuffer(pStubMsg
, pStubMsg
->BufferLength
, async_call_data
->hBinding
);
1638 FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
1641 NdrGetBuffer(pStubMsg
, pStubMsg
->BufferLength
, async_call_data
->hBinding
);
1643 pRpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1644 status
= I_RpcAsyncSetHandle(pRpcMsg
, pAsync
);
1645 if (status
!= RPC_S_OK
)
1646 RpcRaiseException(status
);
1649 TRACE( "MARSHAL\n" );
1650 client_do_args(pStubMsg
, pFormat
, STUBLESS_MARSHAL
, NULL
, async_call_data
->number_of_params
, NULL
);
1652 /* 4. SENDRECEIVE */
1654 pRpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1655 /* send the [in] params only */
1656 if (Oif_flags
.HasPipes
)
1657 /* NdrPipesSend(...) */
1658 FIXME("pipes not supported yet\n");
1661 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1663 NdrNsSend(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
1665 FIXME("using auto handle - call NdrNsSend when it gets implemented\n");
1669 pStubMsg
->RpcMsg
->BufferLength
= pStubMsg
->Buffer
- (unsigned char *)pStubMsg
->RpcMsg
->Buffer
;
1670 status
= I_RpcSend(pStubMsg
->RpcMsg
);
1671 if (status
!= RPC_S_OK
)
1672 RpcRaiseException(status
);
1677 TRACE("returning 0\n");
1681 RPC_STATUS
NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE
*pAsync
, void *Reply
)
1683 /* pointer to start of stack where arguments start */
1684 PMIDL_STUB_MESSAGE pStubMsg
;
1685 struct async_call_data
*async_call_data
;
1686 /* header for procedure string */
1687 const NDR_PROC_HEADER
* pProcHeader
;
1688 RPC_STATUS status
= RPC_S_OK
;
1690 if (!pAsync
->StubInfo
)
1691 return RPC_S_INVALID_ASYNC_HANDLE
;
1693 async_call_data
= pAsync
->StubInfo
;
1694 pStubMsg
= async_call_data
->pStubMsg
;
1695 pProcHeader
= async_call_data
->pProcHeader
;
1698 * 1. CALCSIZE - calculate the buffer size
1699 * 2. GETBUFFER - allocate the buffer
1700 * 3. MARSHAL - marshal [in] params into the buffer
1701 * 4. SENDRECEIVE - send buffer
1702 * Then in NdrpCompleteAsyncClientCall:
1703 * 1. SENDRECEIVE - receive buffer
1704 * 2. UNMARSHAL - unmarshal [out] params from buffer
1707 /* 1. SENDRECEIVE */
1708 TRACE( "RECEIVE\n" );
1709 pStubMsg
->RpcMsg
->RpcFlags
|= RPC_BUFFER_ASYNC
;
1710 /* receive the [out] params */
1711 if (pProcHeader
->handle_type
== RPC_FC_AUTO_HANDLE
)
1713 NdrNsReceive(&stubMsg
, stubMsg
.Buffer
, pStubDesc
->IMPLICIT_HANDLE_INFO
.pAutoHandle
);
1715 FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
1719 status
= I_RpcReceive(pStubMsg
->RpcMsg
);
1720 if (status
!= RPC_S_OK
)
1722 pStubMsg
->BufferLength
= pStubMsg
->RpcMsg
->BufferLength
;
1723 pStubMsg
->BufferStart
= pStubMsg
->RpcMsg
->Buffer
;
1724 pStubMsg
->BufferEnd
= pStubMsg
->BufferStart
+ pStubMsg
->BufferLength
;
1725 pStubMsg
->Buffer
= pStubMsg
->BufferStart
;
1728 /* convert strings, floating point values and endianness into our
1729 * preferred format */
1731 if ((pStubMsg
->RpcMsg
.DataRepresentation
& 0x0000FFFFUL
) != NDR_LOCAL_DATA_REPRESENTATION
)
1732 NdrConvert(pStubMsg
, pFormat
);
1736 TRACE( "UNMARSHAL\n" );
1737 client_do_args(pStubMsg
, async_call_data
->pParamFormat
, STUBLESS_UNMARSHAL
,
1738 NULL
, async_call_data
->number_of_params
, Reply
);
1741 if (pStubMsg
->fHasNewCorrDesc
)
1743 /* free extra correlation package */
1744 NdrCorrelationFree(pStubMsg
);
1747 /* free the full pointer translation tables */
1748 if (pProcHeader
->Oi_flags
& RPC_FC_PROC_OIF_FULLPTR
)
1749 NdrFullPointerXlatFree(pStubMsg
->FullPtrXlatTables
);
1751 /* free marshalling buffer */
1752 NdrFreeBuffer(pStubMsg
);
1753 client_free_handle(pStubMsg
, pProcHeader
, async_call_data
->pHandleFormat
, async_call_data
->hBinding
);
1755 I_RpcFree(pStubMsg
->StackTop
);
1756 I_RpcFree(async_call_data
);
1758 TRACE("-- 0x%x\n", status
);
1764 __ASM_GLOBAL_FUNC( NdrAsyncClientCall
,
1765 "movq %r8,0x18(%rsp)\n\t"
1766 "movq %r9,0x20(%rsp)\n\t"
1767 "leaq 0x18(%rsp),%r8\n\t"
1768 "subq $0x28,%rsp\n\t"
1769 __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
1770 "call " __ASM_NAME("ndr_async_client_call") "\n\t"
1771 "addq $0x28,%rsp\n\t"
1772 __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
1775 #else /* __x86_64__ */
1777 /***********************************************************************
1778 * NdrAsyncClientCall [RPCRT4.@]
1780 CLIENT_CALL_RETURN WINAPIV
NdrAsyncClientCall( PMIDL_STUB_DESC desc
, PFORMAT_STRING format
, ... )
1785 __ms_va_start( args
, format
);
1786 ret
= ndr_async_client_call( desc
, format
, va_arg( args
, void ** ));
1787 __ms_va_end( args
);
1788 return *(CLIENT_CALL_RETURN
*)&ret
;
1791 #endif /* __x86_64__ */
1793 RPCRTAPI LONG RPC_ENTRY
NdrAsyncStubCall(struct IRpcStubBuffer
* pThis
,
1794 struct IRpcChannelBuffer
* pChannel
, PRPC_MESSAGE pRpcMsg
,
1795 DWORD
* pdwStubPhase
)
1797 FIXME("unimplemented, expect crash!\n");