Commit 234dc4b2 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Rework RegisterTypeLibraries to use MSI_IterateRecords.

parent dcad0864
......@@ -2704,69 +2704,28 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
return TRUE;
}
static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
{
/*
* OK this is a bit confusing.. I am given a _Component key and I believe
* that the file that is being registered as a type library is the "key file
* of that component" which I interpret to mean "The file in the KeyPath of
* that component".
*/
UINT rc;
MSIQUERY * view;
MSIRECORD * row = 0;
static const WCHAR Query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','T','y','p','e','L','i','b','`',0};
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_ViewExecute(view, 0);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
while (1)
{
MSIPACKAGE* package = (MSIPACKAGE*)param;
LPCWSTR component;
INT index;
typelib_struct tl_struct;
HMODULE module;
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
rc = ERROR_SUCCESS;
break;
}
component = MSI_RecordGetString(row,3);
index = get_loaded_component(package,component);
if (index < 0)
{
msiobj_release(&row->hdr);
continue;
}
return ERROR_SUCCESS;
if (!ACTION_VerifyComponentForAction(package, index,
INSTALLSTATE_LOCAL))
if (!ACTION_VerifyComponentForAction(package, index, INSTALLSTATE_LOCAL))
{
TRACE("Skipping typelib reg due to disabled component\n");
msiobj_release(&row->hdr);
package->components[index].Action =
package->components[index].Installed;
continue;
return ERROR_SUCCESS;
}
package->components[index].Action = INSTALLSTATE_LOCAL;
......@@ -2774,10 +2733,7 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
index = get_loaded_file(package,package->components[index].KeyPath);
if (index < 0)
{
msiobj_release(&row->hdr);
continue;
}
return ERROR_SUCCESS;
module = LoadLibraryExW(package->files[index].TargetPath, NULL,
LOAD_LIBRARY_AS_DATAFILE);
......@@ -2829,9 +2785,32 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
else
ERR("Could not load file! %s\n",
debugstr_w(package->files[index].TargetPath));
msiobj_release(&row->hdr);
}
MSI_ViewClose(view);
return ERROR_SUCCESS;
}
static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
{
/*
* OK this is a bit confusing.. I am given a _Component key and I believe
* that the file that is being registered as a type library is the "key file
* of that component" which I interpret to mean "The file in the KeyPath of
* that component".
*/
UINT rc;
MSIQUERY * view;
static const WCHAR Query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','T','y','p','e','L','i','b','`',0};
if (!package)
return ERROR_INVALID_HANDLE;
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_RegisterTypeLibraries, package);
msiobj_release(&view->hdr);
return rc;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment