From: Jacek Caban jacek@codeweavers.com
--- tools/winebuild/build.h | 14 +++++++++++++- tools/winebuild/parser.c | 32 ++++++++++++++++++++++++++------ tools/winebuild/utils.c | 12 ++++++++++-- 3 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index e4ad4e6556f..ec463792eef 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -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; diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 959170e39b8..01c230a0a2c 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -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; } diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 2334611fa0d..337db77bcaf 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -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 ); }