winebuild: Introduce exports struct.

This commit is contained in:
Jacek Caban 2024-02-14 00:59:26 +01:00 committed by Alexandre Julliard
parent b8c75f3d2a
commit 73f0bbc731
3 changed files with 49 additions and 9 deletions

View file

@ -129,6 +129,17 @@ struct apiset
static const unsigned int apiset_hash_factor = 31;
struct exports
{
int nb_entry_points; /* number of used entry points */
ORDDEF **entry_points; /* dll entry points */
int nb_names; /* number of entry points with names */
ORDDEF **names; /* array of entry point names (points into entry_points) */
int base; /* ordinal base */
int limit; /* ordinal limit */
ORDDEF **ordinals; /* array of dll ordinals (points into entry_points) */
};
typedef struct
{
char *src_name; /* file name of the source spec file */
@ -152,9 +163,10 @@ typedef struct
int subsystem_major; /* subsystem version major number */
int subsystem_minor; /* subsystem version minor number */
int unicode_app; /* default to unicode entry point */
ORDDEF *entry_points; /* dll entry points */
ORDDEF *entry_points; /* spec entry points */
ORDDEF **names; /* array of entry point names (points into entry_points) */
ORDDEF **ordinals; /* array of dll ordinals (points into entry_points) */
struct exports exports; /* dll exports */
struct resource *resources; /* array of dll resources (format differs between Win16/Win32) */
struct apiset apiset; /* list of defined api sets */
} DLLSPEC;

View file

@ -952,6 +952,29 @@ static void assign_ordinals( DLLSPEC *spec )
}
static void assign_exports( DLLSPEC *spec )
{
struct exports *exports = &spec->exports;
unsigned int i;
exports->entry_points = xmalloc( spec->nb_entry_points * sizeof(*exports->entry_points) );
for (i = 0; i < spec->nb_entry_points; i++)
{
ORDDEF *entry = &spec->entry_points[i];
exports->entry_points[exports->nb_entry_points++] = entry;
}
assign_names( spec );
assign_ordinals( spec );
exports->nb_names = spec->nb_names;
exports->names = spec->names;
exports->base = spec->base;
exports->limit = spec->limit;
exports->ordinals = spec->ordinals;
}
/*******************************************************************
* add_16bit_exports
*
@ -1008,8 +1031,7 @@ void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 )
odp->u.func.nb_args * sizeof(odp->u.func.args[0]) );
}
assign_names( spec32 );
assign_ordinals( spec32 );
assign_exports( spec32 );
}
@ -1052,8 +1074,7 @@ int parse_spec_file( FILE *file, DLLSPEC *spec )
}
current_line = 0; /* no longer parsing the input file */
assign_names( spec );
assign_ordinals( spec );
assign_exports( spec );
return !nb_errors;
}
@ -1295,7 +1316,6 @@ int parse_def_file( FILE *file, DLLSPEC *spec )
}
current_line = 0; /* no longer parsing the input file */
assign_names( spec );
assign_ordinals( spec );
assign_exports( spec );
return !nb_errors;
}

View file

@ -615,10 +615,19 @@ DLLSPEC *alloc_dll_spec(void)
spec->subsystem_major = 4;
spec->subsystem_minor = 0;
spec->dll_characteristics = IMAGE_DLLCHARACTERISTICS_NX_COMPAT | IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE;
spec->exports.base = MAX_ORDINALS;
return spec;
}
static void free_exports( struct exports *entries )
{
free( entries->entry_points );
free( entries->names );
free( entries->ordinals );
}
/*******************************************************************
* free_dll_spec
*
@ -635,13 +644,12 @@ void free_dll_spec( DLLSPEC *spec )
free( odp->export_name );
free( odp->link_name );
}
free_exports( &spec->exports );
free( spec->file_name );
free( spec->dll_name );
free( spec->c_name );
free( spec->init_func );
free( spec->entry_points );
free( spec->names );
free( spec->ordinals );
free( spec->resources );
free( spec );
}