Replaced PTR_SEG_TO_LIN macro by exported MapSL function.
Fixed a few ptr/segptr mismatches.
Moved CONV_RECT/POINT macros to wingdi16.h.

diff --git a/controls/combo.c b/controls/combo.c
index e0594b1..2ca664a 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -1983,12 +1983,12 @@
 	/* Combo messages */
 
 	case CB_ADDSTRING16:
-		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
 	case CB_ADDSTRING:
 		return  SendMessageA( lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
 	case CB_INSERTSTRING16:
 		wParam = (INT)(INT16)wParam;
-		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
 	case CB_INSERTSTRING:
 		return  SendMessageA( lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
 	case CB_DELETESTRING16:
@@ -1996,17 +1996,17 @@
 		return  SendMessageA( lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
 	case CB_SELECTSTRING16:
 		wParam = (INT)(INT16)wParam;
-		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
 	case CB_SELECTSTRING:
 		return  COMBO_SelectString( lphc, (INT)wParam, (LPSTR)lParam );
 	case CB_FINDSTRING16:
 		wParam = (INT)(INT16)wParam;
-		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
 	case CB_FINDSTRING:
 		return  SendMessageA( lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);
 	case CB_FINDSTRINGEXACT16:
 		wParam = (INT)(INT16)wParam;
-		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);
 	case CB_FINDSTRINGEXACT:
 		return  SendMessageA( lphc->hWndLBox, LB_FINDSTRINGEXACT, 
 						       wParam, lParam );
@@ -2049,7 +2049,7 @@
 		    (INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;
 		return  CB_ERR;
 	case CB_GETDROPPEDCONTROLRECT16:
-		lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		lParam = (LPARAM)MapSL(lParam);
 		if( lParam ) 
 		{
 		    RECT	r;
@@ -2064,7 +2064,7 @@
 	case CB_GETDROPPEDSTATE:
 		return  (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;
 	case CB_DIR16: 
-                lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+                lParam = (LPARAM)MapSL(lParam);
                 /* fall through */
 	case CB_DIR:
 		return  COMBO_Directory( lphc, (UINT)wParam, 
@@ -2107,7 +2107,7 @@
 	        return  lParam;
 	case CB_GETLBTEXT16: 
 		wParam = (INT)(INT16)wParam;
-		lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+		lParam = (LPARAM)MapSL(lParam);
 	case CB_GETLBTEXT:
 		return  SendMessageA( lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
 	case CB_GETLBTEXTLEN16: 
diff --git a/controls/edit.c b/controls/edit.c
index 51f0191..a7b52a2 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -23,7 +23,6 @@
 #include "wine/winuser16.h"
 #include "controls.h"
 #include "local.h"
-#include "selectors.h"
 #include "debugtools.h"
 #include "tweak.h"
 
@@ -429,7 +428,7 @@
 	case EM_GETRECT16:
 		DPRINTF_EDIT_MSG16("EM_GETRECT");
 		if (lParam)
-			CONV_RECT32TO16(&es->format_rect, (LPRECT16)PTR_SEG_TO_LIN(lParam));
+			CONV_RECT32TO16(&es->format_rect, MapSL(lParam));
 		break;
 	case EM_GETRECT:
 		DPRINTF_EDIT_MSG32("EM_GETRECT");
@@ -441,7 +440,7 @@
 		DPRINTF_EDIT_MSG16("EM_SETRECT");
 		if ((es->style & ES_MULTILINE) && lParam) {
 			RECT rc;
-			CONV_RECT16TO32((LPRECT16)PTR_SEG_TO_LIN(lParam), &rc);
+			CONV_RECT16TO32(MapSL(lParam), &rc);
 			EDIT_SetRectNP(wnd, es, &rc);
 			EDIT_UpdateText(wnd, NULL, TRUE);
 		}
@@ -458,7 +457,7 @@
 		DPRINTF_EDIT_MSG16("EM_SETRECTNP");
 		if ((es->style & ES_MULTILINE) && lParam) {
 			RECT rc;
-			CONV_RECT16TO32((LPRECT16)PTR_SEG_TO_LIN(lParam), &rc);
+			CONV_RECT16TO32(MapSL(lParam), &rc);
 			EDIT_SetRectNP(wnd, es, &rc);
 		}
 		break;
@@ -586,7 +585,7 @@
 
 	case EM_REPLACESEL16:
 		DPRINTF_EDIT_MSG16("EM_REPLACESEL");
-		lParam = (LPARAM)PTR_SEG_TO_LIN((SEGPTR)lParam);
+		lParam = (LPARAM)MapSL(lParam);
 		/* fall through */
 	case EM_REPLACESEL:
 		DPRINTF_EDIT_MSG32("EM_REPLACESEL");
@@ -610,7 +609,7 @@
 
 	case EM_GETLINE16:
 		DPRINTF_EDIT_MSG16("EM_GETLINE");
-		lParam = (LPARAM)PTR_SEG_TO_LIN((SEGPTR)lParam);
+		lParam = (LPARAM)MapSL(lParam);
 		/* fall through */
 	case EM_GETLINE:
 		DPRINTF_EDIT_MSG32("EM_GETLINE");
@@ -671,7 +670,7 @@
 
 	case EM_SETTABSTOPS16:
 		DPRINTF_EDIT_MSG16("EM_SETTABSTOPS");
-		result = (LRESULT)EDIT_EM_SetTabStops16(es, (INT)wParam, (LPINT16)PTR_SEG_TO_LIN((SEGPTR)lParam));
+		result = (LRESULT)EDIT_EM_SetTabStops16(es, (INT)wParam, MapSL(lParam));
 		break;
 	case EM_SETTABSTOPS:
 		DPRINTF_EDIT_MSG32("EM_SETTABSTOPS");
diff --git a/controls/listbox.c b/controls/listbox.c
index 18bebd5..f6f3d41 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -15,7 +15,6 @@
 #include "winerror.h"
 #include "heap.h"
 #include "spy.h"
-#include "selectors.h"
 #include "win.h"
 #include "controls.h"
 #include "debugtools.h"
@@ -2494,21 +2493,21 @@
         return 0;
 
     case LB_ADDSTRING16:
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_ADDSTRING:
         wParam = LISTBOX_FindStringPos( wnd, descr, (LPCSTR)lParam, FALSE );
         return LISTBOX_InsertString( wnd, descr, wParam, (LPCSTR)lParam );
 
     case LB_INSERTSTRING16:
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         wParam = (INT)(INT16)wParam;
         /* fall through */
     case LB_INSERTSTRING:
         return LISTBOX_InsertString( wnd, descr, wParam, (LPCSTR)lParam );
 
     case LB_ADDFILE16:
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_ADDFILE:
         wParam = LISTBOX_FindFileStrPos( wnd, descr, (LPCSTR)lParam );
@@ -2539,7 +2538,7 @@
         return descr->nb_items;
 
     case LB_GETTEXT16:
-        lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_GETTEXT:
         return LISTBOX_GetText( wnd, descr, wParam, (LPSTR)lParam );
@@ -2621,7 +2620,7 @@
         {
             RECT rect;
             ret = LISTBOX_GetItemRect( wnd, descr, (INT16)wParam, &rect );
-            CONV_RECT32TO16( &rect, (RECT16 *)PTR_SEG_TO_LIN(lParam) );
+            CONV_RECT32TO16( &rect, MapSL(lParam) );
         }
 	return ret;
 
@@ -2630,21 +2629,21 @@
 
     case LB_FINDSTRING16:
         wParam = (INT)(INT16)wParam;
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_FINDSTRING:
         return LISTBOX_FindString( wnd, descr, wParam, (LPCSTR)lParam, FALSE );
 
     case LB_FINDSTRINGEXACT16:
         wParam = (INT)(INT16)wParam;
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_FINDSTRINGEXACT:
         return LISTBOX_FindString( wnd, descr, wParam, (LPCSTR)lParam, TRUE );
 
     case LB_SELECTSTRING16:
         wParam = (INT)(INT16)wParam;
-        if (HAS_STRINGS(descr)) lParam = (LPARAM)PTR_SEG_TO_LIN(lParam);
+        if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
         /* fall through */
     case LB_SELECTSTRING:
         {
@@ -2684,7 +2683,7 @@
 
     case LB_GETSELITEMS16:
         return LISTBOX_GetSelItems16( wnd, descr, wParam,
-                                      (LPINT16)PTR_SEG_TO_LIN(lParam) );
+                                      (LPINT16)MapSL(lParam) );
 
     case LB_GETSELITEMS:
         return LISTBOX_GetSelItems( wnd, descr, wParam, (LPINT)lParam );
@@ -2730,8 +2729,7 @@
         /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
          * be set automatically (this is different in Win32) */
         if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE;
-        return LISTBOX_Directory( wnd, descr, wParam,
-                                  (LPCSTR)PTR_SEG_TO_LIN(lParam), FALSE );
+        return LISTBOX_Directory( wnd, descr, wParam, MapSL(lParam), FALSE );
 
     case LB_DIR:
         return LISTBOX_Directory( wnd, descr, wParam, (LPCSTR)lParam, TRUE );
@@ -2750,8 +2748,7 @@
         return LISTBOX_SetCount( wnd, descr, (INT)wParam );
 
     case LB_SETTABSTOPS16:
-        return LISTBOX_SetTabStops( wnd, descr, (INT)(INT16)wParam,
-                                    (LPINT)PTR_SEG_TO_LIN(lParam), TRUE );
+        return LISTBOX_SetTabStops( wnd, descr, (INT)(INT16)wParam, MapSL(lParam), TRUE );
 
     case LB_SETTABSTOPS:
         return LISTBOX_SetTabStops( wnd, descr, wParam, (LPINT)lParam, FALSE );
@@ -2871,7 +2868,7 @@
     case WM_DRAGMOVE:
 	if( !descr->lphc )
         {
-            LPDRAGINFO16 dragInfo = (LPDRAGINFO16)PTR_SEG_TO_LIN( (SEGPTR)lParam );
+            LPDRAGINFO16 dragInfo = MapSL( lParam );
             dragInfo->l = LISTBOX_GetItemFromPoint( wnd, descr, dragInfo->pt.x,
                                                 dragInfo->pt.y );
             return SendMessageA( descr->owner, msg, wParam, lParam );
diff --git a/controls/menu.c b/controls/menu.c
index f825a38..685040a 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -3609,8 +3609,7 @@
     UINT pos32 = (UINT)pos;
     if ((pos == (UINT16)-1) && (flags & MF_BYPOSITION)) pos32 = (UINT)-1;
     if (IS_STRING_ITEM(flags) && data)
-        return InsertMenuA( hMenu, pos32, flags, id,
-                              (LPSTR)PTR_SEG_TO_LIN(data) );
+        return InsertMenuA( hMenu, pos32, flags, id, MapSL(data) );
     return InsertMenuA( hMenu, pos32, flags, id, (LPSTR)data );
 }
 
@@ -3770,8 +3769,7 @@
                             UINT16 id, SEGPTR data )
 {
     if (IS_STRING_ITEM(flags))
-        return ModifyMenuA( hMenu, pos, flags, id,
-                              (LPSTR)PTR_SEG_TO_LIN(data) );
+        return ModifyMenuA( hMenu, pos, flags, id, MapSL(data) );
     return ModifyMenuA( hMenu, pos, flags, id, (LPSTR)data );
 }
 
@@ -4704,7 +4702,7 @@
 
     miia.cbSize        = sizeof(miia);
     miia.fMask         = mii->fMask;
-    miia.dwTypeData    = mii->dwTypeData;
+    miia.dwTypeData    = (LPSTR)mii->dwTypeData;
     miia.fType         = mii->fType;
     miia.fState        = mii->fState;
     miia.wID           = mii->wID;
@@ -4714,7 +4712,7 @@
     miia.dwItemData    = mii->dwItemData;
     miia.cch           = mii->cch;
     if (IS_STRING_ITEM(miia.fType))
-        miia.dwTypeData = PTR_SEG_TO_LIN(miia.dwTypeData);
+        miia.dwTypeData = MapSL(mii->dwTypeData);
     return InsertMenuItemA( hmenu, pos, byposition, &miia );
 }