Rework RegisterFonts to use MSI_IterateRecords.
This commit is contained in:
parent
dd3fd54a65
commit
a9b5052ff9
|
@ -4043,14 +4043,13 @@ static LPWSTR load_ttfname_from(LPCWSTR filename)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
||||
static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
||||
{
|
||||
UINT rc;
|
||||
MSIQUERY * view;
|
||||
MSIRECORD * row = 0;
|
||||
static const WCHAR ExecSeqQuery[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','F','o','n','t','`',0};
|
||||
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
||||
LPWSTR name;
|
||||
LPCWSTR file;
|
||||
UINT index;
|
||||
DWORD size;
|
||||
static const WCHAR regfont1[] =
|
||||
{'S','o','f','t','w','a','r','e','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\',
|
||||
|
@ -4066,47 +4065,12 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
|||
HKEY hkey1;
|
||||
HKEY hkey2;
|
||||
|
||||
TRACE("%p\n", package);
|
||||
|
||||
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
rc = MSI_ViewExecute(view, 0);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
MSI_ViewClose(view);
|
||||
msiobj_release(&view->hdr);
|
||||
TRACE("MSI_ViewExecute returned %d\n", rc);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1);
|
||||
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2);
|
||||
|
||||
while (1)
|
||||
{
|
||||
LPWSTR name;
|
||||
LPCWSTR file;
|
||||
UINT index;
|
||||
DWORD size;
|
||||
|
||||
rc = MSI_ViewFetch(view,&row);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
rc = ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
file = MSI_RecordGetString(row,1);
|
||||
index = get_loaded_file(package,file);
|
||||
if (index < 0)
|
||||
{
|
||||
ERR("Unable to load file\n");
|
||||
continue;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* check to make sure that component is installed */
|
||||
|
@ -4114,12 +4078,12 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
|||
package->files[index].ComponentIndex, INSTALLSTATE_LOCAL))
|
||||
{
|
||||
TRACE("Skipping: Component not scheduled for install\n");
|
||||
|
||||
msiobj_release(&row->hdr);
|
||||
|
||||
continue;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1);
|
||||
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2);
|
||||
|
||||
if (MSI_RecordIsNull(row,2))
|
||||
name = load_ttfname_from(package->files[index].TargetPath);
|
||||
else
|
||||
|
@ -4135,16 +4099,30 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
|||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),0,name);
|
||||
msiobj_release(&row->hdr);
|
||||
}
|
||||
MSI_ViewClose(view);
|
||||
msiobj_release(&view->hdr);
|
||||
|
||||
RegCloseKey(hkey1);
|
||||
RegCloseKey(hkey2);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
TRACE("returning %d\n", rc);
|
||||
return rc;
|
||||
static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
||||
{
|
||||
UINT rc;
|
||||
MSIQUERY * view;
|
||||
static const WCHAR ExecSeqQuery[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','F','o','n','t','`',0};
|
||||
|
||||
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
|
||||
msiobj_release(&view->hdr);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
|
||||
|
|
Loading…
Reference in New Issue