[PATCH v3 1/5] kernelbase/tests: Check module instead of function existence.

Zhiyi Zhang zzhang at codeweavers.com
Mon Nov 19 08:57:00 CST 2018


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v2: Fix apply failure due to mail client text encoding.
v3: Avoid possible buffer overrun. Add more tests. Thanks Nikolay.

 dlls/kernelbase/tests/path.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c
index cdba51bf3f..ba271cbe6c 100644
--- a/dlls/kernelbase/tests/path.c
+++ b/dlls/kernelbase/tests/path.c
@@ -147,12 +147,6 @@ static void test_PathCchAddBackslash(void)
     unsigned int i;
     HRESULT hr;
 
-    if (!pPathCchAddBackslash)
-    {
-        win_skip("PathCchAddBackslash() is not available.\n");
-        return;
-    }
-
     pathW[0] = 0;
     hr = pPathCchAddBackslash(pathW, 0);
     ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr);
@@ -190,12 +184,6 @@ static void test_PathCchAddBackslashEx(void)
     HRESULT hr;
     WCHAR *ptrW;
 
-    if (!pPathCchAddBackslashEx)
-    {
-        win_skip("PathCchAddBackslashEx() is not available.\n");
-        return;
-    }
-
     pathW[0] = 0;
     hr = pPathCchAddBackslashEx(pathW, 0, NULL, NULL);
     ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr);
@@ -248,6 +236,11 @@ static void test_PathCchAddBackslashEx(void)
 START_TEST(path)
 {
     HMODULE hmod = LoadLibraryA("kernelbase.dll");
+    if (!hmod)
+    {
+        win_skip("kernelbase.dll is not available.\n");
+        return;
+    }
 
     pPathCchCombineEx = (void *)GetProcAddress(hmod, "PathCchCombineEx");
     pPathCchAddBackslash = (void *)GetProcAddress(hmod, "PathCchAddBackslash");
-- 
2.19.1





More information about the wine-devel mailing list