summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-22 12:16:53 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:25:48 +0100
commit1dad58e97826df559e6b89f7e1d5da2fc1197ae3 (patch)
tree8d288923a631e832670e793b85f4c7147f635706
parent849e863a16e216100a711bb0fe0da33ab64ec577 (diff)
remove XML dependency
-rw-r--r--libmsi/msi.c276
1 files changed, 0 insertions, 276 deletions
diff --git a/libmsi/msi.c b/libmsi/msi.c
index a8bbb25..8f95672 100644
--- a/libmsi/msi.c
+++ b/libmsi/msi.c
@@ -273,264 +273,6 @@ static MSIPATCHSEQUENCEINFOW *patchinfoAtoW( DWORD count, const MSIPATCHSEQUENCE
return ret;
}
-UINT WINAPI MsiDetermineApplicablePatchesA(LPCSTR szProductPackagePath,
- DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOA pPatchInfo)
-{
- UINT i, r;
- WCHAR *package_path = NULL;
- MSIPATCHSEQUENCEINFOW *psi;
-
- TRACE("%s, %u, %p\n", debugstr_a(szProductPackagePath), cPatchInfo, pPatchInfo);
-
- if (szProductPackagePath && !(package_path = strdupAtoW( szProductPackagePath )))
- return ERROR_OUTOFMEMORY;
-
- if (!(psi = patchinfoAtoW( cPatchInfo, pPatchInfo )))
- {
- msi_free( package_path );
- return ERROR_OUTOFMEMORY;
- }
- r = MsiDetermineApplicablePatchesW( package_path, cPatchInfo, psi );
- if (r == ERROR_SUCCESS)
- {
- for (i = 0; i < cPatchInfo; i++)
- {
- pPatchInfo[i].dwOrder = psi[i].dwOrder;
- pPatchInfo[i].uStatus = psi[i].uStatus;
- }
- }
- msi_free( package_path );
- free_patchinfo( cPatchInfo, psi );
- return r;
-}
-
-static UINT MSI_ApplicablePatchW( MSIPACKAGE *package, LPCWSTR patch )
-{
- MSISUMMARYINFO *si;
- MSIDATABASE *patch_db;
- UINT r = ERROR_SUCCESS;
-
- r = MSI_OpenDatabaseW( patch, MSIDBOPEN_READONLY, &patch_db );
- if (r != ERROR_SUCCESS)
- {
- WARN("failed to open patch file %s\n", debugstr_w(patch));
- return r;
- }
-
- si = MSI_GetSummaryInformationW( patch_db->storage, 0 );
- if (!si)
- {
- msiobj_release( &patch_db->hdr );
- return ERROR_FUNCTION_FAILED;
- }
-
- r = msi_check_patch_applicable( package, si );
- if (r != ERROR_SUCCESS)
- TRACE("patch not applicable\n");
-
- msiobj_release( &patch_db->hdr );
- msiobj_release( &si->hdr );
- return r;
-}
-
-/* IXMLDOMDocument should be set to XPath mode already */
-static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc )
-{
- static const WCHAR queryW[] = {'M','s','i','P','a','t','c','h','/',
- 'T','a','r','g','e','t','P','r','o','d','u','c','t','/',
- 'T','a','r','g','e','t','P','r','o','d','u','c','t','C','o','d','e',0};
- UINT r = ERROR_FUNCTION_FAILED;
- IXMLDOMNodeList *list;
- LPWSTR product_code;
- IXMLDOMNode *node;
- HRESULT hr;
- BSTR s;
-
- product_code = msi_dup_property( package->db, szProductCode );
- if (!product_code)
- {
- /* FIXME: the property ProductCode should be written into the DB somewhere */
- ERR("no product code to check\n");
- return ERROR_SUCCESS;
- }
-
- s = SysAllocString(queryW);
- hr = IXMLDOMDocument_selectNodes( desc, s, &list );
- SysFreeString(s);
- if (hr != S_OK)
- return ERROR_INVALID_PATCH_XML;
-
- while (IXMLDOMNodeList_nextNode( list, &node ) == S_OK && r != ERROR_SUCCESS)
- {
- hr = IXMLDOMNode_get_text( node, &s );
- IXMLDOMNode_Release( node );
- if (hr == S_OK)
- {
- if (!strcmpW( s, product_code )) r = ERROR_SUCCESS;
- SysFreeString( s );
- }
- }
- IXMLDOMNodeList_Release( list );
-
- if (r != ERROR_SUCCESS)
- TRACE("patch not applicable\n");
-
- msi_free( product_code );
- return r;
-}
-
-static UINT determine_patch_sequence( MSIPACKAGE *package, DWORD count, MSIPATCHSEQUENCEINFOW *info )
-{
- IXMLDOMDocument *desc = NULL;
- DWORD i;
-
- if (count > 1)
- FIXME("patch ordering not supported\n");
-
- for (i = 0; i < count; i++)
- {
- switch (info[i].ePatchDataType)
- {
- case MSIPATCH_DATATYPE_PATCHFILE:
- {
- if (MSI_ApplicablePatchW( package, info[i].szPatchData ) != ERROR_SUCCESS)
- {
- info[i].dwOrder = ~0u;
- info[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
- }
- else
- {
- info[i].dwOrder = i;
- info[i].uStatus = ERROR_SUCCESS;
- }
- break;
- }
- case MSIPATCH_DATATYPE_XMLPATH:
- case MSIPATCH_DATATYPE_XMLBLOB:
- {
- VARIANT_BOOL b;
- HRESULT hr;
- BSTR s;
-
- if (!desc)
- {
- hr = CoCreateInstance( &CLSID_DOMDocument30, NULL, CLSCTX_INPROC_SERVER,
- &IID_IXMLDOMDocument, (void**)&desc );
- if (hr != S_OK)
- {
- ERR("failed to create DOMDocument30 instance, 0x%08x\n", hr);
- return ERROR_FUNCTION_FAILED;
- }
- }
-
- s = SysAllocString( info[i].szPatchData );
- if (info[i].ePatchDataType == MSIPATCH_DATATYPE_XMLPATH)
- {
- VARIANT src;
-
- V_VT(&src) = VT_BSTR;
- V_BSTR(&src) = s;
- hr = IXMLDOMDocument_load( desc, src, &b );
- }
- else
- hr = IXMLDOMDocument_loadXML( desc, s, &b );
- SysFreeString( s );
- if ( hr != S_OK )
- {
- ERR("failed to parse patch description\n");
- IXMLDOMDocument_Release( desc );
- break;
- }
-
- if (MSI_ApplicablePatchXML( package, desc ) != ERROR_SUCCESS)
- {
- info[i].dwOrder = ~0u;
- info[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
- }
- else
- {
- info[i].dwOrder = i;
- info[i].uStatus = ERROR_SUCCESS;
- }
- break;
- }
- default:
- {
- FIXME("unknown patch data type %u\n", info[i].ePatchDataType);
- info[i].dwOrder = i;
- info[i].uStatus = ERROR_SUCCESS;
- break;
- }
- }
-
- TRACE("szPatchData: %s\n", debugstr_w(info[i].szPatchData));
- TRACE("ePatchDataType: %u\n", info[i].ePatchDataType);
- TRACE("dwOrder: %u\n", info[i].dwOrder);
- TRACE("uStatus: %u\n", info[i].uStatus);
- }
-
- if (desc) IXMLDOMDocument_Release( desc );
-
- return ERROR_SUCCESS;
-}
-
-UINT WINAPI MsiDetermineApplicablePatchesW(LPCWSTR szProductPackagePath,
- DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOW pPatchInfo)
-{
- UINT r;
- MSIPACKAGE *package;
-
- TRACE("%s, %u, %p\n", debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo);
-
- r = MSI_OpenPackageW( szProductPackagePath, &package );
- if (r != ERROR_SUCCESS)
- {
- ERR("failed to open package %u\n", r);
- return r;
- }
- r = determine_patch_sequence( package, cPatchInfo, pPatchInfo );
- msiobj_release( &package->hdr );
- return r;
-}
-
-UINT WINAPI MsiDeterminePatchSequenceA( LPCSTR product, LPCSTR usersid,
- MSIINSTALLCONTEXT context, DWORD count, PMSIPATCHSEQUENCEINFOA patchinfo )
-{
- UINT i, r;
- WCHAR *productW, *usersidW = NULL;
- MSIPATCHSEQUENCEINFOW *patchinfoW;
-
- TRACE("%s, %s, %d, %d, %p\n", debugstr_a(product), debugstr_a(usersid),
- context, count, patchinfo);
-
- if (!product) return ERROR_INVALID_PARAMETER;
- if (!(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY;
- if (usersid && !(usersidW = strdupAtoW( usersid )))
- {
- msi_free( productW );
- return ERROR_OUTOFMEMORY;
- }
- if (!(patchinfoW = patchinfoAtoW( count, patchinfo )))
- {
- msi_free( productW );
- msi_free( usersidW );
- return ERROR_OUTOFMEMORY;
- }
- r = MsiDeterminePatchSequenceW( productW, usersidW, context, count, patchinfoW );
- if (r == ERROR_SUCCESS)
- {
- for (i = 0; i < count; i++)
- {
- patchinfo[i].dwOrder = patchinfoW[i].dwOrder;
- patchinfo[i].uStatus = patchinfoW[i].uStatus;
- }
- }
- msi_free( productW );
- msi_free( usersidW );
- free_patchinfo( count, patchinfoW );
- return r;
-}
-
static UINT open_package( const WCHAR *product, const WCHAR *usersid,
MSIINSTALLCONTEXT context, MSIPACKAGE **package )
{
@@ -563,24 +305,6 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid,
return MSI_OpenPackageW( sourcepath, package );
}
-UINT WINAPI MsiDeterminePatchSequenceW( LPCWSTR product, LPCWSTR usersid,
- MSIINSTALLCONTEXT context, DWORD count, PMSIPATCHSEQUENCEINFOW patchinfo )
-{
- UINT r;
- MSIPACKAGE *package;
-
- TRACE("%s, %s, %d, %d, %p\n", debugstr_w(product), debugstr_w(usersid),
- context, count, patchinfo);
-
- if (!product) return ERROR_INVALID_PARAMETER;
- r = open_package( product, usersid, context, &package );
- if (r != ERROR_SUCCESS) return r;
-
- r = determine_patch_sequence( package, count, patchinfo );
- msiobj_release( &package->hdr );
- return r;
-}
-
UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
{
LPWSTR szwComponent = NULL;