msi/tests: Only use functions if they are implemented.

This commit is contained in:
Paul Vriens 2008-01-24 11:56:21 +01:00 committed by Alexandre Julliard
parent 3272fef91a
commit 46f1330e02
1 changed files with 18 additions and 4 deletions

View File

@ -41,9 +41,17 @@ static void init_functionpointers(void)
HMODULE hmsi = GetModuleHandleA("msi.dll"); HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
pMsiSourceListGetInfoA = (void*)GetProcAddress(hmsi, "MsiSourceListGetInfoA"); #define GET_PROC(dll, func) \
pMsiSourceListAddSourceExA = (void*)GetProcAddress(hmsi, "MsiSourceListAddSourceExA"); p ## func = (void *)GetProcAddress(dll, #func); \
pConvertSidToStringSidA = (void*)GetProcAddress(hadvapi32, "ConvertSidToStringSidA"); if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(hmsi, MsiSourceListAddSourceExA)
GET_PROC(hmsi, MsiSourceListGetInfoA)
GET_PROC(hadvapi32, ConvertSidToStringSidA)
#undef GET_PROC
} }
/* copied from dlls/msi/registry.c */ /* copied from dlls/msi/registry.c */
@ -125,6 +133,12 @@ static void test_MsiSourceListGetInfo(void)
HKEY userkey, hkey; HKEY userkey, hkey;
DWORD size; DWORD size;
if (!pMsiSourceListGetInfoA)
{
skip("Skipping MsiSourceListGetInfoA tests\n");
return;
}
create_test_guid(prodcode, prod_squashed); create_test_guid(prodcode, prod_squashed);
get_user_sid(&usersid); get_user_sid(&usersid);
@ -348,7 +362,7 @@ static void test_MsiSourceListAddSourceEx(void)
if (!pMsiSourceListAddSourceExA) if (!pMsiSourceListAddSourceExA)
{ {
skip("Skipping MsiSourceListAddSourceEx tests\n"); skip("Skipping MsiSourceListAddSourceExA tests\n");
return; return;
} }