From 0b1b703fdd1ce66ed5d1aa96967b147dc4e97867 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Wed, 16 Feb 2005 17:52:53 +0000 Subject: [PATCH] Move product, feature and component enumeration functions to registry.c. --- dlls/msi/msi.c | 229 ---------------------------------------------------- dlls/msi/registry.c | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+), 229 deletions(-) diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index b1e91b289b2..c9db2d4bbf3 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -970,219 +970,6 @@ UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uT return ERROR_CALL_NOT_IMPLEMENTED; } -UINT WINAPI MsiEnumProductsA(DWORD index, LPSTR lpguid) -{ - DWORD r; - WCHAR szwGuid[GUID_SIZE]; - - TRACE("%ld %p\n",index,lpguid); - - if (NULL == lpguid) { - return ERROR_INVALID_PARAMETER; - } - r = MsiEnumProductsW(index, szwGuid); - if( r == ERROR_SUCCESS ) - WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL); - - return r; -} - -UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid) -{ - HKEY hkeyFeatures = 0; - DWORD r; - WCHAR szKeyName[33]; - - TRACE("%ld %p\n",index,lpguid); - - if (NULL == lpguid) - return ERROR_INVALID_PARAMETER; - - r = MSIREG_OpenFeatures(&hkeyFeatures); - if( r != ERROR_SUCCESS ) - goto end; - - r = RegEnumKeyW(hkeyFeatures, index, szKeyName, GUID_SIZE); - - unsquash_guid(szKeyName, lpguid); - -end: - - if( hkeyFeatures ) - RegCloseKey(hkeyFeatures); - - return r; -} - -UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, - LPSTR szFeature, LPSTR szParent) -{ - DWORD r; - WCHAR szwFeature[GUID_SIZE], szwParent[GUID_SIZE]; - LPWSTR szwProduct = NULL; - - TRACE("%s %ld %p %p\n",debugstr_a(szProduct),index,szFeature,szParent); - - if( szProduct ) - { - UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); - szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwProduct ) - MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); - else - return ERROR_FUNCTION_FAILED; - } - - r = MsiEnumFeaturesW(szwProduct, index, szwFeature, szwParent); - if( r == ERROR_SUCCESS ) - { - WideCharToMultiByte(CP_ACP, 0, szwFeature, -1, - szFeature, GUID_SIZE, NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, szwParent, -1, - szParent, GUID_SIZE, NULL, NULL); - } - - HeapFree( GetProcessHeap(), 0, szwProduct); - - return r; -} - -UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index, - LPWSTR szFeature, LPWSTR szParent) -{ - HKEY hkeyProduct = 0; - DWORD r, sz; - - TRACE("%s %ld %p %p\n",debugstr_w(szProduct),index,szFeature,szParent); - - r = MSIREG_OpenFeaturesKey(szProduct,&hkeyProduct,FALSE); - if( r != ERROR_SUCCESS ) - goto end; - - sz = GUID_SIZE; - r = RegEnumValueW(hkeyProduct, index, szFeature, &sz, NULL, NULL, NULL, NULL); - -end: - if( hkeyProduct ) - RegCloseKey(hkeyProduct); - - return r; -} - -UINT WINAPI MsiEnumComponentsA(DWORD index, LPSTR lpguid) -{ - DWORD r; - WCHAR szwGuid[GUID_SIZE]; - - TRACE("%ld %p\n",index,lpguid); - - r = MsiEnumComponentsW(index, szwGuid); - if( r == ERROR_SUCCESS ) - WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL); - - return r; -} - -UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid) -{ - HKEY hkeyComponents = 0; - DWORD r; - WCHAR szKeyName[33]; - - TRACE("%ld %p\n",index,lpguid); - - r = MSIREG_OpenComponents(&hkeyComponents); - if( r != ERROR_SUCCESS ) - goto end; - - r = RegEnumKeyW(hkeyComponents, index, szKeyName, GUID_SIZE); - - unsquash_guid(szKeyName, lpguid); - -end: - - if( hkeyComponents ) - RegCloseKey(hkeyComponents); - - return r; -} - -UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct) -{ - DWORD r; - WCHAR szwProduct[GUID_SIZE]; - LPWSTR szwComponent = NULL; - - TRACE("%s %ld %p\n",debugstr_a(szComponent),index,szProduct); - - if( szComponent ) - { - UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); - szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); - if( szwComponent ) - MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); - else - return ERROR_FUNCTION_FAILED; - } - - r = MsiEnumClientsW(szComponent?szwComponent:NULL, index, szwProduct); - if( r == ERROR_SUCCESS ) - { - WideCharToMultiByte(CP_ACP, 0, szwProduct, -1, - szProduct, GUID_SIZE, NULL, NULL); - } - - HeapFree( GetProcessHeap(), 0, szwComponent); - - return r; -} - -UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct) -{ - HKEY hkeyComp = 0; - DWORD r, sz; - WCHAR szValName[GUID_SIZE]; - - TRACE("%s %ld %p\n",debugstr_w(szComponent),index,szProduct); - - r = MSIREG_OpenComponentsKey(szComponent,&hkeyComp,FALSE); - if( r != ERROR_SUCCESS ) - goto end; - - sz = GUID_SIZE; - r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL); - if( r != ERROR_SUCCESS ) - goto end; - - unsquash_guid(szValName, szProduct); - -end: - if( hkeyComp ) - RegCloseKey(hkeyComp); - - return r; -} - -UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex, - LPSTR lpQualifierBuf, DWORD* pcchQualifierBuf, - LPSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf) -{ - FIXME("%s %08lx %p %p %p %p\n", debugstr_a(szComponent), iIndex, - lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf, - pcchApplicationDataBuf); - return ERROR_CALL_NOT_IMPLEMENTED; -} - -UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex, - LPWSTR lpQualifierBuf, DWORD* pcchQualifierBuf, - LPWSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf ) -{ - FIXME("%s %08lx %p %p %p %p\n", debugstr_w(szComponent), iIndex, - lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf, - pcchApplicationDataBuf); - return ERROR_CALL_NOT_IMPLEMENTED; -} - UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext, DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf, DWORD* pcchPathBuf ) @@ -1678,22 +1465,6 @@ BOOL WINAPI MSI_DllCanUnloadNow(void) return S_FALSE; } -UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved, - DWORD iProductIndex, LPWSTR lpProductBuf) -{ - FIXME("%s %lu %lu %p\n", debugstr_w(szUpgradeCode), dwReserved, - iProductIndex, lpProductBuf); - return ERROR_CALL_NOT_IMPLEMENTED; -} - -UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved, - DWORD iProductIndex, LPSTR lpProductBuf) -{ - FIXME("%s %lu %lu %p\n", debugstr_a(szUpgradeCode), dwReserved, - iProductIndex, lpProductBuf); - return ERROR_CALL_NOT_IMPLEMENTED; -} - UINT WINAPI MsiGetFeatureUsageW(LPCWSTR szProduct, LPCWSTR szFeature, DWORD* pdwUseCount, WORD* pwDateUsed) { diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index 61c03c63e5c..6320d03db1e 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -484,3 +484,231 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct, return r; } + +UINT WINAPI MsiEnumProductsA(DWORD index, LPSTR lpguid) +{ + DWORD r; + WCHAR szwGuid[GUID_SIZE]; + + TRACE("%ld %p\n",index,lpguid); + + if (NULL == lpguid) + return ERROR_INVALID_PARAMETER; + r = MsiEnumProductsW(index, szwGuid); + if( r == ERROR_SUCCESS ) + WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL); + + return r; +} + +UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid) +{ + HKEY hkeyFeatures = 0; + DWORD r; + WCHAR szKeyName[33]; + + TRACE("%ld %p\n",index,lpguid); + + if (NULL == lpguid) + return ERROR_INVALID_PARAMETER; + + r = MSIREG_OpenFeatures(&hkeyFeatures); + if( r != ERROR_SUCCESS ) + goto end; + + r = RegEnumKeyW(hkeyFeatures, index, szKeyName, GUID_SIZE); + + unsquash_guid(szKeyName, lpguid); + +end: + + if( hkeyFeatures ) + RegCloseKey(hkeyFeatures); + + return r; +} + +UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, + LPSTR szFeature, LPSTR szParent) +{ + DWORD r; + WCHAR szwFeature[GUID_SIZE], szwParent[GUID_SIZE]; + LPWSTR szwProduct = NULL; + + TRACE("%s %ld %p %p\n",debugstr_a(szProduct),index,szFeature,szParent); + + if( szProduct ) + { + UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); + szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); + if( szwProduct ) + MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len ); + else + return ERROR_FUNCTION_FAILED; + } + + r = MsiEnumFeaturesW(szwProduct, index, szwFeature, szwParent); + if( r == ERROR_SUCCESS ) + { + WideCharToMultiByte(CP_ACP, 0, szwFeature, -1, + szFeature, GUID_SIZE, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, szwParent, -1, + szParent, GUID_SIZE, NULL, NULL); + } + + HeapFree( GetProcessHeap(), 0, szwProduct); + + return r; +} + +UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index, + LPWSTR szFeature, LPWSTR szParent) +{ + HKEY hkeyProduct = 0; + DWORD r, sz; + + TRACE("%s %ld %p %p\n",debugstr_w(szProduct),index,szFeature,szParent); + + r = MSIREG_OpenFeaturesKey(szProduct,&hkeyProduct,FALSE); + if( r != ERROR_SUCCESS ) + goto end; + + sz = GUID_SIZE; + r = RegEnumValueW(hkeyProduct, index, szFeature, &sz, NULL, NULL, NULL, NULL); + +end: + if( hkeyProduct ) + RegCloseKey(hkeyProduct); + + return r; +} + +UINT WINAPI MsiEnumComponentsA(DWORD index, LPSTR lpguid) +{ + DWORD r; + WCHAR szwGuid[GUID_SIZE]; + + TRACE("%ld %p\n",index,lpguid); + + r = MsiEnumComponentsW(index, szwGuid); + if( r == ERROR_SUCCESS ) + WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL); + + return r; +} + +UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid) +{ + HKEY hkeyComponents = 0; + DWORD r; + WCHAR szKeyName[33]; + + TRACE("%ld %p\n",index,lpguid); + + r = MSIREG_OpenComponents(&hkeyComponents); + if( r != ERROR_SUCCESS ) + goto end; + + r = RegEnumKeyW(hkeyComponents, index, szKeyName, GUID_SIZE); + + unsquash_guid(szKeyName, lpguid); + +end: + + if( hkeyComponents ) + RegCloseKey(hkeyComponents); + + return r; +} + +UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct) +{ + DWORD r; + WCHAR szwProduct[GUID_SIZE]; + LPWSTR szwComponent = NULL; + + TRACE("%s %ld %p\n",debugstr_a(szComponent),index,szProduct); + + if( szComponent ) + { + UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); + szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); + if( szwComponent ) + MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); + else + return ERROR_FUNCTION_FAILED; + } + + r = MsiEnumClientsW(szComponent?szwComponent:NULL, index, szwProduct); + if( r == ERROR_SUCCESS ) + { + WideCharToMultiByte(CP_ACP, 0, szwProduct, -1, + szProduct, GUID_SIZE, NULL, NULL); + } + + HeapFree( GetProcessHeap(), 0, szwComponent); + + return r; +} + +UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct) +{ + HKEY hkeyComp = 0; + DWORD r, sz; + WCHAR szValName[GUID_SIZE]; + + TRACE("%s %ld %p\n",debugstr_w(szComponent),index,szProduct); + + r = MSIREG_OpenComponentsKey(szComponent,&hkeyComp,FALSE); + if( r != ERROR_SUCCESS ) + goto end; + + sz = GUID_SIZE; + r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL); + if( r != ERROR_SUCCESS ) + goto end; + + unsquash_guid(szValName, szProduct); + +end: + if( hkeyComp ) + RegCloseKey(hkeyComp); + + return r; +} + +UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex, + LPSTR lpQualifierBuf, DWORD* pcchQualifierBuf, + LPSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf) +{ + FIXME("%s %08lx %p %p %p %p\n", debugstr_a(szComponent), iIndex, + lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf, + pcchApplicationDataBuf); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex, + LPWSTR lpQualifierBuf, DWORD* pcchQualifierBuf, + LPWSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf ) +{ + FIXME("%s %08lx %p %p %p %p\n", debugstr_w(szComponent), iIndex, + lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf, + pcchApplicationDataBuf); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved, + DWORD iProductIndex, LPWSTR lpProductBuf) +{ + FIXME("%s %lu %lu %p\n", debugstr_w(szUpgradeCode), dwReserved, + iProductIndex, lpProductBuf); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved, + DWORD iProductIndex, LPSTR lpProductBuf) +{ + FIXME("%s %lu %lu %p\n", debugstr_a(szUpgradeCode), dwReserved, + iProductIndex, lpProductBuf); + return ERROR_CALL_NOT_IMPLEMENTED; +} -- 2.11.4.GIT