Module: wine Branch: master Commit: 04c40f2f5f779776bdece8e60b0c9cf0686c2daa URL: http://source.winehq.org/git/wine.git/?a=commit;h=04c40f2f5f779776bdece8e60b... Author: Paul Vriens <paul.vriens.wine(a)gmail.com> Date: Mon Aug 4 18:25:29 2008 +0200 quartz/tests: Skip some tests on NT4. --- dlls/quartz/tests/avisplitter.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/avisplitter.c b/dlls/quartz/tests/avisplitter.c index a7461f4..cdebe26 100644 --- a/dlls/quartz/tests/avisplitter.c +++ b/dlls/quartz/tests/avisplitter.c @@ -25,6 +25,10 @@ #include "dshow.h" #include "tlhelp32.h" +static HANDLE (WINAPI *pCreateToolhelp32Snapshot)(DWORD, DWORD); +static BOOL (WINAPI *pThread32First)(HANDLE, LPTHREADENTRY32); +static BOOL (WINAPI *pThread32Next)(HANDLE, LPTHREADENTRY32); + static IUnknown *pAviSplitter = NULL; static int count_threads(void) @@ -33,19 +37,19 @@ static int count_threads(void) int threads; HANDLE h; - h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + h = pCreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); te.dwSize = sizeof(te); if (h == INVALID_HANDLE_VALUE) return -1; - Thread32First(h, &te); + pThread32First(h, &te); if (te.th32OwnerProcessID == GetCurrentProcessId()) threads = 1; else threads = 0; - while (Thread32Next(h, &te)) + while (pThread32Next(h, &te)) if (te.th32OwnerProcessID == GetCurrentProcessId()) ++threads; @@ -195,6 +199,13 @@ static void test_threads() DWORD readbytes; FILTER_STATE state; + /* We need another way of counting threads on NT4. Skip these tests (for now) */ + if (!pCreateToolhelp32Snapshot || !pThread32First || !pThread32Next) + { + win_skip("Needed thread functions are not available (NT4)\n"); + return; + } + /* Before doing anything */ baselevel = count_threads(); expected = 1; @@ -447,6 +458,12 @@ fail: START_TEST(avisplitter) { + HMODULE kernel32 = GetModuleHandleA("kernel32.dll"); + + pCreateToolhelp32Snapshot = (void*)GetProcAddress(kernel32, "CreateToolhelp32Snapshot"); + pThread32First = (void*)GetProcAddress(kernel32, "Thread32First"); + pThread32Next = (void*)GetProcAddress(kernel32, "Thread32Next"); + CoInitialize(NULL); if (!create_avisplitter())