Author: tkreuzer
Date: Wed Aug 8 04:28:08 2007
New Revision: 28233
URL:
http://svn.reactos.org/svn/reactos?rev=28233&view=rev
Log:
make NtGdiGetRandomRgn behave more like on XP, 33/34 tests now passing in w32knapi test
Modified:
trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c Wed Aug 8 04:28:08 2007
@@ -2349,22 +2349,15 @@
INT STDCALL
NtGdiGetRandomRgn(HDC hDC, HRGN hDest, INT iCode)
{
+ INT ret = 0;
PDC pDC;
HRGN hSrc = NULL;
POINT org;
- if ((hDC == NULL) || (hDest == NULL))
- {
- return -1;
- }
- if ((iCode<1 ) || (iCode>4 ))
- {
- return -1;
- }
-
pDC = DC_LockDc(hDC);
if (pDC == NULL)
{
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
return -1;
}
@@ -2375,12 +2368,12 @@
break;
case 2:
//hSrc = dc->hMetaRgn;
- DPRINT1("hMetaRgn not implement\n");
+ DPRINT1("hMetaRgn not implemented\n");
DC_UnlockDc(pDC);
return -1;
break;
case 3:
- DPRINT1("waring : hMetaRgn not implement\n");
+ DPRINT1("hMetaRgn not implemented\n");
//hSrc = dc->hMetaClipRgn;
if(!hSrc)
{
@@ -2390,20 +2383,30 @@
break;
case 4:
hSrc = pDC->w.hVisRgn;
+ break;
+ default:
+ hSrc = 0;
}
if (hSrc)
{
- NtGdiCombineRgn(hDest, hSrc, 0, RGN_COPY);
- }
- if (iCode == SYSRGN)
+ if(NtGdiCombineRgn(hDest, hSrc, 0, RGN_COPY) == ERROR)
+ {
+ ret = -1;
+ }
+ else
+ {
+ ret = 1;
+ }
+ }
+ if (iCode == SYSRGN)
{
IntGdiGetDCOrgEx(pDC, &org);
NtGdiOffsetRgn(hDest, org.x, org.y );
}
- DC_UnlockDc(pDC);
-
- return (hSrc != 0);
+ DC_UnlockDc(pDC);
+
+ return ret;
}
INT STDCALL