From 2820738b290bba49927f579b01af74827f73e2ce Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 15 Mar 2019 10:04:03 +0100 Subject: [PATCH] msidb: Add support for exporting with short (DOS) filenames. msidb's "-s" flag modifies the database export to use short (DOS) filenames instead of full table names. This flag is convenient because it uses the same filenames that the import (-i) option expects. For example, the InstallExecuteSequence table gets imported (or exported with this flag) as InstallE.idt where the normal export option uses InstallExecuteSequence.idt. Signed-off-by: Erich E. Hoover Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- programs/msidb/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/programs/msidb/main.c b/programs/msidb/main.c index 1cb16df7884..3916e0d7219 100644 --- a/programs/msidb/main.c +++ b/programs/msidb/main.c @@ -48,6 +48,7 @@ struct msidb_state BOOL create_database; BOOL import_tables; BOOL export_tables; + BOOL short_filenames; struct list add_stream_list; struct list extract_stream_list; struct list kill_stream_list; @@ -92,6 +93,7 @@ static void show_usage( void ) " -f folder Folder in which to open/save the tables.\n" " -i Import tables into database.\n" " -k file.cab Kill (remove) stream/cabinet file from _Streams table.\n" + " -s Export with short filenames (eight character max).\n" " -x file.cab Extract stream/cabinet file from _Streams table.\n" ); } @@ -163,6 +165,9 @@ static int process_argument( struct msidb_state *state, int i, int argc, WCHAR * state->kill_streams = TRUE; list_append( &state->kill_stream_list, argv[i + 1] ); return 2; + case 's': + state->short_filenames = TRUE; + return 1; case 'x': if (i + 1 >= argc) return 0; state->extract_streams = TRUE; @@ -458,7 +463,9 @@ static int import_tables( struct msidb_state *state ) static int export_table( struct msidb_state *state, const WCHAR *table_name ) { - const WCHAR format[] = { '%','s','.','i','d','t',0 }; + 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 = (state->short_filenames ? format_dos : format_full); WCHAR table_path[MAX_PATH]; UINT ret;