Eliminate fixed length buffers from the MSIFEATURE structure.

This commit is contained in:
Mike McCormack 2005-09-13 10:37:37 +00:00 committed by Alexandre Julliard
parent d765cb960f
commit 79ca56cd6a
3 changed files with 18 additions and 22 deletions

View File

@ -1070,7 +1070,6 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
{
MSIPACKAGE* package = (MSIPACKAGE*)param;
MSIFEATURE* feature;
DWORD sz;
static const WCHAR Query1[] =
{'S','E','L','E','C','T',' ',
'`','C','o','m','p','o','n','e','n','t','_','`',
@ -1090,15 +1089,11 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
list_init( &feature->Components );
sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row,1,feature->Feature,&sz);
feature->Feature = load_dynamic_stringW( row, 1 );
TRACE("Loading feature %s\n",debugstr_w(feature->Feature));
sz = IDENTIFIER_SIZE;
if (!MSI_RecordIsNull(row,2))
MSI_RecordGetStringW(row,2,feature->Feature_Parent,&sz);
feature->Feature_Parent = load_dynamic_stringW( row, 2 );
feature->Title = load_dynamic_stringW( row, 3 );
feature->Description = load_dynamic_stringW( row, 4 );
@ -1106,11 +1101,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
feature->Display = MSI_RecordGetInteger(row,5);
feature->Level= MSI_RecordGetInteger(row,6);
sz = IDENTIFIER_SIZE;
if (!MSI_RecordIsNull(row,7))
MSI_RecordGetStringW(row,7,feature->Directory,&sz);
feature->Directory = load_dynamic_stringW( row, 7 );
feature->Attributes = MSI_RecordGetInteger(row,8);
feature->Installed = INSTALLSTATE_ABSENT;
@ -3280,7 +3271,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
{
size += 21;
}
if (feature->Feature_Parent[0])
if (feature->Feature_Parent)
size += strlenW( feature->Feature_Parent )+2;
data = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
@ -3301,7 +3292,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
strcatW(data,buf);
}
}
if (feature->Feature_Parent[0])
if (feature->Feature_Parent)
{
static const WCHAR sep[] = {'\2',0};
strcatW(data,sep);
@ -3312,18 +3303,22 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
RegSetValueExW( hkey, feature->Feature, 0, REG_SZ, (LPBYTE)data,size );
HeapFree(GetProcessHeap(),0,data);
size = 0;
if (feature->Feature_Parent)
size = strlenW(feature->Feature_Parent)*sizeof(WCHAR);
if (!absent)
{
size = strlenW(feature->Feature_Parent)*sizeof(WCHAR);
RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
(LPBYTE)feature->Feature_Parent,size);
}
else
{
size = (strlenW(feature->Feature_Parent)+2)* sizeof(WCHAR);
size += 2*sizeof(WCHAR);
data = HeapAlloc(GetProcessHeap(),0,size);
data[0] = 0x6;
strcpyW( &data[1], feature->Feature_Parent );
data[1] = 0;
if (feature->Feature_Parent)
strcpyW( &data[1], feature->Feature_Parent );
RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
(LPBYTE)data,size);
HeapFree(GetProcessHeap(),0,data);

View File

@ -23,18 +23,16 @@
#include "wine/list.h"
#define IDENTIFIER_SIZE 96
typedef struct tagMSIFEATURE
{
struct list entry;
WCHAR Feature[IDENTIFIER_SIZE];
WCHAR Feature_Parent[IDENTIFIER_SIZE];
LPWSTR Feature;
LPWSTR Feature_Parent;
LPWSTR Title;
LPWSTR Description;
INT Display;
INT Level;
WCHAR Directory[IDENTIFIER_SIZE];
LPWSTR Directory;
INT Attributes;
INSTALLSTATE Installed;

View File

@ -438,6 +438,9 @@ static void free_feature( MSIFEATURE *feature )
list_remove( &cl->entry );
HeapFree( GetProcessHeap(), 0, cl );
}
HeapFree( GetProcessHeap(), 0, feature->Feature );
HeapFree( GetProcessHeap(), 0, feature->Feature_Parent );
HeapFree( GetProcessHeap(), 0, feature->Directory );
HeapFree( GetProcessHeap(), 0, feature->Description );
HeapFree( GetProcessHeap(), 0, feature->Title );
HeapFree( GetProcessHeap(), 0, feature );