msi:Fix Typelib Registration
Aric Stewart
aric at codeweavers.com
Mon Mar 28 10:39:48 CST 2005
make sure the GUID of the typelib we are registering matches the guid
requested from MSI. if not search the given typelib file to find the
typelib requested to register.
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.105
diff -u -r1.105 action.c
--- dlls/msi/action.c 28 Mar 2005 14:17:52 -0000 1.105
+++ dlls/msi/action.c 28 Mar 2005 16:33:23 -0000
@@ -4057,6 +4057,10 @@
WCHAR component[0x100];
DWORD sz;
INT index;
+ LPWSTR guid;
+ TLIBATTR *attr;
+ GUID clsid;
+ LPWSTR path = NULL;
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
@@ -4097,7 +4101,39 @@
continue;
}
+ guid = load_dynamic_stringW(row,1);
res = LoadTypeLib(package->files[index].TargetPath,&ptLib);
+ ITypeLib_GetLibAttr(ptLib, &attr);
+ CLSIDFromString(guid, &clsid);
+ if (!IsEqualGUID(&clsid,&attr->guid))
+ {
+ static const WCHAR fmt[] = {'%','s','\\','%','i',0};
+ int i;
+ int sz;
+
+ TRACE("Initial match failure\n");
+
+ sz = strlenW(package->files[index].TargetPath)+4;
+ sz *= sizeof(WCHAR);
+
+ for (i = 2; i < 10; i++)
+ {
+ path = HeapAlloc(GetProcessHeap(),0,sz);
+ sprintfW(path,fmt,package->files[index].TargetPath, i);
+ TRACE("trying %s\n", debugstr_w(path));
+ res = LoadTypeLib(path,&ptLib);
+ ITypeLib_GetLibAttr(ptLib, &attr);
+ CLSIDFromString(guid, &clsid);
+ if (IsEqualGUID(&clsid,&attr->guid))
+ break;
+ HeapFree(GetProcessHeap(),0,path);
+ res = E_FAIL;
+
+ }
+ }
+ else
+ path = strdupW(package->files[index].TargetPath);
+
if (SUCCEEDED(res))
{
LPWSTR help;
@@ -4107,12 +4143,11 @@
MSI_RecordGetStringW(row,6,helpid,&sz);
help = resolve_folder(package,helpid,FALSE,FALSE,NULL);
- res = RegisterTypeLib(ptLib,package->files[index].TargetPath,help);
+ res = RegisterTypeLib(ptLib,path,help);
HeapFree(GetProcessHeap(),0,help);
if (!SUCCEEDED(res))
- ERR("Failed to register type library %s\n",
- debugstr_w(package->files[index].TargetPath));
+ ERR("Failed to register type library %s\n", debugstr_w(path));
else
{
/* Yes the row has more fields than I need, but #1 is
@@ -4120,17 +4155,16 @@
ui_actiondata(package,szRegisterTypeLibraries,row);
- TRACE("Registered %s\n",
- debugstr_w(package->files[index].TargetPath));
+ TRACE("Registered %s\n", debugstr_w(path));
}
if (ptLib)
ITypeLib_Release(ptLib);
}
else
- ERR("Failed to load type library %s\n",
- debugstr_w(package->files[index].TargetPath));
-
+ ERR("Failed to load type library %s\n", debugstr_w(path));
+
+ HeapFree(GetProcessHeap(),0,path);
msiobj_release(&row->hdr);
}
MSI_ViewClose(view);
More information about the wine-patches
mailing list