Implemented some of gdi region functions.
authorEugene Ingerman <geneing@myrealbox.com>
Thu, 18 Jul 2002 21:59:18 +0000 (21:59 +0000)
committerEugene Ingerman <geneing@myrealbox.com>
Thu, 18 Jul 2002 21:59:18 +0000 (21:59 +0000)
svn path=/trunk/; revision=3262

reactos/include/structs.h
reactos/include/win32k/cliprgn.h
reactos/include/win32k/float.h
reactos/include/win32k/region.h
reactos/subsys/win32k/misc/math.c
reactos/subsys/win32k/ntuser/painting.c
reactos/subsys/win32k/objects/cliprgn.c
reactos/subsys/win32k/objects/gdiobj.c
reactos/subsys/win32k/objects/region.c
reactos/subsys/win32k/stubs/stubs.c

index 642d406..ef379fe 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    Structures.h
 
    Declarations for all the Windows32 API Structures
@@ -7,14 +7,14 @@
 
    Author:  Scott Christley <scottc@net-community.com>
    Date: 1996
-   
+
    This file is part of the Windows32 API Library.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
-   
+
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
    If you are interested in a warranty or support for this source code,
    contact Scott Christley <scottc@net-community.com> for more information.
-   
+
    You should have received a copy of the GNU Library General Public
    License along with this library; see the file COPYING.LIB.
-   If not, write to the Free Software Foundation, 
+   If not, write to the Free Software Foundation,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/ 
+*/
 
 
 #ifndef _GNU_H_WINDOWS32_STRUCTURES
@@ -58,109 +58,109 @@ typedef struct _VALENT
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
-   
+
 typedef struct _ABC {
-  int     abcA; 
-  UINT    abcB; 
-  int     abcC; 
-} ABC, *LPABC; 
+  int     abcA;
+  UINT    abcB;
+  int     abcC;
+} ABC, *LPABC;
 
 typedef struct _ABCFLOAT {
-  FLOAT   abcfA; 
-  FLOAT   abcfB; 
-  FLOAT   abcfC; 
-} ABCFLOAT, *LPABCFLOAT; 
+  FLOAT   abcfA;
+  FLOAT   abcfB;
+  FLOAT   abcfC;
+} ABCFLOAT, *LPABCFLOAT;
 
 typedef struct tagACCEL {
-  BYTE   fVirt; 
-  WORD   key; 
-  WORD   cmd; 
-} ACCEL, *LPACCEL;  
+  BYTE   fVirt;
+  WORD   key;
+  WORD   cmd;
+} ACCEL, *LPACCEL;
 
 typedef struct tagACCESSTIMEOUT {
-  UINT  cbSize; 
-  DWORD dwFlags; 
-  DWORD iTimeOutMSec; 
-} ACCESSTIMEOUT; 
+  UINT  cbSize;
+  DWORD dwFlags;
+  DWORD iTimeOutMSec;
+} ACCESSTIMEOUT;
 
-typedef struct _ACL_REVISION_INFORMATION {    
-  DWORD   AclRevision; 
-} ACL_REVISION_INFORMATION; 
+typedef struct _ACL_REVISION_INFORMATION {
+  DWORD   AclRevision;
+} ACL_REVISION_INFORMATION;
 
 typedef struct _ACL_SIZE_INFORMATION {
-  DWORD   AceCount; 
-  DWORD   AclBytesInUse; 
-  DWORD   AclBytesFree; 
-} ACL_SIZE_INFORMATION; 
+  DWORD   AceCount;
+  DWORD   AclBytesInUse;
+  DWORD   AclBytesFree;
+} ACL_SIZE_INFORMATION;
 
 typedef struct _ACTION_HEADER {
-  ULONG   transport_id; 
-  USHORT  action_code; 
-  USHORT  reserved; 
-} ACTION_HEADER; 
+  ULONG   transport_id;
+  USHORT  action_code;
+  USHORT  reserved;
+} ACTION_HEADER;
 
 typedef struct _ADAPTER_STATUS {
-  UCHAR   adapter_address[6]; 
-  UCHAR   rev_major; 
-  UCHAR   reserved0; 
-  UCHAR   adapter_type; 
-  UCHAR   rev_minor; 
-  WORD    duration; 
-  WORD    frmr_recv; 
-  WORD    frmr_xmit; 
-  WORD    iframe_recv_err; 
-  WORD    xmit_aborts; 
-  DWORD   xmit_success; 
-  DWORD   recv_success; 
-  WORD    iframe_xmit_err; 
-  WORD    recv_buff_unavail; 
-  WORD    t1_timeouts; 
-  WORD    ti_timeouts; 
-  DWORD   reserved1; 
-  WORD    free_ncbs; 
-  WORD    max_cfg_ncbs; 
-  WORD    max_ncbs; 
-  WORD    xmit_buf_unavail; 
-  WORD    max_dgram_size; 
-  WORD    pending_sess; 
-  WORD    max_cfg_sess; 
-  WORD    max_sess; 
-  WORD    max_sess_pkt_size; 
-  WORD    name_count; 
-} ADAPTER_STATUS; 
+  UCHAR   adapter_address[6];
+  UCHAR   rev_major;
+  UCHAR   reserved0;
+  UCHAR   adapter_type;
+  UCHAR   rev_minor;
+  WORD    duration;
+  WORD    frmr_recv;
+  WORD    frmr_xmit;
+  WORD    iframe_recv_err;
+  WORD    xmit_aborts;
+  DWORD   xmit_success;
+  DWORD   recv_success;
+  WORD    iframe_xmit_err;
+  WORD    recv_buff_unavail;
+  WORD    t1_timeouts;
+  WORD    ti_timeouts;
+  DWORD   reserved1;
+  WORD    free_ncbs;
+  WORD    max_cfg_ncbs;
+  WORD    max_ncbs;
+  WORD    xmit_buf_unavail;
+  WORD    max_dgram_size;
+  WORD    pending_sess;
+  WORD    max_cfg_sess;
+  WORD    max_sess;
+  WORD    max_sess_pkt_size;
+  WORD    name_count;
+} ADAPTER_STATUS;
 
 typedef struct _ADDJOB_INFO_1 {
-  LPTSTR  Path; 
-  DWORD   JobId; 
-} ADDJOB_INFO_1; 
+  LPTSTR  Path;
+  DWORD   JobId;
+} ADDJOB_INFO_1;
+
+typedef struct tagANIMATIONINFO {
+  UINT cbSize;
+  int  iMinAnimate;
+} ANIMATIONINFO, *LPANIMATIONINFO;
+
+typedef struct _RECT {
+  LONG left;
+  LONG top;
+  LONG right;
+  LONG bottom;
+} RECT, *LPRECT, *LPCRECT, *PRECT;
+
+typedef struct _RECTL {
+  LONG left;
+  LONG top;
+  LONG right;
+  LONG bottom;
+} RECTL, *LPRECTL, *LPCRECTL, *PRECTL;
 
-typedef struct tagANIMATIONINFO { 
-  UINT cbSize; 
-  int  iMinAnimate; 
-} ANIMATIONINFO, *LPANIMATIONINFO; 
-
-typedef struct _RECT {  
-  LONG left;       
-  LONG top;        
-  LONG right;      
-  LONG bottom;     
-} RECT, *LPRECT, *LPCRECT, *PRECT; 
-typedef struct _RECTL { 
-  LONG left;     
-  LONG top;      
-  LONG right;    
-  LONG bottom;   
-} RECTL, *LPRECTL, *LPCRECTL, *PRECTL; 
 typedef struct _AppBarData {
-  DWORD  cbSize;           
-  HWND   hWnd;             
-  UINT   uCallbackMessage; 
-  UINT   uEdge;            
-  RECT   rc;               
-  LPARAM lParam;           
-} APPBARDATA, *PAPPBARDATA; 
+  DWORD  cbSize;
+  HWND   hWnd;
+  UINT   uCallbackMessage;
+  UINT   uEdge;
+  RECT   rc;
+  LPARAM lParam;
+} APPBARDATA, *PAPPBARDATA;
 
 typedef struct tagBITMAP
 {
@@ -174,75 +174,75 @@ typedef struct tagBITMAP
 } BITMAP, *PBITMAP,   *NPBITMAP,   *LPBITMAP;
 
 typedef struct tagBITMAPCOREHEADER {
-  DWORD   bcSize; 
-  WORD    bcWidth; 
-  WORD    bcHeight; 
-  WORD    bcPlanes; 
-  WORD    bcBitCount; 
-} BITMAPCOREHEADER; 
-
-typedef struct tagRGBTRIPLE { 
-  BYTE rgbtBlue; 
-  BYTE rgbtGreen; 
-  BYTE rgbtRed; 
-} RGBTRIPLE, *PRGBTRIPLE; 
+  DWORD   bcSize;
+  WORD    bcWidth;
+  WORD    bcHeight;
+  WORD    bcPlanes;
+  WORD    bcBitCount;
+} BITMAPCOREHEADER;
+
+typedef struct tagRGBTRIPLE {
+  BYTE rgbtBlue;
+  BYTE rgbtGreen;
+  BYTE rgbtRed;
+} RGBTRIPLE, *PRGBTRIPLE;
+
 typedef struct _BITMAPCOREINFO {
-  BITMAPCOREHEADER  bmciHeader; 
-  RGBTRIPLE         bmciColors[1]; 
-} BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO; 
+  BITMAPCOREHEADER  bmciHeader;
+  RGBTRIPLE         bmciColors[1];
+} BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO;
 
 typedef struct tagBITMAPFILEHEADER {
-  WORD    bfType; 
-  DWORD   bfSize; 
-  WORD    bfReserved1; 
-  WORD    bfReserved2; 
-  DWORD   bfOffBits; 
+  WORD    bfType;
+  DWORD   bfSize;
+  WORD    bfReserved1;
+  WORD    bfReserved2;
+  DWORD   bfOffBits;
 } BITMAPFILEHEADER __attribute__((packed));
 
 typedef struct tagBITMAPINFOHEADER {
-  DWORD  biSize; 
-  LONG   biWidth; 
-  LONG   biHeight; 
-  WORD   biPlanes; 
-  WORD   biBitCount; 
-  DWORD  biCompression; 
-  DWORD  biSizeImage; 
-  LONG   biXPelsPerMeter; 
-  LONG   biYPelsPerMeter; 
-  DWORD  biClrUsed; 
-  DWORD  biClrImportant; 
+  DWORD  biSize;
+  LONG   biWidth;
+  LONG   biHeight;
+  WORD   biPlanes;
+  WORD   biBitCount;
+  DWORD  biCompression;
+  DWORD  biSizeImage;
+  LONG   biXPelsPerMeter;
+  LONG   biYPelsPerMeter;
+  DWORD  biClrUsed;
+  DWORD  biClrImportant;
 } BITMAPINFOHEADER, *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;
 
-typedef struct tagRGBQUAD { 
+typedef struct tagRGBQUAD {
   BYTE    rgbBlue;
-  BYTE    rgbGreen; 
-  BYTE    rgbRed; 
-  BYTE    rgbReserved; 
-} RGBQUAD; 
+  BYTE    rgbGreen;
+  BYTE    rgbRed;
+  BYTE    rgbReserved;
+} RGBQUAD;
+
 typedef struct tagBITMAPINFO {
-  BITMAPINFOHEADER bmiHeader; 
-  RGBQUAD          bmiColors[1]; 
-} BITMAPINFO, *LPBITMAPINFO, *PBITMAPINFO; 
+  BITMAPINFOHEADER bmiHeader;
+  RGBQUAD          bmiColors[1];
+} BITMAPINFO, *LPBITMAPINFO, *PBITMAPINFO;
 
 typedef long FXPT2DOT30,  * LPFXPT2DOT30;
 
 typedef struct tagCIEXYZ
 {
-  FXPT2DOT30 ciexyzX; 
-  FXPT2DOT30 ciexyzY; 
-  FXPT2DOT30 ciexyzZ; 
+  FXPT2DOT30 ciexyzX;
+  FXPT2DOT30 ciexyzY;
+  FXPT2DOT30 ciexyzZ;
 } CIEXYZ;
-typedef CIEXYZ  * LPCIEXYZ; 
+typedef CIEXYZ  * LPCIEXYZ;
 
 typedef struct tagCIEXYZTRIPLE
 {
-  CIEXYZ  ciexyzRed; 
-  CIEXYZ  ciexyzGreen; 
-  CIEXYZ  ciexyzBlue; 
+  CIEXYZ  ciexyzRed;
+  CIEXYZ  ciexyzGreen;
+  CIEXYZ  ciexyzBlue;
 } CIEXYZTRIPLE;
-typedef CIEXYZTRIPLE  * LPCIEXYZTRIPLE; 
+typedef CIEXYZTRIPLE  * LPCIEXYZTRIPLE;
 
 typedef struct {
   DWORD        bV4Size;
@@ -265,329 +265,329 @@ typedef struct {
   DWORD        bV4GammaRed;
   DWORD        bV4GammaGreen;
   DWORD        bV4GammaBlue;
-} BITMAPV4HEADER,   *LPBITMAPV4HEADER, *PBITMAPV4HEADER; 
-
-typedef struct _BLOB { 
-  ULONG   cbSize; 
-  BYTE    *pBlobData; 
-} BLOB; 
-
-typedef struct _SHITEMID {       
-  USHORT cb;       
-  BYTE   abID[1];  
-} SHITEMID, * LPSHITEMID; 
-typedef const SHITEMID  * LPCSHITEMID; 
-typedef struct _ITEMIDLIST { 
-  SHITEMID mkid;  
-} ITEMIDLIST, * LPITEMIDLIST; 
-typedef const ITEMIDLIST * LPCITEMIDLIST; 
-typedef struct _browseinfo { 
-  HWND hwndOwner;          
-  LPCITEMIDLIST pidlRoot;  
-  LPSTR pszDisplayName;    
-  LPCSTR lpszTitle;        
-  UINT ulFlags;            
-  BFFCALLBACK lpfn;        
-  LPARAM lParam;           
-  int iImage;              
-} BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO; 
+} BITMAPV4HEADER,   *LPBITMAPV4HEADER, *PBITMAPV4HEADER;
+
+typedef struct _BLOB {
+  ULONG   cbSize;
+  BYTE    *pBlobData;
+} BLOB;
+
+typedef struct _SHITEMID {
+  USHORT cb;
+  BYTE   abID[1];
+} SHITEMID, * LPSHITEMID;
+typedef const SHITEMID  * LPCSHITEMID;
+
+typedef struct _ITEMIDLIST {
+  SHITEMID mkid;
+} ITEMIDLIST, * LPITEMIDLIST;
+typedef const ITEMIDLIST * LPCITEMIDLIST;
+
+typedef struct _browseinfo {
+  HWND hwndOwner;
+  LPCITEMIDLIST pidlRoot;
+  LPSTR pszDisplayName;
+  LPCSTR lpszTitle;
+  UINT ulFlags;
+  BFFCALLBACK lpfn;
+  LPARAM lParam;
+  int iImage;
+} BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;
 
 typedef struct _BY_HANDLE_FILE_INFORMATION {
-  DWORD    dwFileAttributes; 
-  FILETIME ftCreationTime; 
-  FILETIME ftLastAccessTime; 
-  FILETIME ftLastWriteTime; 
-  DWORD    dwVolumeSerialNumber; 
-  DWORD    nFileSizeHigh; 
-  DWORD    nFileSizeLow; 
-  DWORD    nNumberOfLinks; 
-  DWORD    nFileIndexHigh; 
-  DWORD    nFileIndexLow; 
-} BY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION; 
-
-typedef struct _FIXED { 
-  WORD  fract; 
-  short value; 
-} FIXED; 
-typedef struct tagPOINT { 
-  LONG x; 
-  LONG y; 
+  DWORD    dwFileAttributes;
+  FILETIME ftCreationTime;
+  FILETIME ftLastAccessTime;
+  FILETIME ftLastWriteTime;
+  DWORD    dwVolumeSerialNumber;
+  DWORD    nFileSizeHigh;
+  DWORD    nFileSizeLow;
+  DWORD    nNumberOfLinks;
+  DWORD    nFileIndexHigh;
+  DWORD    nFileIndexLow;
+} BY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION;
+
+typedef struct _FIXED {
+  WORD  fract;
+  short value;
+} FIXED;
+
+typedef struct tagPOINT {
+  LONG x;
+  LONG y;
 } POINT, *LPPOINT, *PPOINT;
-typedef struct tagPOINTFX { 
-  FIXED x; 
-  FIXED y; 
-} POINTFX; 
-typedef struct _POINTL { 
-  LONG x; 
-  LONG y; 
-} POINTL, *PPOINTL; 
-typedef struct tagPOINTS { 
-  SHORT x;    
-  SHORT y;    
-} POINTS; 
+
+typedef struct tagPOINTFX {
+  FIXED x;
+  FIXED y;
+} POINTFX;
+
+typedef struct _POINTL {
+  LONG x;
+  LONG y;
+} POINTL, *PPOINTL;
+
+typedef struct tagPOINTS {
+  SHORT x;
+  SHORT y;
+} POINTS;
+
 typedef struct _tagCANDIDATEFORM {
-  DWORD  dwIndex;       
-  DWORD  dwStyle;       
-  POINT  ptCurrentPos;  
-  RECT   rcArea;        
+  DWORD  dwIndex;
+  DWORD  dwStyle;
+  POINT  ptCurrentPos;
+  RECT   rcArea;
 } CANDIDATEFORM, *LPCANDIDATEFORM;
 
 typedef struct _tagCANDIDATELIST {
-  DWORD  dwSize;       
-  DWORD  dwStyle;      
-  DWORD  dwCount;      
-  DWORD  dwSelection;  
-  DWORD  dwPageStart;  
-  DWORD  dwPageSize;   
+  DWORD  dwSize;
+  DWORD  dwStyle;
+  DWORD  dwCount;
+  DWORD  dwSelection;
+  DWORD  dwPageStart;
+  DWORD  dwPageSize;
   DWORD  dwOffset[1];
 } CANDIDATELIST, *LPCANDIDATELIST;
 
-typedef struct tagCREATESTRUCT { 
-  LPVOID    lpCreateParams;  
-  HINSTANCE hInstance;       
-  HMENU     hMenu;           
-  HWND      hwndParent;      
-  int       cy;              
-  int       cx;              
-  int       y;               
-  int       x;               
-  LONG      style;           
-  LPCTSTR   lpszName;        
-  LPCTSTR   lpszClass;       
-  DWORD     dwExStyle;       
-} CREATESTRUCT, *LPCREATESTRUCT; 
-typedef struct tagCREATESTRUCTA { 
-  LPVOID    lpCreateParams;  
-  HINSTANCE hInstance;       
-  HMENU     hMenu;           
-  HWND      hwndParent;      
-  int       cy;              
-  int       cx;              
-  int       y;               
-  int       x;               
-  LONG      style;           
-  LPCSTR   lpszName;        
-  LPCSTR   lpszClass;       
-  DWORD     dwExStyle;       
-} CREATESTRUCTA, *LPCREATESTRUCTA; 
-
-typedef struct tagCREATESTRUCTW { 
-  LPVOID    lpCreateParams;  
-  HINSTANCE hInstance;       
-  HMENU     hMenu;           
-  HWND      hwndParent;      
-  int       cy;              
-  int       cx;              
-  int       y;               
-  int       x;               
-  LONG      style;           
-  LPCWSTR   lpszName;        
-  LPCWSTR   lpszClass;       
-  DWORD     dwExStyle;       
-} CREATESTRUCTW, *LPCREATESTRUCTW; 
+typedef struct tagCREATESTRUCT {
+  LPVOID    lpCreateParams;
+  HINSTANCE hInstance;
+  HMENU     hMenu;
+  HWND      hwndParent;
+  int       cy;
+  int       cx;
+  int       y;
+  int       x;
+  LONG      style;
+  LPCTSTR   lpszName;
+  LPCTSTR   lpszClass;
+  DWORD     dwExStyle;
+} CREATESTRUCT, *LPCREATESTRUCT;
+
+typedef struct tagCREATESTRUCTA {
+  LPVOID    lpCreateParams;
+  HINSTANCE hInstance;
+  HMENU     hMenu;
+  HWND      hwndParent;
+  int       cy;
+  int       cx;
+  int       y;
+  int       x;
+  LONG      style;
+  LPCSTR   lpszName;
+  LPCSTR   lpszClass;
+  DWORD     dwExStyle;
+} CREATESTRUCTA, *LPCREATESTRUCTA;
+
+typedef struct tagCREATESTRUCTW {
+  LPVOID    lpCreateParams;
+  HINSTANCE hInstance;
+  HMENU     hMenu;
+  HWND      hwndParent;
+  int       cy;
+  int       cx;
+  int       y;
+  int       x;
+  LONG      style;
+  LPCWSTR   lpszName;
+  LPCWSTR   lpszClass;
+  DWORD     dwExStyle;
+} CREATESTRUCTW, *LPCREATESTRUCTW;
 
 typedef struct tagCBT_CREATEWND {
-  LPCREATESTRUCT lpcs; 
-  HWND           hwndInsertAfter; 
-} CBT_CREATEWND; 
+  LPCREATESTRUCT lpcs;
+  HWND           hwndInsertAfter;
+} CBT_CREATEWND;
 
 typedef struct tagCBTACTIVATESTRUCT {
-  WINBOOL fMouse; 
-  HWND hWndActive; 
-} CBTACTIVATESTRUCT; 
+  WINBOOL fMouse;
+  HWND hWndActive;
+} CBTACTIVATESTRUCT;
 
 typedef struct _CHAR_INFO {
-  union {               
-    WCHAR UnicodeChar; 
-    CHAR AsciiChar; 
-  } Char; 
-  WORD Attributes;      
-} CHAR_INFO, *PCHAR_INFO; 
-
-typedef struct _charformat { 
-  UINT     cbSize; 
-  DWORD    dwMask; 
-  DWORD    dwEffects; 
-  LONG     yHeight; 
-  LONG     yOffset; 
-  COLORREF crTextColor; 
-  BYTE     bCharSet; 
-  BYTE     bPitchAndFamily; 
-  TCHAR    szFaceName[LF_FACESIZE]; 
-} CHARFORMAT; 
-
-typedef struct _charrange { 
-  LONG cpMin; 
-  LONG cpMax; 
-} CHARRANGE; 
+  union {
+    WCHAR UnicodeChar;
+    CHAR AsciiChar;
+  } Char;
+  WORD Attributes;
+} CHAR_INFO, *PCHAR_INFO;
+
+typedef struct _charformat {
+  UINT     cbSize;
+  DWORD    dwMask;
+  DWORD    dwEffects;
+  LONG     yHeight;
+  LONG     yOffset;
+  COLORREF crTextColor;
+  BYTE     bCharSet;
+  BYTE     bPitchAndFamily;
+  TCHAR    szFaceName[LF_FACESIZE];
+} CHARFORMAT;
+
+typedef struct _charrange {
+  LONG cpMin;
+  LONG cpMax;
+} CHARRANGE;
 
 typedef struct tagCHARSET {
-  DWORD aflBlock[3]; 
-  DWORD flLang; 
-} CHARSET; 
+  DWORD aflBlock[3];
+  DWORD flLang;
+} CHARSET;
 
 typedef struct tagFONTSIGNATURE {
   DWORD  fsUsb[4];
   DWORD  fsCsb[2];
-} FONTSIGNATURE, *LPFONTSIGNATURE; 
+} FONTSIGNATURE, *LPFONTSIGNATURE;
+
 typedef struct {
   UINT ciCharset;
   UINT ciACP;
   FONTSIGNATURE fs;
 } CHARSETINFO, *LPCHARSETINFO;
 
-typedef struct { 
-  DWORD        lStructSize; 
-  HWND         hwndOwner; 
-  HWND         hInstance; 
-  COLORREF     rgbResult; 
-  COLORREF*    lpCustColors; 
-  DWORD        Flags; 
-  LPARAM       lCustData; 
-  LPCCHOOKPROC lpfnHook; 
-  LPCTSTR      lpTemplateName; 
-} CHOOSECOLOR, *LPCHOOSECOLOR; 
-
-typedef struct tagLOGFONT { 
-  LONG lfHeight; 
-  LONG lfWidth; 
-  LONG lfEscapement; 
-  LONG lfOrientation; 
-  LONG lfWeight; 
-  BYTE lfItalic; 
-  BYTE lfUnderline; 
-  BYTE lfStrikeOut; 
-  BYTE lfCharSet; 
-  BYTE lfOutPrecision; 
-  BYTE lfClipPrecision; 
-  BYTE lfQuality; 
-  BYTE lfPitchAndFamily; 
-  TCHAR lfFaceName[LF_FACESIZE]; 
-} LOGFONT, *LPLOGFONT, *PLOGFONT; 
-
-typedef struct tagLOGFONTW { 
-  LONG lfHeight; 
-  LONG lfWidth; 
-  LONG lfEscapement; 
-  LONG lfOrientation; 
-  LONG lfWeight; 
-  BYTE lfItalic; 
-  BYTE lfUnderline; 
-  BYTE lfStrikeOut; 
-  BYTE lfCharSet; 
-  BYTE lfOutPrecision; 
-  BYTE lfClipPrecision; 
-  BYTE lfQuality; 
-  BYTE lfPitchAndFamily; 
-  LPWSTR lfFaceName; 
+typedef struct {
+  DWORD        lStructSize;
+  HWND         hwndOwner;
+  HWND         hInstance;
+  COLORREF     rgbResult;
+  COLORREF*    lpCustColors;
+  DWORD        Flags;
+  LPARAM       lCustData;
+  LPCCHOOKPROC lpfnHook;
+  LPCTSTR      lpTemplateName;
+} CHOOSECOLOR, *LPCHOOSECOLOR;
+
+typedef struct tagLOGFONT {
+  LONG lfHeight;
+  LONG lfWidth;
+  LONG lfEscapement;
+  LONG lfOrientation;
+  LONG lfWeight;
+  BYTE lfItalic;
+  BYTE lfUnderline;
+  BYTE lfStrikeOut;
+  BYTE lfCharSet;
+  BYTE lfOutPrecision;
+  BYTE lfClipPrecision;
+  BYTE lfQuality;
+  BYTE lfPitchAndFamily;
+  TCHAR lfFaceName[LF_FACESIZE];
+} LOGFONT, *LPLOGFONT, *PLOGFONT;
+
+typedef struct tagLOGFONTW {
+  LONG lfHeight;
+  LONG lfWidth;
+  LONG lfEscapement;
+  LONG lfOrientation;
+  LONG lfWeight;
+  BYTE lfItalic;
+  BYTE lfUnderline;
+  BYTE lfStrikeOut;
+  BYTE lfCharSet;
+  BYTE lfOutPrecision;
+  BYTE lfClipPrecision;
+  BYTE lfQuality;
+  BYTE lfPitchAndFamily;
+  LPWSTR lfFaceName;
 } LOGFONTW, *LPLOGFONTW, *PLOGFONTW;
 
-typedef struct { 
-  DWORD        lStructSize; 
-  HWND         hwndOwner; 
-  HDC          hDC; 
-  LPLOGFONT    lpLogFont; 
-  INT          iPointSize; 
-  DWORD        Flags; 
-  DWORD        rgbColors; 
-  LPARAM       lCustData; 
-  LPCFHOOKPROC lpfnHook; 
-  LPCTSTR      lpTemplateName; 
-  HINSTANCE    hInstance; 
-  LPTSTR       lpszStyle; 
-  WORD         nFontType; 
-  WORD         ___MISSING_ALIGNMENT__; 
-  INT          nSizeMin; 
-  INT          nSizeMax; 
-} CHOOSEFONT, *LPCHOOSEFONT; 
-
-typedef struct _IDA { 
-  UINT cidl;     
-  UINT aoffset[1]; 
-} CIDA, * LPIDA; 
+typedef struct {
+  DWORD        lStructSize;
+  HWND         hwndOwner;
+  HDC          hDC;
+  LPLOGFONT    lpLogFont;
+  INT          iPointSize;
+  DWORD        Flags;
+  DWORD        rgbColors;
+  LPARAM       lCustData;
+  LPCFHOOKPROC lpfnHook;
+  LPCTSTR      lpTemplateName;
+  HINSTANCE    hInstance;
+  LPTSTR       lpszStyle;
+  WORD         nFontType;
+  WORD         ___MISSING_ALIGNMENT__;
+  INT          nSizeMin;
+  INT          nSizeMax;
+} CHOOSEFONT, *LPCHOOSEFONT;
+
+typedef struct _IDA {
+  UINT cidl;
+  UINT aoffset[1];
+} CIDA, * LPIDA;
 
 typedef struct tagCLIENTCREATESTRUCT {
-  HANDLE hWindowMenu; 
-  UINT   idFirstChild; 
-} CLIENTCREATESTRUCT; 
+  HANDLE hWindowMenu;
+  UINT   idFirstChild;
+} CLIENTCREATESTRUCT;
 
 typedef CLIENTCREATESTRUCT *LPCLIENTCREATESTRUCT;
 
-typedef struct _CMInvokeCommandInfo { 
-  DWORD cbSize;       
-  DWORD fMask;        
-  HWND hwnd;          
-  LPCSTR lpVerb;      
+typedef struct _CMInvokeCommandInfo {
+  DWORD cbSize;
+  DWORD fMask;
+  HWND hwnd;
+  LPCSTR lpVerb;
   LPCSTR lpParameters;
-  LPCSTR lpDirectory; 
-  int nShow;          
-  DWORD dwHotKey;     
-  HANDLE hIcon;       
-} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO; 
+  LPCSTR lpDirectory;
+  int nShow;
+  DWORD dwHotKey;
+  HANDLE hIcon;
+} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO;
 
 typedef struct  tagCOLORADJUSTMENT {
-  WORD  caSize; 
-  WORD  caFlags; 
-  WORD  caIlluminantIndex; 
-  WORD  caRedGamma; 
-  WORD  caGreenGamma; 
-  WORD  caBlueGamma; 
-  WORD  caReferenceBlack; 
-  WORD  caReferenceWhite; 
-  SHORT caContrast; 
-  SHORT caBrightness; 
-  SHORT caColorfulness; 
-  SHORT caRedGreenTint; 
-} COLORADJUSTMENT, *LPCOLORADJUSTMENT; 
-
-typedef struct _COLORMAP { 
-  COLORREF from; 
-  COLORREF to; 
-} COLORMAP,  * LPCOLORMAP; 
-
-typedef struct _DCB { 
-  DWORD DCBlength;          
-  DWORD BaudRate;           
-  DWORD fBinary: 1;         
-  DWORD fParity: 1;         
-  DWORD fOutxCtsFlow:1;     
-  DWORD fOutxDsrFlow:1;     
-  DWORD fDtrControl:2;      
-  DWORD fDsrSensitivity:1;  
+  WORD  caSize;
+  WORD  caFlags;
+  WORD  caIlluminantIndex;
+  WORD  caRedGamma;
+  WORD  caGreenGamma;
+  WORD  caBlueGamma;
+  WORD  caReferenceBlack;
+  WORD  caReferenceWhite;
+  SHORT caContrast;
+  SHORT caBrightness;
+  SHORT caColorfulness;
+  SHORT caRedGreenTint;
+} COLORADJUSTMENT, *LPCOLORADJUSTMENT;
+
+typedef struct _COLORMAP {
+  COLORREF from;
+  COLORREF to;
+} COLORMAP,  * LPCOLORMAP;
+
+typedef struct _DCB {
+  DWORD DCBlength;
+  DWORD BaudRate;
+  DWORD fBinary: 1;
+  DWORD fParity: 1;
+  DWORD fOutxCtsFlow:1;
+  DWORD fOutxDsrFlow:1;
+  DWORD fDtrControl:2;
+  DWORD fDsrSensitivity:1;
   DWORD fTXContinueOnXoff:1;
-  DWORD fOutX: 1;        
-  DWORD fInX: 1;         
-  DWORD fErrorChar: 1;   
-  DWORD fNull: 1;        
-  DWORD fRtsControl:2;   
-  DWORD fAbortOnError:1; 
-  DWORD fDummy2:17;      
-  WORD wReserved;        
-  WORD XonLim;           
-  WORD XoffLim;          
-  BYTE ByteSize;         
-  BYTE Parity;           
-  BYTE StopBits;         
-  char XonChar;          
-  char XoffChar;         
-  char ErrorChar;        
-  char EofChar;          
-  char EvtChar;          
-  WORD wReserved1;       
-} DCB, *LPDCB; 
+  DWORD fOutX: 1;
+  DWORD fInX: 1;
+  DWORD fErrorChar: 1;
+  DWORD fNull: 1;
+  DWORD fRtsControl:2;
+  DWORD fAbortOnError:1;
+  DWORD fDummy2:17;
+  WORD wReserved;
+  WORD XonLim;
+  WORD XoffLim;
+  BYTE ByteSize;
+  BYTE Parity;
+  BYTE StopBits;
+  char XonChar;
+  char XoffChar;
+  char ErrorChar;
+  char EofChar;
+  char EvtChar;
+  WORD wReserved1;
+} DCB, *LPDCB;
+
 typedef struct _COMM_CONFIG {
   DWORD dwSize;
-  WORD  wVersion; 
+  WORD  wVersion;
   WORD  wReserved;
   DCB   dcb;
   DWORD dwProviderSubType;
@@ -597,138 +597,138 @@ typedef struct _COMM_CONFIG {
 } COMMCONFIG, *LPCOMMCONFIG;
 
 typedef struct _COMMPROP {
-  WORD  wPacketLength;       
-  WORD  wPacketVersion;      
-  DWORD dwServiceMask;       
-  DWORD dwReserved1;         
-  DWORD dwMaxTxQueue;        
-  DWORD dwMaxRxQueue;        
-  DWORD dwMaxBaud;           
-  DWORD dwProvSubType;       
-  DWORD dwProvCapabilities;  
-  DWORD dwSettableParams;    
-  DWORD dwSettableBaud;      
-  WORD  wSettableData;       
-  WORD  wSettableStopParity; 
-  DWORD dwCurrentTxQueue;    
-  DWORD dwCurrentRxQueue;    
-  DWORD dwProvSpec1;         
-  DWORD dwProvSpec2;         
-  WCHAR wcProvChar[1];       
-} COMMPROP, *LPCOMMPROP; 
+  WORD  wPacketLength;
+  WORD  wPacketVersion;
+  DWORD dwServiceMask;
+  DWORD dwReserved1;
+  DWORD dwMaxTxQueue;
+  DWORD dwMaxRxQueue;
+  DWORD dwMaxBaud;
+  DWORD dwProvSubType;
+  DWORD dwProvCapabilities;
+  DWORD dwSettableParams;
+  DWORD dwSettableBaud;
+  WORD  wSettableData;
+  WORD  wSettableStopParity;
+  DWORD dwCurrentTxQueue;
+  DWORD dwCurrentRxQueue;
+  DWORD dwProvSpec1;
+  DWORD dwProvSpec2;
+  WCHAR wcProvChar[1];
+} COMMPROP, *LPCOMMPROP;
 
 typedef struct _COMMTIMEOUTS {
-  DWORD ReadIntervalTimeout; 
-  DWORD ReadTotalTimeoutMultiplier; 
-  DWORD ReadTotalTimeoutConstant; 
-  DWORD WriteTotalTimeoutMultiplier; 
-  DWORD WriteTotalTimeoutConstant; 
-} COMMTIMEOUTS,*LPCOMMTIMEOUTS; 
+  DWORD ReadIntervalTimeout;
+  DWORD ReadTotalTimeoutMultiplier;
+  DWORD ReadTotalTimeoutConstant;
+  DWORD WriteTotalTimeoutMultiplier;
+  DWORD WriteTotalTimeoutConstant;
+} COMMTIMEOUTS,*LPCOMMTIMEOUTS;
 
 typedef struct tagCOMPAREITEMSTRUCT {
-  UINT  CtlType; 
-  UINT  CtlID; 
-  HWND  hwndItem; 
-  UINT  itemID1; 
-  DWORD itemData1; 
-  UINT  itemID2; 
-  DWORD itemData2; 
-} COMPAREITEMSTRUCT; 
+  UINT  CtlType;
+  UINT  CtlID;
+  HWND  hwndItem;
+  UINT  itemID1;
+  DWORD itemData1;
+  UINT  itemID2;
+  DWORD itemData2;
+} COMPAREITEMSTRUCT;
 
 typedef struct {
-  COLORREF crText;        
-  COLORREF crBackground;  
-  DWORD dwEffects;        
+  COLORREF crText;
+  COLORREF crBackground;
+  DWORD dwEffects;
 } COMPCOLOR;
 
 typedef struct _tagCOMPOSITIONFORM {
-  DWORD  dwStyle;       
-  POINT  ptCurrentPos;  
-  RECT   rcArea;        
+  DWORD  dwStyle;
+  POINT  ptCurrentPos;
+  RECT   rcArea;
 } COMPOSITIONFORM, *LPCOMPOSITIONFORM;
 
 typedef struct _COMSTAT {
-  DWORD fCtsHold : 1;   
-  DWORD fDsrHold : 1;   
-  DWORD fRlsdHold : 1;  
-  DWORD fXoffHold : 1;  
-  DWORD fXoffSent : 1;  
-  DWORD fEof : 1;       
-  DWORD fTxim : 1;      
-  DWORD fReserved : 25; 
-  DWORD cbInQue;        
-  DWORD cbOutQue;       
-} COMSTAT, *LPCOMSTAT; 
-typedef struct tagCONVCONTEXT { 
-  UINT  cb; 
-  UINT  wFlags; 
-  UINT  wCountryID; 
-  int   iCodePage; 
-  DWORD dwLangID; 
-  DWORD dwSecurity; 
+  DWORD fCtsHold : 1;
+  DWORD fDsrHold : 1;
+  DWORD fRlsdHold : 1;
+  DWORD fXoffHold : 1;
+  DWORD fXoffSent : 1;
+  DWORD fEof : 1;
+  DWORD fTxim : 1;
+  DWORD fReserved : 25;
+  DWORD cbInQue;
+  DWORD cbOutQue;
+} COMSTAT, *LPCOMSTAT;
+
+typedef struct tagCONVCONTEXT {
+  UINT  cb;
+  UINT  wFlags;
+  UINT  wCountryID;
+  int   iCodePage;
+  DWORD dwLangID;
+  DWORD dwSecurity;
   SECURITY_QUALITY_OF_SERVICE qos;
-} CONVCONTEXT; 
+} CONVCONTEXT;
 
 typedef CONVCONTEXT *PCONVCONTEXT;
 
-typedef struct tagCONVINFO { 
-  DWORD       cb; 
-  DWORD       hUser; 
-  HCONV       hConvPartner; 
-  HSZ         hszSvcPartner; 
-  HSZ         hszServiceReq; 
-  HSZ         hszTopic; 
-  HSZ         hszItem; 
-  UINT        wFmt; 
-  UINT        wType; 
-  UINT        wStatus; 
-  UINT        wConvst; 
-  UINT        wLastError; 
-  HCONVLIST   hConvList; 
-  CONVCONTEXT ConvCtxt; 
-  HWND        hwnd; 
-  HWND        hwndPartner; 
+typedef struct tagCONVINFO {
+  DWORD       cb;
+  DWORD       hUser;
+  HCONV       hConvPartner;
+  HSZ         hszSvcPartner;
+  HSZ         hszServiceReq;
+  HSZ         hszTopic;
+  HSZ         hszItem;
+  UINT        wFmt;
+  UINT        wType;
+  UINT        wStatus;
+  UINT        wConvst;
+  UINT        wLastError;
+  HCONVLIST   hConvList;
+  CONVCONTEXT ConvCtxt;
+  HWND        hwnd;
+  HWND        hwndPartner;
 } CONVINFO, *PCONVINFO;
 
-typedef struct tagCOPYDATASTRUCT { 
-  DWORD dwData; 
-  DWORD cbData; 
-  PVOID lpData; 
-} COPYDATASTRUCT; 
-
-typedef struct _cpinfo { 
-  UINT MaxCharSize; 
-  BYTE DefaultChar[MAX_DEFAULTCHAR]; 
-  BYTE LeadByte[MAX_LEADBYTES]; 
-} CPINFO, *LPCPINFO; 
-
-typedef struct tagCPLINFO { 
-  int  idIcon; 
-  int  idName; 
-  int  idInfo; 
-  LONG lData; 
-} CPLINFO; 
+typedef struct tagCOPYDATASTRUCT {
+  DWORD dwData;
+  DWORD cbData;
+  PVOID lpData;
+} COPYDATASTRUCT;
+
+typedef struct _cpinfo {
+  UINT MaxCharSize;
+  BYTE DefaultChar[MAX_DEFAULTCHAR];
+  BYTE LeadByte[MAX_LEADBYTES];
+} CPINFO, *LPCPINFO;
+
+typedef struct tagCPLINFO {
+  int  idIcon;
+  int  idName;
+  int  idInfo;
+  LONG lData;
+} CPLINFO;
 
 typedef struct _CREATE_PROCESS_DEBUG_INFO {
-  HANDLE hFile; 
-  HANDLE hProcess; 
-  HANDLE hThread; 
-  LPVOID lpBaseOfImage; 
-  DWORD dwDebugInfoFileOffset; 
-  DWORD nDebugInfoSize; 
-  LPVOID lpThreadLocalBase; 
-  LPTHREAD_START_ROUTINE lpStartAddress; 
-  LPVOID lpImageName; 
-  WORD fUnicode; 
-} CREATE_PROCESS_DEBUG_INFO; 
+  HANDLE hFile;
+  HANDLE hProcess;
+  HANDLE hThread;
+  LPVOID lpBaseOfImage;
+  DWORD dwDebugInfoFileOffset;
+  DWORD nDebugInfoSize;
+  LPVOID lpThreadLocalBase;
+  LPTHREAD_START_ROUTINE lpStartAddress;
+  LPVOID lpImageName;
+  WORD fUnicode;
+} CREATE_PROCESS_DEBUG_INFO;
+
 typedef struct _CREATE_THREAD_DEBUG_INFO {
-  HANDLE hThread; 
-  LPVOID lpThreadLocalBase; 
-  LPTHREAD_START_ROUTINE lpStartAddress; 
-} CREATE_THREAD_DEBUG_INFO; 
+  HANDLE hThread;
+  LPVOID lpThreadLocalBase;
+  LPTHREAD_START_ROUTINE lpStartAddress;
+} CREATE_THREAD_DEBUG_INFO;
+
 /*
  TODO: sockets
 typedef struct _SOCKET_ADDRESS {
@@ -738,379 +738,379 @@ typedef struct _SOCKET_ADDRESS {
 */
 
 /*
-typedef struct _CSADDR_INFO { 
-  SOCKET_ADDRESS  LocalAddr; 
-  SOCKET_ADDRESS  RemoteAddr; 
-  INT             iSocketType; 
-  INT             iProtocol; 
-} CSADDR_INFO; 
+typedef struct _CSADDR_INFO {
+  SOCKET_ADDRESS  LocalAddr;
+  SOCKET_ADDRESS  RemoteAddr;
+  INT             iSocketType;
+  INT             iProtocol;
+} CSADDR_INFO;
 */
-typedef struct _currencyfmt { 
-  UINT      NumDigits; 
-  UINT      LeadingZero; 
-  UINT      Grouping; 
-  LPTSTR    lpDecimalSep; 
-  LPTSTR    lpThousandSep; 
-  UINT      NegativeOrder; 
-  UINT      PositiveOrder; 
+
+typedef struct _currencyfmt {
+  UINT      NumDigits;
+  UINT      LeadingZero;
+  UINT      Grouping;
+  LPTSTR    lpDecimalSep;
+  LPTSTR    lpThousandSep;
+  UINT      NegativeOrder;
+  UINT      PositiveOrder;
   LPTSTR    lpCurrencySymbol;
-} CURRENCYFMT; 
-typedef struct tagCURSORSHAPE {  
-  int     xHotSpot; 
-  int     yHotSpot; 
-  int     cx; 
-  int     cy; 
-  int     cbWidth; 
-  BYTE    Planes; 
-  BYTE    BitsPixel; 
-} CURSORSHAPE,   *LPCURSORSHAPE; 
+} CURRENCYFMT;
+
+typedef struct tagCURSORSHAPE {
+  int     xHotSpot;
+  int     yHotSpot;
+  int     cx;
+  int     cy;
+  int     cbWidth;
+  BYTE    Planes;
+  BYTE    BitsPixel;
+} CURSORSHAPE,   *LPCURSORSHAPE;
+
 typedef struct tagCWPRETSTRUCT {
-  LRESULT lResult; 
-  LPARAM  lParam; 
-  WPARAM  wParam; 
-  DWORD   message; 
-  HWND    hwnd; 
-} CWPRETSTRUCT; 
+  LRESULT lResult;
+  LPARAM  lParam;
+  WPARAM  wParam;
+  DWORD   message;
+  HWND    hwnd;
+} CWPRETSTRUCT;
 
 typedef struct tagCWPSTRUCT {
-  LPARAM  lParam; 
-  WPARAM  wParam; 
-  UINT    message; 
-  HWND    hwnd; 
-} CWPSTRUCT; 
-typedef struct _DATATYPES_INFO_1 { 
-  LPTSTR pName; 
-} DATATYPES_INFO_1; 
-typedef struct { 
-  unsigned short bAppReturnCode:8, 
-    reserved:6, 
-    fBusy:1, 
-    fAck:1; 
-} DDEACK; 
-typedef struct { 
-  unsigned short reserved:14, 
-    fDeferUpd:1, 
-    fAckReq:1; 
-  short cfFormat; 
-} DDEADVISE; 
-typedef struct { 
-  unsigned short unused:12, 
-    fResponse:1, 
-    fRelease:1, 
-    reserved:1, 
-    fAckReq:1; 
-  short cfFormat; 
-  BYTE  Value[1]; 
-} DDEDATA; 
-typedef struct { 
-  unsigned short unused:13, 
-    fRelease:1, 
-    fDeferUpd:1, 
-    fAckReq:1; 
-  short cfFormat; 
-} DDELN; 
-typedef struct tagDDEML_MSG_HOOK_DATA { 
-  UINT  uiLo; 
-  UINT  uiHi; 
-  DWORD cbData; 
-  DWORD Data[8]; 
-} DDEML_MSG_HOOK_DATA; 
-typedef struct { 
-  unsigned short unused:13, 
-    fRelease:1, 
-    fReserved:2; 
-  short cfFormat; 
-  BYTE  Value[1]; 
-} DDEPOKE; 
-typedef struct { 
-  unsigned short unused:12, 
-    fAck:1, 
-    fRelease:1, 
-    fReserved:1, 
-    fAckReq:1; 
-  short cfFormat; 
-  BYTE rgb[1]; 
-} DDEUP; 
+  LPARAM  lParam;
+  WPARAM  wParam;
+  UINT    message;
+  HWND    hwnd;
+} CWPSTRUCT;
+
+typedef struct _DATATYPES_INFO_1 {
+  LPTSTR pName;
+} DATATYPES_INFO_1;
+
+typedef struct {
+  unsigned short bAppReturnCode:8,
+    reserved:6,
+    fBusy:1,
+    fAck:1;
+} DDEACK;
+
+typedef struct {
+  unsigned short reserved:14,
+    fDeferUpd:1,
+    fAckReq:1;
+  short cfFormat;
+} DDEADVISE;
+
+typedef struct {
+  unsigned short unused:12,
+    fResponse:1,
+    fRelease:1,
+    reserved:1,
+    fAckReq:1;
+  short cfFormat;
+  BYTE  Value[1];
+} DDEDATA;
+
+typedef struct {
+  unsigned short unused:13,
+    fRelease:1,
+    fDeferUpd:1,
+    fAckReq:1;
+  short cfFormat;
+} DDELN;
+
+typedef struct tagDDEML_MSG_HOOK_DATA {
+  UINT  uiLo;
+  UINT  uiHi;
+  DWORD cbData;
+  DWORD Data[8];
+} DDEML_MSG_HOOK_DATA;
+
+typedef struct {
+  unsigned short unused:13,
+    fRelease:1,
+    fReserved:2;
+  short cfFormat;
+  BYTE  Value[1];
+} DDEPOKE;
+
+typedef struct {
+  unsigned short unused:12,
+    fAck:1,
+    fRelease:1,
+    fReserved:1,
+    fAckReq:1;
+  short cfFormat;
+  BYTE rgb[1];
+} DDEUP;
+
 typedef struct _EXCEPTION_DEBUG_INFO {
-  EXCEPTION_RECORD ExceptionRecord; 
-  DWORD dwFirstChance; 
-} EXCEPTION_DEBUG_INFO; 
-typedef struct _EXIT_PROCESS_DEBUG_INFO { 
-  DWORD dwExitCode; 
-} EXIT_PROCESS_DEBUG_INFO; 
-typedef struct _EXIT_THREAD_DEBUG_INFO { 
-  DWORD dwExitCode; 
-} EXIT_THREAD_DEBUG_INFO; 
-typedef struct _LOAD_DLL_DEBUG_INFO { 
-  HANDLE hFile; 
-  LPVOID lpBaseOfDll; 
-  DWORD  dwDebugInfoFileOffset; 
-  DWORD  nDebugInfoSize; 
-  LPVOID lpImageName; 
-  WORD fUnicode; 
-} LOAD_DLL_DEBUG_INFO; 
-typedef struct _UNLOAD_DLL_DEBUG_INFO { 
-  LPVOID lpBaseOfDll; 
-} UNLOAD_DLL_DEBUG_INFO; 
-typedef struct _OUTPUT_DEBUG_STRING_INFO { 
-  LPSTR lpDebugStringData; 
-  WORD  fUnicode; 
-  WORD  nDebugStringLength; 
-} OUTPUT_DEBUG_STRING_INFO; 
-typedef struct _RIP_INFO { 
-  DWORD  dwError; 
-  DWORD  dwType; 
-} RIP_INFO; 
-typedef struct _DEBUG_EVENT { 
-  DWORD dwDebugEventCode; 
-  DWORD dwProcessId; 
-  DWORD dwThreadId; 
-  union { 
-    EXCEPTION_DEBUG_INFO Exception; 
-    CREATE_THREAD_DEBUG_INFO CreateThread; 
-    CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; 
-    EXIT_THREAD_DEBUG_INFO ExitThread; 
-    EXIT_PROCESS_DEBUG_INFO ExitProcess; 
-    LOAD_DLL_DEBUG_INFO LoadDll; 
-    UNLOAD_DLL_DEBUG_INFO UnloadDll; 
-    OUTPUT_DEBUG_STRING_INFO DebugString; 
-    RIP_INFO RipInfo; 
-  } u; 
-} DEBUG_EVENT, *LPDEBUG_EVENT; 
+  EXCEPTION_RECORD ExceptionRecord;
+  DWORD dwFirstChance;
+} EXCEPTION_DEBUG_INFO;
+
+typedef struct _EXIT_PROCESS_DEBUG_INFO {
+  DWORD dwExitCode;
+} EXIT_PROCESS_DEBUG_INFO;
+
+typedef struct _EXIT_THREAD_DEBUG_INFO {
+  DWORD dwExitCode;
+} EXIT_THREAD_DEBUG_INFO;
+
+typedef struct _LOAD_DLL_DEBUG_INFO {
+  HANDLE hFile;
+  LPVOID lpBaseOfDll;
+  DWORD  dwDebugInfoFileOffset;
+  DWORD  nDebugInfoSize;
+  LPVOID lpImageName;
+  WORD fUnicode;
+} LOAD_DLL_DEBUG_INFO;
+
+typedef struct _UNLOAD_DLL_DEBUG_INFO {
+  LPVOID lpBaseOfDll;
+} UNLOAD_DLL_DEBUG_INFO;
+
+typedef struct _OUTPUT_DEBUG_STRING_INFO {
+  LPSTR lpDebugStringData;
+  WORD  fUnicode;
+  WORD  nDebugStringLength;
+} OUTPUT_DEBUG_STRING_INFO;
+
+typedef struct _RIP_INFO {
+  DWORD  dwError;
+  DWORD  dwType;
+} RIP_INFO;
+
+typedef struct _DEBUG_EVENT {
+  DWORD dwDebugEventCode;
+  DWORD dwProcessId;
+  DWORD dwThreadId;
+  union {
+    EXCEPTION_DEBUG_INFO Exception;
+    CREATE_THREAD_DEBUG_INFO CreateThread;
+    CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
+    EXIT_THREAD_DEBUG_INFO ExitThread;
+    EXIT_PROCESS_DEBUG_INFO ExitProcess;
+    LOAD_DLL_DEBUG_INFO LoadDll;
+    UNLOAD_DLL_DEBUG_INFO UnloadDll;
+    OUTPUT_DEBUG_STRING_INFO DebugString;
+    RIP_INFO RipInfo;
+  } u;
+} DEBUG_EVENT, *LPDEBUG_EVENT;
+
 typedef struct tagDEBUGHOOKINFO {
-  DWORD  idThread; 
-  DWORD  idThreadInstaller; 
-  LPARAM lParam; 
-  WPARAM wParam; 
-  int    code; 
-} DEBUGHOOKINFO; 
-typedef struct tagDELETEITEMSTRUCT { 
-  UINT CtlType; 
-  UINT CtlID; 
-  UINT itemID; 
-  HWND hwndItem; 
-  UINT itemData; 
-} DELETEITEMSTRUCT; 
+  DWORD  idThread;
+  DWORD  idThreadInstaller;
+  LPARAM lParam;
+  WPARAM wParam;
+  int    code;
+} DEBUGHOOKINFO;
+
+typedef struct tagDELETEITEMSTRUCT {
+  UINT CtlType;
+  UINT CtlID;
+  UINT itemID;
+  HWND hwndItem;
+  UINT itemData;
+} DELETEITEMSTRUCT;
+
 typedef struct _DEV_BROADCAST_HDR {
-  ULONG dbch_size; 
-  ULONG dbch_devicetype; 
-  ULONG dbch_reserved; 
+  ULONG dbch_size;
+  ULONG dbch_devicetype;
+  ULONG dbch_reserved;
 } DEV_BROADCAST_HDR;
 typedef DEV_BROADCAST_HDR *PDEV_BROADCAST_HDR;
+
 typedef struct _DEV_BROADCAST_OEM {
-  ULONG dbco_size; 
-  ULONG dbco_devicetype; 
-  ULONG dbco_reserved; 
-  ULONG dbco_identifier; 
-  ULONG dbco_suppfunc; 
+  ULONG dbco_size;
+  ULONG dbco_devicetype;
+  ULONG dbco_reserved;
+  ULONG dbco_identifier;
+  ULONG dbco_suppfunc;
 } DEV_BROADCAST_OEM;
 typedef DEV_BROADCAST_OEM *PDEV_BROADCAST_OEM;
+
 typedef struct _DEV_BROADCAST_PORT {
-  ULONG dbcp_size; 
-  ULONG dbcp_devicetype; 
-  ULONG dbcp_reserved; 
-  char dbcp_name[1]; 
+  ULONG dbcp_size;
+  ULONG dbcp_devicetype;
+  ULONG dbcp_reserved;
+  char dbcp_name[1];
 } DEV_BROADCAST_PORT;
 typedef DEV_BROADCAST_PORT *PDEV_BROADCAST_PORT;
-struct _DEV_BROADCAST_USERDEFINED { 
-  struct _DEV_BROADCAST_HDR dbud_dbh; 
+
+struct _DEV_BROADCAST_USERDEFINED {
+  struct _DEV_BROADCAST_HDR dbud_dbh;
   char  dbud_szName[1];
   BYTE  dbud_rgbUserDefined[1];
-}; 
+};
+
 typedef struct _DEV_BROADCAST_VOLUME {
-  ULONG dbcv_size; 
-  ULONG dbcv_devicetype; 
-  ULONG dbcv_reserved; 
-  ULONG dbcv_unitmask; 
-  USHORT dbcv_flags; 
+  ULONG dbcv_size;
+  ULONG dbcv_devicetype;
+  ULONG dbcv_reserved;
+  ULONG dbcv_unitmask;
+  USHORT dbcv_flags;
 } DEV_BROADCAST_VOLUME;
 typedef DEV_BROADCAST_VOLUME *PDEV_BROADCAST_VOLUME;
 
-typedef struct tagDEVNAMES { 
-  WORD wDriverOffset; 
-  WORD wDeviceOffset; 
-  WORD wOutputOffset; 
-  WORD wDefault; 
-} DEVNAMES, *LPDEVNAMES; 
-typedef struct tagDIBSECTION { 
-  BITMAP              dsBm; 
-  BITMAPINFOHEADER    dsBmih; 
-  DWORD               dsBitfields[3]; 
-  HANDLE              dshSection; 
-  DWORD               dsOffset; 
-} DIBSECTION; 
-   
-typedef struct _DISK_PERFORMANCE { 
-  LARGE_INTEGER BytesRead; 
-  LARGE_INTEGER BytesWritten; 
-  LARGE_INTEGER ReadTime; 
-  LARGE_INTEGER WriteTime; 
-  DWORD ReadCount; 
-  DWORD WriteCount; 
-  DWORD QueueDepth; 
-} DISK_PERFORMANCE ; 
-typedef struct { 
-  DWORD style; 
-  DWORD dwExtendedStyle; 
-  short x; 
-  short y; 
-  short cx; 
-  short cy; 
-  WORD  id; 
+typedef struct tagDEVNAMES {
+  WORD wDriverOffset;
+  WORD wDeviceOffset;
+  WORD wOutputOffset;
+  WORD wDefault;
+} DEVNAMES, *LPDEVNAMES;
+
+typedef struct tagDIBSECTION {
+  BITMAP              dsBm;
+  BITMAPINFOHEADER    dsBmih;
+  DWORD               dsBitfields[3];
+  HANDLE              dshSection;
+  DWORD               dsOffset;
+} DIBSECTION;
+
+typedef struct _DISK_PERFORMANCE {
+  LARGE_INTEGER BytesRead;
+  LARGE_INTEGER BytesWritten;
+  LARGE_INTEGER ReadTime;
+  LARGE_INTEGER WriteTime;
+  DWORD ReadCount;
+  DWORD WriteCount;
+  DWORD QueueDepth;
+} DISK_PERFORMANCE ;
+
+typedef struct {
+  DWORD style;
+  DWORD dwExtendedStyle;
+  short x;
+  short y;
+  short cx;
+  short cy;
+  WORD  id;
 } DLGITEMTEMPLATE PACKED;
 
 typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATE;
 typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATE;
-typedef struct { 
-  DWORD style; 
-  DWORD dwExtendedStyle; 
-  WORD  cdit; 
-  short x; 
-  short y; 
-  short cx; 
-  short cy; 
+
+typedef struct {
+  DWORD style;
+  DWORD dwExtendedStyle;
+  WORD  cdit;
+  short x;
+  short y;
+  short cx;
+  short cy;
 } DLGTEMPLATE PACKED;
 
-typedef DLGTEMPLATE *LPDLGTEMPLATE; 
+typedef DLGTEMPLATE *LPDLGTEMPLATE;
 typedef const DLGTEMPLATE *LPCDLGTEMPLATE;
-typedef struct _DOC_INFO_1 { 
-  LPTSTR pDocName; 
-  LPTSTR pOutputFile; 
-  LPTSTR pDatatype; 
-} DOC_INFO_1; 
-typedef struct _DOC_INFO_2 { 
-  LPTSTR pDocName; 
-  LPTSTR pOutputFile; 
-  LPTSTR pDatatype; 
-  DWORD  dwMode; 
-  DWORD  JobId; 
-} DOC_INFO_2; 
-typedef struct {    
-  int     cbSize; 
-  LPCTSTR lpszDocName; 
-  LPCTSTR lpszOutput; 
-  LPCTSTR lpszDatatype; 
-  DWORD   fwType;       
-} DOCINFO, *PDOCINFO; 
-typedef struct { 
-  UINT uNotification; 
-  HWND hWnd; 
-  POINT ptCursor; 
-} DRAGLISTINFO, *LPDRAGLISTINFO; 
-typedef struct tagDRAWITEMSTRUCT { 
-  UINT  CtlType; 
-  UINT  CtlID; 
-  UINT  itemID; 
-  UINT  itemAction; 
-  UINT  itemState; 
-  HWND  hwndItem; 
-  HDC   hDC; 
-  RECT  rcItem; 
-  DWORD itemData; 
-} DRAWITEMSTRUCT, *LPDRAWITEMSTRUCT, *PDRAWITEMSTRUCT; 
-typedef struct { 
-  UINT cbSize;         
-  int  iTabLength;     
-  int  iLeftMargin;    
-  int  iRightMargin;   
-  UINT uiLengthDrawn;  
-} DRAWTEXTPARAMS, *LPDRAWTEXTPARAMS; 
-typedef struct _DRIVER_INFO_1 { 
-  LPTSTR pName; 
-} DRIVER_INFO_1; 
-typedef struct _DRIVER_INFO_2 { 
-  DWORD  cVersion; 
-  LPTSTR pName; 
-  LPTSTR pEnvironment; 
-  LPTSTR pDriverPath; 
-  LPTSTR pDataFile; 
-  LPTSTR pConfigFile; 
-} DRIVER_INFO_2; 
-typedef struct _DRIVER_INFO_3 { 
-  DWORD  cVersion; 
-  LPTSTR pName; 
-  LPTSTR pEnvironment; 
-  LPTSTR pDriverPath; 
-  LPTSTR pDataFile; 
-  LPTSTR pConfigFile; 
-  LPTSTR pHelpFile; 
-  LPTSTR pDependentFiles; 
-  LPTSTR pMonitorName; 
-  LPTSTR pDefaultDataType; 
-} DRIVER_INFO_3; 
-typedef struct _editstream { 
-  DWORD dwCookie; 
-  DWORD dwError; 
-  EDITSTREAMCALLBACK pfnCallback; 
-} EDITSTREAM; 
+
+typedef struct _DOC_INFO_1 {
+  LPTSTR pDocName;
+  LPTSTR pOutputFile;
+  LPTSTR pDatatype;
+} DOC_INFO_1;
+
+typedef struct _DOC_INFO_2 {
+  LPTSTR pDocName;
+  LPTSTR pOutputFile;
+  LPTSTR pDatatype;
+  DWORD  dwMode;
+  DWORD  JobId;
+} DOC_INFO_2;
+
+typedef struct {
+  int     cbSize;
+  LPCTSTR lpszDocName;
+  LPCTSTR lpszOutput;
+  LPCTSTR lpszDatatype;
+  DWORD   fwType;
+} DOCINFO, *PDOCINFO;
+
+typedef struct {
+  UINT uNotification;
+  HWND hWnd;
+  POINT ptCursor;
+} DRAGLISTINFO, *LPDRAGLISTINFO;
+
+typedef struct tagDRAWITEMSTRUCT {
+  UINT  CtlType;
+  UINT  CtlID;
+  UINT  itemID;
+  UINT  itemAction;
+  UINT  itemState;
+  HWND  hwndItem;
+  HDC   hDC;
+  RECT  rcItem;
+  DWORD itemData;
+} DRAWITEMSTRUCT, *LPDRAWITEMSTRUCT, *PDRAWITEMSTRUCT;
+
+typedef struct {
+  UINT cbSize;
+  int  iTabLength;
+  int  iLeftMargin;
+  int  iRightMargin;
+  UINT uiLengthDrawn;
+} DRAWTEXTPARAMS, *LPDRAWTEXTPARAMS;
+
+
+
+typedef struct _DRIVER_INFO_1 {
+  LPTSTR pName;
+} DRIVER_INFO_1;
+
+typedef struct _DRIVER_INFO_2 {
+  DWORD  cVersion;
+  LPTSTR pName;
+  LPTSTR pEnvironment;
+  LPTSTR pDriverPath;
+  LPTSTR pDataFile;
+  LPTSTR pConfigFile;
+} DRIVER_INFO_2;
+
+typedef struct _DRIVER_INFO_3 {
+  DWORD  cVersion;
+  LPTSTR pName;
+  LPTSTR pEnvironment;
+  LPTSTR pDriverPath;
+  LPTSTR pDataFile;
+  LPTSTR pConfigFile;
+  LPTSTR pHelpFile;
+  LPTSTR pDependentFiles;
+  LPTSTR pMonitorName;
+  LPTSTR pDefaultDataType;
+} DRIVER_INFO_3;
+
+typedef struct _editstream {
+  DWORD dwCookie;
+  DWORD dwError;
+  EDITSTREAMCALLBACK pfnCallback;
+} EDITSTREAM;
+
 typedef struct tagEMR
 {
-  DWORD iType; 
+  DWORD iType;
   DWORD nSize;
-} EMR, *PEMR; 
+} EMR, *PEMR;
+
 typedef struct tagEMRANGLEARC
 {
   EMR     emr;
-  POINTL  ptlCenter; 
+  POINTL  ptlCenter;
   DWORD   nRadius;
   FLOAT   eStartAngle;
   FLOAT   eSweepAngle;
-} EMRANGLEARC, *PEMRANGLEARC; 
+} EMRANGLEARC, *PEMRANGLEARC;
+
 typedef struct tagEMRARC
 {
-  EMR    emr; 
+  EMR    emr;
   RECTL  rclBox;
   POINTL ptlStart;
   POINTL ptlEnd;
 } EMRARC,   *PEMRARC,
     EMRARCTO, *PEMRARCTO,
     EMRCHORD, *PEMRCHORD,
-    EMRPIE,   *PEMRPIE; 
+    EMRPIE,   *PEMRPIE;
+
 typedef struct  _XFORM
 {
   FLOAT   eM11;
@@ -1123,615 +1123,615 @@ typedef struct  _XFORM
 
 typedef struct tagEMRBITBLT
 {
-  EMR      emr; 
-  RECTL    rclBounds; 
-  LONG     xDest; 
-  LONG     yDest; 
-  LONG     cxDest; 
-  LONG     cyDest; 
-  DWORD    dwRop; 
-  LONG     xSrc; 
-  LONG     ySrc; 
-  XFORM    xformSrc; 
-  COLORREF crBkColorSrc; 
-  DWORD    iUsageSrc; 
-  DWORD    offBmiSrc; 
-  DWORD    offBitsSrc; 
-  DWORD    cbBitsSrc; 
-} EMRBITBLT, *PEMRBITBLT; 
-typedef struct tagLOGBRUSH { 
-  UINT     lbStyle; 
-  COLORREF lbColor; 
-  LONG     lbHatch; 
-} LOGBRUSH, *PLOGBRUSH; 
+  EMR      emr;
+  RECTL    rclBounds;
+  LONG     xDest;
+  LONG     yDest;
+  LONG     cxDest;
+  LONG     cyDest;
+  DWORD    dwRop;
+  LONG     xSrc;
+  LONG     ySrc;
+  XFORM    xformSrc;
+  COLORREF crBkColorSrc;
+  DWORD    iUsageSrc;
+  DWORD    offBmiSrc;
+  DWORD    offBitsSrc;
+  DWORD    cbBitsSrc;
+} EMRBITBLT, *PEMRBITBLT;
+
+typedef struct tagLOGBRUSH {
+  UINT     lbStyle;
+  COLORREF lbColor;
+  LONG     lbHatch;
+} LOGBRUSH, *PLOGBRUSH;
+
 typedef struct tagEMRCREATEBRUSHINDIRECT
 {
-  EMR      emr; 
-  DWORD    ihBrush; 
-  LOGBRUSH lb; 
-} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT; 
+  EMR      emr;
+  DWORD    ihBrush;
+  LOGBRUSH lb;
+} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT;
+
 typedef LONG LCSCSTYPE;
 typedef LONG LCSGAMUTMATCH;
 
 typedef struct tagLOGCOLORSPACE {
-  DWORD         lcsSignature; 
-  DWORD         lcsVersion; 
-  DWORD         lcsSize; 
+  DWORD         lcsSignature;
+  DWORD         lcsVersion;
+  DWORD         lcsSize;
 
-  LCSCSTYPE     lcsCSType; 
-  LCSGAMUTMATCH lcsIntent; 
+  LCSCSTYPE     lcsCSType;
+  LCSGAMUTMATCH lcsIntent;
   CIEXYZTRIPLE  lcsEndpoints;
   DWORD         lcsGammaRed;
-  DWORD         lcsGammaGreen; 
+  DWORD         lcsGammaGreen;
   DWORD         lcsGammaBlue;
-  TCHAR         lcsFilename[MAX_PATH]; 
-} LOGCOLORSPACE, *LPLOGCOLORSPACE; 
+  TCHAR         lcsFilename[MAX_PATH];
+} LOGCOLORSPACE, *LPLOGCOLORSPACE;
+
 typedef struct tagEMRCREATECOLORSPACE
 {
-  EMR           emr; 
-  DWORD         ihCS; 
-  LOGCOLORSPACE lcs; 
-} EMRCREATECOLORSPACE, *PEMRCREATECOLORSPACE; 
+  EMR           emr;
+  DWORD         ihCS;
+  LOGCOLORSPACE lcs;
+} EMRCREATECOLORSPACE, *PEMRCREATECOLORSPACE;
+
 typedef struct tagEMRCREATEDIBPATTERNBRUSHPT
 {
-  EMR   emr; 
-  DWORD ihBrush; 
-  DWORD iUsage; 
-  DWORD offBmi; 
-  DWORD cbBmi; 
-  DWORD offBits; 
-  DWORD cbBits; 
-} EMRCREATEDIBPATTERNBRUSHPT, 
-    PEMRCREATEDIBPATTERNBRUSHPT; 
+  EMR   emr;
+  DWORD ihBrush;
+  DWORD iUsage;
+  DWORD offBmi;
+  DWORD cbBmi;
+  DWORD offBits;
+  DWORD cbBits;
+} EMRCREATEDIBPATTERNBRUSHPT,
+    PEMRCREATEDIBPATTERNBRUSHPT;
+
 typedef struct tagEMRCREATEMONOBRUSH
 {
-  EMR   emr; 
-  DWORD ihBrush; 
-  DWORD iUsage; 
-  DWORD offBmi; 
-  DWORD cbBmi; 
-  DWORD offBits; 
-  DWORD cbBits; 
-} EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH; 
-typedef struct tagPALETTEENTRY { 
-  BYTE peRed; 
-  BYTE peGreen; 
-  BYTE peBlue; 
-  BYTE peFlags; 
-} PALETTEENTRY, *LPPALETTEENTRY, *PPALETTEENTRY; 
-typedef struct tagLOGPALETTE { 
-  WORD         palVersion; 
-  WORD         palNumEntries; 
-  PALETTEENTRY palPalEntry[1]; 
-} LOGPALETTE, *LPLOGPALETTE, *PLOGPALETTE; 
+  EMR   emr;
+  DWORD ihBrush;
+  DWORD iUsage;
+  DWORD offBmi;
+  DWORD cbBmi;
+  DWORD offBits;
+  DWORD cbBits;
+} EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH;
+
+typedef struct tagPALETTEENTRY {
+  BYTE peRed;
+  BYTE peGreen;
+  BYTE peBlue;
+  BYTE peFlags;
+} PALETTEENTRY, *LPPALETTEENTRY, *PPALETTEENTRY;
+
+typedef struct tagLOGPALETTE {
+  WORD         palVersion;
+  WORD         palNumEntries;
+  PALETTEENTRY palPalEntry[1];
+} LOGPALETTE, *LPLOGPALETTE, *PLOGPALETTE;
 
 typedef struct tagEMRCREATEPALETTE
 {
-  EMR        emr; 
-  DWORD      ihPal; 
-  LOGPALETTE lgpl; 
-} EMRCREATEPALETTE, *PEMRCREATEPALETTE; 
-typedef struct tagLOGPEN { 
-  UINT     lopnStyle; 
-  POINT    lopnWidth; 
-  COLORREF lopnColor; 
-} LOGPEN, *PLOGPEN; 
+  EMR        emr;
+  DWORD      ihPal;
+  LOGPALETTE lgpl;
+} EMRCREATEPALETTE, *PEMRCREATEPALETTE;
+
+typedef struct tagLOGPEN {
+  UINT     lopnStyle;
+  POINT    lopnWidth;
+  COLORREF lopnColor;
+} LOGPEN, *PLOGPEN;
+
 typedef struct tagEMRCREATEPEN
 {
-  EMR    emr; 
-  DWORD  ihPen; 
-  LOGPEN lopn; 
-} EMRCREATEPEN, *PEMRCREATEPEN; 
+  EMR    emr;
+  DWORD  ihPen;
+  LOGPEN lopn;
+} EMRCREATEPEN, *PEMRCREATEPEN;
+
 typedef struct tagEMRELLIPSE
 {
-  EMR   emr; 
-  RECTL rclBox; 
+  EMR   emr;
+  RECTL rclBox;
 } EMRELLIPSE,  *PEMRELLIPSE,
-    EMRRECTANGLE, *PEMRRECTANGLE; 
+    EMRRECTANGLE, *PEMRRECTANGLE;
+
 typedef struct tagEMREOF
 {
   EMR     emr;
-  DWORD   nPalEntries; 
-  DWORD   offPalEntries; 
-  DWORD   nSizeLast; 
-} EMREOF, *PEMREOF; 
+  DWORD   nPalEntries;
+  DWORD   offPalEntries;
+  DWORD   nSizeLast;
+} EMREOF, *PEMREOF;
+
 typedef struct tagEMREXCLUDECLIPRECT
 {
-  EMR   emr;      
-  RECTL rclClip;  
+  EMR   emr;
+  RECTL rclClip;
 } EMREXCLUDECLIPRECT,   *PEMREXCLUDECLIPRECT,
-    EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT; 
-typedef struct tagPANOSE { 
-  BYTE bFamilyType; 
-  BYTE bSerifStyle; 
-  BYTE bWeight; 
-  BYTE bProportion; 
-  BYTE bContrast; 
-  BYTE bStrokeVariation; 
-  BYTE bArmStyle; 
-  BYTE bLetterform; 
-  BYTE bMidline; 
-  BYTE bXHeight; 
-} PANOSE; 
-
-typedef struct tagEXTLOGFONT { 
-    LOGFONT elfLogFont; 
-    BCHAR    elfFullName[LF_FULLFACESIZE]; 
-    BCHAR    elfStyle[LF_FACESIZE]; 
-    DWORD   elfVersion; 
-    DWORD   elfStyleSize; 
-    DWORD   elfMatch; 
-    DWORD   elfReserved; 
-    BYTE    elfVendorId[ELF_VENDOR_SIZE]; 
-    DWORD   elfCulture; 
-    PANOSE  elfPanose; 
-} EXTLOGFONT; 
+    EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT;
+
+typedef struct tagPANOSE {
+  BYTE bFamilyType;
+  BYTE bSerifStyle;
+  BYTE bWeight;
+  BYTE bProportion;
+  BYTE bContrast;
+  BYTE bStrokeVariation;
+  BYTE bArmStyle;
+  BYTE bLetterform;
+  BYTE bMidline;
+  BYTE bXHeight;
+} PANOSE;
+
+typedef struct tagEXTLOGFONT {
+    LOGFONT elfLogFont;
+    BCHAR    elfFullName[LF_FULLFACESIZE];
+    BCHAR    elfStyle[LF_FACESIZE];
+    DWORD   elfVersion;
+    DWORD   elfStyleSize;
+    DWORD   elfMatch;
+    DWORD   elfReserved;
+    BYTE    elfVendorId[ELF_VENDOR_SIZE];
+    DWORD   elfCulture;
+    PANOSE  elfPanose;
+} EXTLOGFONT;
+
 typedef struct tagEMREXTCREATEFONTINDIRECTW
 {
-  EMR         emr; 
-  DWORD       ihFont; 
-  EXTLOGFONT  elfw; 
-} EMREXTCREATEFONTINDIRECTW, 
-    PEMREXTCREATEFONTINDIRECTW; 
-typedef struct tagEXTLOGPEN { 
-  UINT     elpPenStyle; 
-  UINT     elpWidth; 
-  UINT     elpBrushStyle; 
-  COLORREF elpColor; 
-  LONG     elpHatch; 
-  DWORD    elpNumEntries; 
-  DWORD    elpStyleEntry[1]; 
-} EXTLOGPEN; 
+  EMR         emr;
+  DWORD       ihFont;
+  EXTLOGFONT  elfw;
+} EMREXTCREATEFONTINDIRECTW,
+    PEMREXTCREATEFONTINDIRECTW;
+
+typedef struct tagEXTLOGPEN {
+  UINT     elpPenStyle;
+  UINT     elpWidth;
+  UINT     elpBrushStyle;
+  COLORREF elpColor;
+  LONG     elpHatch;
+  DWORD    elpNumEntries;
+  DWORD    elpStyleEntry[1];
+} EXTLOGPEN;
+
 typedef struct tagEMREXTCREATEPEN
 {
-  EMR       emr; 
-  DWORD     ihPen; 
-  DWORD     offBmi; 
-  DWORD     cbBmi; 
-  DWORD     offBits; 
-  DWORD     cbBits; 
-  EXTLOGPEN elp; 
-} EMREXTCREATEPEN, *PEMREXTCREATEPEN; 
+  EMR       emr;
+  DWORD     ihPen;
+  DWORD     offBmi;
+  DWORD     cbBmi;
+  DWORD     offBits;
+  DWORD     cbBits;
+  EXTLOGPEN elp;
+} EMREXTCREATEPEN, *PEMREXTCREATEPEN;
+
 typedef struct tagEMREXTFLOODFILL
 {
-  EMR     emr; 
-  POINTL  ptlStart; 
-  COLORREF crColor; 
-  DWORD   iMode; 
-} EMREXTFLOODFILL, *PEMREXTFLOODFILL; 
+  EMR     emr;
+  POINTL  ptlStart;
+  COLORREF crColor;
+  DWORD   iMode;
+} EMREXTFLOODFILL, *PEMREXTFLOODFILL;
+
 typedef struct tagEMREXTSELECTCLIPRGN
 {
-  EMR   emr; 
-  DWORD cbRgnData; 
-  DWORD iMode; 
-  BYTE  RgnData[1]; 
-} EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN; 
-typedef struct tagEMRTEXT 
+  EMR   emr;
+  DWORD cbRgnData;
+  DWORD iMode;
+  BYTE  RgnData[1];
+} EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN;
+
+typedef struct tagEMRTEXT
 {
-  POINTL ptlReference; 
-  DWORD  nChars; 
-  DWORD  offString; 
-  DWORD  fOptions; 
-  RECTL  rcl; 
-  DWORD  offDx; 
-} EMRTEXT, *PEMRTEXT; 
+  POINTL ptlReference;
+  DWORD  nChars;
+  DWORD  offString;
+  DWORD  fOptions;
+  RECTL  rcl;
+  DWORD  offDx;
+} EMRTEXT, *PEMRTEXT;
+
 typedef struct tagEMREXTTEXTOUTA
 {
-  EMR     emr; 
-  RECTL   rclBounds; 
-  DWORD   iGraphicsMode; 
-  FLOAT   exScale; 
+  EMR     emr;
+  RECTL   rclBounds;
+  DWORD   iGraphicsMode;
+  FLOAT   exScale;
   FLOAT   eyScale;
-  EMRTEXT emrtext; 
+  EMRTEXT emrtext;
 } EMREXTTEXTOUTA, *PEMREXTTEXTOUTA,
-    EMREXTTEXTOUTW, *PEMREXTTEXTOUTW; 
+    EMREXTTEXTOUTW, *PEMREXTTEXTOUTW;
+
 typedef struct tagEMRFILLPATH
 {
-  EMR   emr; 
-  RECTL rclBounds; 
+  EMR   emr;
+  RECTL rclBounds;
 } EMRFILLPATH,          *PEMRFILLPATH,
     EMRSTROKEANDFILLPATH, *PEMRSTROKEANDFILLPATH,
-    EMRSTROKEPATH,        *PEMRSTROKEPATH; 
+    EMRSTROKEPATH,        *PEMRSTROKEPATH;
+
 typedef struct tagEMRFILLRGN
 {
-  EMR   emr; 
-  RECTL rclBounds; 
-  DWORD cbRgnData; 
-  DWORD ihBrush; 
-  BYTE  RgnData[1]; 
-} EMRFILLRGN, *PEMRFILLRGN; 
-typedef struct tagEMRFORMAT { 
-  DWORD   dSignature; 
-  DWORD   nVersion; 
-  DWORD   cbData; 
-  DWORD   offData; 
-} EMRFORMAT; 
-typedef struct tagSIZE { 
-  LONG cx; 
-  LONG cy; 
-} SIZE, *PSIZE, *LPSIZE, SIZEL, *PSIZEL, *LPSIZEL; 
+  EMR   emr;
+  RECTL rclBounds;
+  DWORD cbRgnData;
+  DWORD ihBrush;
+  BYTE  RgnData[1];
+} EMRFILLRGN, *PEMRFILLRGN;
+
+typedef struct tagEMRFORMAT {
+  DWORD   dSignature;
+  DWORD   nVersion;
+  DWORD   cbData;
+  DWORD   offData;
+} EMRFORMAT;
+
+typedef struct tagSIZE {
+  LONG cx;
+  LONG cy;
+} SIZE, *PSIZE, *LPSIZE, SIZEL, *PSIZEL, *LPSIZEL;
+
 typedef struct tagEMRFRAMERGN
 {
-  EMR   emr; 
-  RECTL rclBounds; 
-  DWORD cbRgnData; 
-  DWORD ihBrush; 
-  SIZEL szlStroke; 
-  BYTE  RgnData[1]; 
-} EMRFRAMERGN, *PEMRFRAMERGN; 
+  EMR   emr;
+  RECTL rclBounds;
+  DWORD cbRgnData;
+  DWORD ihBrush;
+  SIZEL szlStroke;
+  BYTE  RgnData[1];
+} EMRFRAMERGN, *PEMRFRAMERGN;
 
 typedef struct tagEMRGDICOMMENT
 {
-  EMR   emr; 
-  DWORD cbData; 
-  BYTE  Data[1]; 
-} EMRGDICOMMENT, *PEMRGDICOMMENT; 
+  EMR   emr;
+  DWORD cbData;
+  BYTE  Data[1];
+} EMRGDICOMMENT, *PEMRGDICOMMENT;
+
 typedef struct tagEMRINVERTRGN
 {
-  EMR   emr; 
-  RECTL rclBounds; 
-  DWORD cbRgnData; 
-  BYTE  RgnData[1]; 
+  EMR   emr;
+  RECTL rclBounds;
+  DWORD cbRgnData;
+  BYTE  RgnData[1];
 } EMRINVERTRGN, *PEMRINVERTRGN,
-    EMRPAINTRGN,  *PEMRPAINTRGN; 
+    EMRPAINTRGN,  *PEMRPAINTRGN;
+
 typedef struct tagEMRLINETO
 {
-  EMR    emr; 
-  POINTL ptl; 
+  EMR    emr;
+  POINTL ptl;
 } EMRLINETO,   *PEMRLINETO,
-    EMRMOVETOEX, *PEMRMOVETOEX; 
+    EMRMOVETOEX, *PEMRMOVETOEX;
+
 typedef struct tagEMRMASKBLT
 {
-  EMR     emr; 
-  RECTL   rclBounds; 
-  LONG    xDest; 
-  LONG    yDest; 
-  LONG    cxDest; 
-  LONG    cyDest; 
-  DWORD   dwRop; 
-  LONG    xSrc; 
-  LONG    ySrc; 
-  XFORM   xformSrc; 
-  COLORREF crBkColorSrc; 
-  DWORD   iUsageSrc; 
-  DWORD   offBmiSrc; 
-  DWORD   cbBmiSrc; 
-  DWORD   offBitsSrc; 
-  DWORD   cbBitsSrc; 
-  LONG    xMask; 
-  LONG    yMask; 
-  DWORD   iUsageMask; 
-  DWORD   offBmiMask; 
-  DWORD   cbBmiMask; 
-  DWORD   offBitsMask; 
-  DWORD   cbBitsMask; 
-} EMRMASKBLT, *PEMRMASKBLT; 
+  EMR     emr;
+  RECTL   rclBounds;
+  LONG    xDest;
+  LONG    yDest;
+  LONG    cxDest;
+  LONG    cyDest;
+  DWORD   dwRop;
+  LONG    xSrc;
+  LONG    ySrc;
+  XFORM   xformSrc;
+  COLORREF crBkColorSrc;
+  DWORD   iUsageSrc;
+  DWORD   offBmiSrc;
+  DWORD   cbBmiSrc;
+  DWORD   offBitsSrc;
+  DWORD   cbBitsSrc;
+  LONG    xMask;
+  LONG    yMask;
+  DWORD   iUsageMask;
+  DWORD   offBmiMask;
+  DWORD   cbBmiMask;
+  DWORD   offBitsMask;
+  DWORD   cbBitsMask;
+} EMRMASKBLT, *PEMRMASKBLT;
+
 typedef struct tagEMRMODIFYWORLDTRANSFORM
 {
-  EMR   emr; 
-  XFORM xform; 
-  DWORD iMode; 
-} EMRMODIFYWORLDTRANSFORM, 
-    PEMRMODIFYWORLDTRANSFORM; 
+  EMR   emr;
+  XFORM xform;
+  DWORD iMode;
+} EMRMODIFYWORLDTRANSFORM,
+    PEMRMODIFYWORLDTRANSFORM;
+
 typedef struct tagEMROFFSETCLIPRGN
 {
-  EMR    emr; 
-  POINTL ptlOffset; 
-} EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN; 
+  EMR    emr;
+  POINTL ptlOffset;
+} EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN;
+
 typedef struct tagEMRPLGBLT
 {
-  EMR      emr; 
-  RECTL    rclBounds; 
-  POINTL   aptlDest[3]; 
-  LONG    xSrc; 
-  LONG    ySrc; 
-  LONG     cxSrc; 
-  LONG     cySrc; 
-  XFORM   xformSrc; 
-  COLORREF crBkColorSrc; 
-  DWORD    iUsageSrc; 
-  DWORD    offBmiSrc; 
-  DWORD   cbBmiSrc; 
-  DWORD   offBitsSrc; 
-  DWORD   cbBitsSrc; 
+  EMR      emr;
+  RECTL    rclBounds;
+  POINTL   aptlDest[3];
+  LONG    xSrc;
+  LONG    ySrc;
+  LONG     cxSrc;
+  LONG     cySrc;
+  XFORM   xformSrc;
+  COLORREF crBkColorSrc;
+  DWORD    iUsageSrc;
+  DWORD    offBmiSrc;
+  DWORD   cbBmiSrc;
+  DWORD   offBitsSrc;
+  DWORD   cbBitsSrc;
   LONG    xMask;
-  LONG    yMask; 
-  DWORD   iUsageMask; 
-  DWORD   offBmiMask; 
+  LONG    yMask;
+  DWORD   iUsageMask;
+  DWORD   offBmiMask;
   DWORD   cbBmiMask;
   DWORD   offBitsMask;
   DWORD   cbBitsMask;
-} EMRPLGBLT, *PEMRPLGBLT; 
+} EMRPLGBLT, *PEMRPLGBLT;
+
 typedef struct tagEMRPOLYDRAW
 {
-  EMR    emr; 
-  RECTL  rclBounds; 
-  DWORD  cptl; 
-  POINTL aptl[1]; 
-  BYTE   abTypes[1]; 
-} EMRPOLYDRAW, *PEMRPOLYDRAW; 
+  EMR    emr;
+  RECTL  rclBounds;
+  DWORD  cptl;
+  POINTL aptl[1];
+  BYTE   abTypes[1];
+} EMRPOLYDRAW, *PEMRPOLYDRAW;
+
 typedef struct tagEMRPOLYDRAW16
 {
-  EMR    emr; 
-  RECTL  rclBounds; 
-  DWORD  cpts; 
-  POINTS apts[1]; 
-  BYTE   abTypes[1]; 
-} EMRPOLYDRAW16, *PEMRPOLYDRAW16; 
+  EMR    emr;
+  RECTL  rclBounds;
+  DWORD  cpts;
+  POINTS apts[1];
+  BYTE   abTypes[1];
+} EMRPOLYDRAW16, *PEMRPOLYDRAW16;
+
 typedef struct tagEMRPOLYLINE
 {
   EMR    emr;
-  RECTL  rclBounds; 
-  DWORD  cptl; 
-  POINTL aptl[1]; 
+  RECTL  rclBounds;
+  DWORD  cptl;
+  POINTL aptl[1];
 } EMRPOLYLINE,     *PEMRPOLYLINE,
     EMRPOLYBEZIER,   *PEMRPOLYBEZIER,
     EMRPOLYGON,      *PEMRPOLYGON,
     EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO,
-    EMRPOLYLINETO,   *PEMRPOLYLINETO; 
+    EMRPOLYLINETO,   *PEMRPOLYLINETO;
+
 typedef struct tagEMRPOLYLINE16
 {
-  EMR    emr; 
-  RECTL  rclBounds; 
-  DWORD  cpts; 
-  POINTL apts[1]; 
+  EMR    emr;
+  RECTL  rclBounds;
+  DWORD  cpts;
+  POINTL apts[1];
 } EMRPOLYLINE16,     *PEMRPOLYLINE16,
     EMRPOLYBEZIER16,   *PEMRPOLYBEZIER16,
     EMRPOLYGON16,      *PEMRPOLYGON16,
     EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16,
-    EMRPOLYLINETO16,   *PEMRPOLYLINETO16; 
+    EMRPOLYLINETO16,   *PEMRPOLYLINETO16;
+
 typedef struct tagEMRPOLYPOLYLINE
 {
-  EMR     emr; 
-  RECTL   rclBounds; 
-  DWORD   nPolys; 
-  DWORD   cptl; 
-  DWORD   aPolyCounts[1]; 
-  POINTL  aptl[1]; 
+  EMR     emr;
+  RECTL   rclBounds;
+  DWORD   nPolys;
+  DWORD   cptl;
+  DWORD   aPolyCounts[1];
+  POINTL  aptl[1];
 } EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE,
-    EMRPOLYPOLYGON,  *PEMRPOLYPOLYGON; 
+    EMRPOLYPOLYGON,  *PEMRPOLYPOLYGON;
+
 typedef struct tagEMRPOLYPOLYLINE16
 {
-  EMR     emr; 
+  EMR     emr;
   RECTL   rclBounds;
-  DWORD   nPolys; 
-  DWORD   cpts; 
-  DWORD   aPolyCounts[1]; 
-  POINTS  apts[1]; 
+  DWORD   nPolys;
+  DWORD   cpts;
+  DWORD   aPolyCounts[1];
+  POINTS  apts[1];
 } EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16,
-    EMRPOLYPOLYGON16,  *PEMRPOLYPOLYGON16; 
+    EMRPOLYPOLYGON16,  *PEMRPOLYPOLYGON16;
+
 typedef struct tagEMRPOLYTEXTOUTA
 {
-  EMR     emr; 
-  RECTL   rclBounds; 
-  DWORD   iGraphicsMode; 
-  FLOAT   exScale; 
-  FLOAT   eyScale; 
-  LONG    cStrings; 
-  EMRTEXT aemrtext[1]; 
+  EMR     emr;
+  RECTL   rclBounds;
+  DWORD   iGraphicsMode;
+  FLOAT   exScale;
+  FLOAT   eyScale;
+  LONG    cStrings;
+  EMRTEXT aemrtext[1];
 } EMRPOLYTEXTOUTA, *PEMRPOLYTEXTOUTA,
-    EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW; 
+    EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW;
+
 typedef struct tagEMRRESIZEPALETTE
 {
-  EMR   emr; 
-  DWORD ihPal; 
-  DWORD cEntries; 
-} EMRRESIZEPALETTE, *PEMRRESIZEPALETTE; 
+  EMR   emr;
+  DWORD ihPal;
+  DWORD cEntries;
+} EMRRESIZEPALETTE, *PEMRRESIZEPALETTE;
+
 typedef struct tagEMRRESTOREDC
 {
-  EMR  emr; 
-  LONG iRelative; 
-} EMRRESTOREDC, *PEMRRESTOREDC; 
+  EMR  emr;
+  LONG iRelative;
+} EMRRESTOREDC, *PEMRRESTOREDC;
+
 typedef struct tagEMRROUNDRECT
 {
-  EMR   emr; 
-  RECTL rclBox; 
-  SIZEL szlCorner; 
-} EMRROUNDRECT, *PEMRROUNDRECT; 
+  EMR   emr;
+  RECTL rclBox;
+  SIZEL szlCorner;
+} EMRROUNDRECT, *PEMRROUNDRECT;
+
 typedef struct tagEMRSCALEVIEWPORTEXTEX
 {
-  EMR  emr; 
-  LONG xNum; 
-  LONG xDenom; 
-  LONG yNum; 
-  LONG yDenom; 
-} EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX, 
-    EMRSCALEWINDOWEXTEX,   *PEMRSCALEWINDOWEXTEX; 
-typedef struct tagEMRSELECTCOLORSPACE 
-{ 
-  EMR     emr; 
-  DWORD   ihCS; 
+  EMR  emr;
+  LONG xNum;
+  LONG xDenom;
+  LONG yNum;
+  LONG yDenom;
+} EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX,
+    EMRSCALEWINDOWEXTEX,   *PEMRSCALEWINDOWEXTEX;
+
+typedef struct tagEMRSELECTCOLORSPACE
+{
+  EMR     emr;
+  DWORD   ihCS;
 } EMRSELECTCOLORSPACE, *PEMRSELECTCOLORSPACE,
-    EMRDELETECOLORSPACE, *PEMRDELETECOLORSPACE; 
+    EMRDELETECOLORSPACE, *PEMRDELETECOLORSPACE;
 typedef struct tagEMRSELECTOBJECT
 {
-  EMR   emr; 
+  EMR   emr;
   DWORD ihObject;
 } EMRSELECTOBJECT, *PEMRSELECTOBJECT,
-    EMRDELETEOBJECT, *PEMRDELETEOBJECT; 
-typedef struct tagEMRSELECTPALETTE 
+    EMRDELETEOBJECT, *PEMRDELETEOBJECT;
+
+typedef struct tagEMRSELECTPALETTE
 {
-  EMR   emr; 
-  DWORD ihPal; 
-} EMRSELECTPALETTE, *PEMRSELECTPALETTE; 
+  EMR   emr;
+  DWORD ihPal;
+} EMRSELECTPALETTE, *PEMRSELECTPALETTE;
+
 typedef struct tagEMRSETARCDIRECTION
 {
-  EMR   emr; 
+  EMR   emr;
   DWORD iArcDirection;
-} EMRSETARCDIRECTION, *PEMRSETARCDIRECTION; 
+} EMRSETARCDIRECTION, *PEMRSETARCDIRECTION;
+
 typedef struct tagEMRSETTEXTCOLOR
 {
-  EMR      emr; 
-  COLORREF crColor; 
+  EMR      emr;
+  COLORREF crColor;
 } EMRSETBKCOLOR,   *PEMRSETBKCOLOR,
-    EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR; 
+    EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR;
+
 typedef struct tagEMRSETCOLORADJUSTMENT
 {
-  EMR  emr; 
-  COLORADJUSTMENT ColorAdjustment; 
-} EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT; 
+  EMR  emr;
+  COLORADJUSTMENT ColorAdjustment;
+} EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT;
+
 typedef struct tagEMRSETDIBITSTODEVICE
 {
-  EMR   emr; 
-  RECTL rclBounds; 
-  LONG  xDest; 
-  LONG  yDest; 
-  LONG  xSrc; 
-  LONG  ySrc; 
-  LONG  cxSrc; 
-  LONG  cySrc; 
-  DWORD offBmiSrc; 
-  DWORD cbBmiSrc; 
-  DWORD offBitsSrc; 
-  DWORD cbBitsSrc; 
-  DWORD iUsageSrc; 
-  DWORD iStartScan; 
-  DWORD cScans; 
-} EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE; 
+  EMR   emr;
+  RECTL rclBounds;
+  LONG  xDest;
+  LONG  yDest;
+  LONG  xSrc;
+  LONG  ySrc;
+  LONG  cxSrc;
+  LONG  cySrc;
+  DWORD offBmiSrc;
+  DWORD cbBmiSrc;
+  DWORD offBitsSrc;
+  DWORD cbBitsSrc;
+  DWORD iUsageSrc;
+  DWORD iStartScan;
+  DWORD cScans;
+} EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE;
+
 typedef struct tagEMRSETMAPPERFLAGS
 {
-  EMR   emr; 
-  DWORD dwFlags; 
-} EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS; 
+  EMR   emr;
+  DWORD dwFlags;
+} EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS;
+
 typedef struct tagEMRSETMITERLIMIT
 {
   EMR   emr;
-  FLOAT eMiterLimit; 
-} EMRSETMITERLIMIT, *PEMRSETMITERLIMIT; 
+  FLOAT eMiterLimit;
+} EMRSETMITERLIMIT, *PEMRSETMITERLIMIT;
+
 typedef struct tagEMRSETPALETTEENTRIES
 {
-  EMR          emr; 
-  DWORD        ihPal; 
-  DWORD        iStart; 
-  DWORD        cEntries; 
-  PALETTEENTRY aPalEntries[1]; 
-} EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES; 
+  EMR          emr;
+  DWORD        ihPal;
+  DWORD        iStart;
+  DWORD        cEntries;
+  PALETTEENTRY aPalEntries[1];
+} EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES;
+
 typedef struct tagEMRSETPIXELV
 {
-  EMR     emr; 
-  POINTL  ptlPixel; 
-  COLORREF crColor; 
-} EMRSETPIXELV, *PEMRSETPIXELV; 
+  EMR     emr;
+  POINTL  ptlPixel;
+  COLORREF crColor;
+} EMRSETPIXELV, *PEMRSETPIXELV;
+
 typedef struct tagEMRSETVIEWPORTEXTEX
 {
-  EMR   emr; 
-  SIZEL szlExtent; 
+  EMR   emr;
+  SIZEL szlExtent;
 } EMRSETVIEWPORTEXTEX, *PEMRSETVIEWPORTEXTEX,
-    EMRSETWINDOWEXTEX,   *PEMRSETWINDOWEXTEX; 
+    EMRSETWINDOWEXTEX,   *PEMRSETWINDOWEXTEX;
+
 typedef struct tagEMRSETVIEWPORTORGEX
 {
-  EMR    emr; 
-  POINTL ptlOrigin; 
+  EMR    emr;
+  POINTL ptlOrigin;
 } EMRSETVIEWPORTORGEX, *PEMRSETVIEWPORTORGEX,
     EMRSETWINDOWORGEX,   *PEMRSETWINDOWORGEX,
-    EMRSETBRUSHORGEX,    *PEMRSETBRUSHORGEX; 
+    EMRSETBRUSHORGEX,    *PEMRSETBRUSHORGEX;
+
 typedef struct tagEMRSETWORLDTRANSFORM
 {
-  EMR   emr; 
-  XFORM xform; 
-} EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM; 
+  EMR   emr;
+  XFORM xform;
+} EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM;
+
 typedef struct tagEMRSTRETCHBLT
 {
-  EMR      emr; 
-  RECTL    rclBounds; 
-  LONG     xDest; 
-  LONG     yDest; 
-  LONG     cxDest; 
-  LONG     cyDest; 
-  DWORD    dwRop; 
-  LONG     xSrc; 
-  LONG     ySrc; 
-  XFORM    xformSrc; 
-  COLORREF crBkColorSrc; 
-  DWORD    iUsageSrc; 
-  DWORD    offBmiSrc; 
-  DWORD    cbBmiSrc; 
-  DWORD    offBitsSrc; 
-  DWORD    cbBitsSrc; 
-  LONG     cxSrc; 
-  LONG     cySrc; 
-} EMRSTRETCHBLT, *PEMRSTRETCHBLT; 
+  EMR      emr;
+  RECTL    rclBounds;
+  LONG     xDest;
+  LONG     yDest;
+  LONG     cxDest;
+  LONG     cyDest;
+  DWORD    dwRop;
+  LONG     xSrc;
+  LONG     ySrc;
+  XFORM    xformSrc;
+  COLORREF crBkColorSrc;
+  DWORD    iUsageSrc;
+  DWORD    offBmiSrc;
+  DWORD    cbBmiSrc;
+  DWORD    offBitsSrc;
+  DWORD    cbBitsSrc;
+  LONG     cxSrc;
+  LONG     cySrc;
+} EMRSTRETCHBLT, *PEMRSTRETCHBLT;
+
 typedef struct tagEMRSTRETCHDIBITS
 {
   EMR   emr;
-  RECTL rclBounds; 
-  LONG  xDest; 
-  LONG  yDest; 
-  LONG  xSrc; 
-  LONG  ySrc; 
-  LONG  cxSrc; 
+  RECTL rclBounds;
+  LONG  xDest;
+  LONG  yDest;
+  LONG  xSrc;
+  LONG  ySrc;
+  LONG  cxSrc;
   LONG  cySrc;
   DWORD offBmiSrc;
-  DWORD cbBmiSrc; 
-  DWORD offBitsSrc; 
-  DWORD cbBitsSrc; 
-  DWORD iUsageSrc; 
-  DWORD dwRop; 
-  LONG  cxDest; 
-  LONG  cyDest; 
-} EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS; 
-typedef struct tagABORTPATH 
-{ 
-  EMR emr; 
+  DWORD cbBmiSrc;
+  DWORD offBitsSrc;
+  DWORD cbBitsSrc;
+  DWORD iUsageSrc;
+  DWORD dwRop;
+  LONG  cxDest;
+  LONG  cyDest;
+} EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS;
+
+typedef struct tagABORTPATH
+{
+  EMR emr;
 } EMRABORTPATH,      *PEMRABORTPATH,
     EMRBEGINPATH,      *PEMRBEGINPATH,
     EMRENDPATH,        *PEMRENDPATH,
@@ -1741,11 +1741,11 @@ typedef struct tagABORTPATH
     EMRSETMETARGN,     *PEMRSETMETARGN,
     EMRSAVEDC,         *PEMRSAVEDC,
     EMRREALIZEPALETTE, *PEMRREALIZEPALETTE;
+
 typedef struct tagEMRSELECTCLIPPATH
 {
-  EMR   emr; 
-  DWORD iMode; 
+  EMR   emr;
+  DWORD iMode;
 } EMRSELECTCLIPPATH,    *PEMRSELECTCLIPPATH,
     EMRSETBKMODE,         *PEMRSETBKMODE,
     EMRSETMAPMODE,        *PEMRSETMAPMODE,
@@ -1754,80 +1754,80 @@ typedef struct tagEMRSELECTCLIPPATH
     EMRSETSTRETCHBLTMODE, *PEMRSETSTRETCHBLTMODE,
     EMRSETTEXTALIGN,      *PEMRSETTEXTALIGN,
     EMRENABLEICM,       *PEMRENABLEICM;
-typedef struct tagNMHDR { 
-  HWND hwndFrom; 
-  UINT idFrom; 
-  UINT code; 
-} NMHDR; 
-typedef struct _encorrecttext { 
-  NMHDR nmhdr;     
-  CHARRANGE chrg;  
-  WORD seltyp;     
-} ENCORRECTTEXT; 
-typedef struct _endropfiles { 
-  NMHDR nmhdr; 
-  HANDLE hDrop; 
-  LONG cp; 
-  WINBOOL fProtected; 
-} ENDROPFILES; 
+
+typedef struct tagNMHDR {
+  HWND hwndFrom;
+  UINT idFrom;
+  UINT code;
+} NMHDR;
+
+typedef struct _encorrecttext {
+  NMHDR nmhdr;
+  CHARRANGE chrg;
+  WORD seltyp;
+} ENCORRECTTEXT;
+
+typedef struct _endropfiles {
+  NMHDR nmhdr;
+  HANDLE hDrop;
+  LONG cp;
+  WINBOOL fProtected;
+} ENDROPFILES;
+
 typedef struct {
-  NMHDR nmhdr;        
-  LONG cObjectCount;  
-  LONG cch;           
+  NMHDR nmhdr;
+  LONG cObjectCount;
+  LONG cch;
 } ENSAVECLIPBOARD;
 
 typedef struct {
-  NMHDR nmhdr;  
-  LONG iob;     
-  LONG lOper;   
-  HRESULT hr;   
+  NMHDR nmhdr;
+  LONG iob;
+  LONG lOper;
+  HRESULT hr;
 } ENOLEOPFAILED;
 
-typedef struct tagENHMETAHEADER { 
-  DWORD iType; 
-  DWORD nSize; 
-  RECTL rclBounds; 
-  RECTL rclFrame; 
-  DWORD dSignature; 
-  DWORD nVersion; 
-  DWORD nBytes; 
-  DWORD nRecords; 
-  WORD  nHandles; 
-  WORD  sReserved; 
-  DWORD nDescription; 
-  DWORD offDescription; 
-  DWORD nPalEntries; 
-  SIZEL szlDevice; 
-  SIZEL szlMillimeters; 
-} ENHMETAHEADER, *LPENHMETAHEADER; 
-typedef struct tagENHMETARECORD { 
-  DWORD iType; 
-  DWORD nSize; 
-  DWORD dParm[1]; 
-} ENHMETARECORD, *PENHMETARECORD, *LPENHMETARECORD; 
-typedef struct _enprotected { 
-  NMHDR nmhdr; 
-  UINT msg; 
-  WPARAM wParam; 
-  LPARAM lParam; 
-  CHARRANGE chrg; 
-} ENPROTECTED; 
+typedef struct tagENHMETAHEADER {
+  DWORD iType;
+  DWORD nSize;
+  RECTL rclBounds;
+  RECTL rclFrame;
+  DWORD dSignature;
+  DWORD nVersion;
+  DWORD nBytes;
+  DWORD nRecords;
+  WORD  nHandles;
+  WORD  sReserved;
+  DWORD nDescription;
+  DWORD offDescription;
+  DWORD nPalEntries;
+  SIZEL szlDevice;
+  SIZEL szlMillimeters;
+} ENHMETAHEADER, *LPENHMETAHEADER;
+
+typedef struct tagENHMETARECORD {
+  DWORD iType;
+  DWORD nSize;
+  DWORD dParm[1];
+} ENHMETARECORD, *PENHMETARECORD, *LPENHMETARECORD;
+
+typedef struct _enprotected {
+  NMHDR nmhdr;
+  UINT msg;
+  WPARAM wParam;
+  LPARAM lParam;
+  CHARRANGE chrg;
+} ENPROTECTED;
+
 typedef struct _SERVICE_STATUS {
-  DWORD dwServiceType; 
-  DWORD dwCurrentState; 
-  DWORD dwControlsAccepted; 
-  DWORD dwWin32ExitCode; 
-  DWORD dwServiceSpecificExitCode; 
-  DWORD dwCheckPoint; 
-  DWORD dwWaitHint; 
-} SERVICE_STATUS, *LPSERVICE_STATUS; 
+  DWORD dwServiceType;
+  DWORD dwCurrentState;
+  DWORD dwControlsAccepted;
+  DWORD dwWin32ExitCode;
+  DWORD dwServiceSpecificExitCode;
+  DWORD dwCheckPoint;
+  DWORD dwWaitHint;
+} SERVICE_STATUS, *LPSERVICE_STATUS;
 
 typedef struct _ENUM_SERVICE_STATUSA {
   LPSTR lpServiceName;
@@ -1849,89 +1849,89 @@ typedef struct _ENUM_SERVICE_STATUSW {
 #define LPENUM_SERVICE_STATUS LPENUM_SERVICE_STATUSA
 #endif
 
-typedef struct tagENUMLOGFONT { 
-  LOGFONT elfLogFont; 
-  BCHAR    elfFullName[LF_FULLFACESIZE]; 
-  BCHAR    elfStyle[LF_FACESIZE]; 
-} ENUMLOGFONT; 
+typedef struct tagENUMLOGFONT {
+  LOGFONT elfLogFont;
+  BCHAR    elfFullName[LF_FULLFACESIZE];
+  BCHAR    elfStyle[LF_FACESIZE];
+} ENUMLOGFONT;
+
 typedef struct tagENUMLOGFONTEX {
   LOGFONT  elfLogFont;
   BCHAR  elfFullName[LF_FULLFACESIZE];
   BCHAR  elfStyle[LF_FACESIZE];
   BCHAR  elfScript[LF_FACESIZE];
 } ENUMLOGFONTEX;
+
 typedef struct _EVENTLOGRECORD {
-  DWORD  Length; 
-  DWORD  Reserved; 
-  DWORD  RecordNumber; 
-  DWORD  TimeGenerated; 
-  DWORD  TimeWritten; 
-  DWORD  EventID; 
-  WORD   EventType; 
-  WORD   NumStrings; 
-  WORD   EventCategory; 
-  WORD   ReservedFlags; 
-  DWORD  ClosingRecordNumber; 
-  DWORD  StringOffset; 
-  DWORD  UserSidLength; 
-  DWORD  UserSidOffset; 
-  DWORD  DataLength; 
-  DWORD  DataOffset; 
+  DWORD  Length;
+  DWORD  Reserved;
+  DWORD  RecordNumber;
+  DWORD  TimeGenerated;
+  DWORD  TimeWritten;
+  DWORD  EventID;
+  WORD   EventType;
+  WORD   NumStrings;
+  WORD   EventCategory;
+  WORD   ReservedFlags;
+  DWORD  ClosingRecordNumber;
+  DWORD  StringOffset;
+  DWORD  UserSidLength;
+  DWORD  UserSidOffset;
+  DWORD  DataLength;
+  DWORD  DataOffset;
 
 /*
-  Then follow: 
-  
-  TCHAR SourceName[] 
-  TCHAR Computername[] 
-  SID   UserSid 
-  TCHAR Strings[] 
-  BYTE  Data[] 
-  CHAR  Pad[] 
-  DWORD Length; 
+  Then follow:
+
+  TCHAR SourceName[]
+  TCHAR Computername[]
+  SID   UserSid
+  TCHAR Strings[]
+  BYTE  Data[]
+  CHAR  Pad[]
+  DWORD Length;
 */
-  
-} EVENTLOGRECORD; 
+
+} EVENTLOGRECORD;
+
 typedef struct tagEVENTMSG {
-  UINT  message; 
-  UINT  paramL; 
-  UINT  paramH; 
-  DWORD time; 
-  HWND  hwnd; 
-} EVENTMSG; 
-typedef struct _EXT_BUTTON { 
-  WORD idCommand; 
-  WORD idsHelp; 
-  WORD fsStyle; 
-} EXT_BUTTON, *LPEXT_BUTTON; 
-typedef struct tagFILTERKEYS {   
-  UINT  cbSize; 
-  DWORD dwFlags; 
-  DWORD iWaitMSec; 
-  DWORD iDelayMSec; 
-  DWORD iRepeatMSec; 
-  DWORD iBounceMSec; 
-} FILTERKEYS; 
-typedef struct _FIND_NAME_BUFFER { 
-  UCHAR length; 
-  UCHAR access_control; 
-  UCHAR frame_control; 
-  UCHAR destination_addr[6]; 
-  UCHAR source_addr[6]; 
-  UCHAR routing_info[18]; 
-} FIND_NAME_BUFFER; 
-typedef struct _FIND_NAME_HEADER { 
-  WORD  node_count; 
-  UCHAR reserved; 
-  UCHAR unique_group; 
-} FIND_NAME_HEADER; 
+  UINT  message;
+  UINT  paramL;
+  UINT  paramH;
+  DWORD time;
+  HWND  hwnd;
+} EVENTMSG;
+
+typedef struct _EXT_BUTTON {
+  WORD idCommand;
+  WORD idsHelp;
+  WORD fsStyle;
+} EXT_BUTTON, *LPEXT_BUTTON;
+
+typedef struct tagFILTERKEYS {
+  UINT  cbSize;
+  DWORD dwFlags;
+  DWORD iWaitMSec;
+  DWORD iDelayMSec;
+  DWORD iRepeatMSec;
+  DWORD iBounceMSec;
+} FILTERKEYS;
+
+typedef struct _FIND_NAME_BUFFER {
+  UCHAR length;
+  UCHAR access_control;
+  UCHAR frame_control;
+  UCHAR destination_addr[6];
+  UCHAR source_addr[6];
+  UCHAR routing_info[18];
+} FIND_NAME_BUFFER;
+
+typedef struct _FIND_NAME_HEADER {
+  WORD  node_count;
+  UCHAR reserved;
+  UCHAR unique_group;
+} FIND_NAME_HEADER;
+
 typedef
 enum _FINDEX_INFO_LEVELS
 {
@@ -1946,91 +1946,91 @@ enum _FINDEX_SEARCH_OPS
        FindExSearchLimitToDirectories,
        FindExSearchLimitToDevices,
        FindExSearchMaxSearchOp
-               
+
 } FINDEX_SEARCH_OPS;
 
 #define FIND_FIRST_EX_CASE_SENSITIVE   0x00000001
 
-typedef struct {   
-  DWORD        lStructSize; 
-  HWND         hwndOwner; 
-  HINSTANCE    hInstance; 
-  DWORD        Flags; 
-  LPTSTR        lpstrFindWhat; 
-  LPTSTR        lpstrReplaceWith; 
-  WORD         wFindWhatLen; 
-  WORD         wReplaceWithLen; 
-  LPARAM        lCustData; 
-  LPFRHOOKPROC lpfnHook; 
-  LPCTSTR       lpTemplateName; 
-} FINDREPLACE, *LPFINDREPLACE; 
-typedef struct _findtext { 
-  CHARRANGE chrg; 
-  LPSTR lpstrText; 
-} FINDTEXT; 
-typedef struct _findtextex { 
-  CHARRANGE chrg;  
-  LPSTR lpstrText; 
-  CHARRANGE chrgText; 
-} FINDTEXTEX; 
-typedef struct _FMS_GETDRIVEINFO { 
-  DWORD dwTotalSpace; 
-  DWORD dwFreeSpace; 
-  TCHAR  szPath[260]; 
-  TCHAR  szVolume[14]; 
-  TCHAR  szShare[128]; 
-} FMS_GETDRIVEINFO; 
-typedef struct _FMS_GETFILESEL { 
-  FILETIME ftTime; 
-  DWORD    dwSize; 
-  BYTE     bAttr; 
-  TCHAR     szName[260]; 
-} FMS_GETFILESEL; 
-typedef struct _FMS_LOAD { 
-  DWORD dwSize; 
-  TCHAR  szMenuName[MENU_TEXT_LEN]; 
-  HMENU hMenu; 
-  UINT  wMenuDelta; 
-} FMS_LOAD; 
-typedef struct _FMS_TOOLBARLOAD { 
-  DWORD        dwSize; 
-  LPEXT_BUTTON lpButtons; 
-  WORD         cButtons; 
-  WORD         cBitmaps; 
-  WORD         idBitmap; 
-  HBITMAP      hBitmap; 
-} FMS_TOOLBARLOAD; 
-typedef struct _FORM_INFO_1 { 
-  DWORD Flags; 
-  LPTSTR pName; 
-  SIZEL  Size; 
-  RECTL  ImageableArea; 
-} FORM_INFO_1; 
-typedef struct _FORMAT_PARAMETERS { 
-  MEDIA_TYPE MediaType; 
-  DWORD StartCylinderNumber; 
-  DWORD EndCylinderNumber; 
-  DWORD StartHeadNumber; 
-  DWORD EndHeadNumber; 
-} FORMAT_PARAMETERS ; 
-typedef struct _formatrange { 
-  HDC hdc; 
-  HDC hdcTarget; 
-  RECT rc; 
-  RECT rcPage; 
-  CHARRANGE chrg; 
-} FORMATRANGE;       
+typedef struct {
+  DWORD        lStructSize;
+  HWND         hwndOwner;
+  HINSTANCE    hInstance;
+  DWORD        Flags;
+  LPTSTR        lpstrFindWhat;
+  LPTSTR        lpstrReplaceWith;
+  WORD         wFindWhatLen;
+  WORD         wReplaceWithLen;
+  LPARAM        lCustData;
+  LPFRHOOKPROC lpfnHook;
+  LPCTSTR       lpTemplateName;
+} FINDREPLACE, *LPFINDREPLACE;
+
+typedef struct _findtext {
+  CHARRANGE chrg;
+  LPSTR lpstrText;
+} FINDTEXT;
+
+typedef struct _findtextex {
+  CHARRANGE chrg;
+  LPSTR lpstrText;
+  CHARRANGE chrgText;
+} FINDTEXTEX;
+
+typedef struct _FMS_GETDRIVEINFO {
+  DWORD dwTotalSpace;
+  DWORD dwFreeSpace;
+  TCHAR  szPath[260];
+  TCHAR  szVolume[14];
+  TCHAR  szShare[128];
+} FMS_GETDRIVEINFO;
+
+typedef struct _FMS_GETFILESEL {
+  FILETIME ftTime;
+  DWORD    dwSize;
+  BYTE     bAttr;
+  TCHAR     szName[260];
+} FMS_GETFILESEL;
+
+typedef struct _FMS_LOAD {
+  DWORD dwSize;
+  TCHAR  szMenuName[MENU_TEXT_LEN];
+  HMENU hMenu;
+  UINT  wMenuDelta;
+} FMS_LOAD;
+
+typedef struct _FMS_TOOLBARLOAD {
+  DWORD        dwSize;
+  LPEXT_BUTTON lpButtons;
+  WORD         cButtons;
+  WORD         cBitmaps;
+  WORD         idBitmap;
+  HBITMAP      hBitmap;
+} FMS_TOOLBARLOAD;
+
+
+typedef struct _FORM_INFO_1 {
+  DWORD Flags;
+  LPTSTR pName;
+  SIZEL  Size;
+  RECTL  ImageableArea;
+} FORM_INFO_1;
+
+typedef struct _FORMAT_PARAMETERS {
+  MEDIA_TYPE MediaType;
+  DWORD StartCylinderNumber;
+  DWORD EndCylinderNumber;
+  DWORD StartHeadNumber;
+  DWORD EndHeadNumber;
+} FORMAT_PARAMETERS ;
+
+typedef struct _formatrange {
+  HDC hdc;
+  HDC hdcTarget;
+  RECT rc;
+  RECT rcPage;
+  CHARRANGE chrg;
+} FORMATRANGE;
+
 typedef struct tagGCP_RESULTS {
   DWORD  lStructSize;
   LPTSTR  lpOutString;
@@ -2042,1032 +2042,1032 @@ typedef struct tagGCP_RESULTS {
   UINT  nGlyphs;
   UINT  nMaxFit;
 } GCP_RESULTS, *LPGCP_RESULTS;
-typedef struct _GLYPHMETRICS { 
-  UINT  gmBlackBoxX; 
-  UINT  gmBlackBoxY; 
-  POINT gmptGlyphOrigin; 
-  short gmCellIncX; 
-  short gmCellIncY; 
-} GLYPHMETRICS, *LPGLYPHMETRICS; 
-typedef struct tagHANDLETABLE { 
-  HGDIOBJ objectHandle[1]; 
-} HANDLETABLE, *LPHANDLETABLE; 
-
-typedef struct _HD_HITTESTINFO { 
-  POINT pt; 
-  UINT flags; 
-  int iItem; 
-} HD_HITTESTINFO; 
-typedef struct _HD_ITEM { 
-  UINT    mask; 
-  int     cxy; 
-  LPTSTR   pszText; 
-  HBITMAP hbm; 
-  int     cchTextMax; 
-  int     fmt; 
-  LPARAM  lParam; 
-} HD_ITEM; 
-typedef struct _WINDOWPOS { 
-  HWND hwnd; 
-  HWND hwndInsertAfter; 
-  int  x; 
-  int  y; 
-  int  cx; 
-  int  cy; 
-  UINT flags; 
-} WINDOWPOS, *PWINDOWPOS, *LPWINDOWPOS; 
-typedef struct _HD_LAYOUT { 
-  RECT  * prc; 
-  WINDOWPOS  * pwpos; 
-} HD_LAYOUT; 
-typedef struct _HD_NOTIFY { 
-  NMHDR   hdr; 
-  int     iItem; 
-  int     iButton; 
-  HD_ITEM  * pitem; 
-} HD_NOTIFY; 
-typedef  struct  tagHELPINFO { 
-  UINT   cbSize; 
-  int    iContextType; 
-  int    iCtrlId; 
-  HANDLE hItemHandle; 
-  DWORD  dwContextId; 
-  POINT  MousePos; 
-} HELPINFO,   *LPHELPINFO; 
-typedef struct {   
-  int   wStructSize; 
-  int   x; 
-  int   y; 
-  int   dx; 
-  int   dy; 
-  int   wMax; 
-  TCHAR rgchMember[2]; 
-} HELPWININFO; 
-typedef struct tagHIGHCONTRAST {  
-  UINT cbSize; 
-  DWORD dwFlags; 
-  LPTSTR lpszDefaultScheme; 
-} HIGHCONTRAST,  * LPHIGHCONTRAST; 
-typedef struct tagHSZPAIR { 
-  HSZ hszSvc; 
-  HSZ hszTopic; 
-} HSZPAIR; 
-typedef struct _ICONINFO { 
-  WINBOOL    fIcon; 
-  DWORD   xHotspot; 
-  DWORD   yHotspot; 
-  HBITMAP hbmMask; 
-  HBITMAP hbmColor; 
-} ICONINFO, *PICONINFO; 
-typedef struct tagICONMETRICS { 
-  UINT    cbSize; 
-  int     iHorzSpacing; 
-  int     iVertSpacing; 
-  int     iTitleWrap; 
-  LOGFONT lfFont; 
-} ICONMETRICS,   *LPICONMETRICS; 
-typedef struct _IMAGEINFO { 
-  HBITMAP hbmImage; 
-  HBITMAP hbmMask;  
-  int     Unused1;  
-  int     Unused2;  
-  RECT    rcImage;  
-} IMAGEINFO; 
-    
-typedef struct _JOB_INFO_1 {  
-  DWORD  JobId; 
-  LPTSTR pPrinterName; 
-  LPTSTR pMachineName; 
-  LPTSTR pUserName; 
-  LPTSTR pDocument; 
-  LPTSTR pDatatype; 
-  LPTSTR pStatus; 
-  DWORD  Status; 
-  DWORD  Priority; 
-  DWORD  Position; 
-  DWORD  TotalPages; 
-  DWORD  PagesPrinted; 
-  SYSTEMTIME Submitted; 
-} JOB_INFO_1; 
-#if 0 
-typedef struct _JOB_INFO_2 { 
-  DWORD      JobId; 
-  LPTSTR     pPrinterName; 
-  LPTSTR     pMachineName; 
-  LPTSTR     pUserName; 
-  LPTSTR     pDocument; 
-  LPTSTR     pNotifyName; 
-  LPTSTR     pDatatype; 
-  LPTSTR     pPrintProcessor; 
-  LPTSTR     pParameters; 
-  LPTSTR     pDriverName; 
-  LPDEVMODE  pDevMode; 
-  LPTSTR     pStatus; 
-  PSECURITY_DESCRIPTOR pSecurityDescriptor; 
-  DWORD      Status; 
-  DWORD      Priority; 
-  DWORD      Position; 
-  DWORD      StartTime; 
-  DWORD      UntilTime; 
-  DWORD      TotalPages; 
-  DWORD      Size; 
-  SYSTEMTIME Submitted; 
-  DWORD      Time; 
-  DWORD      PagesPrinted ; 
-} JOB_INFO_2; 
+
+
+typedef struct _GLYPHMETRICS {
+  UINT  gmBlackBoxX;
+  UINT  gmBlackBoxY;
+  POINT gmptGlyphOrigin;
+  short gmCellIncX;
+  short gmCellIncY;
+} GLYPHMETRICS, *LPGLYPHMETRICS;
+
+typedef struct tagHANDLETABLE {
+  HGDIOBJ objectHandle[1];
+} HANDLETABLE, *LPHANDLETABLE;
+
+typedef struct _HD_HITTESTINFO {
+  POINT pt;
+  UINT flags;
+  int iItem;
+} HD_HITTESTINFO;
+
+typedef struct _HD_ITEM {
+  UINT    mask;
+  int     cxy;
+  LPTSTR   pszText;
+  HBITMAP hbm;
+  int     cchTextMax;
+  int     fmt;
+  LPARAM  lParam;
+} HD_ITEM;
+
+typedef struct _WINDOWPOS {
+  HWND hwnd;
+  HWND hwndInsertAfter;
+  int  x;
+  int  y;
+  int  cx;
+  int  cy;
+  UINT flags;
+} WINDOWPOS, *PWINDOWPOS, *LPWINDOWPOS;
+
+typedef struct _HD_LAYOUT {
+  RECT  * prc;
+  WINDOWPOS  * pwpos;
+} HD_LAYOUT;
+
+typedef struct _HD_NOTIFY {
+  NMHDR   hdr;
+  int     iItem;
+  int     iButton;
+  HD_ITEM  * pitem;
+} HD_NOTIFY;
+
+typedef  struct  tagHELPINFO {
+  UINT   cbSize;
+  int    iContextType;
+  int    iCtrlId;
+  HANDLE hItemHandle;
+  DWORD  dwContextId;
+  POINT  MousePos;
+} HELPINFO,   *LPHELPINFO;
+
+typedef struct {
+  int   wStructSize;
+  int   x;
+  int   y;
+  int   dx;
+  int   dy;
+  int   wMax;
+  TCHAR rgchMember[2];
+} HELPWININFO;
+
+typedef struct tagHIGHCONTRAST {
+  UINT cbSize;
+  DWORD dwFlags;
+  LPTSTR lpszDefaultScheme;
+} HIGHCONTRAST,  * LPHIGHCONTRAST;
+
+typedef struct tagHSZPAIR {
+  HSZ hszSvc;
+  HSZ hszTopic;
+} HSZPAIR;
+
+typedef struct _ICONINFO {
+  WINBOOL    fIcon;
+  DWORD   xHotspot;
+  DWORD   yHotspot;
+  HBITMAP hbmMask;
+  HBITMAP hbmColor;
+} ICONINFO, *PICONINFO;
+
+typedef struct tagICONMETRICS {
+  UINT    cbSize;
+  int     iHorzSpacing;
+  int     iVertSpacing;
+  int     iTitleWrap;
+  LOGFONT lfFont;
+} ICONMETRICS,   *LPICONMETRICS;
+
+typedef struct _IMAGEINFO {
+  HBITMAP hbmImage;
+  HBITMAP hbmMask;
+  int     Unused1;
+  int     Unused2;
+  RECT    rcImage;
+} IMAGEINFO;
+
+typedef struct _JOB_INFO_1 {
+  DWORD  JobId;
+  LPTSTR pPrinterName;
+  LPTSTR pMachineName;
+  LPTSTR pUserName;
+  LPTSTR pDocument;
+  LPTSTR pDatatype;
+  LPTSTR pStatus;
+  DWORD  Status;
+  DWORD  Priority;
+  DWORD  Position;
+  DWORD  TotalPages;
+  DWORD  PagesPrinted;
+  SYSTEMTIME Submitted;
+} JOB_INFO_1;
+
+#if 0
+typedef struct _JOB_INFO_2 {
+  DWORD      JobId;
+  LPTSTR     pPrinterName;
+  LPTSTR     pMachineName;
+  LPTSTR     pUserName;
+  LPTSTR     pDocument;
+  LPTSTR     pNotifyName;
+  LPTSTR     pDatatype;
+  LPTSTR     pPrintProcessor;
+  LPTSTR     pParameters;
+  LPTSTR     pDriverName;
+  LPDEVMODE  pDevMode;
+  LPTSTR     pStatus;
+  PSECURITY_DESCRIPTOR pSecurityDescriptor;
+  DWORD      Status;
+  DWORD      Priority;
+  DWORD      Position;
+  DWORD      StartTime;
+  DWORD      UntilTime;
+  DWORD      TotalPages;
+  DWORD      Size;
+  SYSTEMTIME Submitted;
+  DWORD      Time;
+  DWORD      PagesPrinted ;
+} JOB_INFO_2;
 #endif
-   
-typedef struct tagKERNINGPAIR { 
-  WORD wFirst; 
-  WORD wSecond; 
-  int  iKernAmount; 
-} KERNINGPAIR, *LPKERNINGPAIR; 
-typedef struct _LANA_ENUM { 
-  UCHAR length; 
-  UCHAR lana[MAX_LANA]; 
-} LANA_ENUM; 
-typedef struct _LDT_ENTRY { 
-  WORD LimitLow; 
-  WORD BaseLow; 
-  union { 
-    struct { 
-      BYTE BaseMid; 
-      BYTE Flags1; 
-      BYTE Flags2; 
-      BYTE BaseHi; 
-    } Bytes; 
-    struct { 
-      DWORD BaseMid : 8; 
-      DWORD Type : 5; 
-      DWORD Dpl : 2; 
-      DWORD Pres : 1; 
-      DWORD LimitHi : 4; 
-      DWORD Sys : 1; 
-      DWORD Reserved_0 : 1; 
-      DWORD Default_Big : 1; 
-      DWORD Granularity : 1; 
-      DWORD BaseHi : 8; 
-    } Bits; 
-  } HighWord; 
-} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; 
+
+typedef struct tagKERNINGPAIR {
+  WORD wFirst;
+  WORD wSecond;
+  int  iKernAmount;
+} KERNINGPAIR, *LPKERNINGPAIR;
+
+typedef struct _LANA_ENUM {
+  UCHAR length;
+  UCHAR lana[MAX_LANA];
+} LANA_ENUM;
+
+typedef struct _LDT_ENTRY {
+  WORD LimitLow;
+  WORD BaseLow;
+  union {
+    struct {
+      BYTE BaseMid;
+      BYTE Flags1;
+      BYTE Flags2;
+      BYTE BaseHi;
+    } Bytes;
+    struct {
+      DWORD BaseMid : 8;
+      DWORD Type : 5;
+      DWORD Dpl : 2;
+      DWORD Pres : 1;
+      DWORD LimitHi : 4;
+      DWORD Sys : 1;
+      DWORD Reserved_0 : 1;
+      DWORD Default_Big : 1;
+      DWORD Granularity : 1;
+      DWORD BaseHi : 8;
+    } Bits;
+  } HighWord;
+} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
+
 typedef struct tagLOCALESIGNATURE {
   DWORD  lsUsb[4];
   DWORD  lsCsbDefault[2];
   DWORD  lsCsbSupported[2];
-} LOCALESIGNATURE; 
+} LOCALESIGNATURE;
 
    #if 0
-typedef struct _LOCALGROUP_MEMBERS_INFO_0 {  
-  PSID  lgrmi0_sid; 
-} LOCALGROUP_MEMBERS_INFO_0; 
+typedef struct _LOCALGROUP_MEMBERS_INFO_0 {
+  PSID  lgrmi0_sid;
+} LOCALGROUP_MEMBERS_INFO_0;
  #endif
-   
-typedef struct _LOCALGROUP_MEMBERS_INFO_3 {  
-  LPWSTR  lgrmi3_domainandname; 
-} LOCALGROUP_MEMBERS_INFO_3; 
-typedef long FXPT16DOT16,  * LPFXPT16DOT16; 
+
+typedef struct _LOCALGROUP_MEMBERS_INFO_3 {
+  LPWSTR  lgrmi3_domainandname;
+} LOCALGROUP_MEMBERS_INFO_3;
+
+typedef long FXPT16DOT16,  * LPFXPT16DOT16;
+
 
 
 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
 
-typedef struct _LV_COLUMN { 
-  UINT mask;       
-  int fmt;         
-  int cx;          
-  LPTSTR pszText;  
-  int cchTextMax;  
-  int iSubItem;    
-} LV_COLUMN; 
-typedef struct _LV_ITEM { 
-  UINT   mask;         
-  int    iItem;        
-  int    iSubItem;     
-  UINT   state;        
-  UINT   stateMask;    
-  LPTSTR  pszText;     
-  int    cchTextMax;   
-  int    iImage;      
-  LPARAM lParam;      
-} LV_ITEM; 
-typedef struct tagLV_DISPINFO { 
-  NMHDR   hdr;   
-  LV_ITEM item;  
-} LV_DISPINFO; 
-typedef struct _LV_FINDINFO { 
-  UINT flags;        
-  LPCTSTR psz;        
-  LPARAM lParam;     
-  POINT pt;          
-  UINT vkDirection;  
-} LV_FINDINFO; 
-typedef struct _LV_HITTESTINFO { 
-  POINT pt;    
-  UINT flags;  
-  int iItem;   
-} LV_HITTESTINFO; 
-typedef struct tagLV_KEYDOWN { 
-  NMHDR hdr;   
-  WORD wVKey;  
-  UINT flags;  
-} LV_KEYDOWN; 
-typedef struct _MAT2 { 
-  FIXED eM11; 
-  FIXED eM12; 
-  FIXED eM21; 
-  FIXED eM22; 
-} MAT2, *LPMAT2; 
-typedef struct tagMDICREATESTRUCT { 
-  LPCTSTR szClass; 
-  LPCTSTR szTitle; 
-  HANDLE  hOwner; 
-  int     x; 
-  int     y; 
-  int     cx; 
-  int     cy; 
-  DWORD   style; 
-  LPARAM  lParam; 
-} MDICREATESTRUCT; 
+typedef struct _LV_COLUMN {
+  UINT mask;
+  int fmt;
+  int cx;
+  LPTSTR pszText;
+  int cchTextMax;
+  int iSubItem;
+} LV_COLUMN;
+
+typedef struct _LV_ITEM {
+  UINT   mask;
+  int    iItem;
+  int    iSubItem;
+  UINT   state;
+  UINT   stateMask;
+  LPTSTR  pszText;
+  int    cchTextMax;
+  int    iImage;
+  LPARAM lParam;
+} LV_ITEM;
+
+typedef struct tagLV_DISPINFO {
+  NMHDR   hdr;
+  LV_ITEM item;
+} LV_DISPINFO;
+
+typedef struct _LV_FINDINFO {
+  UINT flags;
+  LPCTSTR psz;
+  LPARAM lParam;
+  POINT pt;
+  UINT vkDirection;
+} LV_FINDINFO;
+
+typedef struct _LV_HITTESTINFO {
+  POINT pt;
+  UINT flags;
+  int iItem;
+} LV_HITTESTINFO;
+
+typedef struct tagLV_KEYDOWN {
+  NMHDR hdr;
+  WORD wVKey;
+  UINT flags;
+} LV_KEYDOWN;
+
+typedef struct _MAT2 {
+  FIXED eM11;
+  FIXED eM12;
+  FIXED eM21;
+  FIXED eM22;
+} MAT2, *LPMAT2;
+
+typedef struct tagMDICREATESTRUCT {
+  LPCTSTR szClass;
+  LPCTSTR szTitle;
+  HANDLE  hOwner;
+  int     x;
+  int     y;
+  int     cx;
+  int     cy;
+  DWORD   style;
+  LPARAM  lParam;
+} MDICREATESTRUCT;
 
 typedef MDICREATESTRUCT *LPMDICREATESTRUCT;
-typedef struct tagMEASUREITEMSTRUCT { 
-  UINT  CtlType;      
-  UINT  CtlID;        
-  UINT  itemID;       
-  UINT  itemWidth;    
-  UINT  itemHeight;   
-  DWORD itemData;     
-} MEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT; 
-typedef struct _MEMORYSTATUS { 
-  DWORD dwLength;        
-  DWORD dwMemoryLoad;    
-  DWORD dwTotalPhys;     
-  DWORD dwAvailPhys;     
-  DWORD dwTotalPageFile; 
-  DWORD dwAvailPageFile; 
-  DWORD dwTotalVirtual;  
-  DWORD dwAvailVirtual;  
-} MEMORYSTATUS, *LPMEMORYSTATUS; 
+
+typedef struct tagMEASUREITEMSTRUCT {
+  UINT  CtlType;
+  UINT  CtlID;
+  UINT  itemID;
+  UINT  itemWidth;
+  UINT  itemHeight;
+  DWORD itemData;
+} MEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT;
+
+typedef struct _MEMORYSTATUS {
+  DWORD dwLength;
+  DWORD dwMemoryLoad;
+  DWORD dwTotalPhys;
+  DWORD dwAvailPhys;
+  DWORD dwTotalPageFile;
+  DWORD dwAvailPageFile;
+  DWORD dwTotalVirtual;
+  DWORD dwAvailVirtual;
+} MEMORYSTATUS, *LPMEMORYSTATUS;
+
 typedef struct {
-  WORD  wVersion; 
-  WORD  wOffset; 
-  DWORD dwHelpId; 
+  WORD  wVersion;
+  WORD  wOffset;
+  DWORD dwHelpId;
 } MENUEX_TEMPLATE_HEADER;
 
-typedef struct { 
-  DWORD  dwType; 
-  DWORD  dwState; 
-  UINT   uId; 
-  BYTE   bResInfo; 
-  WCHAR  szText[1]; 
-  DWORD dwHelpId; 
-} MENUEX_TEMPLATE_ITEM; 
+typedef struct {
+  DWORD  dwType;
+  DWORD  dwState;
+  UINT   uId;
+  BYTE   bResInfo;
+  WCHAR  szText[1];
+  DWORD dwHelpId;
+} MENUEX_TEMPLATE_ITEM;
 
 typedef struct tagMENUITEMINFO {
-  UINT    cbSize; 
-  UINT    fMask; 
-  UINT    fType; 
-  UINT    fState; 
-  UINT    wID; 
-  HMENU   hSubMenu; 
-  HBITMAP hbmpChecked; 
-  HBITMAP hbmpUnchecked; 
-  DWORD   dwItemData; 
-  LPTSTR  dwTypeData; 
-  UINT    cch; 
-} MENUITEMINFO, *LPMENUITEMINFO; 
+  UINT    cbSize;
+  UINT    fMask;
+  UINT    fType;
+  UINT    fState;
+  UINT    wID;
+  HMENU   hSubMenu;
+  HBITMAP hbmpChecked;
+  HBITMAP hbmpUnchecked;
+  DWORD   dwItemData;
+  LPTSTR  dwTypeData;
+  UINT    cch;
+} MENUITEMINFO, *LPMENUITEMINFO;
 typedef MENUITEMINFO CONST *LPCMENUITEMINFO;
-typedef struct {   
-  WORD mtOption;      
-  WORD mtID;          
-  WCHAR mtString[1];  
-} MENUITEMTEMPLATE; 
-typedef struct {      
-  WORD versionNumber; 
-  WORD offset;        
-} MENUITEMTEMPLATEHEADER; 
+
+typedef struct {
+  WORD mtOption;
+  WORD mtID;
+  WCHAR mtString[1];
+} MENUITEMTEMPLATE;
+
+typedef struct {
+  WORD versionNumber;
+  WORD offset;
+} MENUITEMTEMPLATEHEADER;
 typedef VOID MENUTEMPLATE, *LPMENUTEMPLATE;
-typedef struct tagMETAFILEPICT { 
+
+typedef struct tagMETAFILEPICT {
 #if 0
-  LONG      mm; 
-  LONG      xExt; 
-  LONG      yExt; 
-  HMETAFILE hMF; 
+  LONG      mm;
+  LONG      xExt;
+  LONG      yExt;
+  HMETAFILE hMF;
 #endif
-} METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT; 
-   
-typedef struct tagMETAHEADER {  
-  WORD  mtType; 
-  WORD  mtHeaderSize; 
-  WORD  mtVersion; 
-  DWORD mtSize; 
-  WORD  mtNoObjects; 
-  DWORD mtMaxRecord; 
-  WORD  mtNoParameters; 
+} METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT;
+
+typedef struct tagMETAHEADER {
+  WORD  mtType;
+  WORD  mtHeaderSize;
+  WORD  mtVersion;
+  DWORD mtSize;
+  WORD  mtNoObjects;
+  DWORD mtMaxRecord;
+  WORD  mtNoParameters;
 } METAHEADER PACKED;
-typedef struct tagMETARECORD {  
-  DWORD rdSize; 
-  WORD  rdFunction; 
-  WORD  rdParm[1]; 
-} METARECORD, *LPMETARECORD; 
-typedef struct tagMINIMIZEDMETRICS { 
-  UINT    cbSize; 
-  int     iWidth; 
-  int     iHorzGap; 
-  int     iVertGap; 
-  int     iArrange; 
-}   MINIMIZEDMETRICS,   *LPMINIMIZEDMETRICS; 
-typedef struct tagMINMAXINFO {  
-  POINT ptReserved;         
-  POINT ptMaxSize;          
-  POINT ptMaxPosition;      
-  POINT ptMinTrackSize;     
-  POINT ptMaxTrackSize;     
-} MINMAXINFO; 
+
+typedef struct tagMETARECORD {
+  DWORD rdSize;
+  WORD  rdFunction;
+  WORD  rdParm[1];
+} METARECORD, *LPMETARECORD;
+
+typedef struct tagMINIMIZEDMETRICS {
+  UINT    cbSize;
+  int     iWidth;
+  int     iHorzGap;
+  int     iVertGap;
+  int     iArrange;
+}   MINIMIZEDMETRICS,   *LPMINIMIZEDMETRICS;
+
+typedef struct tagMINMAXINFO {
+  POINT ptReserved;
+  POINT ptMaxSize;
+  POINT ptMaxPosition;
+  POINT ptMinTrackSize;
+  POINT ptMaxTrackSize;
+} MINMAXINFO;
+
 typedef struct modemdevcaps_tag {
-  DWORD dwActualSize;           
-  DWORD dwRequiredSize;         
-  DWORD dwDevSpecificOffset;    
-  DWORD dwDevSpecificSize;      
-
-  DWORD dwModemProviderVersion; 
-  DWORD dwModemManufacturerOffset; 
-  DWORD dwModemManufacturerSize;   
-  DWORD dwModemModelOffset;        
-  DWORD dwModemModelSize;          
-  DWORD dwModemVersionOffset;      
-  DWORD dwModemVersionSize;        
-
-  DWORD dwDialOptions;             
-  DWORD dwCallSetupFailTimer;      
-  DWORD dwInactivityTimeout;       
-  DWORD dwSpeakerVolume;           
-  DWORD dwSpeakerMode;             
-  DWORD dwModemOptions;            
-  DWORD dwMaxDTERate;              
-  DWORD dwMaxDCERate;              
-
-  BYTE abVariablePortion [1];    
+  DWORD dwActualSize;
+  DWORD dwRequiredSize;
+  DWORD dwDevSpecificOffset;
+  DWORD dwDevSpecificSize;
+
+  DWORD dwModemProviderVersion;
+  DWORD dwModemManufacturerOffset;
+  DWORD dwModemManufacturerSize;
+  DWORD dwModemModelOffset;
+  DWORD dwModemModelSize;
+  DWORD dwModemVersionOffset;
+  DWORD dwModemVersionSize;
+
+  DWORD dwDialOptions;
+  DWORD dwCallSetupFailTimer;
+  DWORD dwInactivityTimeout;
+  DWORD dwSpeakerVolume;
+  DWORD dwSpeakerMode;
+  DWORD dwModemOptions;
+  DWORD dwMaxDTERate;
+  DWORD dwMaxDCERate;
+
+  BYTE abVariablePortion [1];
 } MODEMDEVCAPS, *PMODEMDEVCAPS, *LPMODEMDEVCAPS;
+
 typedef struct modemsettings_tag {
-  DWORD dwActualSize;            
-  DWORD dwRequiredSize;          
-  DWORD dwDevSpecificOffset;     
-  DWORD dwDevSpecificSize;       
+  DWORD dwActualSize;
+  DWORD dwRequiredSize;
+  DWORD dwDevSpecificOffset;
+  DWORD dwDevSpecificSize;
 
-  DWORD dwCallSetupFailTimer;    
-  DWORD dwInactivityTimeout;     
-  DWORD dwSpeakerVolume;         
-  DWORD dwSpeakerMode;           
-  DWORD dwPreferredModemOptions; 
+  DWORD dwCallSetupFailTimer;
+  DWORD dwInactivityTimeout;
+  DWORD dwSpeakerVolume;
+  DWORD dwSpeakerMode;
+  DWORD dwPreferredModemOptions;
 
-  DWORD dwNegotiatedModemOptions; 
-  DWORD dwNegotiatedDCERate;      
+  DWORD dwNegotiatedModemOptions;
+  DWORD dwNegotiatedDCERate;
 
-  BYTE  abVariablePortion[1];     
+  BYTE  abVariablePortion[1];
 } MODEMSETTINGS, *PMODEMSETTINGS, *LPMODEMSETTINGS;
-typedef struct tagMONCBSTRUCT { 
-  UINT   cb; 
-  DWORD  dwTime; 
-  HANDLE hTask; 
-  DWORD  dwRet; 
-  UINT   wType; 
-  UINT   wFmt; 
-  HCONV  hConv; 
-  HSZ    hsz1; 
-  HSZ    hsz2; 
-  HDDEDATA hData; 
-  DWORD    dwData1; 
-  DWORD    dwData2; 
-  CONVCONTEXT cc; 
-  DWORD  cbData; 
-  DWORD  Data[8]; 
-} MONCBSTRUCT; 
-typedef struct tagMONCONVSTRUCT { 
-  UINT   cb; 
-  WINBOOL   fConnect; 
-  DWORD  dwTime; 
-  HANDLE hTask; 
-  HSZ    hszSvc; 
-  HSZ    hszTopic; 
-  HCONV  hConvClient; 
-  HCONV  hConvServer; 
-} MONCONVSTRUCT; 
-typedef struct tagMONERRSTRUCT { 
-  UINT   cb; 
-  UINT   wLastError; 
-  DWORD  dwTime; 
-  HANDLE hTask; 
-} MONERRSTRUCT; 
-typedef struct tagMONHSZSTRUCT { 
-  UINT   cb; 
-  WINBOOL   fsAction; 
-  DWORD  dwTime; 
-  HSZ    hsz; 
-  HANDLE hTask; 
-  TCHAR   str[1]; 
-} MONHSZSTRUCT; 
-typedef struct _MONITOR_INFO_1 { 
-  LPTSTR pName; 
-} MONITOR_INFO_1; 
-typedef struct _MONITOR_INFO_2 { 
-  LPTSTR pName; 
-  LPTSTR pEnvironment ; 
-  LPTSTR pDLLName ; 
-} MONITOR_INFO_2; 
-typedef struct tagMONLINKSTRUCT { 
-  UINT   cb; 
-  DWORD  dwTime; 
-  HANDLE hTask; 
-  WINBOOL   fEstablished; 
-  WINBOOL   fNoData; 
-  HSZ    hszSvc; 
-  HSZ    hszTopic; 
-  HSZ    hszItem; 
-  UINT   wFmt; 
-  WINBOOL   fServer; 
-  HCONV  hConvServer; 
-  HCONV  hConvClient; 
-} MONLINKSTRUCT; 
-typedef struct tagMONMSGSTRUCT { 
-  UINT   cb; 
-  HWND   hwndTo; 
-  DWORD  dwTime; 
-  HANDLE hTask; 
-  UINT   wMsg; 
-  WPARAM wParam; 
-  LPARAM lParam; 
-  DDEML_MSG_HOOK_DATA dmhd; 
-} MONMSGSTRUCT; 
-typedef struct tagMOUSEHOOKSTRUCT { 
-  POINT pt; 
-  HWND  hwnd; 
-  UINT  wHitTestCode; 
-  DWORD dwExtraInfo; 
-} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT; 
-typedef struct _MOUSEKEYS { 
-  DWORD cbSize; 
-  DWORD dwFlags; 
-  DWORD iMaxSpeed; 
-  DWORD iTimeToMaxSpeed; 
-  DWORD iCtrlSpeed; 
-  DWORD dwReserved1; 
-  DWORD dwReserved2; 
-} MOUSEKEYS; 
-typedef struct tagMSG {  
-  HWND   hwnd;   
-  UINT   message; 
-  WPARAM wParam; 
-  LPARAM lParam; 
-  DWORD  time; 
-  POINT  pt; 
-} MSG, *LPMSG; 
+
+typedef struct tagMONCBSTRUCT {
+  UINT   cb;
+  DWORD  dwTime;
+  HANDLE hTask;
+  DWORD  dwRet;
+  UINT   wType;
+  UINT   wFmt;
+  HCONV  hConv;
+  HSZ    hsz1;
+  HSZ    hsz2;
+  HDDEDATA hData;
+  DWORD    dwData1;
+  DWORD    dwData2;
+  CONVCONTEXT cc;
+  DWORD  cbData;
+  DWORD  Data[8];
+} MONCBSTRUCT;
+
+typedef struct tagMONCONVSTRUCT {
+  UINT   cb;
+  WINBOOL   fConnect;
+  DWORD  dwTime;
+  HANDLE hTask;
+  HSZ    hszSvc;
+  HSZ    hszTopic;
+  HCONV  hConvClient;
+  HCONV  hConvServer;
+} MONCONVSTRUCT;
+
+typedef struct tagMONERRSTRUCT {
+  UINT   cb;
+  UINT   wLastError;
+  DWORD  dwTime;
+  HANDLE hTask;
+} MONERRSTRUCT;
+
+typedef struct tagMONHSZSTRUCT {
+  UINT   cb;
+  WINBOOL   fsAction;
+  DWORD  dwTime;
+  HSZ    hsz;
+  HANDLE hTask;
+  TCHAR   str[1];
+} MONHSZSTRUCT;
+
+typedef struct _MONITOR_INFO_1 {
+  LPTSTR pName;
+} MONITOR_INFO_1;
+
+typedef struct _MONITOR_INFO_2 {
+  LPTSTR pName;
+  LPTSTR pEnvironment ;
+  LPTSTR pDLLName ;
+} MONITOR_INFO_2;
+
+typedef struct tagMONLINKSTRUCT {
+  UINT   cb;
+  DWORD  dwTime;
+  HANDLE hTask;
+  WINBOOL   fEstablished;
+  WINBOOL   fNoData;
+  HSZ    hszSvc;
+  HSZ    hszTopic;
+  HSZ    hszItem;
+  UINT   wFmt;
+  WINBOOL   fServer;
+  HCONV  hConvServer;
+  HCONV  hConvClient;
+} MONLINKSTRUCT;
+
+typedef struct tagMONMSGSTRUCT {
+  UINT   cb;
+  HWND   hwndTo;
+  DWORD  dwTime;
+  HANDLE hTask;
+  UINT   wMsg;
+  WPARAM wParam;
+  LPARAM lParam;
+  DDEML_MSG_HOOK_DATA dmhd;
+} MONMSGSTRUCT;
+
+typedef struct tagMOUSEHOOKSTRUCT {
+  POINT pt;
+  HWND  hwnd;
+  UINT  wHitTestCode;
+  DWORD dwExtraInfo;
+} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;
+
+typedef struct _MOUSEKEYS {
+  DWORD cbSize;
+  DWORD dwFlags;
+  DWORD iMaxSpeed;
+  DWORD iTimeToMaxSpeed;
+  DWORD iCtrlSpeed;
+  DWORD dwReserved1;
+  DWORD dwReserved2;
+} MOUSEKEYS;
+
+typedef struct tagMSG {
+  HWND   hwnd;
+  UINT   message;
+  WPARAM wParam;
+  LPARAM lParam;
+  DWORD  time;
+  POINT  pt;
+} MSG, *LPMSG;
+
 typedef void CALLBACK (*MSGBOXCALLBACK) (LPHELPINFO lpHelpInfo);
 
-typedef struct { 
-  UINT      cbSize; 
-  HWND      hwndOwner; 
-  HINSTANCE hInstance; 
-  LPCSTR    lpszText; 
-  LPCSTR    lpszCaption; 
-  DWORD     dwStyle; 
-  LPCSTR    lpszIcon; 
-  DWORD     dwContextHelpId; 
-  MSGBOXCALLBACK lpfnMsgBoxCallback; 
-  DWORD     dwLanguageId; 
-} MSGBOXPARAMS, *PMSGBOXPARAMS,   *LPMSGBOXPARAMS; 
-
-typedef struct _msgfilter { 
-  NMHDR nmhdr; 
-  UINT msg; 
-  WPARAM wParam; 
-  LPARAM lParam; 
-} MSGFILTER; 
-typedef struct tagMULTIKEYHELP { 
-  DWORD  mkSize; 
-  TCHAR  mkKeylist; 
-  TCHAR  szKeyphrase[1]; 
-} MULTIKEYHELP; 
-typedef struct _NAME_BUFFER { 
-  UCHAR name[NCBNAMSZ]; 
-  UCHAR name_num; 
-  UCHAR name_flags; 
-} NAME_BUFFER; 
-typedef struct _NCB { 
-  UCHAR  ncb_command; 
-  UCHAR  ncb_retcode; 
-  UCHAR  ncb_lsn; 
-  UCHAR  ncb_num; 
-  PUCHAR ncb_buffer; 
-  WORD   ncb_length; 
-  UCHAR  ncb_callname[NCBNAMSZ]; 
-  UCHAR  ncb_name[NCBNAMSZ]; 
-  UCHAR  ncb_rto; 
-  UCHAR  ncb_sto; 
-  void (*ncb_post) (struct _NCB *); 
-  UCHAR  ncb_lana_num; 
-  UCHAR  ncb_cmd_cplt; 
-  UCHAR  ncb_reserve[10]; 
-  HANDLE ncb_event; 
-} NCB; 
-typedef struct _NCCALCSIZE_PARAMS { 
-  RECT        rgrc[3]; 
-  PWINDOWPOS  lppos; 
-} NCCALCSIZE_PARAMS; 
-typedef struct _NDDESHAREINFO { 
-  LONG   lRevision; 
-  LPTSTR lpszShareName; 
-  LONG   lShareType; 
-  LPTSTR lpszAppTopicList; 
-  LONG   fSharedFlag; 
-  LONG   fService; 
-  LONG   fStartAppFlag; 
-  LONG   nCmdShow; 
-  LONG   qModifyId[2]; 
-  LONG   cNumItems; 
-  LPTSTR lpszItemList; 
-}NDDESHAREINFO; 
-typedef struct _NETRESOURCE { 
-  DWORD  dwScope; 
-  DWORD  dwType; 
-  DWORD  dwDisplayType; 
-  DWORD  dwUsage; 
-  LPTSTR lpLocalName; 
-  LPTSTR lpRemoteName; 
-  LPTSTR lpComment; 
-  LPTSTR lpProvider; 
-} NETRESOURCE, *LPNETRESOURCE; 
+typedef struct {
+  UINT      cbSize;
+  HWND      hwndOwner;
+  HINSTANCE hInstance;
+  LPCSTR    lpszText;
+  LPCSTR    lpszCaption;
+  DWORD     dwStyle;
+  LPCSTR    lpszIcon;
+  DWORD     dwContextHelpId;
+  MSGBOXCALLBACK lpfnMsgBoxCallback;
+  DWORD     dwLanguageId;
+} MSGBOXPARAMS, *PMSGBOXPARAMS,   *LPMSGBOXPARAMS;
+
+typedef struct _msgfilter {
+  NMHDR nmhdr;
+  UINT msg;
+  WPARAM wParam;
+  LPARAM lParam;
+} MSGFILTER;
+
+typedef struct tagMULTIKEYHELP {
+  DWORD  mkSize;
+  TCHAR  mkKeylist;
+  TCHAR  szKeyphrase[1];
+} MULTIKEYHELP;
+
+typedef struct _NAME_BUFFER {
+  UCHAR name[NCBNAMSZ];
+  UCHAR name_num;
+  UCHAR name_flags;
+} NAME_BUFFER;
+
+typedef struct _NCB {
+  UCHAR  ncb_command;
+  UCHAR  ncb_retcode;
+  UCHAR  ncb_lsn;
+  UCHAR  ncb_num;
+  PUCHAR ncb_buffer;
+  WORD   ncb_length;
+  UCHAR  ncb_callname[NCBNAMSZ];
+  UCHAR  ncb_name[NCBNAMSZ];
+  UCHAR  ncb_rto;
+  UCHAR  ncb_sto;
+  void (*ncb_post) (struct _NCB *);
+  UCHAR  ncb_lana_num;
+  UCHAR  ncb_cmd_cplt;
+  UCHAR  ncb_reserve[10];
+  HANDLE ncb_event;
+} NCB;
+
+typedef struct _NCCALCSIZE_PARAMS {
+  RECT        rgrc[3];
+  PWINDOWPOS  lppos;
+} NCCALCSIZE_PARAMS;
+
+typedef struct _NDDESHAREINFO {
+  LONG   lRevision;
+  LPTSTR lpszShareName;
+  LONG   lShareType;
+  LPTSTR lpszAppTopicList;
+  LONG   fSharedFlag;
+  LONG   fService;
+  LONG   fStartAppFlag;
+  LONG   nCmdShow;
+  LONG   qModifyId[2];
+  LONG   cNumItems;
+  LPTSTR lpszItemList;
+}NDDESHAREINFO;
+
+typedef struct _NETRESOURCE {
+  DWORD  dwScope;
+  DWORD  dwType;
+  DWORD  dwDisplayType;
+  DWORD  dwUsage;
+  LPTSTR lpLocalName;
+  LPTSTR lpRemoteName;
+  LPTSTR lpComment;
+  LPTSTR lpProvider;
+} NETRESOURCE, *LPNETRESOURCE;
+
 typedef struct tagNEWCPLINFO {
-  DWORD dwSize; 
-  DWORD dwFlags; 
-  DWORD dwHelpContext; 
-  LONG  lData; 
-  HICON hIcon; 
-  TCHAR  szName[32]; 
-  TCHAR  szInfo[64]; 
-  TCHAR  szHelpFile[128]; 
-} NEWCPLINFO; 
-typedef struct tagNEWTEXTMETRIC { 
-  LONG   tmHeight; 
-  LONG   tmAscent; 
-  LONG   tmDescent; 
-  LONG   tmInternalLeading; 
-  LONG   tmExternalLeading; 
-  LONG   tmAveCharWidth; 
-  LONG   tmMaxCharWidth; 
-  LONG   tmWeight; 
-  LONG   tmOverhang; 
-  LONG   tmDigitizedAspectX; 
-  LONG   tmDigitizedAspectY; 
-  BCHAR  tmFirstChar; 
-  BCHAR  tmLastChar; 
-  BCHAR  tmDefaultChar; 
-  BCHAR  tmBreakChar; 
-  BYTE   tmItalic; 
-  BYTE   tmUnderlined; 
-  BYTE   tmStruckOut; 
-  BYTE   tmPitchAndFamily; 
-  BYTE   tmCharSet; 
-  DWORD  ntmFlags; 
-  UINT   ntmSizeEM; 
-  UINT   ntmCellHeight; 
-  UINT   ntmAvgWidth; 
-} NEWTEXTMETRIC; 
+  DWORD dwSize;
+  DWORD dwFlags;
+  DWORD dwHelpContext;
+  LONG  lData;
+  HICON hIcon;
+  TCHAR  szName[32];
+  TCHAR  szInfo[64];
+  TCHAR  szHelpFile[128];
+} NEWCPLINFO;
+
+typedef struct tagNEWTEXTMETRIC {
+  LONG   tmHeight;
+  LONG   tmAscent;
+  LONG   tmDescent;
+  LONG   tmInternalLeading;
+  LONG   tmExternalLeading;
+  LONG   tmAveCharWidth;
+  LONG   tmMaxCharWidth;
+  LONG   tmWeight;
+  LONG   tmOverhang;
+  LONG   tmDigitizedAspectX;
+  LONG   tmDigitizedAspectY;
+  BCHAR  tmFirstChar;
+  BCHAR  tmLastChar;
+  BCHAR  tmDefaultChar;
+  BCHAR  tmBreakChar;
+  BYTE   tmItalic;
+  BYTE   tmUnderlined;
+  BYTE   tmStruckOut;
+  BYTE   tmPitchAndFamily;
+  BYTE   tmCharSet;
+  DWORD  ntmFlags;
+  UINT   ntmSizeEM;
+  UINT   ntmCellHeight;
+  UINT   ntmAvgWidth;
+} NEWTEXTMETRIC;
+
 
 typedef struct tagNEWTEXTMETRICEX {
   NEWTEXTMETRIC  ntmentm;
   FONTSIGNATURE  ntmeFontSignature;
 } NEWTEXTMETRICEX;
-typedef struct tagNM_LISTVIEW { 
-  NMHDR hdr;        
-  int   iItem;      
-  int   iSubItem;   
-  UINT  uNewState;  
-  UINT  uOldState;  
-  UINT  uChanged;   
-  POINT ptAction;   
-  LPARAM lParam;    
-} NM_LISTVIEW; 
+
+typedef struct tagNM_LISTVIEW {
+  NMHDR hdr;
+  int   iItem;
+  int   iSubItem;
+  UINT  uNewState;
+  UINT  uOldState;
+  UINT  uChanged;
+  POINT ptAction;
+  LPARAM lParam;
+} NM_LISTVIEW;
+
 typedef struct _TREEITEM *HTREEITEM;
 
-typedef struct _TV_ITEM { 
-  UINT       mask;           
-  HTREEITEM  hItem;           
-  UINT       state;           
-  UINT       stateMask;     
-  LPTSTR     pszText;        
-  int        cchTextMax;      
-  int        iImage;          
-  int        iSelectedImage;  
-  int        cChildren;       
-  LPARAM     lParam;          
-} TV_ITEM,   *LPTV_ITEM; 
-typedef struct _NM_TREEVIEW { 
-  NMHDR    hdr;       
-  UINT     action;        
-  TV_ITEM  itemOld;   
-  TV_ITEM  itemNew;   
-  POINT    ptDrag;    
-} NM_TREEVIEW; 
-typedef NM_TREEVIEW   *LPNM_TREEVIEW; 
+typedef struct _TV_ITEM {
+  UINT       mask;
+  HTREEITEM  hItem;
+  UINT       state;
+  UINT       stateMask;
+  LPTSTR     pszText;
+  int        cchTextMax;
+  int        iImage;
+  int        iSelectedImage;
+  int        cChildren;
+  LPARAM     lParam;
+} TV_ITEM,   *LPTV_ITEM;
+
+typedef struct _NM_TREEVIEW {
+  NMHDR    hdr;
+  UINT     action;
+  TV_ITEM  itemOld;
+  TV_ITEM  itemNew;
+  POINT    ptDrag;
+} NM_TREEVIEW;
+typedef NM_TREEVIEW   *LPNM_TREEVIEW;
 
 typedef struct _NM_UPDOWN {
-  NMHDR    hdr;    
-  int     iPos;    
-  int  iDelta;     
-} NM_UPDOWNW; 
-typedef struct tagNONCLIENTMETRICS { 
-  UINT    cbSize; 
-  int     iBorderWidth; 
-  int     iScrollWidth; 
-  int     iScrollHeight; 
-  int     iCaptionWidth; 
-  int     iCaptionHeight; 
-  LOGFONT lfCaptionFont; 
-  int     iSmCaptionWidth; 
-  int     iSmCaptionHeight; 
-  LOGFONT lfSmCaptionFont; 
-  int     iMenuWidth; 
-  int     iMenuHeight; 
-  LOGFONT lfMenuFont; 
-  LOGFONT lfStatusFont; 
-  LOGFONT lfMessageFont; 
-} NONCLIENTMETRICS,  * LPNONCLIENTMETRICS; 
-typedef struct _SERVICE_ADDRESS { 
-  DWORD   dwAddressType; 
-  DWORD   dwAddressFlags; 
-  DWORD   dwAddressLength; 
-  DWORD   dwPrincipalLength; 
-  BYTE   *lpAddress;  
-  BYTE   *lpPrincipal; 
-} SERVICE_ADDRESS; 
-typedef struct _SERVICE_ADDRESSES { 
-  DWORD   dwAddressCount; 
-  SERVICE_ADDRESS   Addresses[1]; 
-} SERVICE_ADDRESSES, *LPSERVICE_ADDRESSES; 
+  NMHDR    hdr;
+  int     iPos;
+  int  iDelta;
+} NM_UPDOWNW;
+
+typedef struct tagNONCLIENTMETRICS {
+  UINT    cbSize;
+  int     iBorderWidth;
+  int     iScrollWidth;
+  int     iScrollHeight;
+  int     iCaptionWidth;
+  int     iCaptionHeight;
+  LOGFONT lfCaptionFont;
+  int     iSmCaptionWidth;
+  int     iSmCaptionHeight;
+  LOGFONT lfSmCaptionFont;
+  int     iMenuWidth;
+  int     iMenuHeight;
+  LOGFONT lfMenuFont;
+  LOGFONT lfStatusFont;
+  LOGFONT lfMessageFont;
+} NONCLIENTMETRICS,  * LPNONCLIENTMETRICS;
+
+typedef struct _SERVICE_ADDRESS {
+  DWORD   dwAddressType;
+  DWORD   dwAddressFlags;
+  DWORD   dwAddressLength;
+  DWORD   dwPrincipalLength;
+  BYTE   *lpAddress;
+  BYTE   *lpPrincipal;
+} SERVICE_ADDRESS;
+
+typedef struct _SERVICE_ADDRESSES {
+  DWORD   dwAddressCount;
+  SERVICE_ADDRESS   Addresses[1];
+} SERVICE_ADDRESSES, *LPSERVICE_ADDRESSES;
 
 #ifndef GUID_DEFINED
 #define GUID_DEFINED
 typedef struct _GUID
-{ 
-    unsigned long  Data1; 
-    unsigned short  Data2; 
-    unsigned short  Data3; 
-    unsigned char Data4[8]; 
+{
+    unsigned long  Data1;
+    unsigned short  Data2;
+    unsigned short  Data3;
+    unsigned char Data4[8];
 } GUID, *LPGUID;
 typedef GUID CLSID, *LPCLSID;
 #endif
-typedef struct _SERVICE_INFO { 
-  LPGUID   lpServiceType; 
-  LPTSTR   lpServiceName; 
-  LPTSTR   lpComment; 
-  LPTSTR   lpLocale; 
-  DWORD    dwDisplayHint; 
-  DWORD    dwVersion; 
-  DWORD    dwTime; 
-  LPTSTR   lpMachineName; 
-  LPSERVICE_ADDRESSES lpServiceAddress; 
-  BLOB ServiceSpecificInfo; 
-} SERVICE_INFO; 
-typedef struct _NS_SERVICE_INFO { 
-  DWORD   dwNameSpace; 
-  SERVICE_INFO ServiceInfo; 
-} NS_SERVICE_INFO; 
-typedef struct _numberfmt { 
-  UINT      NumDigits; 
-  UINT      LeadingZero; 
-  UINT      Grouping; 
-  LPTSTR    lpDecimalSep; 
-  LPTSTR    lpThousandSep; 
-  UINT      NegativeOrder; 
-} NUMBERFMT; 
-typedef struct _OFSTRUCT { 
-  BYTE cBytes; 
-  BYTE fFixedDisk; 
-  WORD nErrCode; 
-  WORD Reserved1; 
-  WORD Reserved2; 
-  CHAR szPathName[OFS_MAXPATHNAME]; 
-} OFSTRUCT, *LPOFSTRUCT; 
-typedef struct tagOFN { 
-  DWORD         lStructSize; 
-  HWND          hwndOwner; 
-  HINSTANCE     hInstance; 
-  LPCTSTR       lpstrFilter; 
-  LPTSTR        lpstrCustomFilter; 
-  DWORD         nMaxCustFilter; 
-  DWORD         nFilterIndex; 
-  LPTSTR        lpstrFile; 
-  DWORD         nMaxFile; 
-  LPTSTR        lpstrFileTitle; 
-  DWORD         nMaxFileTitle; 
-  LPCTSTR       lpstrInitialDir; 
-  LPCTSTR       lpstrTitle; 
-  DWORD         Flags; 
-  WORD          nFileOffset; 
-  WORD          nFileExtension; 
-  LPCTSTR       lpstrDefExt; 
-  DWORD         lCustData; 
-  LPOFNHOOKPROC lpfnHook; 
-  LPCTSTR       lpTemplateName; 
-} OPENFILENAME, *LPOPENFILENAME; 
+
+typedef struct _SERVICE_INFO {
+  LPGUID   lpServiceType;
+  LPTSTR   lpServiceName;
+  LPTSTR   lpComment;
+  LPTSTR   lpLocale;
+  DWORD    dwDisplayHint;
+  DWORD    dwVersion;
+  DWORD    dwTime;
+  LPTSTR   lpMachineName;
+  LPSERVICE_ADDRESSES lpServiceAddress;
+  BLOB ServiceSpecificInfo;
+} SERVICE_INFO;
+
+typedef struct _NS_SERVICE_INFO {
+  DWORD   dwNameSpace;
+  SERVICE_INFO ServiceInfo;
+} NS_SERVICE_INFO;
+
+typedef struct _numberfmt {
+  UINT      NumDigits;
+  UINT      LeadingZero;
+  UINT      Grouping;
+  LPTSTR    lpDecimalSep;
+  LPTSTR    lpThousandSep;
+  UINT      NegativeOrder;
+} NUMBERFMT;
+
+typedef struct _OFSTRUCT {
+  BYTE cBytes;
+  BYTE fFixedDisk;
+  WORD nErrCode;
+  WORD Reserved1;
+  WORD Reserved2;
+  CHAR szPathName[OFS_MAXPATHNAME];
+} OFSTRUCT, *LPOFSTRUCT;
+
+typedef struct tagOFN {
+  DWORD         lStructSize;
+  HWND          hwndOwner;
+  HINSTANCE     hInstance;
+  LPCTSTR       lpstrFilter;
+  LPTSTR        lpstrCustomFilter;
+  DWORD         nMaxCustFilter;
+  DWORD         nFilterIndex;
+  LPTSTR        lpstrFile;
+  DWORD         nMaxFile;
+  LPTSTR        lpstrFileTitle;
+  DWORD         nMaxFileTitle;
+  LPCTSTR       lpstrInitialDir;
+  LPCTSTR       lpstrTitle;
+  DWORD         Flags;
+  WORD          nFileOffset;
+  WORD          nFileExtension;
+  LPCTSTR       lpstrDefExt;
+  DWORD         lCustData;
+  LPOFNHOOKPROC lpfnHook;
+  LPCTSTR       lpTemplateName;
+} OPENFILENAME, *LPOPENFILENAME;
 
 typedef struct _OFNOTIFY {
-  NMHDR          hdr; 
-  LPOPENFILENAME lpOFN; 
-  LPTSTR         pszFile; 
-} OFNOTIFY, *LPOFNOTIFY; 
-typedef struct _OSVERSIONINFO { 
-  DWORD dwOSVersionInfoSize; 
-  DWORD dwMajorVersion; 
-  DWORD dwMinorVersion; 
-  DWORD dwBuildNumber; 
-  DWORD dwPlatformId; 
-  TCHAR szCSDVersion[ 128 ]; 
-} OSVERSIONINFO, *POSVERSIONINFO, *LPOSVERSIONINFO; 
-typedef struct tagTEXTMETRIC { 
-  LONG tmHeight; 
-  LONG tmAscent; 
-  LONG tmDescent; 
-  LONG tmInternalLeading; 
-  LONG tmExternalLeading; 
-  LONG tmAveCharWidth; 
-  LONG tmMaxCharWidth; 
-  LONG tmWeight; 
-  LONG tmOverhang; 
-  LONG tmDigitizedAspectX; 
-  LONG tmDigitizedAspectY; 
-  BCHAR tmFirstChar; 
-  BCHAR tmLastChar; 
-  BCHAR tmDefaultChar; 
-  BCHAR tmBreakChar; 
-  BYTE tmItalic; 
-  BYTE tmUnderlined; 
-  BYTE tmStruckOut; 
-  BYTE tmPitchAndFamily; 
-  BYTE tmCharSet; 
-} TEXTMETRIC, *LPTEXTMETRIC; 
-
-typedef struct _OUTLINETEXTMETRIC { 
-  UINT   otmSize; 
-  TEXTMETRIC otmTextMetrics; 
-  BYTE   otmFiller; 
-  PANOSE otmPanoseNumber; 
-  UINT   otmfsSelection; 
-  UINT   otmfsType; 
-  int    otmsCharSlopeRise; 
-  int    otmsCharSlopeRun; 
-  int    otmItalicAngle; 
-  UINT   otmEMSquare; 
-  int    otmAscent; 
-  int    otmDescent; 
-  UINT   otmLineGap; 
-  UINT   otmsCapEmHeight; 
-  UINT   otmsXHeight; 
-  RECT   otmrcFontBox; 
-  int    otmMacAscent; 
-  int    otmMacDescent; 
-  UINT   otmMacLineGap; 
-  UINT   otmusMinimumPPEM; 
-  POINT  otmptSubscriptSize; 
-  POINT  otmptSubscriptOffset; 
-  POINT  otmptSuperscriptSize; 
-  POINT  otmptSuperscriptOffset; 
-  UINT   otmsStrikeoutSize; 
-  int    otmsStrikeoutPosition; 
-  int    otmsUnderscoreSize; 
-  int    otmsUnderscorePosition; 
-  PSTR   otmpFamilyName; 
-  PSTR   otmpFaceName; 
-  PSTR   otmpStyleName; 
-  PSTR   otmpFullName; 
-} OUTLINETEXTMETRIC, *LPOUTLINETEXTMETRIC; 
-typedef struct _OVERLAPPED { 
-  DWORD  Internal; 
-  DWORD  InternalHigh; 
-  DWORD  Offset; 
-  DWORD  OffsetHigh; 
-  HANDLE hEvent; 
-} OVERLAPPED, *LPOVERLAPPED; 
+  NMHDR          hdr;
+  LPOPENFILENAME lpOFN;
+  LPTSTR         pszFile;
+} OFNOTIFY, *LPOFNOTIFY;
+
+typedef struct _OSVERSIONINFO {
+  DWORD dwOSVersionInfoSize;
+  DWORD dwMajorVersion;
+  DWORD dwMinorVersion;
+  DWORD dwBuildNumber;
+  DWORD dwPlatformId;
+  TCHAR szCSDVersion[ 128 ];
+} OSVERSIONINFO, *POSVERSIONINFO, *LPOSVERSIONINFO;
+
+typedef struct tagTEXTMETRIC {
+  LONG tmHeight;
+  LONG tmAscent;
+  LONG tmDescent;
+  LONG tmInternalLeading;
+  LONG tmExternalLeading;
+  LONG tmAveCharWidth;
+  LONG tmMaxCharWidth;
+  LONG tmWeight;
+  LONG tmOverhang;
+  LONG tmDigitizedAspectX;
+  LONG tmDigitizedAspectY;
+  BCHAR tmFirstChar;
+  BCHAR tmLastChar;
+  BCHAR tmDefaultChar;
+  BCHAR tmBreakChar;
+  BYTE tmItalic;
+  BYTE tmUnderlined;
+  BYTE tmStruckOut;
+  BYTE tmPitchAndFamily;
+  BYTE tmCharSet;
+} TEXTMETRIC, *LPTEXTMETRIC;
+
+typedef struct _OUTLINETEXTMETRIC {
+  UINT   otmSize;
+  TEXTMETRIC otmTextMetrics;
+  BYTE   otmFiller;
+  PANOSE otmPanoseNumber;
+  UINT   otmfsSelection;
+  UINT   otmfsType;
+  int    otmsCharSlopeRise;
+  int    otmsCharSlopeRun;
+  int    otmItalicAngle;
+  UINT   otmEMSquare;
+  int    otmAscent;
+  int    otmDescent;
+  UINT   otmLineGap;
+  UINT   otmsCapEmHeight;
+  UINT   otmsXHeight;
+  RECT   otmrcFontBox;
+  int    otmMacAscent;
+  int    otmMacDescent;
+  UINT   otmMacLineGap;
+  UINT   otmusMinimumPPEM;
+  POINT  otmptSubscriptSize;
+  POINT  otmptSubscriptOffset;
+  POINT  otmptSuperscriptSize;
+  POINT  otmptSuperscriptOffset;
+  UINT   otmsStrikeoutSize;
+  int    otmsStrikeoutPosition;
+  int    otmsUnderscoreSize;
+  int    otmsUnderscorePosition;
+  PSTR   otmpFamilyName;
+  PSTR   otmpFaceName;
+  PSTR   otmpStyleName;
+  PSTR   otmpFullName;
+} OUTLINETEXTMETRIC, *LPOUTLINETEXTMETRIC;
+
+typedef struct _OVERLAPPED {
+  DWORD  Internal;
+  DWORD  InternalHigh;
+  DWORD  Offset;
+  DWORD  OffsetHigh;
+  HANDLE hEvent;
+} OVERLAPPED, *LPOVERLAPPED;
 
 typedef struct tagPSD {
-    DWORD           lStructSize; 
-    HWND            hwndOwner; 
-    HGLOBAL         hDevMode; 
-    HGLOBAL         hDevNames; 
-    DWORD           Flags; 
-    POINT           ptPaperSize; 
-    RECT            rtMinMargin; 
-    RECT            rtMargin; 
-    HINSTANCE       hInstance; 
-    LPARAM          lCustData; 
-    LPPAGESETUPHOOK lpfnPageSetupHook; 
-    LPPAGEPAINTHOOK lpfnPagePaintHook; 
-    LPCTSTR         lpPageSetupTemplateName; 
-    HGLOBAL         hPageSetupTemplate; 
-} PAGESETUPDLG, *LPPAGESETUPDLG; 
-
-typedef struct tagPAINTSTRUCT { 
-  HDC  hdc; 
-  WINBOOL fErase; 
-  RECT rcPaint; 
-  WINBOOL fRestore; 
-  WINBOOL fIncUpdate; 
-  BYTE rgbReserved[32]; 
-} PAINTSTRUCT, *LPPAINTSTRUCT; 
-typedef struct _paraformat { 
-  UINT cbSize; 
-  DWORD dwMask; 
-  WORD  wNumbering; 
-  WORD  wReserved; 
-  LONG  dxStartIndent; 
-  LONG  dxRightIndent; 
-  LONG  dxOffset; 
-  WORD  wAlignment; 
-  SHORT cTabCount; 
-  LONG  rgxTabs[MAX_TAB_STOPS]; 
-} PARAFORMAT; 
-typedef struct _PERF_COUNTER_BLOCK { 
-  DWORD ByteLength; 
-} PERF_COUNTER_BLOCK; 
-typedef struct _PERF_COUNTER_DEFINITION { 
-  DWORD  ByteLength; 
-  DWORD  CounterNameTitleIndex; 
-  LPWSTR CounterNameTitle; 
-  DWORD  CounterHelpTitleIndex; 
-  LPWSTR CounterHelpTitle; 
-  DWORD  DefaultScale; 
-  DWORD  DetailLevel; 
-  DWORD  CounterType; 
-  DWORD  CounterSize; 
-  DWORD  CounterOffset; 
-} PERF_COUNTER_DEFINITION; 
-typedef struct _PERF_DATA_BLOCK { 
-  WCHAR         Signature[4]; 
-  DWORD         LittleEndian; 
-  DWORD         Version; 
-  DWORD         Revision; 
-  DWORD         TotalByteLength; 
-  DWORD         HeaderLength; 
-  DWORD         NumObjectTypes; 
-  DWORD         DefaultObject; 
-  SYSTEMTIME    SystemTime; 
-  LARGE_INTEGER PerfTime; 
-  LARGE_INTEGER PerfFreq; 
-  LARGE_INTEGER PerfTime100nSec; 
-  DWORD         SystemNameLength; 
-  DWORD         SystemNameOffset; 
-} PERF_DATA_BLOCK; 
-typedef struct _PERF_INSTANCE_DEFINITION { 
-  DWORD ByteLength; 
-  DWORD ParentObjectTitleIndex; 
-  DWORD ParentObjectInstance; 
-  DWORD UniqueID; 
-  DWORD NameOffset; 
-  DWORD NameLength; 
-} PERF_INSTANCE_DEFINITION; 
-typedef struct _PERF_OBJECT_TYPE { 
-  DWORD  TotalByteLength; 
-  DWORD  DefinitionLength; 
-  DWORD  HeaderLength; 
-  DWORD  ObjectNameTitleIndex; 
-  LPWSTR ObjectNameTitle; 
-  DWORD  ObjectHelpTitleIndex; 
-  LPWSTR ObjectHelpTitle; 
-  DWORD  DetailLevel; 
-  DWORD  NumCounters; 
-  DWORD  DefaultCounter; 
-  DWORD  NumInstances; 
-  DWORD  CodePage; 
-  LARGE_INTEGER PerfTime; 
-  LARGE_INTEGER PerfFreq; 
-} PERF_OBJECT_TYPE; 
-typedef struct _POLYTEXT { 
-  int     x; 
-  int     y; 
-  UINT    n; 
-  LPCTSTR lpstr; 
-  UINT    uiFlags; 
-  RECT    rcl; 
-  int     *pdx; 
-} POLYTEXT, *LPPOLYTEXT; 
-typedef struct _PORT_INFO_1 { 
-  LPTSTR pName; 
-} PORT_INFO_1; 
-typedef struct _PORT_INFO_2 { 
-  LPSTR pPortName; 
-  LPSTR pMonitorName; 
-  LPSTR pDescription; 
-  DWORD fPortType; 
-  DWORD Reserved; 
-} PORT_INFO_2; 
-typedef struct _PREVENT_MEDIA_REMOVAL { 
-  BOOLEAN PreventMediaRemoval; 
-} PREVENT_MEDIA_REMOVAL ; 
-typedef struct tagPD {  
-  DWORD     lStructSize; 
-  HWND      hwndOwner; 
-  HANDLE    hDevMode; 
-  HANDLE    hDevNames; 
-  HDC       hDC; 
-  DWORD     Flags; 
-  WORD      nFromPage; 
-  WORD      nToPage; 
-  WORD      nMinPage; 
-  WORD      nMaxPage; 
-  WORD      nCopies; 
-  HINSTANCE hInstance; 
-  DWORD     lCustData; 
-  LPPRINTHOOKPROC lpfnPrintHook; 
-  LPSETUPHOOKPROC lpfnSetupHook; 
-  LPCTSTR    lpPrintTemplateName; 
-  LPCTSTR    lpSetupTemplateName; 
-  HANDLE    hPrintTemplate; 
-  HANDLE    hSetupTemplate; 
+    DWORD           lStructSize;
+    HWND            hwndOwner;
+    HGLOBAL         hDevMode;
+    HGLOBAL         hDevNames;
+    DWORD           Flags;
+    POINT           ptPaperSize;
+    RECT            rtMinMargin;
+    RECT            rtMargin;
+    HINSTANCE       hInstance;
+    LPARAM          lCustData;
+    LPPAGESETUPHOOK lpfnPageSetupHook;
+    LPPAGEPAINTHOOK lpfnPagePaintHook;
+    LPCTSTR         lpPageSetupTemplateName;
+    HGLOBAL         hPageSetupTemplate;
+} PAGESETUPDLG, *LPPAGESETUPDLG;
+
+typedef struct tagPAINTSTRUCT {
+  HDC  hdc;
+  WINBOOL fErase;
+  RECT rcPaint;
+  WINBOOL fRestore;
+  WINBOOL fIncUpdate;
+  BYTE rgbReserved[32];
+} PAINTSTRUCT, *LPPAINTSTRUCT;
+
+typedef struct _paraformat {
+  UINT cbSize;
+  DWORD dwMask;
+  WORD  wNumbering;
+  WORD  wReserved;
+  LONG  dxStartIndent;
+  LONG  dxRightIndent;
+  LONG  dxOffset;
+  WORD  wAlignment;
+  SHORT cTabCount;
+  LONG  rgxTabs[MAX_TAB_STOPS];
+} PARAFORMAT;
+
+typedef struct _PERF_COUNTER_BLOCK {
+  DWORD ByteLength;
+} PERF_COUNTER_BLOCK;
+
+typedef struct _PERF_COUNTER_DEFINITION {
+  DWORD  ByteLength;
+  DWORD  CounterNameTitleIndex;
+  LPWSTR CounterNameTitle;
+  DWORD  CounterHelpTitleIndex;
+  LPWSTR CounterHelpTitle;
+  DWORD  DefaultScale;
+  DWORD  DetailLevel;
+  DWORD  CounterType;
+  DWORD  CounterSize;
+  DWORD  CounterOffset;
+} PERF_COUNTER_DEFINITION;
+
+typedef struct _PERF_DATA_BLOCK {
+  WCHAR         Signature[4];
+  DWORD         LittleEndian;
+  DWORD         Version;
+  DWORD         Revision;
+  DWORD         TotalByteLength;
+  DWORD         HeaderLength;
+  DWORD         NumObjectTypes;
+  DWORD         DefaultObject;
+  SYSTEMTIME    SystemTime;
+  LARGE_INTEGER PerfTime;
+  LARGE_INTEGER PerfFreq;
+  LARGE_INTEGER PerfTime100nSec;
+  DWORD         SystemNameLength;
+  DWORD         SystemNameOffset;
+} PERF_DATA_BLOCK;
+
+typedef struct _PERF_INSTANCE_DEFINITION {
+  DWORD ByteLength;
+  DWORD ParentObjectTitleIndex;
+  DWORD ParentObjectInstance;
+  DWORD UniqueID;
+  DWORD NameOffset;
+  DWORD NameLength;
+} PERF_INSTANCE_DEFINITION;
+
+typedef struct _PERF_OBJECT_TYPE {
+  DWORD  TotalByteLength;
+  DWORD  DefinitionLength;
+  DWORD  HeaderLength;
+  DWORD  ObjectNameTitleIndex;
+  LPWSTR ObjectNameTitle;
+  DWORD  ObjectHelpTitleIndex;
+  LPWSTR ObjectHelpTitle;
+  DWORD  DetailLevel;
+  DWORD  NumCounters;
+  DWORD  DefaultCounter;
+  DWORD  NumInstances;
+  DWORD  CodePage;
+  LARGE_INTEGER PerfTime;
+  LARGE_INTEGER PerfFreq;
+} PERF_OBJECT_TYPE;
+
+typedef struct _POLYTEXT {
+  int     x;
+  int     y;
+  UINT    n;
+  LPCTSTR lpstr;
+  UINT    uiFlags;
+  RECT    rcl;
+  int     *pdx;
+} POLYTEXT, *LPPOLYTEXT;
+
+typedef struct _PORT_INFO_1 {
+  LPTSTR pName;
+} PORT_INFO_1;
+
+typedef struct _PORT_INFO_2 {
+  LPSTR pPortName;
+  LPSTR pMonitorName;
+  LPSTR pDescription;
+  DWORD fPortType;
+  DWORD Reserved;
+} PORT_INFO_2;
+
+typedef struct _PREVENT_MEDIA_REMOVAL {
+  BOOLEAN PreventMediaRemoval;
+} PREVENT_MEDIA_REMOVAL ;
+
+typedef struct tagPD {
+  DWORD     lStructSize;
+  HWND      hwndOwner;
+  HANDLE    hDevMode;
+  HANDLE    hDevNames;
+  HDC       hDC;
+  DWORD     Flags;
+  WORD      nFromPage;
+  WORD      nToPage;
+  WORD      nMinPage;
+  WORD      nMaxPage;
+  WORD      nCopies;
+  HINSTANCE hInstance;
+  DWORD     lCustData;
+  LPPRINTHOOKPROC lpfnPrintHook;
+  LPSETUPHOOKPROC lpfnSetupHook;
+  LPCTSTR    lpPrintTemplateName;
+  LPCTSTR    lpSetupTemplateName;
+  HANDLE    hPrintTemplate;
+  HANDLE    hSetupTemplate;
 } PRINTDLG PACKED, *LPPRINTDLG PACKED;
 
 typedef struct _PRINTER_DEFAULTSA
@@ -3084,189 +3084,189 @@ typedef struct _PRINTER_DEFAULTSW
   ACCESS_MASK DesiredAccess;
 } PRINTER_DEFAULTSW, *PPRINTER_DEFAULTSW, *LPPRINTER_DEFAULTSW;
 
-typedef struct _PRINTER_INFO_1 { 
-  DWORD  Flags; 
-  LPTSTR pDescription; 
-  LPTSTR pName; 
-  LPTSTR pComment; 
-} PRINTER_INFO_1, *PPRINTER_INFO_1, *LPPRINTER_INFO_1; 
+typedef struct _PRINTER_INFO_1 {
+  DWORD  Flags;
+  LPTSTR pDescription;
+  LPTSTR pName;
+  LPTSTR pComment;
+} PRINTER_INFO_1, *PPRINTER_INFO_1, *LPPRINTER_INFO_1;
 
    #if 0
-typedef struct _PRINTER_INFO_2 { 
-  LPTSTR    pServerName; 
-  LPTSTR    pPrinterName; 
-  LPTSTR    pShareName; 
-  LPTSTR    pPortName; 
-  LPTSTR    pDriverName; 
-  LPTSTR    pComment; 
-  LPTSTR    pLocation; 
-  LPDEVMODE pDevMode; 
-  LPTSTR    pSepFile; 
-  LPTSTR    pPrintProcessor; 
-  LPTSTR    pDatatype; 
-  LPTSTR    pParameters; 
-  PSECURITY_DESCRIPTOR pSecurityDescriptor; 
-  DWORD     Attributes; 
-  DWORD     Priority; 
-  DWORD     DefaultPriority; 
-  DWORD     StartTime; 
-  DWORD     UntilTime; 
-  DWORD     Status; 
-  DWORD     cJobs; 
-  DWORD     AveragePPM; 
-} PRINTER_INFO_2; 
-
-   
-typedef struct _PRINTER_INFO_3 { 
-  PSECURITY_DESCRIPTOR pSecurityDescriptor; 
-} PRINTER_INFO_3; 
+typedef struct _PRINTER_INFO_2 {
+  LPTSTR    pServerName;
+  LPTSTR    pPrinterName;
+  LPTSTR    pShareName;
+  LPTSTR    pPortName;
+  LPTSTR    pDriverName;
+  LPTSTR    pComment;
+  LPTSTR    pLocation;
+  LPDEVMODE pDevMode;
+  LPTSTR    pSepFile;
+  LPTSTR    pPrintProcessor;
+  LPTSTR    pDatatype;
+  LPTSTR    pParameters;
+  PSECURITY_DESCRIPTOR pSecurityDescriptor;
+  DWORD     Attributes;
+  DWORD     Priority;
+  DWORD     DefaultPriority;
+  DWORD     StartTime;
+  DWORD     UntilTime;
+  DWORD     Status;
+  DWORD     cJobs;
+  DWORD     AveragePPM;
+} PRINTER_INFO_2;
+
+
+typedef struct _PRINTER_INFO_3 {
+  PSECURITY_DESCRIPTOR pSecurityDescriptor;
+} PRINTER_INFO_3;
  #endif
-   
-typedef struct _PRINTER_INFO_4 { 
-  LPTSTR  pPrinterName; 
-  LPTSTR  pServerName; 
-  DWORD  Attributes; 
-} PRINTER_INFO_4; 
-typedef struct _PRINTER_INFO_5 { 
-  LPTSTR    pPrinterName; 
-  LPTSTR    pPortName; 
-  DWORD     Attributes; 
-  DWORD     DeviceNotSelectedTimeout; 
-  DWORD     TransmissionRetryTimeout; 
-} PRINTER_INFO_5; 
-typedef struct _PRINTER_NOTIFY_INFO_DATA { 
-  WORD   Type; 
-  WORD   Field; 
-  DWORD  Reserved; 
-  DWORD  Id; 
-  union { 
-    DWORD  adwData[2]; 
-    struct { 
-      DWORD  cbBuf; 
-      LPVOID pBuf; 
-    } Data; 
-  } NotifyData; 
-} PRINTER_NOTIFY_INFO_DATA; 
-typedef struct _PRINTER_NOTIFY_INFO { 
-  DWORD  Version; 
-  DWORD  Flags; 
-  DWORD  Count; 
-  PRINTER_NOTIFY_INFO_DATA  aData[1]; 
-} PRINTER_NOTIFY_INFO; 
-typedef struct _PRINTER_NOTIFY_OPTIONS_TYPE { 
-  WORD   Type; 
-  WORD   Reserved0; 
-  DWORD  Reserved1; 
-  DWORD  Reserved2; 
-  DWORD  Count; 
-  PWORD  pFields; 
-} PRINTER_NOTIFY_OPTIONS_TYPE, *PPRINTER_NOTIFY_OPTIONS_TYPE; 
-typedef struct _PRINTER_NOTIFY_OPTIONS { 
-  DWORD  Version; 
-  DWORD  Flags; 
-  DWORD  Count; 
-  PPRINTER_NOTIFY_OPTIONS_TYPE  pTypes; 
-} PRINTER_NOTIFY_OPTIONS; 
-typedef struct _PRINTPROCESSOR_INFO_1 { 
-  LPTSTR pName; 
-} PRINTPROCESSOR_INFO_1; 
-typedef struct _PROCESS_HEAP_ENTRY {  
-  PVOID lpData; 
-  DWORD cbData; 
-  BYTE cbOverhead; 
-  BYTE iRegionIndex; 
-  WORD wFlags; 
-  DWORD dwCommittedSize; 
-  DWORD dwUnCommittedSize; 
-  LPVOID lpFirstBlock; 
-  LPVOID lpLastBlock; 
-  HANDLE hMem; 
-} PROCESS_HEAPENTRY, *LPPROCESS_HEAP_ENTRY; 
-typedef struct _PROCESS_INFORMATION { 
-  HANDLE hProcess; 
-  HANDLE hThread; 
-  DWORD dwProcessId; 
-  DWORD dwThreadId; 
-} PROCESS_INFORMATION, *LPPROCESS_INFORMATION; 
+
+typedef struct _PRINTER_INFO_4 {
+  LPTSTR  pPrinterName;
+  LPTSTR  pServerName;
+  DWORD  Attributes;
+} PRINTER_INFO_4;
+
+typedef struct _PRINTER_INFO_5 {
+  LPTSTR    pPrinterName;
+  LPTSTR    pPortName;
+  DWORD     Attributes;
+  DWORD     DeviceNotSelectedTimeout;
+  DWORD     TransmissionRetryTimeout;
+} PRINTER_INFO_5;
+
+typedef struct _PRINTER_NOTIFY_INFO_DATA {
+  WORD   Type;
+  WORD   Field;
+  DWORD  Reserved;
+  DWORD  Id;
+  union {
+    DWORD  adwData[2];
+    struct {
+      DWORD  cbBuf;
+      LPVOID pBuf;
+    } Data;
+  } NotifyData;
+} PRINTER_NOTIFY_INFO_DATA;
+
+typedef struct _PRINTER_NOTIFY_INFO {
+  DWORD  Version;
+  DWORD  Flags;
+  DWORD  Count;
+  PRINTER_NOTIFY_INFO_DATA  aData[1];
+} PRINTER_NOTIFY_INFO;
+
+typedef struct _PRINTER_NOTIFY_OPTIONS_TYPE {
+  WORD   Type;
+  WORD   Reserved0;
+  DWORD  Reserved1;
+  DWORD  Reserved2;
+  DWORD  Count;
+  PWORD  pFields;
+} PRINTER_NOTIFY_OPTIONS_TYPE, *PPRINTER_NOTIFY_OPTIONS_TYPE;
+
+typedef struct _PRINTER_NOTIFY_OPTIONS {
+  DWORD  Version;
+  DWORD  Flags;
+  DWORD  Count;
+  PPRINTER_NOTIFY_OPTIONS_TYPE  pTypes;
+} PRINTER_NOTIFY_OPTIONS;
+
+typedef struct _PRINTPROCESSOR_INFO_1 {
+  LPTSTR pName;
+} PRINTPROCESSOR_INFO_1;
+
+
+typedef struct _PROCESS_HEAP_ENTRY {
+  PVOID lpData;
+  DWORD cbData;
+  BYTE cbOverhead;
+  BYTE iRegionIndex;
+  WORD wFlags;
+  DWORD dwCommittedSize;
+  DWORD dwUnCommittedSize;
+  LPVOID lpFirstBlock;
+  LPVOID lpLastBlock;
+  HANDLE hMem;
+} PROCESS_HEAPENTRY, *LPPROCESS_HEAP_ENTRY;
+
+typedef struct _PROCESS_INFORMATION {
+  HANDLE hProcess;
+  HANDLE hThread;
+  DWORD dwProcessId;
+  DWORD dwThreadId;
+} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
+
 typedef UINT CALLBACK (*LPFNPSPCALLBACK) (HWND, UINT, LPVOID);
 
-typedef struct _PROPSHEETPAGE { 
-  DWORD     dwSize;     
-  DWORD     dwFlags;    
-  HINSTANCE hInstance;  
-  union { 
-    LPCTSTR        pszTemplate;      
-    LPCDLGTEMPLATE pResource;        
-  } u1; 
-  union { 
-    HICON  hIcon;     
-    LPCTSTR pszIcon;  
-  } u2; 
-  LPCTSTR pszTitle;     
-  DLGPROC pfnDlgProc;   
-  LPARAM  lParam;       
-  LPFNPSPCALLBACK pfnCallback;         
-  UINT   * pcRefParent;              
-} PROPSHEETPAGE,   *LPPROPSHEETPAGE; 
-typedef const PROPSHEETPAGE   *LPCPROPSHEETPAGE; 
+typedef struct _PROPSHEETPAGE {
+  DWORD     dwSize;
+  DWORD     dwFlags;
+  HINSTANCE hInstance;
+  union {
+    LPCTSTR        pszTemplate;
+    LPCDLGTEMPLATE pResource;
+  } u1;
+  union {
+    HICON  hIcon;
+    LPCTSTR pszIcon;
+  } u2;
+  LPCTSTR pszTitle;
+  DLGPROC pfnDlgProc;
+  LPARAM  lParam;
+  LPFNPSPCALLBACK pfnCallback;
+  UINT   * pcRefParent;
+} PROPSHEETPAGE,   *LPPROPSHEETPAGE;
+typedef const PROPSHEETPAGE   *LPCPROPSHEETPAGE;
+
 typedef struct _PSP *HPROPSHEETPAGE;
-typedef struct _PROPSHEETHEADER { 
-  DWORD      dwSize;     
-  DWORD      dwFlags;    
-  HWND       hwndParent; 
-  HINSTANCE  hInstance;  
-  union { 
-    HICON  hIcon;      
-    LPCTSTR pszIcon;   
-  } u1; 
-  LPCTSTR     pszCaption; 
-  UINT       nPages; 
-  union { 
-    UINT  nStartPage; 
-    LPCTSTR pStartPage; 
-  } u2; 
-  union { 
-    LPCPROPSHEETPAGE    ppsp;   
-    HPROPSHEETPAGE   *phpage; 
-  } u3; 
-  PFNPROPSHEETCALLBACK pfnCallback; 
-} PROPSHEETHEADER,   *LPPROPSHEETHEADER; 
-typedef const PROPSHEETHEADER   *LPCPROPSHEETHEADER; 
+typedef struct _PROPSHEETHEADER {
+  DWORD      dwSize;
+  DWORD      dwFlags;
+  HWND       hwndParent;
+  HINSTANCE  hInstance;
+  union {
+    HICON  hIcon;
+    LPCTSTR pszIcon;
+  } u1;
+  LPCTSTR     pszCaption;
+  UINT       nPages;
+  union {
+    UINT  nStartPage;
+    LPCTSTR pStartPage;
+  } u2;
+  union {
+    LPCPROPSHEETPAGE    ppsp;
+    HPROPSHEETPAGE   *phpage;
+  } u3;
+  PFNPROPSHEETCALLBACK pfnCallback;
+} PROPSHEETHEADER,   *LPPROPSHEETHEADER;
+typedef const PROPSHEETHEADER   *LPCPROPSHEETHEADER;
 
 /* PropertySheet callbacks */
 typedef WINBOOL CALLBACK (*LPFNADDPROPSHEETPAGE) (HPROPSHEETPAGE, LPARAM);
-typedef WINBOOL CALLBACK (*LPFNADDPROPSHEETPAGES) (LPVOID, 
-                                                  LPFNADDPROPSHEETPAGE, 
+typedef WINBOOL CALLBACK (*LPFNADDPROPSHEETPAGES) (LPVOID,
+                                                  LPFNADDPROPSHEETPAGE,
                                                   LPARAM);
-typedef  struct _PROTOCOL_INFO {  
-  DWORD  dwServiceFlags; 
-  INT  iAddressFamily; 
-  INT  iMaxSockAddr; 
-  INT  iMinSockAddr; 
-  INT  iSocketType; 
-  INT  iProtocol; 
-  DWORD  dwMessageSize; 
-  LPTSTR  lpProtocol; 
-} PROTOCOL_INFO; 
-typedef struct _PROVIDOR_INFO_1 { 
-  LPTSTR pName; 
-  LPTSTR pEnvironment ; 
-  LPTSTR pDLLName ; 
-} PROVIDOR_INFO_1; 
+
+typedef  struct _PROTOCOL_INFO {
+  DWORD  dwServiceFlags;
+  INT  iAddressFamily;
+  INT  iMaxSockAddr;
+  INT  iMinSockAddr;
+  INT  iSocketType;
+  INT  iProtocol;
+  DWORD  dwMessageSize;
+  LPTSTR  lpProtocol;
+} PROTOCOL_INFO;
+
+typedef struct _PROVIDOR_INFO_1 {
+  LPTSTR pName;
+  LPTSTR pEnvironment ;
+  LPTSTR pDLLName ;
+} PROVIDOR_INFO_1;
+
 typedef struct _PSHNOTIFY {
   NMHDR hdr;
   LPARAM lParam;
@@ -3275,7 +3275,7 @@ typedef struct _PSHNOTIFY {
 typedef struct _punctuation {
   UINT   iSize;
   LPSTR  szPunctuation;
-} PUNCTUATION; 
+} PUNCTUATION;
 
 typedef struct _QUERY_SERVICE_CONFIGA {
   DWORD dwServiceType;
@@ -3330,165 +3330,165 @@ typedef struct _QUERY_SERVICE_LOCK_STATUSW {
 #endif
 
 typedef  struct  _RASAMB {
-  DWORD    dwSize; 
-  DWORD    dwError; 
-  TCHAR    szNetBiosError[ NETBIOS_NAME_LEN + 1 ]; 
-  BYTE     bLana; 
-} RASAMB; 
-typedef struct _RASCONN { 
-  DWORD     dwSize; 
-  HRASCONN  hrasconn; 
-  TCHAR     szEntryName[RAS_MaxEntryName + 1]; 
-  CHAR      szDeviceType[ RAS_MaxDeviceType + 1 ]; 
-  CHAR      szDeviceName[ RAS_MaxDeviceName + 1 ]; 
-} RASCONN ; 
-typedef struct _RASCONNSTATUS { 
-  DWORD         dwSize; 
-  RASCONNSTATE  rasconnstate; 
-  DWORD         dwError; 
-  TCHAR         szDeviceType[RAS_MaxDeviceType + 1]; 
-  TCHAR         szDeviceName[RAS_MaxDeviceName + 1]; 
-} RASCONNSTATUS; 
-typedef  struct  _RASDIALEXTENSIONS { 
-  DWORD    dwSize; 
-  DWORD    dwfOptions; 
-  HWND    hwndParent; 
-  DWORD    reserved; 
-} RASDIALEXTENSIONS; 
-typedef struct _RASDIALPARAMS { 
-  DWORD  dwSize; 
-  TCHAR  szEntryName[RAS_MaxEntryName + 1]; 
-  TCHAR  szPhoneNumber[RAS_MaxPhoneNumber + 1]; 
-  TCHAR  szCallbackNumber[RAS_MaxCallbackNumber + 1]; 
-  TCHAR  szUserName[UNLEN + 1]; 
-  TCHAR  szPassword[PWLEN + 1]; 
-  TCHAR  szDomain[DNLEN + 1] ; 
-} RASDIALPARAMS; 
-typedef struct _RASENTRYNAME { 
-  DWORD  dwSize; 
-  TCHAR  szEntryName[RAS_MaxEntryName + 1]; 
-}RASENTRYNAME; 
-typedef  struct  _RASPPPIP { 
-  DWORD    dwSize; 
-  DWORD    dwError; 
-  TCHAR    szIpAddress[ RAS_MaxIpAddress + 1 ]; 
-} RASPPPIP; 
-typedef  struct  _RASPPPIPX { 
-  DWORD    dwSize; 
-  DWORD    dwError; 
-  TCHAR    szIpxAddress[ RAS_MaxIpxAddress + 1 ]; 
-} RASPPPIPX; 
-typedef  struct  _RASPPPNBF { 
-  DWORD    dwSize; 
-  DWORD    dwError; 
-  DWORD    dwNetBiosError; 
-  TCHAR    szNetBiosError[ NETBIOS_NAME_LEN + 1 ]; 
-  TCHAR    szWorkstationName[ NETBIOS_NAME_LEN + 1 ]; 
-  BYTE     bLana; 
-} RASPPPNBF; 
-typedef struct _RASTERIZER_STATUS { 
-  short nSize; 
-  short wFlags; 
-  short nLanguageID; 
-} RASTERIZER_STATUS, *LPRASTERIZER_STATUS; 
-typedef struct _REASSIGN_BLOCKS { 
-  WORD   Reserved; 
-  WORD   Count; 
-  DWORD BlockNumber[1]; 
-} REASSIGN_BLOCKS ; 
+  DWORD    dwSize;
+  DWORD    dwError;
+  TCHAR    szNetBiosError[ NETBIOS_NAME_LEN + 1 ];
+  BYTE     bLana;
+} RASAMB;
+
+typedef struct _RASCONN {
+  DWORD     dwSize;
+  HRASCONN  hrasconn;
+  TCHAR     szEntryName[RAS_MaxEntryName + 1];
+
+  CHAR      szDeviceType[ RAS_MaxDeviceType + 1 ];
+  CHAR      szDeviceName[ RAS_MaxDeviceName + 1 ];
+} RASCONN ;
+
+typedef struct _RASCONNSTATUS {
+  DWORD         dwSize;
+  RASCONNSTATE  rasconnstate;
+  DWORD         dwError;
+  TCHAR         szDeviceType[RAS_MaxDeviceType + 1];
+  TCHAR         szDeviceName[RAS_MaxDeviceName + 1];
+} RASCONNSTATUS;
+
+typedef  struct  _RASDIALEXTENSIONS {
+  DWORD    dwSize;
+  DWORD    dwfOptions;
+  HWND    hwndParent;
+  DWORD    reserved;
+} RASDIALEXTENSIONS;
+
+typedef struct _RASDIALPARAMS {
+  DWORD  dwSize;
+  TCHAR  szEntryName[RAS_MaxEntryName + 1];
+  TCHAR  szPhoneNumber[RAS_MaxPhoneNumber + 1];
+  TCHAR  szCallbackNumber[RAS_MaxCallbackNumber + 1];
+  TCHAR  szUserName[UNLEN + 1];
+  TCHAR  szPassword[PWLEN + 1];
+  TCHAR  szDomain[DNLEN + 1] ;
+} RASDIALPARAMS;
+
+typedef struct _RASENTRYNAME {
+  DWORD  dwSize;
+  TCHAR  szEntryName[RAS_MaxEntryName + 1];
+}RASENTRYNAME;
+
+typedef  struct  _RASPPPIP {
+  DWORD    dwSize;
+  DWORD    dwError;
+  TCHAR    szIpAddress[ RAS_MaxIpAddress + 1 ];
+} RASPPPIP;
+
+typedef  struct  _RASPPPIPX {
+  DWORD    dwSize;
+  DWORD    dwError;
+  TCHAR    szIpxAddress[ RAS_MaxIpxAddress + 1 ];
+} RASPPPIPX;
+
+typedef  struct  _RASPPPNBF {
+  DWORD    dwSize;
+  DWORD    dwError;
+  DWORD    dwNetBiosError;
+  TCHAR    szNetBiosError[ NETBIOS_NAME_LEN + 1 ];
+  TCHAR    szWorkstationName[ NETBIOS_NAME_LEN + 1 ];
+  BYTE     bLana;
+} RASPPPNBF;
+
+typedef struct _RASTERIZER_STATUS {
+  short nSize;
+  short wFlags;
+  short nLanguageID;
+} RASTERIZER_STATUS, *LPRASTERIZER_STATUS;
+
+typedef struct _REASSIGN_BLOCKS {
+  WORD   Reserved;
+  WORD   Count;
+  DWORD BlockNumber[1];
+} REASSIGN_BLOCKS ;
+
 typedef struct _REMOTE_NAME_INFO {
-  LPTSTR  lpUniversalName; 
-  LPTSTR  lpConnectionName; 
-  LPTSTR  lpRemainingPath;    
-} REMOTE_NAME_INFO; 
+  LPTSTR  lpUniversalName;
+  LPTSTR  lpConnectionName;
+  LPTSTR  lpRemainingPath;
+} REMOTE_NAME_INFO;
+
 /*
  TODO: OLE
-typedef struct _reobject { 
-  DWORD  cbStruct;           
-  LONG   cp;                 
-  CLSID  clsid;              
-  LPOLEOBJECT      poleobj;  
-  LPSTORAGE        pstg;     
-  LPOLECLIENTSITE  polesite; 
-  SIZEL  sizel;              
-  DWORD  dvaspect;           
-  DWORD  dwFlags;            
-  DWORD  dwUser;             
-} REOBJECT; 
+typedef struct _reobject {
+  DWORD  cbStruct;
+  LONG   cp;
+  CLSID  clsid;
+  LPOLEOBJECT      poleobj;
+  LPSTORAGE        pstg;
+  LPOLECLIENTSITE  polesite;
+  SIZEL  sizel;
+  DWORD  dvaspect;
+  DWORD  dwFlags;
+  DWORD  dwUser;
+} REOBJECT;
 */
-typedef struct _repastespecial { 
-  DWORD  dwAspect;  
-  DWORD  dwParam;   
-} REPASTESPECIAL; 
-typedef struct _reqresize { 
-  NMHDR nmhdr; 
-  RECT rc; 
-} REQRESIZE; 
-typedef struct _RGNDATAHEADER { 
-  DWORD dwSize; 
-  DWORD iType; 
-  DWORD nCount; 
-  DWORD nRgnSize; 
-  RECT  rcBound; 
-} RGNDATAHEADER; 
-typedef struct _RGNDATA { 
-  RGNDATAHEADER rdh; 
-  char          Buffer[1]; 
-} RGNDATA, *PRGNDATA, *LPRGNDATA; 
+
+typedef struct _repastespecial {
+  DWORD  dwAspect;
+  DWORD  dwParam;
+} REPASTESPECIAL;
+
+typedef struct _reqresize {
+  NMHDR nmhdr;
+  RECT rc;
+} REQRESIZE;
+
+typedef struct _RGNDATAHEADER {
+  DWORD dwSize;
+  DWORD iType;
+  DWORD nCount;
+  DWORD nRgnSize;
+  RECT  rcBound;
+} RGNDATAHEADER;
+
+typedef struct _RGNDATA {
+  RGNDATAHEADER rdh;
+  char*          Buffer;
+} RGNDATA, *PRGNDATA, *LPRGNDATA;
+
 typedef struct tagSCROLLINFO {
-  UINT cbSize; 
-  UINT fMask; 
-  int  nMin; 
-  int  nMax; 
-  UINT nPage; 
-  int  nPos; 
-  int  nTrackPos; 
-}   SCROLLINFO, *LPSCROLLINFO; 
-typedef SCROLLINFO const *LPCSCROLLINFO; 
-  
-typedef struct _selchange { 
-  NMHDR nmhdr; 
-  CHARRANGE chrg; 
-  WORD seltyp; 
-} SELCHANGE; 
-typedef struct tagSERIALKEYS {  
-  DWORD cbSize; 
-  DWORD dwFlags; 
-  LPSTR lpszActivePort; 
-  LPSTR lpszPort; 
-  DWORD iBaudRate; 
-  DWORD iPortState; 
-} SERIALKEYS,  * LPSERIALKEYS; 
-typedef struct _SERVICE_TABLE_ENTRYA { 
-  LPSTR lpServiceName; 
-  LPSERVICE_MAIN_FUNCTION lpServiceProc; 
-} SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; 
+  UINT cbSize;
+  UINT fMask;
+  int  nMin;
+  int  nMax;
+  UINT nPage;
+  int  nPos;
+  int  nTrackPos;
+}   SCROLLINFO, *LPSCROLLINFO;
+typedef SCROLLINFO const *LPCSCROLLINFO;
+
+
+typedef struct _selchange {
+  NMHDR nmhdr;
+  CHARRANGE chrg;
+  WORD seltyp;
+} SELCHANGE;
+
+typedef struct tagSERIALKEYS {
+  DWORD cbSize;
+  DWORD dwFlags;
+  LPSTR lpszActivePort;
+  LPSTR lpszPort;
+  DWORD iBaudRate;
+  DWORD iPortState;
+} SERIALKEYS,  * LPSERIALKEYS;
+
+typedef struct _SERVICE_TABLE_ENTRYA {
+  LPSTR lpServiceName;
+  LPSERVICE_MAIN_FUNCTION lpServiceProc;
+} SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA;
 
-typedef struct _SERVICE_TABLE_ENTRYW { 
-  LPWSTR lpServiceName; 
-  LPSERVICE_MAIN_FUNCTION lpServiceProc; 
-} SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; 
+typedef struct _SERVICE_TABLE_ENTRYW {
+  LPWSTR lpServiceName;
+  LPSERVICE_MAIN_FUNCTION lpServiceProc;
+} SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW;
 
 #ifdef UNICODE
 #define SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW
@@ -3499,36 +3499,36 @@ typedef struct _SERVICE_TABLE_ENTRYW {
 #endif
 
 
-typedef struct _SERVICE_TYPE_VALUE_ABS { 
-  DWORD   dwNameSpace; 
-  DWORD   dwValueType; 
-  DWORD   dwValueSize; 
-  LPTSTR  lpValueName; 
-  PVOID   lpValue; 
-} SERVICE_TYPE_VALUE_ABS; 
-typedef struct _SERVICE_TYPE_INFO_ABS { 
-  LPTSTR                  lpTypeName; 
-  DWORD                   dwValueCount; 
-  SERVICE_TYPE_VALUE_ABS  Values[1]; 
-} SERVICE_TYPE_INFO_ABS; 
-typedef struct _SESSION_BUFFER { 
-  UCHAR lsn; 
-  UCHAR state; 
-  UCHAR local_name[NCBNAMSZ]; 
-  UCHAR remote_name[NCBNAMSZ]; 
-  UCHAR rcvs_outstanding; 
-  UCHAR sends_outstanding; 
-} SESSION_BUFFER; 
-typedef struct _SESSION_HEADER { 
-  UCHAR sess_name; 
-  UCHAR num_sess; 
-  UCHAR rcv_dg_outstanding; 
-  UCHAR rcv_any_outstanding; 
-} SESSION_HEADER; 
+typedef struct _SERVICE_TYPE_VALUE_ABS {
+  DWORD   dwNameSpace;
+  DWORD   dwValueType;
+  DWORD   dwValueSize;
+  LPTSTR  lpValueName;
+  PVOID   lpValue;
+} SERVICE_TYPE_VALUE_ABS;
+
+typedef struct _SERVICE_TYPE_INFO_ABS {
+  LPTSTR                  lpTypeName;
+  DWORD                   dwValueCount;
+  SERVICE_TYPE_VALUE_ABS  Values[1];
+} SERVICE_TYPE_INFO_ABS;
+
+typedef struct _SESSION_BUFFER {
+  UCHAR lsn;
+  UCHAR state;
+  UCHAR local_name[NCBNAMSZ];
+  UCHAR remote_name[NCBNAMSZ];
+  UCHAR rcvs_outstanding;
+  UCHAR sends_outstanding;
+} SESSION_BUFFER;
+
+typedef struct _SESSION_HEADER {
+  UCHAR sess_name;
+  UCHAR num_sess;
+  UCHAR rcv_dg_outstanding;
+  UCHAR rcv_any_outstanding;
+} SESSION_HEADER;
+
 typedef enum tagSHCONTF { 
   SHCONTF_FOLDERS = 32,         
   SHCONTF_NONFOLDERS = 64,      
@@ -3584,45 +3584,45 @@ typedef struct tagSOUNDSENTRY {
 } SOUNDSENTRY, *LPSOUNDSENTRY; 
  
 typedef struct _STARTUPINFOA {
-  DWORD   cb; 
-  LPSTR   lpReserved; 
-  LPSTR   lpDesktop; 
-  LPSTR   lpTitle; 
-  DWORD   dwX; 
-  DWORD   dwY; 
-  DWORD   dwXSize; 
-  DWORD   dwYSize; 
-  DWORD   dwXCountChars; 
-  DWORD   dwYCountChars; 
-  DWORD   dwFillAttribute; 
-  DWORD   dwFlags; 
-  WORD    wShowWindow; 
-  WORD    cbReserved2; 
-  LPBYTE  lpReserved2; 
-  HANDLE  hStdInput; 
-  HANDLE  hStdOutput; 
-  HANDLE  hStdError; 
+  DWORD   cb;
+  LPSTR   lpReserved;
+  LPSTR   lpDesktop;
+  LPSTR   lpTitle;
+  DWORD   dwX;
+  DWORD   dwY;
+  DWORD   dwXSize;
+  DWORD   dwYSize;
+  DWORD   dwXCountChars;
+  DWORD   dwYCountChars;
+  DWORD   dwFillAttribute;
+  DWORD   dwFlags;
+  WORD    wShowWindow;
+  WORD    cbReserved2;
+  LPBYTE  lpReserved2;
+  HANDLE  hStdInput;
+  HANDLE  hStdOutput;
+  HANDLE  hStdError;
 } STARTUPINFOA, *LPSTARTUPINFOA;
 
 typedef struct _STARTUPINFOW {
-  DWORD   cb; 
-  LPWSTR  lpReserved; 
-  LPWSTR  lpDesktop; 
-  LPWSTR  lpTitle; 
-  DWORD   dwX; 
-  DWORD   dwY; 
-  DWORD   dwXSize; 
-  DWORD   dwYSize; 
-  DWORD   dwXCountChars; 
-  DWORD   dwYCountChars; 
-  DWORD   dwFillAttribute; 
-  DWORD   dwFlags; 
-  WORD    wShowWindow; 
-  WORD    cbReserved2; 
-  LPBYTE  lpReserved2; 
-  HANDLE  hStdInput; 
-  HANDLE  hStdOutput; 
-  HANDLE  hStdError; 
+  DWORD   cb;
+  LPWSTR  lpReserved;
+  LPWSTR  lpDesktop;
+  LPWSTR  lpTitle;
+  DWORD   dwX;
+  DWORD   dwY;
+  DWORD   dwXSize;
+  DWORD   dwYSize;
+  DWORD   dwXCountChars;
+  DWORD   dwYCountChars;
+  DWORD   dwFillAttribute;
+  DWORD   dwFlags;
+  WORD    wShowWindow;
+  WORD    cbReserved2;
+  LPBYTE  lpReserved2;
+  HANDLE  hStdInput;
+  HANDLE  hStdOutput;
+  HANDLE  hStdError;
 } STARTUPINFOW, *LPSTARTUPINFOW;
 
 #ifdef UNICODE
@@ -3633,39 +3633,39 @@ typedef STARTUPINFOA STARTUPINFO;
 typedef LPSTARTUPINFOA LPSTARTUPINFO;
 #endif /* UNICODE */
 
-typedef struct tagSTICKYKEYS {  
-  DWORD cbSize; 
-  DWORD dwFlags; 
-} STICKYKEYS, *LPSTICKYKEYS; 
-typedef struct _STRRET { 
-  UINT uType; 
-  union 
-    { 
-      LPWSTR pOleStr;        
-      UINT   uOffset;        
-      char   cStr[MAX_PATH]; 
-    } DUMMYUNIONNAME; 
-} STRRET, *LPSTRRET; 
+typedef struct tagSTICKYKEYS {
+  DWORD cbSize;
+  DWORD dwFlags;
+} STICKYKEYS, *LPSTICKYKEYS;
+
+typedef struct _STRRET {
+  UINT uType;
+  union
+    {
+      LPWSTR pOleStr;
+      UINT   uOffset;
+      char   cStr[MAX_PATH];
+    } DUMMYUNIONNAME;
+} STRRET, *LPSTRRET;
+
 typedef struct _tagSTYLEBUF {
-  DWORD  dwStyle;           
-  CHAR  szDescription[32];  
+  DWORD  dwStyle;
+  CHAR  szDescription[32];
 } STYLEBUF, *LPSTYLEBUF;
-typedef struct tagSTYLESTRUCT {  
-  DWORD styleOld;    
-  DWORD styleNew;    
-} STYLESTRUCT, * LPSTYLESTRUCT; 
-typedef struct _SYSTEM_AUDIT_ACE { 
-  ACE_HEADER  Header; 
-  ACCESS_MASK Mask; 
-  DWORD       SidStart; 
-} SYSTEM_AUDIT_ACE; 
+
+typedef struct tagSTYLESTRUCT {
+  DWORD styleOld;
+  DWORD styleNew;
+} STYLESTRUCT, * LPSTYLESTRUCT;
+
+typedef struct _SYSTEM_AUDIT_ACE {
+  ACE_HEADER  Header;
+  ACCESS_MASK Mask;
+  DWORD       SidStart;
+} SYSTEM_AUDIT_ACE;
+
 typedef struct _SYSTEM_INFO
-{ 
+{
   union
     {
       DWORD dwOemId;
@@ -3677,156 +3677,156 @@ typedef struct _SYSTEM_INFO
       s;
     }
   u;
-  DWORD  dwPageSize; 
-  LPVOID lpMinimumApplicationAddress; 
-  LPVOID lpMaximumApplicationAddress; 
-  DWORD  dwActiveProcessorMask; 
-  DWORD  dwNumberOfProcessors; 
-  DWORD  dwProcessorType; 
-  DWORD  dwAllocationGranularity; 
-  WORD  wProcessorLevel; 
-  WORD  wProcessorRevision; 
-} SYSTEM_INFO, *LPSYSTEM_INFO; 
+  DWORD  dwPageSize;
+  LPVOID lpMinimumApplicationAddress;
+  LPVOID lpMaximumApplicationAddress;
+  DWORD  dwActiveProcessorMask;
+  DWORD  dwNumberOfProcessors;
+  DWORD  dwProcessorType;
+  DWORD  dwAllocationGranularity;
+  WORD  wProcessorLevel;
+  WORD  wProcessorRevision;
+} SYSTEM_INFO, *LPSYSTEM_INFO;
+
 typedef struct _SYSTEM_POWER_STATUS {
-  BYTE ACLineStatus;           
-  BYTE  BatteryFlag;           
-  BYTE  BatteryLifePercent;    
-  BYTE  Reserved1;             
-  DWORD  BatteryLifeTime;      
-  DWORD  BatteryFullLifeTime;  
+  BYTE ACLineStatus;
+  BYTE  BatteryFlag;
+  BYTE  BatteryLifePercent;
+  BYTE  Reserved1;
+  DWORD  BatteryLifeTime;
+  DWORD  BatteryFullLifeTime;
 } SYSTEM_POWER_STATUS;
 typedef SYSTEM_POWER_STATUS *LPSYSTEM_POWER_STATUS;
-typedef struct _TAPE_ERASE { 
-  ULONG Type; 
-} TAPE_ERASE; 
-typedef struct _TAPE_GET_DRIVE_PARAMETERS { 
-  BOOLEAN ECC; 
-  BOOLEAN Compression; 
-  BOOLEAN DataPadding; 
-  BOOLEAN ReportSetmarks; 
-  ULONG   DefaultBlockSize; 
-  ULONG   MaximumBlockSize; 
-  ULONG   MinimumBlockSize; 
-  ULONG   MaximumPartitionCount; 
-  ULONG   FeaturesLow; 
-  ULONG   FeaturesHigh; 
-  ULONG   EOTWarningZoneSize; 
-} TAPE_GET_DRIVE_PARAMETERS; 
-typedef struct _TAPE_GET_MEDIA_PARAMETERS {  
-  LARGE_INTEGER   Capacity; 
-  LARGE_INTEGER   Remaining; 
-  DWORD   BlockSize; 
-  DWORD   PartitionCount; 
-  BOOLEAN WriteProtected; 
-} TAPE_GET_MEDIA_PARAMETERS; 
-typedef struct _TAPE_GET_POSITION { 
-  ULONG Type; 
-  ULONG Partition; 
-  ULONG OffsetLow; 
-  ULONG OffsetHigh; 
-} TAPE_GET_POSITION; 
-typedef struct _TAPE_PREPARE { 
-  ULONG Operation; 
-} TAPE_PREPARE; 
-typedef struct _TAPE_SET_DRIVE_PARAMETERS { 
-  BOOLEAN ECC; 
-  BOOLEAN Compression; 
-  BOOLEAN DataPadding; 
-  BOOLEAN ReportSetmarks; 
-  ULONG   EOTWarningZoneSize; 
-} TAPE_SET_DRIVE_PARAMETERS; 
-typedef struct _TAPE_SET_MEDIA_PARAMETERS { 
-  ULONG BlockSize; 
-} TAPE_SET_MEDIA_PARAMETERS; 
-typedef struct _TAPE_SET_POSITION { 
-  ULONG Method; 
-  ULONG Partition; 
-  ULONG OffsetLow; 
-  ULONG OffsetHigh; 
-} TAPE_SET_POSITION; 
-typedef struct _TAPE_WRITE_MARKS { 
-  ULONG Type; 
-  ULONG Count; 
-} TAPE_WRITE_MARKS; 
-typedef struct {  
-  HINSTANCE hInst; 
-  UINT nID; 
-} TBADDBITMAP, *LPTBADDBITMAP; 
-typedef struct _TBBUTTON { 
-  int iBitmap; 
-  int idCommand; 
-  BYTE fsState; 
-  BYTE fsStyle; 
-  DWORD dwData; 
-  int iString; 
-} TBBUTTON,  * PTBBUTTON,  * LPTBBUTTON; 
-typedef const TBBUTTON  * LPCTBBUTTON; 
-typedef struct { 
-  NMHDR hdr; 
-  int iItem; 
-  TBBUTTON tbButton; 
-  int cchText; 
-  LPTSTR pszText; 
-} TBNOTIFY,  *LPTBNOTIFY; 
-typedef struct { 
-  HKEY hkr; 
-  LPCTSTR pszSubKey; 
-  LPCTSTR pszValueName; 
-} TBSAVEPARAMS; 
-typedef struct _TC_HITTESTINFO { 
-  POINT pt;     
-  UINT  flags;  
-} TC_HITTESTINFO; 
-typedef struct _TC_ITEM { 
-  UINT mask;         
-  UINT lpReserved1;  
-  UINT lpReserved2;  
-  LPTSTR pszText;     
-  int cchTextMax;    
-  int iImage;        
-  LPARAM lParam;     
-} TC_ITEM; 
-typedef struct _TC_ITEMHEADER { 
-  UINT mask;         
-  UINT lpReserved1;  
-  UINT lpReserved2;  
-  LPTSTR pszText;     
-  int cchTextMax;    
-  int iImage;        
-} TC_ITEMHEADER; 
-typedef struct _TC_KEYDOWN { 
-  NMHDR hdr;    
-  WORD wVKey;   
+
+typedef struct _TAPE_ERASE {
+  ULONG Type;
+} TAPE_ERASE;
+
+typedef struct _TAPE_GET_DRIVE_PARAMETERS {
+  BOOLEAN ECC;
+  BOOLEAN Compression;
+  BOOLEAN DataPadding;
+  BOOLEAN ReportSetmarks;
+  ULONG   DefaultBlockSize;
+  ULONG   MaximumBlockSize;
+  ULONG   MinimumBlockSize;
+  ULONG   MaximumPartitionCount;
+  ULONG   FeaturesLow;
+  ULONG   FeaturesHigh;
+  ULONG   EOTWarningZoneSize;
+} TAPE_GET_DRIVE_PARAMETERS;
+
+typedef struct _TAPE_GET_MEDIA_PARAMETERS {
+  LARGE_INTEGER   Capacity;
+  LARGE_INTEGER   Remaining;
+  DWORD   BlockSize;
+  DWORD   PartitionCount;
+  BOOLEAN WriteProtected;
+} TAPE_GET_MEDIA_PARAMETERS;
+
+typedef struct _TAPE_GET_POSITION {
+  ULONG Type;
+  ULONG Partition;
+  ULONG OffsetLow;
+  ULONG OffsetHigh;
+} TAPE_GET_POSITION;
+
+typedef struct _TAPE_PREPARE {
+  ULONG Operation;
+} TAPE_PREPARE;
+
+typedef struct _TAPE_SET_DRIVE_PARAMETERS {
+  BOOLEAN ECC;
+  BOOLEAN Compression;
+  BOOLEAN DataPadding;
+  BOOLEAN ReportSetmarks;
+  ULONG   EOTWarningZoneSize;
+} TAPE_SET_DRIVE_PARAMETERS;
+
+typedef struct _TAPE_SET_MEDIA_PARAMETERS {
+  ULONG BlockSize;
+} TAPE_SET_MEDIA_PARAMETERS;
+
+typedef struct _TAPE_SET_POSITION {
+  ULONG Method;
+  ULONG Partition;
+  ULONG OffsetLow;
+  ULONG OffsetHigh;
+} TAPE_SET_POSITION;
+
+typedef struct _TAPE_WRITE_MARKS {
+  ULONG Type;
+  ULONG Count;
+} TAPE_WRITE_MARKS;
+
+typedef struct {
+  HINSTANCE hInst;
+  UINT nID;
+} TBADDBITMAP, *LPTBADDBITMAP;
+
+typedef struct _TBBUTTON {
+  int iBitmap;
+  int idCommand;
+  BYTE fsState;
+  BYTE fsStyle;
+  DWORD dwData;
+  int iString;
+} TBBUTTON,  * PTBBUTTON,  * LPTBBUTTON;
+typedef const TBBUTTON  * LPCTBBUTTON;
+
+typedef struct {
+  NMHDR hdr;
+  int iItem;
+  TBBUTTON tbButton;
+  int cchText;
+  LPTSTR pszText;
+} TBNOTIFY,  *LPTBNOTIFY;
+
+typedef struct {
+  HKEY hkr;
+  LPCTSTR pszSubKey;
+  LPCTSTR pszValueName;
+} TBSAVEPARAMS;
+
+typedef struct _TC_HITTESTINFO {
+  POINT pt;
+  UINT  flags;
+} TC_HITTESTINFO;
+
+typedef struct _TC_ITEM {
+  UINT mask;
+  UINT lpReserved1;
+  UINT lpReserved2;
+  LPTSTR pszText;
+  int cchTextMax;
+  int iImage;
+  LPARAM lParam;
+} TC_ITEM;
+
+typedef struct _TC_ITEMHEADER {
+  UINT mask;
+  UINT lpReserved1;
+  UINT lpReserved2;
+  LPTSTR pszText;
+  int cchTextMax;
+  int iImage;
+} TC_ITEMHEADER;
+
+typedef struct _TC_KEYDOWN {
+  NMHDR hdr;
+  WORD wVKey;
   UINT flags;
-} TC_KEYDOWN; 
-typedef struct _textrange { 
-  CHARRANGE chrg; 
-  LPSTR lpstrText; 
-} TEXTRANGE; 
+} TC_KEYDOWN;
+
+typedef struct _textrange {
+  CHARRANGE chrg;
+  LPSTR lpstrText;
+} TEXTRANGE;
+
 typedef struct tagTOGGLEKEYS {
-  DWORD cbSize; 
-  DWORD dwFlags; 
-} TOGGLEKEYS; 
+  DWORD cbSize;
+  DWORD dwFlags;
+} TOGGLEKEYS;
 
 typedef struct {
   UINT      cbSize;
@@ -3838,92 +3838,92 @@ typedef struct {
   LPTSTR     lpszText;
 } TOOLINFO, *PTOOLINFO, *LPTOOLINFO;
 
-typedef struct { 
-  NMHDR     hdr;        
-  LPTSTR    lpszText;   
-  char      szText[80]; 
-  HINSTANCE hinst;      
-  UINT      uFlags;     
-} TOOLTIPTEXT,   *LPTOOLTIPTEXT; 
-typedef struct tagTPMPARAMS { 
-  UINT cbSize; 
-  RECT rcExclude; 
-} TPMPARAMS,   *LPTPMPARAMS; 
-typedef struct _TRANSMIT_FILE_BUFFERS {  
-  PVOID Head; 
-  DWORD HeadLength; 
-  PVOID Tail; 
-  DWORD TailLength; 
-} TRANSMIT_FILE_BUFFERS; 
-typedef struct _TT_HITTESTINFO { 
-  HWND hwnd;   
-  POINT pt;    
-  TOOLINFO ti; 
-} TTHITTESTINFO,   * LPHITTESTINFO; 
-typedef struct tagTTPOLYCURVE { 
-  WORD    wType; 
-  WORD    cpfx; 
-  POINTFX apfx[1]; 
-} TTPOLYCURVE,  * LPTTPOLYCURVE; 
-typedef struct _TTPOLYGONHEADER { 
-  DWORD   cb; 
-  DWORD   dwType; 
-  POINTFX pfxStart; 
-} TTPOLYGONHEADER,  * LPTTPOLYGONHEADER; 
-typedef struct _TV_DISPINFO { 
-  NMHDR   hdr;  
-  TV_ITEM item;  
-} TV_DISPINFO; 
-typedef struct _TVHITTESTINFO { 
-  POINT     pt;     
-  UINT      flags;  
-  HTREEITEM hItem;  
-} TV_HITTESTINFO,   *LPTV_HITTESTINFO; 
-typedef struct _TV_INSERTSTRUCT { 
-  HTREEITEM hParent;       
-  HTREEITEM hInsertAfter;  
-  TV_ITEM   item;          
-} TV_INSERTSTRUCT,   *LPTV_INSERTSTRUCT; 
+typedef struct {
+  NMHDR     hdr;
+  LPTSTR    lpszText;
+  char      szText[80];
+  HINSTANCE hinst;
+  UINT      uFlags;
+} TOOLTIPTEXT,   *LPTOOLTIPTEXT;
+
+typedef struct tagTPMPARAMS {
+  UINT cbSize;
+  RECT rcExclude;
+} TPMPARAMS,   *LPTPMPARAMS;
+
+typedef struct _TRANSMIT_FILE_BUFFERS {
+  PVOID Head;
+  DWORD HeadLength;
+  PVOID Tail;
+  DWORD TailLength;
+} TRANSMIT_FILE_BUFFERS;
+
+typedef struct _TT_HITTESTINFO {
+  HWND hwnd;
+  POINT pt;
+  TOOLINFO ti;
+} TTHITTESTINFO,   * LPHITTESTINFO;
+
+typedef struct tagTTPOLYCURVE {
+  WORD    wType;
+  WORD    cpfx;
+  POINTFX apfx[1];
+} TTPOLYCURVE,  * LPTTPOLYCURVE;
+
+typedef struct _TTPOLYGONHEADER {
+  DWORD   cb;
+  DWORD   dwType;
+  POINTFX pfxStart;
+} TTPOLYGONHEADER,  * LPTTPOLYGONHEADER;
+
+typedef struct _TV_DISPINFO {
+  NMHDR   hdr;
+  TV_ITEM item;
+} TV_DISPINFO;
+
+typedef struct _TVHITTESTINFO {
+  POINT     pt;
+  UINT      flags;
+  HTREEITEM hItem;
+} TV_HITTESTINFO,   *LPTV_HITTESTINFO;
+
+typedef struct _TV_INSERTSTRUCT {
+  HTREEITEM hParent;
+  HTREEITEM hInsertAfter;
+  TV_ITEM   item;
+} TV_INSERTSTRUCT,   *LPTV_INSERTSTRUCT;
+
 typedef struct _TV_KEYDOWN {
-  NMHDR hdr;    
-  WORD  wVKey;  
-  UINT  flags;  
-} TV_KEYDOWN; 
-typedef struct _TV_SORTCB { 
-  HTREEITEM    hParent;       
-  PFNTVCOMPARE lpfnCompare;   
-  LPARAM       lParam;        
-} TV_SORTCB,   *LPTV_SORTCB;  
-typedef struct { 
-  UINT nSec;   
-  UINT nInc;   
-} UDACCEL; 
-  
-typedef struct _UNIVERSAL_NAME_INFO { 
-  LPTSTR  lpUniversalName; 
-} UNIVERSAL_NAME_INFO; 
-typedef struct tagUSEROBJECTFLAGS { 
-  WINBOOL fInherit; 
-  WINBOOL fReserved; 
-  DWORD dwFlags; 
-} USEROBJECTFLAGS; 
+  NMHDR hdr;
+  WORD  wVKey;
+  UINT  flags;
+} TV_KEYDOWN;
+
+typedef struct _TV_SORTCB {
+  HTREEITEM    hParent;
+  PFNTVCOMPARE lpfnCompare;
+  LPARAM       lParam;
+} TV_SORTCB,   *LPTV_SORTCB;
+
+typedef struct {
+  UINT nSec;
+  UINT nInc;
+} UDACCEL;
 
-typedef struct _VERIFY_INFORMATION { 
-  LARGE_INTEGER  StartingOffset; 
-  DWORD  Length; 
-} VERIFY_INFORMATION ; 
+typedef struct _UNIVERSAL_NAME_INFO {
+  LPTSTR  lpUniversalName;
+} UNIVERSAL_NAME_INFO;
+
+typedef struct tagUSEROBJECTFLAGS {
+  WINBOOL fInherit;
+  WINBOOL fReserved;
+  DWORD dwFlags;
+} USEROBJECTFLAGS;
+
+typedef struct _VERIFY_INFORMATION {
+  LARGE_INTEGER  StartingOffset;
+  DWORD  Length;
+} VERIFY_INFORMATION ;
 
 typedef struct _VS_FIXEDFILEINFO {
   DWORD dwSignature;
@@ -4057,18 +4057,18 @@ typedef struct _NETCONNECTINFOSTRUCT{
   DWORD dwOptDataSize;
 } NETCONNECTINFOSTRUCT, *LPNETCONNECTINFOSTRUCT;
 
-typedef int CALLBACK (*ENUMMETAFILEPROC) (HDC, HANDLETABLE, 
+typedef int CALLBACK (*ENUMMETAFILEPROC) (HDC, HANDLETABLE,
                                          METARECORD, int, LPARAM);
-typedef int CALLBACK (*ENHMETAFILEPROC) (HDC, HANDLETABLE, 
+typedef int CALLBACK (*ENHMETAFILEPROC) (HDC, HANDLETABLE,
                                         ENHMETARECORD, int, LPARAM);
 
 typedef int CALLBACK (*ENUMFONTSPROC) (LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM);
-typedef int CALLBACK (*FONTENUMPROC) (ENUMLOGFONT *, NEWTEXTMETRIC *, 
+typedef int CALLBACK (*FONTENUMPROC) (ENUMLOGFONT *, NEWTEXTMETRIC *,
                                      int, LPARAM);
-typedef int CALLBACK (*FONTENUMEXPROC) (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, 
+typedef int CALLBACK (*FONTENUMEXPROC) (ENUMLOGFONTEX *, NEWTEXTMETRICEX *,
                                      int, LPARAM);
 
-typedef VOID CALLBACK (*LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD, DWORD, 
+typedef VOID CALLBACK (*LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD, DWORD,
                                                          LPOVERLAPPED);
 
 /*
@@ -4321,7 +4321,7 @@ typedef struct tagMENUINFO {
   DWORD   dwContextHelpID;
   ULONG_PTR  dwMenuData;
 } MENUINFO, FAR *LPMENUINFO;
-typedef MENUINFO CONST FAR *LPCMENUINFO; 
+typedef MENUINFO CONST FAR *LPCMENUINFO;
 
 typedef struct tagMONITORINFO {
   DWORD cbSize;
@@ -4357,10 +4357,10 @@ typedef struct tagTITLEBARINFO {
   DWORD rgstate[CCHILDREN_TITLEBAR+1];
 } TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO;
 
-typedef struct { 
-  HWND hwnd; 
-  LPCTSTR szWindowName; 
-  UINT32 fToBeClosed; 
+typedef struct {
+  HWND hwnd;
+  LPCTSTR szWindowName;
+  UINT32 fToBeClosed;
   UINT32 fToBeTerminated;
 } WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO;
 
index dca225b..4b8f7cb 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _WIN32K_CLIPRGN_H
 #define _WIN32K_CLIPRGN_H
 
+HRGN WINAPI SaveVisRgn(HDC hdc);
+INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn);
+
 int
 STDCALL
 W32kExcludeClipRect (
index 5df5abb..16094d6 100644 (file)
@@ -1,3 +1,10 @@
+#ifndef __WIN32K_FLOAT_H
+#define __WIN32K_FLOAT_H
+
+#include <win32k/math.h>
+#include <win32k/dc.h>
+#include <freetype/freetype.h>
+
 typedef struct tagFLOAT_POINT
 {
    FLOAT x, y;
@@ -18,7 +25,7 @@ static inline INT GDI_ROUND(FLOAT val)
 static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
 {
     FLOAT x, y;
-    
+
     /* Perform the transformation */
     x = point->x;
     y = point->y;
@@ -33,16 +40,17 @@ static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
 /* Performs a viewport-to-world transformation on the specified point (which
  * is in integer format). Returns TRUE if successful, else FALSE.
  */
+#if 0
 static inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
 {
     FLOAT_POINT floatPoint;
-    
+
     /* Perform operation with floating point */
     floatPoint.x=(FLOAT)point->x;
     floatPoint.y=(FLOAT)point->y;
     if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
         return FALSE;
-    
+
     /* Round to integers */
     point->x = GDI_ROUND(floatPoint.x);
     point->y = GDI_ROUND(floatPoint.y);
@@ -56,17 +64,21 @@ static inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
 static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
 {
     FLOAT_POINT floatPoint;
-    
+
     /* Perform operation with floating point */
     floatPoint.x=(FLOAT)point->x;
     floatPoint.y=(FLOAT)point->y;
     INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
-    
+
     /* Round to integers */
     point->x = GDI_ROUND(floatPoint.x);
     point->y = GDI_ROUND(floatPoint.y);
 }
 
+#endif
+
+#define MulDiv( x, y, z ) EngMulDiv( x, y, z )
+
 #define XDPTOLP(dc,x) \
     (MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
 #define YDPTOLP(dc,y) \
@@ -86,3 +98,5 @@ static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
     MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
 #define YLSTODS(dc,y) \
     MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)
+
+#endif
index 1b6b80b..6665a1e 100644 (file)
@@ -2,32 +2,16 @@
 #ifndef __WIN32K_REGION_H
 #define __WIN32K_REGION_H
 
-#include <structs.h>
 #include <win32k/gdiobj.h>
 
-/*  Internal functions  */
-/*
-#define  RGNDATA_PtrToHandle(pRgn)  \
-  ((HRGN) GDIOBJ_PtrToHandle ((PGDIOBJ) pRgn, GO_REGION_MAGIC))
-*/
-#define  RGNDATA_HandleToPtr(hRgn)  \
-  ((RGNDATA *) GDIOBJ_LockObj ((HGDIOBJ) hRgn, GO_REGION_MAGIC))
+#define  RGNDATA_FreeRgn(hRgn)  GDIOBJ_FreeObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
+#define  RGNDATA_LockRgn(hRgn) ((PRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC))
+#define  RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
+HRGN RGNDATA_AllocRgn(INT n);
 
-/* call GDIOBJ_ReleaseObj when reference counting is added */
-#define RGNDATA_Release(hRgn) {}
-
-/* GDI logical region object */
-typedef struct tagRGNOBJ
-{
-    GDIOBJHDR   header;
-    RGNDATA*    rgn;
-} RGNOBJ;
+BOOL RGNDATA_InternalDelete( PRGNDATA Obj );
 
 /*  User entry points */
-INT STDCALL
-W32kGetBoxRgn(HRGN hRgn, PRECT Rect);
-HRGN STDCALL
-W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point);
 HRGN STDCALL
 W32kUnionRectWithRgn(HRGN hDest, const RECT* Rect);
 
index 9968995..e5e6f0b 100644 (file)
@@ -18,6 +18,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <windows.h>
 
 double atan (double __x);
 double atan2 (double __y, double __x);
@@ -207,3 +208,50 @@ double tan (double __x)
 
   return __value;
 }
+
+//FIXME! Is there a better algorithm. like FT_MulDiv
+INT STDCALL EngMulDiv(
+            INT nMultiplicand,
+            INT nMultiplier,
+            INT nDivisor)
+{
+#if SIZEOF_LONG_LONG >= 8
+    long long ret;
+
+    if (!nDivisor) return -1;
+
+    /* We want to deal with a positive divisor to simplify the logic. */
+    if (nDivisor < 0)
+    {
+      nMultiplicand = - nMultiplicand;
+      nDivisor = -nDivisor;
+    }
+
+    /* If the result is positive, we "add" to round. else, we subtract to round. */
+    if ( ( (nMultiplicand <  0) && (nMultiplier <  0) ) ||
+        ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+      ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+    else
+      ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
+
+    if ((ret > 2147483647) || (ret < -2147483647)) return -1;
+    return ret;
+#else
+    if (!nDivisor) return -1;
+
+    /* We want to deal with a positive divisor to simplify the logic. */
+    if (nDivisor < 0)
+    {
+      nMultiplicand = - nMultiplicand;
+      nDivisor = -nDivisor;
+    }
+
+    /* If the result is positive, we "add" to round. else, we subtract to round. */
+    if ( ( (nMultiplicand <  0) && (nMultiplier <  0) ) ||
+        ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+      return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+
+    return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
+
+#endif
+}
index ac2afb0..6ff7e5a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: painting.c,v 1.1 2002/07/04 20:12:27 dwelch Exp $
+/* $Id: painting.c,v 1.2 2002/07/18 21:59:18 ei Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -23,6 +23,7 @@
 #include <user32/wininternal.h>
 #include <include/rect.h>
 #include <win32k/coord.h>
+#include <win32k/region.h>
 
 
 #define NDEBUG
@@ -47,7 +48,7 @@ PaintDoPaint(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags, ULONG ExFlags)
   BOOL bIcon = (Window->Style & WS_MINIMIZE) &&
     NtUserGetClassLong(hWnd, GCL_HICON);
 
-  if (ExFlags & RDW_EX_DELAY_NCPAINT || 
+  if (ExFlags & RDW_EX_DELAY_NCPAINT ||
       PaintHaveToDelayNCPaint(Window, 0))
     {
       ExFlags |= RDW_EX_DELAY_NCPAINT;
@@ -66,12 +67,12 @@ PaintDoPaint(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags, ULONG ExFlags)
        DCX_WINDOWPAINT | DCX_CACHE;
       HRGN hRgnRet;
 
-      hRgnRet = 
+      hRgnRet =
        PaintUpdateNCRegion(Window,
                         hRgn,
                         UNC_REGION | UNC_CHECK |
                         ((ExFlags & RDW_EX_TOPFRAME) ? UNC_ENTIRE : 0) |
-                        ((ExFlags & RDW_EX_DELAY_NCPAINT) ? 
+                        ((ExFlags & RDW_EX_DELAY_NCPAINT) ?
                          UNC_DELAY_NCPAINT : 0));
       if (hRgnRet != NULL)
        {
@@ -91,8 +92,8 @@ PaintDoPaint(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags, ULONG ExFlags)
                }
              if (hRgnRet)
                {
-                 W32kOffsetRgn(hRgnRet, 
-                               Window->WindowRect.left - 
+                 W32kOffsetRgn(hRgnRet,
+                               Window->WindowRect.left -
                                Window->ClientRect.left,
                                Window->WindowRect.top -
                                Window->ClientRect.top);
@@ -123,7 +124,7 @@ PaintDoPaint(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags, ULONG ExFlags)
 }
 
 VOID STATIC
-PaintUpdateRgns(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags, 
+PaintUpdateRgns(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags,
                BOOL First)
 {
 
@@ -173,11 +174,11 @@ PaintRedrawWindow(HWND hWnd, const RECT* UpdateRect, HRGN UpdateRgn,
        {
          if (Window->UpdateRegion != NULL)
            {
-             hRgn = W32kCropRgn(0, UpdateRgn, NULL, &Pt);
+             hRgn = REGION_CropRgn(0, UpdateRgn, NULL, &Pt);
            }
          else
            {
-             Window->UpdateRegion = W32kCropRgn(0, UpdateRgn, &Rect, &Pt);
+             Window->UpdateRegion = REGION_CropRgn(0, UpdateRgn, &Rect, &Pt);
            }
        }
       else if (UpdateRect != NULL)
@@ -282,7 +283,7 @@ PaintingFindWinToRepaint(HWND hWnd, PW32THREAD Thread)
       return(hFoundWnd);
     }
 
-  Status = 
+  Status =
     ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
                               hWnd,
                               otWindow,
@@ -329,7 +330,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
       Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
       if (Window->UpdateRegion > (HANDLE)1)
        {
-         hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
+         hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
        }
       else
        {
@@ -338,7 +339,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
       return(hRgnRet);
     }
 
-  if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT && 
+  if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT &&
       !PaintHaveToDelayNCPaint(Window, Flags))
     {
       RECT UpdateRegionBox;
@@ -355,7 +356,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
              Rect.right != ClientRect.right || Rect.right != ClientRect.right)
            {
              hClip = Window->UpdateRegion;
-             Window->UpdateRegion = W32kCropRgn(hRgn, hClip,
+             Window->UpdateRegion = REGION_CropRgn(hRgn, hClip,
                                                 &Rect, NULL);
              if (Flags & UNC_REGION)
                {
@@ -365,7 +366,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
 
          if (Flags & UNC_CHECK)
            {
-             W32kGetBoxRgn(Window->UpdateRegion, &UpdateRegionBox);
+             W32kGetRgnBox(Window->UpdateRegion, &UpdateRegionBox);
              if (W32kIsEmptyRect(&UpdateRegionBox))
                {
                  W32kDeleteObject(Window->UpdateRegion);
@@ -377,7 +378,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
 
          if (!hClip && Window->UpdateRegion && Flags & UNC_REGION)
            {
-             hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL,
+             hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL,
                                    NULL);
            }
        }
@@ -398,7 +399,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
     {
       if (Window->UpdateRegion > (HANDLE)1 && Flags & UNC_REGION)
        {
-         hRgnRet = W32kCropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
+         hRgnRet = REGION_CropRgn(hRgn, Window->UpdateRegion, NULL, NULL);
        }
       else if (Window->UpdateRegion == (HANDLE)1 && Flags & UNC_UPDATE)
        {
@@ -413,7 +414,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
 
   if (hClip == NULL && Flags & UNC_ENTIRE)
     {
-      if (RtlCompareMemory(&Window->WindowRect, &Window->ClientRect, 
+      if (RtlCompareMemory(&Window->WindowRect, &Window->ClientRect,
                           sizeof(RECT)) == sizeof(RECT))
        {
          hClip = (HANDLE)1;
@@ -459,7 +460,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
   RECT ClipRect;
   NTSTATUS Status;
 
-  Status = 
+  Status =
     ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
                               hWnd,
                               otWindow,
@@ -469,9 +470,9 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
       return(NULL);
     }
 
-  IsIcon = Window->Style & WS_MINIMIZE && 
+  IsIcon = Window->Style & WS_MINIMIZE &&
     NtUserGetClassLong(Window->Self, GCL_HICON);
-  
+
   Window->Flags &= ~WINDOWOBJECT_NEED_BEGINPAINT;
 
   /* Send WM_NCPAINT */
@@ -499,8 +500,8 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
     {
       if (UpdateRegion != NULL)
        {
-         W32kOffsetRgn(UpdateRegion, 
-                       Window->WindowRect.left - 
+         W32kOffsetRgn(UpdateRegion,
+                       Window->WindowRect.left -
                        Window->ClientRect.left,
                        Window->WindowRect.top -
                        Window->ClientRect.top);
@@ -522,7 +523,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
     {
       BOOLEAN Result;
       Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBACKGRD;
-      Result = NtUserSendMessage(hWnd, 
+      Result = NtUserSendMessage(hWnd,
                                 IsIcon ? WM_ICONERASEBKGND : WM_ERASEBKGND,
                                 (WPARAM)lPs->hdc,
                                 0);
index 9ca5834..9898151 100644 (file)
@@ -4,6 +4,7 @@
 #include <windows.h>
 #include <ddk/ntddk.h>
 #include <win32k/dc.h>
+#include <win32k/region.h>
 #include <win32k/cliprgn.h>
 
 // #define NDEBUG
@@ -14,43 +15,39 @@ HRGN WINAPI SaveVisRgn(HDC hdc)
   HRGN copy;
   PRGNDATA obj, copyObj;
   PDC dc = DC_HandleToPtr(hdc);
-/*ei
+
   if (!dc) return 0;
 
-  obj = RGNDATA_HandleToPtr(dc->w.hVisRgn);
+  obj = RGNDATA_LockRgn(dc->w.hVisRgn);
 
-  if(!(copy = CreateRectRgn(0, 0, 0, 0)))
+  if(!(copy = W32kCreateRectRgn(0, 0, 0, 0)))
   {
-    GDI_ReleaseObj(dc->w.hVisRgn);
-    GDI_ReleaseObj(hdc);
+    RGNDATA_UnlockRgn(dc->w.hVisRgn);
+    DC_ReleasePtr(hdc);
     return 0;
   }
-  CombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
-  copyObj = RGNDATA_HandleToPtr(copy);
-*/
+  W32kCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
+  copyObj = RGNDATA_LockRgn(copy);
 /*  copyObj->header.hNext = obj->header.hNext;
   header.hNext = copy; */
-  DC_ReleasePtr( hdc );
+
   return copy;
 }
 
-INT16 WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
+INT WINAPI SelectVisRgn(HDC hdc, HRGN hrgn)
 {
-       return ERROR;
-/*ei
   int retval;
   DC *dc;
 
   if (!hrgn) return ERROR;
   if (!(dc = DC_HandleToPtr(hdc))) return ERROR;
 
-  dc->flags &= ~DC_DIRTY;
+  dc->w.flags &= ~DC_DIRTY;
 
-  retval = CombineRgn(dc->hVisRgn, hrgn, 0, RGN_COPY);
-  CLIPPING_UpdateGCRegion(dc);
+  retval = W32kCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
+  //ei CLIPPING_UpdateGCRegion(dc);
 
   return retval;
-*/
 }
 
 int STDCALL W32kExcludeClipRect(HDC  hDC,
index 10f818b..e2a4865 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * GDIOBJ.C - GDI object manipulation routines
  *
- * $Id: gdiobj.c,v 1.12 2002/07/13 21:37:27 ei Exp $
+ * $Id: gdiobj.c,v 1.13 2002/07/18 21:59:18 ei Exp $
  *
  */
 
@@ -213,7 +213,8 @@ BOOL  GDIOBJ_FreeObj(HGDIOBJ hObj, WORD Magic)
        Obj = (PGDIOBJ)((PCHAR)handleEntry->pObject + sizeof(GDIOBJHDR));
        switch( handleEntry->wMagic ){
                case GO_REGION_MAGIC:
-
+                       bRet = RGNDATA_InternalDelete( (PRGNDATA) Obj );
+                       break;
                case GO_PEN_MAGIC:
                case GO_PALETTE_MAGIC:
                case GO_BITMAP_MAGIC:
@@ -290,6 +291,7 @@ BOOL GDIOBJ_UnlockObj( HGDIOBJ hObj, WORD Magic )
 
        if( objectHeader->dwCount  == 0x80000000 ){
                //delayed object release
+               objectHeader->dwCount = 0;
                ExReleaseFastMutex(&RefCountHandling);
                DPRINT("GDIOBJ_UnlockObj: delayed delete\n");
                return GDIOBJ_FreeObj( hObj, Magic );
@@ -439,31 +441,6 @@ HGDIOBJ STDCALL  W32kGetStockObject(INT  Object)
 
 BOOL STDCALL  W32kDeleteObject(HGDIOBJ hObject)
 {
-/* ei: Now this is handled in gdiobj.c
-  PGDIOBJ  Obj;
-  PGDIOBJHDR  ObjHdr;
-  WORD  magic;
-
-  magic = GDIOBJ_GetHandleMagic (hObject);
-  Obj = GDIOBJ_HandleToPtr( hObject, GO_MAGIC_DONTCARE );
-  if( !Obj )
-    return FALSE;
-  ObjHdr = (PGDIOBJHDR)(((PCHAR)Obj) - sizeof (GDIOBJHDR));
-  switch( magic )
-  {
-    case GO_BITMAP_MAGIC: {
-      DPRINT( "Deleting bitmap\n" );
-      ExFreePool( ((PBITMAPOBJ)Obj)->bitmap.bmBits );
-      BITMAPOBJ_FreeBitmap( Obj );
-      break;
-    }
-    default: {
-      DPRINT( "W32kDeleteObject: Deleting object of unknown type %x\n", magic );
-      return FALSE;
-    }
-  }
-  return TRUE;
- */
   return GDIOBJ_FreeObj( hObject, GO_MAGIC_DONTCARE );
 }
 
index 73ed9c1..197e7aa 100644 (file)
+#undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <ddk/ntddk.h>
+#include <internal/safe.h>
+#include <win32k/float.h>
+#include <win32k/dc.h>
+#include <win32k/bitmaps.h>
 #include <win32k/region.h>
-#include <win32k/gdiobj.h>
+#include <win32k/cliprgn.h>
+#include <include/rect.h>
 
-//#define NDEBUG
+
+// #define NDEBUG
 #include <win32k/debug1.h>
 
-/* FUNCTIONS *****************************************************************/
+// Internal Functions
+
+#define EMPTY_REGION(pReg) { \
+  (pReg)->rdh.nCount = 0; \
+  (pReg)->rdh.rcBound.left = (pReg)->rdh.rcBound.top = 0; \
+  (pReg)->rdh.rcBound.right = (pReg)->rdh.rcBound.bottom = 0; \
+  (pReg)->rdh.iType = NULLREGION; \
+}
+
+#define REGION_NOT_EMPTY(pReg) pReg->rdh.nCount
+
+#define INRECT(r, x, y) \
+      ( ( ((r).right >  x)) && \
+        ( ((r).left <= x)) && \
+        ( ((r).bottom >  y)) && \
+        ( ((r).top <= y)) )
+
+/*  1 if two RECTs overlap.
+ *  0 if two RECTs do not overlap.
+ */
+#define EXTENTCHECK(r1, r2) \
+       ((r1)->right > (r2)->left && \
+        (r1)->left < (r2)->right && \
+        (r1)->bottom > (r2)->top && \
+        (r1)->top < (r2)->bottom)
+
+/*
+ *   Check to see if there is enough memory in the present region.
+ */
+static inline int xmemcheck(RGNDATA *reg, LPRECT *rect, LPRECT *firstrect ) {
+       if ( (reg->rdh.nCount+1)*sizeof( RECT ) >= reg->rdh.nRgnSize ) {
+               PRECT temp;
+               temp = ExAllocatePool( PagedPool, (2 * (reg->rdh.nRgnSize)));
+
+               if (temp == 0)
+                   return 0;
+               RtlCopyMemory( temp, *firstrect, reg->rdh.nRgnSize );
+               reg->rdh.nRgnSize *= 2;
+               *rect = (*firstrect)+reg->rdh.nCount;
+    }
+    return 1;
+}
+
+#define MEMCHECK(reg, rect, firstrect) xmemcheck(reg,&(rect),&(firstrect))
+
+typedef void (*voidProcp)();
+
+// Number of points to buffer before sending them off to scanlines() :  Must be an even number
+#define NUMPTSTOBUFFER 200
+
+#define RGN_DEFAULT_RECTS      2
+
+// used to allocate buffers for points and link the buffers together
+
+typedef struct _POINTBLOCK {
+  POINT pts[NUMPTSTOBUFFER];
+  struct _POINTBLOCK *next;
+} POINTBLOCK;
 
-INT STDCALL
-W32kGetBoxRgn(HRGN hRgn, PRECT Rect)
+static BOOL REGION_CopyRegion(PRGNDATA dst, PRGNDATA src)
 {
-       return 0;
+  if(dst != src) //  don't want to copy to itself
+  {
+    if (dst->rdh.nRgnSize < src->rdh.nCount * sizeof(RECT))
+    {
+         PCHAR temp;
+
+         temp = ExAllocatePool(PagedPool, src->rdh.nCount * sizeof(RECT) );
+         if( !temp )
+               return FALSE;
+
+         if( dst->Buffer )
+               ExFreePool( dst->Buffer );      //free the old buffer
+         dst->Buffer = temp;
+      dst->rdh.nRgnSize = src->rdh.nCount * sizeof(RECT);  //size of region buffer
+    }
+    dst->rdh.nCount = src->rdh.nCount;                 //number of rectangles present in Buffer
+    dst->rdh.rcBound.left = src->rdh.rcBound.left;
+    dst->rdh.rcBound.top = src->rdh.rcBound.top;
+    dst->rdh.rcBound.right = src->rdh.rcBound.right;
+    dst->rdh.rcBound.bottom = src->rdh.rcBound.bottom;
+    dst->rdh.iType = src->rdh.iType;
+    RtlCopyMemory(dst->Buffer, src->Buffer, (int)(src->rdh.nCount * sizeof(RECT)));
+  }
+  return TRUE;
 }
 
-HRGN STDCALL
-W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point)
+static void REGION_SetExtents (RGNDATA *pReg)
 {
-       return NULL;
+    RECT *pRect, *pRectEnd, *pExtents;
+
+    if (pReg->rdh.nCount == 0)
+    {
+               pReg->rdh.rcBound.left = 0;
+               pReg->rdh.rcBound.top = 0;
+               pReg->rdh.rcBound.right = 0;
+               pReg->rdh.rcBound.bottom = 0;
+               return;
+    }
+
+    pExtents = &pReg->rdh.rcBound;
+    pRect = (PRECT)pReg->Buffer;
+    pRectEnd = (PRECT)pReg->Buffer + pReg->rdh.nCount - 1;
+
+    /*
+     * Since pRect is the first rectangle in the region, it must have the
+     * smallest top and since pRectEnd is the last rectangle in the region,
+     * it must have the largest bottom, because of banding. Initialize left and
+     * right from pRect and pRectEnd, resp., as good things to initialize them
+     * to...
+     */
+    pExtents->left = pRect->left;
+    pExtents->top = pRect->top;
+    pExtents->right = pRectEnd->right;
+    pExtents->bottom = pRectEnd->bottom;
+
+    while (pRect <= pRectEnd)
+    {
+               if (pRect->left < pExtents->left)
+                   pExtents->left = pRect->left;
+               if (pRect->right > pExtents->right)
+                   pExtents->right = pRect->right;
+               pRect++;
+    }
 }
 
-HRGN STDCALL
-W32kUnionRectWithRgn(HRGN hDest, const RECT* Rect)
+
+/***********************************************************************
+ *           REGION_CropAndOffsetRegion
+ */
+static BOOL REGION_CropAndOffsetRegion(const PPOINT off, const PRECT rect, PRGNDATA rgnSrc, PRGNDATA rgnDst)
+{
+  if(!rect) // just copy and offset
+  {
+    PRECT xrect;
+    if(rgnDst == rgnSrc)
+    {
+      if(off->x || off->y)
+        xrect = (PRECT)rgnDst->Buffer;
+      else
+        return TRUE;
+    }
+    else{
+      xrect = ExAllocatePool(PagedPool, rgnSrc->rdh.nCount * sizeof(RECT));
+         if( rgnDst->Buffer )
+               ExFreePool( rgnDst->Buffer ); //free the old buffer. will be assigned to xrect below.
+       }
+
+    if(xrect)
+    {
+      INT i;
+
+      if(rgnDst != rgnSrc)
+               RtlCopyMemory(rgnDst, rgnSrc, sizeof(RGNDATA));
+
+      if(off->x || off->y)
+      {
+        for(i = 0; i < rgnDst->rdh.nCount; i++)
+        {
+          xrect[i].left = ((PRECT)rgnSrc->Buffer + i)->left + off->x;
+          xrect[i].right = ((PRECT)rgnSrc->Buffer + i)->right + off->x;
+          xrect[i].top = ((PRECT)rgnSrc->Buffer + i)->top + off->y;
+          xrect[i].bottom = ((PRECT)rgnSrc->Buffer + i)->bottom + off->y;
+        }
+        rgnDst->rdh.rcBound.left   += off->x;
+        rgnDst->rdh.rcBound.right  += off->x;
+        rgnDst->rdh.rcBound.top    += off->y;
+        rgnDst->rdh.rcBound.bottom += off->y;
+      }
+      else
+        RtlCopyMemory(xrect, rgnSrc->Buffer, rgnDst->rdh.nCount * sizeof(RECT));
+
+         rgnDst->Buffer = (char*)xrect;
+    } else
+      return FALSE;
+  }
+  else if ((rect->left >= rect->right) ||
+           (rect->top >= rect->bottom) ||
+            !EXTENTCHECK(rect, &rgnSrc->rdh.rcBound))
+  {
+       goto empty;
+  }
+  else // region box and clipping rect appear to intersect
+  {
+    PRECT lpr, rpr;
+    INT i, j, clipa, clipb;
+    INT left = rgnSrc->rdh.rcBound.right + off->x;
+    INT right = rgnSrc->rdh.rcBound.left + off->x;
+
+    for(clipa = 0; ((PRECT)rgnSrc->Buffer + clipa)->bottom <= rect->top; clipa++)
+       //region and rect intersect so we stop before clipa > rgnSrc->rdh.nCount
+      ; // skip bands above the clipping rectangle
+
+    for(clipb = clipa; clipb < rgnSrc->rdh.nCount; clipb++)
+      if(((PRECT)rgnSrc->Buffer + clipb)->top >= rect->bottom)
+        break;    // and below it
+
+    // clipa - index of the first rect in the first intersecting band
+    // clipb - index of the last rect in the last intersecting band
+
+    if((rgnDst != rgnSrc) && (rgnDst->rdh.nCount < (i = (clipb - clipa))))
+    {
+         PCHAR temp;
+         temp = ExAllocatePool( PagedPool, i * sizeof(RECT) );
+      if(!temp)
+             return FALSE;
+
+         if( rgnDst->Buffer )
+               ExFreePool( rgnDst->Buffer ); //free the old buffer
+      (PRECT)rgnDst->Buffer = temp;
+      rgnDst->rdh.nCount = i;
+         rgnDst->rdh.nRgnSize = i * sizeof(RECT);
+    }
+
+    for(i = clipa, j = 0; i < clipb ; i++)
+    {
+      // i - src index, j - dst index, j is always <= i for obvious reasons
+
+      lpr = (PRECT)rgnSrc->Buffer + i;
+
+      if(lpr->left < rect->right && lpr->right > rect->left)
+      {
+           rpr = (PRECT)rgnDst->Buffer + j;
+
+        rpr->top = lpr->top + off->y;
+        rpr->bottom = lpr->bottom + off->y;
+        rpr->left = ((lpr->left > rect->left) ? lpr->left : rect->left) + off->x;
+        rpr->right = ((lpr->right < rect->right) ? lpr->right : rect->right) + off->x;
+
+        if(rpr->left < left) left = rpr->left;
+        if(rpr->right > right) right = rpr->right;
+
+        j++;
+      }
+    }
+
+    if(j == 0) goto empty;
+
+    rgnDst->rdh.rcBound.left = left;
+    rgnDst->rdh.rcBound.right = right;
+
+    left = rect->top + off->y;
+    right = rect->bottom + off->y;
+
+    rgnDst->rdh.nCount = j--;
+    for(i = 0; i <= j; i++) // fixup top band
+      if(((PRECT)rgnDst->Buffer + i)->top < left)
+        ((PRECT)rgnDst->Buffer + i)->top = left;
+      else
+        break;
+
+    for(i = j; i >= 0; i--) // fixup bottom band
+      if(((PRECT)rgnDst->Buffer + i)->bottom > right)
+        ((PRECT)rgnDst->Buffer + i)->bottom = right;
+      else
+        break;
+
+    rgnDst->rdh.rcBound.top = ((PRECT)rgnDst->Buffer)->top;
+    rgnDst->rdh.rcBound.bottom = ((PRECT)rgnDst->Buffer + j)->bottom;
+
+    rgnDst->rdh.iType = (j >= 1) ? COMPLEXREGION : SIMPLEREGION;
+  }
+
+  return TRUE;
+
+empty:
+       if(!rgnDst->Buffer)
+       {
+         rgnDst->Buffer = (char*)ExAllocatePool(PagedPool, RGN_DEFAULT_RECTS * sizeof(RECT));
+         if(rgnDst->Buffer){
+           rgnDst->rdh.nCount = RGN_DEFAULT_RECTS;
+               rgnDst->rdh.nRgnSize = RGN_DEFAULT_RECTS * sizeof(RECT);
+         }
+         else
+           return FALSE;
+       }
+       EMPTY_REGION(rgnDst);
+       return TRUE;
+}
+
+/***********************************************************************
+ *           REGION_CropRgn
+ *
+ *
+ * hSrc:       Region to crop and offset.
+ * lpRect:     Clipping rectangle. Can be NULL (no clipping).
+ * lpPt:       Points to offset the cropped region. Can be NULL (no offset).
+ *
+ * hDst: Region to hold the result (a new region is created if it's 0).
+ *       Allowed to be the same region as hSrc in which case everything
+ *      will be done in place, with no memory reallocations.
+ *
+ * Returns: hDst if success, 0 otherwise.
+ */
+HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, const PPOINT lpPt)
+{
+  PRGNDATA objSrc = RGNDATA_LockRgn(hSrc);
+  HRGN hNewDst;
+
+  if(objSrc)
+  {
+       PRGNDATA rgnDst;
+
+    if(hDst)
+    {
+      if(!(rgnDst = RGNDATA_LockRgn(hDst)))
+      {
+        hDst = 0;
+        goto done;
+      }
+    }
+       else{
+         if( !( hNewDst = RGNDATA_AllocRgn(1) ) ){
+               RGNDATA_UnlockRgn( hSrc );
+               return 0;
+         }
+
+      if(!(rgnDst = RGNDATA_LockRgn(hNewDst)))
+      {
+        RGNDATA_FreeRgn( hNewDst );
+               RGNDATA_UnlockRgn( hSrc );
+        return 0;
+      }
+       }
+
+    if(rgnDst)
+    {
+      POINT pt = { 0, 0 };
+
+         if(!lpPt)
+               lpPt = &pt;
+
+      if(REGION_CropAndOffsetRegion(lpPt, lpRect, objSrc, rgnDst) == FALSE)
+         { // ve failed cleanup and return
+               RGNDATA_UnlockRgn( hSrc );
+
+               if(hDst) // unlock new region if allocated
+                 RGNDATA_UnlockRgn( hDst );
+               else
+                 RGNDATA_UnlockRgn( hNewDst );
+
+               return 0;
+      }
+      else{ // ve are fine. unlock the correct pointer and return correct handle
+               RGNDATA_UnlockRgn( hSrc );
+
+               if(hDst == 0){
+                       RGNDATA_UnlockRgn( hNewDst );
+                       return hNewDst;
+               }
+               else {
+                       RGNDATA_UnlockRgn( hDst );
+                       return hDst;
+               }
+         }
+    }
+done:
+       RGNDATA_UnlockRgn( hSrc );
+  }
+  return 0;
+}
+
+/***********************************************************************
+ *           REGION_Coalesce
+ *
+ *      Attempt to merge the rects in the current band with those in the
+ *      previous one. Used only by REGION_RegionOp.
+ *
+ * Results:
+ *      The new index for the previous band.
+ *
+ * Side Effects:
+ *      If coalescing takes place:
+ *          - rectangles in the previous band will have their bottom fields
+ *            altered.
+ *          - pReg->numRects will be decreased.
+ *
+ */
+static INT REGION_Coalesce (
+            PRGNDATA pReg, /* Region to coalesce */
+            INT prevStart,  /* Index of start of previous band */
+            INT curStart    /* Index of start of current band */
+) {
+    RECT *pPrevRect;          /* Current rect in previous band */
+    RECT *pCurRect;           /* Current rect in current band */
+    RECT *pRegEnd;            /* End of region */
+    INT curNumRects;          /* Number of rectangles in current band */
+    INT prevNumRects;         /* Number of rectangles in previous band */
+    INT bandtop;               /* top coordinate for current band */
+
+    pRegEnd = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+    pPrevRect = (PRECT)pReg->Buffer + prevStart;
+    prevNumRects = curStart - prevStart;
+
+    /*
+     * Figure out how many rectangles are in the current band. Have to do
+     * this because multiple bands could have been added in REGION_RegionOp
+     * at the end when one region has been exhausted.
+     */
+    pCurRect = (PRECT)pReg->Buffer + curStart;
+    bandtop = pCurRect->top;
+    for (curNumRects = 0;
+        (pCurRect != pRegEnd) && (pCurRect->top == bandtop);
+        curNumRects++)
+    {
+               pCurRect++;
+    }
+
+    if (pCurRect != pRegEnd)
+    {
+               /*
+                * If more than one band was added, we have to find the start
+                * of the last band added so the next coalescing job can start
+                * at the right place... (given when multiple bands are added,
+                * this may be pointless -- see above).
+                */
+               pRegEnd--;
+               while ((pRegEnd-1)->top == pRegEnd->top)
+               {
+                   pRegEnd--;
+               }
+               curStart = pRegEnd - (PRECT)pReg->Buffer;
+               pRegEnd = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+    }
+
+    if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
+               pCurRect -= curNumRects;
+               /*
+                * The bands may only be coalesced if the bottom of the previous
+                * matches the top scanline of the current.
+                */
+               if (pPrevRect->bottom == pCurRect->top)
+               {
+                   /*
+                    * Make sure the bands have rects in the same places. This
+                    * assumes that rects have been added in such a way that they
+                    * cover the most area possible. I.e. two rects in a band must
+                    * have some horizontal space between them.
+                    */
+                   do
+                   {
+                               if ((pPrevRect->left != pCurRect->left) ||
+                                   (pPrevRect->right != pCurRect->right))
+                               {
+                                   /*
+                                    * The bands don't line up so they can't be coalesced.
+                                    */
+                                   return (curStart);
+                               }
+                               pPrevRect++;
+                               pCurRect++;
+                               prevNumRects -= 1;
+                   } while (prevNumRects != 0);
+
+                   pReg->rdh.nCount -= curNumRects;
+                   pCurRect -= curNumRects;
+                   pPrevRect -= curNumRects;
+
+                   /*
+                    * The bands may be merged, so set the bottom of each rect
+                    * in the previous band to that of the corresponding rect in
+                    * the current band.
+                    */
+                   do
+                   {
+                               pPrevRect->bottom = pCurRect->bottom;
+                               pPrevRect++;
+                               pCurRect++;
+                               curNumRects -= 1;
+                   } while (curNumRects != 0);
+
+                   /*
+                    * If only one band was added to the region, we have to backup
+                    * curStart to the start of the previous band.
+                    *
+                    * If more than one band was added to the region, copy the
+                    * other bands down. The assumption here is that the other bands
+                    * came from the same region as the current one and no further
+                    * coalescing can be done on them since it's all been done
+                    * already... curStart is already in the right place.
+                    */
+                   if (pCurRect == pRegEnd)
+                   {
+                               curStart = prevStart;
+                   }
+                   else
+                   {
+                               do
+                               {
+                                   *pPrevRect++ = *pCurRect++;
+                               } while (pCurRect != pRegEnd);
+                   }
+               }
+    }
+    return (curStart);
+}
+
+/***********************************************************************
+ *           REGION_RegionOp
+ *
+ *      Apply an operation to two regions. Called by REGION_Union,
+ *      REGION_Inverse, REGION_Subtract, REGION_Intersect...
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      The new region is overwritten.
+ *
+ * Notes:
+ *      The idea behind this function is to view the two regions as sets.
+ *      Together they cover a rectangle of area that this function divides
+ *      into horizontal bands where points are covered only by one region
+ *      or by both. For the first case, the nonOverlapFunc is called with
+ *      each the band and the band's upper and lower extents. For the
+ *      second, the overlapFunc is called to process the entire band. It
+ *      is responsible for clipping the rectangles in the band, though
+ *      this function provides the boundaries.
+ *      At the end of each band, the new region is coalesced, if possible,
+ *      to reduce the number of rectangles in the region.
+ *
+ */
+static void REGION_RegionOp(
+           RGNDATA *newReg, /* Place to store result */
+           RGNDATA *reg1,   /* First region in operation */
+        RGNDATA *reg2,   /* 2nd region in operation */
+           void (*overlapFunc)(),     /* Function to call for over-lapping bands */
+           void (*nonOverlap1Func)(), /* Function to call for non-overlapping bands in region 1 */
+           void (*nonOverlap2Func)()  /* Function to call for non-overlapping bands in region 2 */
+) {
+    RECT *r1;                         /* Pointer into first region */
+    RECT *r2;                         /* Pointer into 2d region */
+    RECT *r1End;                      /* End of 1st region */
+    RECT *r2End;                      /* End of 2d region */
+    INT ybot;                         /* Bottom of intersection */
+    INT ytop;                         /* Top of intersection */
+    RECT *oldRects;                   /* Old rects for newReg */
+    INT prevBand;                     /* Index of start of
+                                                * previous band in newReg */
+    INT curBand;                      /* Index of start of current
+                                                * band in newReg */
+    RECT *r1BandEnd;                  /* End of current band in r1 */
+    RECT *r2BandEnd;                  /* End of current band in r2 */
+    INT top;                          /* Top of non-overlapping band */
+    INT bot;                          /* Bottom of non-overlapping band */
+
+    /*
+     * Initialization:
+     *  set r1, r2, r1End and r2End appropriately, preserve the important
+     * parts of the destination region until the end in case it's one of
+     * the two source regions, then mark the "new" region empty, allocating
+     * another array of rectangles for it to use.
+     */
+    r1 = (PRECT)reg1->Buffer;
+    r2 = (PRECT)reg2->Buffer;
+    r1End = r1 + reg1->rdh.nCount;
+    r2End = r2 + reg2->rdh.nCount;
+
+
+    /*
+     * newReg may be one of the src regions so we can't empty it. We keep a
+     * note of its rects pointer (so that we can free them later), preserve its
+     * extents and simply set numRects to zero.
+     */
+
+    oldRects = (PRECT)newReg->Buffer;
+    newReg->rdh.nCount = 0;
+
+    /*
+     * Allocate a reasonable number of rectangles for the new region. The idea
+     * is to allocate enough so the individual functions don't need to
+     * reallocate and copy the array, which is time consuming, yet we don't
+     * have to worry about using too much memory. I hope to be able to
+     * nuke the Xrealloc() at the end of this function eventually.
+     */
+    newReg->rdh.nRgnSize = max(reg1->rdh.nCount,reg2->rdh.nCount) * 2 * sizeof(RECT);
+
+       if( newReg->Buffer )
+               ExFreePool( newReg->Buffer );
+
+    if (! (newReg->Buffer = ExAllocatePool( PagedPool, newReg->rdh.nRgnSize )))
+    {
+               newReg->rdh.nRgnSize = 0;
+               return;
+    }
+
+    /*
+     * Initialize ybot and ytop.
+     * In the upcoming loop, ybot and ytop serve different functions depending
+     * on whether the band being handled is an overlapping or non-overlapping
+     * band.
+     *  In the case of a non-overlapping band (only one of the regions
+     * has points in the band), ybot is the bottom of the most recent
+     * intersection and thus clips the top of the rectangles in that band.
+     * ytop is the top of the next intersection between the two regions and
+     * serves to clip the bottom of the rectangles in the current band.
+     *  For an overlapping band (where the two regions intersect), ytop clips
+     * the top of the rectangles of both regions and ybot clips the bottoms.
+     */
+    if (reg1->rdh.rcBound.top < reg2->rdh.rcBound.top)
+               ybot = reg1->rdh.rcBound.top;
+    else
+               ybot = reg2->rdh.rcBound.top;
+
+    /*
+     * prevBand serves to mark the start of the previous band so rectangles
+     * can be coalesced into larger rectangles. qv. miCoalesce, above.
+     * In the beginning, there is no previous band, so prevBand == curBand
+     * (curBand is set later on, of course, but the first band will always
+     * start at index 0). prevBand and curBand must be indices because of
+     * the possible expansion, and resultant moving, of the new region's
+     * array of rectangles.
+     */
+    prevBand = 0;
+
+    do
+    {
+               curBand = newReg->rdh.nCount;
+
+               /*
+                * This algorithm proceeds one source-band (as opposed to a
+                * destination band, which is determined by where the two regions
+                * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
+                * rectangle after the last one in the current band for their
+                * respective regions.
+                */
+               r1BandEnd = r1;
+               while ((r1BandEnd != r1End) && (r1BandEnd->top == r1->top))
+               {
+                   r1BandEnd++;
+               }
+
+               r2BandEnd = r2;
+               while ((r2BandEnd != r2End) && (r2BandEnd->top == r2->top))
+               {
+                   r2BandEnd++;
+               }
+
+               /*
+                * First handle the band that doesn't intersect, if any.
+                *
+                * Note that attention is restricted to one band in the
+                * non-intersecting region at once, so if a region has n
+                * bands between the current position and the next place it overlaps
+                * the other, this entire loop will be passed through n times.
+                */
+               if (r1->top < r2->top)
+               {
+                   top = max(r1->top,ybot);
+                   bot = min(r1->bottom,r2->top);
+
+                   if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
+                   {
+                               (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
+                   }
+
+                   ytop = r2->top;
+               }
+               else if (r2->top < r1->top)
+               {
+                   top = max(r2->top,ybot);
+                   bot = min(r2->bottom,r1->top);
+
+                   if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
+                   {
+                               (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
+                   }
+
+                   ytop = r1->top;
+               }
+               else
+               {
+                   ytop = r1->top;
+               }
+
+               /*
+                * If any rectangles got added to the region, try and coalesce them
+                * with rectangles from the previous band. Note we could just do
+                * this test in miCoalesce, but some machines incur a not
+                * inconsiderable cost for function calls, so...
+                */
+               if (newReg->rdh.nCount != curBand)
+               {
+                   prevBand = REGION_Coalesce (newReg, prevBand, curBand);
+               }
+
+               /*
+                * Now see if we've hit an intersecting band. The two bands only
+                * intersect if ybot > ytop
+                */
+               ybot = min(r1->bottom, r2->bottom);
+               curBand = newReg->rdh.nCount;
+               if (ybot > ytop)
+               {
+                   (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
+
+               }
+
+               if (newReg->rdh.nCount != curBand)
+               {
+                   prevBand = REGION_Coalesce (newReg, prevBand, curBand);
+               }
+
+               /*
+                * If we've finished with a band (bottom == ybot) we skip forward
+                * in the region to the next band.
+                */
+               if (r1->bottom == ybot)
+               {
+                   r1 = r1BandEnd;
+               }
+               if (r2->bottom == ybot)
+               {
+                   r2 = r2BandEnd;
+               }
+    } while ((r1 != r1End) && (r2 != r2End));
+
+    /*
+     * Deal with whichever region still has rectangles left.
+     */
+    curBand = newReg->rdh.nCount;
+    if (r1 != r1End)
+    {
+               if (nonOverlap1Func != (void (*)())NULL)
+               {
+                   do
+                   {
+                               r1BandEnd = r1;
+                               while ((r1BandEnd < r1End) && (r1BandEnd->top == r1->top))
+                               {
+                                   r1BandEnd++;
+                               }
+                               (* nonOverlap1Func) (newReg, r1, r1BandEnd,
+                                                    max(r1->top,ybot), r1->bottom);
+                               r1 = r1BandEnd;
+                   } while (r1 != r1End);
+               }
+    }
+    else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
+    {
+               do
+               {
+                   r2BandEnd = r2;
+                   while ((r2BandEnd < r2End) && (r2BandEnd->top == r2->top))
+                   {
+                        r2BandEnd++;
+                   }
+                   (* nonOverlap2Func) (newReg, r2, r2BandEnd,
+                                       max(r2->top,ybot), r2->bottom);
+                   r2 = r2BandEnd;
+               } while (r2 != r2End);
+    }
+
+    if (newReg->rdh.nCount != curBand)
+    {
+               (void) REGION_Coalesce (newReg, prevBand, curBand);
+    }
+
+    /*
+     * A bit of cleanup. To keep regions from growing without bound,
+     * we shrink the array of rectangles to match the new number of
+     * rectangles in the region. This never goes to 0, however...
+     *
+     * Only do this stuff if the number of rectangles allocated is more than
+     * twice the number of rectangles in the region (a simple optimization...).
+     */
+    if ((newReg->rdh.nCount*sizeof(RECT) < 2*newReg->rdh.nRgnSize && (newReg->rdh.nCount > 2)))
+    {
+               if (REGION_NOT_EMPTY(newReg))
+               {
+                   RECT *prev_rects = (PRECT)newReg->Buffer;
+                   newReg->Buffer = ExAllocatePool( PagedPool, newReg->rdh.nCount*sizeof(RECT) );
+
+                   if (! newReg->Buffer)
+                               newReg->Buffer = (char*)prev_rects;
+                       else{
+                               newReg->rdh.nRgnSize = newReg->rdh.nCount*sizeof(RECT);
+                               ExFreePool( prev_rects );
+                       }
+               }
+               else
+               {
+                   /*
+                    * No point in doing the extra work involved in an Xrealloc if
+                    * the region is empty
+                    */
+                   newReg->rdh.nRgnSize = sizeof(RECT);
+                   ExFreePool( newReg->Buffer );
+                   newReg->Buffer = ExAllocatePool( PagedPool, sizeof(RECT) );
+                       ASSERT( newReg->Buffer );
+               }
+    }
+    ExFreePool( oldRects );
+    return;
+}
+
+/***********************************************************************
+ *          Region Intersection
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *          REGION_IntersectO
+ *
+ * Handle an overlapping band for REGION_Intersect.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      Rectangles may be added to the region.
+ *
+ */
+static void REGION_IntersectO(RGNDATA *pReg,  RECT *r1, RECT *r1End,
+               RECT *r2, RECT *r2End, INT top, INT bottom)
+
+{
+    INT       left, right;
+    RECT      *pNextRect;
+
+    pNextRect = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+               left = max(r1->left, r2->left);
+               right = min(r1->right, r2->right);
+
+               /*
+                * If there's any overlap between the two rectangles, add that
+                * overlap to the new region.
+                * There's no need to check for subsumption because the only way
+                * such a need could arise is if some region has two rectangles
+                * right next to each other. Since that should never happen...
+                */
+               if (left < right)
+               {
+                   MEMCHECK(pReg, pNextRect, pReg->Buffer);
+                   pNextRect->left = left;
+                   pNextRect->top = top;
+                   pNextRect->right = right;
+                   pNextRect->bottom = bottom;
+                   pReg->rdh.nCount += 1;
+                   pNextRect++;
+               }
+
+               /*
+                * Need to advance the pointers. Shift the one that extends
+                * to the right the least, since the other still has a chance to
+                * overlap with that region's next rectangle, if you see what I mean.
+                */
+               if (r1->right < r2->right)
+               {
+                   r1++;
+               }
+               else if (r2->right < r1->right)
+               {
+                   r2++;
+               }
+               else
+               {
+                   r1++;
+                   r2++;
+               }
+    }
+    return;
+}
+
+/***********************************************************************
+ *          REGION_IntersectRegion
+ */
+static void REGION_IntersectRegion(RGNDATA *newReg, RGNDATA *reg1,
+                                  RGNDATA *reg2)
+{
+   /* check for trivial reject */
+    if ( (!(reg1->rdh.nCount)) || (!(reg2->rdh.nCount))  ||
+               (!EXTENTCHECK(&reg1->rdh.rcBound, &reg2->rdh.rcBound)))
+               newReg->rdh.nCount = 0;
+    else
+               REGION_RegionOp (newReg, reg1, reg2,
+                       (voidProcp) REGION_IntersectO, (voidProcp) NULL, (voidProcp) NULL);
+
+    /*
+     * Can't alter newReg's extents before we call miRegionOp because
+     * it might be one of the source regions and miRegionOp depends
+     * on the extents of those regions being the same. Besides, this
+     * way there's no checking against rectangles that will be nuked
+     * due to coalescing, so we have to examine fewer rectangles.
+     */
+    REGION_SetExtents(newReg);
+}
+
+/***********************************************************************
+ *          Region Union
+ ***********************************************************************/
+
+/***********************************************************************
+ *          REGION_UnionNonO
+ *
+ *      Handle a non-overlapping band for the union operation. Just
+ *      Adds the rectangles into the region. Doesn't have to check for
+ *      subsumption or anything.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg->numRects is incremented and the final rectangles overwritten
+ *      with the rectangles we're passed.
+ *
+ */
+static void REGION_UnionNonO (RGNDATA *pReg, RECT *r, RECT *rEnd,
+                             INT top, INT bottom)
+{
+    RECT *pNextRect;
+
+    pNextRect = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+
+    while (r != rEnd)
+    {
+               MEMCHECK(pReg, pNextRect, pReg->Buffer);
+               pNextRect->left = r->left;
+               pNextRect->top = top;
+               pNextRect->right = r->right;
+               pNextRect->bottom = bottom;
+               pReg->rdh.nCount += 1;
+               pNextRect++;
+               r++;
+    }
+    return;
+}
+
+/***********************************************************************
+ *          REGION_UnionO
+ *
+ *      Handle an overlapping band for the union operation. Picks the
+ *      left-most rectangle each time and merges it into the region.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      Rectangles are overwritten in pReg->rects and pReg->numRects will
+ *      be changed.
+ *
+ */
+static void REGION_UnionO (RGNDATA *pReg, RECT *r1, RECT *r1End,
+                          RECT *r2, RECT *r2End, INT top, INT bottom)
+{
+    RECT *pNextRect;
+
+    pNextRect = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+
+#define MERGERECT(r) \
+    if ((pReg->rdh.nCount != 0) &&  \
+               ((pNextRect-1)->top == top) &&  \
+               ((pNextRect-1)->bottom == bottom) &&  \
+               ((pNextRect-1)->right >= r->left))  \
+    {  \
+               if ((pNextRect-1)->right < r->right)  \
+               {  \
+                   (pNextRect-1)->right = r->right;  \
+               }  \
+    }  \
+    else  \
+    {  \
+               MEMCHECK(pReg, pNextRect, pReg->Buffer);  \
+               pNextRect->top = top;  \
+               pNextRect->bottom = bottom;  \
+               pNextRect->left = r->left;  \
+               pNextRect->right = r->right;  \
+               pReg->rdh.nCount += 1;  \
+               pNextRect += 1;  \
+    }  \
+    r++;
+
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+               if (r1->left < r2->left)
+               {
+                   MERGERECT(r1);
+               }
+               else
+               {
+                   MERGERECT(r2);
+               }
+    }
+
+    if (r1 != r1End)
+    {
+               do
+               {
+                   MERGERECT(r1);
+               } while (r1 != r1End);
+    }
+    else while (r2 != r2End)
+    {
+               MERGERECT(r2);
+    }
+    return;
+}
+
+/***********************************************************************
+ *          REGION_UnionRegion
+ */
+static void REGION_UnionRegion(RGNDATA *newReg, RGNDATA *reg1,
+                              RGNDATA *reg2)
+{
+    /*  checks all the simple cases */
+
+    /*
+     * Region 1 and 2 are the same or region 1 is empty
+     */
+    if ( (reg1 == reg2) || (!(reg1->rdh.nCount)) )
+    {
+               if (newReg != reg2)
+                   REGION_CopyRegion(newReg, reg2);
+               return;
+    }
+
+    /*
+     * if nothing to union (region 2 empty)
+     */
+    if (!(reg2->rdh.nCount))
+    {
+               if (newReg != reg1)
+                   REGION_CopyRegion(newReg, reg1);
+               return;
+    }
+
+    /*
+     * Region 1 completely subsumes region 2
+     */
+    if ((reg1->rdh.nCount == 1) &&
+               (reg1->rdh.rcBound.left <= reg2->rdh.rcBound.left) &&
+               (reg1->rdh.rcBound.top <= reg2->rdh.rcBound.top) &&
+               (reg1->rdh.rcBound.right >= reg2->rdh.rcBound.right) &&
+               (reg1->rdh.rcBound.bottom >= reg2->rdh.rcBound.bottom))
+    {
+               if (newReg != reg1)
+                   REGION_CopyRegion(newReg, reg1);
+               return;
+    }
+
+    /*
+     * Region 2 completely subsumes region 1
+     */
+    if ((reg2->rdh.nCount == 1) &&
+               (reg2->rdh.rcBound.left <= reg1->rdh.rcBound.left) &&
+               (reg2->rdh.rcBound.top <= reg1->rdh.rcBound.top) &&
+               (reg2->rdh.rcBound.right >= reg1->rdh.rcBound.right) &&
+               (reg2->rdh.rcBound.bottom >= reg1->rdh.rcBound.bottom))
+    {
+               if (newReg != reg2)
+                   REGION_CopyRegion(newReg, reg2);
+               return;
+    }
+
+    REGION_RegionOp (newReg, reg1, reg2, (voidProcp) REGION_UnionO,
+               (voidProcp) REGION_UnionNonO, (voidProcp) REGION_UnionNonO);
+
+    newReg->rdh.rcBound.left = min(reg1->rdh.rcBound.left, reg2->rdh.rcBound.left);
+    newReg->rdh.rcBound.top = min(reg1->rdh.rcBound.top, reg2->rdh.rcBound.top);
+    newReg->rdh.rcBound.right = max(reg1->rdh.rcBound.right, reg2->rdh.rcBound.right);
+    newReg->rdh.rcBound.bottom = max(reg1->rdh.rcBound.bottom, reg2->rdh.rcBound.bottom);
+}
+
+/***********************************************************************
+ *          Region Subtraction
+ ***********************************************************************/
+
+/***********************************************************************
+ *          REGION_SubtractNonO1
+ *
+ *      Deal with non-overlapping band for subtraction. Any parts from
+ *      region 2 we discard. Anything from region 1 we add to the region.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg may be affected.
+ *
+ */
+static void REGION_SubtractNonO1 (RGNDATA *pReg, RECT *r, RECT *rEnd,
+               INT top, INT bottom)
+{
+    RECT *pNextRect;
+
+    pNextRect = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+
+    while (r != rEnd)
+    {
+               MEMCHECK(pReg, pNextRect, pReg->Buffer);
+               pNextRect->left = r->left;
+               pNextRect->top = top;
+               pNextRect->right = r->right;
+               pNextRect->bottom = bottom;
+               pReg->rdh.nCount += 1;
+               pNextRect++;
+               r++;
+    }
+    return;
+}
+
+
+/***********************************************************************
+ *          REGION_SubtractO
+ *
+ *      Overlapping band subtraction. x1 is the left-most point not yet
+ *      checked.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg may have rectangles added to it.
+ *
+ */
+static void REGION_SubtractO (RGNDATA *pReg, RECT *r1, RECT *r1End,
+               RECT *r2, RECT *r2End, INT top, INT bottom)
+{
+    RECT *pNextRect;
+    INT left;
+
+    left = r1->left;
+    pNextRect = (PRECT)pReg->Buffer + pReg->rdh.nCount;
+
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+               if (r2->right <= left)
+               {
+                   /*
+                    * Subtrahend missed the boat: go to next subtrahend.
+                    */
+                   r2++;
+               }
+               else if (r2->left <= left)
+               {
+                   /*
+                    * Subtrahend preceeds minuend: nuke left edge of minuend.
+                    */
+                   left = r2->right;
+                   if (left >= r1->right)
+                   {
+                       /*
+                        * Minuend completely covered: advance to next minuend and
+                        * reset left fence to edge of new minuend.
+                        */
+                       r1++;
+                       if (r1 != r1End)
+                           left = r1->left;
+                   }
+                   else
+                   {
+                       /*
+                        * Subtrahend now used up since it doesn't extend beyond
+                        * minuend
+                        */
+                       r2++;
+                   }
+               }
+               else if (r2->left < r1->right)
+               {
+                   /*
+                    * Left part of subtrahend covers part of minuend: add uncovered
+                    * part of minuend to region and skip to next subtrahend.
+                    */
+                   MEMCHECK(pReg, pNextRect, pReg->Buffer);
+                   pNextRect->left = left;
+                   pNextRect->top = top;
+                   pNextRect->right = r2->left;
+                   pNextRect->bottom = bottom;
+                   pReg->rdh.nCount += 1;
+                   pNextRect++;
+                   left = r2->right;
+                   if (left >= r1->right)
+                   {
+                       /*
+                        * Minuend used up: advance to new...
+                        */
+                       r1++;
+                       if (r1 != r1End)
+                           left = r1->left;
+                   }
+                   else
+                   {
+                       /*
+                        * Subtrahend used up
+                        */
+                       r2++;
+                   }
+               }
+               else
+               {
+                   /*
+                    * Minuend used up: add any remaining piece before advancing.
+                    */
+                   if (r1->right > left)
+                   {
+                               MEMCHECK(pReg, pNextRect, pReg->Buffer);
+                               pNextRect->left = left;
+                               pNextRect->top = top;
+                               pNextRect->right = r1->right;
+                               pNextRect->bottom = bottom;
+                               pReg->rdh.nCount += 1;
+                               pNextRect++;
+                   }
+                   r1++;
+                   left = r1->left;
+               }
+    }
+
+    /*
+     * Add remaining minuend rectangles to region.
+     */
+    while (r1 != r1End)
+    {
+               MEMCHECK(pReg, pNextRect, pReg->Buffer);
+               pNextRect->left = left;
+               pNextRect->top = top;
+               pNextRect->right = r1->right;
+               pNextRect->bottom = bottom;
+               pReg->rdh.nCount += 1;
+               pNextRect++;
+               r1++;
+               if (r1 != r1End)
+               {
+                   left = r1->left;
+               }
+    }
+    return;
+}
+
+/***********************************************************************
+ *          REGION_SubtractRegion
+ *
+ *      Subtract regS from regM and leave the result in regD.
+ *      S stands for subtrahend, M for minuend and D for difference.
+ *
+ * Results:
+ *      TRUE.
+ *
+ * Side Effects:
+ *      regD is overwritten.
+ *
+ */
+static void REGION_SubtractRegion(RGNDATA *regD, RGNDATA *regM,
+                                                      RGNDATA *regS )
+{
+   /* check for trivial reject */
+    if ( (!(regM->rdh.nCount)) || (!(regS->rdh.nCount))  ||
+               (!EXTENTCHECK(&regM->rdh.rcBound, &regS->rdh.rcBound)) )
+    {
+               REGION_CopyRegion(regD, regM);
+               return;
+    }
+
+    REGION_RegionOp (regD, regM, regS, (voidProcp) REGION_SubtractO,
+               (voidProcp) REGION_SubtractNonO1, (voidProcp) NULL);
+
+    /*
+     * Can't alter newReg's extents before we call miRegionOp because
+     * it might be one of the source regions and miRegionOp depends
+     * on the extents of those regions being the unaltered. Besides, this
+     * way there's no checking against rectangles that will be nuked
+     * due to coalescing, so we have to examine fewer rectangles.
+     */
+    REGION_SetExtents (regD);
+}
+
+/***********************************************************************
+ *          REGION_XorRegion
+ */
+static void REGION_XorRegion(RGNDATA *dr, RGNDATA *sra,
+                                                       RGNDATA *srb)
+{
+       HRGN htra, htrb;
+    RGNDATA *tra, *trb;
+
+    if ((! (htra = RGNDATA_AllocRgn(sra->rdh.nCount + 1))) ||
+               (! (htrb = RGNDATA_AllocRgn(srb->rdh.nCount + 1))))
+       return;
+       tra = RGNDATA_LockRgn( htra );
+       if( !tra ){
+               W32kDeleteObject( htra );
+               W32kDeleteObject( htrb );
+               return;
+       }
+
+       trb = RGNDATA_LockRgn( htrb );
+       if( !trb ){
+               RGNDATA_UnlockRgn( htra );
+               W32kDeleteObject( htra );
+               W32kDeleteObject( htrb );
+               return;
+       }
+
+    REGION_SubtractRegion(tra,sra,srb);
+    REGION_SubtractRegion(trb,srb,sra);
+    REGION_UnionRegion(dr,tra,trb);
+       RGNDATA_UnlockRgn( htra );
+       RGNDATA_UnlockRgn( htrb );
+
+    W32kDeleteObject( htra );
+    W32kDeleteObject( htrb );
+    return;
+}
+
+
+/***********************************************************************
+ *           REGION_UnionRectWithRegion
+ *           Adds a rectangle to a WINEREGION
+ */
+static void REGION_UnionRectWithRegion(const RECT *rect, RGNDATA *rgn)
+{
+    RGNDATA region;
+
+    region.Buffer = (char*)(&(region.rdh.rcBound));
+    region.rdh.nCount = 1;
+    region.rdh.nRgnSize = sizeof( RECT );
+    region.rdh.rcBound = *rect;
+    REGION_UnionRegion(rgn, rgn, &region);
+}
+
+
+BOOL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
+{
+  RECT *pCurRect, *pEndRect;
+  PRGNDATA srcObj = NULL;
+  PRGNDATA destObj = NULL;
+
+  DC * dc = DC_HandleToPtr(hdc);
+  RECT tmpRect;
+  BOOL ret = FALSE;
+
+  if(!dc)
+    return ret;
+
+  if(dc->w.MapMode == MM_TEXT) // Requires only a translation
+  {
+    if(W32kCombineRgn(hDest, hSrc, 0, RGN_COPY) == ERROR)
+         goto done;
+
+    W32kOffsetRgn(hDest, dc->vportOrgX - dc->wndOrgX, dc->vportOrgY - dc->wndOrgY);
+    ret = TRUE;
+    goto done;
+  }
+
+  if(!( srcObj = (PRGNDATA) RGNDATA_LockRgn( hSrc ) ))
+        goto done;
+  if(!( destObj = (PRGNDATA) RGNDATA_LockRgn( hDest ) ))
+  {
+    RGNDATA_UnlockRgn( hSrc );
+    goto done;
+  }
+  EMPTY_REGION(destObj);
+
+  pEndRect = (PRECT)srcObj->Buffer + srcObj->rdh.nCount;
+  for(pCurRect = (PRECT)srcObj->Buffer; pCurRect < pEndRect; pCurRect++)
+  {
+    tmpRect = *pCurRect;
+    tmpRect.left = XLPTODP(dc, tmpRect.left);
+    tmpRect.top = YLPTODP(dc, tmpRect.top);
+    tmpRect.right = XLPTODP(dc, tmpRect.right);
+    tmpRect.bottom = YLPTODP(dc, tmpRect.bottom);
+
+    if(tmpRect.left > tmpRect.right)
+      { INT tmp = tmpRect.left; tmpRect.left = tmpRect.right; tmpRect.right = tmp; }
+    if(tmpRect.top > tmpRect.bottom)
+      { INT tmp = tmpRect.top; tmpRect.top = tmpRect.bottom; tmpRect.bottom = tmp; }
+
+    REGION_UnionRectWithRegion(&tmpRect, destObj);
+  }
+  ret = TRUE;
+
+  RGNDATA_UnlockRgn( hSrc );
+  RGNDATA_UnlockRgn( hDest );
+
+done:
+  DC_ReleasePtr( hdc );
+  return ret;
+}
+
+HRGN RGNDATA_AllocRgn(INT n)
+{
+  HRGN hReg;
+  PRGNDATA pReg;
+  BOOL bRet;
+
+  if((hReg = (HRGN)GDIOBJ_AllocObj(sizeof(RGNDATA), GO_REGION_MAGIC))){
+       if( (pReg = GDIOBJ_LockObj( hReg, GO_REGION_MAGIC )) ){
+
+      if ((pReg->Buffer = ExAllocatePool(PagedPool, n * sizeof(RECT)))){
+       pReg->rdh.dwSize = sizeof(RGNDATAHEADER);
+       pReg->rdh.nCount = n;
+       pReg->rdh.nRgnSize = n*sizeof(RECT);
+       EMPTY_REGION(pReg);
+
+        bRet = GDIOBJ_UnlockObj( hReg, GO_REGION_MAGIC );
+        ASSERT(bRet);
+
+       return hReg;
+         }
+
+       }
+       else
+               GDIOBJ_FreeObj( hReg, GO_REGION_MAGIC );
+  }
+  return NULL;
+}
+
+BOOL RGNDATA_InternalDelete( PRGNDATA pRgn )
 {
+  ASSERT(pRgn);
+  if(pRgn->Buffer)
+    ExFreePool(pRgn->Buffer);
+  return TRUE;
 }
 
-INT STDCALL
+// W32k Exported Functions
+INT
+STDCALL
 W32kCombineRgn(HRGN  hDest,
-              HRGN  hSrc1,
-              HRGN  hSrc2,
-              INT  CombineMode)
+                    HRGN  hSrc1,
+                    HRGN  hSrc2,
+                    INT  CombineMode)
 {
-  UNIMPLEMENTED;
+  INT result = ERROR;
+  PRGNDATA destRgn = RGNDATA_LockRgn(hDest);
+
+  if( destRgn ){
+       PRGNDATA src1Rgn = RGNDATA_LockRgn(hSrc1);
+
+       if( src1Rgn ){
+               if (CombineMode == RGN_COPY)
+               {
+                 if( !REGION_CopyRegion(destRgn, src1Rgn) )
+                               return ERROR;
+                 result = destRgn->rdh.iType;
+               }
+               else
+               {
+                 PRGNDATA src2Rgn = RGNDATA_LockRgn(hSrc2);
+                 if( src2Rgn ){
+                         switch (CombineMode)
+                         {
+                           case RGN_AND:
+                             REGION_IntersectRegion(destRgn, src1Rgn, src2Rgn);
+                             break;
+                           case RGN_OR:
+                             REGION_UnionRegion(destRgn, src1Rgn, src2Rgn);
+                             break;
+                           case RGN_XOR:
+                             REGION_XorRegion(destRgn, src1Rgn, src2Rgn);
+                             break;
+                           case RGN_DIFF:
+                             REGION_SubtractRegion(destRgn, src1Rgn, src2Rgn);
+                             break;
+                         }
+                         result = destRgn->rdh.iType;
+                 }
+                 RGNDATA_UnlockRgn( hSrc1 );
+               }
+               RGNDATA_UnlockRgn( hDest );
+       }
+       else{
+               DPRINT("W32kCombineRgn: hDest unavailable\n");
+               return ERROR;
+       }
+  }
+  return result;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kCreateEllipticRgn(INT  LeftRect,
-                     INT  TopRect,
-                     INT  RightRect,
-                     INT  BottomRect)
+                            INT  TopRect,
+                            INT  RightRect,
+                            INT  BottomRect)
 {
   UNIMPLEMENTED;
 }
 
-HRGN STDCALL
-W32kCreateEllipticRgnIndirect(CONST PRECT rc)
+HRGN
+STDCALL
+W32kCreateEllipticRgnIndirect(CONST PRECT  rc)
 {
   UNIMPLEMENTED;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kCreatePolygonRgn(CONST PPOINT  pt,
-                    INT  Count,
-                    INT  PolyFillMode)
+                           INT  Count,
+                           INT  PolyFillMode)
 {
   UNIMPLEMENTED;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kCreatePolyPolygonRgn(CONST PPOINT  pt,
-                        CONST PINT  PolyCounts,
-                        INT  Count,
-                        INT  PolyFillMode)
+                               CONST PINT  PolyCounts,
+                               INT  Count,
+                               INT  PolyFillMode)
 {
   UNIMPLEMENTED;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kCreateRectRgn(INT  LeftRect,
-                 INT  TopRect,
-                 INT  RightRect,
-                 INT  BottomRect)
+                        INT  TopRect,
+                        INT  RightRect,
+                        INT  BottomRect)
 {
-  RGNDATA* Region;
-  PRECT Rect;
-/*
-  DPRINT("W32kCreateRectRgn(LeftRect %d, TopRect %d, RightRect %d, "
-        "BottomRect %d)\n", LeftRect, TopRect, RightRect, BottomRect);
+  HRGN hRgn;
+  PRGNDATA pRgnData;
+  PRECT pRect;
+
+  // Allocate region data structure with space for 1 RECT
+  if( ( hRgn = RGNDATA_AllocRgn(1) ) ){
+       if( ( pRgnData = RGNDATA_LockRgn( hRgn ) ) ){
+       pRect = (PRECT)pRgnData->Buffer;
+       ASSERT(pRect);
 
-  Region = (RGNDATA*)GDIOBJ_AllocObject(sizeof(RGNDATA) + sizeof(RECT) - 1, 0);
-  Region->rdh.dwSize = sizeof(RGNDATA) + sizeof(RECT) - 1;
-  Region->rdh.iType = RDH_RECTANGLES;
-  Region->rdh.nCount = 0;
-  Rect = (PRECT)Region->Buffer;
-  Rect->left = LeftRect;
-  Rect->right = RightRect;
-  Rect->top = TopRect;
-  Rect->bottom = BottomRect;
-  Region->rdh.rcBound = *Rect;
+       // Fill in the region data header
+       pRgnData->rdh.iType = RDH_RECTANGLES;
+       W32kSetRect(&(pRgnData->rdh.rcBound), LeftRect, TopRect, RightRect, BottomRect);
 
-  return(GDIOBJ_PtrToHandle((PGDIOBJ)Region, 0));
-*/
-return NULL;
+       // use W32kCopyRect when implemented
+       W32kSetRect(pRect, LeftRect, TopRect, RightRect, BottomRect);
+               RGNDATA_UnlockRgn( hRgn );
+
+       return hRgn;
+       }
+       W32kDeleteObject( hRgn );
+  }
+  DPRINT("W32kCreateRectRgn: can't allocate region\n");
+  return NULL;
 }
 
-HRGN STDCALL
-W32kCreateRectRgnIndirect(CONST PRECT rc)
+HRGN
+STDCALL
+W32kCreateRectRgnIndirect(CONST PRECT  rc)
 {
-  return(W32kCreateRectRgn(rc->left, rc->top, rc->right, rc->bottom));
+  RECT SafeRc;
+  if( NT_SUCCESS( MmCopyFromCaller( &SafeRc, rc, sizeof( RECT ) ) ) )
+         return W32kCreateRectRgn(SafeRc.left, SafeRc.top, SafeRc.right, SafeRc.bottom);
+
+  return NULL;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kCreateRoundRectRgn(INT  LeftRect,
-                      INT  TopRect,
-                      INT  RightRect,
-                      INT  BottomRect,
-                      INT  WidthEllipse,
-                      INT  HeightEllipse)
+                             INT  TopRect,
+                             INT  RightRect,
+                             INT  BottomRect,
+                             INT  WidthEllipse,
+                             INT  HeightEllipse)
 {
   UNIMPLEMENTED;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kEqualRgn(HRGN  hSrcRgn1,
-            HRGN  hSrcRgn2)
+                   HRGN  hSrcRgn2)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn1, rgn2;
+  PRECT tRect1, tRect2;
+  int i;
+  BOOL bRet = FALSE;
+
+  if( !(rgn1 = RGNDATA_LockRgn(hSrcRgn1)))
+       return ERROR;
+
+  if( !(rgn2 = RGNDATA_LockRgn(hSrcRgn2))){
+       RGNDATA_UnlockRgn( hSrcRgn1 );
+       return ERROR;
+  }
+
+  if(rgn1->rdh.nCount != rgn2->rdh.nCount ||
+       rgn1->rdh.nCount == 0 ||
+       rgn1->rdh.rcBound.left   != rgn2->rdh.rcBound.left ||
+       rgn1->rdh.rcBound.right  != rgn2->rdh.rcBound.right ||
+       rgn1->rdh.rcBound.top    != rgn2->rdh.rcBound.top ||
+       rgn1->rdh.rcBound.bottom != rgn2->rdh.rcBound.bottom)
+       goto exit;
+
+  tRect1 = (PRECT)rgn1->Buffer;
+  tRect2 = (PRECT)rgn2->Buffer;
+
+  if( !tRect1 || !tRect2 )
+       goto exit;
+
+  for(i=0; i < rgn1->rdh.nCount; i++)
+  {
+    if(tRect1[i].left   != tRect2[i].left ||
+               tRect1[i].right  != tRect2[i].right ||
+               tRect1[i].top    != tRect2[i].top ||
+               tRect1[i].bottom != tRect2[i].bottom)
+          goto exit;;
+  }
+  bRet = TRUE;
+
+exit:
+  RGNDATA_UnlockRgn( hSrcRgn1 );
+  RGNDATA_UnlockRgn( hSrcRgn2 );
+  return bRet;
 }
 
-HRGN STDCALL
+HRGN
+STDCALL
 W32kExtCreateRegion(CONST PXFORM  Xform,
-                   DWORD  Count,
-                   CONST PRGNDATA  RgnData)
+                          DWORD  Count,
+                          CONST PRGNDATA  RgnData)
 {
-  UNIMPLEMENTED;
+  HRGN hRgn;
+
+  // FIXME: Apply Xform transformation to the regional data
+  if(Xform != NULL) {
+
+  }
+
+  return hRgn;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kFillRgn(HDC  hDC,
-           HRGN  hRgn,
-           HBRUSH  hBrush)
+                  HRGN  hRgn,
+                  HBRUSH  hBrush)
 {
   UNIMPLEMENTED;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kFrameRgn(HDC  hDC,
-            HRGN  hRgn,
-            HBRUSH  hBrush,
-            INT  Width,
-            INT  Height)
+                   HRGN  hRgn,
+                   HBRUSH  hBrush,
+                   INT  Width,
+                   INT  Height)
 {
   UNIMPLEMENTED;
 }
 
-INT STDCALL
+
+INT
+STDCALL
 W32kGetRgnBox(HRGN  hRgn,
-             LPRECT  hRect)
+                   LPRECT  pRect)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn = RGNDATA_LockRgn(hRgn);
+  DWORD ret;
+
+  if( rgn ){
+       RECT SafeRect;
+       SafeRect.left = rgn->rdh.rcBound.left;
+       SafeRect.top = rgn->rdh.rcBound.top;
+       SafeRect.right = rgn->rdh.rcBound.right;
+       SafeRect.bottom = rgn->rdh.rcBound.bottom;
+       ret = rgn->rdh.iType;
+       RGNDATA_UnlockRgn( hRgn );
+
+       if(!NT_SUCCESS(MmCopyToCaller(pRect, &SafeRect, sizeof(RECT))))
+               return 0;
+
+       return ret;
+  }
+  return 0; //if invalid region return zero
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kInvertRgn(HDC  hDC,
-             HRGN  hRgn)
+                    HRGN  hRgn)
 {
   UNIMPLEMENTED;
 }
 
-INT STDCALL
+INT
+STDCALL
 W32kOffsetRgn(HRGN  hRgn,
-             INT  XOffset,
-             INT  YOffset)
+                   INT  XOffset,
+                   INT  YOffset)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn = RGNDATA_LockRgn(hRgn);
+  INT ret;
+
+  if( !rgn )
+         return ERROR;
+
+  if(XOffset || YOffset) {
+    int nbox = rgn->rdh.nCount;
+       PRECT pbox = (PRECT)rgn->Buffer;
+
+    if(nbox && pbox) {
+      while(nbox--) {
+        pbox->left += XOffset;
+        pbox->right += XOffset;
+        pbox->top += YOffset;
+        pbox->bottom += YOffset;
+        pbox++;
+      }
+      rgn->rdh.rcBound.left += XOffset;
+      rgn->rdh.rcBound.right += XOffset;
+      rgn->rdh.rcBound.top += YOffset;
+      rgn->rdh.rcBound.bottom += YOffset;
+    }
+  }
+  ret = rgn->rdh.iType;
+  RGNDATA_UnlockRgn( hRgn );
+  return ret;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kPaintRgn(HDC  hDC,
-            HRGN  hRgn)
+                   HRGN  hRgn)
 {
-  UNIMPLEMENTED;
+  RECT box;
+  HRGN tmpVisRgn, prevVisRgn;
+  DC *dc = DC_HandleToPtr(hDC);
+
+  if( !dc )
+       return FALSE;
+  if(!(tmpVisRgn = W32kCreateRectRgn(0, 0, 0, 0))){
+       DC_ReleasePtr( hDC );
+       return FALSE;
+  }
+
+  // Transform region into device co-ords
+  if(!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || W32kOffsetRgn(tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY) == ERROR) {
+    W32kDeleteObject( tmpVisRgn );
+       DC_ReleasePtr( hDC );
+    return FALSE;
+  }
+
+  // Modify visible region
+  if(!(prevVisRgn = SaveVisRgn(hDC))) {
+    W32kDeleteObject(tmpVisRgn);
+       DC_ReleasePtr( hDC );
+    return FALSE;
+  }
+  W32kCombineRgn(tmpVisRgn, prevVisRgn, tmpVisRgn, RGN_AND);
+  SelectVisRgn(hDC, tmpVisRgn);
+  W32kDeleteObject(tmpVisRgn);
+
+  // Fill the region
+
+  W32kGetRgnBox(dc->w.hGCClipRgn, &box);
+//  if (X11DRV_SetupGCForBrush( physDev )) FIXME: Recode with ReactOS GDI calls
+//  {
+//    // Update the pixmap from the DIB section
+//    X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
+//
+//    TSXFillRectangle(gdi_display, physDev->drawable, physDev->gc,
+//                     box.left, box.top, box.right-box.left, box.bottom-box.top);
+//
+//    // Update the DIBSection from the pixmap
+//    X11DRV_UnlockDIBSection(physDev, TRUE);
+//  }
+
+  // Restore the visible region
+  DC_ReleasePtr( hDC );
+  return TRUE;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kPtInRegion(HRGN  hRgn,
-              INT  X,
-              INT  Y)
+                     INT  X,
+                     INT  Y)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn;
+  int i;
+
+  if( (rgn = RGNDATA_LockRgn(hRgn) ) )
+         return FALSE;
+
+  if(rgn->rdh.nCount > 0 && INRECT(rgn->rdh.rcBound, X, Y)){
+    for(i = 0; i < rgn->rdh.nCount; i++) {
+      if(INRECT(*(PRECT)&rgn->Buffer[i], X, Y)){
+               RGNDATA_UnlockRgn(hRgn);
+               return TRUE;
+         }
+    }
+  }
+  RGNDATA_UnlockRgn(hRgn);
+  return FALSE;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kRectInRegion(HRGN  hRgn,
-                CONST LPRECT  rc)
+                       CONST LPRECT  unsaferc)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn;
+  PRECT pCurRect, pRectEnd;
+  PRECT rc;
+  BOOL bRet = FALSE;
+
+  if( !NT_SUCCESS( MmCopyFromCaller( rc, unsaferc, sizeof( RECT ) ) ) ){
+       DPRINT("W32kRectInRegion: bogus rc\n");
+       return ERROR;
+  }
+
+  if( !( rgn  = RGNDATA_LockRgn(hRgn) ) )
+       return ERROR;
+
+  // this is (just) a useful optimization
+  if((rgn->rdh.nCount > 0) && EXTENTCHECK(&rgn->rdh.rcBound, rc))
+  {
+    for (pCurRect = (PRECT)rgn->Buffer, pRectEnd = pCurRect + rgn->rdh.nCount; pCurRect < pRectEnd; pCurRect++)
+    {
+      if (pCurRect->bottom <= rc->top) continue; // not far enough down yet
+      if (pCurRect->top >= rc->bottom) break;    // too far down
+      if (pCurRect->right <= rc->left) continue; // not far enough over yet
+      if (pCurRect->left >= rc->right) continue;
+      bRet = TRUE;
+      break;
+    }
+  }
+  RGNDATA_UnlockRgn(hRgn);
+  return bRet;
 }
 
-BOOL STDCALL
+BOOL
+STDCALL
 W32kSetRectRgn(HRGN  hRgn,
-              INT  LeftRect,
-              INT  TopRect,
-              INT  RightRect,
-              INT  BottomRect)
+                     INT  LeftRect,
+                     INT  TopRect,
+                     INT  RightRect,
+                     INT  BottomRect)
 {
-  UNIMPLEMENTED;
+  PRGNDATA rgn;
+  PRECT firstRect;
+
+
+
+  if( !( rgn = RGNDATA_LockRgn(hRgn) ) )
+         return 0; //per documentation
+
+  if (LeftRect > RightRect) { INT tmp = LeftRect; LeftRect = RightRect; RightRect = tmp; }
+  if (TopRect > BottomRect) { INT tmp = TopRect; TopRect = BottomRect; BottomRect = tmp; }
+
+  if((LeftRect != RightRect) && (TopRect != BottomRect))
+  {
+    firstRect = (PRECT)rgn->Buffer;
+       ASSERT( firstRect );
+       firstRect->left = rgn->rdh.rcBound.left = LeftRect;
+    firstRect->top = rgn->rdh.rcBound.top = TopRect;
+    firstRect->right = rgn->rdh.rcBound.right = RightRect;
+    firstRect->bottom = rgn->rdh.rcBound.bottom = BottomRect;
+    rgn->rdh.nCount = 1;
+    rgn->rdh.iType = SIMPLEREGION;
+  } else
+    EMPTY_REGION(rgn);
+
+  RGNDATA_UnlockRgn( hRgn );
+  return TRUE;
 }
 
+HRGN STDCALL
+W32kUnionRectWithRgn(HRGN hDest, const RECT* unsafeRect)
+{
+       PRECT pRect;
+       PRGNDATA pRgn;
+
+       if( !NT_SUCCESS( MmCopyFromCaller( pRect, unsafeRect, sizeof( RECT ) ) ) )
+               return NULL;
+
+       if( !(pRgn = RGNDATA_LockRgn( hDest ) ) )
+               return NULL;
+
+       REGION_UnionRectWithRegion( pRect, pRgn );
+       RGNDATA_UnlockRgn( hDest );
+       return hDest;
+}
index cdbe897..0f1898f 100644 (file)
@@ -46,7 +46,6 @@ STUB(EngMapFontFile)
 STUB(EngMapModule)
 STUB(EngMarkBandingSurface)
 STUB(EngMovePointer)
-STUB(EngMulDiv)
 STUB(EngMultiByteToUnicodeN)
 STUB(EngMultiByteToWideChar)
 STUB(EngProbeForRead)