[2/2] kernel32/tests: Get the test to run on Windows 95.

Francois Gouget fgouget at free.fr
Sun Dec 9 18:24:49 CST 2007


---
 dlls/kernel32/tests/actctx.c |    5 ++++-
 dlls/kernel32/tests/file.c   |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c
index 40f8b6e..21faa68 100644
--- a/dlls/kernel32/tests/actctx.c
+++ b/dlls/kernel32/tests/actctx.c
@@ -29,6 +29,7 @@ static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
 static BOOL   (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
 static BOOL   (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA);
 static BOOL   (WINAPI *pGetCurrentActCtx)(HANDLE *);
+static BOOL   (WINAPI *pIsDebuggerPresent)(void);
 static BOOL   (WINAPI *pQueryActCtxW)(DWORD,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
 static VOID   (WINAPI *pReleaseActCtx)(HANDLE);
 
@@ -881,8 +882,9 @@ static void test_actctx(void)
         test_detailed_info(handle, &detailed_info1);
         test_info_in_assembly(handle, 1, &manifest1_info);
 
-        if (!IsDebuggerPresent())  /* CloseHandle will generate an exception if a debugger is present */
+        if (pIsDebuggerPresent && !pIsDebuggerPresent())
         {
+            /* CloseHandle will generate an exception if a debugger is present */
             b = CloseHandle(handle);
             ok(!b, "CloseHandle succeeded\n");
             ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError());
@@ -1137,6 +1139,7 @@ static BOOL init_funcs(void)
     X(DeactivateActCtx);
     X(FindActCtxSectionStringW);
     X(GetCurrentActCtx);
+    X(IsDebuggerPresent);
     X(QueryActCtxW);
     X(ReleaseActCtx);
 #undef X
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 8b8c5fa..1fac807 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -28,6 +28,9 @@
 #include "winbase.h"
 #include "winerror.h"
 
+static HINSTANCE hkernel32;
+static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
+
 /* keep filename and filenameW the same */
 static const char filename[] = "testfile.xxx";
 static const WCHAR filenameW[] = { 't','e','s','t','f','i','l','e','.','x','x','x',0 };
@@ -1420,12 +1423,18 @@ static void test_FindFirstFileExA(void)
     WIN32_FIND_DATAA search_results;
     HANDLE handle;
 
+    if (!pFindFirstFileExA)
+    {
+        skip("FindFirstFileExA() is missing\n");
+        return;
+    }
+
     CreateDirectoryA("test-dir", NULL);
     _lclose(_lcreat("test-dir\\file1", 0));
     _lclose(_lcreat("test-dir\\file2", 0));
     CreateDirectoryA("test-dir\\dir1", NULL);
     /* FindExLimitToDirectories is ignored */
-    handle = FindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0);
+    handle = pFindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0);
     ok(handle != INVALID_HANDLE_VALUE, "FindFirstFile failed (err=%u)\n", GetLastError());
     ok(strcmp(search_results.cFileName, ".") == 0, "First entry should be '.', is %s\n", search_results.cFileName);
 
@@ -1895,6 +1904,9 @@ static void test_RemoveDirectory(void)
 
 START_TEST(file)
 {
+    hkernel32 = GetModuleHandleA("kernel32.dll");
+    pFindFirstFileExA=(void*)GetProcAddress(hkernel32, "FindFirstFileExA");
+
     test__hread(  );
     test__hwrite(  );
     test__lclose(  );
-- 
1.5.3.4




More information about the wine-patches mailing list