Fix string value lookups in MSI.
This commit is contained in:
parent
10509573ac
commit
717107bb65
|
@ -427,15 +427,21 @@ static UINT msi_string2id( string_table *st, LPCWSTR buffer, UINT *id )
|
||||||
TRACE("Finding string %s in %ld strings\n", debugstr_w(buffer), count);
|
TRACE("Finding string %s in %ld strings\n", debugstr_w(buffer), count);
|
||||||
|
|
||||||
sz = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
|
sz = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
|
||||||
|
if( sz <= 0 )
|
||||||
|
return r;
|
||||||
str = HeapAlloc( GetProcessHeap(), 0, sz );
|
str = HeapAlloc( GetProcessHeap(), 0, sz );
|
||||||
|
if( !str )
|
||||||
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
WideCharToMultiByte( CP_ACP, 0, buffer, -1, str, sz, NULL, NULL );
|
WideCharToMultiByte( CP_ACP, 0, buffer, -1, str, sz, NULL, NULL );
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
sz--; /* nul terminated */
|
||||||
for(i=0; i<count; i++)
|
for(i=0; i<count; i++)
|
||||||
{
|
{
|
||||||
len = st->pool.data[i*2];
|
len = st->pool.data[i*2];
|
||||||
if ( ( sz == len ) && !memcmp( str, st->info.data+offset, sz ) )
|
if ( ( sz == len ) && !memcmp( str, st->info.data+offset, sz ) )
|
||||||
{
|
{
|
||||||
|
TRACE("%ld <- %s\n",i,debugstr_an(st->info.data+offset, len) );
|
||||||
*id = i;
|
*id = i;
|
||||||
r = ERROR_SUCCESS;
|
r = ERROR_SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue