widl: Add /robust flags in correlation descriptors.

This commit is contained in:
Alexandre Julliard 2024-04-01 20:47:03 +02:00
parent 896b4f05ea
commit 4d8ee6bb18
5 changed files with 31 additions and 22 deletions

View file

@ -7259,15 +7259,13 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
*/
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
{
static int once;
if (!once++)
FIXME("(%p, %p, %ld, 0x%lx): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
TRACE("(%p, %p, %ld, 0x%lx)\n", pStubMsg, pMemory, CacheSize, Flags);
if (pStubMsg->CorrDespIncrement == 0)
pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
pStubMsg->fHasNewCorrDesc = TRUE;
pStubMsg->pCorrInfo = pMemory;
}
/***********************************************************************
@ -7300,8 +7298,5 @@ void WINAPI NdrCorrelationPass(PMIDL_STUB_MESSAGE pStubMsg)
*/
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
{
static int once;
if (!once++)
FIXME("(%p): stub\n", pStubMsg);
/* FIXME: free memory */
}

View file

@ -640,7 +640,9 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str,
{
WRITE_SHORT(str, *len, size);
WRITE_INT(str, *len, 0xffffffff); /* conformance */
WRITE_SHORT(str, *len, 0);
WRITE_INT(str, *len, 0xffffffff); /* variance */
WRITE_SHORT(str, *len, 0);
}
else
{
@ -1099,18 +1101,18 @@ static void write_proc_func_header(ITypeInfo *typeinfo, FUNCDESC *desc,
WRITE_SHORT(proc, *proclen, 0); /* constant_client_buffer_size */
WRITE_SHORT(proc, *proclen, 0); /* constant_server_buffer_size */
#ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 0x47); /* HasExtensions | HasReturn | ClientMustSize | ServerMustSize */
#else
WRITE_CHAR (proc, *proclen, 0x07); /* HasReturn | ClientMustSize | ServerMustSize */
#endif
WRITE_CHAR (proc, *proclen, desc->cParams + 1); /* incl. return value */
#ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 10); /* extension size */
WRITE_CHAR (proc, *proclen, 0); /* INTERPRETER_OPT_FLAGS2 */
#else
WRITE_CHAR (proc, *proclen, 8); /* extension size */
#endif
WRITE_CHAR (proc, *proclen, 1); /* HasNewCorrDesc */
WRITE_SHORT(proc, *proclen, 0); /* ClientCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
#ifdef __x86_64__
for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++)
{
basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);

View file

@ -106,6 +106,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (has_full_pointer)
write_full_pointer_free(client, indent, func);
if (interpreted_mode) print_client("NdrCorrelationFree(&__frame->_StubMsg);\n");
print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
if (explicit_fc == FC_BIND_GENERIC)
@ -134,6 +135,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
write_type_decl(client, &retval->declspec, retval->name);
fprintf(client, ";\n");
}
if (interpreted_mode) print_client("ULONG _NdrCorrCache[256];\n");
print_client("RPC_MESSAGE _RpcMessage;\n");
if (handle_var)
@ -213,6 +215,8 @@ static void write_function_stub( const type_t *iface, const var_t *func,
}
break;
}
if (interpreted_mode)
print_client( "NdrCorrelationInitialize(&__frame->_StubMsg, _NdrCorrCache, sizeof(_NdrCorrCache), 0);\n" );
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE);

View file

@ -69,6 +69,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
print_server("static void __finally_%s_%s(", iface->name, get_name(func));
fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(func));
if (interpreted_mode) print_server("NdrCorrelationFree(&__frame->_StubMsg);\n");
indent++;
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
@ -87,6 +89,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
fprintf(server, "{\n");
indent++;
print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(func));
if (interpreted_mode) print_server("ULONG _NdrCorrCache[256];\n");
if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n");
fprintf(server, "\n");
@ -113,6 +116,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
print_server("RpcTryExcept\n");
print_server("{\n");
indent++;
if (interpreted_mode)
print_server("NdrCorrelationInitialize(&__frame->_StubMsg, _NdrCorrCache, sizeof(_NdrCorrCache), 0);\n" );
if (has_full_pointer)
write_full_pointer_init(server, indent, func, TRUE);

View file

@ -1342,7 +1342,7 @@ static void write_proc_func_interp( FILE *file, int indent, const type_t *iface,
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
unsigned char oi_flags = Oi_HAS_RPCFLAGS | Oi_USE_NEW_INIT_ROUTINES;
unsigned char oi2_flags = get_func_oi2_flags( func );
unsigned char ext_flags = 0;
unsigned char ext_flags = 0x01; /* HasNewCorrDesc */
unsigned int rpc_flags = get_rpc_flags( func->attrs );
unsigned int nb_args = 0;
unsigned int stack_size = 0;
@ -1621,6 +1621,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
{
unsigned char operator_type = 0;
unsigned char conftype = FC_NORMAL_CONFORMANCE;
unsigned short robust_flags = 0;
const char *conftype_string = "field";
const expr_t *subexpr;
const type_t *iface = NULL;
@ -1629,7 +1630,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (!expr)
{
print_file(file, 2, "NdrFcLong(0xffffffff),\t/* -1 */\n");
return 4;
goto done;
}
if (expr->is_const)
@ -1643,8 +1644,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
FC_CONSTANT_CONFORMANCE, expr->cval);
print_file(file, 2, "0x%x,\n", expr->cval >> 16);
print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval);
return 4;
goto done;
}
if (!cont_type) /* top-level conformance */
@ -1854,7 +1854,10 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
print_file(file, 2, "0x0,\n" );
print_file(file, 2, "NdrFcShort(0x0),\n" );
}
return 4;
done:
if (!interpreted_mode) return 4;
print_file(file, 2, "NdrFcShort(0x%hx),\n", robust_flags);
return 6;
}
/* return size and start offset of a data field based on current offset */
@ -2495,15 +2498,15 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
unsigned int absoff = ft->typestring_offset;
if (is_attr(ft->attrs, ATTR_SWITCHTYPE))
absoff += 8; /* we already have a corr descr, skip it */
reloff = absoff - (*tfsoff + 6);
print_file(file, 0, "/* %d */\n", *tfsoff);
print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", FC_NON_ENCAPSULATED_UNION);
print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", FC_LONG);
write_conf_or_var_desc(file, current_structure, offset, ft,
get_attrp(f->attrs, ATTR_SWITCHIS));
*tfsoff += 2 + write_conf_or_var_desc(file, current_structure, offset, ft,
get_attrp(f->attrs, ATTR_SWITCHIS));
reloff = absoff - *tfsoff;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
(unsigned short)reloff, reloff, absoff);
*tfsoff += 8;
*tfsoff += 2;
}
offset += size;
}