From 0a68d5e2e4be90420e74f38d2f5f1f77ae537f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 8 May 2010 16:41:41 +0000 Subject: [PATCH] [WIN32K] - Allow NtGdiDeleteObjectApp to delete a permanent DC, as windows does it. This is not exactly what windows does, but no one should use a DeletedDC'ed DC anyway. Fixes "No! You Naughty Application" debug spam and some wine tests svn path=/branches/reactos-yarotows/; revision=47131 --- subsystems/win32/win32k/objects/dclife.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/subsystems/win32/win32k/objects/dclife.c b/subsystems/win32/win32k/objects/dclife.c index c57346f6d8c..664263348a1 100644 --- a/subsystems/win32/win32k/objects/dclife.c +++ b/subsystems/win32/win32k/objects/dclife.c @@ -801,11 +801,28 @@ IntGdiDeleteDC(HDC hDC, BOOL Force) if (!Force) { + /* Windows permits NtGdiDeleteObjectApp to delete a permanent DC + * For some reason, it's still a valid handle, pointing to some kernel data. + * Not sure if this is a bug, a feature, some cache stuff... Who knows? + * See NtGdiDeleteObjectApp test for details */ if (DCToDelete->fs & DC_FLAG_PERMANENT) { - DPRINT1("No! You Naughty Application!\n"); DC_UnlockDc(DCToDelete); - return UserReleaseDC(NULL, hDC, FALSE); + if(UserReleaseDC(NULL, hDC, FALSE)) + { + /* ReactOs feature : call UserReleaseDC + * I don't think windows does it. + * Still, complain, no one should ever call DeleteDC + * on a window DC */ + DPRINT1("No, you naughty application!\n"); + return TRUE; + } + else + { + /* This is not a window owned DC. + * Force its deletion */ + return IntGdiDeleteDC(hDC, TRUE); + } } }