Release 960324

Sun Mar 24 13:13:11 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [include/win.h] [windows/*.c]
	Replaced next, parent, child and owner handles by pointers in WND
	structure. This should improve performance, and should be
	reasonably safe since Microsoft did the same in Win95.

	* [include/wintypes.h] [*/*]
	Redefined HANDLE to be UINT instead of a pointer for Winelib. This
	allows removing a lot of unnecessary casts and NPFMTs.

	* [windows/caret.c]
	Create the caret brush upon CreateCaret(); use the bitmap
	dimensions for the caret.
	Fixed CARET_DisplayCaret() to use PatBlt().

Fri Mar 22 16:00:00 1996  Anand Kumria <akumria@ozemail.com.au>

	* [misc/winsocket.c]
	More sanity checks, fixup some erroneous return codes.

	* [documentation/winsock]
	Description of how compatible the winsock is currently.

Fri Mar 22 13:05:34 1996  Ulrich Schmid  <uschmid@mail.hh.provi.de>

	* [library/winmain.c]
	Set `lpszCmdParam' by concatenating arguments.

	* [loader/module.c]
	WinExec: accept Unix commands, use Wine emulator.

Mon Mar 18 12:16:27 1996  Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
	DeleteCriticalSection, EnterCriticalSection,
 	InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
 	TlsFree, TlsGetValue, TlsSetValue: new functions.
	CRITICAL_SECTION: new structure.

	* [if1632/kernel32.spec][win32/code_page.c]
	WideCharToMultiByte: new function.

	* [if1632/kernel32.spec][win32/file.c]
	GetFileAttributesA: new function.

	* [if1632/kernel32.spec][misc/main.c]
	GetEnvironmentStringsW, FreeEnvironmentStringsA,
 	FreeEnvironmentStringsW: new functions.
	
	* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
	cursoricon32.c: new file.
	LoadCursorA, LoadCursorW: modified implementation from LoadCursor
 	to WIN32_*.
	LoadIconA, LoadIconW: modified implementation from LoadIconA32
	to WIN32_*.

	* [include/struct32.h]
	pragma pack inserted.
	CURSORICON32 structures added.

	* [include/winnls.h]
	Constants CP_* and WC_* added.

	* [loader/pe_image.c]
	PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.

Sun Mar 17 16:59:12 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [misc/commdlg.c]
	Introduced hook function handling in file dialog.
	Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().

Thu Mar 14 10:50:00 1996  Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>

	* [if1632/gdi32.spec]
	Added GetNearestColor.

	* [if1632/kernel32.spec]
	Added GlobalAddAtomA.

	* [win32/param32.c]
	Added stackframe.h to includes.
	WIN32_GlobalAddAtomA() - new function.
diff --git a/controls/button.c b/controls/button.c
index 9310643..80bd0f4 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -161,8 +161,7 @@
                     }
 #ifdef WINELIB32
                     SendMessage( GetParent(hWnd), WM_COMMAND,
-                                 MAKEWPARAM(wndPtr->wIDmenu,BN_CLICKED),
-				 (LPARAM) hWnd );
+                                 MAKEWPARAM(wndPtr->wIDmenu,BN_CLICKED), hWnd);
 #else
                     SendMessage( GetParent(hWnd), WM_COMMAND,
                                  wndPtr->wIDmenu, MAKELPARAM(hWnd,BN_CLICKED));
@@ -199,7 +198,7 @@
                 break;
 
         case WM_GETFONT:
-                return (LONG) infoPtr->hFont;
+                return infoPtr->hFont;
 
 	case WM_SETFOCUS:
                 infoPtr->state |= BUTTON_HASFOCUS;
@@ -281,8 +280,7 @@
       /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
     if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
 #ifdef WINELIB32
-    SendMessage( GetParent(hButton), WM_CTLCOLORBTN,
-		 (WPARAM)hDC, (LPARAM)hButton );
+    SendMessage( GetParent(hButton), WM_CTLCOLORBTN, hDC, hButton );
 #else
     SendMessage( GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
                  MAKELPARAM(hButton, CTLCOLOR_BTN) );
@@ -340,8 +338,8 @@
         }
     }
 
-    SelectObject(hDC, (HANDLE)hOldPen);
-    SelectObject(hDC, (HANDLE)hOldBrush);
+    SelectObject( hDC, hOldPen );
+    SelectObject( hDC, hOldBrush );
 }
 
 
@@ -364,10 +362,9 @@
 
     if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
 #ifdef WINELIB32 /* JBP: Different in Win32 */
-    hBrush = (HBRUSH) SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC,
-				  (LPARAM)hWnd);
+    hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd);
 #else
-    hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
+    hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, hDC,
 			 MAKELPARAM(hWnd, CTLCOLOR_BTN));
 #endif
     if (action == ODA_DRAWENTIRE) FillRect(hDC, &rc, hBrush);
@@ -444,9 +441,9 @@
 
     if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
 #ifdef WINELIB32
-    SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hWnd );
+    SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd );
 #else
-    SendMessage( GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
+    SendMessage( GetParent(hWnd), WM_CTLCOLOR, hDC,
 		 MAKELPARAM(hWnd, CTLCOLOR_BTN));
 #endif
     SelectObject( hDC, sysColorObjects.hpenWindowFrame );
@@ -487,8 +484,7 @@
 
     if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
 #ifdef WINELIB32
-    hBrush = (HBRUSH) SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC,
-				  (LPARAM)hWnd);
+    hBrush = SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd );
 #else
     hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
 			 MAKELPARAM(hWnd, CTLCOLOR_BTN));
diff --git a/controls/combo.c b/controls/combo.c
index 338c0c8..f637b0f 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -175,7 +175,7 @@
 				0, 0, WIN_GetWindowInstance(hwnd),
 				(SEGPTR)hwnd );
   ShowWindow(lphc->hWndLBox, SW_HIDE);
-  dprintf_combo(stddeb,"Combo Creation LBox="NPFMT"!\n", lphc->hWndLBox);
+  dprintf_combo(stddeb,"Combo Creation LBox=%04x\n", lphc->hWndLBox);
   return 0;
 }
 
@@ -226,8 +226,7 @@
   hOldFont = SelectObject(hdc, lphl->hFont);
 
 #ifdef WINELIB32
-  hBrush = (HBRUSH) SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, (WPARAM)hdc,
-				(LPARAM)hwnd);
+  hBrush = SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, hdc, hwnd);
 #else
   hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc,
 		       MAKELONG(hwnd, CTLCOLOR_LISTBOX));
@@ -473,7 +472,7 @@
 
   wRet = ListBoxSetCurSel(lphl, wParam);
 
-  dprintf_combo(stddeb,"CBSetCurSel: hwnd "NPFMT" wp %x lp %lx wRet %d\n",
+  dprintf_combo(stddeb,"CBSetCurSel: hwnd %04x wp %x lp %lx wRet %d\n",
 		hwnd,wParam,lParam,wRet);
 /*  SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/
   InvalidateRect(hwnd, NULL, TRUE);
@@ -756,8 +755,7 @@
 
   hOldFont = SelectObject(hdc, lphl->hFont);
 #ifdef WINELIB32
-  hBrush = (HBRUSH) SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, (WPARAM)hdc,
-				(LPARAM)hwnd);
+  hBrush = SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, hdc, hwnd);
 #else
   hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc,
 		       MAKELONG(hwnd, CTLCOLOR_LISTBOX));
@@ -783,7 +781,8 @@
       lpls->itemRect.left   = rect.left;
       lpls->itemRect.right  = rect.right;
 
-      dprintf_listbox(stddeb,"drawing item: %ld %d %ld %d %d\n",(LONG)rect.left,top,(LONG)rect.right,top+height,lpls->itemState);
+      dprintf_listbox(stddeb,"drawing item: %d %d %d %d %d\n",
+                      rect.left,top,rect.right,top+height,lpls->itemState);
       if (lphl->OwnerDrawn) {
 	ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0);
 	if (lpls->itemState)
@@ -891,7 +890,7 @@
   ListBoxGetItemRect(lphl, wRet, &rectsel);
   GetClientRect(hwnd, &rect);
 
-  dprintf_combo(stddeb,"CBLMouseMove: hwnd "NPFMT" wp %x lp %lx  y %d  if %d wret %d %d,%d-%d,%d\n",
+  dprintf_combo(stddeb,"CBLMouseMove: hwnd %04x wp %x lp %lx  y %d  if %d wret %d %d,%d-%d,%d\n",
 hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.right,rectsel.bottom);
   
   if ((wParam & MK_LBUTTON) != 0) {
@@ -997,7 +996,7 @@
  */
 BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, INT nIDLBox)
 {
-	fprintf(stdnimp,"DlgDirSelectComboBox("NPFMT", '%s', %d) \n",
+	fprintf(stdnimp,"DlgDirSelectComboBox(%04x, '%s', %d) \n",
 				hDlg, lpStr, nIDLBox);
 	return TRUE;
 }
@@ -1011,7 +1010,7 @@
 {
     INT ret = 0;
 
-    dprintf_combo( stddeb,"DlgDirListComboBox("NPFMT",%08lx,%d,%d,%04X) \n",
+    dprintf_combo( stddeb,"DlgDirListComboBox(%04x,%08lx,%d,%d,%04X) \n",
                    hDlg, (DWORD)path, idCBox, idStatic, wType );
 
     if (idCBox)
diff --git a/controls/edit.c b/controls/edit.c
index 9eeb811..4537c02 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -743,14 +743,14 @@
     /* make sure rectangle is within window */
     if (rc.left >= es->ClientWidth - 1)
     {
-	dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.left (%ld) is greater than right edge\n",
-	       (LONG)rc.left);
+	dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.left (%d) is greater than right edge\n",
+	       rc.left);
 	return;
     }
     if (rc.right <= 0)
     {
-	dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.right (%ld) is less than left edge\n",
-	       (LONG)rc.right);
+	dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.right (%d) is less than left edge\n",
+	       rc.right);
 	return;
     }
     if (y - es->wtop < (rc.top / es->txtht) || 
@@ -2008,8 +2008,8 @@
 	es->textwidth = 0;
 	es->SelBegLine = es->SelBegCol = 0;
 	es->SelEndLine = es->SelEndCol = 0;
-	dprintf_edit(stddeb, "EDIT_SetHandleMsg: handle %04lx, textlen=%d\n",
-		     (DWORD)wParam, es->textlen);
+	dprintf_edit(stddeb, "EDIT_SetHandleMsg: handle %04x, textlen=%d\n",
+		     wParam, es->textlen);
 
 	EDIT_BuildTextPointers(hwnd);
 	es->PaintBkgd = TRUE;
@@ -2353,8 +2353,8 @@
     GetClientRect(hwnd, &rc);
     IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
 
-    dprintf_edit(stddeb,"WM_PAINT: rc=(%ld,%ld), (%ld,%ld)\n", (LONG)rc.left, 
-           (LONG)rc.top, (LONG)rc.right, (LONG)rc.bottom);
+    dprintf_edit(stddeb,"WM_PAINT: rc=(%d,%d), (%d,%d)\n",
+                 rc.left, rc.top, rc.right, rc.bottom);
 
     if (es->PaintBkgd)
 	FillWindow(GetParent(hwnd), hwnd, hdc, (HBRUSH)CTLCOLOR_EDIT);
diff --git a/controls/listbox.c b/controls/listbox.c
index e255cbd..6bba90f 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -1253,7 +1253,7 @@
 {
   LPHEADLIST  lphl = ListBoxGetStorageHeader(hwnd);
 
-  dprintf_listbox(stddeb,"ListBox WM_SETREDRAW hWnd="NPFMT" w=%04X !\n",
+  dprintf_listbox(stddeb,"ListBox WM_SETREDRAW hWnd=%04x w=%04x !\n",
 		  hwnd, wParam);
   lphl->bRedrawFlag = wParam;
 
@@ -1365,8 +1365,8 @@
 
       if( IntersectRect(&scratchRect,&paintRect,&lpls->itemRect) )
        {
-        dprintf_listbox(stddeb,"LBPaint: drawing item: %ld %d %ld %d %d\n",(LONG)rect.left,top,
-                            (LONG)rect.right,top+height,lpls->itemState);
+        dprintf_listbox(stddeb,"LBPaint: drawing item: %d %d %d %d %d\n",
+                        rect.left,top,rect.right,top+height,lpls->itemState);
 
         if (lphl->OwnerDrawn && (lphl->ItemFocused == i) && GetFocus() == hwnd)
            {
@@ -1401,7 +1401,7 @@
 {
   LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
 
-  dprintf_listbox(stddeb,"ListBox WM_SETFOCUS for "NPFMT"\n",hwnd);
+  dprintf_listbox(stddeb,"ListBox WM_SETFOCUS for %04x\n",hwnd);
   if(!(lphl->dwStyle & LBS_MULTIPLESEL) )
        if( lphl->ItemsCount && lphl->ItemFocused != -1)
          {
@@ -1429,7 +1429,7 @@
 {
   LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
 
-  dprintf_listbox(stddeb,"ListBox WM_KILLFOCUS for "NPFMT"\n",hwnd);
+  dprintf_listbox(stddeb,"ListBox WM_KILLFOCUS for %04x\n",hwnd);
   if (!(lphl->dwStyle & LBS_MULTIPLESEL))
      {
        if( lphl->ItemsCount )
@@ -1780,7 +1780,7 @@
 
   if (!(lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL) )) return 0;
 
-  dprintf_listbox(stddeb,"LBSetCaretIndex: hwnd "NPFMT" n=%i\n",hwnd,wParam);  
+  dprintf_listbox(stddeb,"LBSetCaretIndex: hwnd %04x n=%i\n",hwnd,wParam);  
 
   if (wParam >= lphl->ItemsCount) return LB_ERR;
 
@@ -1946,9 +1946,9 @@
   WND* ptrWnd = WIN_FindWndPtr(hwnd);  
 
   if( ptrWnd )
-	if( /* !(ptrWnd->dwExStyle & WS_EX_NOPARENTNOTIFY) && */ 
-                 ptrWnd->hwndParent ) 
-		 return SendMessage(ptrWnd->hwndParent,message,wParam,lParam);
+      if( /* !(ptrWnd->dwExStyle & WS_EX_NOPARENTNOTIFY) && */ 
+          ptrWnd->parent ) 
+          return SendMessage(ptrWnd->parent->hwndSelf,message,wParam,lParam);
   return 0;
 }
 
@@ -2044,8 +2044,7 @@
     char buffer[20];
     INT i;
 
-    dprintf_listbox( stddeb, "DlgDirSelect: "NPFMT" '%s' %d\n",
-                     hDlg, lpStr, id );
+    dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id );
     if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR)
         return FALSE;
     SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, MAKE_SEGPTR(buffer) );
@@ -2083,7 +2082,7 @@
     ((attrib & DDL_POSTMSGS) ? PostMessage( hwnd, msg, wparam, lparam ) \
                              : SendMessage( hwnd, msg, wparam, lparam ))
 
-    dprintf_listbox( stddeb, "DlgDirList: "NPFMT" '%s' %d %d %04x\n",
+    dprintf_listbox( stddeb, "DlgDirList: %04x '%s' %d %d %04x\n",
                      hDlg, filespec ? filespec : "NULL",
                      idLBox, idStatic, attrib );
 
diff --git a/controls/menu.c b/controls/menu.c
index 00c2129..0457c11 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -126,7 +126,7 @@
     }
     menu = (POPUPMENU*) USER_HEAP_LIN_ADDR(hMenu);
     menu->wFlags |= MF_SYSMENU | MF_POPUP;
-    dprintf_menu(stddeb,"CopySysMenu hMenu="NPFMT" !\n", hMenu);
+    dprintf_menu(stddeb,"CopySysMenu hMenu=%04x !\n", hMenu);
     return hMenu;
 }
 
@@ -252,7 +252,7 @@
     }
 #ifdef WINELIB32
     menuchar = SendMessage( hwndOwner, WM_MENUCHAR, 
-			    MAKEWPARAM(key,menu->wFlags), (LPARAM)hmenu );
+			    MAKEWPARAM(key,menu->wFlags), hmenu );
 #else
     menuchar = SendMessage( hwndOwner, WM_MENUCHAR, key,
 			    MAKELONG( menu->wFlags, hmenu ) );
@@ -413,8 +413,8 @@
 
     if ((lprect == NULL) || (lppop == NULL)) return;
     if (lppop->nItems == 0) return;
-    dprintf_menu(stddeb,"MENU_MenuBarCalcSize left=%ld top=%ld right=%ld bottom=%ld !\n", 
-		(LONG)lprect->left, (LONG)lprect->top, (LONG)lprect->right, (LONG)lprect->bottom);
+    dprintf_menu(stddeb,"MENU_MenuBarCalcSize left=%d top=%d right=%d bottom=%d\n", 
+                 lprect->left, lprect->top, lprect->right, lprect->bottom);
     items = (MENUITEM *)USER_HEAP_LIN_ADDR( lppop->hItems );
     lppop->Width  = lprect->right - lprect->left;
     lppop->Height = 0;
@@ -495,7 +495,7 @@
         dis.hwndItem   = hwnd;
         dis.hDC        = hdc;
         dis.rcItem     = lpitem->rect;
-        SendMessage( hwnd, WM_DRAWITEM, 0, MAKE_SEGPTR(&dis) );
+        SendMessage( hwnd, WM_DRAWITEM, 0, (LPARAM)MAKE_SEGPTR(&dis) );
         return;
     }
 
@@ -655,7 +655,7 @@
     
     lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU)wndPtr->wIDmenu );
     if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU;
-    dprintf_menu(stddeb,"MENU_DrawMenuBar("NPFMT", %p, %p); !\n", 
+    dprintf_menu(stddeb,"MENU_DrawMenuBar(%04x, %p, %p); !\n", 
 		 hDC, lprect, lppop);
     if (lppop->Height == 0) MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
     lprect->bottom = lprect->top + lppop->Height;
@@ -794,7 +794,7 @@
 /* FIX: Lost Info */
     else SendMessage( hwndOwner, WM_MENUSELECT, 
 		      MAKEWPARAM( (DWORD)hmenu, lppop->wFlags | MF_MOUSESELECT),
-		      (LPARAM)hmenu );
+		      hmenu );
 #else
     else SendMessage( hwndOwner, WM_MENUSELECT, hmenu,
                       MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
@@ -920,7 +920,7 @@
             strcpy( (char *)USER_HEAP_LIN_ADDR( hText ), str );
         }
     }
-    else if (flags & MF_BITMAP) item->hText = (HANDLE)(DWORD)data;
+    else if (flags & MF_BITMAP) item->hText = (HANDLE)data;
     else if (flags & MF_OWNERDRAW) SET_OWNERDRAW_DATA( item, data );
     else item->hText = 0;
 
@@ -945,7 +945,7 @@
 
     if (!(menu = (POPUPMENU *)USER_HEAP_LIN_ADDR(hMenu))) 
     {
-        dprintf_menu( stddeb, "MENU_InsertItem: "NPFMT" not a menu handle\n",
+        dprintf_menu( stddeb, "MENU_InsertItem: %04x not a menu handle\n",
                       hMenu );
         return NULL;
     }
@@ -969,7 +969,7 @@
         }
         if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu)))
         {
-            dprintf_menu(stddeb,"MENU_InsertItem: "NPFMT" not a menu handle\n",
+            dprintf_menu(stddeb,"MENU_InsertItem: %04x not a menu handle\n",
                          hMenu);
             return NULL;
         }
@@ -1670,7 +1670,7 @@
 	    CREATESTRUCT *createStruct = (CREATESTRUCT*)PTR_SEG_TO_LIN(lParam);
 #ifdef WINELIB32
 	    HMENU hmenu = (HMENU) (createStruct->lpCreateParams);
-	    SetWindowLong( hwnd, 0, (LONG)hmenu );
+	    SetWindowLong( hwnd, 0, hmenu );
 #else
 	    HMENU hmenu = (HMENU) ((int)createStruct->lpCreateParams & 0xffff);
 	    SetWindowWord( hwnd, 0, hmenu );
@@ -1731,8 +1731,8 @@
  */
 BOOL ChangeMenu( HMENU hMenu, UINT pos, SEGPTR data, UINT id, UINT flags )
 {
-    dprintf_menu( stddeb,"ChangeMenu: menu="NPFMT" pos=%d data=%08lx id=%04x flags=%04x\n",
-                  hMenu, pos, data, id, flags );
+    dprintf_menu( stddeb,"ChangeMenu: menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n",
+                  hMenu, pos, (DWORD)data, id, flags );
     if (flags & MF_APPEND)
     {
         return AppendMenu( hMenu, flags & ~MF_APPEND, id, data );
@@ -1766,8 +1766,7 @@
     MENUITEM *item;
     INT ret;
 
-    dprintf_menu( stddeb,"CheckMenuItem: "NPFMT" %04x %04x\n", 
-                  hMenu, id, flags );
+    dprintf_menu( stddeb,"CheckMenuItem: %04x %04x %04x\n", hMenu, id, flags );
     if (!(item = MENU_FindItem( &hMenu, &id, flags ))) return -1;
     ret = item->item_flags & MF_CHECKED;
     if (flags & MF_CHECKED) item->item_flags |= MF_CHECKED;
@@ -1782,7 +1781,7 @@
 BOOL EnableMenuItem(HMENU hMenu, UINT wItemID, UINT wFlags)
 {
     LPMENUITEM 	lpitem;
-    dprintf_menu(stddeb,"EnableMenuItem ("NPFMT", %04X, %04X) !\n", 
+    dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n", 
 		 hMenu, wItemID, wFlags);
     if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return FALSE;
 
@@ -1811,7 +1810,7 @@
 {
     LPMENUITEM lpitem;
 
-    dprintf_menu( stddeb, "GetMenuString: menu="NPFMT" item=%04x ptr=%p len=%d flags=%04x\n",
+    dprintf_menu( stddeb, "GetMenuString: menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
                  hMenu, wItemID, str, nMaxSiz, wFlags );
     if (!str || !nMaxSiz) return 0;
     str[0] = '\0';
@@ -1830,8 +1829,8 @@
 {
     LPPOPUPMENU menu;
     LPMENUITEM  lpitem;
-    dprintf_menu(stddeb,"HiliteMenuItem("NPFMT", "NPFMT", %04X, %04X);\n", 
-						hWnd, hMenu, wItemID, wHilite);
+    dprintf_menu(stddeb,"HiliteMenuItem(%04x, %04x, %04x, %04x);\n", 
+                 hWnd, hMenu, wItemID, wHilite);
     if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wHilite ))) return FALSE;
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
     if (menu->FocusedItem == wItemID) return TRUE;
@@ -1847,7 +1846,7 @@
 UINT GetMenuState(HMENU hMenu, UINT wItemID, UINT wFlags)
 {
     LPMENUITEM lpitem;
-    dprintf_menu(stddeb,"GetMenuState("NPFMT", %04X, %04X);\n", 
+    dprintf_menu(stddeb,"GetMenuState(%04x, %04x, %04x);\n", 
 		 hMenu, wItemID, wFlags);
     if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
     if (lpitem->item_flags & MF_POPUP)
@@ -1866,10 +1865,10 @@
 INT GetMenuItemCount(HMENU hMenu)
 {
 	LPPOPUPMENU	menu;
-	dprintf_menu(stddeb,"GetMenuItemCount("NPFMT");\n", hMenu);
+	dprintf_menu(stddeb,"GetMenuItemCount(%04x);\n", hMenu);
 	menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
 	if (menu == NULL) return (UINT)-1;
-	dprintf_menu(stddeb,"GetMenuItemCount("NPFMT") return %d \n", 
+	dprintf_menu(stddeb,"GetMenuItemCount(%04x) return %d \n", 
 		     hMenu, menu->nItems);
 	return menu->nItems;
 }
@@ -1883,7 +1882,7 @@
     LPPOPUPMENU	menu;
     MENUITEM *item;
 
-    dprintf_menu(stddeb,"GetMenuItemID("NPFMT", %d);\n", hMenu, nPos);
+    dprintf_menu(stddeb,"GetMenuItemID(%04x, %d);\n", hMenu, nPos);
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return -1;
     if ((nPos < 0) || (nPos >= menu->nItems)) return -1;
     item = (MENUITEM *) USER_HEAP_LIN_ADDR( menu->hItems );
@@ -1900,9 +1899,9 @@
     MENUITEM *item;
 
     if (IS_STRING_ITEM(flags) && data)
-        dprintf_menu( stddeb, "InsertMenu: "NPFMT" %d %04x %04x '%s'\n",
+        dprintf_menu( stddeb, "InsertMenu: %04x %d %04x %04x '%s'\n",
                       hMenu, pos, flags, id, (char *)PTR_SEG_TO_LIN(data) );
-    else dprintf_menu( stddeb, "InsertMenu: "NPFMT" %d %04x %04x %08lx\n",
+    else dprintf_menu( stddeb, "InsertMenu: %04x %d %04x %04x %08lx\n",
                        hMenu, pos, flags, id, (DWORD)data );
 
     if (!(item = MENU_InsertItem( hMenu, pos, flags ))) return FALSE;
@@ -1938,7 +1937,7 @@
 {
     LPPOPUPMENU	menu;
     LPMENUITEM 	lpitem;
-	dprintf_menu(stddeb,"RemoveMenu ("NPFMT", %04X, %04X) !\n", 
+	dprintf_menu(stddeb,"RemoveMenu (%04x, %04x, %04x) !\n", 
 		     hMenu, nPos, wFlags);
     if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
@@ -1990,13 +1989,13 @@
 
     if (IS_STRING_ITEM(flags))
     {
-	dprintf_menu( stddeb, "ModifyMenu: "NPFMT" %d %04x %04x '%s'\n",
+	dprintf_menu( stddeb, "ModifyMenu: %04x %d %04x %04x '%s'\n",
                       hMenu, pos, flags, id,
                       data ? (char *)PTR_SEG_TO_LIN(data) : "#NULL#");
         if (!data) return FALSE;
     }
     else
-	dprintf_menu( stddeb, "ModifyMenu: "NPFMT" %d %04x %04x %08lx\n",
+	dprintf_menu( stddeb, "ModifyMenu: %04x %d %04x %04x %08lx\n",
                       hMenu, pos, flags, id, (DWORD)data );
     if (!(item = MENU_FindItem( &hMenu, &pos, flags ))) return FALSE;
 
@@ -2032,11 +2031,11 @@
  *			SetMenuItemBitmaps	[USER.418]
  */
 BOOL SetMenuItemBitmaps(HMENU hMenu, UINT nPos, UINT wFlags,
-		HBITMAP hNewUnCheck, HBITMAP hNewCheck)
+                        HBITMAP hNewUnCheck, HBITMAP hNewCheck)
 {
     LPMENUITEM lpitem;
-   dprintf_menu(stddeb,"SetMenuItemBitmaps ("NPFMT", %04X, %04X, "NPFMT", %08lX) !\n",
-	    hMenu, nPos, wFlags, hNewCheck, (DWORD)hNewUnCheck);
+   dprintf_menu(stddeb,"SetMenuItemBitmaps(%04x, %04x, %04x, %04x, %04x)\n",
+                hMenu, nPos, wFlags, hNewCheck, hNewUnCheck);
     if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
 
     if (!hNewCheck && !hNewUnCheck)
@@ -2077,7 +2076,7 @@
     menu->hWnd   = 0;
     menu->hItems = 0;
     menu->FocusedItem = NO_SELECTED_ITEM;
-    dprintf_menu(stddeb,"CreateMenu // return "NPFMT"\n", hMenu);
+    dprintf_menu(stddeb,"CreateMenu // return %04x\n", hMenu);
     return hMenu;
 }
 
@@ -2088,7 +2087,7 @@
 BOOL DestroyMenu(HMENU hMenu)
 {
     LPPOPUPMENU lppop;
-    dprintf_menu(stddeb,"DestroyMenu ("NPFMT") !\n", hMenu);
+    dprintf_menu(stddeb,"DestroyMenu (%04x) !\n", hMenu);
     if (hMenu == 0) return FALSE;
     lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
     if (!lppop || (lppop->wMagic != MENU_MAGIC)) return FALSE;
@@ -2110,7 +2109,7 @@
         USER_HEAP_FREE( lppop->hItems );
     }
     USER_HEAP_FREE( hMenu );
-    dprintf_menu(stddeb,"DestroyMenu ("NPFMT") // End !\n", hMenu);
+    dprintf_menu(stddeb,"DestroyMenu (%04x) // End !\n", hMenu);
     return TRUE;
 }
 
@@ -2162,18 +2161,18 @@
 	LPPOPUPMENU lpmenu;
 	WND * wndPtr = WIN_FindWndPtr(hWnd);
 	if (wndPtr == NULL) {
-		fprintf(stderr,"SetMenu("NPFMT", "NPFMT") // Bad window handle !\n",
+		fprintf(stderr,"SetMenu(%04x, %04x) // Bad window handle !\n",
 			hWnd, hMenu);
 		return FALSE;
 		}
-	dprintf_menu(stddeb,"SetMenu("NPFMT", "NPFMT");\n", hWnd, hMenu);
+	dprintf_menu(stddeb,"SetMenu(%04x, %04x);\n", hWnd, hMenu);
 	if (GetCapture() == hWnd) ReleaseCapture();
 	wndPtr->wIDmenu = (UINT)hMenu;
 	if (hMenu != 0)
 	{
 	    lpmenu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
 	    if (lpmenu == NULL) {
-		fprintf(stderr,"SetMenu("NPFMT", "NPFMT") // Bad menu handle !\n", 
+		fprintf(stderr,"SetMenu(%04x, %04x) // Bad menu handle !\n", 
 			hWnd, hMenu);
 		return FALSE;
 		}
@@ -2195,7 +2194,7 @@
 {
     LPPOPUPMENU lppop;
     LPMENUITEM 	lpitem;
-    dprintf_menu(stddeb,"GetSubMenu ("NPFMT", %04X) !\n", hMenu, nPos);
+    dprintf_menu(stddeb,"GetSubMenu (%04x, %04X) !\n", hMenu, nPos);
     if (!(lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return 0;
     if ((UINT)nPos >= lppop->nItems) return 0;
     lpitem = (MENUITEM *) USER_HEAP_LIN_ADDR( lppop->hItems );
@@ -2211,7 +2210,7 @@
 {
 	WND		*wndPtr;
 	LPPOPUPMENU lppop;
-	dprintf_menu(stddeb,"DrawMenuBar ("NPFMT")\n", hWnd);
+	dprintf_menu(stddeb,"DrawMenuBar (%04x)\n", hWnd);
 	wndPtr = WIN_FindWndPtr(hWnd);
 	if (wndPtr != NULL && (wndPtr->dwStyle & WS_CHILD) == 0 && 
 		wndPtr->wIDmenu != 0) {
@@ -2259,11 +2258,11 @@
     if (HIWORD(name))
     {
         char *str = (char *)PTR_SEG_TO_LIN( name );
-        dprintf_menu( stddeb, "LoadMenu("NPFMT",'%s')\n", instance, str );
+        dprintf_menu( stddeb, "LoadMenu(%04x,'%s')\n", instance, str );
         if (str[0] == '#') name = (SEGPTR)atoi( str + 1 );
     }
     else
-        dprintf_resource(stddeb,"LoadMenu("NPFMT",%04x)\n",instance,LOWORD(name));
+        dprintf_resource(stddeb,"LoadMenu(%04x,%04x)\n",instance,LOWORD(name));
 
     if (!name) return 0;
 
diff --git a/controls/scroll.c b/controls/scroll.c
index 8f67f09..9824b3b 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -358,9 +358,8 @@
         if (nBar == SB_CTL)  /* Only scrollbar controls send WM_CTLCOLOR */
         {
 #ifdef WINELIB32
-            HBRUSH hbrush = (HBRUSH)SendMessage( GetParent(hwnd), 
-						 WM_CTLCOLORSCROLLBAR,
-						 (WPARAM)hdc, (LPARAM)hwnd );
+            HBRUSH hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSCROLLBAR,
+                                         hdc, hwnd );
 #else
             HBRUSH hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, hdc,
                                          MAKELONG(hwnd, CTLCOLOR_SCROLLBAR) );
@@ -505,7 +504,7 @@
 static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam )
 {
     WND *wndPtr = WIN_FindWndPtr( hwnd );
-    WORD msg;
+    WPARAM msg;
     
     switch(wParam)
     {
@@ -521,7 +520,7 @@
 #ifdef WINELIB32
     SendMessage( GetParent(hwnd),
                  (wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
-                 (WPARAM)msg, (LPARAM)hwnd );
+                 msg, hwnd );
 #else
     SendMessage( GetParent(hwnd),
                  (wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
@@ -598,8 +597,8 @@
           return;  /* Should never happen */
     }
 
-    dprintf_scroll( stddeb, "ScrollBar Event: hwnd="NPFMT" bar=%d msg=%x pt=%ld,%ld hit=%d\n",
-                    hwnd, nBar, msg, (LONG)pt.x, (LONG)pt.y, hittest );
+    dprintf_scroll( stddeb, "ScrollBar Event: hwnd=%04x bar=%d msg=%x pt=%d,%d hit=%d\n",
+                    hwnd, nBar, msg, pt.x, pt.y, hittest );
 
     switch(trackHitTest)
     {
@@ -615,7 +614,7 @@
             {
 #ifdef WINELIB32
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                             (WPARAM)SB_LINEUP, (LPARAM)hwndCtl );
+                             SB_LINEUP, hwndCtl );
 #else
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_LINEUP, MAKELONG( 0, hwndCtl ));
@@ -638,7 +637,7 @@
             {
 #ifdef WINELIB32
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                             (WPARAM)SB_PAGEUP, (LPARAM)hwndCtl );
+                             SB_PAGEUP, hwndCtl );
 #else
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_PAGEUP, MAKELONG( 0, hwndCtl ));
@@ -682,7 +681,7 @@
                 uTrackingPos = trackThumbPos + pos - lastClickPos;
 #ifdef WINELIB32
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                             MAKEWPARAM(SB_THUMBTRACK,val), (LPARAM)hwndCtl );
+                             MAKEWPARAM(SB_THUMBTRACK,val), hwndCtl );
 #else
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_THUMBTRACK, MAKELONG( val, hwndCtl ));
@@ -703,7 +702,7 @@
             {
 #ifdef WINELIB32
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                             (WPARAM)SB_PAGEDOWN, (LPARAM)hwndCtl );
+                             SB_PAGEDOWN, hwndCtl );
 #else
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_PAGEDOWN, MAKELONG( 0, hwndCtl ));
@@ -725,7 +724,7 @@
             {
 #ifdef WINELIB32
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                             (WPARAM)SB_LINEDOWN, (LPARAM)hwndCtl );
+                             SB_LINEDOWN, hwndCtl );
 #else
                 SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                              SB_LINEDOWN, MAKELONG( 0, hwndCtl ));
@@ -747,7 +746,7 @@
                                  trackThumbPos + lastMousePos - lastClickPos );
 #ifdef WINELIB32
             SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                         MAKEWPARAM(SB_THUMBPOSITION,val), (LPARAM)hwndCtl );
+                         MAKEWPARAM(SB_THUMBPOSITION,val), hwndCtl );
 #else
             SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                          SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) );
@@ -756,7 +755,7 @@
         else
 #ifdef WINELIB32
             SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
-                         (WPARAM)SB_ENDSCROLL, (LPARAM)hwndCtl );
+                         SB_ENDSCROLL, hwndCtl );
 #else
             SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                          SB_ENDSCROLL, MAKELONG( 0, hwndCtl ) );
@@ -812,7 +811,7 @@
             }
         }
         if (!hUpArrow) SCROLL_LoadBitmaps();
-        dprintf_scroll( stddeb, "ScrollBar creation, hwnd="NPFMT"\n", hwnd );
+        dprintf_scroll( stddeb, "ScrollBar creation, hwnd=%04x\n", hwnd );
         return 0;
 	
     case WM_LBUTTONDOWN:
@@ -898,7 +897,7 @@
 
     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return;
 
-    dprintf_scroll( stddeb,"SetScrollRange hwnd="NPFMT" bar=%d min=%d max=%d\n",
+    dprintf_scroll( stddeb,"SetScrollRange hwnd=%04x bar=%d min=%d max=%d\n",
                     hwnd, nBar, MinVal, MaxVal );
 
       /* Invalid range -> range is set to (0,0) */
@@ -936,7 +935,7 @@
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
     if (!wndPtr) return;
-    dprintf_scroll( stddeb, "ShowScrollBar: hwnd="NPFMT" bar=%d on=%d\n", hwnd, wBar, fShow );
+    dprintf_scroll( stddeb, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n", hwnd, wBar, fShow );
 
     switch(wBar)
     {
@@ -1002,7 +1001,7 @@
     HDC hdc;
 
     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
-    dprintf_scroll( stddeb, "EnableScrollBar: "NPFMT" %d %d\n", hwnd, nBar, flags );
+    dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n", hwnd, nBar, flags );
     flags &= ESB_DISABLE_BOTH;
     if (infoPtr->flags == flags) return FALSE;
     infoPtr->flags = flags;
diff --git a/controls/static.c b/controls/static.c
index 11adb0d..eb51961 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -91,9 +91,9 @@
 		if (createStruct->lpszName)
                 {
                     HICON hicon = LoadIcon( createStruct->hInstance,
-                                            (SEGPTR)createStruct->lpszName );
+                                            createStruct->lpszName );
                     if (!hicon)  /* Try OEM icon (FIXME: is this right?) */
-                        hicon = LoadIcon( 0, (SEGPTR)createStruct->lpszName );
+                        hicon = LoadIcon( 0, createStruct->lpszName );
                     STATIC_SetIcon( hWnd, hicon );
                 }
                 return 1;
@@ -159,7 +159,7 @@
             break;
 
         case WM_GETFONT:
-            return (LONG)infoPtr->hFont;
+            return infoPtr->hFont;
 
 	case WM_NCHITTEST:
 	    return HTTRANSPARENT;
@@ -168,10 +168,10 @@
             return DLGC_STATIC;
 
 	case STM_GETICON:
-	    return (LONG)infoPtr->hIcon;
+	    return infoPtr->hIcon;
 
 	case STM_SETICON:
-            lResult = (LONG)STATIC_SetIcon( hWnd, (HICON)wParam );
+            lResult = STATIC_SetIcon( hWnd, (HICON)wParam );
             InvalidateRect( hWnd, NULL, FALSE );
             UpdateWindow( hWnd );
 	    break;
@@ -230,16 +230,14 @@
 
     if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
 #ifdef WINELIB32
-    hBrush = (HBRUSH)SendMessage( wndPtr->hwndParent, WM_CTLCOLORSTATIC,
-				  (WPARAM)hdc, (LPARAM)hwnd );
+    hBrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
 #else
-    hBrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, (WORD)hdc,
+    hBrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
                           MAKELONG(hwnd, CTLCOLOR_STATIC));
 #endif
-    if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
+    if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH);
     FillRect(hdc, &rc, hBrush);
-    if (text)
-	DrawText(hdc, text, -1, &rc, wFormat);
+    if (text) DrawText( hdc, text, -1, &rc, wFormat );
 }
 
 static void PaintRectfn( HWND hwnd, HDC hdc )
@@ -293,10 +291,9 @@
 
     GetClientRect(hwnd, &rc);
 #ifdef WINELIB32
-    hbrush = (HBRUSH)SendMessage( wndPtr->hwndParent, WM_CTLCOLORSTATIC, 
-				  (WPARAM)hdc, (LPARAM)hwnd );
+    hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
 #else
-    hbrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, hdc,
+    hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, hdc,
                           MAKELONG(hwnd, CTLCOLOR_STATIC));
 #endif
     FillRect( hdc, &rc, hbrush );