Paul Vriens : advapi32/tests: Prepare for more tests and use skip.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 12 08:28:33 CDT 2007
Module: wine
Branch: master
Commit: 65448311840c0f6da470e4c388789f6335cb9fdb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=65448311840c0f6da470e4c388789f6335cb9fdb
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Sun Mar 11 19:42:35 2007 +0100
advapi32/tests: Prepare for more tests and use skip.
---
dlls/advapi32/tests/registry.c | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 283da34..7e689e7 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -33,6 +33,22 @@ static DWORD GLE;
static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1";
static const char * sTestpath2 = "%FOO%\\subdir1";
+static HMODULE hadvapi32;
+static DWORD (WINAPI *pRegGetValueA)(HKEY,LPCSTR,LPCSTR,DWORD,LPDWORD,PVOID,LPDWORD);
+
+#define ADVAPI32_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hadvapi32, #func); \
+ if(!p ## func) \
+ trace("GetProcAddress(%s) failed\n", #func);
+
+static void InitFunctionPtrs(void)
+{
+ hadvapi32 = GetModuleHandleA("advapi32.dll");
+
+ /* This function was introduced with Windows 2003 SP1 */
+ ADVAPI32_GET_PROC(RegGetValueA)
+}
+
/* delete key and all its subkeys */
static DWORD delete_key( HKEY hkey )
{
@@ -360,9 +376,6 @@ static void test_query_value_ex(void)
static void test_get_value(void)
{
- HMODULE hadvapi32;
- DWORD (WINAPI *pRegGetValueA)(HKEY,LPCSTR,LPCSTR,DWORD,LPDWORD,PVOID,LPDWORD);
-
DWORD ret;
DWORD size;
DWORD type;
@@ -370,16 +383,11 @@ static void test_get_value(void)
CHAR buf[80];
CHAR expanded[] = "bar\\subdir1";
- /* This function was introduced with Windows 2003 SP1 */
- hadvapi32 = LoadLibraryA("advapi32.dll");
- if(!hadvapi32)
+ if(!pRegGetValueA)
{
- ok(0, "error=%d\n", GetLastError());
+ skip("RegGetValue not available on this platform\n");
return;
}
- pRegGetValueA = (PVOID)GetProcAddress(hadvapi32, "RegGetValueA");
- if(!pRegGetValueA)
- return;
/* Query REG_DWORD using RRF_RT_REG_DWORD (ok) */
size = type = dw = 0xdeadbeef;
@@ -860,6 +868,9 @@ static void test_reg_query_value(void)
START_TEST(registry)
{
+ /* Load pointers for functions that are not available in all Windows versions */
+ InitFunctionPtrs();
+
setup_main_key();
test_set_value();
create_test_entries();
More information about the wine-cvs
mailing list