Mike McCormack : msi: Add a test for MsiGetComponentPath and make it
pass.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 6 10:44:01 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: ee3e0586550b073e68a31418cb39868679953588
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=ee3e0586550b073e68a31418cb39868679953588
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Jul 6 19:01:11 2006 +0900
msi: Add a test for MsiGetComponentPath and make it pass.
---
dlls/msi/msi.c | 6 ++++--
dlls/msi/tests/msi.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index d3c2179..a628155 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -977,7 +977,7 @@ UINT WINAPI MsiVerifyPackageW( LPCWSTR s
INSTALLSTATE WINAPI MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
awstring* lpPathBuf, DWORD* pcchBuf)
{
- WCHAR squished_pc[GUID_SIZE];
+ WCHAR squished_pc[GUID_SIZE], squished_comp[GUID_SIZE];
UINT rc;
INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
HKEY hkey = 0;
@@ -992,7 +992,9 @@ INSTALLSTATE WINAPI MSI_GetComponentPath
if( lpPathBuf && !pcchBuf )
return INSTALLSTATE_INVALIDARG;
- squash_guid( szProduct, squished_pc );
+ if (!squash_guid( szProduct, squished_pc ) ||
+ !squash_guid( szComponent, squished_comp ))
+ return INSTALLSTATE_INVALIDARG;
rc = MSIREG_OpenProductsKey( szProduct, &hkey, FALSE);
if( rc != ERROR_SUCCESS )
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index b79f45d..4334675 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -31,6 +31,8 @@ typedef UINT (WINAPI *fnMsiOpenPackageEx
fnMsiOpenPackageExA pMsiOpenPackageExA;
typedef UINT (WINAPI *fnMsiOpenPackageExW)(LPCWSTR, DWORD, MSIHANDLE*);
fnMsiOpenPackageExW pMsiOpenPackageExW;
+typedef INSTALLSTATE (WINAPI *fnMsiGetComponentPathA)(LPCSTR, LPCSTR, LPSTR, DWORD*);
+fnMsiGetComponentPathA pMsiGetComponentPathA;
static void test_usefeature(void)
{
@@ -83,6 +85,46 @@ static void test_null(void)
ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
}
+static void test_getcomponentpath(void)
+{
+ INSTALLSTATE r;
+ char buffer[0x100];
+ DWORD sz;
+
+ if(!pMsiGetComponentPathA)
+ return;
+
+ r = pMsiGetComponentPathA( NULL, NULL, NULL, NULL );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "bogus", "bogus", NULL, NULL );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ sz = sizeof buffer;
+ buffer[0]=0;
+ r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}",
+ "{00000000-0000-0000-0000-000000000000}", buffer, &sz );
+ ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
+ "{00000000-0000-0000-0000-00000000}", buffer, &sz );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
+ "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer, &sz );
+ ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
+
+ r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}",
+ "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer, &sz );
+ ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
+}
+
START_TEST(msi)
{
HMODULE hmod = GetModuleHandle("msi.dll");
@@ -92,7 +134,10 @@ START_TEST(msi)
GetProcAddress(hmod, "MsiOpenPackageExA");
pMsiOpenPackageExW = (fnMsiOpenPackageExW)
GetProcAddress(hmod, "MsiOpenPackageExW");
+ pMsiGetComponentPathA = (fnMsiGetComponentPathA)
+ GetProcAddress(hmod, "MsiGetComponentPathA" );
test_usefeature();
test_null();
+ test_getcomponentpath();
}
More information about the wine-cvs
mailing list