Commit 4d8ee6bb authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Add /robust flags in correlation descriptors.

parent 896b4f05
...@@ -7259,15 +7259,13 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -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) void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
{ {
static int once; TRACE("(%p, %p, %ld, 0x%lx)\n", pStubMsg, pMemory, CacheSize, Flags);
if (!once++)
FIXME("(%p, %p, %ld, 0x%lx): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
if (pStubMsg->CorrDespIncrement == 0) if (pStubMsg->CorrDespIncrement == 0)
pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */ pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
pStubMsg->fHasNewCorrDesc = TRUE; pStubMsg->fHasNewCorrDesc = TRUE;
pStubMsg->pCorrInfo = pMemory;
} }
/*********************************************************************** /***********************************************************************
...@@ -7300,8 +7298,5 @@ void WINAPI NdrCorrelationPass(PMIDL_STUB_MESSAGE pStubMsg) ...@@ -7300,8 +7298,5 @@ void WINAPI NdrCorrelationPass(PMIDL_STUB_MESSAGE pStubMsg)
*/ */
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg) void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
{ {
static int once; /* FIXME: free memory */
if (!once++)
FIXME("(%p): stub\n", pStubMsg);
} }
...@@ -640,7 +640,9 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str, ...@@ -640,7 +640,9 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str,
{ {
WRITE_SHORT(str, *len, size); WRITE_SHORT(str, *len, size);
WRITE_INT(str, *len, 0xffffffff); /* conformance */ WRITE_INT(str, *len, 0xffffffff); /* conformance */
WRITE_SHORT(str, *len, 0);
WRITE_INT(str, *len, 0xffffffff); /* variance */ WRITE_INT(str, *len, 0xffffffff); /* variance */
WRITE_SHORT(str, *len, 0);
} }
else else
{ {
...@@ -1099,18 +1101,18 @@ static void write_proc_func_header(ITypeInfo *typeinfo, FUNCDESC *desc, ...@@ -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_client_buffer_size */
WRITE_SHORT(proc, *proclen, 0); /* constant_server_buffer_size */ WRITE_SHORT(proc, *proclen, 0); /* constant_server_buffer_size */
#ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 0x47); /* HasExtensions | HasReturn | ClientMustSize | ServerMustSize */ 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 */ WRITE_CHAR (proc, *proclen, desc->cParams + 1); /* incl. return value */
#ifdef __x86_64__ #ifdef __x86_64__
WRITE_CHAR (proc, *proclen, 10); /* extension size */ 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); /* ClientCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */ WRITE_SHORT(proc, *proclen, 0); /* ServerCorrHint */
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */ WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
#ifdef __x86_64__
for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++) for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++)
{ {
basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc); basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);
......
...@@ -106,6 +106,7 @@ static void write_function_stub( const type_t *iface, const var_t *func, ...@@ -106,6 +106,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (has_full_pointer) if (has_full_pointer)
write_full_pointer_free(client, indent, func); write_full_pointer_free(client, indent, func);
if (interpreted_mode) print_client("NdrCorrelationFree(&__frame->_StubMsg);\n");
print_client("NdrFreeBuffer(&__frame->_StubMsg);\n"); print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
if (explicit_fc == FC_BIND_GENERIC) if (explicit_fc == FC_BIND_GENERIC)
...@@ -134,6 +135,7 @@ static void write_function_stub( const type_t *iface, const var_t *func, ...@@ -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); write_type_decl(client, &retval->declspec, retval->name);
fprintf(client, ";\n"); fprintf(client, ";\n");
} }
if (interpreted_mode) print_client("ULONG _NdrCorrCache[256];\n");
print_client("RPC_MESSAGE _RpcMessage;\n"); print_client("RPC_MESSAGE _RpcMessage;\n");
if (handle_var) if (handle_var)
...@@ -213,6 +215,8 @@ static void write_function_stub( const type_t *iface, const var_t *func, ...@@ -213,6 +215,8 @@ static void write_function_stub( const type_t *iface, const var_t *func,
} }
break; break;
} }
if (interpreted_mode)
print_client( "NdrCorrelationInitialize(&__frame->_StubMsg, _NdrCorrCache, sizeof(_NdrCorrCache), 0);\n" );
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE); write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE);
......
...@@ -69,6 +69,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned ...@@ -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)); 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)); fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(func));
if (interpreted_mode) print_server("NdrCorrelationFree(&__frame->_StubMsg);\n");
indent++; indent++;
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE); 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 ...@@ -87,6 +89,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
fprintf(server, "{\n"); fprintf(server, "{\n");
indent++; indent++;
print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(func)); 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"); if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n");
fprintf(server, "\n"); fprintf(server, "\n");
...@@ -113,6 +116,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned ...@@ -113,6 +116,8 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
print_server("RpcTryExcept\n"); print_server("RpcTryExcept\n");
print_server("{\n"); print_server("{\n");
indent++; indent++;
if (interpreted_mode)
print_server("NdrCorrelationInitialize(&__frame->_StubMsg, _NdrCorrCache, sizeof(_NdrCorrCache), 0);\n" );
if (has_full_pointer) if (has_full_pointer)
write_full_pointer_init(server, indent, func, TRUE); write_full_pointer_init(server, indent, func, TRUE);
......
...@@ -1342,7 +1342,7 @@ static void write_proc_func_interp( FILE *file, int indent, const type_t *iface, ...@@ -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 ); 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 oi_flags = Oi_HAS_RPCFLAGS | Oi_USE_NEW_INIT_ROUTINES;
unsigned char oi2_flags = get_func_oi2_flags( func ); 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 rpc_flags = get_rpc_flags( func->attrs );
unsigned int nb_args = 0; unsigned int nb_args = 0;
unsigned int stack_size = 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, ...@@ -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 operator_type = 0;
unsigned char conftype = FC_NORMAL_CONFORMANCE; unsigned char conftype = FC_NORMAL_CONFORMANCE;
unsigned short robust_flags = 0;
const char *conftype_string = "field"; const char *conftype_string = "field";
const expr_t *subexpr; const expr_t *subexpr;
const type_t *iface = NULL; const type_t *iface = NULL;
...@@ -1629,7 +1630,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type, ...@@ -1629,7 +1630,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (!expr) if (!expr)
{ {
print_file(file, 2, "NdrFcLong(0xffffffff),\t/* -1 */\n"); print_file(file, 2, "NdrFcLong(0xffffffff),\t/* -1 */\n");
return 4; goto done;
} }
if (expr->is_const) if (expr->is_const)
...@@ -1643,8 +1644,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type, ...@@ -1643,8 +1644,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
FC_CONSTANT_CONFORMANCE, expr->cval); FC_CONSTANT_CONFORMANCE, expr->cval);
print_file(file, 2, "0x%x,\n", expr->cval >> 16); print_file(file, 2, "0x%x,\n", expr->cval >> 16);
print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval); print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval);
goto done;
return 4;
} }
if (!cont_type) /* top-level conformance */ 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, ...@@ -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, "0x0,\n" );
print_file(file, 2, "NdrFcShort(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 */ /* 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) ...@@ -2495,15 +2498,15 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
unsigned int absoff = ft->typestring_offset; unsigned int absoff = ft->typestring_offset;
if (is_attr(ft->attrs, ATTR_SWITCHTYPE)) if (is_attr(ft->attrs, ATTR_SWITCHTYPE))
absoff += 8; /* we already have a corr descr, skip it */ absoff += 8; /* we already have a corr descr, skip it */
reloff = absoff - (*tfsoff + 6);
print_file(file, 0, "/* %d */\n", *tfsoff); 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/* FC_NON_ENCAPSULATED_UNION */\n", FC_NON_ENCAPSULATED_UNION);
print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", FC_LONG); print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", FC_LONG);
write_conf_or_var_desc(file, current_structure, offset, ft, *tfsoff += 2 + write_conf_or_var_desc(file, current_structure, offset, ft,
get_attrp(f->attrs, ATTR_SWITCHIS)); get_attrp(f->attrs, ATTR_SWITCHIS));
reloff = absoff - *tfsoff;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
(unsigned short)reloff, reloff, absoff); (unsigned short)reloff, reloff, absoff);
*tfsoff += 8; *tfsoff += 2;
} }
offset += size; offset += size;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment