[PATCH 1/2] msidb: Permit specifying tables to import by filename.

Hans Leidekker hans at codeweavers.com
Mon Mar 18 14:53:53 CDT 2019


On Mon, 2019-03-18 at 09:11 -0600, Erich E. Hoover wrote:
> -static int import_table( struct msidb_state *state, const WCHAR *table_name )
> +static int import_table( struct msidb_state *state, const WCHAR *table_name, BOOL long_filename )
>  {
> -    const WCHAR format[] = { '%','.','8','s','.','i','d','t',0 }; /* truncate to 8 characters */
> +    const WCHAR format_dos[] = { '%','.','8','s','.','i','d','t',0 }; /* truncate to 8 characters */
> +    const WCHAR format_full[] = { '%','s','.','i','d','t',0 };
> +    const WCHAR *format = (long_filename ? format_full : format_dos);
>      WCHAR table_path[MAX_PATH];
>      UINT ret;
>  
> @@ -451,11 +454,22 @@ static int import_table( struct msidb_state *state, const WCHAR *table_name )
>  
>  static int import_tables( struct msidb_state *state )
>  {
> +    const WCHAR idt_ext[] = { '.','i','d','t',0 };
>      struct msidb_listentry *data;
>  
>      LIST_FOR_EACH_ENTRY( data, &state->table_list, struct msidb_listentry, entry )
>      {
> -        if (!import_table( state, data->name ))
> +        WCHAR *table_name = data->name;
> +        BOOL long_filename = FALSE;
> +        WCHAR *ext;
> +
> +        /* permit specifying tables by filename (*.idt) */
> +        if ((ext = PathFindExtensionW( table_name )) != NULL && lstrcmpW( ext, idt_ext ) == 0)
> +        {
> +            long_filename = TRUE;
> +            PathRemoveExtensionW( table_name );
> +        }
> +        if (!import_table( state, table_name, long_filename ))

In import_table you can assume that the table name has a .idt extension
if long_filename is true, so there's no need to remove the extension
here and then put it back on in import_table. That way you can also
avoid copying the filename.




More information about the wine-devel mailing list