diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/DC.xs Win32-GUI-0.0.670/DC.xs
--- Win32-GUI-0.0.670.orig/DC.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/DC.xs	2003-12-19 17:46:59.171875000 -0800
@@ -502,7 +502,7 @@
         	self = (HV*) SvRV(handle);
             window = hv_fetch_mg(NOTXSCALL self, szKey, strlen(szKey), 0);
         	if(window != NULL) {
-            	hwnd = (HWND) SvIV(*window);
+            	hwnd = (HWND)(DWORD)SvIV(*window);
             } else {
             	XSRETURN_NO;
             }
@@ -542,7 +542,7 @@
         	self = (HV*) SvRV(handle);
             window = hv_fetch_mg(NOTXSCALL self, "-window", 7, 0);
         	if(window != NULL) {
-            	hwnd = (HWND) SvIV(*window);
+            	hwnd = (HWND)(DWORD)SvIV(*window);
             } else {
             	XSRETURN_UNDEF;
             }
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI.h Win32-GUI-0.0.670/GUI.h
--- Win32-GUI-0.0.670.orig/GUI.h	2003-12-11 21:21:14.000000000 -0800
+++ Win32-GUI-0.0.670/GUI.h	2003-12-19 17:55:08.546875000 -0800
@@ -5,14 +5,15 @@
 
 #define  WIN32_LEAN_AND_MEAN
 #define _WIN32_IE 0x0401
+#ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0400
+#endif
+#define STRICT
 #undef NOTRACKMOUSEEVENT
-#include <stdarg.h>
-#include <windows.h>
+#include "win32perl.h"
 #include <winuser.h>
 #include <commctrl.h>
 #include <commdlg.h>
-#include <wtypes.h>
 #include <richedit.h>
 #include <shellapi.h>
 #include <shlobj.h>
@@ -21,27 +22,6 @@
 
 #include "resource.h"
 
-#define __TEMP_WORD  WORD   /* perl defines a WORD, yikes! */
-
-#if defined(PERL_OBJECT)
-#define NO_XSLOCKS
-#endif
-
-/*
- * Perl includes
- */
-#if defined(__cplusplus) && !defined(PERL_OBJECT) && !defined(PERL_IMPLICIT_CONTEXT)
-extern "C" {
-#endif
-
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#if defined(__cplusplus) && !defined(PERL_OBJECT) && !defined(PERL_IMPLICIT_CONTEXT)
-}
-#endif
-
 #define MAX_WINDOW_NAME 128
 #define MAX_EVENT_NAME 255
 
@@ -180,17 +160,14 @@
  */
 #ifdef PERL_OBJECT
 #   ifdef _INC_WIN32_PERL5
-#       pragma message( "\n*** Using the 5.005 Perl Object CPerlObj class.\n" )
 #       define NOTXSPROC   CPerlObj *pPerl,
 #       define NOTXSCALL   pPerl,
 #       define CPerl CPerlObj
 #   else // not _INC_WIN32_PERL5
-#       pragma message( "\n*** Using the 5.004 Perl Object CPerl class.\n" )
 #       define NOTXSPROC   CPerl *pPerl,
 #       define NOTXSCALL   pPerl,
 #   endif  //  _INC_WIN32_PERL5
 #else
-#   pragma message( "\n*** Using a non-Object Core Perl.\n" )
 #   define NOTXSPROC
 #   define NOTXSCALL
 #endif
@@ -287,9 +264,6 @@
 
 #define HV_SELF_FROM_WINDOW(x) (SV_SELF_FROM_WINDOW(x) ? (HV*)SvRV(SV_SELF_FROM_WINDOW(x)) : NULL)
 
-#undef WORD
-#define WORD __TEMP_WORD
-
 /*
  * Section for the constant definitions.
  */
@@ -428,12 +402,19 @@
 LRESULT CALLBACK InactiveMsgLoop(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 /*
- * default procedures for controls (not really to be used yet)
+ * default procedures for controls
  */
-static WNDPROC DefButtonProc;
-static WNDPROC DefListboxProc;
-static WNDPROC DefTabStripProc;
-static WNDPROC DefRichEditProc;
+
+#define MY_CXT_KEY "Win32::GUI::_guts" XS_VERSION
+
+typedef struct {
+	WNDPROC DefButtonProc;
+	WNDPROC DefListboxProc;
+	WNDPROC DefTabStripProc;
+	WNDPROC DefRichEditProc;
+} my_cxt_t;
+
+START_MY_CXT
 
 /*
  * class-specific routines for (options|create|etc)
@@ -464,25 +445,3 @@
 
 BOOL TreeView_onParseOption(NOTXSPROC char *option, SV* value, LPPERLWIN32GUI_CREATESTRUCT perlcs);
 void TreeView_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs);
-
-// MinGW patch
-#ifdef __MINGW__
-  #define WNDPROC_CAST WNDPROC
-  #ifndef HDHITTESTINFO
-    #define HDHITTESTINFO HD_HITTESTINFO
-  #endif
-  #ifndef DateTime_GetSystemtime
-    #define DateTime_GetSystemtime DateTime_GetSystemTime
-  #endif
-  #ifndef DateTime_SetSystemtime
-    #define DateTime_SetSystemtime DateTime_SetSystemTime
-  #endif
-  #ifndef ListView_GetCheckState
-    #define ListView_GetCheckState(w, i) (int)(((SNDMSG((w), LVM_GETITEMSTATE, (WPARAM)i, LVIS_STATEIMAGEMASK)) >> 12) -1)
-  #endif
-  #ifndef TreeView_GetLastVisible
-    #define TreeView_GetLastVisible(w) TreeView_GetNextItem(w,NULL,TVGN_LASTVISIBLE)
-  #endif
-#else
-  #define WNDPROC_CAST FARPROC
-#endif
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI.pm Win32-GUI-0.0.670/GUI.pm
--- Win32-GUI-0.0.670.orig/GUI.pm	2003-12-11 21:21:14.000000000 -0800
+++ Win32-GUI-0.0.670/GUI.pm	2003-12-19 17:41:52.281250000 -0800
@@ -15,6 +15,7 @@
 ###############################################################################
 package Win32::GUI;
 
+eval { require Win32 };
 require Exporter;       # to export the constants to the main:: space
 require DynaLoader;     # to dynuhlode the module.
 
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI.xs Win32-GUI-0.0.670/GUI.xs
--- Win32-GUI-0.0.670.orig/GUI.xs	2003-12-11 13:19:02.000000000 -0800
+++ Win32-GUI-0.0.670/GUI.xs	2003-12-19 17:33:25.296875000 -0800
@@ -113,6 +113,7 @@
     HINSTANCE hinstance;
     char * option;
     int i, next_i;
+    dMY_CXT;
 
     ZeroMemory(&wcx, sizeof(WNDCLASSEX));
     wcx.cbSize = sizeof(WNDCLASSEX);
@@ -160,16 +161,16 @@
             } else if(strcmp(option, "-widget") == 0) {
                 next_i = i + 1;
                 if(strcmp(SvPV_nolen(ST(next_i)), "Button") == 0) {
-                    DefButtonProc = wcx.lpfnWndProc;
+                    MY_CXT.DefButtonProc = wcx.lpfnWndProc;
                     wcx.lpfnWndProc = ButtonMsgLoop;
                 } else if(strcmp(SvPV_nolen(ST(next_i)), "Listbox") == 0) {
-                    DefListboxProc = wcx.lpfnWndProc;
+                    MY_CXT.DefListboxProc = wcx.lpfnWndProc;
                     wcx.lpfnWndProc = ListboxMsgLoop;
                 } else if(strcmp(SvPV_nolen(ST(next_i)), "TabStrip") == 0) {
-                    DefTabStripProc = wcx.lpfnWndProc;
+                    MY_CXT.DefTabStripProc = wcx.lpfnWndProc;
                     wcx.lpfnWndProc = TabStripMsgLoop;
                 } else if(strcmp(SvPV_nolen(ST(next_i)), "RichEdit") == 0) {
-                    DefRichEditProc = wcx.lpfnWndProc;
+                    MY_CXT.DefRichEditProc = wcx.lpfnWndProc;
                     wcx.lpfnWndProc = RichEditMsgLoop;
                 } else if(strcmp(SvPV_nolen(ST(next_i)), "Graphic") == 0) {
                     wcx.lpfnWndProc = GraphicMsgLoop;
@@ -284,7 +285,7 @@
             }
             if(strcmp(option, "-instance") == 0) {
                 next_i = i + 1;
-                hInstance = (HINSTANCE) SvIV(ST(next_i));
+                hInstance = (HINSTANCE)(DWORD)SvIV(ST(next_i));
             }
             if(strcmp(option, "-data") == 0) {
                 next_i = i + 1;
@@ -636,7 +637,7 @@
                     SV** t;
                     t = hv_fetch_mg(NOTXSCALL perlcs.hvParent, "-tooltip", 8, 0);
                     if(t != NULL && SvOK( *t )) {
-                        perlcs.hTooltip = (HWND) SvIV(*t);
+						perlcs.hTooltip = (HWND)(DWORD)SvIV(*t);
                     }
                 }
                 if(perlcs.hTooltip == NULL) {
@@ -1085,14 +1086,13 @@
 
     ###########################################################################
     # (@)INTERNAL:oldDialog()
-void
+DWORD
 oldDialog(...)
-PPCODE:
+PREINIT:
     HWND hwnd;
     MSG msg;
-    int stayhere;
-    stayhere = 1;
-
+    int stayhere = 1;
+CODE:
     if(items > 0) {
         hwnd = (HWND) handle_From(NOTXSCALL ST(0));
     } else {
@@ -1114,7 +1114,9 @@
             }
         }
     }
-    XSRETURN_IV((long) msg.wParam);
+    RETVAL = (long)msg.wParam;
+OUTPUT:
+    RETVAL
 
 
     ###########################################################################
@@ -1538,7 +1540,6 @@
 PREINIT:
 	LPPERLWIN32GUI_USERDATA perlud;
 	SV** oldcoderef;
-	dTARG;
 PPCODE:
 	if(SvOK(coderef) && SvROK(coderef) && SvTYPE(SvRV(coderef)) == SVt_PVCV) {
 		// We have a ref and it's a coderef.
@@ -2487,7 +2488,7 @@
     windows = newAV();
     EnumWindows( (WNDENUMPROC) EnumMyWindowsProc, (LPARAM) windows);
     for(i=0; i<av_len(windows); i++) {
-        thwnd = (HWND) SvIV(*(av_fetch(windows, i, 0)));
+		thwnd = (HWND)(DWORD)SvIV(*(av_fetch(windows, i, 0)));
         if(thwnd != handle) {
             printf("XS(DoModal): windows[%d] = 0x%x\n", i, thwnd);
             winprocs[i].hWnd = (HWND) thwnd;
@@ -2608,7 +2609,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         if(hmeta = GetEnhMetaFile(filename)) {
             GetClientRect(handle, &rect);
             RETVAL = PlayEnhMetaFile(hdc, hmeta, &rect);
@@ -2690,7 +2691,7 @@
     if(tmp == NULL) {
         RETVAL = 0;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         iWidthMM = GetDeviceCaps(hdc, HORZSIZE);
         iHeightMM = GetDeviceCaps(hdc, VERTSIZE);
         iWidthPels = GetDeviceCaps(hdc, HORZRES);
@@ -2740,10 +2741,10 @@
     #    obj_dc = hv_fetch((HV*)SvRV(obj), "dc", 2, 0);
     #    if(obj_dc != NULL) {
     #        __DEBUG("!XS(GetOrInitDC): obj{dc} = %ld\n", SvIV(*obj_dc));
-    #        return (HDC) SvIV(*obj_dc);
+    #        return (HDC)(DWORD)SvIV(*obj_dc);
     #    } else {
     #        obj_hwnd = hv_fetch((HV*)SvRV(obj), "handle", 6, 0);
-    #        hwnd = (HWND) SvIV(*obj_hwnd);
+    #        hwnd = (HWND)(DWORD)SvIV(*obj_hwnd);
     #        hdc = GetDC(hwnd);
     #        __DEBUG("!XS(GetOrInitDC): GetDC = %ld\n", hdc);
     #        hv_store((HV*) SvRV(obj), "dc", 2, newSViv((long) hdc), 0);
@@ -2830,7 +2831,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         textlen = strlen(text);
         RETVAL = (long) TextOut(hdc, x, y, text, textlen);
     }
@@ -2851,7 +2852,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = SetTextColor(hdc, color);
     }
 OUTPUT:
@@ -2870,7 +2871,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = GetTextColor(hdc);
     }
 OUTPUT:
@@ -2890,7 +2891,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = (long) SetBkMode(hdc, mode);
     }
 OUTPUT:
@@ -2909,7 +2910,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = GetBkMode(hdc);
     }
 OUTPUT:
@@ -2930,7 +2931,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = MoveToEx(hdc, x, y, NULL);
     }
 OUTPUT:
@@ -2953,7 +2954,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         if(height == -1) {
             width *= 2;
             height = width;
@@ -2979,7 +2980,7 @@
     if(tmp == NULL) {
         RETVAL = -1;
     } else {
-        hdc = (HDC) SvIV(*tmp);
+        hdc = (HDC)(DWORD)SvIV(*tmp);
         RETVAL = LineTo(hdc, x, y);
     }
 OUTPUT:
@@ -3017,7 +3018,7 @@
     PAINTSTRUCT ps;
     char tmprgb[16];
     self = (HV*) SvRV(ST(0));
-    hwnd = (HWND) SvIV(*hv_fetch(self, "-handle", 7, 0));
+    hwnd = (HWND)(DWORD)SvIV(*hv_fetch(self, "-handle", 7, 0));
     if(hwnd) {
         if(hdc = BeginPaint(hwnd, &ps)) {
             hv_store(self, "-DC", 3, newSViv((long) hdc), 0);
@@ -3056,10 +3057,10 @@
     if(self) {
         tmp = hv_fetch(self, "-handle", 7, 0);
         if(tmp == NULL) XSRETURN_NO;
-        hwnd = (HWND) SvIV(*tmp);
+        hwnd = (HWND)(DWORD)SvIV(*tmp);
         tmp = hv_fetch(self, "-ps.hdc", 7, 0);
         if(tmp == NULL) XSRETURN_NO;
-        ps.hdc = (HDC) SvIV(*tmp);
+        ps.hdc = (HDC)(DWORD)SvIV(*tmp);
         tmp = hv_fetch(self, "-ps.fErase", 10, 0);
         if(tmp == NULL) XSRETURN_NO;
         ps.fErase = (BOOL) SvIV(*tmp);
@@ -3678,7 +3679,7 @@
             } else if(strcmp(option, "-root") == 0) {
                 next_i = i + 1;
                 if(SvIOK(ST(next_i))) {
-                    bi.pidlRoot = (LPCITEMIDLIST) SvIV(ST(next_i));
+					bi.pidlRoot = (LPCITEMIDLIST)(DWORD)SvIV(ST(next_i));
                 } else {
                     SHGetDesktopFolder(&pDesktopFolder);
                     MultiByteToWideChar(
@@ -3998,10 +3999,10 @@
 
 HGDIOBJ
 SelectObject(handle,hgdiobj)
-    HDC handle
+    HWND handle
     HGDIOBJ hgdiobj
 CODE:
-    RETVAL = SelectObject(handle, hgdiobj);
+    RETVAL = SelectObject((HDC)handle, hgdiobj);
 OUTPUT:
     RETVAL
 
@@ -4172,17 +4173,12 @@
     /* SvREFCNT_dec((SV*)ary); */
     XSRETURN(i);
 
-
-
     ###########################################################################
     # (@)PACKAGE:Win32::GUI::Menu
     ###########################################################################
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Menu
 
-
-#pragma message( "*** PACKAGE Win32::GUI::Menu..." )
-
     ###########################################################################
     # (@)INTERNAL:DESTROY(HANDLE)
 BOOL
@@ -4200,8 +4196,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::MenuButton
 
-#pragma message( "*** PACKAGE Win32::GUI::MenuButton..." )
-
     ###########################################################################
     # (@)INTERNAL:InsertMenuItem(HANDLE, %OPTIONS)
 void
@@ -4242,8 +4236,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::MenuItem
 
-#pragma message( "*** PACKAGE Win32::GUI::MenuItem..." )
-
     ###########################################################################
     # (@)METHOD:Change(%OPTIONS)
     # Change most of the options used when the object was created.
@@ -4259,7 +4251,7 @@
     if(SvROK(ST(0))) {
         parentmenu = hv_fetch((HV*)SvRV((ST(0))), "-menu", 5, 0);
         if(parentmenu != NULL) {
-            hMenu = (HMENU) SvIV(*parentmenu);
+            hMenu = (HMENU)(DWORD)SvIV(*parentmenu);
             myItem = SvIV(*(hv_fetch((HV*)SvRV(ST(0)), "-id", 3, 0)));
         } else {
             hMenu = (HMENU) handle_From(NOTXSCALL ST(0));
@@ -4300,7 +4292,7 @@
     if(SvROK(ST(0))) {
         parentmenu = hv_fetch((HV*)SvRV((ST(0))), "-menu", 5, 0);
         if(parentmenu != NULL) {
-            hMenu = (HMENU) SvIV(*parentmenu);
+            hMenu = (HMENU)(DWORD)SvIV(*parentmenu);
             myItem = SvIV(*(hv_fetch((HV*)SvRV(ST(0)), "-id", 3, 0)));
             i = 1;
         } else {
@@ -4341,7 +4333,7 @@
     if(SvROK(ST(0))) {
         parentmenu = hv_fetch((HV*)SvRV((ST(0))), "-menu", 5, 0);
         if(parentmenu != NULL) {
-            hMenu = (HMENU) SvIV(*parentmenu);
+            hMenu = (HMENU)(DWORD)SvIV(*parentmenu);
             myItem = SvIV(*(hv_fetch((HV*)SvRV(ST(0)), "-id", 3, 0)));
             i = 1;
         } else {
@@ -4373,9 +4365,6 @@
     # (@)PACKAGE:Win32::GUI::DialogBox
     ###########################################################################
 
-#pragma message( "*** PACKAGE Win32::GUI::DialogBox..." )
-
-
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::DialogBox
 
     # DWORD
@@ -4396,11 +4385,11 @@
     #         stayhere = GetMessage(&msg, hwnd, 0, 0);
     #         if(msg.message == WM_EXITLOOP) {
     #             stayhere = 0;
-    #             msg.wParam = -1;
+    #             msg.wParam = (WPARAM)-1;
     #         } else {
     #             if(stayhere == -1) {
     #                 stayhere = 0;
-    #                 msg.wParam = -2; // an error occurred...
+    #                 msg.wParam = (WPARAM)-2; // an error occurred...
     #             } else {
     #                 if(!IsDialogMessage(hwnd, &msg)) {
     #                     TranslateMessage(&msg);
@@ -4418,8 +4407,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Combobox
 
-#pragma message( "*** PACKAGE Win32::GUI::Combobox..." )
-
 
     ###########################################################################
     # (@)METHOD:AddString(STRING)
@@ -4549,8 +4536,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::UpDown
 
-#pragma message( "*** PACKAGE Win32::GUI::UpDown..." )
-
 
     ###########################################################################
     # (@)METHOD:Base([VALUE])
@@ -4637,8 +4622,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Tooltip
 
-#pragma message( "*** PACKAGE Win32::GUI::Tooltip..." )
-
 
     ###########################################################################
     # (@)METHOD:Add(...)
@@ -4695,8 +4678,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Header
 
-#pragma message( "*** PACKAGE Win32::GUI::Header..." )
-
 
     ###########################################################################
     # (@)METHOD:InsertItem(%OPTIONS)
@@ -4808,9 +4789,9 @@
     LONG x
     LONG y
 PREINIT:
-    HDHITTESTINFO ht;
+    HD_HITTESTINFO ht;
 PPCODE:
-    ZeroMemory(&ht, sizeof(HDHITTESTINFO));
+	ZeroMemory(&ht, sizeof(HD_HITTESTINFO));
     ht.pt.x = x;
     ht.pt.y = y;
     if(SendMessage(handle, HDM_HITTEST, 0, (LPARAM) &ht) == -1) {
@@ -4858,8 +4839,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::ComboboxEx
 
-#pragma message( "*** PACKAGE Win32::GUI::ComboboxEx..." )
-
 
     ###########################################################################
     # (@)METHOD:InsertItem(%OPTIONS)
@@ -4891,8 +4870,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::DateTime
 
-#pragma message( "*** PACKAGE Win32::GUI::DateTime..." )
-
 
     ###########################################################################
     # (@)METHOD:GetDate()
@@ -5076,8 +5053,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Brush
 
-#pragma message( "*** PACKAGE Win32::GUI::Brush..." )
-
 
     ###########################################################################
     # (@)INTERNAL:Create(%OPTIONS)
@@ -5176,8 +5151,6 @@
 
 MODULE = Win32::GUI     PACKAGE = Win32::GUI::Pen
 
-#pragma message( "*** PACKAGE Win32::GUI::Pen..." )
-
 
     ###########################################################################
     # (@)INTERNAL:Create(%OPTIONS)
@@ -5256,6 +5229,7 @@
 BOOT:
     {
         INITCOMMONCONTROLSEX icce;
+	MY_CXT_INIT;
         icce.dwSize = sizeof(INITCOMMONCONTROLSEX);
         icce.dwICC = ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES
                    | ICC_LISTVIEW_CLASSES | ICC_PROGRESS_CLASS
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI_Events.cpp Win32-GUI-0.0.670/GUI_Events.cpp
--- Win32-GUI-0.0.670.orig/GUI_Events.cpp	2003-12-03 20:10:06.000000000 -0800
+++ Win32-GUI-0.0.670/GUI_Events.cpp	2003-12-19 01:14:42.000000000 -0800
@@ -50,7 +50,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER;
         SAVETMPS;
         PUSHMARK(SP);
@@ -85,7 +84,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -118,7 +116,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -154,7 +151,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -200,7 +196,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -251,7 +246,6 @@
 #endif
 	if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -285,7 +279,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -320,7 +313,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -362,7 +354,6 @@
 #endif
     if(perl_get_cv(Name, FALSE) != NULL) {
         dSP;
-        dTARG;
         ENTER ;
         SAVETMPS;
         PUSHMARK(SP) ;
@@ -423,7 +414,6 @@
 				PerlResult = 0;
 
 				dSP;
-				dTARG;
 				ENTER;
 				SAVETMPS;
 				PUSHMARK(SP);
@@ -508,7 +498,6 @@
 	    printf("!XS(DoEvent_NEM_Menu) CV found (%s)\n", SvPV_nolen(event));
 #endif
 		dSP;
-		dTARG;
 		ENTER;
 		SAVETMPS;
 		PUSHMARK(SP);
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI_Helpers.cpp Win32-GUI-0.0.670/GUI_Helpers.cpp
--- Win32-GUI-0.0.670.orig/GUI_Helpers.cpp	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/GUI_Helpers.cpp	2003-12-19 01:14:42.000000000 -0800
@@ -86,12 +86,12 @@
     if(NULL != pSv)  {
         if( SvROK(pSv)) {
             SV **pHv;
-            pHv = hv_fetch_mg(NOTXSCALL (HV*) SvRV(pSv), szKey, strlen(szKey), 0);
+            pHv = hv_fetch_mg(NOTXSCALL (HV*)(int)SvRV(pSv), szKey, strlen(szKey), 0);
             if(pHv != NULL) {
-                hReturn = (HWND) SvIV(*pHv);
+                hReturn = (HWND)(int)SvIV(*pHv);
             }
         } else {
-            hReturn = (HWND) SvIV(pSv);
+            hReturn = (HWND)(int)SvIV(pSv);
         }
     }
     return(hReturn);
@@ -193,7 +193,7 @@
 
 	t = hv_fetch_mg(NOTXSCALL parent, "-handle", 7, 0);
 	if(t != NULL) {
-		hParent = (HWND) SvIV(*t);
+		hParent = (HWND)(int)SvIV(*t);
 	} else {
 		return NULL;
 	}
@@ -341,7 +341,7 @@
     itoa(nID, temp, 10);
     handle = hv_fetch(hash, temp, strlen(temp), FALSE);
     if(handle == NULL) return NULL;
-    return (HMENU) SvIV(*handle);
+    return (HMENU)(int)SvIV(*handle);
 }
 
     /*
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI_MessageLoops.cpp Win32-GUI-0.0.670/GUI_MessageLoops.cpp
--- Win32-GUI-0.0.670.orig/GUI_MessageLoops.cpp	2003-12-11 21:21:14.000000000 -0800
+++ Win32-GUI-0.0.670/GUI_MessageLoops.cpp	2003-12-19 12:31:18.000000000 -0800
@@ -311,12 +311,14 @@
         }
         break;
         case WM_NOTIFY:
+	    {
             LPNMHDR notify;
             notify = (LPNMHDR) lParam;
             childud = (LPPERLWIN32GUI_USERDATA) GetWindowLong(notify->hwndFrom, GWL_USERDATA);
             if( ValidUserData(childud) && (childud->dwPlStyle & PERLWIN32GUI_NEM) ) {
                 switch(childud->iClass) {
                 case PERLWIN32GUI_CLS_LISTVIEW:
+			    {
                     LPNM_LISTVIEW lv_notify;
                     lv_notify = (LPNM_LISTVIEW) lParam;
 #ifdef PERLWIN32GUI_STRONDEBUG
@@ -343,6 +345,7 @@
                             );
                         break;
                     case LVN_KEYDOWN:
+				    {
                         LV_KEYDOWN FAR * lv_keydown;
                         lv_keydown = (LV_KEYDOWN FAR *) lParam;
                         PerlResult = DoEvent_NEM(NOTXSCALL childud, PERLWIN32GUI_NEM_KEYDOWN, "KeyDown",
@@ -350,8 +353,11 @@
                             );
                         break;
                     }
+				}
                     break;
+			    }
                 case PERLWIN32GUI_CLS_TREEVIEW:
+			    {
                     LPNM_TREEVIEW tv_notify;
                     tv_notify = (LPNM_TREEVIEW) lParam;
                     switch(notify->code) {
@@ -387,6 +393,7 @@
                             );
                         break;
                     case TVN_KEYDOWN:
+		    {
                         TV_KEYDOWN FAR * tv_keydown;
                         tv_keydown = (TV_KEYDOWN FAR *) lParam;
                         PerlResult = DoEvent_NEM(NOTXSCALL childud, PERLWIN32GUI_NEM_KEYDOWN, "KeyDown",
@@ -394,7 +401,9 @@
                             );
                         break;
                     }
+                }
                     break;
+		            }
                 case PERLWIN32GUI_CLS_TAB:
                     switch(notify->code) {
                     case TCN_SELCHANGING:
@@ -413,6 +422,7 @@
                 case PERLWIN32GUI_CLS_TOOLTIP:
                     switch(notify->code) {
                     case TTN_NEEDTEXT:
+		    {
                         LPTOOLTIPTEXT lptt;
                         lptt = (LPTOOLTIPTEXT) lParam;
                         lptt->lpszText = (LPTSTR) DoEvent_NEM(NOTXSCALL childud, PERLWIN32GUI_NEM_NEEDTEXT, "NeedText",
@@ -424,6 +434,7 @@
                         PerlResult = 1;
                         break;
                     }
+                }
                     break;
                         
                 case PERLWIN32GUI_CLS_REBAR:
@@ -435,6 +446,7 @@
                     break;
                     
                 case PERLWIN32GUI_CLS_HEADER:
+		{
                     LPNMHEADER nmh;
                     nmh = (LPNMHEADER) lParam;
                     switch(notify->code) {
@@ -487,6 +499,7 @@
                     break;
                 }
             }
+		}
         break;
     }
     
@@ -522,7 +535,7 @@
         if(perlud->iEventModel == PERLWIN32GUI_EM_BOTH) {
             if(perlud->wndprocPreNEM != NULL) {
                 wndprocOriginal = perlud->wndprocPreNEM;
-                return CallWindowProc((WNDPROC_CAST) wndprocOriginal, hwnd, uMsg, wParam, lParam);
+				return CallWindowProc(wndprocOriginal, hwnd, uMsg, wParam, lParam);
             } else {
                 return CommonMsgLoop(NOTXSCALL hwnd, uMsg, wParam, lParam);
             }
@@ -533,6 +546,7 @@
         return CommonMsgLoop(NOTXSCALL hwnd, uMsg, wParam, lParam);
     }
 }
+}
 
 
     /*
@@ -647,7 +661,7 @@
 #ifdef PERLWIN32GUI_STRONGDEBUG
             printf("!XS(NEM_ChildMsgLoop) calling wndprocOriginal\n");
 #endif
-            return CallWindowProc((WNDPROC_CAST) wndprocOriginal, hwnd, uMsg, wParam, lParam);
+			return CallWindowProc(wndprocOriginal, hwnd, uMsg, wParam, lParam);
         } else {
 #ifdef PERLWIN32GUI_STRONGDEBUG
             printf("!XS(NEM_ChildMsgLoop) returning DefWindowProc (wndprocOriginal not valid)\n");
@@ -685,7 +699,7 @@
 #ifdef PERLWIN32GUI_STRONGDEBUG
             printf("!XS(ContainerMsgLoop) perlud was valid, forwarding to wndprocOriginal(0x%x)...\n", wndprocOriginal);
 #endif
-            return CallWindowProc((WNDPROC_CAST) wndprocOriginal, hwnd, uMsg, wParam, lParam);
+			return CallWindowProc(wndprocOriginal, hwnd, uMsg, wParam, lParam);
         } else {
 #ifdef PERLWIN32GUI_STRONGDEBUG
             printf("!XS(ContainerMsgLoop) perlud was not valid, forwarding to DefWindowProc...\n");
@@ -831,10 +845,11 @@
     */
 LRESULT CALLBACK ButtonMsgLoop(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    dMY_CXT;
 #ifdef PERL_OBJECT
     CPerl *pPerl;
     pPerl = PERL_OBJECT_FROM_WINDOW(hwnd);
-    if(pPerl == NULL) return DefButtonProc(hwnd, uMsg, wParam, lParam);
+	if(pPerl == NULL) return MY_CXT.DefButtonProc(hwnd, uMsg, wParam, lParam);
 #endif
 #ifdef PERLWIN32GUI_STRONGDEBUG
     printf("!XS(ButtonMsgLoop) got (0x%x, 0x%x, 0x%x, 0x%x)\n", hwnd, uMsg, wParam, lParam);
@@ -884,7 +899,7 @@
     if(PerlResult == 0) {
         return 0;
     } else {
-        return DefButtonProc(hwnd, uMsg, wParam, lParam);
+        return MY_CXT.DefButtonProc(hwnd, uMsg, wParam, lParam);
     }
 }
 
@@ -895,10 +910,11 @@
     */
 LRESULT CALLBACK ListboxMsgLoop(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    dMY_CXT;
 #ifdef PERL_OBJECT
     CPerl *pPerl;
     pPerl = PERL_OBJECT_FROM_WINDOW(hwnd);
-    if(pPerl == NULL) return DefListboxProc(hwnd, uMsg, wParam, lParam);
+	if(pPerl == NULL) return MY_CXT.DefListboxProc(hwnd, uMsg, wParam, lParam);
 #endif
 #ifdef PERLWIN32GUI_STRONGDEBUG
     printf("!XS(ListboxMsgLoop) got (0x%x, 0x%x, 0x%x, 0x%x)\n", hwnd, uMsg, wParam, lParam);
@@ -948,7 +964,7 @@
     if(PerlResult == 0) {
         return 0;
     } else {
-        return DefListboxProc(hwnd, uMsg, wParam, lParam);
+        return MY_CXT.DefListboxProc(hwnd, uMsg, wParam, lParam);
     }
 
 }
@@ -960,13 +976,14 @@
     */
 LRESULT CALLBACK RichEditMsgLoop(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    dMY_CXT;
 #ifdef PERLWIN32GUI_STRONGDEBUG
     printf("!XS(RichEditMsgLoop) got (0x%x, 0x%x, 0x%x, 0x%x)\n", hwnd, uMsg, wParam, lParam);
 #endif
 #ifdef PERL_OBJECT
     CPerl *pPerl;
     pPerl = PERL_OBJECT_FROM_WINDOW(hwnd);
-    if(pPerl == NULL) return DefRichEditProc(hwnd, uMsg, wParam, lParam);
+	if(pPerl == NULL) return MY_CXT.DefRichEditProc(hwnd, uMsg, wParam, lParam);
 #endif
     int PerlResult;
     char Name[MAX_EVENT_NAME];
@@ -1032,8 +1049,9 @@
     if(PerlResult == 0) {
         return 0;
     } else {
-        return DefRichEditProc(hwnd, uMsg, wParam, lParam);
+        return MY_CXT.DefRichEditProc(hwnd, uMsg, wParam, lParam);
     }
+
 }
 
     /*
@@ -1043,6 +1061,7 @@
     */
 LRESULT CALLBACK TabStripMsgLoop(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    dMY_CXT;
     // a TabStrip acts like a container, so we simply
     // redirect the messages to our parent and call the default Proc.
     HWND hwndParent;
@@ -1052,7 +1071,7 @@
         SendMessage(hwndParent, uMsg, wParam, lParam);
         return 0;
     } else {
-        return DefTabStripProc(hwnd, uMsg, wParam, lParam);
+        return MY_CXT.DefTabStripProc(hwnd, uMsg, wParam, lParam);
     }
 }
 
@@ -1114,7 +1133,6 @@
                 */
                 
                 dSP;
-                dTARG;
                 ENTER;
                 SAVETMPS;
                 PUSHMARK(SP);
@@ -1222,7 +1240,6 @@
                 * (@)APPLIES_TO:Graphic
                 */
                 dSP;
-                dTARG;
                 ENTER;
                 SAVETMPS;
                 PUSHMARK(SP);
@@ -2287,7 +2304,6 @@
     // 2 = function or DefWindowProc
 
     dSP;
-    dTARG;
 
     ENTER ;
     SAVETMPS;
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/GUI_Options.cpp Win32-GUI-0.0.670/GUI_Options.cpp
--- Win32-GUI-0.0.670.orig/GUI_Options.cpp	2003-12-10 22:15:16.000000000 -0800
+++ Win32-GUI-0.0.670/GUI_Options.cpp	2003-12-19 01:14:42.000000000 -0800
@@ -394,7 +394,7 @@
                 perlcs->cs.hMenu = (HMENU) handle_From(NOTXSCALL ST(next_i));
             } else if(strcmp(option, "-instance") == 0) {
                 next_i = i + 1;
-                perlcs->cs.hInstance = (HINSTANCE) SvIV(ST(next_i));
+                perlcs->cs.hInstance = (HINSTANCE)(int)SvIV(ST(next_i));
             } else if(strcmp(option, "-name") == 0) {
                 next_i = i + 1;
                 perlcs->szWindowName = SvPV_nolen(ST(next_i));
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/ListView.xs Win32-GUI-0.0.670/ListView.xs
--- Win32-GUI-0.0.670.orig/ListView.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/ListView.xs	2003-12-19 01:14:42.000000000 -0800
@@ -54,6 +54,8 @@
 
 MODULE = Win32::GUI::ListView		PACKAGE = Win32::GUI::ListView
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:InsertColumn(%OPTIONS)
 int
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/MANIFEST Win32-GUI-0.0.670/MANIFEST
--- Win32-GUI-0.0.670.orig/MANIFEST	2003-12-12 18:52:38.000000000 -0800
+++ Win32-GUI-0.0.670/MANIFEST	2003-12-19 17:43:25.921875000 -0800
@@ -1,3 +1,8 @@
+CHANGELOG
+hints/cygwin.pl
+hints/MSWin32.pl
+win32perl.h
+ppport.h
 Animation.xs
 BUGS
 Bitmap.xs
@@ -27,7 +32,7 @@
 RichEdit.xs
 Splitter.xs
 TODO
-TYPEMAP
+typemap
 TabStrip.xs
 Textfield.xs
 Toolbar.xs
@@ -36,6 +41,12 @@
 hsplit.cur
 vsplit.cur
 resource.h
+docs/archdraft.html
+docs/html/archdraft.html
+docs/html/events.html
+docs/html/methods.html
+docs/html/options.html
+docs/html/packages.html
 docs/archdraft.pod
 docs/dodoc.pl
 docs/dodoc2.pl
@@ -102,59 +113,6 @@
 docs/html/guiconcepts.html
 docs/html/guioptions.html
 docs/html/guipacks.html
-docs/pod/AcceleratorTable.pod
-docs/pod/Animation.pod
-docs/pod/Bitmap.pod
-docs/pod/BitmapInline.pod
-docs/pod/Brush.pod
-docs/pod/Button.pod
-docs/pod/Checkbox.pod
-docs/pod/Class.pod
-docs/pod/Combobox.pod
-docs/pod/ComboboxEx.pod
-docs/pod/Cursor.pod
-docs/pod/DC.pod
-docs/pod/DateTime.pod
-docs/pod/DialogBox.pod
-docs/pod/Font.pod
-docs/pod/Graphic.pod
-docs/pod/GridLayout.pod
-docs/pod/Groupbox.pod
-docs/pod/Header.pod
-docs/pod/Icon.pod
-docs/pod/ImageList.pod
-docs/pod/Label.pod
-docs/pod/ListView.pod
-docs/pod/ListView_Item.pod
-docs/pod/ListView_SubItem.pod
-docs/pod/Listbox.pod
-docs/pod/Listbox_Item.pod
-docs/pod/MDI.pod
-docs/pod/Menu.pod
-docs/pod/MenuButton.pod
-docs/pod/MenuItem.pod
-docs/pod/NotifyIcon.pod
-docs/pod/Pen.pod
-docs/pod/ProgressBar.pod
-docs/pod/RadioButton.pod
-docs/pod/Rebar.pod
-docs/pod/RichEdit.pod
-docs/pod/Slider.pod
-docs/pod/Splitter.pod
-docs/pod/StatusBar.pod
-docs/pod/TabStrip.pod
-docs/pod/Textfield.pod
-docs/pod/Timer.pod
-docs/pod/Toolbar.pod
-docs/pod/Tooltip.pod
-docs/pod/TreeView.pod
-docs/pod/UpDown.pod
-docs/pod/Win32_GUI.pod
-docs/pod/Window.pod
-docs/pod/GUI.pod
-docs/pod/guiconcepts.pod
-docs/pod/guioptions.pod
-docs/pod/guipacks.pod
 docs/tut/guitut1-1.gif
 docs/tut/guitut1-2.gif
 docs/tut/guitut1-3.gif
@@ -173,6 +131,11 @@
 docs/tut/guitut9.html
 docs/tut/guitut9.pod
 docs/tut/morethanone.pl
+samples/DateTime.pl
+samples/nemtimer.pl
+samples/res.txt
+samples/richedit.rtf
+samples/tt.pl
 samples/Pod/RTF.pm
 samples/Zapotec.bmp
 samples/alarm.bmp
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/Makefile.PL Win32-GUI-0.0.670/Makefile.PL
--- Win32-GUI-0.0.670.orig/Makefile.PL	2003-11-19 20:10:42.000000000 -0800
+++ Win32-GUI-0.0.670/Makefile.PL	2003-12-19 12:34:53.000000000 -0800
@@ -1,38 +1,8 @@
 use ExtUtils::MakeMaker;
 use Config;
 
-$USERESOURCE = 0;
-
-foreach (@ARGV) {
-    if(/USERESOURCE=0/) {
-        $USERESOURCE = -1;
-        undef $_;
-        last;
-    }
-}
-
-if($USERESOURCE == -1) {
-    $USERESOURCE = 0;
-} else {
-    if($Config{'cc'} =~ /^cl(\.exe)?/i) {
-
-        print <<____EXPLAIN;
-
-Using Visual C++
-NOTE:Makefile.PL will add the instruction to use the Resource Compiler to 
-your Makefile; if you're not using Visual C++, or don't want to compile 
-resources with your extension, call this script with this additional 
-argument:
-
-    perl Makefile.PL USERESOURCE=0    
-
-____EXPLAIN
-
-        $USERESOURCE = 1;
-    }
-}
-
-@subpackages = qw(
+@xs = qw(
+        GUI
 	Animation
 	Bitmap
 	DC
@@ -51,8 +21,7 @@
 	TreeView
 );
 
-@c_files = qw(
-	GUI
+@cpp = qw(
 	GUI_Constants
 	GUI_Helpers
 	GUI_Options
@@ -60,42 +29,20 @@
 	GUI_Events
 );
 
-$c_ext = ($^O eq "cygwin") ? "c" : "cpp";
-
-@arg_c = ();
-$arg_object = "";
-
-foreach (@c_files) {
-	push( @arg_c, $_ . '.' . $c_ext );
-	$arg_object .= ' ' . $_ . $Config{'obj_ext'};
-}
-
-%arg_xs = ( 'GUI.xs' => 'GUI.' . $c_ext );
-@arg_dl_funcs = ( 'boot_Win32__GUI' );
-foreach (@subpackages) {
-	$arg_xs{$_.'.xs'} = $_ . '.' . $c_ext;
-	push( @arg_c, $_ . '.' . $c_ext );
-	push( @arg_dl_funcs, 'boot_Win32__GUI__' . $_ );
-	$arg_object .= ' ' . $_ . $Config{'obj_ext'};
-}
-
-
-%MakefileArgs = (
-    'NAME'         => 'Win32::GUI',
-    'VERSION_FROM' => 'GUI.pm',
-    'LIBS'         => ( ($^O eq "cygwin") ? '-lcomctl32' : 'comctl32.lib' ),
+WriteMakefile (
+    NAME => 'Win32::GUI',
+    VERSION_FROM => 'GUI.pm',
     'PM' => {
         'GUI.pm'            => '$(INST_LIBDIR)/GUI.pm',
         'BitmapInline.pm'   => '$(INST_LIBDIR)/GUI/BitmapInline.pm',
         'GridLayout.pm'     => '$(INST_LIBDIR)/GUI/GridLayout.pm',
     },
-	'XS' => { %arg_xs },
-	'C'  => [ @arg_c ],
-	'OBJECT' => $arg_object,
-	'DL_FUNCS' => { 'Win32::GUI' => [ @arg_dl_funcs ] },
-
-	($^O eq "cygwin") ? ( 'DEFINE' => '-UWIN32' ) : (),	
-
+    DL_FUNCS => { 'Win32::GUI' => [
+        'boot_Win32__GUI',
+    	(map { "boot_Win32__GUI__$_" } @xs[1..$#xs])
+    ]},
+    OBJECT => (join ' ', map { "$_\$(OBJ_EXT)" }  (@xs, @cpp)),
+    XS => { map { ("$_.xs" => "$_.cpp") } @xs},
 	'dist'  => {
         ZIP => 'zip',
         ZIPFLAGS => '-r9',
@@ -104,48 +51,13 @@
         'AUTHOR'        => 'Aldo Calpini <dada@perl.it>',
         'ABSTRACT'      => 'Perl-Win32 Graphical User Interface Extension',
     )),
-
 );
 
-
-$MakefileArgs{'LDFROM'} = '$(OBJECT) GUI.res' if $USERESOURCE;
-
-WriteMakefile( %MakefileArgs );
-
-# tweak the generated Makefile to include resource
-
 package MY;
 
 sub xs_c {
-($^O eq 'cygwin') ? 
-    shift->SUPER::xs_c(@_)
-:
     '
 .xs.cpp:
-    $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.cpp
+	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && $(MV) xstmp.c $*.cpp
 ';
 }
-
-sub constants {
-    my $inherited = shift->SUPER::constants(@_);
-    if($main::USERESOURCE) {
-        $inherited =~ s/\.SUFFIXES([^\n]+)\n/\.SUFFIXES$1 .rc res\n/;
-    }
-    return $inherited;
-}
-
-sub c_o {
-    my $inherited = shift->SUPER::c_o(@_);
-    if($main::USERESOURCE) {
-        $inherited .= "\nGUI.res:\n    rc.exe /l 0x409 /fo\"GUI.res\" GUI.rc\n\n";
-    }
-    return $inherited;
-}
-
-sub top_targets {
-    my $inherited = shift->SUPER::top_targets(@_);
-    if($main::USERESOURCE) {
-        $inherited =~ s/pure_all(.*) linkext/pure_all$1 GUI.res linkext/;
-    }
-    return $inherited;
-}
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/Makefile_m.pl Win32-GUI-0.0.670/Makefile_m.pl
--- Win32-GUI-0.0.670.orig/Makefile_m.pl	2003-11-19 21:08:06.000000000 -0800
+++ Win32-GUI-0.0.670/Makefile_m.pl	1969-12-31 16:00:00.000000000 -0800
@@ -1,118 +0,0 @@
-use Config_m;
-use ExtUtils::MakeMaker;
-$Config{'obj_ext'}='.o';
-
-$USERESOURCE = 1;
-
-@subpackages = qw(
-        Animation
-        Bitmap
-        DC
-        Font
-        ImageList
-        Label
-        Listbox
-        ListView
-        NotifyIcon
-        Rebar
-        RichEdit
-        Splitter
-        TabStrip
-        Textfield
-        Toolbar
-        TreeView
-);
-
-@c_files = qw(
-        GUI
-        GUI_Constants
-        GUI_Helpers
-        GUI_Options
-        GUI_MessageLoops
-        GUI_Events
-);
-
-$c_ext =  "cpp";
-
-@arg_c = ();
-$arg_object = "";
-
-foreach (@c_files) {
-        push( @arg_c, $_ . '.' . $c_ext );
-        $arg_object .= ' ' . $_ . $Config{'obj_ext'};
-}
-
-%arg_xs = ( 'GUI.xs' => 'GUI.' . $c_ext );
-@arg_dl_funcs = ( 'boot_Win32__GUI' );
-foreach (@subpackages) {
-        $arg_xs{$_.'.xs'} = $_ . '.' . $c_ext;
-        push( @arg_c, $_ . '.' . $c_ext );
-        push( @arg_dl_funcs, 'boot_Win32__GUI__' . $_ );
-        $arg_object .= ' ' . $_ . $Config{'obj_ext'};
-}
-
-
-%MakefileArgs = (
-    'NAME'         => 'Win32::GUI',
-    'VERSION_FROM' => 'GUI.pm',
-    'LIBS'         => ( ':nosearch -lcomctl32' ),
-    'PM' => {
-        'GUI.pm'            => '$(INST_LIBDIR)/GUI.pm',
-        'BitmapInline.pm'   => '$(INST_LIBDIR)/GUI/BitmapInline.pm',
-        'GridLayout.pm'     => '$(INST_LIBDIR)/GUI/GridLayout.pm',
-    },
-        'XS' => { %arg_xs },
-        'C'  => [ @arg_c ],
-        'OBJECT' => $arg_object,
-        'DL_FUNCS' => { 'Win32::GUI' => [ @arg_dl_funcs ] },
-        'DEFINE' => '-D__MINGW__',
-        'dist'  => {
-        ZIP => 'zip',
-        ZIPFLAGS => '-r9',
-    },
-    ($] < 5.005 ? () : (
-        'AUTHOR'        => 'Aldo Calpini <dada@perl.it>',
-        'ABSTRACT'      => 'Perl-Win32 Graphical User Interface Extension',
-    )),
-
-);
-
-
-$MakefileArgs{'LDFROM'} = '$(OBJECT) GUI.res' if $USERESOURCE;
-
-WriteMakefile( %MakefileArgs );
-
-# tweak the generated Makefile to include resource
-
-package MY;
-
-sub xs_c {
-    '
-.xs.cpp:
-    $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
-';
-}
-
-sub constants {
-    my $inherited = shift->SUPER::constants(@_);
-    if($main::USERESOURCE) {
-        $inherited =~ s/\.SUFFIXES([^\n]+)\n/\.SUFFIXES$1 .rc res\n/;
-    }
-    return $inherited;
-}
-
-sub c_o {
-    my $inherited = shift->SUPER::c_o(@_);
-    if($main::USERESOURCE) {
-        $inherited .= "\nGUI.res:\n    windres.exe -i GUI.rc -o GUI.res -O coff\n\n";
-    }
-    return $inherited;
-}
-
-sub top_targets {
-    my $inherited = shift->SUPER::top_targets(@_);
-    if($main::USERESOURCE) {
-        $inherited =~ s/pure_all(.*) linkext/pure_all$1 GUI.res linkext/;
-    }
-    return $inherited;
-}
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/NotifyIcon.xs Win32-GUI-0.0.670/NotifyIcon.xs
--- Win32-GUI-0.0.670.orig/NotifyIcon.xs	2003-11-19 20:10:42.000000000 -0800
+++ Win32-GUI-0.0.670/NotifyIcon.xs	2003-12-14 21:16:14.000000000 -0800
@@ -9,6 +9,8 @@
 
 MODULE = Win32::GUI::NotifyIcon		PACKAGE = Win32::GUI::NotifyIcon
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)INTERNAL:Add(PARENT, %OPTIONS)
 BOOL
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/Rebar.xs Win32-GUI-0.0.670/Rebar.xs
--- Win32-GUI-0.0.670.orig/Rebar.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/Rebar.xs	2003-12-19 01:14:43.000000000 -0800
@@ -45,6 +45,8 @@
 
 MODULE = Win32::GUI::Rebar		PACKAGE = Win32::GUI::Rebar
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:InsertBand(%OPTIONS)
 LRESULT
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/RichEdit.xs Win32-GUI-0.0.670/RichEdit.xs
--- Win32-GUI-0.0.670.orig/RichEdit.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/RichEdit.xs	2003-12-19 01:14:43.000000000 -0800
@@ -11,6 +11,8 @@
 
 MODULE = Win32::GUI::RichEdit		PACKAGE = Win32::GUI::RichEdit
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:SetCharFormat(%OPTIONS)
 LRESULT
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/TYPEMAP Win32-GUI-0.0.670/TYPEMAP
--- Win32-GUI-0.0.670.orig/TYPEMAP	2003-12-10 22:15:16.000000000 -0800
+++ Win32-GUI-0.0.670/TYPEMAP	1969-12-31 16:00:00.000000000 -0800
@@ -1,55 +0,0 @@
-# $Id: TYPEMAP,v 1.2.2.1 2003/12/10 21:15:15 lrocher Exp $
-TYPEMAP
-HWND         T_HANDLE
-HMENU        T_HANDLE
-HICON        T_HANDLE
-HCURSOR      T_HANDLE
-HBITMAP      T_HANDLE
-HFONT        T_HANDLE
-HGDIOBJ      T_HANDLE
-HIMAGELIST   T_HANDLE
-HDC          T_HANDLE
-HBRUSH       T_HANDLE
-HPEN         T_HANDLE
-HTREEITEM    T_IV
-LONG         T_IV
-LPCTSTR      T_PV
-LPTSTR       T_PV
-DWORD        T_IV
-UINT         T_IV
-BOOL         T_IV
-WPARAM       T_IV
-LPARAM       T_LPARAM
-LRESULT      T_IV
-HINSTANCE    T_IV
-COLORREF     T_COLOR
-LPCSTR       T_PV
-HENHMETAFILE T_IV
-FLOAT        T_FLOAT
-LPVOID       T_PV
-HACCEL       T_IV
-
-################################################################################
-INPUT
-T_HANDLE
-    if(SvROK($arg)) {
-        if(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0) != NULL)
-            $var = ($type) SvIV(*(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0)));
-        else
-            $var = NULL;
-    } else
-        $var = ($type) SvIV($arg);
-T_COLOR
-    $var = SvCOLORREF(NOTXSCALL $arg);
-T_LPARAM
-    if(SvPOK($arg))
-      $var = ($type) SvPV_nolen($arg);
-    else
-      $var = ($type) SvIV($arg);
-################################################################################
-OUTPUT
-T_HANDLE
-    sv_setiv($arg, (IV) $var);
-T_COLOR
-    sv_setiv($arg, (IV) $var);
-
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/TabStrip.xs Win32-GUI-0.0.670/TabStrip.xs
--- Win32-GUI-0.0.670.orig/TabStrip.xs	2003-11-30 00:19:04.000000000 -0800
+++ Win32-GUI-0.0.670/TabStrip.xs	2003-12-19 01:14:43.000000000 -0800
@@ -41,6 +41,8 @@
 
 MODULE = Win32::GUI::TabStrip		PACKAGE = Win32::GUI::TabStrip
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:InsertItem(%OPTIONS)
     # Adds an item to the TabStrip.
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/Textfield.xs Win32-GUI-0.0.670/Textfield.xs
--- Win32-GUI-0.0.670.orig/Textfield.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/Textfield.xs	2003-12-19 01:14:43.000000000 -0800
@@ -61,6 +61,8 @@
 
 MODULE = Win32::GUI::Textfield     PACKAGE = Win32::GUI::Textfield
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:ReplaceSel(STRING, [FLAG])
 LRESULT
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/Toolbar.xs Win32-GUI-0.0.670/Toolbar.xs
--- Win32-GUI-0.0.670.orig/Toolbar.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/Toolbar.xs	2003-12-19 01:14:43.000000000 -0800
@@ -33,6 +33,8 @@
 
 MODULE = Win32::GUI::Toolbar     PACKAGE = Win32::GUI::Toolbar
 
+PROTOTYPES: ENABLE
+
     ###########################################################################
     # (@)METHOD:AddBitmap(BITMAP, NUMBUTTONS)
 LRESULT
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/TreeView.xs Win32-GUI-0.0.670/TreeView.xs
--- Win32-GUI-0.0.670.orig/TreeView.xs	2003-11-30 21:04:02.000000000 -0800
+++ Win32-GUI-0.0.670/TreeView.xs	2003-12-19 01:14:43.000000000 -0800
@@ -35,6 +35,8 @@
 
 MODULE = Win32::GUI::TreeView		PACKAGE = Win32::GUI::TreeView
 
+PROTOTYPES: DISABLE
+
     ###########################################################################
     # (@)METHOD:InsertItem(%OPTIONS)
     # Inserts a new node in the TreeView.
@@ -287,7 +289,7 @@
         RETVAL = TreeView_DeleteAllItems(handle);
     else
         RETVAL = TreeView_Expand(handle,
-                                 (HTREEITEM) SvIV(ST(1)),
+                                 (HTREEITEM) (DWORD)SvIV(ST(1)),
                                  TVE_COLLAPSE | TVE_COLLAPSERESET);
 OUTPUT:
     RETVAL
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/hints/MSWin32.pl Win32-GUI-0.0.670/hints/MSWin32.pl
--- Win32-GUI-0.0.670.orig/hints/MSWin32.pl	1969-12-31 16:00:00.000000000 -0800
+++ Win32-GUI-0.0.670/hints/MSWin32.pl	2003-12-19 17:09:46.046875000 -0800
@@ -0,0 +1,105 @@
+use Config;
+
+my $mingw   = 1 if $Config{'cc'} =~ /^gcc/i;
+my $borland = 1 if $Config{'cc'} =~ /^bcc32/i;
+my $msvc    = 1 if $Config{'cc'} =~ /^cl/i;
+
+my $incpath = $Config{'incpath'};
+
+my @res_files = map { s/\.rc$/.res/i;$_ } <*.[Rr][Cc]>;
+
+if ($borland) {
+# Find the library path
+	my ($libpath) = ( grep { /borland .* lib \/* \W/ix }
+				split (/\s+/ms, $Config{'ldflags'})
+			);
+# Strip off the -L"..." around the path
+	$libpath =~ s/^-L["']?//; $libpath =~ s/["']?$//;
+
+	$self->{INC} .= qq{ -I"$incpath" -I"$incpath\\mfc" };
+	$self->{CCFLAGS} .= $Config{ccflags} . qq{ -L"$libpath" -L"$libpath\\PSDK" };
+
+# include the Microsoft Platform SDK libs
+	$self->{dynamic_lib}{OTHERLDFLAGS} .= qq{ c0d32.obj -L"$libpath\\PSDK" };
+
+	$self->{LDLOADLIBS} .= " import32.lib cw32mti.lib odbc32.lib comctl32.lib wininet.lib ";
+} elsif ($mingw) {
+	$self->{CCFLAGS} .= $Config{ccflags} . " -pipe ";
+
+	if (((`gcc --version`)[0] !~ /\s[3-9]\.\d+/) &&
+	    ($self->{CCFLAGS} !~ /-fvtable-thunks/)) {
+		$self->{CCFLAGS} .= ' -fvtable-thunks ';
+	} else {
+		$self->{CCFLAGS} =~ s/-fvtable-thunks//g;
+	}
+
+	$self->{LDLOADLIBS} = q{ -lnetapi32 -lwininet -lversion -lmpr -lodbc32 -lodbccp32 -lwinmm -lstdc++ -lole32 -loleaut32 -luuid  -lcomctl32 -lgdi32 -lcomdlg32 -lntdll -lws2_32 }; 
+} elsif ($msvc) {
+	$self->{INC}	.= ' -GX ';
+	$self->{LIBS}	.= ' :nosearch wininet.lib comctl32.lib ';
+	$self->{LDFROM}	.=  "\$(OBJECT) @res_files ";
+}
+
+$self->{clean}{FILES} .= ' *.res *.o *.obj vc*.pdb dll.base dll.exp *.stackdump';
+# Any way to include 'TMP*.$$$' in the above without having nmake go apeshit?
+
+$self->{dynamic_lib}{INST_DYNAMIC_DEP} .= " @res_files ";
+
+package MY;
+
+sub special_targets {
+    my $section = shift->SUPER::special_targets(@_);
+    $section =~ s/\.SUFFIXES([^\n]+)\n/\.SUFFIXES$1 .rc .res\n/;
+    return $section;
+}
+
+sub c_o {
+	my $section = shift->SUPER::c_o(@_);
+
+# Borland C doesn't preserve case in object files, this throws off dmake.
+	if ($borland) {
+		$section =~ s/^(\s+\$\(CCCMD.+?)\s+(\$\*\.\w+)/$1 $2 && ren \$*\$(OBJ_EXT) \$*\$(OBJ_EXT)\n/msg
+	}
+
+# Add target for compiling resource files.
+	if ($mingw) {
+            $section .= <<'EOF';
+
+# Added by hints/MSWin32.pl
+.rc.res:
+	windres -O coff -o $*.res $*.rc
+EOF
+	} else {
+	    my $rc = $borland ? qq{brcc32.exe -x -I"$incpath"} : "rc.exe";
+
+	    $section .= <<"EOF";
+
+# Added by hints/MSWin32.pl
+.rc.res:
+	$rc /l 0x409 /fo\$*.res \$*.rc
+EOF
+	}
+
+	return $section;
+}
+
+sub dynamic_lib {
+	my $section = shift->SUPER::dynamic_lib(@_);
+	if ($borland) {
+		return <<"EOF" . $section;
+
+# Added by hints/MSWin32.pl to dynamic_lib
+RESFILES = @res_files
+
+EOF
+	} elsif ($mingw) {
+		return <<"EOF" . $section;
+
+# Added by hints/MSWin32.pl to dynamic_lib
+OBJECT += @res_files
+
+EOF
+	} else {
+		return $section;
+	}
+}
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/hints/cygwin.pl Win32-GUI-0.0.670/hints/cygwin.pl
--- Win32-GUI-0.0.670.orig/hints/cygwin.pl	1969-12-31 16:00:00.000000000 -0800
+++ Win32-GUI-0.0.670/hints/cygwin.pl	2003-12-19 17:09:46.078125000 -0800
@@ -0,0 +1,67 @@
+use Config;
+
+for (qw(INCLUDE LIB)) {
+	warn
+"WARNING: Having environment variable $_ set will most likely cause your build to fail!\n"
+		if exists $ENV{$_};
+}
+
+my @res_files = map { s/\.rc$/.res/i;$_ } <*.[Rr][Cc]>;
+
+$self->{LDLOADLIBS} = q{ -lnetapi32 -lwininet -lversion -lmpr -lodbc32 -lodbccp32 -lwinmm -lstdc++ -lole32 -loleaut32 -luuid  -lcomctl32 -lgdi32 -lcomdlg32 -lntdll }; 
+
+if ($Config{cc} =~ /\Wgcc/) {
+# Check for GCC >= 3.x
+	if (((`gcc --version`)[0] !~ /\s[3-9]\.\d+/) &&
+	    ($self->{CCFLAGS} !~ /-fvtable-thunks/)) {
+		$self->{CCFLAGS} .= ' -fvtable-thunks ';
+	} else {
+		$self->{CCFLAGS} =~ s/-fvtable-thunks//g;
+	}
+}
+
+$self->{CCFLAGS} .= $Config{ccflags} . " -pipe ";
+$self->{CCFLAGS} =~ s|-I/usr/local/include/?||g;
+
+$self->{clean}{FILES} .= ' *.res *.o *.obj vc*.pdb TMP*.$$$ dll.base dll.exp *.stackdump ';
+
+$self->{dynamic_lib}{INST_DYNAMIC_DEP} .= " @res_files ";
+
+package MY;
+
+# Add targets for compiling resource files.
+
+sub special_targets {
+    my $section = shift->SUPER::special_targets(@_);
+    $section =~ s/\.SUFFIXES([^\n]+)\n/\.SUFFIXES$1 .rc .res\n/;
+    return $section;
+}
+
+sub c_o {
+	my $section = shift->SUPER::c_o(@_);
+        $section .= <<'EOF';
+
+# Added by hints/cygwin.pl
+.rc.res:
+	windres -O coff -o $*.res $*.rc
+
+EOF
+	return $section;
+}
+
+sub dynamic_lib {
+   my $section = shift->SUPER::dynamic_lib(@_);
+   if (defined $section && $section) {
+	$section = <<"EOF" . $section;
+
+# Added by hints/cygwin.pl to dynamic_lib
+OBJECT += @res_files
+
+EOF
+## This doesn't seem to help much.
+#	$section .= <<'EOF' if -e '/bin/rebase';
+#	rebase -v -d -b 0x70000000 -o 0x10000 $@
+#EOF
+   }
+   $section;
+}
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/ppport.h Win32-GUI-0.0.670/ppport.h
--- Win32-GUI-0.0.670.orig/ppport.h	1969-12-31 16:00:00.000000000 -0800
+++ Win32-GUI-0.0.670/ppport.h	2003-12-19 17:08:55.546875000 -0800
@@ -0,0 +1,315 @@
+
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
+/* Perl/Pollution/Portability Version 1.0007-gsar-v3 */
+
+/* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
+   distributed under the same license as any version of Perl. */
+   
+/* For the latest version of this code, please retreive the Devel::PPPort
+   module from CPAN, contact the author at <kjahds@kjahds.com>, or check
+   with the Perl maintainers. */
+   
+/* If you needed to customize this file for your project, please mention
+   your changes, and visible alter the version number. */
+
+/* Additional macros added for 5.6.0 compatibility. --GSAR */
+
+/*
+   In order for a Perl extension module to be as portable as possible
+   across differing versions of Perl itself, certain steps need to be taken.
+   Including this header is the first major one, then using dTHR is all the
+   appropriate places and using a PL_ prefix to refer to global Perl
+   variables is the second.
+*/
+
+
+/* If you use one of a few functions that were not present in earlier
+   versions of Perl, please add a define before the inclusion of ppport.h
+   for a static include, or use the GLOBAL request in a single module to
+   produce a global definition that can be referenced from the other
+   modules.
+   
+   Function:            Static define:           Extern define:
+   newCONSTSUB()        NEED_newCONSTSUB         NEED_newCONSTSUB_GLOBAL
+
+*/
+ 
+
+/* To verify whether ppport.h is needed for your module, and whether any
+   special defines should be used, ppport.h can be run through Perl to check
+   your source code. Simply say:
+   
+   	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+   
+   The result will be a list of patches suggesting changes that should at
+   least be acceptable, if not necessarily the most efficient solution, or a
+   fix for all possible problems. It won't catch where dTHR is needed, and
+   doesn't attempt to account for global macro or function definitions,
+   nested includes, typemaps, etc.
+   
+   In order to test for the need of dTHR, please try your module under a
+   recent version of Perl that has threading compiled-in.
+ 
+*/ 
+
+
+/*
+#!/usr/bin/perl
+@ARGV = ("*.xs") if !@ARGV;
+%badmacros = %funcs = %macros = (); $replace = 0;
+foreach (<DATA>) {
+	$funcs{$1} = 1 if /Provide:\s+(\S+)/;
+	$macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
+	$replace = $1 if /Replace:\s+(\d+)/;
+	$badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
+	$badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
+}
+foreach $filename (map(glob($_),@ARGV)) {
+	unless (open(IN, "<$filename")) {
+		warn "Unable to read from $file: $!\n";
+		next;
+	}
+	print "Scanning $filename...\n";
+	$c = ""; while (<IN>) { $c .= $_; } close(IN);
+	$need_include = 0; %add_func = (); $changes = 0;
+	$has_include = ($c =~ /#.*include.*ppport/m);
+
+	foreach $func (keys %funcs) {
+		if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {
+			if ($c !~ /\b$func\b/m) {
+				print "If $func isn't needed, you don't need to request it.\n" if
+				$changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);
+			} else {
+				print "Uses $func\n";
+				$need_include = 1;
+			}
+		} else {
+			if ($c =~ /\b$func\b/m) {
+				$add_func{$func} =1 ;
+				print "Uses $func\n";
+				$need_include = 1;
+			}
+		}
+	}
+
+	if (not $need_include) {
+		foreach $macro (keys %macros) {
+			if ($c =~ /\b$macro\b/m) {
+				print "Uses $macro\n";
+				$need_include = 1;
+			}
+		}
+	}
+
+	foreach $badmacro (keys %badmacros) {
+		if ($c =~ /\b$badmacro\b/m) {
+			$changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
+			print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
+			$need_include = 1;
+		}
+	}
+	
+	if (scalar(keys %add_func) or $need_include != $has_include) {
+		if (!$has_include) {
+			$inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
+			       "#include \"ppport.h\"\n";
+			$c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
+		} elsif (keys %add_func) {
+			$inc = join('',map("#define NEED_$_\n", sort keys %add_func));
+			$c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
+		}
+		if (!$need_include) {
+			print "Doesn't seem to need ppport.h.\n";
+			$c =~ s/^.*#.*include.*ppport.*\n//m;
+		}
+		$changes++;
+	}
+	
+	if ($changes) {
+		open(OUT,">/tmp/ppport.h.$$");
+		print OUT $c;
+		close(OUT);
+		open(DIFF, "diff -u $filename /tmp/ppport.h.$$|");
+		while (<DIFF>) { s!/tmp/ppport\.h\.$$!$filename.patched!; print STDOUT; }
+		close(DIFF);
+		unlink("/tmp/ppport.h.$$");
+	} else {
+		print "Looks OK\n";
+	}
+}
+__DATA__
+*/
+
+#ifndef PERL_REVISION
+#   ifndef __PATCHLEVEL_H_INCLUDED__
+#       include "patchlevel.h"
+#   endif
+#   ifndef PERL_REVISION
+#	define PERL_REVISION	(5)
+        /* Replace: 1 */
+#       define PERL_VERSION	PATCHLEVEL
+#       define PERL_SUBVERSION	SUBVERSION
+        /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+        /* Replace: 0 */
+#   endif
+#endif
+
+#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+
+#ifndef ERRSV
+#	define ERRSV perl_get_sv("@",FALSE)
+#endif
+
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
+/* Replace: 1 */
+#	define PL_sv_undef	sv_undef
+#	define PL_sv_yes	sv_yes
+#	define PL_sv_no		sv_no
+#	define PL_na		na
+#	define PL_stdingv	stdingv
+#	define PL_hints		hints
+#	define PL_curcop	curcop
+#	define PL_curstash	curstash
+#	define PL_copline	copline
+#	define PL_Sv		Sv
+#	define PL_dowarn	dowarn
+/* Replace: 0 */
+#endif
+
+#ifndef dNOOP
+#  ifdef WIN32
+#	define dNOOP extern int Perl___notused
+#  else
+#	define dNOOP extern int errno
+#  endif
+#endif
+
+#ifndef dTHR
+#  define dTHR		dNOOP
+#endif
+
+#ifndef dTHX
+#  define dTHX		dNOOP
+#  define dTHXa(x)	dNOOP
+#  define dTHXoa(x)	dNOOP
+#endif
+
+#ifndef pTHX
+#  define pTHX		void
+#  define pTHX_
+#  define aTHX
+#  define aTHX_
+#endif
+
+#ifndef USING_WIDE
+#  define USING_WIDE()	0
+#endif
+
+#ifndef A2WHELPER
+#  define A2WHELPER(a,b,c)		((void)0)
+#  define W2AHELPER(a,b,c)		((void)0)
+#endif
+
+#ifndef A2WHELPER_LEN
+#  define A2WHELPER_LEN(a,b,c,d)	(0)
+#  define W2AHELPER_LEN(a,b,c,d)	(0)
+#endif
+
+#ifndef boolSV
+#	define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#endif
+
+#ifndef gv_stashpvn
+#	define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#endif
+
+#ifndef newSVpvn
+#	define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#endif
+
+#ifndef newRV_inc
+/* Replace: 1 */
+#	define newRV_inc(sv) newRV(sv)
+/* Replace: 0 */
+#endif
+
+#ifndef newRV_noinc
+#  ifdef __GNUC__
+#    define newRV_noinc(sv)               \
+      ({                                  \
+          SV *nsv = (SV*)newRV(sv);       \
+          SvREFCNT_dec(sv);               \
+          nsv;                            \
+      })
+#  else
+#    if defined(CRIPPLED_CC) || defined(USE_THREADS)
+static SV * newRV_noinc (SV * sv)
+{
+          SV *nsv = (SV*)newRV(sv);       
+          SvREFCNT_dec(sv);               
+          return nsv;                     
+}
+#    else
+#      define newRV_noinc(sv)    \
+        ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+#    endif
+#  endif
+#endif
+
+/* Provide: newCONSTSUB */
+
+/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
+
+#if defined(NEED_newCONSTSUB)
+static
+#else
+extern void newCONSTSUB _((HV * stash, char * name, SV *sv));
+#endif
+
+#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
+void
+newCONSTSUB( HV *stash, char *name, SV *sv )
+{
+	U32 oldhints = PL_hints;
+	HV *old_cop_stash = PL_curcop->cop_stash;
+	HV *old_curstash = PL_curstash;
+	line_t oldline = PL_curcop->cop_line;
+	PL_curcop->cop_line = PL_copline;
+
+	PL_hints &= ~HINT_BLOCK_SCOPE;
+	if (stash)
+		PL_curstash = PL_curcop->cop_stash = stash;
+
+	newSUB(
+
+#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
+     /* before 5.003_22 */
+		start_subparse(),
+#else
+#  if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+     /* 5.003_22 */
+     		start_subparse(0),
+#  else
+     /* 5.003_23  onwards */
+     		start_subparse(FALSE, 0),
+#  endif
+#endif
+
+		newSVOP(OP_CONST, 0, newSVpv(name,0)),
+		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
+		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+	);
+
+	PL_hints = oldhints;
+	PL_curcop->cop_stash = old_cop_stash;
+	PL_curstash = old_curstash;
+	PL_curcop->cop_line = oldline;
+}
+#endif
+
+#endif /* newCONSTSUB */
+
+#endif /* _P_P_PORTABILITY_H_ */
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/typemap Win32-GUI-0.0.670/typemap
--- Win32-GUI-0.0.670.orig/typemap	1969-12-31 16:00:00.000000000 -0800
+++ Win32-GUI-0.0.670/typemap	2003-12-19 01:14:43.000000000 -0800
@@ -0,0 +1,61 @@
++# $Id: typemap,v 1.4 2003/12/19 09:14:43 caelum Exp $
+TYPEMAP
+HWND         T_HANDLE
+HMENU        T_HANDLE
+HICON        T_HANDLE
+HCURSOR      T_HANDLE
+HBITMAP      T_HANDLE
+HFONT        T_HANDLE
+HGDIOBJ      T_HANDLE
+HIMAGELIST   T_HANDLE
+HDC          T_HANDLE
+HBRUSH       T_HANDLE
+HPEN         T_HANDLE
+HTREEITEM    T_HANDLE
+LONG         T_IV
+LPCTSTR      T_PV
+LPTSTR       T_PV
+DWORD        T_IV
+UINT         T_IV
+BOOL         T_IV
+WPARAM       T_IV
+LPARAM       T_LPARAM
+LRESULT      T_IV
+HINSTANCE    T_UV
+COLORREF     T_COLOR
+LPCSTR       T_PV
+HENHMETAFILE T_UV
+FLOAT        T_FLOAT
+LPVOID       T_PV
+HACCEL       T_UV
+
+################################################################################
+INPUT
+T_HANDLE
+    if(SvROK($arg)) {
+        if(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0) != NULL)
+            $var = ($type)(DWORD)SvIV(*(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0)));
+        else
+            $var = NULL;
+    } else
+        $var = ($type)(DWORD)SvIV($arg);
+T_COLOR
+    $var = ($type) SvCOLORREF(NOTXSCALL $arg);
+T_UV    
+    $var= ($type)(DWORD)SvUV($arg)
+T_LPARAM
+    if(SvPOK($arg))
+      $var = ($type)(DWORD) SvPV_nolen($arg);
+    else
+      $var = ($type)(DWORD) SvIV($arg);
+
+################################################################################
+OUTPUT
+T_HANDLE
+    sv_setiv($arg, (IV)(DWORD)$var);
+T_COLOR
+    sv_setiv($arg, (IV) $var);
+T_UV    
+    if(  ! SvREADONLY($arg)  )
+        sv_setuv( $arg, (UV)(DWORD)$var );
+
diff -ruN -w -I '$Id: ' Win32-GUI-0.0.670.orig/win32perl.h Win32-GUI-0.0.670/win32perl.h
--- Win32-GUI-0.0.670.orig/win32perl.h	1969-12-31 16:00:00.000000000 -0800
+++ Win32-GUI-0.0.670/win32perl.h	2003-12-19 17:08:59.453125000 -0800
@@ -0,0 +1,396 @@
+/*
+ * This file provides some common includes and workarounds for libwin32
+ * extensions. Use as a replacement for all necessary Perl headers and
+ * <windows.h>. As well as some ANSI headers and the ppport.h compatibility
+ * header. Include any other headers you need after this one.
+ *
+ * Headers generally don't get included more than once, so don't worry about
+ * duplicating an #include by accident.
+ *
+ * If you want to pass macros to perl headers, such as #define NO_XSLOCKS,
+ * define them before including this header.
+ *
+ * Rafael Kitover - 12/2003
+ */
+
+#ifndef WIN32_PERL_H
+#define WIN32_PERL_H
+
+/* ANSI C stuff */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#undef isnan
+#ifndef __BORLANDC__
+#include <malloc.h>
+#endif
+
+/* Win32 stuff */
+
+#include <windows.h>
+
+#if (!defined(__MINGW32__) && !(defined(__BORLANDC__)) || __BORLANDC__ >= 0x0550)
+#include <wtypes.h>
+#endif
+
+#if defined(__CYGWIN__) && PERL_REVISION <= 5 && PERL_VERSION <= 6
+/* No win32.h in cygwin perl 5.6 */
+# undef WIN32
+#endif
+
+/* This header conflicts with Perl's macros, so include it early. */
+#include <shlobj.h>
+
+/* Perl stuff */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "patchlevel.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#include "ppport.h"
+
+#undef 	Top			/* some devel version pollutes */
+
+/* Type Fixups */
+
+#undef  WORD
+
+#if !defined(_WIN64) && !defined(DWORD_PTR)
+#  define DWORD_PTR	DWORD
+#endif
+
+#if !defined(_WIN64) && !defined(PDWORD_PTR)
+#  define PDWORD_PTR	DWORD*
+#endif
+
+#ifdef __cplusplus
+	#define lw32_perl_LIBCAST HINSTANCE__*
+#else
+	#define lw32_perl_LIBCAST HANDLE
+#endif
+
+#if !defined(__CYGWIN__) && !defined(__BORLANDC__)
+	#undef  stat
+	#define stat _stati64
+#endif
+
+#ifdef __BORLANDC__
+	#define FARPROC(fptr) int __stdcall (*fptr)(void)
+#else
+	#define FARPROC(fptr) FARPROC fptr
+#endif
+
+/* Constant Fixups */
+
+#ifndef _MAX_PATH
+#	define _MAX_PATH MAX_PATH
+#endif
+
+/* Function Fixups */
+
+/* Perl 5.005 added win32_get_osfhandle/win32_open_osfhandle */
+/* This block was taken from Tye's APIFile.xs and modified */
+#if (PERL_REVISION <= 5 && PERL_VERSION < 5) || defined(__CYGWIN__)
+# define win32_get_osfhandle _get_osfhandle
+# ifdef __CYGWIN__
+#  define win32_open_osfhandle(handle,mode) \
+	(Perl_croak(aTHX_ "_open_osfhandle not implemented on Cygwin!"), -1)
+# else
+#  define win32_open_osfhandle _open_osfhandle
+# endif
+# ifdef _get_osfhandle
+#  undef _get_osfhandle	/* stolen_get_osfhandle() isn't available here */
+# endif
+# ifdef _open_osfhandle
+#  undef _open_osfhandle /* stolen_open_osfhandle() isn't available here */
+# endif
+#endif
+
+#ifdef __BORLANDC__ /* Borland C Fixups */
+
+#define DllMain DllEntryPoint
+
+/* Disable "not expanded inline" warnings. */
+#pragma warn -inl
+
+/* Some Borland C compilers don't have odbccp32.lib, notably the free 5.5
+ * version, so we "delayload" a couple functions we need ourselves.
+ */
+
+#ifdef __cplusplus
+	#define static_inline static inline
+#else
+	#define static_inline static
+#endif
+
+#include <odbcinst.h>	/* To avoid prototype redefinition problems. */
+
+#undef  SQLConfigDataSource
+#define SQLConfigDataSource		lw32_perl_SQLConfigDataSource
+#undef  SQLGetPrivateProfileString
+#define SQLGetPrivateProfileString	lw32_perl_SQLGetPrivateProfileString
+
+static HANDLE odbccp32_dll = NULL;
+
+static BOOL __stdcall (*odbccp32_SQLConfigDataSource)(HWND, WORD, LPCSTR,
+			LPCSTR);
+
+static int __stdcall (*odbccp32_SQLGetPrivateProfileString)(LPCSTR, LPCSTR,
+			LPCSTR, LPCSTR, INT, LPCSTR);
+
+static_inline void odbccp32_init(void)
+{
+	odbccp32_dll = LoadLibrary("odbccp32.dll");
+	if (odbccp32_dll == NULL) {
+		croak("Could not LoadLibrary odbccp32.dll");
+	}
+
+	odbccp32_SQLConfigDataSource =
+	  (BOOL __stdcall (*)(HWND, WORD, LPCSTR, LPCSTR))
+          GetProcAddress((lw32_perl_LIBCAST)odbccp32_dll,
+	  	"SQLConfigDataSource");
+
+	if (odbccp32_SQLConfigDataSource == NULL) {
+	  croak("could not find function SQLConfigDataSource in odbccp32.dll");
+	}
+
+	odbccp32_SQLGetPrivateProfileString =
+	  (int __stdcall (*)(LPCSTR, LPCSTR, LPCSTR, LPCSTR, INT, LPCSTR))
+	  GetProcAddress((lw32_perl_LIBCAST)odbccp32_dll,
+	  	"SQLGetPrivateProfileString");
+
+	if (odbccp32_SQLGetPrivateProfileString == NULL) {
+		croak(
+"could not find function SQLGetPrivateProfileString in odbccp32.dll");
+	}
+}
+
+static_inline BOOL
+lw32_perl_SQLConfigDataSource(HWND hwndParent, WORD fRequest,
+	LPCSTR lpszDriver, LPCSTR lpszAttributes)
+{
+
+	if (odbccp32_dll == NULL) { odbccp32_init(); }
+	return (BOOL)(*odbccp32_SQLConfigDataSource)(
+		hwndParent, fRequest, lpszDriver, lpszAttributes);
+}
+
+static_inline int
+lw32_perl_SQLGetPrivateProfileString(LPCSTR lpszSection, LPCSTR lpszEntry,
+	LPCSTR lpszDefault, LPCSTR RetBuffer, INT cbRetBuffer,
+	LPCSTR lpszFilename)
+{
+	if (odbccp32_dll == NULL) { odbccp32_init(); }
+	return (int)(*odbccp32_SQLGetPrivateProfileString)(
+		lpszSection, lpszEntry, lpszDefault, RetBuffer, cbRetBuffer,
+		lpszFilename);
+}
+
+#endif /* Borland C Fixups */
+
+#if defined(__CYGWIN__) || defined(__MINGW32__) /* Cygwin and MinGW Fixups */
+
+#include <commctrl.h>
+
+/* Older w32api commctrl.h missing some defs */
+#ifndef LVIF_INDENT
+	#define LVIF_INDENT 16
+	#define TCM_SETMINTABWIDTH   	(TCM_FIRST + 49)
+	#define TB_GETPADDING		(WM_USER+86)
+	#define TB_SETPADDING		(WM_USER+87)
+	#define TB_SETINDENT		(WM_USER+47)
+	#define TB_GETMAXSIZE		(WM_USER+83)
+	#if (_WIN32_IE >= 0x0400)
+		#define TVGN_LASTVISIBLE	10
+	#endif
+#endif
+
+/* commctrl.h macro DateTime_(Get|Set)Systemtime is capitalized incorrectly in
+ * the w32api headers.
+ */
+
+#define DateTime_GetSystemtime DateTime_GetSystemTime
+#define DateTime_SetSystemtime DateTime_SetSystemTime
+
+/* Missing TreeView_GetLastVisible and ListView_GetCheckState macros.
+ */
+#define TreeView_GetLastVisible(w) TreeView_GetNextItem(w,NULL,TVGN_LASTVISIBLE)
+
+/* Taken this from Laurent Rocher's (rocherl@club-internet.fr) Win32::GUI patch
+ * from: http://perso.club-internet.fr/rocherl/HowTo/howto-mingw.html
+ */
+#define ListView_GetCheckState(w,i) (int)(((SNDMSG((w), LVM_GETITEMSTATE, (WPARAM)i, LVIS_STATEIMAGEMASK)) >> 12) -1)
+
+/* Cygwin/Mingw libkernel32 does not have the Job functions, so we have to load
+ * them at run time from kernel32.dll
+ *
+ * These get optimized out when not referenced.
+ */
+
+#undef  CreateJobObject
+#define CreateJobObject			lw32_perl_CreateJobObject
+#undef  TerminateJobObject
+#define TerminateJobObject		lw32_perl_TerminateJobObject
+#undef  AssignProcessToJobObject
+#define AssignProcessToJobObject	lw32_perl_AssignProcessToJobObject
+
+static HANDLE kernel32_dll = NULL;
+
+static HANDLE __stdcall (*kernel32_CreateJobObjectA)(LPSECURITY_ATTRIBUTES, LPCSTR);
+
+static BOOL __stdcall (*kernel32_TerminateJobObject)(HANDLE, UINT);
+
+static BOOL __stdcall (*kernel32_AssignProcessToJobObject)(HANDLE, HANDLE);
+
+static inline void kernel32_init()
+{
+	kernel32_dll = LoadLibrary("kernel32.dll");
+	if (kernel32_dll == NULL) {
+		croak("Could not LoadLibrary kernel32.dll");
+	}
+
+	kernel32_CreateJobObjectA =
+	  (HANDLE __stdcall (*)(LPSECURITY_ATTRIBUTES, LPCSTR))
+	  GetProcAddress((lw32_perl_LIBCAST)kernel32_dll,"CreateJobObjectA");
+
+	if (kernel32_CreateJobObjectA == NULL) {
+	  croak("could not find function CreateJobObjectA in kernel32.dll");
+	}
+
+	kernel32_TerminateJobObject =
+	  (BOOL __stdcall (*)(HANDLE, UINT))
+	  GetProcAddress((lw32_perl_LIBCAST)kernel32_dll,"TerminateJobObject");
+
+	if (kernel32_TerminateJobObject  == NULL) {
+	  croak("could not find function TerminateJobObject in kernel32.dll");
+	}
+
+	kernel32_AssignProcessToJobObject =
+	  (BOOL __stdcall (*)(HANDLE, HANDLE))
+	  GetProcAddress((lw32_perl_LIBCAST)kernel32_dll,
+	  	"AssignProcessToJobObject");
+
+	if (kernel32_AssignProcessToJobObject == NULL) {
+	  croak(
+"could not find function AssignProcessToJobObject in kernel32.dll");
+	}
+}
+
+static inline HANDLE lw32_perl_CreateJobObject(
+	LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName)
+{
+	if (kernel32_dll == NULL) { kernel32_init(); }
+	return (HANDLE)(*kernel32_CreateJobObjectA)(lpJobAttributes, lpName);
+}
+
+static inline BOOL lw32_perl_TerminateJobObject(HANDLE hJob, UINT uExitCode)
+{
+	if (kernel32_dll == NULL) { kernel32_init(); }
+	return (BOOL)(*kernel32_TerminateJobObject)(hJob, uExitCode);
+}
+
+static inline BOOL lw32_perl_AssignProcessToJobObject(HANDLE hJob,
+	HANDLE hProcess)
+{
+	if (kernel32_dll == NULL) { kernel32_init(); }
+	return (BOOL)(*kernel32_AssignProcessToJobObject)(hJob, hProcess);
+}
+
+#endif /* Cygwin and MinGW Fixups */
+
+
+#ifdef __CYGWIN__ /* Cygwin specific Fixups */
+
+/* Headers */
+#include <netdb.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <wchar.h>
+
+/* Possibly missing prototypes */
+#define _wcscmpi _wcsicmp
+int  _wcsicmp(const wchar_t*, const wchar_t*);
+long _wtol (const wchar_t*);
+
+/* Make an itoa and ltoa macro using snprintf */
+
+#define itoa(num,str,len) snprintf(str, len, "%d",  num), str;
+#define ltoa(num,str,len) snprintf(str, len, "%ld", num), str;
+
+/* UNICODE stuff (from win32.h) */
+
+#undef USING_WIDE
+#undef A2WHELPER
+#undef A2WHELPER_LEN
+#undef W2AHELPER
+#undef W2AHELPER_LEN
+
+#define USING_WIDE() (0)
+
+#define A2WHELPER_LEN(lpa, alen, lpw, nBytes)\
+    (lpw[0] = 0, MultiByteToWideChar(CP_ACP, 0, \
+                                    lpa, alen, lpw, (nBytes/sizeof(WCHAR))))
+
+#define A2WHELPER(lpa, lpw, nBytes)     A2WHELPER_LEN(lpa, -1, lpw, nBytes)
+
+#define W2AHELPER_LEN(lpw, wlen, lpa, nChars)\
+    (lpa[0] = '\0', WideCharToMultiByte(CP_ACP, 0, \
+                                       lpw, wlen, (LPSTR)lpa, nChars,NULL,NULL))
+
+#define W2AHELPER(lpw, lpa, nChars)     W2AHELPER_LEN(lpw, -1, lpa, nChars)
+
+/*
+ * Implementation of missing functions.
+ *
+ * NOTE: These will not bloat the code, since on GCC at least a static inline
+ * function will only be compiled if there are calls to it.
+ */
+
+#ifndef strrev
+#define strrev lw32_perl_strrev
+
+static inline char *lw32_perl_strrev(char* str)
+{
+	int  start = 0;
+	int  end   = strlen(str) - 1;
+
+	while (start < end) {
+		char tmp   = str[start];
+		str[start] = str[end];
+		str[end]   = tmp;
+		start++; end--;
+	}
+}
+
+#endif /* strrev */
+
+/*
+ * Cygwin installations with postgres installed may have a conflicting
+ * /usr/include/sqltypes.h which will break trying to #include <sql.h>.
+ */
+# ifndef ODBCVER
+#  define ODBCVER 0x0351
+# endif
+
+# include <w32api/sqltypes.h>
+
+#endif /* Cygwin specific Fixups */
+
+/* Clear out unnecessary macros */
+
+#undef lw32_perl_LIBCAST
+
+#undef Stat
+#undef Move
+
+#endif /* WIN32_PERL_H */
