widl: Support using custom handle types with the implicit_handle attribute.
This commit is contained in:
parent
4fc0d3c317
commit
21cbdaa1eb
@ -75,7 +75,7 @@ static void check_pointers(const var_t *func)
|
|||||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||||
{
|
{
|
||||||
const statement_t *stmt;
|
const statement_t *stmt;
|
||||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
int method_count = 0;
|
int method_count = 0;
|
||||||
|
|
||||||
if (!implicit_handle)
|
if (!implicit_handle)
|
||||||
@ -245,7 +245,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||||||
}
|
}
|
||||||
else if (implicit_handle)
|
else if (implicit_handle)
|
||||||
{
|
{
|
||||||
print_client("__frame->_Handle = %s;\n", implicit_handle);
|
print_client("__frame->_Handle = %s;\n", implicit_handle->name);
|
||||||
fprintf(client, "\n");
|
fprintf(client, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ static void write_stubdescdecl(type_t *iface)
|
|||||||
|
|
||||||
static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
||||||
{
|
{
|
||||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
|
|
||||||
print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name);
|
print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name);
|
||||||
print_client("{\n");
|
print_client("{\n");
|
||||||
@ -345,7 +345,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
|||||||
print_client("{\n");
|
print_client("{\n");
|
||||||
indent++;
|
indent++;
|
||||||
if (implicit_handle)
|
if (implicit_handle)
|
||||||
print_client("&%s,\n", implicit_handle);
|
print_client("&%s,\n", implicit_handle->name);
|
||||||
else
|
else
|
||||||
print_client("&%s__MIDL_AutoBindHandle,\n", iface->name);
|
print_client("&%s__MIDL_AutoBindHandle,\n", iface->name);
|
||||||
indent--;
|
indent--;
|
||||||
@ -423,12 +423,12 @@ static void write_clientinterfacedecl(type_t *iface)
|
|||||||
|
|
||||||
static void write_implicithandledecl(type_t *iface)
|
static void write_implicithandledecl(type_t *iface)
|
||||||
{
|
{
|
||||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const var_t *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
|
|
||||||
if (implicit_handle)
|
if (implicit_handle)
|
||||||
{
|
{
|
||||||
fprintf(client, "handle_t %s;\n", implicit_handle);
|
write_type_decl( client, implicit_handle->type, implicit_handle->name );
|
||||||
fprintf(client, "\n");
|
fprintf(client, ";\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,14 +1078,19 @@ static void write_com_interface_end(FILE *header, type_t *iface)
|
|||||||
static void write_rpc_interface_start(FILE *header, const type_t *iface)
|
static void write_rpc_interface_start(FILE *header, const type_t *iface)
|
||||||
{
|
{
|
||||||
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
|
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||||
const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const var_t *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
|
|
||||||
fprintf(header, "/*****************************************************************************\n");
|
fprintf(header, "/*****************************************************************************\n");
|
||||||
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||||
fprintf(header, " */\n");
|
fprintf(header, " */\n");
|
||||||
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
|
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
|
||||||
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
|
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
|
||||||
if (var) fprintf(header, "extern handle_t %s;\n", var);
|
if (var)
|
||||||
|
{
|
||||||
|
fprintf(header, "extern ");
|
||||||
|
write_type_decl( header, var->type, var->name );
|
||||||
|
fprintf(header, ";\n");
|
||||||
|
}
|
||||||
if (old_names)
|
if (old_names)
|
||||||
{
|
{
|
||||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_ClientIfHandle;\n", prefix_client, iface->name);
|
fprintf(header, "extern RPC_IF_HANDLE %s%s_ClientIfHandle;\n", prefix_client, iface->name);
|
||||||
|
@ -522,7 +522,7 @@ attribute: { $$ = NULL; }
|
|||||||
| tIGNORE { $$ = make_attr(ATTR_IGNORE); }
|
| tIGNORE { $$ = make_attr(ATTR_IGNORE); }
|
||||||
| tIIDIS '(' expr ')' { $$ = make_attrp(ATTR_IIDIS, $3); }
|
| tIIDIS '(' expr ')' { $$ = make_attrp(ATTR_IIDIS, $3); }
|
||||||
| tIMMEDIATEBIND { $$ = make_attr(ATTR_IMMEDIATEBIND); }
|
| tIMMEDIATEBIND { $$ = make_attr(ATTR_IMMEDIATEBIND); }
|
||||||
| tIMPLICITHANDLE '(' tHANDLET aIDENTIFIER ')' { $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $4); }
|
| tIMPLICITHANDLE '(' arg ')' { $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $3); }
|
||||||
| tIN { $$ = make_attr(ATTR_IN); }
|
| tIN { $$ = make_attr(ATTR_IN); }
|
||||||
| tINPUTSYNC { $$ = make_attr(ATTR_INPUTSYNC); }
|
| tINPUTSYNC { $$ = make_attr(ATTR_INPUTSYNC); }
|
||||||
| tLENGTHIS '(' m_exprs ')' { $$ = make_attrp(ATTR_LENGTHIS, $3); }
|
| tLENGTHIS '(' m_exprs ')' { $$ = make_attrp(ATTR_LENGTHIS, $3); }
|
||||||
@ -2124,6 +2124,17 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
|
|||||||
if (!allowed_attr[attr->type].on_interface)
|
if (!allowed_attr[attr->type].on_interface)
|
||||||
error_loc("inapplicable attribute %s for interface %s\n",
|
error_loc("inapplicable attribute %s for interface %s\n",
|
||||||
allowed_attr[attr->type].display_name, name);
|
allowed_attr[attr->type].display_name, name);
|
||||||
|
if (attr->type == ATTR_IMPLICIT_HANDLE)
|
||||||
|
{
|
||||||
|
const var_t *var = attr->u.pval;
|
||||||
|
if (type_get_type( var->type) == TYPE_BASIC &&
|
||||||
|
type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
|
||||||
|
continue;
|
||||||
|
if (is_aliaschain_attr( var->type, ATTR_HANDLE ))
|
||||||
|
continue;
|
||||||
|
error_loc("attribute %s requires a handle type in interface %s\n",
|
||||||
|
allowed_attr[attr->type].display_name, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return attrs;
|
return attrs;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user