From bcd8fa3c78d3d40371544390510fc353dae50009 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 8 Aug 2005 11:01:56 +0000 Subject: [PATCH] Handle loading strings over 64k from the string table. --- dlls/msi/table.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 60fd269be4c..b8bb8de1170 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -731,15 +731,40 @@ UINT load_string_table( MSIDATABASE *db ) db->strings = msi_init_stringtable( count, codepage ); offset = 0; + n = 1; for( i=1; istrings, i, data+offset, len, pool[i*2+1] ); - if( n != i ) - ERR("Failed to add string %ld\n", i ); + + /* + * If a string is over 64k, the previous string entry is made null + * and its the high word of the length is inserted in the null string's + * reference count field. + */ + if( pool[i*2-2] == 0 ) + len += pool[i*2-1] * 0x10000; + + if( (offset + len) > datasize ) + { + ERR("string table corrupt?\n"); + break; + } + + /* don't add the high word of a string's length as a string */ + if ( len || !pool[i*2+1] ) + { + r = msi_addstring( db->strings, n, data+offset, len, pool[i*2+1] ); + if( r != n ) + ERR("Failed to add string %ld\n", n ); + n++; + } + offset += len; } + if ( datasize != offset ) + ERR("string table load failed! (%08x != %08lx)\n", datasize, offset ); + TRACE("Loaded %ld strings\n", count); ret = ERROR_SUCCESS;