Use MSI_RecordGetString in more actions.

This commit is contained in:
Mike McCormack 2005-06-08 18:34:04 +00:00 committed by Alexandre Julliard
parent 3b37099451
commit ad6a6be88d
1 changed files with 27 additions and 44 deletions

View File

@ -1534,9 +1534,8 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
while (1) while (1)
{ {
WCHAR dir[0x100]; LPCWSTR dir;
LPWSTR full_path; LPWSTR full_path;
DWORD sz;
MSIRECORD *row = NULL, *uirow; MSIRECORD *row = NULL, *uirow;
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
@ -1546,17 +1545,14 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
break; break;
} }
sz=0x100; dir = MSI_RecordGetString(row,1);
rc = MSI_RecordGetStringW(row,1,dir,&sz); if (!dir)
if (rc!= ERROR_SUCCESS)
{ {
ERR("Unable to get folder id \n"); ERR("Unable to get folder id \n");
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
continue; continue;
} }
sz = MAX_PATH;
full_path = resolve_folder(package,dir,FALSE,FALSE,&folder); full_path = resolve_folder(package,dir,FALSE,FALSE,&folder);
if (!full_path) if (!full_path)
{ {
@ -1715,8 +1711,7 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
} }
while (1) while (1)
{ {
DWORD sz = 0x100; LPCWSTR component;
WCHAR buffer[0x100];
DWORD rc; DWORD rc;
INT c_indx; INT c_indx;
INT cnt = package->features[index].ComponentCount; INT cnt = package->features[index].ComponentCount;
@ -1725,14 +1720,13 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
break; break;
sz = 0x100; component = MSI_RecordGetString(row2,1);
MSI_RecordGetStringW(row2,1,buffer,&sz);
/* check to see if the component is already loaded */ /* check to see if the component is already loaded */
c_indx = get_loaded_component(package,buffer); c_indx = get_loaded_component(package,component);
if (c_indx != -1) if (c_indx != -1)
{ {
TRACE("Component %s already loaded at %i\n", debugstr_w(buffer), TRACE("Component %s already loaded at %i\n", debugstr_w(component),
c_indx); c_indx);
package->features[index].Components[cnt] = c_indx; package->features[index].Components[cnt] = c_indx;
package->features[index].ComponentCount ++; package->features[index].ComponentCount ++;
@ -1740,7 +1734,7 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
continue; continue;
} }
rc = MSI_OpenQuery(package->db, &view2, Query2, buffer); rc = MSI_OpenQuery(package->db, &view2, Query2, component);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
msiobj_release( &row2->hdr ); msiobj_release( &row2->hdr );
@ -2583,10 +2577,9 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
while (1) while (1)
{ {
WCHAR name[0x100]; LPCWSTR name;
LPWSTR path; LPWSTR path;
MSIRECORD * row = 0; MSIRECORD * row = 0;
DWORD sz;
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
@ -2595,8 +2588,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
break; break;
} }
sz=0x100; name = MSI_RecordGetString(row,1);
MSI_RecordGetStringW(row,1,name,&sz);
/* This helper function now does ALL the work */ /* This helper function now does ALL the work */
TRACE("Dir %s ...\n",debugstr_w(name)); TRACE("Dir %s ...\n",debugstr_w(name));
@ -2710,9 +2702,8 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
while (1) while (1)
{ {
WCHAR Feature[0x100]; LPCWSTR Feature;
MSIRECORD * row = 0; MSIRECORD * row = 0;
DWORD sz;
int feature_index; int feature_index;
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
@ -2723,16 +2714,15 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
break; break;
} }
sz = 0x100; Feature = MSI_RecordGetString(row,1);
MSI_RecordGetStringW(row,1,Feature,&sz);
feature_index = get_loaded_feature(package,Feature); feature_index = get_loaded_feature(package,Feature);
if (feature_index < 0) if (feature_index < 0)
ERR("FAILED to find loaded feature %s\n",debugstr_w(Feature)); ERR("FAILED to find loaded feature %s\n",debugstr_w(Feature));
else else
{ {
LPWSTR Condition; LPCWSTR Condition;
Condition = load_dynamic_stringW(row,3); Condition = MSI_RecordGetString(row,3);
if (MSI_EvaluateConditionW(package,Condition) == if (MSI_EvaluateConditionW(package,Condition) ==
MSICONDITION_TRUE) MSICONDITION_TRUE)
@ -2742,7 +2732,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
debugstr_w(Feature), level); debugstr_w(Feature), level);
package->features[feature_index].Level = level; package->features[feature_index].Level = level;
} }
HeapFree(GetProcessHeap(),0,Condition);
} }
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
@ -2782,7 +2771,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* /*
* This is a helper function for handling embedded cabinet media * This is a helper function for handling embedded cabinet media
*/ */
static UINT writeout_cabinet_stream(MSIPACKAGE *package, WCHAR* stream_name, static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name,
WCHAR* source) WCHAR* source)
{ {
UINT rc; UINT rc;
@ -3036,8 +3025,8 @@ static UINT ready_media_for_file(MSIPACKAGE *package, WCHAR* path,
'`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=', '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=',
' ','%', 'i',' ','O','R','D','E','R',' ','B','Y',' ', ' ','%', 'i',' ','O','R','D','E','R',' ','B','Y',' ',
'`','L','a','s','t','S','e','q','u','e','n','c','e','`',0}; '`','L','a','s','t','S','e','q','u','e','n','c','e','`',0};
WCHAR cab[0x100]; LPCWSTR cab;
DWORD sz=0x100; DWORD sz;
INT seq; INT seq;
static UINT last_sequence = 0; static UINT last_sequence = 0;
@ -3061,10 +3050,9 @@ static UINT ready_media_for_file(MSIPACKAGE *package, WCHAR* path,
seq = MSI_RecordGetInteger(row,2); seq = MSI_RecordGetInteger(row,2);
last_sequence = seq; last_sequence = seq;
if (!MSI_RecordIsNull(row,4)) cab = MSI_RecordGetString(row,4);
if (cab)
{ {
sz=0x100;
MSI_RecordGetStringW(row,4,cab,&sz);
TRACE("Source is CAB %s\n",debugstr_w(cab)); TRACE("Source is CAB %s\n",debugstr_w(cab));
/* the stream does not contain the # character */ /* the stream does not contain the # character */
if (cab[0]=='#') if (cab[0]=='#')
@ -3313,14 +3301,13 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
while (1) while (1)
{ {
WCHAR file_key[0x100];
WCHAR *file_source = NULL; WCHAR *file_source = NULL;
WCHAR dest_name[0x100]; WCHAR dest_name[0x100];
LPWSTR dest_path, dest; LPWSTR dest_path, dest;
WCHAR component[0x100]; LPCWSTR file_key, component;
INT component_index; INT component_index;
DWORD sz=0x100; DWORD sz;
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
@ -3329,9 +3316,8 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
break; break;
} }
sz=0x100; component = MSI_RecordGetString(row,2);
rc = MSI_RecordGetStringW(row,2,component,&sz); if (!component)
if (rc != ERROR_SUCCESS)
{ {
ERR("Unable to get component\n"); ERR("Unable to get component\n");
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
@ -3355,9 +3341,8 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
package->components[component_index].Action = INSTALLSTATE_LOCAL; package->components[component_index].Action = INSTALLSTATE_LOCAL;
sz=0x100; file_key = MSI_RecordGetString(row,3);
rc = MSI_RecordGetStringW(row,3,file_key,&sz); if (!file_key)
if (rc != ERROR_SUCCESS)
{ {
ERR("Unable to get file key\n"); ERR("Unable to get file key\n");
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
@ -3395,10 +3380,8 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
} }
else else
{ {
WCHAR destkey[0x100]; LPCWSTR destkey;
sz=0x100; destkey = MSI_RecordGetString(row,5);
MSI_RecordGetStringW(row,5,destkey,&sz);
sz = 0x100;
dest_path = resolve_folder(package, destkey, FALSE,FALSE,NULL); dest_path = resolve_folder(package, destkey, FALSE,FALSE,NULL);
if (!dest_path) if (!dest_path)
{ {