Commit in reactos on MAIN
w32api/include/commctrl.h+13-71.8 -> 1.9
lib/comctl32/animate.c+16-111.7 -> 1.8
            /comboex.c+13-141.7 -> 1.8
            /datetime.c+640-9811.6 -> 1.7
            /flatsb.c+1-11.7 -> 1.8
            /header.c+1-11.6 -> 1.7
            /hotkey.c+49-521.5 -> 1.6
            /imagelist.c+11.15 -> 1.16
            /ipaddress.c+10-101.6 -> 1.7
            /listview.c+87-761.15 -> 1.16
            /monthcal.c+278-3131.5 -> 1.6
            /nativefont.c+26-321.3 -> 1.4
            /progress.c+3-31.7 -> 1.8
            /rebar.c+23-261.14 -> 1.15
            /status.c+46-491.6 -> 1.7
            /syslink.c+3-51.2 -> 1.3
            /tab.c+1-21.11 -> 1.12
            /toolbar.c+264-1971.20 -> 1.21
            /tooltips.c+32-141.10 -> 1.11
            /trackbar.c+14-101.6 -> 1.7
            /treeview.c+11-71.12 -> 1.13
            /updown.c+53-281.6 -> 1.7
            /winehq2ros.patch+89-141.12 -> 1.13
+1674-1853
23 modified files
Sync to Wine-20041201
Ulrich Czekalla <ulrich@codeweavers.com>
- Prevent the animation thread from waiting on itself when it stops.
Robert Shearman <rob@codeweavers.com>
- Remove unnecessary WNDPROC casts.
Alexandre Julliard <julliard@winehq.org>
- Avoid using the MAKEPOINTS macro, it's broken on big endian.
- Use correct type instead of void* in item linked list.
Dimitrie O. Paun <dpaun@rogers.com>
- Minor cleanups.
- Implement proper GWL_STYLE handling, proper reaction to style changes.
- Merge {{Inc,Dec}rement,Reset{Up,Down}}Field into one method. Fix a
  bunch of bugs in the process.  Implement DTM_[GS]ETMCFONT. Indentation
  fixes, cleanups.
- Use typesafe signature where possible.
- Use Unicode functions where possible.
- Send notification messages in the format dictated by
  infoPtr->notifyFormat.
- Audit the month calendar.
- Rename STATUSWINDOWINFO to STATUS_INFO, for consistency with other
  controls. Fix some prototypes. Always pass infoPtr around.
- Use only Unicode functions, it makes it easier to see we are fully
  Unicode compliant.
Robert Shearman <rob@codeweavers.com>
- Always remove WS_BORDER style from ComboBoxEx control.
- Correct the date of the completeness audit.
- Store the new style before redrawing and repositioning the control.
- Set cache bitmap dimensions correctly when a 0x0 image list is used.
- Optimize WM_STYLECHANGED handler to only redraw when a CCS_* style
  is changed, like native.
- bNtfUnicode is a dup' of bUnicode so remove it and fix the few
  places where it was used.
- Remove a load of useless NULL infoPtr checks.
- Hardcode the default padding like native instead of using a wacky formula.
- Replace some tabs with spaces and remove NMHDR casts.
- Implement TBN_RESTORE notification.
- Don't fill in any more information than native does for notifications.
- Store hit code in a signed integer so that we can see whether it is
  less than zero.
- Draw with ILD_TRANSPARENT instead of ILD_NORMAL to draw bitmaps from
  the native shell image list properly (reported by Thorsten Kani).
- Rewrite TOOLBAR_NotifyFormat to avoid side-effects.
James Hawkins <truiken@gmail.com>
- Fixed a few memory leaks.
Zach Gorman <zach@archetypeauction.com>
- Add the DT_NOPREFIX flag when calling DrawText() for single-line
  listview controls.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Pass infoPtr around in month calendar control.
- Add support for WM_SETFONT and WM_GETFONT messages.
- Dimensions of month calendar control should not depend on the client
  window size.
- Convert NativeFont control to unicode, use hbrBackground as in native.
- Do not retrieve infoPtr twice in ToolbarWindowProc entry.
- do not move updown control and buddy if an alignment was not requested
- in UDM_SETACCEL handler do not forget to update number of accelerators
- update arrows info in WM_LBUTTONDOWN as well as in WM_MOUSEMOVE
- use accelerators in WM_LBUTTONDOWN handler
Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
- Monthcal_SetRange: Set proper value for min date.
Thorsten Kani <beebix@gmx.net>
- Use address of tab_item.extra when building drawitemstruct.
- Don't add extra OFFSET_X/Y to the calculation of rcBitmap.top/left,
  just use GetSystemMetrics.
Huw Davies <huw@codeweavers.com>
- The default font for the treeview should be the icon title font.

reactos/w32api/include
commctrl.h 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- commctrl.h	19 Sep 2004 09:11:12 -0000	1.8
+++ commctrl.h	5 Dec 2004 23:09:26 -0000	1.9
@@ -1992,6 +1992,17 @@
 	int iString;
 } TBBUTTON,*PTBBUTTON,*LPTBBUTTON;
 typedef const TBBUTTON *LPCTBBUTTON;
+typedef struct tagNMTBRESTORE
+{
+	NMHDR hdr;
+	DWORD* pData;
+	DWORD* pCurrent;
+	UINT cbData;
+	int iItem;
+	int cButtons;
+	int cbBytesPerRecord;
+	TBBUTTON tbButton;
+} NMTBRESTORE, *LPNMTBRESTORE;
 #if _WIN32_IE >= 0x400
 typedef struct {
 	UINT cbSize;
@@ -2045,11 +2056,6 @@
 	int cchText;
 	LPTSTR pszText;
 } TBNOTIFY,*LPTBNOTIFY;
-typedef struct {
-	HKEY hkr;
-	LPCTSTR pszSubKey;
-	LPCTSTR pszValueName;
-} TBSAVEPARAMS;
 typedef struct _IMAGEINFO {
 	HBITMAP hbmImage;
 	HBITMAP hbmMask;
@@ -2246,12 +2252,12 @@
 	HKEY hkr;
 	LPCSTR pszSubKey;
 	LPCSTR pszValueName;
-} TBSAVEPARAMSA;
+} TBSAVEPARAMSA, *LPTBSAVEPARAMSA;
 typedef struct tagTBSAVEPARAMSW {
 	HKEY hkr;
 	LPCWSTR pszSubKey;
 	LPCWSTR pszValueName;
-} TBSAVEPARAMSW;
+} TBSAVEPARAMSW, *LPTBSAVEPARAMSW, *LPTBSAVEPARAMW;
 typedef struct {
 	HINSTANCE hInstOld;
 	UINT nIDOld;

reactos/lib/comctl32
animate.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- animate.c	20 Oct 2004 08:36:54 -0000	1.7
+++ animate.c	5 Dec 2004 23:09:26 -0000	1.8
@@ -73,6 +73,7 @@
    CRITICAL_SECTION	cs;
    HANDLE		hStopEvent;
    HANDLE		hThread;
+   DWORD		threadId;
    UINT			uTimer;
    /* data for playing the file */
    int			nFromFrame;
@@ -149,14 +150,20 @@
         HANDLE handle = infoPtr->hThread;
 
         TRACE("stopping animation thread\n");
+        infoPtr->hThread = 0;
         SetEvent( infoPtr->hStopEvent );
-        LeaveCriticalSection(&infoPtr->cs);  /* leave it a chance to run */
-        WaitForSingleObject( handle, INFINITE );
-        TRACE("animation thread stopped\n");
-        EnterCriticalSection(&infoPtr->cs);
-        CloseHandle( infoPtr->hThread );
+
+        if (infoPtr->threadId != GetCurrentThreadId())
+        {
+            LeaveCriticalSection(&infoPtr->cs);  /* leave it a chance to run */
+            WaitForSingleObject( handle, INFINITE );
+            TRACE("animation thread stopped\n");
+            EnterCriticalSection(&infoPtr->cs);
+        }
+
+        CloseHandle( handle );
         CloseHandle( infoPtr->hStopEvent );
-        infoPtr->hThread = 0;
+        infoPtr->hStopEvent = 0;
     }
     if (infoPtr->uTimer) {
 	KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
@@ -399,7 +406,7 @@
         LeaveCriticalSection(&infoPtr->cs);
 
         /* time is in microseconds, we should convert it to milliseconds */
-        if (WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
+        if ((event == 0) || WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
             break;
     }
     return TRUE;
@@ -439,8 +446,6 @@
 	/* create a timer to display AVI */
 	infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
     } else {
-        DWORD threadID;
-
         if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
         {
             infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
@@ -449,7 +454,7 @@
 
 	TRACE("Using an animation thread\n");
         infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
-        infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &threadID);
+        infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId);
         if(!infoPtr->hThread)
         {
            ERR("Could not create animation thread!\n");
@@ -950,7 +955,7 @@
 
     ZeroMemory(&wndClass, sizeof(WNDCLASSA));
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS;
-    wndClass.lpfnWndProc   = (WNDPROC)ANIMATE_WindowProc;
+    wndClass.lpfnWndProc   = ANIMATE_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(ANIMATE_INFO *);
     wndClass.hCursor       = LoadCursorA(0, (LPSTR)IDC_ARROW);

reactos/lib/comctl32
comboex.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- comboex.c	20 Oct 2004 08:36:54 -0000	1.7
+++ comboex.c	5 Dec 2004 23:09:26 -0000	1.8
@@ -45,9 +45,9 @@
 WINE_DEFAULT_DEBUG_CHANNEL(comboex);
 
 /* Item structure */
-typedef struct
+typedef struct _CBE_ITEMDATA
 {
-    VOID         *next;
+    struct _CBE_ITEMDATA *next;
     UINT         mask;
     LPWSTR       pszText;
     LPWSTR       pszTemp;
@@ -126,10 +126,8 @@
 
 
 /* Things common to the entire DLL */
-static LRESULT WINAPI
-COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-static LRESULT WINAPI
-COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr);
 typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR);
 
@@ -458,7 +456,7 @@
 
     /* find the item in the list */
     while (item && (i > index)) {
-	item = (CBE_ITEMDATA *)item->next;
+	item = item->next;
 	i--;
     }
     if (!item || (i != index)) {
@@ -579,7 +577,7 @@
 	CBE_ITEMDATA *moving = infoPtr->items;
 
 	while ((i > index) && moving) {
-	    moving = (CBE_ITEMDATA *)moving->next;
+	    moving = moving->next;
 	    i--;
 	}
 	if (!moving) {
@@ -1252,7 +1250,7 @@
 
 	/* find the prior item in the list */
 	while (item->next && (i > dis->itemID)) {
-	    item = (CBE_ITEMDATA *)item->next;
+	    item = item->next;
 	    i--;
 	}
 	if (!item->next || (i != dis->itemID)) {
@@ -1260,7 +1258,7 @@
 	    return FALSE;
 	}
 	olditem = item->next;
-	item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;
+	item->next = item->next->next;
     }
     infoPtr->nb_items--;
 
@@ -1529,7 +1527,7 @@
 
 	item = infoPtr->items;
 	while (item) {
-	    next = (CBE_ITEMDATA *)item->next;
+	    next = item->next;
 	    COMBOEX_FreeText (item);
 	    Free (item);
 	    item = next;
@@ -1570,7 +1568,7 @@
     DWORD oldstyle, newstyle;
 
     oldstyle = (DWORD)GetWindowLongW (hwnd, GWL_STYLE);
-    newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL);
+    newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER);
     if (newstyle != oldstyle) {
 	TRACE("req style %08lx, reseting style %08lx\n",
 	      oldstyle, newstyle);
@@ -1912,7 +1910,8 @@
 	    rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf,
 			                          CB_GETITEMHEIGHT, -1, 0);
 	    rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL);
-	    POINTSTOPOINT(pt, MAKEPOINTS(lParam));
+	    pt.x = (short)LOWORD(lParam);
+	    pt.y = (short)HIWORD(lParam);
 	    if (PtInRect(&rect, pt))
 		return CallWindowProcW (infoPtr->prevComboWndProc,
 				        hwnd, uMsg, wParam, lParam);
@@ -2254,7 +2253,7 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSW));
     wndClass.style         = CS_GLOBALCLASS;
-    wndClass.lpfnWndProc   = (WNDPROC)COMBOEX_WindowProc;
+    wndClass.lpfnWndProc   = COMBOEX_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(COMBOEX_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);

reactos/lib/comctl32
datetime.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- datetime.c	5 Dec 2004 00:22:03 -0000	1.6
+++ datetime.c	5 Dec 2004 23:09:26 -0000	1.7
@@ -19,16 +19,31 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * NOTE
+ * 
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Oct. 20, 2004, by Dimitrie O. Paun.
+ * 
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features, or bugs, please note them below.
+ * 
  * TODO:
- *   - All messages.
- *   - All notifications.
- *
+ *    -- DTS_APPCANPARSE
+ *    -- DTS_SHORTDATECENTURYFORMAT
+ *    -- DTN_CLOSEUP
+ *    -- DTN_FORMAT
+ *    -- DTN_FORMATQUERY
+ *    -- DTN_USERSTRING
+ *    -- DTN_WMKEYDOWN
+ *    -- FORMATCALLBACK
  */
 
 #include <math.h>
 #include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <limits.h>
 
 #include "windef.h"
 #include "winbase.h"
@@ -38,32 +53,35 @@
 #include "commctrl.h"
 #include "comctl32.h"
 #include "wine/debug.h"
+#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(datetime);
 
 typedef struct
 {
-	HWND hMonthCal;
-	HWND hwndNotify;
-	HWND hUpdown;
-	SYSTEMTIME date;
-	BOOL dateValid;
-	HWND hwndCheckbut;
-	RECT rcClient; /* rect around the edge of the window */
-	RECT rcDraw; /* rect inside of the border */
-	RECT checkbox;  /* checkbox allowing the control to be enabled/disabled */
-	RECT calbutton; /* button that toggles the dropdown of the monthcal control */
-	BOOL bCalDepressed; /* TRUE = cal button is depressed */
-	int  select;
-	HFONT hFont;
-	int nrFieldsAllocated;
-	int nrFields;
-	int haveFocus;
-	int *fieldspec;
-	RECT *fieldRect;
-	int  *buflen;
-	char textbuf[256];
-        POINT monthcal_pos;
+    HWND hwndSelf;
+    HWND hMonthCal;
+    HWND hwndNotify;
+    HWND hUpdown;
+    DWORD dwStyle;
+    SYSTEMTIME date;
+    BOOL dateValid;
+    HWND hwndCheckbut;
+    RECT rcClient; /* rect around the edge of the window */
+    RECT rcDraw; /* rect inside of the border */
+    RECT checkbox;  /* checkbox allowing the control to be enabled/disabled */
+    RECT calbutton; /* button that toggles the dropdown of the monthcal control */
+    BOOL bCalDepressed; /* TRUE = cal button is depressed */
+    int  select;
+    HFONT hFont;
+    int nrFieldsAllocated;
+    int nrFields;
+    int haveFocus;
+    int *fieldspec;
+    RECT *fieldRect;
+    int  *buflen;
+    WCHAR textbuf[256];
+    POINT monthcal_pos;
 } DATETIME_INFO, *LPDATETIME_INFO;
 
 /* in monthcal.c */
@@ -110,1174 +128,812 @@
 #define DTHT_MCPOPUP  0x300     /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */
 #define DTHT_GOTFOCUS 0x400     /* tests for date-fields */
 
-#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongPtrW (hwnd, 0))
-
-static BOOL DATETIME_SendSimpleNotify (HWND hwnd, UINT code);
-static BOOL DATETIME_SendDateTimeChangeNotify (HWND hwnd);
+static BOOL DATETIME_SendSimpleNotify (DATETIME_INFO *infoPtr, UINT code);
+static BOOL DATETIME_SendDateTimeChangeNotify (DATETIME_INFO *infoPtr);
 extern void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to);
-static const char *allowedformatchars = {"dhHmMstyX'"};
+static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', '\'', 0};
 static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1,-1};
 
 
-static LRESULT
-DATETIME_GetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
+static DWORD
+DATETIME_GetSystemTime (DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray)
 {
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-  DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
-  SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *) lParam;
+    if (!lprgSysTimeArray) return GDT_NONE;
 
-  TRACE("%04x %08lx\n",wParam,lParam);
-  if (!lParam) return GDT_NONE;
-
-  if ((dwStyle & DTS_SHOWNONE) &&
-       (SendMessageA (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED))
+    if ((infoPtr->dwStyle & DTS_SHOWNONE) &&
+        (SendMessageW (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED))
         return GDT_NONE;
 
-  MONTHCAL_CopyTime (&infoPtr->date, lprgSysTimeArray);
-
-  return GDT_VALID;
-}
-
-
-static LRESULT
-DATETIME_SetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-  SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *) lParam;
-
-  TRACE("%p %04x %08lx\n",hwnd, wParam, lParam);
-  if (!lParam) return 0;
-
-  TRACE("%04d/%02d/%02d %02d:%02d:%02d\n",
-        lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
-        lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
-
-  if (wParam==GDT_VALID) {
-      infoPtr->dateValid = TRUE;
-      MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
-	SendMessageA(infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
-      SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
-  } else if (wParam==GDT_NONE) {
-      infoPtr->dateValid = FALSE;
-      SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, BST_UNCHECKED, 0);
-  }
-  InvalidateRect(hwnd, NULL, TRUE);
-  return 1;
-}
-
-
-static LRESULT
-DATETIME_GetRange (HWND hwnd, LPARAM lParam )
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-  LRESULT ret;
-
-  TRACE("%08lx\n", lParam);
-  ret =  SendMessageA (infoPtr->hMonthCal, MCM_GETRANGE, 0, lParam);
-  if (!ret) ret = 1; /* bug emulation... */
-  return ret;
-}
-
-static LRESULT
-DATETIME_SetRange (HWND hwnd, WPARAM wParam, LPARAM lParam )
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-
-  TRACE("%04x %08lx\n",wParam,lParam);
-
-  return SendMessageA (infoPtr->hMonthCal, MCM_SETRANGE, wParam, lParam);
-}
-
-static LRESULT
-DATETIME_GetMonthCalColor (HWND hwnd, WPARAM wParam)
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-
-  TRACE("%04x\n",wParam);
-  return SendMessageA (infoPtr->hMonthCal, MCM_GETCOLOR, wParam, 0);
-}
-
-
-static LRESULT
-DATETIME_SetMonthCalColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-
-  TRACE("%04x %08lx\n",wParam,lParam);
-  return SendMessageA (infoPtr->hMonthCal, MCM_SETCOLOR, wParam, lParam);
-}
-
-
-/* FIXME: need to get way to force font into monthcal structure */
-static LRESULT
-DATETIME_GetMonthCal (HWND hwnd)
-{
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
+    MONTHCAL_CopyTime (&infoPtr->date, lprgSysTimeArray);
 
-  TRACE("\n");
-  return (LRESULT)infoPtr->hMonthCal;
+    return GDT_VALID;
 }
 
 
-
-/* FIXME: need to get way to force font into monthcal structure */
-
-static LRESULT
-DATETIME_GetMonthCalFont (HWND hwnd)
+static BOOL
+DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysTimeArray)
 {
+    if (!lprgSysTimeArray) return 0;
 
-  TRACE("\n");
-  return 0;
-}
-
-
-static LRESULT
-DATETIME_SetMonthCalFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
+    TRACE("%04d/%02d/%02d %02d:%02d:%02d\n",
+          lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
+          lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
+
+    if (flag == GDT_VALID) {
+        infoPtr->dateValid = TRUE;
+        MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
+        SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
+        SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
+    } else if (flag == GDT_NONE) {
+        infoPtr->dateValid = FALSE;
+        SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_UNCHECKED, 0);
+    }
 
-  TRACE("%04x %08lx\n",wParam,lParam);
-  return 0;
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
+    return TRUE;
 }
 
 
-/*
-   Split up a formattxt in actions.
-   See ms documentation for the meaning of the letter codes/'specifiers'.
-
-   Notes:
-   *'dddddd' is handled as 'dddd' plus 'dd'.
-   *unrecognized formats are strings (here given the type DT_STRING;
-   start of the string is encoded in lower bits of DT_STRING.
-   Therefore, 'string' ends finally up as '<show seconds>tring'.
-
+/***
+ * Split up a formattxt in actions.
+ * See ms documentation for the meaning of the letter codes/'specifiers'.
+ *
+ * Notes:
+ * *'dddddd' is handled as 'dddd' plus 'dd'.
+ * *unrecognized formats are strings (here given the type DT_STRING;
+ * start of the string is encoded in lower bits of DT_STRING.
+ * Therefore, 'string' ends finally up as '<show seconds>tring'.
+ *
  */
-
-
 static void
-DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
+DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
 {
- unsigned int i;
- int j,k,len;
- int *nrFields=& infoPtr->nrFields;
-
- TRACE ("%s\n",formattxt);
-
-
- *nrFields=0;
- infoPtr->fieldspec[*nrFields]=0;
- len=strlen(allowedformatchars);
- k=0;
-
- for (i=0; formattxt[i]; i++)  {
-	TRACE ("\n%d %c:",i, formattxt[i]);
- 	for (j=0; j<len; j++) {
- 		if (allowedformatchars[j]==formattxt[i]) {
-			TRACE ("%c[%d,%x]",allowedformatchars[j], *nrFields,
-							 infoPtr->fieldspec[*nrFields]);
-			if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
-				infoPtr->fieldspec[*nrFields]=(j<<4) +1;
-				break;
-			}
-			if (infoPtr->fieldspec[*nrFields]>>4!=j) {
-				(*nrFields)++;
-				infoPtr->fieldspec[*nrFields]=(j<<4) +1;
-				break;
-			}
-			if ((infoPtr->fieldspec[*nrFields] & 0x0f)==maxrepetition[j]) {
-				(*nrFields)++;
-				infoPtr->fieldspec[*nrFields]=(j<<4) +1;
-				break;
-			}
-			infoPtr->fieldspec[*nrFields]++;
-			break;
-		}   /* if allowedformatchar */
-	 } /* for j */
-
-
-			/* char is not a specifier: handle char like a string */
-	if (j==len) {
+    unsigned int i;
+    int j, k, len;
+    int *nrFields = &infoPtr->nrFields;
+
+    *nrFields = 0;
+    infoPtr->fieldspec[*nrFields] = 0;
+    len = strlenW(allowedformatchars);
+    k = 0;
+
+    for (i = 0; formattxt[i]; i++)  {
+	TRACE ("\n%d %c:", i, formattxt[i]);
+ 	for (j = 0; j < len; j++) {
+ 	    if (allowedformatchars[j]==formattxt[i]) {
+		TRACE ("%c[%d,%x]", allowedformatchars[j], *nrFields, infoPtr->fieldspec[*nrFields]);
 		if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
-			infoPtr->fieldspec[*nrFields]=DT_STRING+k;
-			infoPtr->buflen[*nrFields]=0;
-        } else
-		if ((infoPtr->fieldspec[*nrFields] & DT_STRING)!=DT_STRING)  {
-			(*nrFields)++;
-			infoPtr->fieldspec[*nrFields]=DT_STRING+k;
-			infoPtr->buflen[*nrFields]=0;
+		    infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+		    break;
+		}
+		if (infoPtr->fieldspec[*nrFields] >> 4 != j) {
+		    (*nrFields)++;
+		    infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+		    break;
+		}
+		if ((infoPtr->fieldspec[*nrFields] & 0x0f) == maxrepetition[j]) {
+		    (*nrFields)++;
+		    infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+		    break;
 		}
-		infoPtr->textbuf[k]=formattxt[i];
-		k++;
-		infoPtr->buflen[*nrFields]++;
+		infoPtr->fieldspec[*nrFields]++;
+		break;
+	    }   /* if allowedformatchar */
+	} /* for j */
+
+	/* char is not a specifier: handle char like a string */
+	if (j == len) {
+	    if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
+		infoPtr->fieldspec[*nrFields] = DT_STRING + k;
+		infoPtr->buflen[*nrFields] = 0;
+            } else if ((infoPtr->fieldspec[*nrFields] & DT_STRING) != DT_STRING)  {
+		(*nrFields)++;
+		infoPtr->fieldspec[*nrFields] = DT_STRING + k;
+		infoPtr->buflen[*nrFields] = 0;
+	    }
+	    infoPtr->textbuf[k] = formattxt[i];
+	    k++;
+	    infoPtr->buflen[*nrFields]++;
 	}   /* if j=len */
 
-	if (*nrFields==infoPtr->nrFieldsAllocated) {
-		FIXME ("out of memory; should reallocate. crash ahead.\n");
+	if (*nrFields == infoPtr->nrFieldsAllocated) {
+	    FIXME ("out of memory; should reallocate. crash ahead.\n");
 	}
+    } /* for i */
 
-  } /* for i */
-
-  TRACE("\n");
+    TRACE("\n");
 
-  if (infoPtr->fieldspec[*nrFields]!=0) (*nrFields)++;
+    if (infoPtr->fieldspec[*nrFields] != 0) (*nrFields)++;
 }
 
 
-static LRESULT
-DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
+static BOOL
+DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat)
 {
- DATETIME_INFO *infoPtr= DATETIME_GetInfoPtr (hwnd);
- char format_buf[80];
- DWORD format_item;
-
- TRACE("%04x %08lx\n",wParam,lParam);
- if (!lParam) {
-  	DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
-
-	if (dwStyle & DTS_LONGDATEFORMAT)
-		format_item=LOCALE_SLONGDATE;
-	else if (dwStyle & DTS_TIMEFORMAT)
-		format_item=LOCALE_STIMEFORMAT;
+    if (!lpszFormat) {
+	WCHAR format_buf[80];
+	DWORD format_item;
+
+	if (infoPtr->dwStyle & DTS_LONGDATEFORMAT)
+	    format_item = LOCALE_SLONGDATE;
+	else if (infoPtr->dwStyle & DTS_TIMEFORMAT)
+	    format_item = LOCALE_STIMEFORMAT;
         else /* DTS_SHORTDATEFORMAT */
-		format_item=LOCALE_SSHORTDATE;
-	GetLocaleInfoA( GetSystemDefaultLCID(), format_item,format_buf,sizeof(format_buf));
-	DATETIME_UseFormat (infoPtr, format_buf);
- }
- else
- 	DATETIME_UseFormat (infoPtr, (char *) lParam);
+	    format_item = LOCALE_SSHORTDATE;
+	GetLocaleInfoW( GetSystemDefaultLCID(), format_item, format_buf, sizeof(format_buf)/sizeof(format_buf[0]));
+	lpszFormat = format_buf;
+    }
 
- return infoPtr->nrFields;
-}
+    DATETIME_UseFormat (infoPtr, lpszFormat);
 
+    return infoPtr->nrFields;
+}
 
-static LRESULT
-DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
+static BOOL
+DATETIME_SetFormatA (DATETIME_INFO *infoPtr, LPCSTR lpszFormat)
 {
- TRACE("%04x %08lx\n",wParam,lParam);
- if (lParam) {
-	LPSTR buf;
-	int retval;
-        int len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, NULL, 0, NULL, NULL );
-
- 	buf = (LPSTR) Alloc (len);
-        WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, buf, len, NULL, NULL );
-	retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf);
-	Free (buf);
+    if (lpszFormat) {
+	BOOL retval;
+	INT len = MultiByteToWideChar(CP_ACP, 0, lpszFormat, -1, NULL, 0);
+	LPWSTR wstr = Alloc(len * sizeof(WCHAR));
+	if (wstr) MultiByteToWideChar(CP_ACP, 0, lpszFormat, -1, wstr, len);
+	retval = DATETIME_SetFormatW (infoPtr, wstr);
+	Free (wstr);
 	return retval;
- }
- else
-	return DATETIME_SetFormat (hwnd, 0, 0);
+    }
+    else
+	return DATETIME_SetFormatW (infoPtr, 0);
 
 }
 
 
 static void
-DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result, int resultSize)
+DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
 {
- SYSTEMTIME date = infoPtr->date;
- int spec;
- char buffer[80];
-
- *result=0;
- TRACE ("%d,%d\n", infoPtr->nrFields, count);
- if ((count>infoPtr->nrFields) || (count<0)) {
+    static const WCHAR fmt_dW[] = { '%', 'd', 0 };
+    static const WCHAR fmt__2dW[] = { '%', '.', '2', 'd', 0 };
+    static const WCHAR fmt__3sW[] = { '%', '.', '3', 's', 0 };
+    SYSTEMTIME date = infoPtr->date;
+    int spec;
+    WCHAR buffer[80];
+
+    *result=0;
+    TRACE ("%d,%d\n", infoPtr->nrFields, count);
+    if (count>infoPtr->nrFields || count < 0) {
 	WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);
 	return;
- }
+    }
 
- if (!infoPtr->fieldspec) return;
+    if (!infoPtr->fieldspec) return;
 
- spec=infoPtr->fieldspec[count];
- if (spec & DT_STRING) {
-	int txtlen=infoPtr->buflen[count];
+    spec = infoPtr->fieldspec[count];
+    if (spec & DT_STRING) {
+	int txtlen = infoPtr->buflen[count];
 
         if (txtlen > resultSize)
             txtlen = resultSize - 1;
-	memcpy (result, infoPtr->textbuf + (spec &~ DT_STRING), txtlen);
-	result[txtlen]=0;
-	TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result);
+	memcpy (result, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR));
+	result[txtlen] = 0;
+	TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result));
 	return;
- }
+    }
 
 
- switch (spec) {
+    switch (spec) {
 	case DT_END_FORMAT:
-		*result=0;
-		break;
+	    *result = 0;
+	    break;
 	case ONEDIGITDAY:
-		sprintf (result,"%d",date.wDay);
-	 	break;
+	    wsprintfW (result, fmt_dW, date.wDay);
+	    break;
 	case TWODIGITDAY:
-		sprintf (result,"%.2d",date.wDay);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wDay);
+	    break;
 	case THREECHARDAY:
-	        GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7,
-				result,4);
-		/*sprintf (result,"%.3s",days[date.wDayOfWeek]);*/
-		break;
+	    GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7, result, 4);
+	    /*wsprintfW (result,"%.3s",days[date.wDayOfWeek]);*/
+	    break;
 	case FULLDAY:
-	        GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SDAYNAME1+ (date.wDayOfWeek+6)%7,
-                               result, resultSize);
-		break;
+	    GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDAYNAME1+(date.wDayOfWeek+6)%7, result, resultSize);
+	    break;
 	case ONEDIGIT12HOUR:
-		if (date.wHour>12)
-			sprintf (result,"%d",date.wHour-12);
-		else
-			sprintf (result,"%d",date.wHour);
-		break;
+	    wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0));
+	    break;
 	case TWODIGIT12HOUR:
-		if (date.wHour>12)
-			sprintf (result,"%.2d",date.wHour-12);
-		else
-			sprintf (result,"%.2d",date.wHour);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0));
+	    break;
 	case ONEDIGIT24HOUR:
-		sprintf (result,"%d",date.wHour);
-		break;
+	    wsprintfW (result, fmt_dW, date.wHour);
+	    break;
 	case TWODIGIT24HOUR:
-		sprintf (result,"%.2d",date.wHour);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wHour);
+	    break;
 	case ONEDIGITSECOND:
-		sprintf (result,"%d",date.wSecond);
-		break;
+	    wsprintfW (result, fmt_dW, date.wSecond);
+	    break;
 	case TWODIGITSECOND:
-		sprintf (result,"%.2d",date.wSecond);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wSecond);
+	    break;
 	case ONEDIGITMINUTE:
-		sprintf (result,"%d",date.wMinute);
-		break;
+	    wsprintfW (result, fmt_dW, date.wMinute);
+	    break;
 	case TWODIGITMINUTE:
-		sprintf (result,"%.2d",date.wMinute);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wMinute);
+	    break;
 	case ONEDIGITMONTH:
-		sprintf (result,"%d",date.wMonth);
-	 	break;
+	    wsprintfW (result, fmt_dW, date.wMonth);
+	    break;
 	case TWODIGITMONTH:
-		sprintf (result,"%.2d",date.wMonth);
-		break;
+	    wsprintfW (result, fmt__2dW, date.wMonth);
+	    break;
 	case THREECHARMONTH:
-		GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,
-                               buffer,sizeof(buffer));
-		sprintf (result,"%.3s",buffer);
-		break;
+	    GetLocaleInfoW(GetSystemDefaultLCID(), LOCALE_SMONTHNAME1+date.wMonth -1, 
+			   buffer, sizeof(buffer)/sizeof(buffer[0]));
+	    wsprintfW (result, fmt__3sW, buffer);
+	    break;
 	case FULLMONTH:
-		GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,
-                               result, resultSize);
-		break;
+	    GetLocaleInfoW(GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,
+                           result, resultSize);
+	    break;
 	case ONELETTERAMPM:
-		if (date.wHour<12)
-			strcpy (result,"A");
-		else
-			strcpy (result,"P");
-		break;
+	    result[0] = (date.wHour < 12 ? 'A' : 'P');
+	    result[1] = 0;
+	    break;
 	case TWOLETTERAMPM:
-		if (date.wHour<12)
-			strcpy (result,"AM");
-		else
-			strcpy (result,"PM");
-		break;
+	    result[0] = (date.wHour < 12 ? 'A' : 'P');
+	    result[1] = 'M';
+	    result[2] = 0;
+	    break;
 	case FORMATCALLBACK:
-		FIXME ("Not implemented\n");
-		strcpy (result,"xxx");
-		break;
+	    FIXME ("Not implemented\n");
+	    result[0] = 'x';
+	    result[1] = 0;
+	    break;
 	case ONEDIGITYEAR:
-		sprintf (result,"%d",date.wYear-10* (int) floor(date.wYear/10));
-	 	break;
+	    wsprintfW (result, fmt_dW, date.wYear-10* (int) floor(date.wYear/10));
+	    break;
 	case TWODIGITYEAR:
-		sprintf (result,"%.2d",date.wYear-100* (int) floor(date.wYear/100));
-		break;
+	    wsprintfW (result, fmt__2dW, date.wYear-100* (int) floor(date.wYear/100));
+	    break;
         case INVALIDFULLYEAR:
 	case FULLYEAR:
-		sprintf (result,"%d",date.wYear);
-		break;
+	    wsprintfW (result, fmt_dW, date.wYear);
+	    break;
     }
 
-	TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result);
+    TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result));
 }
 
-
-static void
-DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number)
+static int wrap(int val, int delta, int minVal, int maxVal)
 {
- SYSTEMTIME *date = &infoPtr->date;
- int spec;
-
- TRACE ("%d\n",number);
- if ((number>infoPtr->nrFields) || (number<0)) return;
-
- spec=infoPtr->fieldspec[number];
- if ((spec & DTHT_DATEFIELD)==0) return;
-
- switch (spec) {
-	case ONEDIGITDAY:
-	case TWODIGITDAY:
-	case THREECHARDAY:
-	case FULLDAY:
-		date->wDay++;
-		if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
-		  date->wDay=1;
-		break;
-	case ONEDIGIT12HOUR:
-	case TWODIGIT12HOUR:
-	case ONEDIGIT24HOUR:
-	case TWODIGIT24HOUR:
-		date->wHour++;
-		if (date->wHour>23) date->wHour=0;
-		break;
-	case ONEDIGITSECOND:
-	case TWODIGITSECOND:
-		date->wSecond++;
-		if (date->wSecond>59) date->wSecond=0;
-		break;
-	case ONEDIGITMINUTE:
-	case TWODIGITMINUTE:
-		date->wMinute++;
-		if (date->wMinute>59) date->wMinute=0;
-		break;
-	case ONEDIGITMONTH:
-	case TWODIGITMONTH:
-	case THREECHARMONTH:
-	case FULLMONTH:
-		date->wMonth++;
-		if (date->wMonth>12) date->wMonth=1;
-		if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
-			date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
-		break;
-	case ONELETTERAMPM:
-	case TWOLETTERAMPM:
-		date->wHour+=12;
-		if (date->wHour>23) date->wHour-=24;
-		break;
-	case FORMATCALLBACK:
-		FIXME ("Not implemented\n");
-		break;
-	case ONEDIGITYEAR:
-	case TWODIGITYEAR:
-	case FULLYEAR:
-		date->wYear++;
-		break;
-	}
-
+    val += delta;
+    if (delta == INT_MIN || val < minVal) return maxVal;
+    if (delta == INT_MAX || val > maxVal) return minVal;
+    return val;
 }
 
-
 static void
-DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number)
+DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
 {
- SYSTEMTIME *date = & infoPtr->date;
- int spec;
+    SYSTEMTIME *date = &infoPtr->date;
 
- TRACE ("%d\n",number);
- if ((number>infoPtr->nrFields) || (number<0)) return;
+    TRACE ("%d\n", number);
+    if ((number > infoPtr->nrFields) || (number < 0)) return;
 
- spec = infoPtr->fieldspec[number];
- if ((spec & DTHT_DATEFIELD)==0) return;
+    if ((infoPtr->fieldspec[number] & DTHT_DATEFIELD) == 0) return;
 
- TRACE ("%x\n",spec);
-
- switch (spec) {
-	case ONEDIGITDAY:
-	case TWODIGITDAY:
-	case THREECHARDAY:
-	case FULLDAY:
-		date->wDay--;
-		if (date->wDay<1)
-		  date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
-		break;
-	case ONEDIGIT12HOUR:
-	case TWODIGIT12HOUR:
-	case ONEDIGIT24HOUR:
-	case TWODIGIT24HOUR:
-		if (date->wHour)
-			date->wHour--;
-		else
-			date->wHour=23;
-		break;
-	case ONEDIGITSECOND:
-	case TWODIGITSECOND:
-		if (date->wHour)
-			date->wSecond--;
-		else
-			date->wHour=59;
-		break;
-	case ONEDIGITMINUTE:
-	case TWODIGITMINUTE:
-		if (date->wMinute)
-			date->wMinute--;
-		else
-			date->wMinute=59;
-		break;
-	case ONEDIGITMONTH:
-	case TWODIGITMONTH:
-	case THREECHARMONTH:
-	case FULLMONTH:
-		if (date->wMonth>1)
-			date->wMonth--;
-		else
-			date->wMonth=12;
-		if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
-			date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
-		break;
-	case ONELETTERAMPM:
-	case TWOLETTERAMPM:
-		if (date->wHour<12)
-			date->wHour+=12;
-		else
-			date->wHour-=12;
-		break;
-	case FORMATCALLBACK:
-		FIXME ("Not implemented\n");
-		break;
+    switch (infoPtr->fieldspec[number]) {
 	case ONEDIGITYEAR:
 	case TWODIGITYEAR:
 	case FULLYEAR:
-		date->wYear--;
-		break;
-	}
-
-}
-
-
-static void
-DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number)
-{
- SYSTEMTIME *date = &infoPtr->date;
- int spec;
-
- TRACE ("%d\n",number);
- if ((number>infoPtr->nrFields) || (number<0)) return;
-
- spec = infoPtr->fieldspec[number];
- if ((spec & DTHT_DATEFIELD)==0) return;
-
-
- switch (spec) {
-	case ONEDIGITDAY:
-	case TWODIGITDAY:
-	case THREECHARDAY:
-	case FULLDAY:
-		date->wDay = 1;
-		break;
-	case ONEDIGIT12HOUR:
-	case TWODIGIT12HOUR:
-	case ONEDIGIT24HOUR:
-	case TWODIGIT24HOUR:
-	case ONELETTERAMPM:
-	case TWOLETTERAMPM:
-		date->wHour = 0;
-		break;
-	case ONEDIGITSECOND:
-	case TWODIGITSECOND:
-		date->wSecond = 0;
-		break;
-	case ONEDIGITMINUTE:
-	case TWODIGITMINUTE:
-		date->wMinute = 0;
-		break;
+	    date->wYear = wrap(date->wYear, delta, 1752, 9999);
+	    break;
 	case ONEDIGITMONTH:
 	case TWODIGITMONTH:
 	case THREECHARMONTH:
 	case FULLMONTH:
-		date->wMonth = 1;
-	case FORMATCALLBACK:
-		FIXME ("Not implemented\n");
-		break;
-	case ONEDIGITYEAR:
-	case TWODIGITYEAR:
-        /* FYI: On 1752/9/14 the calendar changed and England and the
-         * American colonies changed to the Gregorian calendar. This change
-         * involved having September 14th follow September 2nd. So no date
-         * algorithm works before that date.
-         */
-	case FULLYEAR:
-		date->wSecond = 0;
-		date->wMinute = 0;
-		date->wHour = 0;
-		date->wDay = 14;		/* overactive ms-programmers..*/
-		date->wMonth = 9;
-		date->wYear = 1752;
-		break;
-	}
-
-}
-
-
-static void
-DATETIME_ResetFieldUp (DATETIME_INFO *infoPtr, int number)
-{
- SYSTEMTIME *date = & infoPtr->date;
- int spec;
-
- TRACE("%d \n",number);
- if ((number>infoPtr->nrFields) || (number<0)) return;
-
- spec=infoPtr->fieldspec[number];
- if ((spec & DTHT_DATEFIELD)==0) return;
-
- switch (spec) {
+	    date->wMonth = wrap(date->wMonth, delta, 1, 12);
+	    delta = 0;
+	    /* fall through */
 	case ONEDIGITDAY:
 	case TWODIGITDAY:
 	case THREECHARDAY:
 	case FULLDAY:
-		date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
-		break;
+	    date->wDay = wrap(date->wDay, delta, 1, MONTHCAL_MonthLength(date->wMonth, date->wYear));
+	    break;
+	case ONELETTERAMPM:
+	case TWOLETTERAMPM:
+	    delta *= 12;
+	    /* fall through */
 	case ONEDIGIT12HOUR:
 	case TWODIGIT12HOUR:
 	case ONEDIGIT24HOUR:
 	case TWODIGIT24HOUR:
-	case ONELETTERAMPM:
-	case TWOLETTERAMPM:
-		date->wHour=23;
-		break;
-	case ONEDIGITSECOND:
-	case TWODIGITSECOND:
-		date->wSecond=59;
-		break;
+	    date->wHour = wrap(date->wHour, delta, 0, 23);
+	    break;
 	case ONEDIGITMINUTE:
 	case TWODIGITMINUTE:
-		date->wMinute=59;
-		break;
-	case ONEDIGITMONTH:
-	case TWODIGITMONTH:
-	case THREECHARMONTH:
-	case FULLMONTH:
-		date->wMonth=12;
+	    date->wMinute = wrap(date->wMinute, delta, 0, 59);
+	    break;
+	case ONEDIGITSECOND:
+	case TWODIGITSECOND:
+	    date->wSecond = wrap(date->wSecond, delta, 0, 59);
+	    break;
 	case FORMATCALLBACK:
-		FIXME ("Not implemented\n");
-		break;
-	case ONEDIGITYEAR:
-	case TWODIGITYEAR:
-	case FULLYEAR:
-		date->wYear=9999;    /* Y10K problem? naaah. */
-		break;
-	}
+	    FIXME ("Not implemented\n");
+	    break;
+    }
 
+    /* FYI: On 1752/9/14 the calendar changed and England and the
+     * American colonies changed to the Gregorian calendar. This change
+     * involved having September 14th follow September 2nd. So no date
+     * algorithm works before that date.
+     */
+    if (10000 * date->wYear + 100 * date->wMonth + date->wDay < 17520914) {
+	date->wYear = 1752;
+    	date->wMonth = 9;
+	date->wDay = 14;
+	date->wSecond = 0;
+	date->wMinute = 0;
+	date->wHour = 0;
+    }
 }
 
 
-static void DATETIME_Refresh (HWND hwnd, HDC hdc)
-
+static void 
+DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
 {
-  DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
-  int i,prevright;
-  RECT *field;
-  DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
-  RECT *rcDraw = &infoPtr->rcDraw;
-  RECT *rcClient = &infoPtr->rcClient;
-  RECT *calbutton = &infoPtr->calbutton;
-  RECT *checkbox = &infoPtr->checkbox;
-  HBRUSH hbr;
-  SIZE size;
-  COLORREF oldBk, oldTextColor;
[truncated at 1000 lines; 985 more skipped]

reactos/lib/comctl32
flatsb.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- flatsb.c	19 Sep 2004 09:50:06 -0000	1.7
+++ flatsb.c	5 Dec 2004 23:09:26 -0000	1.8
@@ -274,7 +274,7 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     wndClass.style         = CS_GLOBALCLASS;
-    wndClass.lpfnWndProc   = (WNDPROC)FlatSB_WindowProc;
+    wndClass.lpfnWndProc   = FlatSB_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(FLATSB_INFO *);
     wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);

reactos/lib/comctl32
header.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- header.c	19 Sep 2004 09:50:06 -0000	1.6
+++ header.c	5 Dec 2004 23:09:26 -0000	1.7
@@ -1842,7 +1842,7 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS;
-    wndClass.lpfnWndProc   = (WNDPROC)HEADER_WindowProc;
+    wndClass.lpfnWndProc   = HEADER_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(HEADER_INFO *);
     wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);

reactos/lib/comctl32
hotkey.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- hotkey.c	20 Oct 2004 08:36:55 -0000	1.5
+++ hotkey.c	5 Dec 2004 23:09:26 -0000	1.6
@@ -57,10 +57,8 @@
     WCHAR strNone[15]; /* hope its long enough ... */
 } HOTKEY_INFO;
 
-#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongPtrA (hwnd, 0))
-
 static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' };
-static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
+static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw);
 
 #define IsOnlySet(flags) (infoPtr->CurrMod == (flags))
 
@@ -94,7 +92,7 @@
 #undef IsOnlySet
 
 static void
-HOTKEY_DrawHotKey(HOTKEY_INFO *infoPtr, LPCWSTR KeyName, WORD NameLen, HDC hdc)
+HOTKEY_DrawHotKey(HOTKEY_INFO *infoPtr, HDC hdc, LPCWSTR KeyName, WORD NameLen)
 {
     SIZE TextSize;
     INT nXStart, nYStart;
@@ -142,7 +140,7 @@
     TRACE("(infoPtr=%p hdc=%p)\n", infoPtr, hdc);
 
     if(!infoPtr->CurrMod && !infoPtr->HotKey) {
-	HOTKEY_DrawHotKey (infoPtr, infoPtr->strNone, 4, hdc);
+	HOTKEY_DrawHotKey (infoPtr, hdc, infoPtr->strNone, 4);
 	return;
     }
 	
@@ -182,7 +180,7 @@
     else
 	KeyName[NameLen] = 0;
 
-    HOTKEY_DrawHotKey (infoPtr, KeyName, NameLen, hdc);
+    HOTKEY_DrawHotKey (infoPtr, hdc, KeyName, NameLen);
 }
 
 static void
@@ -207,39 +205,39 @@
 }
 
 static void
-HOTKEY_SetHotKey(HOTKEY_INFO *infoPtr, WPARAM wParam)
+HOTKEY_SetHotKey(HOTKEY_INFO *infoPtr, WORD hotKey)
 {
-    infoPtr->HotKey = (WORD)wParam;
+    infoPtr->HotKey = hotKey;
     infoPtr->ScanCode = 
         MAKELPARAM(0, MapVirtualKeyW(LOBYTE(infoPtr->HotKey), 0));
-    TRACE("(infoPtr=%p wParam=%x) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr,
-          wParam, HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
+    TRACE("(infoPtr=%p hotKey=%x) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr,
+          hotKey, HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
     InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 }
 
 static void 
-HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WORD invComb, WORD invMod)
 {
-    infoPtr->InvComb = (WORD)wParam;
-    infoPtr->InvMod = (WORD)lParam;
+    infoPtr->InvComb = invComb;
+    infoPtr->InvMod = invMod;
     TRACE("(infoPtr=%p) Invalid Modifers: 0x%x, If Invalid: 0x%x\n", infoPtr,
           infoPtr->InvComb, infoPtr->InvMod);
 }
 
 
 static LRESULT
-HOTKEY_Create (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_Create (HOTKEY_INFO *infoPtr, LPCREATESTRUCTW lpcs)
 {
-    infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
+    infoPtr->hwndNotify = lpcs->hwndParent;
 
-    HOTKEY_SetFont(infoPtr, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
+    HOTKEY_SetFont(infoPtr, GetStockObject(SYSTEM_FONT), 0);
 
     return 0;
 }
 
 
 static LRESULT
-HOTKEY_Destroy (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
 {
     HWND hwnd = infoPtr->hwndSelf;
     /* free hotkey info data */
@@ -250,7 +248,7 @@
 
 
 static LRESULT
-HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, HDC hdc)
 {
     HBRUSH hBrush, hSolidBrush = NULL;
     RECT   rc;
@@ -260,14 +258,14 @@
     else
     {
         hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT,
-            wParam, (LPARAM)infoPtr->hwndSelf);
+                                      (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
         if (!hBrush)
             hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow);
     }
 
     GetClientRect (infoPtr->hwndSelf, &rc);
 
-    FillRect ((HDC)wParam, &rc, hBrush);
+    FillRect (hdc, &rc, hBrush);
 
     if (hSolidBrush)
         DeleteObject(hSolidBrush);
@@ -277,13 +275,13 @@
 
 
 inline static LRESULT
-HOTKEY_GetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_GetFont (HOTKEY_INFO *infoPtr)
 {
     return (LRESULT)infoPtr->hFont;
 }
 
 static LRESULT
-HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
 {
     WORD wOldHotKey;
     BYTE bOldMod;
@@ -291,7 +289,7 @@
     if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED)
         return 0;
 
-    TRACE("() Key: %d\n", wParam);
+    TRACE("() Key: %ld\n", key);
 
     wOldHotKey = infoPtr->HotKey;
     bOldMod = infoPtr->CurrMod;
@@ -299,7 +297,7 @@
     /* If any key is Pressed, we have to reset the hotkey in the control */
     infoPtr->HotKey = 0;
 
-    switch (wParam)
+    switch (key)
     {
 	case VK_RETURN:
 	case VK_TAB:
@@ -308,8 +306,7 @@
 	case VK_ESCAPE:
 	case VK_BACK:
 	    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
-	    return DefWindowProcW (infoPtr->hwndSelf, WM_KEYDOWN, wParam, 
-	                           lParam);
+	    return DefWindowProcW (infoPtr->hwndSelf, WM_KEYDOWN, key, flags);
 
 	case VK_SHIFT:
 	    infoPtr->CurrMod |= HOTKEYF_SHIFT;
@@ -323,10 +320,10 @@
 
 	default:
 	    if(HOTKEY_IsCombInv(infoPtr))
-	        infoPtr->HotKey = MAKEWORD(wParam, infoPtr->InvMod);
+	        infoPtr->HotKey = MAKEWORD(key, infoPtr->InvMod);
 	    else
-	        infoPtr->HotKey = MAKEWORD(wParam, infoPtr->CurrMod);
-	    infoPtr->ScanCode = lParam;
+	        infoPtr->HotKey = MAKEWORD(key, infoPtr->CurrMod);
+	    infoPtr->ScanCode = flags;
 	    break;
     }
 
@@ -345,18 +342,18 @@
 
 
 static LRESULT
-HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
 {
     BYTE bOldMod;
 
     if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED)
         return 0;
 
-    TRACE("() Key: %d\n", wParam);
+    TRACE("() Key: %ld\n", key);
 
     bOldMod = infoPtr->CurrMod;
 
-    switch (wParam)
+    switch (key)
     {
 	case VK_SHIFT:
 	    infoPtr->CurrMod &= ~HOTKEYF_SHIFT;
@@ -386,7 +383,7 @@
 
 
 static LRESULT
-HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, HWND receiveFocus)
 {
     infoPtr->bFocus = FALSE;
     DestroyCaret ();
@@ -396,7 +393,7 @@
 
 
 static LRESULT
-HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr)
 {
     if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED))
         SetFocus (infoPtr->hwndSelf);
@@ -406,7 +403,7 @@
 
 
 inline static LRESULT
-HOTKEY_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
+HOTKEY_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
 {
     HOTKEY_INFO *infoPtr;
     DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
@@ -423,11 +420,11 @@
     infoPtr->hwndSelf = hwnd;
     LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15);
 
-    return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, wParam, lParam);
+    return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, 0, (LPARAM)lpcs);
 }
 
 static LRESULT
-HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, HWND lostFocus)
 {
     infoPtr->bFocus = TRUE;
 
@@ -440,13 +437,13 @@
 
 
 static LRESULT
-HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw)
 {
     TEXTMETRICW tm;
     HDC hdc;
     HFONT hOldFont = 0;
 
-    infoPtr->hFont = (HFONT)wParam;
+    infoPtr->hFont = hFont;
 
     hdc = GetDC (infoPtr->hwndSelf);
     if (infoPtr->hFont)
@@ -459,7 +456,7 @@
 	SelectObject (hdc, hOldFont);
     ReleaseDC (infoPtr->hwndSelf, hdc);
 
-    if (LOWORD(lParam))
+    if (redraw)
 	InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
 
     return 0;
@@ -468,7 +465,7 @@
 static LRESULT WINAPI
 HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
+    HOTKEY_INFO *infoPtr = (HOTKEY_INFO *)GetWindowLongPtrW (hwnd, 0);
     TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam);
     if (!infoPtr && (uMsg != WM_NCCREATE))
         return DefWindowProcW (hwnd, uMsg, wParam, lParam);
@@ -477,10 +474,10 @@
 	case HKM_GETHOTKEY:
 	    return HOTKEY_GetHotKey (infoPtr);
 	case HKM_SETHOTKEY:
-	    HOTKEY_SetHotKey (infoPtr, wParam);
+	    HOTKEY_SetHotKey (infoPtr, (WORD)wParam);
 	    break;
 	case HKM_SETRULES:
-            HOTKEY_SetRules (infoPtr, wParam, lParam);
+            HOTKEY_SetRules (infoPtr, (WORD)wParam, (WORD)lParam);
 	    break;
 
 	case WM_CHAR:
@@ -488,19 +485,19 @@
 	    return HOTKEY_KeyDown (infoPtr, MapVirtualKeyW(LOBYTE(HIWORD(lParam)), 1), lParam);
 
 	case WM_CREATE:
-	    return HOTKEY_Create (infoPtr, wParam, lParam);
+	    return HOTKEY_Create (infoPtr, (LPCREATESTRUCTW)lParam);
 
 	case WM_DESTROY:
-	    return HOTKEY_Destroy (infoPtr, wParam, lParam);
+	    return HOTKEY_Destroy (infoPtr);
 
 	case WM_ERASEBKGND:
-	    return HOTKEY_EraseBackground (infoPtr, wParam, lParam);
+	    return HOTKEY_EraseBackground (infoPtr, (HDC)wParam);
 
 	case WM_GETDLGCODE:
 	    return DLGC_WANTCHARS | DLGC_WANTARROWS;
 
 	case WM_GETFONT:
-	    return HOTKEY_GetFont (infoPtr, wParam, lParam);
+	    return HOTKEY_GetFont (infoPtr);
 
 	case WM_KEYDOWN:
 	case WM_SYSKEYDOWN:
@@ -511,23 +508,23 @@
 	    return HOTKEY_KeyUp (infoPtr, wParam, lParam);
 
 	case WM_KILLFOCUS:
-	    return HOTKEY_KillFocus (infoPtr, wParam, lParam);
+	    return HOTKEY_KillFocus (infoPtr, (HWND)wParam);
 
 	case WM_LBUTTONDOWN:
-	    return HOTKEY_LButtonDown (infoPtr, wParam, lParam);
+	    return HOTKEY_LButtonDown (infoPtr);
 
 	case WM_NCCREATE:
-	    return HOTKEY_NCCreate (hwnd, wParam, lParam);
+	    return HOTKEY_NCCreate (hwnd, (LPCREATESTRUCTW)lParam);
 
 	case WM_PAINT:
 	    HOTKEY_Paint(infoPtr, (HDC)wParam);
 	    return 0;
 
 	case WM_SETFOCUS:
-	    return HOTKEY_SetFocus (infoPtr, wParam, lParam);
+	    return HOTKEY_SetFocus (infoPtr, (HWND)wParam);
 
 	case WM_SETFONT:
-	    return HOTKEY_SetFont (infoPtr, wParam, lParam);
+	    return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
 
 	default:
 	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))

reactos/lib/comctl32
imagelist.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- imagelist.c	20 Oct 2004 08:36:55 -0000	1.15
+++ imagelist.c	5 Dec 2004 23:09:26 -0000	1.16
@@ -2731,6 +2731,7 @@
     failed:
     ReleaseDC(0, xdc);
     LocalFree((HLOCAL)lpBitsOrg);
+    LocalFree((HLOCAL)data);
 
     return result;
 }

reactos/lib/comctl32
ipaddress.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- ipaddress.c	19 Sep 2004 09:50:06 -0000	1.6
+++ ipaddress.c	5 Dec 2004 23:09:27 -0000	1.7
@@ -65,15 +65,14 @@
     IPPART_INFO	Part[4];
 } IPADDRESS_INFO;
 
+static const WCHAR IP_SUBCLASS_PROP[] = 
+    { 'C', 'C', 'I', 'P', '3', '2', 'S', 'u', 'b', 'c', 'l', 'a', 's', 's', 'I', 'n', 'f', 'o', 0 };
+
 #define POS_DEFAULT	0
 #define POS_LEFT	1
 #define POS_RIGHT	2
 #define POS_SELALL	3
 
-#define IP_SUBCLASS_PROP "CCIP32SubclassInfo"
-#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0))
-
-
 static LRESULT CALLBACK
 IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
@@ -125,6 +124,7 @@
 
 static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
 {
+    static const WCHAR dotW[] = { '.', 0 };
     RECT rect, rcPart;
     POINT pt;
     int i;
@@ -143,7 +143,7 @@
 	pt.x = rcPart.left;
 	ScreenToClient(infoPtr->Self, &pt);
 	rect.right = pt.x;
-	DrawTextA(hdc, ".", 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
+	DrawTextW(hdc, dotW, 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
     }
 
     return 0;
@@ -152,10 +152,10 @@
 
 static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
 {
+    static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
     IPADDRESS_INFO *infoPtr;
     RECT rcClient, edit;
     int i, fieldsize;
-    static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
 
     TRACE("\n");
 
@@ -188,7 +188,7 @@
                                edit.left, edit.top, edit.right - edit.left,
 			       edit.bottom - edit.top, hwnd, (HMENU) 1,
 			       (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
-	SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
+	SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
         part->OrigProc = (WNDPROC)
 		SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC,
 				(DWORD_PTR)IPADDRESS_SubclassProc);
@@ -419,8 +419,8 @@
 LRESULT CALLBACK
 IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    HWND Self = (HWND)GetPropA (hwnd, IP_SUBCLASS_PROP);
-    IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (Self);
+    HWND Self = (HWND)GetPropW (hwnd, IP_SUBCLASS_PROP);
+    IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (Self, 0);
     CHAR c = (CHAR)wParam;
     INT index, len = 0, startsel, endsel;
     IPPART_INFO *part;
@@ -502,7 +502,7 @@
 static LRESULT WINAPI
 IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
+    IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0);
 
     TRACE("(hwnd=%p msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam);
 

reactos/lib/comctl32
listview.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- listview.c	19 Sep 2004 09:50:06 -0000	1.15
+++ listview.c	5 Dec 2004 23:09:27 -0000	1.16
@@ -348,7 +348,7 @@
 /* Standard DrawText flags */
 #define LV_ML_DT_FLAGS  (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
 #define LV_FL_DT_FLAGS  (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_NOCLIP)
-#define LV_SL_DT_FLAGS  (DT_VCENTER | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
+#define LV_SL_DT_FLAGS  (DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
 
 /* The time in milliseconds to reset the search in the list */
 #define KEY_DELAY       450
@@ -819,10 +819,8 @@
 }
 
 /*
-  With testing on Windows 2000 it looks like the notify format
-  has nothing to do with this message. It ALWAYS seems to be
-  in ansi format.
-
+  Send notification. depends on dispinfoW having same
+  structure as dispinfoA.
   infoPtr : listview struct
   notificationCode : *Unicode* notification code
   pdi : dispinfo structure (can be unicode or ansi)
@@ -831,32 +829,40 @@
 static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW)
 {
     BOOL bResult = FALSE;
-    BOOL convertToAnsi = FALSE;
-    INT cchTempBufMax = 0, savCchTextMax = 0;
+    BOOL convertToAnsi = FALSE, convertToUnicode = FALSE;
+    INT cchTempBufMax = 0, savCchTextMax = 0, realNotifCode;
     LPWSTR pszTempBuf = NULL, savPszText = NULL;
 
     if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW))
-	    convertToAnsi = isW;
+    {
+	convertToAnsi = (isW && infoPtr->notifyFormat == NFR_ANSI);
+	convertToUnicode = (!isW && infoPtr->notifyFormat == NFR_UNICODE);
+    }
 
-    if (convertToAnsi)
+    if (convertToAnsi || convertToUnicode)
     {
 	if (notificationCode != LVN_GETDISPINFOW)
-	{
-            cchTempBufMax = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText,
-                                                -1, NULL, 0, NULL, NULL);
-        }
-	else
-	{
-	    cchTempBufMax = pdi->item.cchTextMax;
-	    *pdi->item.pszText = 0; /* make sure we don't process garbage */
-	}
+ 	{
+ 	    cchTempBufMax = convertToUnicode ?
+       		MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1, NULL, 0):
+       		WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
+	}
+ 	else
+ 	{
+ 	    cchTempBufMax = pdi->item.cchTextMax;
+ 	    *pdi->item.pszText = 0; /* make sure we don't process garbage */
+ 	}
 
-        pszTempBuf = HeapAlloc(GetProcessHeap(), 0, sizeof(CHAR) *
-                               cchTempBufMax);
+	pszTempBuf = HeapAlloc(GetProcessHeap(), 0,
+	    (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax);
         if (!pszTempBuf) return FALSE;
 
-        WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR)
-                             pszTempBuf, cchTempBufMax, NULL, NULL);
+	if (convertToUnicode)
+	    MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1,
+	                        pszTempBuf, cchTempBufMax);
+	else
+	    WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) pszTempBuf,
+	                        cchTempBufMax, NULL, NULL);
 
         savCchTextMax = pdi->item.cchTextMax;
         savPszText = pdi->item.pszText;
@@ -864,16 +870,21 @@
         pdi->item.cchTextMax = cchTempBufMax;
     }
 
-    TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat !=
-           NFR_ANSI));
-
-    bResult = notify_hdr(infoPtr, get_ansi_notification(notificationCode),
-                        (LPNMHDR)pdi);
-
-    if (convertToAnsi)
-    {
-        MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
-                            savPszText, savCchTextMax);
+    if (infoPtr->notifyFormat == NFR_ANSI)
+	realNotifCode = get_ansi_notification(notificationCode);
+    else
+	realNotifCode = notificationCode;
+    TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat != NFR_ANSI));
+    bResult = notify_hdr(infoPtr, realNotifCode, &pdi->hdr);
+
+    if (convertToUnicode || convertToAnsi)
+    {
+	if (convertToUnicode) /* note : pointer can be changed by app ! */
+ 	    WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) savPszText,
+                                savCchTextMax, NULL, NULL);
+	else
+	    MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
+	                        savPszText, savCchTextMax);
         pdi->item.pszText = savPszText; /* restores our buffer */
         pdi->item.cchTextMax = savCchTextMax;
         HeapFree(GetProcessHeap(), 0, pszTempBuf);
@@ -3131,7 +3142,7 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] fwKeys : key indicator
- * [I] pts : mouse position
+ * [I] x,y : mouse position
  *
  * RETURN:
  *   0 if the message was processed, non-zero if there was an error
@@ -3141,7 +3152,7 @@
  * over the item for a certain period of time.
  *
  */
-static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, POINTS pts)
+static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, INT x, INT y)
 {
     if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
 	/* FIXME: select the item!!! */
@@ -3157,12 +3168,12 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] fwKeys : key indicator
- * [I] pts : mouse position
+ * [I] x,y : mouse position
  *
  * RETURN:
  *   0 if the message is processed, non-zero if there was an error
  */
-static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, POINTS pts)
+static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
 {
   TRACKMOUSEEVENT trackinfo;
 
@@ -7951,22 +7962,22 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO htInfo;
 
-    TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y);
+    TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
 
     /* send NM_RELEASEDCAPTURE notification */
     notify(infoPtr, NM_RELEASEDCAPTURE);
 
-    htInfo.pt.x = pts.x;
-    htInfo.pt.y = pts.y;
+    htInfo.pt.x = x;
+    htInfo.pt.y = y;
 
     /* send NM_DBLCLK notification */
     LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE);
@@ -7985,19 +7996,19 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
   LVHITTESTINFO lvHitTestInfo;
   static BOOL bGroupSelect = TRUE;
-  POINT pt = { pts.x, pts.y };
+  POINT pt = { x, y };
   INT nItem;
 
-  TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y);
+  TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
 
   /* send NM_RELEASEDCAPTURE notification */
   notify(infoPtr, NM_RELEASEDCAPTURE);
@@ -8007,8 +8018,8 @@
   /* set left button down flag */
   infoPtr->bLButtonDown = TRUE;
 
-  lvHitTestInfo.pt.x = pts.x;
-  lvHitTestInfo.pt.y = pts.y;
+  lvHitTestInfo.pt.x = x;
+  lvHitTestInfo.pt.y = y;
 
   nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
   TRACE("at %s, nItem=%d\n", debugpoint(&pt), nItem);
@@ -8112,21 +8123,21 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO lvHitTestInfo;
     
-    TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y);
+    TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
 
     if (!infoPtr->bLButtonDown) return 0;
 
-    lvHitTestInfo.pt.x = pts.x;
-    lvHitTestInfo.pt.y = pts.y;
+    lvHitTestInfo.pt.x = x;
+    lvHitTestInfo.pt.y = y;
 
     /* send NM_CLICK notification */
     LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
@@ -8344,23 +8355,23 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO lvHitTestInfo;
     
-    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y);
+    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
 
     /* send NM_RELEASEDCAPTURE notification */
     notify(infoPtr, NM_RELEASEDCAPTURE);
 
     /* send NM_RDBLCLK notification */
-    lvHitTestInfo.pt.x = pts.x;
-    lvHitTestInfo.pt.y = pts.y;
+    lvHitTestInfo.pt.x = x;
+    lvHitTestInfo.pt.y = y;
     LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
     notify_click(infoPtr, NM_RDBLCLK, &lvHitTestInfo);
 
@@ -8374,17 +8385,17 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO lvHitTestInfo;
     INT nItem;
 
-    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y);
+    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
 
     /* send NM_RELEASEDCAPTURE notification */
     notify(infoPtr, NM_RELEASEDCAPTURE);
@@ -8396,8 +8407,8 @@
     infoPtr->bRButtonDown = TRUE;
 
     /* determine the index of the selected item */
-    lvHitTestInfo.pt.x = pts.x;
-    lvHitTestInfo.pt.y = pts.y;
+    lvHitTestInfo.pt.x = x;
+    lvHitTestInfo.pt.y = y;
     nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
   
     if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
@@ -8422,17 +8433,17 @@
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
  * [I] wKey : key flag
- * [I] pts : mouse coordinate
+ * [I] x,y : mouse coordinate
  *
  * RETURN:
  * Zero
  */
-static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
+static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 {
     LVHITTESTINFO lvHitTestInfo;
     POINT pt;
 
-    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y);
+    TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
 
     if (!infoPtr->bRButtonDown) return 0;
  
@@ -8440,8 +8451,8 @@
     infoPtr->bRButtonDown = FALSE;
 
     /* Send NM_RClICK notification */
-    lvHitTestInfo.pt.x = pts.x;
-    lvHitTestInfo.pt.y = pts.y;
+    lvHitTestInfo.pt.x = x;
+    lvHitTestInfo.pt.y = y;
     LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
     notify_click(infoPtr, NM_RCLICK, &lvHitTestInfo);
 
@@ -9159,19 +9170,19 @@
     return LISTVIEW_KillFocus(infoPtr);
 
   case WM_LBUTTONDBLCLK:
-    return LISTVIEW_LButtonDblClk(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_LButtonDblClk(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_LBUTTONDOWN:
-    return LISTVIEW_LButtonDown(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_LButtonDown(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_LBUTTONUP:
-    return LISTVIEW_LButtonUp(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_LButtonUp(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_MOUSEMOVE:
-    return LISTVIEW_MouseMove (infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_MouseMove (infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_MOUSEHOVER:
-    return LISTVIEW_MouseHover(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_MouseHover(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_NCDESTROY:
     return LISTVIEW_NCDestroy(infoPtr);
@@ -9188,13 +9199,13 @@
     return LISTVIEW_Paint(infoPtr, (HDC)wParam);
 
   case WM_RBUTTONDBLCLK:
-    return LISTVIEW_RButtonDblClk(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_RButtonDblClk(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_RBUTTONDOWN:
-    return LISTVIEW_RButtonDown(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_RButtonDown(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_RBUTTONUP:
-    return LISTVIEW_RButtonUp(infoPtr, (WORD)wParam, MAKEPOINTS(lParam));
+    return LISTVIEW_RButtonUp(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
   case WM_SETCURSOR:
     if(LISTVIEW_SetCursor(infoPtr, (HWND)wParam, LOWORD(lParam), HIWORD(lParam)))
@@ -9270,7 +9281,7 @@
 
     ZeroMemory(&wndClass, sizeof(WNDCLASSW));
     wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
-    wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc;
+    wndClass.lpfnWndProc = LISTVIEW_WindowProc;
     wndClass.cbClsExtra = 0;
     wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);
     wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);

reactos/lib/comctl32
monthcal.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- monthcal.c	19 Sep 2004 09:50:06 -0000	1.5
+++ monthcal.c	5 Dec 2004 23:09:27 -0000	1.6
@@ -21,13 +21,26 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * NOTE
+ * 
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Oct. 20, 2004, by Dimitrie O. Paun.
+ * 
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features, or bugs, please note them below.
+ * 
  * TODO:
- *   - Notifications.
- *
- *
- *  FIXME: handle resources better (doesn't work now); also take care
-           of internationalization.
- *  FIXME: keyboard handling.
+ *    -- MCM_[GS]ETUNICODEFORMAT
+ *    -- MONTHCAL_GetMonthRange
+ *    -- Unicodification
+ *    -- handle resources better (doesn't work now); 
+ *    -- take care of internationalization.
+ *    -- keyboard handling.
+ *    -- GetRange: At the moment, we copy ranges anyway, regardless of
+ *                 infoPtr->rangeValid; a invalid range is simply filled 
+ *                 with zeros in SetRange.  Is this the right behavior?
+ *    -- search for FIXME
  */
 
 #include <math.h>
@@ -59,6 +72,7 @@
 
 typedef struct
 {
+    HWND hwndSelf;
     COLORREF	bk;
     COLORREF	txt;
     COLORREF	titlebk;
@@ -71,8 +85,6 @@
     int		textWidth;
     int		height_increment;
     int		width_increment;
-    int		left_offset;
-    int		top_offset;
     int		firstDayplace; /* place of the first day of the current month */
     int		delta;	/* scroll rate; # of months that the */
                         /* control moves when user clicks a scroll button */
@@ -93,8 +105,6 @@
     SYSTEMTIME	minDate;
     SYSTEMTIME	maxDate;
 
-    RECT rcClient;	/* rect for whole client area */
-    RECT rcDraw;	/* rect for drawable portion of client area */
     RECT title;		/* rect for the header above the calendar */
     RECT titlebtnnext;	/* the `next month' button in the header */
     RECT titlebtnprev;  /* the `prev month' button in the header */
@@ -195,12 +205,15 @@
 				   int *daypos,int *weekpos)
 {
   int retval, firstDay;
+  RECT rcClient;
+
+  GetClientRect(infoPtr->hwndSelf, &rcClient);
 
   /* if the point is outside the x bounds of the window put
   it at the boundry */
-  if(x > infoPtr->rcClient.right) {
-    x = infoPtr->rcClient.right ;
-  }
+  if (x > rcClient.right)
+    x = rcClient.right;
+
 
   *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment;
   *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment;
@@ -266,8 +279,7 @@
 
 /* day is the day in the month(1 == 1st of the month) */
 /* month is the month value(1 == january, 12 == december) */
-static void MONTHCAL_CircleDay(HDC hdc, MONTHCAL_INFO *infoPtr, int day,
-int month)
+static void MONTHCAL_CircleDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month)
 {
   HPEN hRedPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
   HPEN hOldPen2 = SelectObject(hdc, hRedPen);
@@ -318,7 +330,7 @@
 }
 
 
-static void MONTHCAL_DrawDay(HDC hdc, MONTHCAL_INFO *infoPtr, int day, int month,
+static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month,
                              int x, int y, int bold)
 {
   char buf[10];
@@ -391,12 +403,8 @@
 }
 
 
-/* CHECKME: For `todays date', do we need to check the locale?*/
-static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
+static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
 {
-  MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd);
-  RECT *rcClient=&infoPtr->rcClient;
-  RECT *rcDraw=&infoPtr->rcDraw;
   RECT *title=&infoPtr->title;
   RECT *prev=&infoPtr->titlebtnprev;
   RECT *next=&infoPtr->titlebtnnext;
@@ -410,12 +418,11 @@
   SIZE size;
   HBRUSH hbr;
   HFONT currentFont;
-  /* LOGFONTA logFont; */
   char buf[20];
   char buf1[20];
   char buf2[32];
   COLORREF oldTextColor, oldBkColor;
-  DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
+  DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
   RECT rcTemp;
   RECT rcDay; /* used in MONTHCAL_CalcDayRect() */
   SYSTEMTIME localtime;
@@ -423,10 +430,9 @@
 
   oldTextColor = SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
 
-
   /* fill background */
   hbr = CreateSolidBrush (infoPtr->bk);
-  FillRect(hdc, rcClient, hbr);
+  FillRect(hdc, &ps->rcPaint, hbr);
   DeleteObject(hbr);
 
   /* draw header */
@@ -507,8 +513,7 @@
 /* draw line under day abbreviatons */
 
   MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL);
-
-  LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1);
+  LineTo(hdc, infoPtr->days.right - 3, title->bottom + textHeight + 1);
 
   prevMonth = infoPtr->currentMonth - 1;
   if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */
@@ -555,7 +560,7 @@
     MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, 0);
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     {
-      MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0,
+      MONTHCAL_DrawDay(infoPtr, hdc, day, prevMonth, i, 0,
           infoPtr->monthdayState[m] & mask);
     }
 
@@ -579,14 +584,14 @@
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     {
 
-      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0,
+      MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth, i, 0,
 	infoPtr->monthdayState[m] & mask);
 
       if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
           (day==infoPtr->todaysDate.wDay) &&
 	  (infoPtr->currentYear == infoPtr->todaysDate.wYear)) {
         if(!(dwStyle & MCS_NOTODAYCIRCLE))
-	  MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
+	  MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->currentMonth);
       }
     }
 
@@ -601,14 +606,14 @@
     MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     {
-      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, j,
+      MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth, i, j,
           infoPtr->monthdayState[m] & mask);
 
       if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
           (day==infoPtr->todaysDate.wDay) &&
           (infoPtr->currentYear == infoPtr->todaysDate.wYear))
         if(!(dwStyle & MCS_NOTODAYCIRCLE))
-	  MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
+	  MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->currentMonth);
     }
     mask<<=1;
     day++;
@@ -630,7 +635,7 @@
     MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     {
-      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j,
+      MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth + 1, i, j,
 		infoPtr->monthdayState[m] & mask);
     }
 
@@ -652,7 +657,7 @@
     int offset = 0;
     if(!(dwStyle & MCS_NOTODAYCIRCLE))  {
       /*day is the number of days from nextmonth we put on the calendar */
-      MONTHCAL_CircleDay(hdc, infoPtr,
+      MONTHCAL_CircleDay(infoPtr, hdc,
 			 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear),
 			 infoPtr->currentMonth);
       offset+=textWidth;
@@ -765,30 +770,32 @@
 
 
 static LRESULT
-MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetMinReqRect(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   LPRECT lpRect = (LPRECT) lParam;
-  TRACE("%x %lx\n", wParam, lParam);
+
+  TRACE("rect %p\n", lpRect);
 
   /* validate parameters */
 
   if((infoPtr==NULL) ||(lpRect == NULL) ) return FALSE;
 
-  lpRect->left = infoPtr->rcClient.left;
-  lpRect->right = infoPtr->rcClient.right;
-  lpRect->top = infoPtr->rcClient.top;
-  lpRect->bottom = infoPtr->rcClient.bottom;
+  lpRect->left = infoPtr->title.left;
+  lpRect->top = infoPtr->title.top;
+  lpRect->right = infoPtr->title.right;
+  lpRect->bottom = infoPtr->todayrect.bottom;
+  AdjustWindowRect(lpRect, GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE), FALSE);
+
+  TRACE("%s\n", wine_dbgstr_rect(lpRect));
+
   return TRUE;
 }
 
 
 static LRESULT
-MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetColor(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("\n");
 
   switch((int)wParam) {
     case MCSC_BACKGROUND:
@@ -810,12 +817,11 @@
 
 
 static LRESULT
-MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetColor(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   int prev = -1;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%d: color %08lx\n", wParam, lParam);
 
   switch((int)wParam) {
     case MCSC_BACKGROUND:
@@ -844,17 +850,15 @@
       break;
   }
 
-  InvalidateRect(hwnd, NULL, FALSE);
+  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
   return prev;
 }
 
 
 static LRESULT
-MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetMonthDelta(MONTHCAL_INFO *infoPtr)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("\n");
 
   if(infoPtr->delta)
     return infoPtr->delta;
@@ -864,12 +868,11 @@
 
 
 static LRESULT
-MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetMonthDelta(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   int prev = infoPtr->delta;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("delta %d\n", wParam);
 
   infoPtr->delta = (int)wParam;
   return prev;
@@ -877,10 +880,8 @@
 
 
 static LRESULT
-MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetFirstDayOfWeek(MONTHCAL_INFO *infoPtr)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
   return infoPtr->firstDay;
 }
 
@@ -890,14 +891,13 @@
 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */
 /* FIXME: we need more error checking here */
 static LRESULT
-MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   int prev = infoPtr->firstDay;
   char buf[40];
   int day;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("day %ld\n", lParam);
 
   if((lParam >= 0) && (lParam < 7)) {
     infoPtr->firstDay = (int)lParam;
@@ -916,24 +916,18 @@
 }
 
 
-/* FIXME: fill this in */
 static LRESULT
-MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetMonthRange(MONTHCAL_INFO *infoPtr)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
-  TRACE("%x %lx\n", wParam, lParam);
-  FIXME("stub\n");
+  TRACE("\n");
 
   return infoPtr->monthRange;
 }
 
 
 static LRESULT
-MONTHCAL_GetMaxTodayWidth(HWND hwnd)
+MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO *infoPtr)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
   return(infoPtr->todayrect.right - infoPtr->todayrect.left);
 }
 
@@ -945,9 +939,8 @@
  */
 
 static LRESULT
-MONTHCAL_SetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *)lParam;
   int prev;
 
@@ -964,11 +957,11 @@
   }
   if(wParam & GDTR_MIN) {
     if(MONTHCAL_ValidateTime(lprgSysTimeArray[0])) {
-      MONTHCAL_CopyTime(&lprgSysTimeArray[0], &infoPtr->maxDate);
+      MONTHCAL_CopyTime(&lprgSysTimeArray[0], &infoPtr->minDate);
       infoPtr->rangeValid|=GDTR_MIN;
     } else {
       GetSystemTime(&infoPtr->todaysDate);
-      MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate);
+      MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minDate);
     }
   }
 
@@ -984,11 +977,6 @@
 }
 
 
-/* CHECKME: At the moment, we copy ranges anyway,regardless of
- * infoPtr->rangeValid; a invalid range is simply filled with zeros in
- * SetRange.  Is this the right behavior?
-*/
-
 static LRESULT
 MONTHCAL_GetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1007,10 +995,9 @@
 
 
 static LRESULT
-MONTHCAL_SetDayState(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetDayState(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   int i, iMonths = (int)wParam;
   MONTHDAYSTATE *dayStates = (LPMONTHDAYSTATE)lParam;
 
@@ -1023,14 +1010,13 @@
 }
 
 static LRESULT
-MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lpSel = (SYSTEMTIME *) lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
   if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE;
-  if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT) return FALSE;
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT) return FALSE;
 
   MONTHCAL_CopyTime(&infoPtr->minSel, lpSel);
   TRACE("%d/%d/%d\n", lpSel->wYear, lpSel->wMonth, lpSel->wDay);
@@ -1040,14 +1026,13 @@
 /* FIXME: if the specified date is not visible, make it visible */
 /* FIXME: redraw? */
 static LRESULT
-MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lpSel = (SYSTEMTIME *)lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
   if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE;
-  if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT) return FALSE;
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT) return FALSE;
 
   infoPtr->currentMonth=lpSel->wMonth;
   infoPtr->currentYear=lpSel->wYear;
@@ -1055,29 +1040,25 @@
   MONTHCAL_CopyTime(lpSel, &infoPtr->minSel);
   MONTHCAL_CopyTime(lpSel, &infoPtr->maxSel);
 
-  InvalidateRect(hwnd, NULL, FALSE);
+  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
   return TRUE;
 }
 
 
 static LRESULT
-MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetMaxSelCount(MONTHCAL_INFO *infoPtr)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
-  TRACE("%x %lx\n", wParam, lParam);
   return infoPtr->maxSelCount;
 }
 
 
 static LRESULT
-MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetMaxSelCount(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
+  TRACE("%x\n", wParam);
 
-  TRACE("%x %lx\n", wParam, lParam);
-  if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT)  {
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT)  {
     infoPtr->maxSelCount = wParam;
   }
 
@@ -1086,18 +1067,17 @@
 
 
 static LRESULT
-MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetSelRange(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lprgSysTimeArray = (SYSTEMTIME *) lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
 
   /* validate parameters */
 
   if((infoPtr==NULL) ||(lprgSysTimeArray==NULL)) return FALSE;
 
-  if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT)
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT)
   {
     MONTHCAL_CopyTime(&infoPtr->maxSel, &lprgSysTimeArray[1]);
     MONTHCAL_CopyTime(&infoPtr->minSel, &lprgSysTimeArray[0]);
@@ -1110,18 +1090,17 @@
 
 
 static LRESULT
-MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lprgSysTimeArray = (SYSTEMTIME *) lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
 
   /* validate parameters */
 
   if((infoPtr==NULL) ||(lprgSysTimeArray==NULL)) return FALSE;
 
-  if(GetWindowLongA( hwnd, GWL_STYLE) & MCS_MULTISELECT)
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT)
   {
     MONTHCAL_CopyTime(&lprgSysTimeArray[1], &infoPtr->maxSel);
     MONTHCAL_CopyTime(&lprgSysTimeArray[0], &infoPtr->minSel);
@@ -1134,12 +1113,11 @@
 
 
 static LRESULT
-MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetToday(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lpToday = (SYSTEMTIME *) lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
 
   /* validate parameters */
 
@@ -1150,26 +1128,24 @@
 
 
 static LRESULT
-MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   SYSTEMTIME *lpToday = (SYSTEMTIME *) lParam;
 
-  TRACE("%x %lx\n", wParam, lParam);
+  TRACE("%lx\n", lParam);
 
   /* validate parameters */
 
   if((infoPtr==NULL) ||(lpToday==NULL)) return FALSE;
   MONTHCAL_CopyTime(lpToday, &infoPtr->todaysDate);
-  InvalidateRect(hwnd, NULL, FALSE);
+  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
   return TRUE;
 }
 
 
 static LRESULT
-MONTHCAL_HitTest(HWND hwnd, LPARAM lParam)
+MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   PMCHITTESTINFO lpht = (PMCHITTESTINFO)lParam;
   UINT x,y;
   DWORD retval;
@@ -1285,9 +1261,9 @@
 }
 
 
-static void MONTHCAL_GoToNextMonth(HWND hwnd, MONTHCAL_INFO *infoPtr)
+static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr)
 {
-  DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
+  DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
 
   TRACE("MONTHCAL_GoToNextMonth\n");
 
@@ -1301,8 +1277,8 @@
     NMDAYSTATE nmds;
     int i;
 
-    nmds.nmhdr.hwndFrom = hwnd;
-    nmds.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
+    nmds.nmhdr.hwndFrom = infoPtr->hwndSelf;
+    nmds.nmhdr.idFrom   = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
@@ -1315,11 +1291,11 @@
 }
 
 
-static void MONTHCAL_GoToPrevMonth(HWND hwnd,  MONTHCAL_INFO *infoPtr)
+static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr)
 {
-  DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
+  DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
 
-  TRACE("MONTHCAL_GoToPrevMonth\n");
+  TRACE("\n");
 
   infoPtr->currentMonth--;
   if(infoPtr->currentMonth < 1) {
@@ -1331,8 +1307,8 @@
     NMDAYSTATE nmds;
     int i;
 
-    nmds.nmhdr.hwndFrom = hwnd;
-    nmds.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
+    nmds.nmhdr.hwndFrom = infoPtr->hwndSelf;
+    nmds.nmhdr.idFrom   = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc
@@ -1346,9 +1322,8 @@
 }
 
 static LRESULT
-MONTHCAL_RButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   HMENU hMenu;
   POINT menupoint;
   char buf[32];
@@ -1362,21 +1337,20 @@
   AppendMenuA(hMenu, MF_STRING|MF_ENABLED,1, buf);
   menupoint.x=(INT)LOWORD(lParam);
   menupoint.y=(INT)HIWORD(lParam);
-  ClientToScreen(hwnd, &menupoint);
+  ClientToScreen(infoPtr->hwndSelf, &menupoint);
   if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD,
-		     menupoint.x,menupoint.y,0,hwnd,NULL))
+		     menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL))
     {
       infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
       infoPtr->currentYear=infoPtr->todaysDate.wYear;
-      InvalidateRect(hwnd, NULL, FALSE);
+      InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     }
   return 0;
 }
 
 static LRESULT
-MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   MCHITTESTINFO ht;
   DWORD hit;
   HMENU hMenu;
@@ -1384,7 +1358,8 @@
   char buf[32];
   int i;
   POINT menupoint;
-  TRACE("%x %lx\n", wParam, lParam);
+
+  TRACE("%lx\n", lParam);
 
   if (infoPtr->hWndYearUpDown)
     {
@@ -1401,28 +1376,28 @@
 	}
       else
 	infoPtr->hWndYearEdit=0;
-      InvalidateRect(hwnd, NULL, FALSE);
+      InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     }
 
   ht.pt.x = (INT)LOWORD(lParam);
   ht.pt.y = (INT)HIWORD(lParam);
-  hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
+  hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
 
   /* FIXME: these flags should be checked by */
   /*((hit & MCHT_XXX) == MCHT_XXX) b/c some of the flags are */
   /* multi-bit */
   if(hit ==MCHT_TITLEBTNNEXT) {
-    MONTHCAL_GoToNextMonth(hwnd, infoPtr);
+    MONTHCAL_GoToNextMonth(infoPtr);
     infoPtr->status = MC_NEXTPRESSED;
-    SetTimer(hwnd, MC_NEXTMONTHTIMER, MC_NEXTMONTHDELAY, 0);
-    InvalidateRect(hwnd, NULL, FALSE);
+    SetTimer(infoPtr->hwndSelf, MC_NEXTMONTHTIMER, MC_NEXTMONTHDELAY, 0);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
   }
   if(hit == MCHT_TITLEBTNPREV){
-    MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
+    MONTHCAL_GoToPrevMonth(infoPtr);
     infoPtr->status = MC_PREVPRESSED;
-    SetTimer(hwnd, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0);
-    InvalidateRect(hwnd, NULL, FALSE);
+    SetTimer(infoPtr->hwndSelf, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
   }
 
@@ -1437,13 +1412,13 @@
       }
     menupoint.x=infoPtr->titlemonth.right;
     menupoint.y=infoPtr->titlemonth.bottom;
-    ClientToScreen(hwnd, &menupoint);
+    ClientToScreen(infoPtr->hwndSelf, &menupoint);
     i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD,
-		      menupoint.x,menupoint.y,0,hwnd,NULL);
+		      menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL);
     if ((i>0) && (i<13))
       {
 	infoPtr->currentMonth=i;
-	InvalidateRect(hwnd, NULL, FALSE);
+	InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
       }
   }
   if(hit == MCHT_TITLEYEAR) {
@@ -1454,7 +1429,7 @@
 			 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,
 			 infoPtr->titleyear.right-infoPtr->titleyear.left,
 			 infoPtr->textHeight,
-			 hwnd,
+			 infoPtr->hwndSelf,
 			 NULL,
 			 NULL,
 			 NULL);
@@ -1465,7 +1440,7 @@
 			 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,
 			 20,
 			 infoPtr->textHeight,
-			 hwnd,
+			 infoPtr->hwndSelf,
 			 NULL,
 			 NULL,
 			 NULL);
@@ -1478,7 +1453,7 @@
   if(hit == MCHT_TODAYLINK) {
     infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
     infoPtr->currentYear=infoPtr->todaysDate.wYear;
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
   }
   if(hit == MCHT_CALENDARDATE) {
@@ -1487,11 +1462,11 @@
 
     MONTHCAL_CopyTime(&ht.st, &selArray[0]);
     MONTHCAL_CopyTime(&ht.st, &selArray[1]);
-    MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
-    MONTHCAL_SetCurSel(hwnd,0,(LPARAM) &selArray);
+    MONTHCAL_SetSelRange(infoPtr, (LPARAM)&selArray);
+    MONTHCAL_SetCurSel(infoPtr, (LPARAM)&selArray);
     TRACE("MCHT_CALENDARDATE\n");
-    nmsc.nmhdr.hwndFrom = hwnd;
-    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
+    nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
+    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     nmsc.nmhdr.code     = MCN_SELCHANGE;
     MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart);
     MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd);
@@ -1503,10 +1478,10 @@
     /* redraw both old and new days if the selected day changed */
     if(infoPtr->curSelDay != ht.st.wDay) {
       MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay);
-      InvalidateRect(hwnd, &rcDay, TRUE);
+      InvalidateRect(infoPtr->hwndSelf, &rcDay, TRUE);
 
       MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->curSelDay, infoPtr->currentMonth, &rcDay);
-      InvalidateRect(hwnd, &rcDay, TRUE);
+      InvalidateRect(infoPtr->hwndSelf, &rcDay, TRUE);
     }
 
     infoPtr->firstSelDay = ht.st.wDay;
@@ -1520,9 +1495,8 @@
 
 
 static LRESULT
-MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   NMSELCHANGE nmsc;
   NMHDR nmhdr;
   BOOL redraw = FALSE;
@@ -1532,46 +1506,46 @@
   TRACE("\n");
 
   if(infoPtr->status & MC_NEXTPRESSED) {
-    KillTimer(hwnd, MC_NEXTMONTHTIMER);
+    KillTimer(infoPtr->hwndSelf, MC_NEXTMONTHTIMER);
     infoPtr->status &= ~MC_NEXTPRESSED;
     redraw = TRUE;
   }
   if(infoPtr->status & MC_PREVPRESSED) {
-    KillTimer(hwnd, MC_PREVMONTHTIMER);
+    KillTimer(infoPtr->hwndSelf, MC_PREVMONTHTIMER);
     infoPtr->status &= ~MC_PREVPRESSED;
     redraw = TRUE;
   }
 
   ht.pt.x = (INT)LOWORD(lParam);
   ht.pt.y = (INT)HIWORD(lParam);
-  hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
+  hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
 
   infoPtr->status = MC_SEL_LBUTUP;
 
   if(hit ==MCHT_CALENDARDATENEXT) {
-    MONTHCAL_GoToNextMonth(hwnd, infoPtr);
-    InvalidateRect(hwnd, NULL, FALSE);
+    MONTHCAL_GoToNextMonth(infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
   }
   if(hit == MCHT_CALENDARDATEPREV){
-    MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
-    InvalidateRect(hwnd, NULL, FALSE);
+    MONTHCAL_GoToPrevMonth(infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
   }
-  nmhdr.hwndFrom = hwnd;
-  nmhdr.idFrom   = GetWindowLongPtrW( hwnd, GWLP_ID);
+  nmhdr.hwndFrom = infoPtr->hwndSelf;
+  nmhdr.idFrom   = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
   nmhdr.code     = NM_RELEASEDCAPTURE;
-  TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify);
+  TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify);
 
   SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
                                 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
   /* redraw if necessary */
   if(redraw)
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
   /* only send MCN_SELECT if currently displayed month's day was selected */
   if(hit == MCHT_CALENDARDATE) {
-    nmsc.nmhdr.hwndFrom = hwnd;
-    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
+    nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
+    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     nmsc.nmhdr.code     = MCN_SELECT;
     MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart);
     MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd);
@@ -1585,39 +1559,37 @@
 
 
 static LRESULT
-MONTHCAL_Timer(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_Timer(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   BOOL redraw = FALSE;
 
-  TRACE(" %d\n", wParam);
-  if(!infoPtr) return 0;
+  TRACE("%d\n", wParam);
 
   switch(wParam) {
   case MC_NEXTMONTHTIMER:
     redraw = TRUE;
-    MONTHCAL_GoToNextMonth(hwnd, infoPtr);
+    MONTHCAL_GoToNextMonth(infoPtr);
     break;
   case MC_PREVMONTHTIMER:
     redraw = TRUE;
-    MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
+    MONTHCAL_GoToPrevMonth(infoPtr);
     break;
   default:
     ERR("got unknown timer\n");
+    break;
   }
 
   /* redraw only if necessary */
   if(redraw)
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
   return 0;
 }
 
 
 static LRESULT
-MONTHCAL_MouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   MCHITTESTINFO ht;
   int oldselday, selday, hit;
   RECT r;
@@ -1627,7 +1599,7 @@
   ht.pt.x = LOWORD(lParam);
   ht.pt.y = HIWORD(lParam);
 
-  hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
+  hit = MONTHCAL_HitTest(infoPtr, (LPARAM)&ht);
 
   /* not on the calendar date numbers? bail out */
   TRACE("hit:%x\n",hit);
@@ -1638,11 +1610,11 @@
   infoPtr->curSelDay = selday;
   MONTHCAL_CalcPosFromDay(infoPtr, selday, ht.st. wMonth, &r);
 
-  if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT)  {
+  if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT)  {
     SYSTEMTIME selArray[2];
     int i;
 
-    MONTHCAL_GetSelRange(hwnd, 0, (LPARAM)&selArray);
+    MONTHCAL_GetSelRange(infoPtr, (LPARAM)&selArray);
     i = 0;
     if(infoPtr->firstSelDay==selArray[0].wDay) i=1;
     TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
@@ -1672,7 +1644,7 @@
         selArray[0].wDay = tempday;
       }
 
-      MONTHCAL_SetSelRange(hwnd, 0, (LPARAM)&selArray);
+      MONTHCAL_SetSelRange(infoPtr, (LPARAM)&selArray);
     }
   }
 
@@ -1682,57 +1654,57 @@
   /* FIXME: this should specify a rectangle containing only the days that changed */
   /* using InvalidateRect */
   if(oldselday != infoPtr->curSelDay)
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
   return 0;
 }
 
 
 static LRESULT
-MONTHCAL_Paint(HWND hwnd, WPARAM wParam)
+MONTHCAL_Paint(MONTHCAL_INFO *infoPtr, WPARAM wParam)
 {
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
   HDC hdc;
   PAINTSTRUCT ps;
 
-  /* fill ps.rcPaint with a default rect */
-  memcpy(&(ps.rcPaint), &(infoPtr->rcClient), sizeof(infoPtr->rcClient));
+  if (wParam)
+  {
+    GetClientRect(infoPtr->hwndSelf, &ps.rcPaint);
+    hdc = (HDC)wParam;
+  }
+  else
+    hdc = BeginPaint(infoPtr->hwndSelf, &ps);
 
-  hdc = (wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam);
-  MONTHCAL_Refresh(hwnd, hdc, &ps);
-  if(!wParam) EndPaint(hwnd, &ps);
+  MONTHCAL_Refresh(infoPtr, hdc, &ps);
+  if (!wParam) EndPaint(infoPtr->hwndSelf, &ps);
   return 0;
 }
 
 
 static LRESULT
-MONTHCAL_KillFocus(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_KillFocus(MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
-  InvalidateRect(hwnd, NULL, TRUE);
+  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
   return 0;
 }
 
 
 static LRESULT
-MONTHCAL_SetFocus(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_SetFocus(MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
 
-  InvalidateRect(hwnd, NULL, FALSE);
+  InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
   return 0;
 }
 
 /* sets the size information */
-static void MONTHCAL_UpdateSize(HWND hwnd)
+static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
 {
-  HDC hdc = GetDC(hwnd);
-  MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-  RECT *rcClient=&infoPtr->rcClient;
-  RECT *rcDraw=&infoPtr->rcDraw;
[truncated at 1000 lines; 408 more skipped]

reactos/lib/comctl32
nativefont.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- nativefont.c	19 Sep 2004 09:50:06 -0000	1.3
+++ nativefont.c	5 Dec 2004 23:09:27 -0000	1.4
@@ -28,12 +28,11 @@
  */
 
 #include <stdarg.h>
-#include <string.h>
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
 #include "winuser.h"
-#include "winnls.h"
 #include "commctrl.h"
 #include "comctl32.h"
 #include "wine/debug.h"
@@ -42,12 +41,11 @@
 
 typedef struct
 {
-    DWORD  dwDummy;   /* just to keep the compiler happy ;-) */
+    HWND     hwndSelf;        /* my own handle */
 } NATIVEFONT_INFO;
 
 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0))
 
-
 static LRESULT
 NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -57,45 +55,40 @@
     infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO));
     SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
-
     /* initialize info structure */
-
+    infoPtr->hwndSelf = hwnd;
 
     return 0;
 }
 
-
 static LRESULT
-NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
+NATIVEFONT_Destroy (NATIVEFONT_INFO *infoPtr)
 {
-    NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
-
-
-
-
-    /* free comboex info data */
+    /* free control info data */
+    SetWindowLongPtrW( infoPtr->hwndSelf, 0, 0 );
     Free (infoPtr);
-    SetWindowLongPtrW( hwnd, 0, 0 );
 
     return 0;
 }
 
-
-
 static LRESULT WINAPI
 NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    if (!NATIVEFONT_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
-	return DefWindowProcA( hwnd, uMsg, wParam, lParam );
+    NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(hwnd);
+
+    TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n",
+	  hwnd, uMsg, wParam, lParam);
+
+    if (!infoPtr && (uMsg != WM_CREATE))
+	return DefWindowProcW( hwnd, uMsg, wParam, lParam );
 
     switch (uMsg)
     {
-
 	case WM_CREATE:
 	    return NATIVEFONT_Create (hwnd, wParam, lParam);
 
 	case WM_DESTROY:
-	    return NATIVEFONT_Destroy (hwnd, wParam, lParam);
+	    return NATIVEFONT_Destroy (infoPtr);
 
         case WM_MOVE:
         case WM_SIZE:
@@ -105,12 +98,13 @@
         case WM_SETFONT:
         case WM_GETDLGCODE:
 	    /* FIXME("message %04x seen but stubbed\n", uMsg); */
-	    return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
 	default:
-	    ERR("unknown msg %04x wp=%08x lp=%08lx\n",
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+		ERR("unknown msg %04x wp=%08x lp=%08lx\n",
 		     uMsg, wParam, lParam);
-	    return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
     return 0;
 }
@@ -119,23 +113,23 @@
 VOID
 NATIVEFONT_Register (void)
 {
-    WNDCLASSA wndClass;
+    WNDCLASSW wndClass;
 
-    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
+    ZeroMemory (&wndClass, sizeof(WNDCLASSW));
     wndClass.style         = CS_GLOBALCLASS;
-    wndClass.lpfnWndProc   = (WNDPROC)NATIVEFONT_WindowProc;
+    wndClass.lpfnWndProc   = NATIVEFONT_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(NATIVEFONT_INFO *);
-    wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);
-    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
-    wndClass.lpszClassName = WC_NATIVEFONTCTLA;
+    wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+    wndClass.lpszClassName = WC_NATIVEFONTCTLW;
 
-    RegisterClassA (&wndClass);
+    RegisterClassW (&wndClass);
 }
 
 
 VOID
 NATIVEFONT_Unregister (void)
 {
-    UnregisterClassA (WC_NATIVEFONTCTLA, NULL);
+    UnregisterClassW (WC_NATIVEFONTCTLW, NULL);
 }

reactos/lib/comctl32
progress.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- progress.c	19 Sep 2004 09:50:06 -0000	1.7
+++ progress.c	5 Dec 2004 23:09:27 -0000	1.8
@@ -493,7 +493,7 @@
  *           ProgressWindowProc
  */
 static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
-                                  WPARAM wParam, LPARAM lParam)
+                                         WPARAM wParam, LPARAM lParam)
 {
     PROGRESS_INFO *infoPtr;
 
@@ -654,7 +654,7 @@
  *
  * Registers the progress bar window class.
  */
-VOID PROGRESS_Register (void)
+void PROGRESS_Register (void)
 {
     WNDCLASSW wndClass;
 
@@ -675,7 +675,7 @@
  *
  * Unregisters the progress bar window class.
  */
-VOID PROGRESS_Unregister (void)
+void PROGRESS_Unregister (void)
 {
     UnregisterClassW (PROGRESS_CLASSW, NULL);
 }

reactos/lib/comctl32
rebar.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- rebar.c	5 Dec 2004 01:12:56 -0000	1.14
+++ rebar.c	5 Dec 2004 23:09:27 -0000	1.15
@@ -19,7 +19,7 @@
  *
  *
  * This code was audited for completeness against the documented features
- * of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman.
+ * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman.
  * 
  * Unless otherwise noted, we believe this code to be complete, as per
  * the specification mentioned above.
@@ -194,8 +194,8 @@
     HCURSOR  hcurVert;    /* handle to the NS cursor */
     HCURSOR  hcurDrag;    /* handle to the drag cursor */
     INT      iVersion;    /* version number */
-    POINTS   dragStart;   /* x,y of button down */
-    POINTS   dragNow;     /* x,y of this MouseMove */
+    POINT    dragStart;   /* x,y of button down */
+    POINT    dragNow;     /* x,y of this MouseMove */
     INT      iOldBand;    /* last band that had the mouse cursor over it */
     INT      ihitoffset;  /* offset of hotspot from gripper.left */
     POINT    origin;      /* left/upper corner of client */
@@ -394,7 +394,7 @@
     TRACE("hwnd=%p: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",
 	  iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
 	  iP->calcSize.cx, iP->calcSize.cy);
-    TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n",
+    TRACE("hwnd=%p: flags=%08x, dragStart=%ld,%ld, dragNow=%ld,%ld, iGrabbedBand=%d\n",
 	  iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
 	  iP->dragNow.x, iP->dragNow.y,
 	  iP->iGrabbedBand);
@@ -2418,7 +2418,7 @@
 
 
 static void
-REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
+REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
      /* Function:  This will implement the functionality of a     */
      /*  Gripper drag within a row. It will not implement "out-   */
      /*  of-row" drags. (They are detected and handled in         */
@@ -2491,7 +2491,7 @@
 			     infoPtr->ihitoffset);
     infoPtr->dragNow = *ptsmove;
 
-    TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n",
+    TRACE("before: movement=%d (%ld,%ld), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n",
 	  movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,
 	  imaxdBand, LHeaderSum, RHeaderSum);
     REBAR_DumpBand (infoPtr);
@@ -3874,7 +3874,8 @@
         infoPtr->iGrabbedBand = iHitBand;
 
         /* save off the LOWORD and HIWORD of lParam as initial x,y */
-        infoPtr->dragStart = MAKEPOINTS(lParam);
+        infoPtr->dragStart.x = (short)LOWORD(lParam);
+        infoPtr->dragStart.y = (short)HIWORD(lParam);
         infoPtr->dragNow = infoPtr->dragStart;
         if (infoPtr->dwStyle & CCS_VERT)
             infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER);
@@ -3935,9 +3936,10 @@
 REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     REBAR_BAND *lpChevronBand;
-    POINTS ptsmove;
+    POINT ptMove;
 
-    ptsmove = MAKEPOINTS(lParam);
+    ptMove.x = (short)LOWORD(lParam);
+    ptMove.y = (short)HIWORD(lParam);
 
     /* if we are currently dragging a band */
     if (infoPtr->iGrabbedBand >= 0)
@@ -3951,40 +3953,37 @@
         band2 = &infoPtr->bands[infoPtr->iGrabbedBand];
 
         /* if mouse did not move much, exit */
-        if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) &&
-            (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
+        if ((abs(ptMove.x - infoPtr->dragNow.x) <= mindragx) &&
+            (abs(ptMove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
 
         /* Test for valid drag case - must not be first band in row */
         if (infoPtr->dwStyle & CCS_VERT) {
-            if ((ptsmove.x < band2->rcBand.left) ||
-	      (ptsmove.x > band2->rcBand.right) ||
+            if ((ptMove.x < band2->rcBand.left) ||
+	      (ptMove.x > band2->rcBand.right) ||
               ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
                 FIXME("Cannot drag to other rows yet!!\n");
             }
             else {
-                REBAR_HandleLRDrag (infoPtr, &ptsmove);
+                REBAR_HandleLRDrag (infoPtr, &ptMove);
             }
         }
         else {
-            if ((ptsmove.y < band2->rcBand.top) ||
-              (ptsmove.y > band2->rcBand.bottom) ||
+            if ((ptMove.y < band2->rcBand.top) ||
+              (ptMove.y > band2->rcBand.bottom) ||
               ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
                 FIXME("Cannot drag to other rows yet!!\n");
             }
             else {
-                REBAR_HandleLRDrag (infoPtr, &ptsmove);
+                REBAR_HandleLRDrag (infoPtr, &ptMove);
             }
         }
     }
     else
     {
-        POINT ptMove;
         INT iHitBand;
         UINT htFlags;
         TRACKMOUSEEVENT trackinfo;
 
-        ptMove.x = (INT)ptsmove.x;
-        ptMove.y = (INT)ptsmove.y;
         REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand);
 
         if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand)
@@ -4152,8 +4151,7 @@
 REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     NMMOUSE nmmouse;
-    POINTS shortpt;
-    POINT clpt, pt;
+    POINT clpt;
     INT i;
     UINT scrap;
     LRESULT ret = HTCLIENT;
@@ -4166,9 +4164,8 @@
      * 3. native always seems to return HTCLIENT if notify return is 0.
      */
 
-    shortpt = MAKEPOINTS (lParam);
-    POINTSTOPOINT(pt, shortpt);
-    clpt = pt;
+    clpt.x = (short)LOWORD(lParam);
+    clpt.y = (short)HIWORD(lParam);
     ScreenToClient (infoPtr->hwndSelf, &clpt);
     REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
 			   (INT *)&nmmouse.dwItemSpec);
@@ -4710,7 +4707,7 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS;
-    wndClass.lpfnWndProc   = (WNDPROC)REBAR_WindowProc;
+    wndClass.lpfnWndProc   = REBAR_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(REBAR_INFO *);
     wndClass.hCursor       = 0;

reactos/lib/comctl32
status.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- status.c	19 Sep 2004 09:50:06 -0000	1.6
+++ status.c	5 Dec 2004 23:09:27 -0000	1.7
@@ -79,7 +79,7 @@
     BOOL              NtfUnicode;	/* notify format */
     STATUSWINDOWPART  part0;		/* simple window */
     STATUSWINDOWPART* parts;
-} STATUSWINDOWINFO;
+} STATUS_INFO;
 
 /*
  * Run tests using Waite Group Windows95 API Bible Vol. 1&2
@@ -91,11 +91,9 @@
 #define VERT_BORDER 2
 #define HORZ_GAP    2
 
-#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0))
-
 /* prototype */
 static void
-STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr);
+STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
 
 static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
 {
@@ -148,7 +146,7 @@
 
 
 static void
-STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID)
+STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
 {
     RECT r = part->bound;
     UINT border = BDR_SUNKENOUTER;
@@ -189,7 +187,7 @@
 
 
 static void
-STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID)
+STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
 {
     HBRUSH hbrBk;
     HFONT  hOldFont;
@@ -208,7 +206,7 @@
 
     hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
 
-	STATUSBAR_DrawPart (hdc, part, infoPtr, itemID);
+	STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
 
     SelectObject (hdc, hOldFont);
 
@@ -226,7 +224,7 @@
 
 
 static LRESULT
-STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
+STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
 {
     int      i;
     RECT   rect;
@@ -250,10 +248,10 @@
     hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
 
     if (infoPtr->simple) {
-	    STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0);
+	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
     } else {
 	    for (i = 0; i < infoPtr->numParts; i++) {
-		    STATUSBAR_RefreshPart (infoPtr, &infoPtr->parts[i], hdc, i);
+		    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
 	    }
     }
 
@@ -270,7 +268,7 @@
 
 
 static void
-STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
+STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
 {
     STATUSWINDOWPART *part;
     RECT rect, *r;
@@ -315,7 +313,7 @@
 
 
 static LRESULT
-STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg,
+STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
 		     WPARAM wParam, LPARAM lParam)
 {
     MSG msg;
@@ -345,7 +343,7 @@
 
 
 static HICON
-STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
+STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
 {
     TRACE("%d\n", nPart);
     /* MSDN says: "simple parts are indexed with -1" */
@@ -360,7 +358,7 @@
 
 
 static INT
-STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
+STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
 {
     INT   i;
 
@@ -375,7 +373,7 @@
 
 
 static BOOL
-STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
+STATUSBAR_GetRect (STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
 {
     TRACE("part %d\n", nPart);
     if (infoPtr->simple)
@@ -387,7 +385,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
+STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
 {
     STATUSWINDOWPART *part;
     LRESULT result;
@@ -416,7 +414,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
+STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
 {
     STATUSWINDOWPART *part;
     LRESULT result;
@@ -442,7 +440,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
+STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
 {
     STATUSWINDOWPART *part;
     DWORD result;
@@ -467,7 +465,7 @@
 }
 
 static LRESULT
-STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
+STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -489,7 +487,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
+STATUSBAR_GetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -512,7 +510,7 @@
 
 
 static COLORREF
-STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
+STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
 {
     COLORREF oldBkColor;
 
@@ -526,7 +524,7 @@
 
 
 static BOOL
-STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
+STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
 {
     if ((nPart < -1) || (nPart >= infoPtr->numParts))
 	return FALSE;
@@ -553,7 +551,7 @@
 
 
 static BOOL
-STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
+STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
 {
 
     TRACE("(height=%d)\n", height);
@@ -577,7 +575,7 @@
 
 
 static BOOL
-STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
+STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
 {
     STATUSWINDOWPART *tmp;
     int	i, oldNumParts;
@@ -647,7 +645,7 @@
 
 
 static BOOL
-STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
+STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
 		    LPCWSTR text, BOOL isW)
 {
     STATUSWINDOWPART *part=NULL;
@@ -715,7 +713,7 @@
 
 
 static LRESULT
-STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
+STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, text);
     if (infoPtr->hwndToolTip) {
@@ -734,7 +732,7 @@
 
 
 static LRESULT
-STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
+STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
     if (infoPtr->hwndToolTip) {
@@ -753,7 +751,7 @@
 
 
 inline static LRESULT
-STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
+STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
 {
     BOOL bOld = infoPtr->bUnicode;
 
@@ -765,7 +763,7 @@
 
 
 static BOOL
-STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
+STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
 {
     NMHDR  nmhdr;
 
@@ -786,7 +784,7 @@
 
 
 static LRESULT
-STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
+STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
 {
     int	i;
 
@@ -816,7 +814,7 @@
 static LRESULT
 STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
 {
-    STATUSWINDOWINFO *infoPtr;
+    STATUS_INFO *infoPtr;
     NONCLIENTMETRICSW nclm;
     DWORD dwStyle;
     RECT rect;
@@ -824,7 +822,7 @@
     HDC	hdc;
 
     TRACE("\n");
-    infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO));
+    infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
     if (!infoPtr) goto create_fail;
     SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
@@ -944,7 +942,7 @@
 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
  * of the first part only (usual behaviour) */
 static INT
-STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
+STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
 {
     INT len;
 
@@ -970,7 +968,7 @@
 
 
 static BOOL
-STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
+STATUSBAR_WMNCHitTest (STATUS_INFO *infoPtr, INT x, INT y)
 {
     if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
 	RECT  rect;
@@ -994,7 +992,7 @@
 
 
 static LRESULT
-STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
+STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
 {
     PAINTSTRUCT ps;
 
@@ -1009,7 +1007,7 @@
 
 
 static LRESULT
-STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
+STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
 {
     infoPtr->hFont = font;
     TRACE("%p\n", infoPtr->hFont);
@@ -1021,7 +1019,7 @@
 
 
 static BOOL
-STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
+STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
 {
     STATUSWINDOWPART *part;
     int len;
@@ -1058,7 +1056,7 @@
 
 
 static BOOL
-STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
+STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
 {
     INT  width, x, y;
     RECT parent_rect;
@@ -1088,7 +1086,7 @@
 
 
 static LRESULT
-STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
+STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
 {
     if (cmd == NF_REQUERY) {
 	INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
@@ -1099,14 +1097,13 @@
 
 
 static LRESULT
-STATUSBAR_SendNotify (HWND hwnd, UINT code)
+STATUSBAR_SendNotify (STATUS_INFO *infoPtr, UINT code)
 {
-    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
     NMHDR  nmhdr;
 
     TRACE("code %04x\n", code);
-    nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
+    nmhdr.hwndFrom = infoPtr->Self;
+    nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
     nmhdr.code = code;
     SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     return 0;
@@ -1117,7 +1114,7 @@
 static LRESULT WINAPI
 StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
+    STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
     INT nPart = ((INT) wParam) & 0x00ff;
     LRESULT res;
 
@@ -1206,10 +1203,10 @@
 	    return STATUSBAR_GetTextLength (infoPtr, 0);
 
 	case WM_LBUTTONDBLCLK:
-            return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
+            return STATUSBAR_SendNotify (infoPtr, NM_DBLCLK);
 
 	case WM_LBUTTONUP:
-	    return STATUSBAR_SendNotify (hwnd, NM_CLICK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_CLICK);
 
 	case WM_MOUSEMOVE:
 	    return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
@@ -1232,10 +1229,10 @@
 	    return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
 
 	case WM_RBUTTONDBLCLK:
-	    return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_RDBLCLK);
 
 	case WM_RBUTTONUP:
-	    return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_RCLICK);
 
 	case WM_SETFONT:
 	    return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
@@ -1272,7 +1269,7 @@
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
     wndClass.lpfnWndProc   = StatusWindowProc;
     wndClass.cbClsExtra    = 0;
-    wndClass.cbWndExtra    = sizeof(STATUSWINDOWINFO *);
+    wndClass.cbWndExtra    = sizeof(STATUS_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
     wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
     wndClass.lpszClassName = STATUSCLASSNAMEW;

reactos/lib/comctl32
syslink.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- syslink.c	19 Sep 2004 09:50:06 -0000	1.2
+++ syslink.c	5 Dec 2004 23:09:27 -0000	1.3
@@ -1478,12 +1478,10 @@
     case WM_SETCURSOR:
     {
         LHITTESTINFO ht;
-        POINTS pt;
         DWORD mp = GetMessagePos();
         
-        pt = MAKEPOINTS(mp);
-        ht.pt.x = pt.x;
-        ht.pt.y = pt.y;
+        ht.pt.x = (short)LOWORD(mp);
+        ht.pt.y = (short)HIWORD(mp);
         
         ScreenToClient(infoPtr->Self, &ht.pt);
         if(SYSLINK_HitTest (infoPtr, &ht))
@@ -1662,7 +1660,7 @@
 
     ZeroMemory (&wndClass, sizeof(wndClass));
     wndClass.style         = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
-    wndClass.lpfnWndProc   = (WNDPROC)SysLinkWindowProc;
+    wndClass.lpfnWndProc   = SysLinkWindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof (SYSLINK_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);

reactos/lib/comctl32
tab.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- tab.c	20 Oct 2004 08:36:55 -0000	1.11
+++ tab.c	5 Dec 2004 23:09:27 -0000	1.12
@@ -1659,8 +1659,7 @@
     dis.hwndItem = hwnd;		/* */
     dis.hDC      = hdc;
     CopyRect(&dis.rcItem,drawRect);
-    dis.itemData = 0;
-    memcpy( &dis.itemData, TAB_GetItem(infoPtr, iItem)->extra, min(sizeof(dis.itemData),infoPtr->cbInfo) );
+    dis.itemData = (ULONG_PTR)TAB_GetItem(infoPtr, iItem)->extra;
 
     /*
      * send the draw message

reactos/lib/comctl32
toolbar.c 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- toolbar.c	20 Oct 2004 08:36:55 -0000	1.20
+++ toolbar.c	5 Dec 2004 23:09:27 -0000	1.21
@@ -47,11 +47,11 @@
  *     - TB_INSERTMARKHITTEST
  *     - TB_SAVERESTORE
  *     - TB_SETMETRICS
+ *     - WM_WININICHANGE
  *   - Notifications:
  *     - NM_CHAR
  *     - NM_KEYDOWN
  *     - TBN_GETOBJECT
- *     - TBN_RESTORE
  *     - TBN_SAVE
  *   - Button wrapping (under construction).
  *   - Fix TB_SETROWS.
@@ -73,6 +73,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winreg.h"
 #include "wingdi.h"
 #include "winuser.h"
 #include "wine/unicode.h"
@@ -157,10 +158,9 @@
     BOOL     bBtnTranspnt;    /* button transparency flag */
     BOOL     bAutoSize;       /* auto size deadlock indicator */
     BOOL     bAnchor;         /* anchor highlight enabled */
-    BOOL     bNtfUnicode;     /* TRUE if NOTIFYs use {W} */
     BOOL     bDoRedraw;       /* Redraw status */
     BOOL     bDragOutSent;    /* has TBN_DRAGOUT notification been sent for this drag? */
-    BOOL     bUnicode;        /* ASCII (FALSE) or Unicode (TRUE)? */
+    BOOL     bUnicode;        /* Notifications are ASCII (FALSE) or Unicode (TRUE)? */
     BOOL     bCaptured;       /* mouse captured? */
     DWORD      dwStyle;         /* regular toolbar style */
     DWORD      dwExStyle;       /* extended toolbar style */
@@ -208,6 +208,9 @@
 #define ARROW_HEIGHT       3
 #define INSERTMARK_WIDTH   2
 
+#define DEFPAD_CX 7
+#define DEFPAD_CY 6
+
 /* gap between border of button and text/image */
 #define OFFSET_X 1
 #define OFFSET_Y 1
@@ -231,6 +234,10 @@
                         TBSTYLE_EX_MIXEDBUTTONS | \
                         TBSTYLE_EX_HIDECLIPPEDBUTTONS)
 
+/* all of the CCS_ styles */
+#define COMMON_STYLES (CCS_TOP|CCS_NOMOVEY|CCS_BOTTOM|CCS_NORESIZE| \
+                       CCS_NOPARENTALIGN|CCS_ADJUSTABLE|CCS_NODIVIDER|CCS_VERT)
+
 #define GETIBITMAP(infoPtr, i) (infoPtr->iVersion >= 5 ? LOWORD(i) : i)
 #define GETHIMLID(infoPtr, i) (infoPtr->iVersion >= 5 ? HIWORD(i) : 0)
 #define GETDEFIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id)
@@ -329,14 +336,10 @@
     nmhdr->code = code;
 
     TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code,
-	  (infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI");
+	  (infoPtr->bUnicode) ? "via Unicode" : "via ANSI");
 
-    if (infoPtr->bNtfUnicode)
-	return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
-			     (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
-    else
-	return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
-			     (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
+    return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, 
+        (WPARAM)nmhdr->idFrom, (LPARAM)nmhdr);
 }
 
 /***********************************************************************
@@ -351,22 +354,22 @@
 {
     INT ret = btnPtr->iBitmap;
 
-    if (ret == I_IMAGECALLBACK) {
-	/* issue TBN_GETDISPINFO */
-	NMTBDISPINFOA nmgd;
-
-	nmgd.idCommand = btnPtr->idCommand;
-	nmgd.lParam = btnPtr->dwData;
-	nmgd.dwMask = TBNF_IMAGE;
-	TOOLBAR_SendNotify ((NMHDR *) &nmgd, infoPtr,
-			(infoPtr->bNtfUnicode) ? TBN_GETDISPINFOW :
-			TBN_GETDISPINFOA);
-	if (nmgd.dwMask & TBNF_DI_SETITEM) {
-	    btnPtr->iBitmap = nmgd.iImage;
-	}
-	ret = nmgd.iImage;
-	TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
-	      ret, nmgd.dwMask, infoPtr->nNumBitmaps);
+    if (ret == I_IMAGECALLBACK)
+    {
+        /* issue TBN_GETDISPINFO */
+        NMTBDISPINFOA nmgd;
+
+        memset(&nmgd, 0, sizeof(nmgd));
+        nmgd.idCommand = btnPtr->idCommand;
+        nmgd.lParam = btnPtr->dwData;
+        nmgd.dwMask = TBNF_IMAGE;
+        TOOLBAR_SendNotify(&nmgd.hdr, infoPtr,
+			infoPtr->bUnicode ? TBN_GETDISPINFOW : TBN_GETDISPINFOA);
+        if (nmgd.dwMask & TBNF_DI_SETITEM)
+            btnPtr->iBitmap = nmgd.iImage;
+        ret = nmgd.iImage;
+        TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
+            ret, nmgd.dwMask, infoPtr->nNumBitmaps);
     }
 
     if (ret != I_IMAGENONE)
@@ -707,7 +710,7 @@
     BOOL draw_masked = FALSE;
     INT index;
     INT offset = 0;
-    UINT draw_flags = ILD_NORMAL;
+    UINT draw_flags = ILD_TRANSPARENT;
 
     if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
     {
@@ -868,12 +871,12 @@
 
     /* Center the bitmap horizontally and vertically */
     if (dwStyle & TBSTYLE_LIST)
-        rcBitmap.left += GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
+        rcBitmap.left += GetSystemMetrics(SM_CXEDGE);
     else
         rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2;
 
     if(lpText)
-        rcBitmap.top+= GetSystemMetrics(SM_CYEDGE) + OFFSET_Y;
+        rcBitmap.top+= GetSystemMetrics(SM_CYEDGE);
     else
         rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
 
@@ -942,7 +945,7 @@
 	tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
 	tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
 	tbcd.nmcd.lItemlParam = btnPtr->dwData;
-	ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+	ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
         /* reset these fields so the user can't alter the behaviour like native */
         tbcd.nmcd.hdc = hdc;
         tbcd.nmcd.rc = rc;
@@ -1032,7 +1035,7 @@
 	tbcd.rcText = rcText;
 	tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
 	tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
-	ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+	ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
     }
 
 }
@@ -1068,7 +1071,7 @@
     tbcd.nmcd.dwDrawStage = CDDS_PREPAINT;
     tbcd.nmcd.hdc = hdc;
     tbcd.nmcd.rc = ps->rcPaint;
-    ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+    ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
     infoPtr->dwBaseCustDraw = ntfret & 0xffff;
 
     if (infoPtr->bBtnTranspnt)
@@ -1117,7 +1120,7 @@
 	tbcd.nmcd.dwDrawStage = CDDS_POSTPAINT;
 	tbcd.nmcd.hdc = hdc;
 	tbcd.nmcd.rc = ps->rcPaint;
-	ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+	ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
     }
 }
 
@@ -1804,7 +1807,7 @@
     /* MSDN states that iItem is the index of the button, rather than the
      * command ID as used by every other NMTOOLBAR notification */
     nmtb.iItem = nIndexFrom;
-    if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
+    if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
     {
         PCUSTOMBUTTON btnInfo;
         NMHDR hdr;
@@ -1845,7 +1848,7 @@
     /* MSDN states that iItem is the index of the button, rather than the
      * command ID as used by every other NMTOOLBAR notification */
     nmtb.iItem = nIndexAvail;
-    if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
+    if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
     {
         PCUSTOMBUTTON btnInfo;
         NMHDR hdr;
@@ -2074,10 +2077,11 @@
 		/* send TBN_QUERYINSERT notification */
 		nmtb.iItem = custInfo->tbInfo->nNumButtons;
 
-		if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYINSERT))
+		if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
 		    return FALSE;
 
 		/* UNDOCUMENTED: dialog hwnd immediately follows NMHDR */
+		/* FIXME: this hack won't work on 64-bit - we need to declare a structure for this */
 		nmtb.iItem = (int)hwnd;
 		/* Send TBN_INITCUSTOMIZE notification */
 		if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_INITCUSTOMIZE) ==
@@ -2222,8 +2226,7 @@
 
 			/* send TBN_QUERYINSERT notification */
 			nmtb.iItem = index;
-		        TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-					TBN_QUERYINSERT);
+		        TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
 
 			/* get list box item */
 			btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
@@ -3029,7 +3032,7 @@
     {
         x = y = 1;
         cy += GetSystemMetrics(SM_CYEDGE);
-        cx += GetSystemMetrics(SM_CYEDGE);
+        cx += GetSystemMetrics(SM_CXEDGE);
     }
 
     infoPtr->bAutoSize = TRUE;
@@ -3056,12 +3059,6 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (infoPtr == NULL) {
-	ERR("(%p, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);
-	ERR("infoPtr == NULL!\n");
-	return 0;
-    }
-
     infoPtr->dwStructSize = (DWORD)wParam;
 
     return 0;
@@ -3162,8 +3159,7 @@
     custInfo.tbHwnd = hwnd;
 
     /* send TBN_BEGINADJUST notification */
-    TOOLBAR_SendNotify ((NMHDR *) &nmhdr, infoPtr,
-		    TBN_BEGINADJUST);
+    TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
 
     if (!(hRes = FindResourceW (COMCTL32_hModule,
                                 MAKEINTRESOURCEW(IDD_TBCUSTOMIZE),
@@ -3180,8 +3176,7 @@
                                    (LPARAM)&custInfo);
 
     /* send TBN_ENDADJUST notification */
-    TOOLBAR_SendNotify ((NMHDR *) &nmhdr, infoPtr,
-		    TBN_ENDADJUST);
+    TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
 
     return ret;
 }
@@ -3206,7 +3201,7 @@
     nmtb.tbButton.fsStyle = btnPtr->fsStyle;
     nmtb.tbButton.dwData = btnPtr->dwData;
     nmtb.tbButton.iString = btnPtr->iString;
-    TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_DELETINGBUTTON);
+    TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
 
     if ((infoPtr->hwndToolTip) &&
 	!(btnPtr->fsStyle & BTNS_SEP)) {
@@ -3325,9 +3320,6 @@
     INT nIndex = (INT)wParam;
     TBUTTON_INFO *btnPtr;
 
-    if (infoPtr == NULL)
-	return FALSE;
-
     if (lpTbb == NULL)
 	return FALSE;
 
@@ -3356,8 +3348,6 @@
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
-    if (infoPtr == NULL)
-	return -1;
     if (lpTbInfo == NULL)
 	return -1;
     if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA))
@@ -3404,8 +3394,6 @@
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
-    if (infoPtr == NULL)
-	return -1;
     if (lpTbInfo == NULL)
 	return -1;
     if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW))
@@ -3594,8 +3582,6 @@
     LPRECT     lpRect;
     INT        nIndex;
 
-    if (infoPtr == NULL)
-	return FALSE;
     nIndex = (INT)wParam;
     btnPtr = &infoPtr->buttons[nIndex];
     if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
@@ -3657,8 +3643,6 @@
     LPRECT     lpRect;
     INT        nIndex;
 
-    if (infoPtr == NULL)
-	return FALSE;
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
     btnPtr = &infoPtr->buttons[nIndex];
     if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
@@ -3714,9 +3698,6 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (infoPtr == NULL)
-	return 0;
-
     return infoPtr->nMaxTextRows;
 }
 
@@ -3726,8 +3707,6 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (infoPtr == NULL)
-	return 0;
     return (LRESULT)infoPtr->hwndToolTip;
 }
 
@@ -4385,64 +4364,184 @@
     return TRUE;
 }
 
-static LRESULT
-TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+
+/* helper for TOOLBAR_SaveRestoreW */
+static BOOL
+TOOLBAR_Save(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
 {
-#if 0
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-    LPTBSAVEPARAMSA lpSave = (LPTBSAVEPARAMSA)lParam;
+    FIXME("save to %s %s\n", debugstr_w(lpSave->pszSubKey),
+        debugstr_w(lpSave->pszValueName));
+
+    return FALSE;
+}
 
-    if (lpSave == NULL) return 0;
 
-    if ((BOOL)wParam) {
-	/* save toolbar information */
-	FIXME("save to \"%s\" \"%s\"\n",
-	       lpSave->pszSubKey, lpSave->pszValueName);
+/* helper for TOOLBAR_Restore */
+static void
+TOOLBAR_DeleteAllButtons(TOOLBAR_INFO *infoPtr)
+{
+    INT i;
+    TTTOOLINFOW ti;
 
+    ZeroMemory(&ti, sizeof(ti));
+    ti.cbSize   = sizeof(ti);
+    ti.hwnd     = infoPtr->hwndSelf;
 
+    for (i = 0; i < infoPtr->nNumButtons; i++)
+    {
+        if ((infoPtr->hwndToolTip) &&
+            !(infoPtr->buttons[i].fsStyle & BTNS_SEP))
+        {
+            ti.uId      = infoPtr->buttons[i].idCommand;
+            SendMessageW(infoPtr->hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
+        }
     }
-    else {
-	/* restore toolbar information */
 
-	FIXME("restore from \"%s\" \"%s\"\n",
-	       lpSave->pszSubKey, lpSave->pszValueName);
+    Free(infoPtr->buttons);
+    infoPtr->buttons = NULL;
+    infoPtr->nNumButtons = 0;
+}
 
 
+/* helper for TOOLBAR_SaveRestoreW */
+static BOOL
+TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
+{
+    LONG res;
+    HKEY hkey = NULL;
+    BOOL ret = FALSE;
+    DWORD dwType;
+    DWORD dwSize = 0;
+    NMTBRESTORE nmtbr;
+
+    /* restore toolbar information */
+    TRACE("restore from %s %s\n", debugstr_w(lpSave->pszSubKey),
+        debugstr_w(lpSave->pszValueName));
+
+    memset(&nmtbr, 0, sizeof(nmtbr));
+
+    res = RegOpenKeyExW(lpSave->hkr, lpSave->pszSubKey, 0,
+        KEY_QUERY_VALUE, &hkey);
+    if (!res)
+        res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
+            NULL, &dwSize);
+    if (!res && dwType != REG_BINARY)
+        res = ERROR_FILE_NOT_FOUND;
+    if (!res)
+    {
+        nmtbr.pData = HeapAlloc(GetProcessHeap(), 0, dwSize);
+        nmtbr.cbData = (UINT)dwSize;
+        if (!nmtbr.pData) res = ERROR_OUTOFMEMORY;
+    }
+    if (!res)
+        res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
+            (LPBYTE)nmtbr.pData, &dwSize);
+    if (!res)
+    {
+        nmtbr.pCurrent = nmtbr.pData;
+        nmtbr.iItem = -1;
+        nmtbr.cbBytesPerRecord = sizeof(DWORD);
+        nmtbr.cButtons = nmtbr.cbData / nmtbr.cbBytesPerRecord;
+
+        if (!TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE))
+        {
+            INT i;
+
+            /* remove all existing buttons as this function is designed to
+             * restore the toolbar to a previously saved state */
+            TOOLBAR_DeleteAllButtons(infoPtr);
+
+            for (i = 0; i < nmtbr.cButtons; i++)
+            {
+                nmtbr.iItem = i;
+                nmtbr.tbButton.iBitmap = -1;
+                nmtbr.tbButton.fsState = 0;
+                nmtbr.tbButton.fsStyle = 0;
+                nmtbr.tbButton.idCommand = 0;
+                if (*nmtbr.pCurrent == (DWORD)-1)
+                {
+                    /* separator */
+                    nmtbr.tbButton.fsStyle = TBSTYLE_SEP;
+                    nmtbr.tbButton.iBitmap = SEPARATOR_WIDTH;
+                }
+                else if (*nmtbr.pCurrent == (DWORD)-2)
+                    /* hidden button */
+                    nmtbr.tbButton.fsState = TBSTATE_HIDDEN;
+                else
+                    nmtbr.tbButton.idCommand = (int)*nmtbr.pCurrent;
+
+                nmtbr.pCurrent++;
+                
+                TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE);
+
+                /* can't contain real string as we don't know whether
+                 * the client put an ANSI or Unicode string in there */
+                if (HIWORD(nmtbr.tbButton.iString))
+                    nmtbr.tbButton.iString = 0;
+
+                TOOLBAR_InsertButtonW(infoPtr->hwndSelf, -1,
+                    (LPARAM)&nmtbr.tbButton);
+            }
+
+            /* do legacy notifications */
+            if (infoPtr->iVersion < 5)
+            {
+                /* FIXME: send TBN_BEGINADJUST */
+                FIXME("send TBN_GETBUTTONINFO for each button\n");
+                /* FIXME: send TBN_ENDADJUST */
+            }
+
+            /* remove all uninitialised buttons
+             * note: loop backwards to avoid having to fixup i on a
+             * delete */
+            for (i = infoPtr->nNumButtons - 1; i >= 0; i--)
+                if (infoPtr->buttons[i].iBitmap == -1)
+                    TOOLBAR_DeleteButton(infoPtr->hwndSelf, i, 0);
+
+            /* only indicate success if at least one button survived */
+            if (infoPtr->nNumButtons > 0) ret = TRUE;
+        }
     }
-#endif
+    HeapFree(GetProcessHeap(), 0, nmtbr.pData);
+    RegCloseKey(hkey);
 
-    return 0;
+    return ret;
 }
 
 
 static LRESULT
-TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave)
 {
-#if 0
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-    LPTBSAVEPARAMSW lpSave = (LPTBSAVEPARAMSW)lParam;
 
-    if (lpSave == NULL)
-	return 0;
+    if (lpSave == NULL) return 0;
 
-    if ((BOOL)wParam) {
-	/* save toolbar information */
-	FIXME("save to \"%s\" \"%s\"\n",
-	       lpSave->pszSubKey, lpSave->pszValueName);
+    if (wParam)
+        return TOOLBAR_Save(infoPtr, lpSave);
+    else
+        return TOOLBAR_Restore(infoPtr, lpSave);
+}
 
 
-    }
-    else {
-	/* restore toolbar information */
+static LRESULT
+TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave)
+{
+    TBSAVEPARAMSW SaveW;
+    int len;
 
-	FIXME("restore from \"%s\" \"%s\"\n",
-	       lpSave->pszSubKey, lpSave->pszValueName);
+    if (lpSave == NULL) return 0;
 
+    SaveW.hkr = lpSave->hkr;
 
-    }
-#endif
+    len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0);
+    SaveW.pszSubKey = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, (LPWSTR)SaveW.pszSubKey, len);
 
-    return 0;
+    len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0);
+    SaveW.pszValueName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, (LPWSTR)SaveW.pszValueName, len);
+
+    return TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW);
 }
 
 
@@ -4613,9 +4712,11 @@
     if ((cx < 0) || (cy < 0))
     {
         ERR("invalid parameter 0x%08lx\n", (DWORD)lParam);
-	return FALSE;
+        return FALSE;
     }
 
+    TRACE("%p, cx = %d, cy = %d\n", hwnd, cx, cy);
+
     /* The documentation claims you can only change the button size before
      * any button has been added. But this is wrong.
      * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding
@@ -4638,11 +4739,6 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (infoPtr == NULL) {
-	TRACE("Toolbar not initialized yet?????\n");
-	return FALSE;
-    }
-
     /* if setting to current values, ignore */
     if ((infoPtr->cxMin == (INT)LOWORD(lParam)) &&
 	(infoPtr->cxMax == (INT)HIWORD(lParam))) {
@@ -4824,7 +4920,7 @@
 	else
 	    nmhotitem.dwFlags |= HICF_LEAVING;
 
-	no_highlight = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE);
+	no_highlight = TOOLBAR_SendNotify(&nmhotitem.hdr, infoPtr, TBN_HOTITEMCHANGE);
 
 	/* now invalidate the old and new buttons so they will be painted */
 	if (oldBtnPtr)
@@ -4879,10 +4975,15 @@
     for (i = 0; i < infoPtr->cimlDef; i++)
         infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
 
-    ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
-			  &infoPtr->nBitmapHeight);
-    TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",
-	  hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps,
+    if (!ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
+            &infoPtr->nBitmapHeight))
+    {
+        infoPtr->nBitmapWidth = 0;
+        infoPtr->nBitmapHeight = 0;
+    }
+
+    TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
+	  hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
 	  infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
 
     InvalidateRect(hwnd, NULL, TRUE);
@@ -4960,9 +5061,6 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (infoPtr == NULL)
-	return FALSE;
-
     infoPtr->nMaxTextRows = (INT)wParam;
 
     TOOLBAR_CalcToolbar(hwnd);
@@ -5003,8 +5101,6 @@
 
     TRACE("\n");
 
-    if (infoPtr == NULL)
-	return 0;
     hwndOldNotify = infoPtr->hwndNotify;
     infoPtr->hwndNotify = (HWND)wParam;
 
@@ -5095,8 +5191,6 @@
 
     TRACE("hwnd=%p, hwndTooltip=%p, lParam=0x%lx\n", hwnd, (HWND)wParam, lParam);
 
-    if (infoPtr == NULL)
-	return 0;
     infoPtr->hwndToolTip = (HWND)wParam;
     return 0;
 }
@@ -5370,7 +5464,6 @@
     infoPtr->nOldHit = -1;
     infoPtr->nHotItem = -1;
     infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
-    infoPtr->bUnicode = IsWindowUnicode (infoPtr->hwndNotify);
     infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST));
     infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
     infoPtr->bAnchor = FALSE; /* no anchor highlighting */
@@ -5380,15 +5473,14 @@
     infoPtr->bDoRedraw = TRUE;
     infoPtr->clrBtnHighlight = CLR_DEFAULT;
     infoPtr->clrBtnShadow = CLR_DEFAULT;
-    /* not sure where the +1 comes from, but this comes to the same value
-     * as native so this is probably correct */
-    infoPtr->szPadding.cx = 2*(GetSystemMetrics(SM_CXEDGE)+OFFSET_X) + 1;
-    infoPtr->szPadding.cy = 2*(GetSystemMetrics(SM_CYEDGE)+OFFSET_Y);
+    infoPtr->szPadding.cx = DEFPAD_CX;
+    infoPtr->szPadding.cy = DEFPAD_CY;
     infoPtr->iListGap = infoPtr->szPadding.cx / 2;
     infoPtr->dwStyle = dwStyle;
     infoPtr->tbim.iButton = -1;
     GetClientRect(hwnd, &infoPtr->client_rect);
-    TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY);
+    infoPtr->bUnicode = infoPtr->hwndNotify && 
+        (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY));
 
     SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
     infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont);
@@ -5402,13 +5494,13 @@
 			       hwnd, 0, 0, 0);
 
 	/* Send NM_TOOLTIPSCREATED notification */
-	if (infoPtr->hwndToolTip) {
+	if (infoPtr->hwndToolTip)
+	{
 	    NMTOOLTIPSCREATED nmttc;
 
 	    nmttc.hwndToolTips = infoPtr->hwndToolTip;
 
-	    TOOLBAR_SendNotify ((NMHDR *) &nmttc, infoPtr,
-			    NM_TOOLTIPSCREATED);
+	    TOOLBAR_SendNotify (&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED);
 	}
     }
 
@@ -5483,7 +5575,7 @@
 	ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
 	tbcd.nmcd.dwDrawStage = CDDS_PREERASE;
 	tbcd.nmcd.hdc = (HDC)wParam;
-	ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+	ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
 	infoPtr->dwBaseCustDraw = ntfret & 0xffff;
 
 	/* FIXME: in general the return flags *can* be or'ed together */
@@ -5523,7 +5615,7 @@
 	ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
 	tbcd.nmcd.dwDrawStage = CDDS_POSTERASE;
 	tbcd.nmcd.hdc = (HDC)wParam;
-	ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
+	ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
 	infoPtr->dwBaseCustDraw = ntfret & 0xffff;
 	switch (infoPtr->dwBaseCustDraw)
 	    {
@@ -5632,11 +5724,9 @@
 	    RedrawWindow(hwnd,&btnPtr->rect,0,
 			RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
 
+	    memset(&nmtb, 0, sizeof(nmtb));
 	    nmtb.iItem = btnPtr->idCommand;
-	    memset(&nmtb.tbButton, 0, sizeof(TBBUTTON));
-	    nmtb.cchText = 0;
-	    nmtb.pszText = 0;
-	    CopyRect(&nmtb.rcButton, &btnPtr->rect);
+	    nmtb.rcButton = btnPtr->rect;
 	    res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
 				  TBN_DROPDOWN);
 	    TRACE("TBN_DROPDOWN responded with %ld\n", res);
@@ -5686,22 +5776,15 @@
 
     if (nHit >=0)
     {
+        memset(&nmtb, 0, sizeof(nmtb));
         nmtb.iItem = btnPtr->idCommand;
-        nmtb.tbButton.iBitmap = btnPtr->iBitmap;
-        nmtb.tbButton.idCommand = btnPtr->idCommand;
-        nmtb.tbButton.fsState = btnPtr->fsState;
-        nmtb.tbButton.fsStyle = btnPtr->fsStyle;
-        nmtb.tbButton.dwData = btnPtr->dwData;
-        nmtb.tbButton.iString = btnPtr->iString;
-        nmtb.cchText = 0;  /* !!! not correct */
-        nmtb.pszText = 0;  /* !!! not correct */
         TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
     }
 
     nmmouse.dwHitInfo = nHit;
 
     /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */
-    if (nmmouse.dwHitInfo < 0)
+    if (nHit < 0)
         nmmouse.dwItemSpec = -1;
     else
     {
@@ -5712,7 +5795,7 @@
     ClientToScreen(hwnd, &pt); 
     nmmouse.pt = pt;
 
-    if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_LDOWN))
+    if (!TOOLBAR_SendNotify(&nmmouse.hdr, infoPtr, NM_LDOWN))
         return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam);
 
     return 0;
@@ -5847,15 +5930,8 @@
 	/* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the
 	 * TBN_BEGINDRAG
 	 */
+	memset(&nmtb, 0, sizeof(nmtb));
 	nmtb.iItem = btnPtr->idCommand;
-	nmtb.tbButton.iBitmap = btnPtr->iBitmap;
-	nmtb.tbButton.idCommand = btnPtr->idCommand;
-	nmtb.tbButton.fsState = btnPtr->fsState;
-	nmtb.tbButton.fsStyle = btnPtr->fsStyle;
-	nmtb.tbButton.dwData = btnPtr->dwData;
-	nmtb.tbButton.iString = btnPtr->iString;
-	nmtb.cchText = 0;  /* !!! not correct */
-	nmtb.pszText = 0;  /* !!! not correct */
 	TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
 			TBN_ENDDRAG);
 
@@ -5891,16 +5967,17 @@
 TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
+    INT nHit;
     NMMOUSE nmmouse;
     POINT pt;
 
     pt.x = LOWORD(lParam);
     pt.y = HIWORD(lParam);
 
-    nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
+    nmmouse.dwHitInfo = nHit;
 
-    if (nmmouse.dwHitInfo < 0) {
+    if (nHit < 0) {
 	nmmouse.dwItemSpec = -1;
     } else {
 	nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
@@ -6207,7 +6284,7 @@
     if (index < 0)
         return 0;
 
-    if (infoPtr->bNtfUnicode)
+    if (infoPtr->bUnicode)
     {
         WCHAR wszBuffer[INFOTIPSIZE+1];
         NMTBGETINFOTIPW tbgit;
@@ -6362,7 +6439,7 @@
         return TOOLBAR_TTGetDispInfo(infoPtr, (LPNMTTDISPINFOW)lParam);
 
     case TTN_GETDISPINFOA:
-        FIXME("TTN_GETDISPINFOA - stub\n");
+        FIXME("TTN_GETDISPINFOA - should not be received; please report\n");
         return 0;
 
     default:
@@ -6372,38 +6449,26 @@
 
 
 static LRESULT
-TOOLBAR_NotifyFormatFake(HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    /* remove this routine when Toolbar is improved to pass infoPtr
-     * around instead of hwnd.
-     */
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
-    return TOOLBAR_NotifyFormat(infoPtr, wParam, lParam);
-}
-
-
-static LRESULT
 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    INT i;
+    LRESULT format;
 
     TRACE("wParam = 0x%x, lParam = 0x%08lx\n", wParam, lParam);
 
-    if ((lParam == NF_QUERY) && ((HWND)wParam == infoPtr->hwndToolTip))
+    if (lParam == NF_QUERY)
         return NFR_UNICODE;
 
     if (lParam == NF_REQUERY) {
-	i = SendMessageW(infoPtr->hwndNotify,
+	format = SendMessageW(infoPtr->hwndNotify,
 			 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
-	if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
-	    ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
-		i);
-	    i = NFR_ANSI;
+	if ((format != NFR_ANSI) && (format != NFR_UNICODE)) {
+	    ERR("wrong response to WM_NOTIFYFORMAT (%ld), assuming ANSI\n",
+		format);
+	    format = NFR_ANSI;
 	}
-	infoPtr->bNtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
-	return (LRESULT)i;
+	return format;
     }
-    return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
+    return 0;
 }
 
 
@@ -6541,7 +6606,7 @@
 	{
 	    x = y = 1;
 	    cy += GetSystemMetrics(SM_CYEDGE);
-	    cx += GetSystemMetrics(SM_CYEDGE);
+	    cx += GetSystemMetrics(SM_CXEDGE);
 	}
 
         if(infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS)
@@ -6597,27 +6662,29 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
 
-    if (nType == GWL_STYLE) {
-	if (lpStyle->styleNew & TBSTYLE_LIST) {
-	    infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;
-	}
-	else {
-	    infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
-	}
+    if (nType == GWL_STYLE)
+    {
+        if (lpStyle->styleNew & TBSTYLE_LIST)
+            infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;
+        else
+            infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
+
 	infoPtr->bBtnTranspnt = (lpStyle->styleNew &
 				 (TBSTYLE_FLAT | TBSTYLE_LIST));
-	TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
+        TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
 
         TRACE("new style 0x%08lx\n", lpStyle->styleNew);
 
         infoPtr->dwStyle = lpStyle->styleNew;
-    }
-
-    TOOLBAR_CalcToolbar(hwnd);
-
-    TOOLBAR_AutoSize (hwnd);
 
-    InvalidateRect(hwnd, NULL, TRUE);
+        /* only resize if one of the CCS_* styles was changed */
+        if ((infoPtr->dwStyle ^ lpStyle->styleNew) & COMMON_STYLES)
+        {
+            TOOLBAR_AutoSize (hwnd);
+    
+            InvalidateRect(hwnd, NULL, TRUE);
+        }
+    }
 
     return 0;
 }
@@ -6641,7 +6708,7 @@
     TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
 	  hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
 
-    if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE))
+    if (!infoPtr && (uMsg != WM_NCCREATE))
 	return DefWindowProcW( hwnd, uMsg, wParam, lParam );
 
     switch (uMsg)
@@ -6829,10 +6896,10 @@
             return TOOLBAR_ReplaceBitmap (hwnd, wParam, lParam);
 
 	case TB_SAVERESTOREA:
-	    return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam);
+	    return TOOLBAR_SaveRestoreA (hwnd, wParam, (LPTBSAVEPARAMSA)lParam);
 
 	case TB_SAVERESTOREW:
-	    return TOOLBAR_SaveRestoreW (hwnd, wParam, lParam);
+	    return TOOLBAR_SaveRestoreW (hwnd, wParam, (LPTBSAVEPARAMSW)lParam);
 
 	case TB_SETANCHORHIGHLIGHT:
 	    return TOOLBAR_SetAnchorHighlight (hwnd, wParam);
@@ -6998,7 +7065,7 @@
 	    return TOOLBAR_Notify (hwnd, wParam, lParam);
 
 	case WM_NOTIFYFORMAT:
-	    return TOOLBAR_NotifyFormatFake (hwnd, wParam, lParam);
+	    return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam);
 
 	case WM_PAINT:
 	    return TOOLBAR_Paint (hwnd, wParam);
@@ -7145,7 +7212,7 @@
 static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
 {
     if (infoPtr->bUnicode)
-        return TOOLBAR_SendNotify ((NMHDR *) nmtb, infoPtr, TBN_GETBUTTONINFOW);
+        return TOOLBAR_SendNotify(&nmtb->hdr, infoPtr, TBN_GETBUTTONINFOW);
     else
     {
         CHAR Buffer[256];
@@ -7157,7 +7224,7 @@
         nmtba.cchText = 256;
         ZeroMemory(nmtba.pszText, nmtba.cchText);
 
-        if (TOOLBAR_SendNotify ((NMHDR *) &nmtba, infoPtr, TBN_GETBUTTONINFOA))
+        if (TOOLBAR_SendNotify(&nmtba.hdr, infoPtr, TBN_GETBUTTONINFOA))
         {
             int ccht = strlen(nmtba.pszText);
             if (ccht)

reactos/lib/comctl32
tooltips.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- tooltips.c	5 Dec 2004 00:22:03 -0000	1.10
+++ tooltips.c	5 Dec 2004 23:09:27 -0000	1.11
@@ -1927,16 +1927,25 @@
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
     LPCSTR pszTitle = (LPCSTR)lParam;
-    UINT uTitleIcon = (UINT)wParam;
+    UINT_PTR uTitleIcon = (UINT_PTR)wParam;
     UINT size;
 
-    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, pszTitle, (void*)uTitleIcon);
+    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_a(pszTitle),
+        (void*)uTitleIcon);
+
+    Free(infoPtr->pszTitle);
+
+    if (pszTitle)
+    {
+        size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0);
+        infoPtr->pszTitle = Alloc(size);
+        if (!infoPtr->pszTitle)
+            return FALSE;
+        MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
+    }
+    else
+        infoPtr->pszTitle = NULL;
 
-    size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0);
-    infoPtr->pszTitle = Alloc(size);
-    if (!infoPtr->pszTitle)
-        return FALSE;
-    MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
     if (uTitleIcon <= TTI_ERROR)
         infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
     else
@@ -1951,16 +1960,25 @@
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
     LPCWSTR pszTitle = (LPCWSTR)lParam;
-    UINT uTitleIcon = (UINT)wParam;
+    UINT_PTR uTitleIcon = (UINT_PTR)wParam;
     UINT size;
 
-    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle), (void*)uTitleIcon);
+    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle),
+        (void*)uTitleIcon);
+
+    Free(infoPtr->pszTitle);
+
+    if (pszTitle)
+    {
+        size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
+        infoPtr->pszTitle = Alloc(size);
+        if (!infoPtr->pszTitle)
+            return FALSE;
+        memcpy(infoPtr->pszTitle, pszTitle, size);
+    }
+    else
+        infoPtr->pszTitle = NULL;
 
-    size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
-    infoPtr->pszTitle = Alloc(size);
-    if (!infoPtr->pszTitle)
-        return FALSE;
-    memcpy(infoPtr->pszTitle, pszTitle, size);
     if (uTitleIcon <= TTI_ERROR)
         infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
     else

reactos/lib/comctl32
trackbar.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- trackbar.c	19 Sep 2004 09:50:06 -0000	1.6
+++ trackbar.c	5 Dec 2004 23:09:27 -0000	1.7
@@ -1418,9 +1418,12 @@
 }
 
 static LRESULT
-TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts)
+TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
 {
-    POINT clickPoint = { pts.x, pts.y };
+    POINT clickPoint;
+
+    clickPoint.x = x;
+    clickPoint.y = y;
 
     SetFocus(infoPtr->hwndSelf);
 
@@ -1444,7 +1447,7 @@
 
 
 static LRESULT
-TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts)
+TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
 {
     if (infoPtr->flags & TB_DRAG_MODE) {
         notify_with_scroll (infoPtr, TB_THUMBPOSITION | (infoPtr->lPos<<16));
@@ -1526,17 +1529,18 @@
 
 
 static LRESULT
-TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts)
+TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
-    INT clickPlace = (dwStyle & TBS_VERT) ? pts.y : pts.x;
+    INT clickPlace = (dwStyle & TBS_VERT) ? y : x;
     LONG dragPos, oldPos = infoPtr->lPos;
 
-    TRACE("(x=%d. y=%d)\n", pts.x, pts.y);
+    TRACE("(x=%d. y=%d)\n", x, y);
 
     if (infoPtr->flags & TB_AUTO_PAGE) {
 	POINT pt;
-	POINTSTOPOINT(pt, pts);
+	pt.x = x;
+	pt.y = y;
 	TRACKBAR_AutoPage (infoPtr, pt);
 	return TRUE;
     }
@@ -1778,13 +1782,13 @@
         return TRACKBAR_KillFocus (infoPtr, (HWND)wParam);
 
     case WM_LBUTTONDOWN:
-        return TRACKBAR_LButtonDown (infoPtr, wParam, MAKEPOINTS(lParam));
+        return TRACKBAR_LButtonDown (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
     case WM_LBUTTONUP:
-        return TRACKBAR_LButtonUp (infoPtr, wParam, MAKEPOINTS(lParam));
+        return TRACKBAR_LButtonUp (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
     case WM_MOUSEMOVE:
-        return TRACKBAR_MouseMove (infoPtr, wParam, MAKEPOINTS(lParam));
+        return TRACKBAR_MouseMove (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 
     case WM_PAINT:
         return TRACKBAR_Paint (infoPtr, (HDC)wParam);

reactos/lib/comctl32
treeview.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- treeview.c	21 Oct 2004 08:38:35 -0000	1.12
+++ treeview.c	5 Dec 2004 23:09:27 -0000	1.13
@@ -130,6 +130,7 @@
   COLORREF      clrLine;
   COLORREF      clrInsertMark;
   HFONT         hFont;
+  HFONT         hDefaultFont;
   HFONT         hBoldFont;
   HWND          hwndToolTip;
 
@@ -255,11 +256,11 @@
 static HFONT
 TREEVIEW_CreateBoldFont(HFONT hOrigFont)
 {
-    LOGFONTA font;
+    LOGFONTW font;
 
-    GetObjectA(hOrigFont, sizeof(font), &font);
+    GetObjectW(hOrigFont, sizeof(font), &font);
     font.lfWeight = FW_BOLD;
-    return CreateFontIndirectA(&font);
+    return CreateFontIndirectW(&font);
 }
 
 static inline HFONT
@@ -1809,7 +1810,7 @@
 
     TRACE("%p %i\n", hFont, bRedraw);
 
-    infoPtr->hFont = hFont ? hFont : GetStockObject(SYSTEM_FONT);
+    infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
 
     DeleteObject(infoPtr->hBoldFont);
     infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
@@ -2328,7 +2329,7 @@
 	    SelectObject(hdc, hOldPen);
 	    DeleteObject(hNewPen);
 
-	    if (height < 32 || width < 32)
+	    if (height < 18 || width < 18)
 	    {
 	        MoveToEx(hdc, centerx - plussize + 1, centery, NULL);
 	        LineTo(hdc, centerx + plussize, centery);
@@ -4684,6 +4685,7 @@
     static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
     RECT rcClient;
     TREEVIEW_INFO *infoPtr;
+    LOGFONTW lf;
 
     TRACE("wnd %p, style %lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
 
@@ -4749,7 +4751,8 @@
 
     infoPtr->items = DPA_Create(16);
 
-    infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
+    SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
+    infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
     infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
 
     infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
@@ -4839,6 +4842,7 @@
     /* Deassociate treeview from the window before doing anything drastic. */
     SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL);
 
+    DeleteObject(infoPtr->hDefaultFont);
     DeleteObject(infoPtr->hBoldFont);
     Free(infoPtr);
 
@@ -5399,7 +5403,7 @@
 
     ZeroMemory(&wndClass, sizeof(WNDCLASSA));
     wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
-    wndClass.lpfnWndProc = (WNDPROC)TREEVIEW_WindowProc;
+    wndClass.lpfnWndProc = TREEVIEW_WindowProc;
     wndClass.cbClsExtra = 0;
     wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *);
 

reactos/lib/comctl32
updown.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- updown.c	20 Oct 2004 08:36:55 -0000	1.6
+++ updown.c	5 Dec 2004 23:09:27 -0000	1.7
@@ -92,12 +92,12 @@
 #define TIMER_ACCEL        2
 #define TIMER_AUTOPRESS    3
 
-#define BUDDY_UPDOWN_HWND        "buddyUpDownHWND"
-#define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
-
 #define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
 
+static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 };
+static const WCHAR BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r', 
+						   'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 };
 static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
 
 /***********************************************************************
@@ -427,12 +427,13 @@
 static LRESULT CALLBACK
 UPDOWN_Buddy_SubclassProc(HWND  hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC);
-    TRACE("hwnd=%p, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",
-	  hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam);
+    WNDPROC superClassWndProc = (WNDPROC)GetPropW(hwnd, BUDDY_SUPERCLASS_WNDPROC);
+
+    TRACE("hwnd=%p, wndProc=%p, uMsg=%04x, wParam=%08x, lParam=%08lx\n",
+          hwnd, superClassWndProc, uMsg, wParam, lParam);
 
     if (uMsg == WM_KEYDOWN) {
-        HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND);
+        HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND);
 
 	UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam);
     }
@@ -452,11 +453,13 @@
  */
 static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
 {
+    static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 };
+    static const WCHAR listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 };
     DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
     RECT  budRect;  /* new coord for the buddy */
     int   x, width;  /* new x position and width for the up-down */
     WNDPROC baseWndProc;
-    CHAR buddyClass[40];
+    WCHAR buddyClass[40];
     HWND ret;
 
     TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
@@ -464,7 +467,7 @@
     ret = infoPtr->Buddy;
 
     /* there is already a body assigned */
-    if (infoPtr->Buddy)  RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
+    if (infoPtr->Buddy)  RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
 
     if(!IsWindow(bud))
         bud = 0;
@@ -475,14 +478,14 @@
     if(bud) {
 
         /* keep upDown ctrl hwnd in a buddy property */
-        SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
+        SetPropW( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
 
         /* Store buddy window class type */
         infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
-        if (GetClassNameA(bud, buddyClass, COUNT_OF(buddyClass))) {
-            if (lstrcmpiA(buddyClass, "Edit") == 0)
+        if (GetClassNameW(bud, buddyClass, COUNT_OF(buddyClass))) {
+            if (lstrcmpiW(buddyClass, editW) == 0)
                 infoPtr->BuddyType = BUDDY_TYPE_EDIT;
-            else if (lstrcmpiA(buddyClass, "Listbox") == 0)
+            else if (lstrcmpiW(buddyClass, listboxW) == 0)
                 infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
         }
 
@@ -490,9 +493,9 @@
             /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
                when we reset the upDown ctrl buddy to another buddy because it is not
                good to break the window proc chain. */
-            if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) {
+            if (!GetPropW(bud, BUDDY_SUPERCLASS_WNDPROC)) {
                 baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
-                SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
+                SetPropW(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
             }
         }
 
@@ -508,7 +511,8 @@
             budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
             x  = budRect.right+DEFAULT_XSEP;
         } else {
-            x  = budRect.right+DEFAULT_XSEP;
+            /* nothing to do */
+            return ret;
         }
 
         /* first adjust the buddy to accommodate the up/down */
@@ -533,7 +537,7 @@
                 x -= DEFAULT_BUDDYBORDER;
         }
 
-        SetWindowPos(infoPtr->Self, infoPtr->Buddy, x,
+        SetWindowPos(infoPtr->Self, 0, x,
                      budRect.top - DEFAULT_ADDTOP, width,
                      budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
                      SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
@@ -568,6 +572,8 @@
     delta *= (action & FLAG_INCR ? 1 : -1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1);
     if ( (action & FLAG_INCR) && (action & FLAG_DECR) ) delta = 0;
 
+    TRACE("current %d, delta: %d\n", infoPtr->CurVal, delta);
+
     /* We must notify parent now to obtain permission */
     ni.iPos = infoPtr->CurVal;
     ni.iDelta = delta;
@@ -579,6 +585,8 @@
 
         /* Now adjust value with (maybe new) delta */
         if (UPDOWN_OffsetVal (infoPtr, ni.iDelta)) {
+            TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta);
+
             /* Now take care about our buddy */
             if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
         }
@@ -597,7 +605,7 @@
  */
 static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr)
 {
-    if(GetWindowLongW (infoPtr->Self, GWL_STYLE) & WS_DISABLED)
+    if (!IsWindowEnabled(infoPtr->Self))
         return FALSE;
     if(infoPtr->Buddy)
         return IsWindowEnabled(infoPtr->Buddy);
@@ -642,23 +650,32 @@
  * 'pt' is the location of the mouse event in client or
  * windows coordinates.
  */
-static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts)
+static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT y)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
-    POINT pt = { pts.x, pts.y };
+    POINT pt = { x, y };
     RECT rect;
     int temp, arrow;
 
+    TRACE("msg %04x point %s\n", msg, wine_dbgstr_point(&pt));
+
     switch(msg)
     {
         case WM_LBUTTONDOWN:  /* Initialise mouse tracking */
-            /* If we are inside an arrow, then nothing to do */
-            if(!(infoPtr->Flags & FLAG_MOUSEIN)) return;
 
             /* If the buddy is an edit, will set focus to it */
 	    if (UPDOWN_IsBuddyEdit(infoPtr)) SetFocus(infoPtr->Buddy);
 
             /* Now see which one is the 'active' arrow */
+            arrow = UPDOWN_GetArrowFromPoint (infoPtr, &rect, pt);
+
+            /* Update the flags if we are in/out */
+            infoPtr->Flags &= ~(FLAG_MOUSEIN | FLAG_ARROW);
+            if (arrow)
+                infoPtr->Flags |= FLAG_MOUSEIN | arrow;
+            else
+                if (infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0;
+
 	    if (infoPtr->Flags & FLAG_ARROW) {
 
             	/* Update the CurVal if necessary */
@@ -671,7 +688,8 @@
 	    	InvalidateRect (infoPtr->Self, NULL, FALSE);
 
             	/* process the click */
-            	UPDOWN_DoAction (infoPtr, 1, infoPtr->Flags & FLAG_ARROW);
+		temp = (infoPtr->AccelCount && infoPtr->AccelVect) ? infoPtr->AccelVect[0].nInc : 1;
+            	UPDOWN_DoAction (infoPtr, temp, infoPtr->Flags & FLAG_ARROW);
 
             	/* now capture all mouse messages */
             	SetCapture (infoPtr->Self);
@@ -710,13 +728,14 @@
 /***********************************************************************
  *           UpDownWndProc
  */
-static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
-				LPARAM lParam)
+static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
     DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
     int temp;
 
+    TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam);
+
     if (!infoPtr && (message != WM_CREATE))
         return DefWindowProcW (hwnd, message, wParam, lParam);
 
@@ -750,7 +769,7 @@
 	case WM_DESTROY:
 	    if(infoPtr->AccelVect) Free (infoPtr->AccelVect);
 
-	    if(infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
+	    if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
 
 	    Free (infoPtr);
 	    SetWindowLongPtrW (hwnd, 0, 0);
@@ -821,7 +840,7 @@
 	case WM_LBUTTONDOWN:
 	case WM_MOUSEMOVE:
 	    if(UPDOWN_IsEnabled(infoPtr))
-		UPDOWN_HandleMouseEvent (infoPtr, message, MAKEPOINTS(lParam));
+		UPDOWN_HandleMouseEvent (infoPtr, message, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
 	    break;
 
 	case WM_KEYDOWN:
@@ -842,7 +861,8 @@
 	    return 0;
 
 	case UDM_SETACCEL:
-	    TRACE("UpDown Ctrl new accel info, hwnd=%p\n", hwnd);
+	    TRACE("UDM_SETACCEL\n");
+
 	    if(infoPtr->AccelVect) {
 		Free (infoPtr->AccelVect);
 		infoPtr->AccelCount = 0;
@@ -852,6 +872,11 @@
 	    infoPtr->AccelVect = Alloc (wParam*sizeof(UDACCEL));
 	    if(infoPtr->AccelVect == 0) return FALSE;
 	    memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
+            infoPtr->AccelCount = wParam;
+
+            for (temp = 0; temp < wParam; temp++)
+                TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc);
+
     	    return TRUE;
 
 	case UDM_GETBASE:

reactos/lib/comctl32
winehq2ros.patch 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- winehq2ros.patch	21 Oct 2004 08:38:36 -0000	1.12
+++ winehq2ros.patch	5 Dec 2004 23:09:27 -0000	1.13
@@ -4,7 +4,7 @@
 retrieving revision 1.46
 diff -u -r1.46 comctl32.spec
 --- comctl32.spec	19 Oct 2004 22:59:59 -0000	1.46
-+++ comctl32.spec	21 Oct 2004 08:50:24 -0000
++++ comctl32.spec	5 Dec 2004 22:48:09 -0000
 @@ -106,13 +106,13 @@
  412 stdcall RemoveWindowSubclass(long ptr long)
  413 stdcall DefSubclassProc(long long long long)
@@ -26,13 +26,49 @@
  
  # Functions imported by name
  
+Index: commctrl.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/commctrl.c,v
+retrieving revision 1.88
+diff -u -r1.88 commctrl.c
+--- commctrl.c	19 Oct 2004 22:59:59 -0000	1.88
++++ commctrl.c	5 Dec 2004 22:48:09 -0000
+@@ -482,7 +482,7 @@
+         r.left += 3;
+         if (style & SBT_RTLREADING)
+ 	    FIXME("Unsupported RTL style!\n");
+-        DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE);
++        DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX);
+ 	SetBkMode(hdc, oldbkmode);
+     }
+ }
+Index: datetime.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/datetime.c,v
+retrieving revision 1.49
+diff -u -r1.49 datetime.c
+--- datetime.c	24 Nov 2004 18:28:31 -0000	1.49
++++ datetime.c	5 Dec 2004 22:48:10 -0000
+@@ -814,10 +814,10 @@
+ 
+     TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
+ 
+-    /* use DrawEdge to adjust the size of rcEdge to get rcDraw */
+     memcpy((&infoPtr->rcDraw), (&infoPtr->rcClient), sizeof(infoPtr->rcDraw));
+ 
+-    DrawEdge(NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST);
++    /* subract the size of the edge drawn by DrawEdge */
++    InflateRect(&infoPtr->rcDraw, -2, -2);
+ 
+     /* set the size of the button that drops the calendar down */
+     /* FIXME: account for style that allows button on left side */
 Index: listview.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
-retrieving revision 1.394
-diff -u -r1.394 listview.c
---- listview.c	2 Sep 2004 23:00:53 -0000	1.394
-+++ listview.c	21 Oct 2004 08:50:32 -0000
+retrieving revision 1.398
+diff -u -r1.398 listview.c
+--- listview.c	24 Nov 2004 18:28:31 -0000	1.398
++++ listview.c	5 Dec 2004 22:48:13 -0000
 @@ -146,6 +146,7 @@
  #include <assert.h>
  #include <ctype.h>
@@ -41,7 +77,7 @@
  #include <stdlib.h>
  #include <stdarg.h>
  #include <stdio.h>
-@@ -2022,7 +2023,8 @@
+@@ -2033,7 +2034,8 @@
  		         infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
  	    Label.right = Label.left + labelSize.cx;
  	    Label.bottom = Label.top + infoPtr->nItemHeight;
@@ -51,7 +87,7 @@
  	    {
  		labelSize.cy = min(Box.bottom - Label.top, labelSize.cy);
  		labelSize.cy /= infoPtr->ntmHeight;
-@@ -9511,7 +9513,8 @@
+@@ -9522,7 +9524,8 @@
          hOldFont = SelectObject(hdc, infoPtr->hFont);
  
      /*Get String Length in pixels */
@@ -61,13 +97,35 @@
  
      /*Add Extra spacing for the next character */
      GetTextMetricsW(hdc, &textMetric);
+Index: rebar.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/rebar.c,v
+retrieving revision 1.100
+diff -u -r1.100 rebar.c
+--- rebar.c	24 Nov 2004 18:28:31 -0000	1.100
++++ rebar.c	5 Dec 2004 22:48:14 -0000
+@@ -3786,10 +3786,10 @@
+ 	infoPtr->bands = NULL;
+     }
+ 
+-    DeleteObject (infoPtr->hcurArrow);
+-    DeleteObject (infoPtr->hcurHorz);
+-    DeleteObject (infoPtr->hcurVert);
+-    DeleteObject (infoPtr->hcurDrag);
++    DestroyCursor (infoPtr->hcurArrow);
++    DestroyCursor (infoPtr->hcurHorz);
++    DestroyCursor (infoPtr->hcurVert);
++    DestroyCursor (infoPtr->hcurDrag);
+     if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
+     SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
+ 
 Index: string.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/comctl32/string.c,v
 retrieving revision 1.5
 diff -u -r1.5 string.c
 --- string.c	22 Sep 2004 19:10:27 -0000	1.5
-+++ string.c	21 Oct 2004 08:50:38 -0000
++++ string.c	5 Dec 2004 22:48:15 -0000
 @@ -264,7 +264,7 @@
  {
    TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@@ -86,19 +144,36 @@
  }
  
  /*************************************************************************
+Index: tooltips.c
+===================================================================
+RCS file: /home/wine/wine/dlls/comctl32/tooltips.c,v
+retrieving revision 1.74
+diff -u -r1.74 tooltips.c
+--- tooltips.c	25 Oct 2004 21:44:50 -0000	1.74
++++ tooltips.c	5 Dec 2004 22:48:16 -0000
+@@ -2836,7 +2836,7 @@
+ TOOLTIPS_Unregister (void)
+ {
+     int i;
+-    for (i = 0; i < TTI_ERROR+1; i++)
+-        DeleteObject(hTooltipIcons[i]);
++    for (i = TTI_INFO; i <= TTI_ERROR; i++)
++        DestroyIcon(hTooltipIcons[i]);
+     UnregisterClassW (TOOLTIPS_CLASSW, NULL);
+ }
 Index: treeview.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
-retrieving revision 1.156
-diff -u -r1.156 treeview.c
---- treeview.c	7 Oct 2004 17:34:31 -0000	1.156
-+++ treeview.c	21 Oct 2004 08:50:45 -0000
-@@ -2328,7 +2328,7 @@
+retrieving revision 1.158
+diff -u -r1.158 treeview.c
+--- treeview.c	21 Nov 2004 15:41:08 -0000	1.158
++++ treeview.c	5 Dec 2004 22:48:18 -0000
+@@ -2329,7 +2329,7 @@
  	    SelectObject(hdc, hOldPen);
  	    DeleteObject(hNewPen);
  
 -	    if (height < 16 || width < 16)
-+	    if (height < 32 || width < 32)
++	    if (height < 18 || width < 18)
  	    {
  	        MoveToEx(hdc, centerx - plussize + 1, centery, NULL);
  	        LineTo(hdc, centerx + plussize, centery);
CVSspam 0.2.8