From 155bd681a0eeaf0e63eb53513f5cd3bc80143b2a Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Sun, 19 Aug 2018 22:33:56 +0200 Subject: [PATCH] [GDI32_APITEST] Remove broken EngDeleteSemaphore.c (#655) - Checks are actually uses-after-free, "by design" :-< - Actual test code duplicates EngCreateSemaphore.c, EngAcquireSemaphore.c and EngReleaseSemaphore.c. --- .../rostests/apitests/gdi32/CMakeLists.txt | 1 - .../apitests/gdi32/EngDeleteSemaphore.c | 67 ------------------- modules/rostests/apitests/gdi32/testlist.c | 2 - 3 files changed, 70 deletions(-) delete mode 100644 modules/rostests/apitests/gdi32/EngDeleteSemaphore.c diff --git a/modules/rostests/apitests/gdi32/CMakeLists.txt b/modules/rostests/apitests/gdi32/CMakeLists.txt index 4290fce8d60..42453d1e980 100644 --- a/modules/rostests/apitests/gdi32/CMakeLists.txt +++ b/modules/rostests/apitests/gdi32/CMakeLists.txt @@ -21,7 +21,6 @@ list(APPEND SOURCE DPtoLP.c EngAcquireSemaphore.c EngCreateSemaphore.c - EngDeleteSemaphore.c EngReleaseSemaphore.c EnumFontFamilies.c ExcludeClipRect.c diff --git a/modules/rostests/apitests/gdi32/EngDeleteSemaphore.c b/modules/rostests/apitests/gdi32/EngDeleteSemaphore.c deleted file mode 100644 index d8c1218e3ee..00000000000 --- a/modules/rostests/apitests/gdi32/EngDeleteSemaphore.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * PROJECT: ReactOS api tests - * LICENSE: GPL - See COPYING in the top level directory - * PURPOSE: Test for EngDeleteSemaphore - * PROGRAMMERS: Magnus Olsen - */ - -#include "precomp.h" - -void Test_EngDeleteSemaphore() -{ - HSEMAPHORE hsem; - PRTL_CRITICAL_SECTION lpcrit; - - /* test Create then delete */ - hsem = EngCreateSemaphore(); - ok(hsem != NULL, "EngCreateSemaphore failed\n"); - if (!hsem) return; - lpcrit = (PRTL_CRITICAL_SECTION)hsem; - EngDeleteSemaphore(hsem); - -// ok(lpcrit->LockCount > 0); doesn't work on XP - ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount); - ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread); - ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore); - ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount); - - //ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n"); - if (lpcrit->DebugInfo) - { - ok(lpcrit->DebugInfo->Type != 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type); - ok(lpcrit->DebugInfo->CreatorBackTraceIndex != 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex); - //ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount); - //ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount); - } - - /* test EngAcquireSemaphore and release it, then delete it */ - hsem = EngCreateSemaphore(); - ok(hsem != NULL, "EngCreateSemaphore failed\n"); - if (!hsem) return; - lpcrit = (PRTL_CRITICAL_SECTION)hsem; - - EngAcquireSemaphore(hsem); - EngReleaseSemaphore(hsem); - EngDeleteSemaphore(hsem); - - //ok(lpcrit->LockCount > 0, "lpcrit->LockCount=%ld\n", lpcrit->LockCount); - ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount); - ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread); - ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore); - ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount); - - //ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n"); - if (lpcrit->DebugInfo) - { - ok(lpcrit->DebugInfo->Type != 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type); - ok(lpcrit->DebugInfo->CreatorBackTraceIndex != 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex); - //ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount); - //ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount); - } -} - -START_TEST(EngDeleteSemaphore) -{ - Test_EngDeleteSemaphore(); -} - diff --git a/modules/rostests/apitests/gdi32/testlist.c b/modules/rostests/apitests/gdi32/testlist.c index c466cde5bd5..2c9e70af4a0 100644 --- a/modules/rostests/apitests/gdi32/testlist.c +++ b/modules/rostests/apitests/gdi32/testlist.c @@ -22,7 +22,6 @@ extern void func_CreateRectRgn(void); extern void func_DPtoLP(void); extern void func_EngAcquireSemaphore(void); extern void func_EngCreateSemaphore(void); -extern void func_EngDeleteSemaphore(void); extern void func_EngReleaseSemaphore(void); extern void func_EnumFontFamilies(void); extern void func_ExcludeClipRect(void); @@ -96,7 +95,6 @@ const struct test winetest_testlist[] = { "DPtoLP", func_DPtoLP }, { "EngAcquireSemaphore", func_EngAcquireSemaphore }, { "EngCreateSemaphore", func_EngCreateSemaphore }, - { "EngDeleteSemaphore", func_EngDeleteSemaphore }, { "EngReleaseSemaphore", func_EngReleaseSemaphore }, { "EnumFontFamilies", func_EnumFontFamilies }, { "ExcludeClipRect", func_ExcludeClipRect }, -- 2.17.1