Release 960811

Sun Aug 11 13:00:20 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure.in] [include/acconfig.h] [tools/build.c]
	Added check for underscore on external symbols.

	* [memory/selector.c] [memory/global.c]
	Fixed FreeSelector() to free only one selector.
	Added SELECTOR_FreeBlock() to free an array of selectors.

	* [objects/color.c]
	Fixed a bug in COLOR_ToLogical() that caused GetPixel() to fail on
	hi-color displays.

	* [tools/build.c] [if1632/crtdll.spec]
	Added 'extern' type, used for external variables or functions.

	* [windows/winpos.c]
	Allow de-activating a window in WINPOS_ChangeActiveWindow().

	* [windows/winproc.c]
	Added 32-to-16 translation for button messages.
	Fixed WINPROC_GetPtr() to avoid crashes on 32-bit procedures that
	happen to be valid SEGPTRs.

Sat Aug 10 18:22:25 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/message.c]
	Removed a FIXME in MSG_PeekHardwareMsg(): produces correct 
	data for the JOURNALRECORD-hook (using EVENTMSG16 structure).

	* [if1632/gdi.spec] [include/windows.h] [objects/metafile.c]
	Introduced undocumented API function IsValidMetaFile(), plus a
 	minor fix in last patch of CopyMetaFile().

	* [objects/gdiobj.c]
	Removed a FIXME in IsGDIObject(): added magic word check.

Sun Aug 10 18:10:10 1996  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [controls/statuswin.c]
	First pass at implementing the StatusWindow class.

	* [include/commctrl.h]
	Header file for common controls.

	* [controls/widgets.c]
	Added InitCommonControls().

	* [if1632/comctl32.spec]
	Add DrawStatusTextA, CreateStatusWindowA, InitCommonControls.

	* [win32/findfile.c] [if1632/kernel32.spec]
	Add FindNextFile32A, FindClose.
	Modified FindFirstFile32A so it works with FindNextFile32A.

	* [include/winbase.h]
	Fixed WIN32_FIND_DATA structure member names.

Sat Aug 10 09:00:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/scroll.c]
	Changed scrolling routines to benefit from DCE code update.

Thu Aug  8 18:05:09 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/file.c]
	SearchPath* could get NULL for lastpart argument.

	* [if1632/build-spec.txt] [documentation/debugging]
	Varargs documentation added, debugging hints updated.

	* [if1632/crtdll.spec][misc/crtdll.c][misc/Makefile.in]
	Started to implement CRTDLL.

	* [if1632/wsock32.spec]
	Some thunks to standard libc functions (structures have the same
 	elements, but perhaps wrong offset due to packing).

	* [include/kernel32.h][include/windows.h][win32/*.c][loader/main.c]
	Merged kernel32.h into windows.h.

	* [misc/lstr.c]
	Enhanced FormatMessage().

	* [misc/main.c] [if1632/kernel.spec] [include/windows.h]
	GetVersion() updated to new naming standard.
	Changed language handling to support language ids.

	* [misc/shell.c]
	Enhanced FindExecutable, so it finds files in the search path too.

	* [win32/environment.c]
	GetCommandLine* updated.

	* [loader/resource.c] [loader/pe_resource.c]
	FindResourceEx32* added.
	Loading of messagetables added.
	Language handling now uses Wine default language id.
diff --git a/objects/bitblt.c b/objects/bitblt.c
index 1cb29bb..4a9489c 100644
--- a/objects/bitblt.c
+++ b/objects/bitblt.c
@@ -660,8 +660,9 @@
         memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00,
                 widthDst*sizeof(int) );
 
-    hstretch = ((widthSrc < widthDst) || (mode == STRETCH_DELETESCANS));
-    vstretch = ((heightSrc < heightDst) || (mode == STRETCH_DELETESCANS));
+    hstretch = (widthSrc < widthDst);
+    vstretch = (heightSrc < heightDst);
+
     xinc = hstretch ? ((int)widthSrc << 16) / widthDst :
                       ((int)widthDst << 16) / widthSrc;
 
diff --git a/objects/brush.c b/objects/brush.c
index 00553ab..27c847f 100644
--- a/objects/brush.c
+++ b/objects/brush.c
@@ -190,7 +190,7 @@
 /***********************************************************************
  *           CreateDIBPatternBrush    (GDI.445)
  */
-HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
+HBRUSH CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse )
 {
     LOGBRUSH16 logbrush = { BS_DIBPATTERN, coloruse, 0 };
     BITMAPINFO *info, *newInfo;
diff --git a/objects/color.c b/objects/color.c
index 308d191..5ed37ec 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -736,9 +736,9 @@
 
     if ( cSpace.flags & COLOR_FIXED && !COLOR_Graymax )
        {
-         color.red = pixel >> COLOR_Redshift;
-         color.green = pixel >> COLOR_Greenshift;
-         color.blue = pixel >> COLOR_Blueshift;
+         color.red = (pixel >> COLOR_Redshift) & COLOR_Redmax;
+         color.green = (pixel >> COLOR_Greenshift) & COLOR_Greenmax;
+         color.blue = (pixel >> COLOR_Blueshift) & COLOR_Bluemax;
        }
     else if ((screenDepth <= 8) && (pixel < 256) && 
 	    !(cSpace.flags & (COLOR_VIRTUAL | COLOR_FIXED)) )
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 5a35ff8..2b1c67f 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -38,7 +38,7 @@
 extern UINT16 COLOR_GetSystemPaletteSize();
 
 Cursor CURSORICON_XCursor = None;  /* Current X cursor */
-static HCURSOR hActiveCursor = 0;  /* Active cursor */
+static HCURSOR16 hActiveCursor = 0;  /* Active cursor */
 static int CURSOR_ShowCount = 0;   /* Cursor display count */
 static RECT32 CURSOR_ClipRect;       /* Cursor clipping rect */
 
@@ -371,7 +371,7 @@
                                int height, int colors, BOOL fCursor )
 {
     HANDLE handle,hRet;
-    HRSRC  hRsrc;
+    HRSRC16 hRsrc;
     CURSORICONDIRENTRY dirEntry;
 
     if (!hInstance)  /* OEM cursor/icon */
@@ -433,7 +433,7 @@
  * FIXME: if icon is passed returns a copy of OCR_DRAGOBJECT cursor
  *	  but should actually convert icon to cursor.
  */
-HCURSOR CURSORICON_IconToCursor(HICON hIcon)
+HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon)
 {
  CURSORICONINFO *ptr = NULL;
 
@@ -499,9 +499,9 @@
 /***********************************************************************
  *           CreateCursor    (USER.406)
  */
-HCURSOR CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
-                      INT nWidth, INT nHeight,
-                      const BYTE *lpANDbits, const BYTE *lpXORbits )
+HCURSOR16 CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot,
+                        INT nWidth, INT nHeight,
+                        const BYTE *lpANDbits, const BYTE *lpXORbits )
 {
     CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
 
@@ -514,7 +514,7 @@
 /***********************************************************************
  *           CreateIcon    (USER.407)
  */
-HICON CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes,
+HICON16 CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes,
                   BYTE bBitsPixel, const BYTE* lpANDbits, const BYTE* lpXORbits)
 {
     CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel };
@@ -585,7 +585,7 @@
 /***********************************************************************
  *           DestroyIcon    (USER.457)
  */
-BOOL DestroyIcon( HICON hIcon )
+BOOL DestroyIcon( HICON16 hIcon )
 {
     dprintf_icon( stddeb, "DestroyIcon: %04x\n", hIcon );
     /* FIXME: should check for OEM icon here */
@@ -596,7 +596,7 @@
 /***********************************************************************
  *           DestroyCursor    (USER.458)
  */
-BOOL DestroyCursor( HCURSOR hCursor )
+BOOL DestroyCursor( HCURSOR16 hCursor )
 {
     dprintf_cursor( stddeb, "DestroyCursor: %04x\n", hCursor );
     /* FIXME: should check for OEM cursor here */
@@ -607,7 +607,7 @@
 /***********************************************************************
  *           DrawIcon    (USER.84)
  */
-BOOL DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
+BOOL DrawIcon( HDC hdc, INT x, INT y, HICON16 hIcon )
 {
     CURSORICONINFO *ptr;
     HDC hMemDC;
@@ -665,7 +665,7 @@
  *
  * Change the X cursor. Helper function for SetCursor() and ShowCursor().
  */
-static BOOL CURSORICON_SetCursor( HCURSOR hCursor )
+static BOOL CURSORICON_SetCursor( HCURSOR16 hCursor )
 {
     Pixmap pixmapBits, pixmapMask, pixmapAll;
     XColor fg, bg;
@@ -803,9 +803,9 @@
 /***********************************************************************
  *           SetCursor    (USER.69)
  */
-HCURSOR SetCursor( HCURSOR hCursor )
+HCURSOR16 SetCursor( HCURSOR16 hCursor )
 {
-    HCURSOR hOldCursor;
+    HCURSOR16 hOldCursor;
 
     if (hCursor == hActiveCursor) return hActiveCursor;  /* No change */
     dprintf_cursor( stddeb, "SetCursor: %04x\n", hCursor );
@@ -852,7 +852,7 @@
 /***********************************************************************
  *           GetCursor    (USER.247)
  */
-HCURSOR GetCursor(void)
+HCURSOR16 GetCursor(void)
 {
     return hActiveCursor;
 }
@@ -973,7 +973,7 @@
 /**********************************************************************
  *	    LoadIconHandler    (USER.456)
  */
-HICON LoadIconHandler( HANDLE hResource, BOOL bNew )
+HICON16 LoadIconHandler( HANDLE hResource, BOOL bNew )
 {
     dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource);
 
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index c406140..d36acda 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -515,11 +515,10 @@
  */
 BOOL IsGDIObject(HANDLE handle)
 {
-    GDIOBJHDR *object;
-
-    object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
-    /* FIXME: should check magic here */
-    return (object != NULL);
+    GDIOBJHDR *object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
+    if (object)
+      return (object->wMagic>=PEN_MAGIC && object->wMagic<= METAFILE_DC_MAGIC);
+    return FALSE;
 }
 
 
diff --git a/objects/metafile.c b/objects/metafile.c
index 3c2ad1a..d3e21e3 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -25,9 +25,9 @@
  *         GetMetafile         GDI.124 By Kenny MacDonald 30 Nov 94
  */
 
-HMETAFILE GetMetaFile(LPSTR lpFilename)
+HMETAFILE16 GetMetaFile(LPSTR lpFilename)
 {
-  HMETAFILE hmf;
+  HMETAFILE16 hmf;
   METAHEADER *mh;
   HFILE hFile;
   DWORD size;
@@ -146,9 +146,9 @@
  *         CopyMetafile         GDI.151 Niels de Carpentier, April 1996
  */
 
-HMETAFILE CopyMetaFile(HMETAFILE hSrcMetaFile, LPCSTR lpFilename)
+HMETAFILE16 CopyMetaFile(HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
 {
-    HMETAFILE handle = 0;
+    HMETAFILE16 handle = 0;
     METAHEADER *mh;
     METAHEADER *mh2;
     int hFile;
@@ -168,12 +168,9 @@
 	mh->mtType=1;        /* disk file version stores 1 here */
 	i=_lwrite(hFile, (char *)mh, mh->mtSize * 2) ;
 	mh->mtType=j;        /* restore old value  [0 or 1] */	
+        _lclose(hFile);
 	if (i == -1)
-	    {
-	    _lclose(hFile);
 	    return 0;
-	    }
-	_lclose(hFile);
         }
     else                     /* memory based metafile */
         {
@@ -186,16 +183,35 @@
     return handle;
 }
 
+/******************************************************************
+ *         IsValidMetaFile   (GDI.410)
+ *         (This is not exactly what windows does, see "Undoc Win")
+ */
+
+BOOL IsValidMetaFile(HMETAFILE16 hmf)
+{
+    BOOL resu=FALSE;
+    METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
+    if (mh)
+      if (mh->mtType == 1 || mh->mtType == 0) 
+        if (mh->mtHeaderSize == MFHEADERSIZE/sizeof(INT16))
+          if (mh->mtVersion == MFVERSION)
+            resu=TRUE;
+    GlobalUnlock16(hmf);            
+    dprintf_metafile(stddeb,"IsValidMetaFile %x => %d\n",hmf,resu);
+    return resu;         
+}
+
 
 /******************************************************************
  *         CloseMetafile         GDI.126
  */
 
-HMETAFILE CloseMetaFile(HDC hdc)
+HMETAFILE16 CloseMetaFile(HDC hdc)
 {
     DC *dc;
     METAHEADER *mh;
-    HMETAFILE hmf;
+    HMETAFILE16 hmf;
     HFILE hFile;
     
     dprintf_metafile(stddeb,"CloseMetaFile\n");
@@ -248,7 +264,7 @@
  *         DeleteMetafile         GDI.127
  */
 
-BOOL DeleteMetaFile(HMETAFILE hmf)
+BOOL DeleteMetaFile(HMETAFILE16 hmf)
 {
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
 
@@ -264,7 +280,7 @@
  *         PlayMetafile         GDI.123
  */
 
-BOOL PlayMetaFile(HDC hdc, HMETAFILE hmf)
+BOOL PlayMetaFile(HDC hdc, HMETAFILE16 hmf)
 {
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
     METARECORD *mr;
@@ -307,7 +323,7 @@
  *                                    Niels de carpentier, april 1996
  */
 
-BOOL EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
+BOOL EnumMetaFile(HDC hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
 {
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
     METARECORD *mr;
@@ -740,7 +756,7 @@
  * Trade in a meta file object handle for a handle to the meta file memory
  */
 
-HANDLE GetMetaFileBits(HMETAFILE hmf)
+HANDLE GetMetaFileBits(HMETAFILE16 hmf)
 {
     dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %04x\n", hmf);
 
@@ -753,7 +769,7 @@
  * Trade in a meta file memory handle for a handle to a meta file object
  */
 
-HMETAFILE SetMetaFileBits(HANDLE hMem)
+HMETAFILE16 SetMetaFileBits(HANDLE hMem)
 {
     dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %04x\n", hMem);
 
@@ -764,7 +780,7 @@
  *         MF_WriteRecord
  */
 
-HMETAFILE MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen)
+HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen)
 {
     DWORD len;
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
@@ -860,7 +876,7 @@
 {
     char buffer[8];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 3;
     mr->rdFunction = func;
@@ -878,7 +894,7 @@
 {
     char buffer[8];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 4;
     mr->rdFunction = func;
@@ -897,7 +913,7 @@
 {
     char buffer[10];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 5;
     mr->rdFunction = func;
@@ -919,7 +935,7 @@
 {
     char buffer[14];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 7;
     mr->rdFunction = func;
@@ -943,7 +959,7 @@
 {
     char buffer[18];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 9;
     mr->rdFunction = func;
@@ -969,7 +985,7 @@
 {
     char buffer[22];
     METARECORD *mr = (METARECORD *)&buffer;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     
     mr->rdSize = 11;
     mr->rdFunction = func;
@@ -995,7 +1011,7 @@
 BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush)
 {
     int index;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     char buffer[sizeof(METARECORD) - 2 + sizeof(LOGBRUSH16)];
     METARECORD *mr = (METARECORD *)&buffer;
     METAHEADER *mh;
@@ -1039,7 +1055,7 @@
     BITMAPINFO *info;
     BITMAPINFOHEADER *infohdr;
     int index;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     char buffer[sizeof(METARECORD)];
     METAHEADER *mh;
 
@@ -1124,7 +1140,7 @@
 BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen)
 {
     int index;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     char buffer[sizeof(METARECORD) - 2 + sizeof(LOGPEN16)];
     METARECORD *mr = (METARECORD *)&buffer;
     METAHEADER *mh;
@@ -1161,7 +1177,7 @@
 BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT16 *logfont)
 {
     int index;
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)];
     METARECORD *mr = (METARECORD *)&buffer;
     METAHEADER *mh;
@@ -1196,7 +1212,7 @@
  */
 BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count)
 {
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     DWORD len;
     HANDLE hmr;
     METARECORD *mr;
@@ -1225,7 +1241,7 @@
 BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect,
                    LPCSTR str, short count, const INT16 *lpDx)
 {
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     DWORD len;
     HANDLE hmr;
     METARECORD *mr;
@@ -1259,7 +1275,7 @@
  */
 BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
 {
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     DWORD len;
     HANDLE hmr;
     METARECORD *mr;
@@ -1287,7 +1303,7 @@
 BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width,
 	       short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop)
 {
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     DWORD len;
     HANDLE hmr;
     METARECORD *mr;
@@ -1339,7 +1355,7 @@
 		   short heightDest, HDC hdcSrc, short xSrc, short ySrc, 
 		   short widthSrc, short heightSrc, DWORD rop)
 {
-    HMETAFILE handle;
+    HMETAFILE16 handle;
     DWORD len;
     HANDLE hmr;
     METARECORD *mr;
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
index 3de567fa..819e82a 100644
--- a/objects/oembitmap.c
+++ b/objects/oembitmap.c
@@ -216,7 +216,7 @@
 #endif
 };
 
-static HCURSOR OBM_Cursors[NB_CURSORS];
+static HGLOBAL16 OBM_Cursors[NB_CURSORS];
 
 
   /* All the colors used in the xpm files must be included in this   */
@@ -299,10 +299,10 @@
  *
  * Allocate a GDI bitmap.
  */
-static HBITMAP OBM_MakeBitmap( WORD width, WORD height,
-                               WORD bpp, Pixmap pixmap )
+static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
+                                 WORD bpp, Pixmap pixmap )
 {
-    HBITMAP hbitmap;
+    HBITMAP16 hbitmap;
     BITMAPOBJ * bmpObjPtr;
 
     if (!pixmap) return 0;
@@ -330,8 +330,8 @@
  *
  * Create the 2 bitmaps from XPM data.
  */
-static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap,
-                               HBITMAP *hBitmapMask, POINT16 *hotspot )
+static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP16 *hBitmap,
+                               HBITMAP16 *hBitmapMask, POINT16 *hotspot )
 {
     Pixmap pixmap, pixmask;
     XpmAttributes *attrs;
@@ -377,9 +377,9 @@
 /***********************************************************************
  *           OBM_LoadBitmap
  */
-HBITMAP OBM_LoadBitmap( WORD id )
+HBITMAP16 OBM_LoadBitmap( WORD id )
 {
-    HBITMAP hbitmap;
+    HBITMAP16 hbitmap;
 
     if ((id < OBM_FIRST) || (id > OBM_LAST)) return 0;
     id -= OBM_FIRST;
@@ -401,12 +401,12 @@
 /***********************************************************************
  *           OBM_LoadCursorIcon
  */
-HANDLE OBM_LoadCursorIcon( WORD id, BOOL fCursor )
+HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
 {
-    HANDLE handle;
+    HGLOBAL16 handle;
     CURSORICONINFO *pInfo;
     BITMAPOBJ *bmpXor, *bmpAnd;
-    HBITMAP hXorBits, hAndBits;
+    HBITMAP16 hXorBits, hAndBits;
     POINT16 hotspot;
     int sizeXor, sizeAnd;
 
diff --git a/objects/region.c b/objects/region.c
index 0b43fb9..a5e5cd6 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -424,6 +424,35 @@
 }
 
 /***********************************************************************
+ *           REGION_UnionRectWithRgn
+ *
+ * Add rectangle to region
+ */
+BOOL16 REGION_UnionRectWithRgn( HRGN32 hRgn, LPRECT16 rc )
+{
+  RGNOBJ 	*rgnObj = (RGNOBJ*) GDI_GetObjPtr( hRgn, REGION_MAGIC );
+  XRectangle     rect = { rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top };
+  BOOL16	 ret = 0; 
+
+  if( rgnObj )
+  {
+    if( !rgnObj->xrgn )
+    {
+      if (!(rgnObj->xrgn = XCreateRegion()))
+      {
+         GDI_FreeObject( hRgn );
+         return 0;
+      }
+      ret = SIMPLEREGION; 
+    }
+    else
+      ret = COMPLEXREGION;
+    XUnionRectWithRegion( &rect, rgnObj->xrgn, rgnObj->xrgn );
+  }
+  return ret;
+}
+
+/***********************************************************************
  *           REGION_CreateFrameRgn
  *
  * Create a region that is a frame around another region