diff --git a/controls/combo.c b/controls/combo.c index e0594b127ba..2ca664a8e06 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -1983,12 +1983,12 @@ static inline LRESULT WINAPI ComboWndProc_locked( WND* pWnd, UINT message, /* 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 @@ static inline LRESULT WINAPI ComboWndProc_locked( WND* pWnd, UINT message, 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 @@ static inline LRESULT WINAPI ComboWndProc_locked( WND* pWnd, UINT message, (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 @@ static inline LRESULT WINAPI ComboWndProc_locked( WND* pWnd, UINT message, 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 @@ static inline LRESULT WINAPI ComboWndProc_locked( WND* pWnd, UINT message, 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 51f0191f668..a7b52a2e3c2 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 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 18bebd54340..f6f3d417669 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, { 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, /* 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, 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 f825a384853..685040a2701 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -3609,8 +3609,7 @@ BOOL16 WINAPI InsertMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, 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 @@ BOOL16 WINAPI ModifyMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, 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 @@ BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition, 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 @@ BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition, 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 ); } diff --git a/dlls/commdlg/cdlg.h b/dlls/commdlg/cdlg.h index 1470d47570a..2feb104e327 100644 --- a/dlls/commdlg/cdlg.h +++ b/dlls/commdlg/cdlg.h @@ -168,7 +168,7 @@ typedef struct { HWND16 hwndOwner; HWND16 hInstance; COLORREF rgbResult; - COLORREF *lpCustColors; + SEGPTR lpCustColors; DWORD Flags; LPARAM lCustData; LPCCHOOKPROC16 lpfnHook; diff --git a/dlls/commdlg/colordlg.c b/dlls/commdlg/colordlg.c index d2eaf213ec4..524a32f3c1c 100644 --- a/dlls/commdlg/colordlg.c +++ b/dlls/commdlg/colordlg.c @@ -18,7 +18,6 @@ #include "wingdi.h" #include "wine/winbase16.h" #include "wine/winuser16.h" -#include "ldt.h" #include "heap.h" #include "commdlg.h" #include "dlgs.h" @@ -835,7 +834,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 ) ch32->lStructSize = sizeof(CHOOSECOLORW); ch32->hwndOwner = ch16->hwndOwner; ch32->hInstance = ch16->hInstance; - ch32->lpCustColors = PTR_SEG_TO_LIN(ch16->lpCustColors); + ch32->lpCustColors = MapSL(ch16->lpCustColors); ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */ ch32->Flags = ch16->Flags; } @@ -1071,7 +1070,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif } if (lpp->lpcc16) { - BYTE *ptr = PTR_SEG_TO_LIN(lpp->lpcc16->lpCustColors); + BYTE *ptr = MapSL(lpp->lpcc16->lpCustColors); memcpy(ptr, lpp->lpcc->lpCustColors, sizeof(COLORREF)*16); lpp->lpcc16->rgbResult = lpp->lpcc->rgbResult; } @@ -1370,7 +1369,7 @@ BOOL16 WINAPI ChooseColor16( LPCHOOSECOLOR16 lpChCol ) { HANDLE16 hResInfo; if (!(hResInfo = FindResource16(lpChCol->hInstance, - PTR_SEG_TO_LIN(lpChCol->lpTemplateName), + MapSL(lpChCol->lpTemplateName), RT_DIALOGA))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index 52ab0e27832..297ab7aa230 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -15,7 +15,6 @@ #include "wine/winbase16.h" #include "wine/winuser16.h" #include "wine/unicode.h" -#include "ldt.h" #include "heap.h" #include "commdlg.h" #include "debugtools.h" @@ -202,7 +201,7 @@ BOOL Get16BitsTemplate(LFSPRIVATE lfs) { HANDLE16 hResInfo; if (!(hResInfo = FindResource16(ofn16->hInstance, - PTR_SEG_TO_LIN(ofn16->lpTemplateName), + MapSL(ofn16->lpTemplateName), RT_DIALOGA))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); @@ -510,7 +509,7 @@ static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) { LPMEASUREITEMSTRUCT16 lpmeasure; - lpmeasure = (LPMEASUREITEMSTRUCT16)PTR_SEG_TO_LIN(lParam); + lpmeasure = MapSL(lParam); lpmeasure->itemHeight = fldrHeight; return TRUE; } @@ -652,7 +651,7 @@ void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr) /* update the real client structures if any */ if (lfs->ofn16) { - char *dest = PTR_SEG_TO_LIN(lfs->ofn16->lpstrFile); + char *dest = MapSL(lfs->ofn16->lpstrFile); if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1, dest, ofnW->nMaxFile, NULL, NULL )) dest[ofnW->nMaxFile-1] = 0; @@ -685,7 +684,7 @@ void FILEDLG_UpdateFileTitle(LFSPRIVATE lfs) (LPARAM)ofnW->lpstrFileTitle ); if (lfs->ofn16) { - char *dest = PTR_SEG_TO_LIN(lfs->ofn16->lpstrFileTitle); + char *dest = MapSL(lfs->ofn16->lpstrFileTitle); if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFileTitle, -1, dest, ofnW->nMaxFileTitle, NULL, NULL )) dest[ofnW->nMaxFileTitle-1] = 0; @@ -1127,23 +1126,23 @@ void FILEDLG_MapOfnStruct16(LPOPENFILENAME16 ofn16, LPOPENFILENAMEW ofnW, BOOL o ofnA.hwndOwner = ofn16->hwndOwner; ofnA.hInstance = ofn16->hInstance; if (ofn16->lpstrFilter) - ofnA.lpstrFilter = PTR_SEG_TO_LIN(ofn16->lpstrFilter); + ofnA.lpstrFilter = MapSL(ofn16->lpstrFilter); if (ofn16->lpstrCustomFilter) - ofnA.lpstrCustomFilter = PTR_SEG_TO_LIN(ofn16->lpstrCustomFilter); + ofnA.lpstrCustomFilter = MapSL(ofn16->lpstrCustomFilter); ofnA.nMaxCustFilter = ofn16->nMaxCustFilter; ofnA.nFilterIndex = ofn16->nFilterIndex; - ofnA.lpstrFile = PTR_SEG_TO_LIN(ofn16->lpstrFile); + ofnA.lpstrFile = MapSL(ofn16->lpstrFile); ofnA.nMaxFile = ofn16->nMaxFile; - ofnA.lpstrFileTitle = PTR_SEG_TO_LIN(ofn16->lpstrFileTitle); + ofnA.lpstrFileTitle = MapSL(ofn16->lpstrFileTitle); ofnA.nMaxFileTitle = ofn16->nMaxFileTitle; - ofnA.lpstrInitialDir = PTR_SEG_TO_LIN(ofn16->lpstrInitialDir); - ofnA.lpstrTitle = PTR_SEG_TO_LIN(ofn16->lpstrTitle); + ofnA.lpstrInitialDir = MapSL(ofn16->lpstrInitialDir); + ofnA.lpstrTitle = MapSL(ofn16->lpstrTitle); ofnA.Flags = ofn16->Flags; ofnA.nFileOffset = ofn16->nFileOffset; ofnA.nFileExtension = ofn16->nFileExtension; - ofnA.lpstrDefExt = PTR_SEG_TO_LIN(ofn16->lpstrDefExt); + ofnA.lpstrDefExt = MapSL(ofn16->lpstrDefExt); if (HIWORD(ofn16->lpTemplateName)) - ofnA.lpTemplateName = PTR_SEG_TO_LIN(ofn16->lpTemplateName); + ofnA.lpTemplateName = MapSL(ofn16->lpTemplateName); else ofnA.lpTemplateName = (LPSTR) ofn16->lpTemplateName; /* ressource number */ /* now calls the 32 bits Ansi to Unicode version to complete the job */ @@ -1211,7 +1210,7 @@ LFSPRIVATE FILEDLG_AllocPrivate(LPARAM lParam, int type, UINT dlgType) switch(type) { case LFS16: - lfs->ofn16 = (LPOPENFILENAME16) PTR_SEG_TO_LIN(lParam); + lfs->ofn16 = MapSL(lParam); if (lfs->ofn16->Flags & OFN_ENABLEHOOK) if (lfs->ofn16->lpfnHook) lfs->hook = TRUE; @@ -1344,7 +1343,7 @@ LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam); case WM_DRAWITEM: - FILEDLG_MapDrawItemStruct((LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam), &dis); + FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis); return FILEDLG_WMDrawItem(hWnd, wParam, lParam, FALSE, &dis); case WM_COMMAND: @@ -1392,7 +1391,7 @@ LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam); case WM_DRAWITEM: - FILEDLG_MapDrawItemStruct((LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam), &dis); + FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis); return FILEDLG_WMDrawItem(hWnd, wParam, lParam, TRUE, &dis); case WM_COMMAND: @@ -1485,7 +1484,7 @@ BOOL16 WINAPI GetOpenFileName16( { HINSTANCE hInst; BOOL bRet = FALSE; - LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(ofn); + LPOPENFILENAME16 lpofn = MapSL(ofn); LFSPRIVATE lfs; FARPROC16 ptr; @@ -1501,8 +1500,7 @@ BOOL16 WINAPI GetOpenFileName16( FILEDLG_DestroyPrivate(lfs); } - TRACE("return lpstrFile='%s' !\n", - (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile)); + TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile)); return bRet; } @@ -1524,7 +1522,7 @@ BOOL16 WINAPI GetSaveFileName16( { HINSTANCE hInst; BOOL bRet = FALSE; - LPOPENFILENAME16 lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(ofn); + LPOPENFILENAME16 lpofn = MapSL(ofn); LFSPRIVATE lfs; FARPROC16 ptr; @@ -1540,8 +1538,7 @@ BOOL16 WINAPI GetSaveFileName16( FILEDLG_DestroyPrivate(lfs); } - TRACE("return lpstrFile='%s' !\n", - (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile)); + TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile)); return bRet; } diff --git a/dlls/commdlg/finddlg.c b/dlls/commdlg/finddlg.c index e2fc9789b96..3610d77091e 100644 --- a/dlls/commdlg/finddlg.c +++ b/dlls/commdlg/finddlg.c @@ -12,7 +12,6 @@ #include "wine/winbase16.h" #include "wine/winuser16.h" #include "commdlg.h" -#include "ldt.h" #include "debugtools.h" #include "cderr.h" @@ -61,7 +60,7 @@ BOOL FINDDLG_Get16BitsTemplate(LFRPRIVATE lfr) { HANDLE16 hResInfo; if (!(hResInfo = FindResource16(fr16->hInstance, - PTR_SEG_TO_LIN(fr16->lpTemplateName), + MapSL(fr16->lpTemplateName), RT_DIALOGA))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); @@ -159,7 +158,7 @@ HWND16 WINAPI FindText16( SEGPTR find ) LFRPRIVATE lfr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct FRPRIVATE)); if (!lfr) return 0; - lfr->fr16 = (LPFINDREPLACE16)PTR_SEG_TO_LIN(find); + lfr->fr16 = MapSL(find); lfr->find = TRUE; if (FINDDLG_Get16BitsTemplate(lfr)) { @@ -189,7 +188,7 @@ HWND16 WINAPI ReplaceText16( SEGPTR find ) * FIXME : We should do error checking on the lpFind structure here * and make CommDlgExtendedError() return the error condition. */ - lfr->fr16 = (LPFINDREPLACE16)PTR_SEG_TO_LIN(find); + lfr->fr16 = MapSL(find); lfr->find = FALSE; if (FINDDLG_Get16BitsTemplate(lfr)) { @@ -304,13 +303,13 @@ LRESULT WINAPI FindTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPFINDREPLACE16 lpfr; switch (wMsg) { case WM_INITDIALOG: - lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(lParam); + lpfr=MapSL(lParam); return FINDDLG_WMInitDialog(hWnd, lParam, &(lpfr->Flags), - PTR_SEG_TO_LIN(lpfr->lpstrFindWhat), FALSE); + MapSL(lpfr->lpstrFindWhat), FALSE); case WM_COMMAND: - lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(GetWindowLongA(hWnd, DWL_USER)); + lpfr=MapSL(GetWindowLongA(hWnd, DWL_USER)); return FINDDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner, - &lpfr->Flags, PTR_SEG_TO_LIN(lpfr->lpstrFindWhat), + &lpfr->Flags, MapSL(lpfr->lpstrFindWhat), lpfr->wFindWhatLen, FALSE); } return FALSE; @@ -460,15 +459,15 @@ LRESULT WINAPI ReplaceTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPFINDREPLACE16 lpfr; switch (wMsg) { case WM_INITDIALOG: - lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(lParam); + lpfr=MapSL(lParam); return REPLACEDLG_WMInitDialog(hWnd, lParam, &lpfr->Flags, - PTR_SEG_TO_LIN(lpfr->lpstrFindWhat), - PTR_SEG_TO_LIN(lpfr->lpstrReplaceWith), FALSE); + MapSL(lpfr->lpstrFindWhat), + MapSL(lpfr->lpstrReplaceWith), FALSE); case WM_COMMAND: - lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(GetWindowLongA(hWnd, DWL_USER)); + lpfr=MapSL(GetWindowLongA(hWnd, DWL_USER)); return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner, - &lpfr->Flags, PTR_SEG_TO_LIN(lpfr->lpstrFindWhat), - lpfr->wFindWhatLen, PTR_SEG_TO_LIN(lpfr->lpstrReplaceWith), + &lpfr->Flags, MapSL(lpfr->lpstrFindWhat), + lpfr->wFindWhatLen, MapSL(lpfr->lpstrReplaceWith), lpfr->wReplaceWithLen, FALSE); } return FALSE; diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c index d06695ff915..3ccc466a9ff 100644 --- a/dlls/commdlg/fontdlg.c +++ b/dlls/commdlg/fontdlg.c @@ -15,7 +15,6 @@ #include "wingdi.h" #include "wine/winbase16.h" #include "wine/winuser16.h" -#include "ldt.h" #include "heap.h" #include "commdlg.h" #include "dlgs.h" @@ -64,13 +63,13 @@ static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a) chf32a->rgbColors=chf16->rgbColors; chf32a->lCustData=chf16->lCustData; chf32a->lpfnHook=NULL; - chf32a->lpTemplateName=PTR_SEG_TO_LIN(chf16->lpTemplateName); + chf32a->lpTemplateName=MapSL(chf16->lpTemplateName); chf32a->hInstance=chf16->hInstance; - chf32a->lpszStyle=PTR_SEG_TO_LIN(chf16->lpszStyle); + chf32a->lpszStyle=MapSL(chf16->lpszStyle); chf32a->nFontType=chf16->nFontType; chf32a->nSizeMax=chf16->nSizeMax; chf32a->nSizeMin=chf16->nSizeMin; - FONT_LogFont16To32A(PTR_SEG_TO_LIN(chf16->lpLogFont), chf32a->lpLogFont); + FONT_LogFont16To32A(MapSL(chf16->lpLogFont), chf32a->lpLogFont); } @@ -108,7 +107,7 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont) { HANDLE16 hResInfo; if (!(hResInfo = FindResource16( lpChFont->hInstance, - PTR_SEG_TO_LIN(lpChFont->lpTemplateName), + MapSL(lpChFont->lpTemplateName), RT_DIALOGA))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); @@ -175,7 +174,7 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont) lpChFont->lpTemplateName=lpTemplateName; - font16 = PTR_SEG_TO_LIN(lpChFont->lpLogFont); + font16 = MapSL(lpChFont->lpLogFont); font16->lfHeight = cf32a.lpLogFont->lfHeight; font16->lfWidth = cf32a.lpLogFont->lfWidth; font16->lfEscapement = cf32a.lpLogFont->lfEscapement; @@ -361,7 +360,7 @@ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics, HWND16 hwnd=LOWORD(lParam); HWND hDlg=GetParent(hwnd); LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); - LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN( logfont ); + LOGFONT16 *lplf = MapSL( logfont ); LOGFONTA lf32a; FONT_LogFont16To32A(lplf, &lf32a); return AddFontFamily(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName, @@ -493,7 +492,7 @@ INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics, HWND16 hcmb3=HIWORD(lParam); HWND hDlg=GetParent(hcmb3); LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); - LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN(logfont); + LOGFONT16 *lplf = MapSL(logfont); LOGFONTA lf32a; FONT_LogFont16To32A(lplf, &lf32a); return AddFontStyle(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName, @@ -952,7 +951,7 @@ LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam, { case WM_MEASUREITEM: { - MEASUREITEMSTRUCT16* mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam); + MEASUREITEMSTRUCT16* mis16 = MapSL(lParam); MEASUREITEMSTRUCT mis; mis.CtlType = mis16->CtlType; mis.CtlID = mis16->CtlID; @@ -967,7 +966,7 @@ LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam, break; case WM_DRAWITEM: { - DRAWITEMSTRUCT16* dis16 = (DRAWITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam); + DRAWITEMSTRUCT16* dis16 = MapSL(lParam); DRAWITEMSTRUCT dis; dis.CtlType = dis16->CtlType; dis.CtlID = dis16->CtlID; diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c index 726556129aa..c321854b44b 100644 --- a/dlls/commdlg/printdlg.c +++ b/dlls/commdlg/printdlg.c @@ -16,7 +16,6 @@ #include "wine/wingdi16.h" #include "winuser.h" #include "wine/winuser16.h" -#include "ldt.h" #include "commdlg.h" #include "dlgs.h" #include "debugtools.h" @@ -1159,8 +1158,8 @@ BOOL16 WINAPI PrintDlg16( LPPRINTDLG16 lpPrint ) FIXME("Need to allocate thunk\n"); /* Print32.lpfnSetupHook = lpPrint->lpfnSetupHook;*/ } - Print32.lpPrintTemplateName = PTR_SEG_TO_LIN(lpPrint->lpPrintTemplateName); - Print32.lpSetupTemplateName = PTR_SEG_TO_LIN(lpPrint->lpSetupTemplateName); + Print32.lpPrintTemplateName = MapSL(lpPrint->lpPrintTemplateName); + Print32.lpSetupTemplateName = MapSL(lpPrint->lpSetupTemplateName); Print32.hPrintTemplate = lpPrint->hPrintTemplate; Print32.hSetupTemplate = lpPrint->hSetupTemplate; diff --git a/dlls/gdi/gdi.spec b/dlls/gdi/gdi.spec index 0e802773962..0084277a083 100644 --- a/dlls/gdi/gdi.spec +++ b/dlls/gdi/gdi.spec @@ -137,7 +137,7 @@ owner gdi32 133 pascal16 GetEnvironment(str str word) GetEnvironment16 134 pascal16 GetRgnBox(word ptr) GetRgnBox16 #135 pascal ScanLr -136 pascal16 RemoveFontResource(segptr) RemoveFontResource16 +136 pascal16 RemoveFontResource(str) RemoveFontResource16 #137 - 147 removed sometime after W2.0 137 stub GSV 138 stub DPXlate diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c index 4ecb1e92a43..104bc7669fd 100644 --- a/dlls/gdi/printdrv.c +++ b/dlls/gdi/printdrv.c @@ -13,7 +13,6 @@ #include #include #include -#include "ldt.h" #include "winbase.h" #include "wine/winbase16.h" #include "wine/wingdi16.h" @@ -43,11 +42,11 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc ) DOCINFOA docA; docA.cbSize = lpdoc->cbSize; - docA.lpszDocName = PTR_SEG_TO_LIN(lpdoc->lpszDocName); - docA.lpszOutput = PTR_SEG_TO_LIN(lpdoc->lpszOutput); + docA.lpszDocName = MapSL(lpdoc->lpszDocName); + docA.lpszOutput = MapSL(lpdoc->lpszOutput); if(lpdoc->cbSize >= 14) - docA.lpszDatatype = PTR_SEG_TO_LIN(lpdoc->lpszDatatype); + docA.lpszDatatype = MapSL(lpdoc->lpszDatatype); else docA.lpszDatatype = NULL; diff --git a/dlls/gdi/wing.c b/dlls/gdi/wing.c index cf5a2f983a8..1c3a66c4f54 100644 --- a/dlls/gdi/wing.c +++ b/dlls/gdi/wing.c @@ -13,7 +13,6 @@ #include "wine/winuser16.h" #include "bitmap.h" #include "debugtools.h" -#include "ldt.h" #include "palette.h" #include "windef.h" @@ -100,7 +99,7 @@ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) FIXME(": Todo - implement setting BITMAPINFO\n"); #ifndef X_DISPLAY_MISSING - res = PTR_SEG_OFF_TO_SEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0); + res = MAKESEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0); #endif /* !defined(X_DISPLAY_MISSING) */ GDI_ReleaseObj( hWinGBitmap ); diff --git a/dlls/kernel/debugger.c b/dlls/kernel/debugger.c index 07d6d7436bc..39b7fc9c815 100644 --- a/dlls/kernel/debugger.c +++ b/dlls/kernel/debugger.c @@ -253,8 +253,8 @@ void WINAPIV _DebugOutput( void ) flags = VA_ARG16( valist, WORD ); spec = VA_ARG16( valist, SEGPTR ); /* FIXME: cannot use wvsnprintf16 from kernel */ - /* wvsnprintf16( temp, sizeof(temp), (LPCSTR)PTR_SEG_TO_LIN(spec), valist ); */ + /* wvsnprintf16( temp, sizeof(temp), MapSL(spec), valist ); */ /* Output */ - FIXME("%s %04x %s\n", caller, flags, debugstr_a(PTR_SEG_TO_LIN(spec)) ); + FIXME("%s %04x %s\n", caller, flags, debugstr_a(MapSL(spec)) ); } diff --git a/dlls/kernel/kernel.spec b/dlls/kernel/kernel.spec index e118985b300..2fb3a39ca0b 100644 --- a/dlls/kernel/kernel.spec +++ b/dlls/kernel/kernel.spec @@ -72,7 +72,7 @@ owner kernel32 64 pascal16 AccessResource(word word) AccessResource16 65 pascal SizeofResource(word word) SizeofResource16 66 pascal16 AllocResource(word word long) AllocResource16 -67 pascal SetResourceHandler(word segstr segptr) SetResourceHandler16 +67 pascal SetResourceHandler(word str segptr) SetResourceHandler16 68 pascal16 InitAtomTable(word) InitAtomTable16 69 pascal16 FindAtom(str) FindAtom16 70 pascal16 AddAtom(str) AddAtom16 diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index 4ef0e3a2f89..17470dade19 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c @@ -10,7 +10,6 @@ #include "module.h" #include "task.h" -#include "selectors.h" #include "miscemu.h" #include "global.h" @@ -53,7 +52,7 @@ static BOOL process_attach(void) NE_SetEntryPoint( hModule, 455, __get_ds() ); /* Initialize KERNEL.THHOOK */ - TASK_InstallTHHook((THHOOK *)PTR_SEG_TO_LIN((SEGPTR)GetProcAddress16( hModule, (LPCSTR)332 ))); + TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( hModule, (LPCSTR)332 ))); /* Initialize the real-mode selector entry points */ #define SET_ENTRY_POINT( num, addr ) \ @@ -128,7 +127,7 @@ LONG WINAPI KERNEL_nop(void) { return 0; } */ SEGPTR WINAPI KERNEL_AnsiNext16(SEGPTR current) { - return (*(char *)PTR_SEG_TO_LIN(current)) ? current + 1 : current; + return (*(char *)MapSL(current)) ? current + 1 : current; } /*********************************************************************** @@ -147,7 +146,7 @@ SEGPTR WINAPI KERNEL_AnsiUpper16( SEGPTR strOrChar ) /* uppercase only one char if strOrChar < 0x10000 */ if (HIWORD(strOrChar)) { - char *s = PTR_SEG_TO_LIN(strOrChar); + char *s = MapSL(strOrChar); while (*s) { *s = toupper(*s); s++; @@ -165,7 +164,7 @@ SEGPTR WINAPI KERNEL_AnsiLower16( SEGPTR strOrChar ) /* lowercase only one char if strOrChar < 0x10000 */ if (HIWORD(strOrChar)) { - char *s = PTR_SEG_TO_LIN(strOrChar); + char *s = MapSL(strOrChar); while (*s) { *s = tolower(*s); s++; diff --git a/dlls/kernel/thunk.c b/dlls/kernel/thunk.c index 6fd71843d22..f4f101c5e3d 100644 --- a/dlls/kernel/thunk.c +++ b/dlls/kernel/thunk.c @@ -139,7 +139,7 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32, } if ( !(ordinal = NE_GetOrdinal(hmod, func)) - || !(TD16 = PTR_SEG_TO_LIN(NE_GetEntryPointEx(hmod, ordinal, FALSE)))) + || !(TD16 = MapSL((SEGPTR)NE_GetEntryPointEx(hmod, ordinal, FALSE)))) { ERR("Unable to find thunk data '%s' in %s, required by %s (conflicting/incorrect DLL versions !?).\n", func, module, module32); @@ -261,7 +261,7 @@ UINT WINAPI ThunkConnect32( struct ThunkDataLS32 *LS32 = (struct ThunkDataLS32 *)TD; struct ThunkDataLS16 *LS16 = (struct ThunkDataLS16 *)TD16; - LS32->targetTable = PTR_SEG_TO_LIN(LS16->targetTable); + LS32->targetTable = MapSL(LS16->targetTable); /* write QT_Thunk and FT_Prolog stubs */ _write_qtthunk ((LPBYTE)TD + LS32->offsetQTThunk, LS32->targetTable); @@ -425,9 +425,9 @@ void WINAPI FT_Thunk( CONTEXT86 *context ) if (mapESPrelative & (1 << i)) { SEGPTR *arg = (SEGPTR *)(newstack + 2*i); - *arg = PTR_SEG_OFF_TO_SEGPTR(SELECTOROF(NtCurrentTeb()->cur_stack), - OFFSETOF(NtCurrentTeb()->cur_stack) - argsize - + (*(LPBYTE *)arg - oldstack)); + *arg = MAKESEGPTR(SELECTOROF(NtCurrentTeb()->cur_stack), + OFFSETOF(NtCurrentTeb()->cur_stack) - argsize + + (*(LPBYTE *)arg - oldstack)); } wine_call_to_16_regs_short( &context16, argsize ); @@ -757,7 +757,7 @@ LPVOID WINAPI ThunkInitLSF( if (!(addr = _loadthunk( dll16, thkbuf, dll32, NULL, len ))) return 0; - addr2 = PTR_SEG_TO_LIN(addr[1]); + addr2 = MapSL(addr[1]); if (HIWORD(addr2)) *(DWORD*)thunk = (DWORD)addr2; @@ -849,7 +849,7 @@ VOID WINAPI ThunkInitSL( if (!(addr = _loadthunk( dll16, thkbuf, dll32, NULL, len ))) return; - *(DWORD*)PTR_SEG_TO_LIN(addr[1]) = (DWORD)thunk; + *(DWORD*)MapSL(addr[1]) = (DWORD)thunk; } /********************************************************************** @@ -1113,7 +1113,7 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context ) frame16->ebp = context->Ebp; memcpy(stack32, stack16, argSize); - NtCurrentTeb()->cur_stack = PTR_SEG_OFF_TO_SEGPTR(stackSel, (DWORD)frame16 - stackBase); + NtCurrentTeb()->cur_stack = MAKESEGPTR(stackSel, (DWORD)frame16 - stackBase); context->Esp = (DWORD)stack32 + 4; context->Ebp = context->Esp + argSize; @@ -1141,7 +1141,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context ) if ( code[5] == 0xFF && code[6] == 0x55 && code[7] == 0xFC && code[13] == 0x66 && code[14] == 0xCB) { - STACK16FRAME *frame16 = (STACK16FRAME *)PTR_SEG_TO_LIN(NtCurrentTeb()->cur_stack); + STACK16FRAME *frame16 = MapSL(NtCurrentTeb()->cur_stack); char *stack16 = (char *)(frame16 + 1); DWORD argSize = frame16->ebp - (DWORD)stack16; char *stack32 = (char *)frame16->frame32 - argSize; @@ -1237,7 +1237,7 @@ UINT WINAPI ThunkConnect16( SL->flags1 = SL16->flags1; SL->flags2 = SL16->flags2; - SL->apiDB = PTR_SEG_TO_LIN(SL16->apiDatabase); + SL->apiDB = MapSL(SL16->apiDatabase); SL->targetDB = NULL; lstrcpynA(SL->pszDll16, module16, 255); @@ -1278,7 +1278,7 @@ UINT WINAPI ThunkConnect16( void WINAPI C16ThkSL(CONTEXT86 *context) { - LPBYTE stub = PTR_SEG_TO_LIN(context->Eax), x = stub; + LPBYTE stub = MapSL(context->Eax), x = stub; WORD cs = __get_cs(); WORD ds = __get_ds(); @@ -1323,11 +1323,11 @@ void WINAPI C16ThkSL(CONTEXT86 *context) void WINAPI C16ThkSL01(CONTEXT86 *context) { - LPBYTE stub = PTR_SEG_TO_LIN(context->Eax), x = stub; + LPBYTE stub = MapSL(context->Eax), x = stub; if (stub) { - struct ThunkDataSL16 *SL16 = PTR_SEG_TO_LIN(context->Edx); + struct ThunkDataSL16 *SL16 = MapSL(context->Edx); struct ThunkDataSL *td = SL16->fpData; DWORD procAddress = (DWORD)GetProcAddress16(GetModuleHandle16("KERNEL"), (LPCSTR)631); @@ -1404,7 +1404,7 @@ void WINAPI C16ThkSL01(CONTEXT86 *context) } else { - WORD *stack = PTR_SEG_OFF_TO_LIN(context->SegSs, LOWORD(context->Esp)); + WORD *stack = MapSL( MAKESEGPTR(context->SegSs, LOWORD(context->Esp)) ); DX_reg(context) = HIWORD(td->apiDB[targetNr].errorReturnValue); AX_reg(context) = LOWORD(td->apiDB[targetNr].errorReturnValue); context->Eip = stack[2]; @@ -1623,7 +1623,7 @@ SEGPTR WINAPI AllocSLThunkletSysthunk16( FARPROC target, FARPROC WINAPI AllocLSThunkletCallbackEx16( SEGPTR target, DWORD relay, HTASK16 task ) { - THUNKLET *thunk = (THUNKLET *)PTR_SEG_TO_LIN( target ); + THUNKLET *thunk = MapSL( target ); if ( !thunk ) return NULL; if ( IsSLThunklet16( thunk ) && thunk->relay == relay @@ -1672,7 +1672,7 @@ SEGPTR WINAPI AllocSLThunkletCallback16( FARPROC target, DWORD relay ) */ FARPROC WINAPI FindLSThunkletCallback( SEGPTR target, DWORD relay ) { - THUNKLET *thunk = (THUNKLET *)PTR_SEG_TO_LIN( target ); + THUNKLET *thunk = MapSL( target ); if ( thunk && IsSLThunklet16( thunk ) && thunk->relay == relay && thunk->glue == (DWORD)ThunkletCallbackGlueSL ) return (FARPROC)thunk->target; @@ -1782,7 +1782,7 @@ void WINAPI CBClientGlueSL( CONTEXT86 *context ) { /* Create stack frame */ SEGPTR stackSeg = stack16_push( 12 ); - LPWORD stackLin = PTR_SEG_TO_LIN( stackSeg ); + LPWORD stackLin = MapSL( stackSeg ); SEGPTR glue, *glueTab; stackLin[3] = BP_reg( context ); @@ -1795,7 +1795,7 @@ void WINAPI CBClientGlueSL( CONTEXT86 *context ) context->SegGs = 0; /* Jump to 16-bit relay code */ - glueTab = PTR_SEG_TO_LIN( CBClientRelay16[ stackLin[5] ] ); + glueTab = MapSL( CBClientRelay16[ stackLin[5] ] ); glue = glueTab[ stackLin[4] ]; context->SegCs = SELECTOROF( glue ); context->Eip = OFFSETOF ( glue ); @@ -1809,7 +1809,7 @@ void WINAPI CBClientThunkSL( CONTEXT86 *context ) { /* Call 32-bit relay code */ - LPWORD args = PTR_SEG_OFF_TO_LIN( context->SegSs, BP_reg( context ) ); + LPWORD args = MapSL( MAKESEGPTR( context->SegSs, BP_reg( context ) ) ); FARPROC proc = CBClientRelay32[ args[2] ][ args[1] ]; context->Eax = CALL32_CBClient( proc, args, &context->Esi ); @@ -1823,7 +1823,7 @@ void WINAPI CBClientThunkSLEx( CONTEXT86 *context ) { /* Call 32-bit relay code */ - LPWORD args = PTR_SEG_OFF_TO_LIN( context->SegSs, BP_reg( context ) ); + LPWORD args = MapSL( MAKESEGPTR( context->SegSs, BP_reg( context ) ) ); FARPROC proc = CBClientRelay32[ args[2] ][ args[1] ]; INT nArgs; LPWORD stackLin; @@ -1861,7 +1861,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name) { if (!handle) handle=GetModuleHandle16("WIN32S16"); proc_16 = (DWORD)GetProcAddress16(handle, func_name); - x=PTR_SEG_TO_LIN(thunk); + x=MapSL(thunk); *x++=0xba; *(DWORD*)x=proc_16;x+=4; /* movl proc_16, $edx */ *x++=0xea; *(DWORD*)x=(DWORD)GetProcAddress(GetModuleHandleA("KERNEL32"),"QT_Thunk");x+=4; /* jmpl QT_Thunk */ *(WORD*)x=__get_cs(); @@ -2003,7 +2003,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT86 *context ) pFrame->frame32 = frame32; break; } - frame32 = ((STACK16FRAME *)PTR_SEG_TO_LIN(frame32->frame16))->frame32; + frame32 = ((STACK16FRAME *)MapSL(frame32->frame16))->frame32; } context->Eip = lpbuf[0]; diff --git a/dlls/kernel/utthunk.c b/dlls/kernel/utthunk.c index 3b52fb0b64b..2de9cb03f6d 100644 --- a/dlls/kernel/utthunk.c +++ b/dlls/kernel/utthunk.c @@ -8,7 +8,6 @@ #include "ntddk.h" #include "heap.h" #include "module.h" -#include "selectors.h" #include "callback.h" #include "debugtools.h" @@ -79,8 +78,8 @@ DWORD WINAPI UTGlue16( LPVOID lpBuff, DWORD dwUserDefined, SEGPTR *translationLi if ( translationList ) for ( i = 0; translationList[i]; i++ ) { - LPVOID flatPtr = PTR_SEG_TO_LIN( translationList[i] ); - *(LPVOID *)flatPtr = PTR_SEG_TO_LIN( *(SEGPTR *)flatPtr ); + LPVOID flatPtr = MapSL( translationList[i] ); + *(LPVOID *)flatPtr = MapSL( *(SEGPTR *)flatPtr ); } /* Call 32-bit routine */ diff --git a/dlls/kernel/wowthunk.c b/dlls/kernel/wowthunk.c index 70a0320338c..e9b18ae19f9 100644 --- a/dlls/kernel/wowthunk.c +++ b/dlls/kernel/wowthunk.c @@ -55,7 +55,7 @@ LPVOID WINAPI K32WOWGetVDMPointer( DWORD vp, DWORD dwBytes, BOOL fProtectedMode /* FIXME: add size check too */ if ( fProtectedMode ) - return PTR_SEG_TO_LIN( vp ); + return MapSL( vp ); else return DOSMEM_MapRealToLinear( vp ); } @@ -383,8 +383,8 @@ static DWORD WOW_CallProc32W16( BOOL Ex ) if (argconvmask & (1<dwSize; + DWORD size = ((ICINFO*)(MapSL((SEGPTR)lpicinfo)))->dwSize; /* Use the mapping functions to map the ICINFO structure */ lpv = MSVIDEO_MapMsg16To32(ICM_GETINFO,&lParam,&size); @@ -506,13 +505,13 @@ DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFo } #define COPY(x,y) (x->y = x##16->y); -#define COPYPTR(x,y) (x->y = PTR_SEG_TO_LIN(x##16->y)); +#define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y)); LPVOID MSVIDEO_MapICDEX16To32(LPDWORD lParam) { LPVOID ret; ICDECOMPRESSEX *icdx = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESSEX)); - ICDECOMPRESSEX16 *icdx16 = (ICDECOMPRESSEX16*)PTR_SEG_TO_LIN(*lParam); + ICDECOMPRESSEX16 *icdx16 = MapSL(*lParam); ret = icdx16; COPY(icdx,dwFlags); @@ -554,14 +553,14 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { case DRV_OPEN: case ICM_GETDEFAULTQUALITY: case ICM_GETQUALITY: - *lParam1 = (DWORD)PTR_SEG_TO_LIN(*lParam1); + *lParam1 = (DWORD)MapSL(*lParam1); break; case ICM_GETINFO: { ICINFO *ici = HeapAlloc(GetProcessHeap(),0,sizeof(ICINFO)); ICINFO16 *ici16; - ici16 = (ICINFO16*)PTR_SEG_TO_LIN(*lParam1); + ici16 = MapSL(*lParam1); ret = ici16; ici->dwSize = sizeof(ICINFO); @@ -582,7 +581,7 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(),0,sizeof(ICCOMPRESS)); ICCOMPRESS *icc16; - icc16 = (ICCOMPRESS*)PTR_SEG_TO_LIN(*lParam1); + icc16 = MapSL(*lParam1); ret = icc16; COPY(icc,dwFlags); @@ -607,7 +606,7 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESS)); ICDECOMPRESS *icd16; /* Same structure except for the pointers */ - icd16 = (ICDECOMPRESS*)PTR_SEG_TO_LIN(*lParam1); + icd16 = MapSL(*lParam1); ret = icd16; COPY(icd,dwFlags); @@ -630,8 +629,8 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { case ICM_DECOMPRESS_BEGIN: case ICM_DECOMPRESS_SET_PALETTE: case ICM_DECOMPRESS_GET_PALETTE: - *lParam1 = (DWORD)PTR_SEG_TO_LIN(*lParam1); - *lParam2 = (DWORD)PTR_SEG_TO_LIN(*lParam2); + *lParam1 = (DWORD)MapSL(*lParam1); + *lParam2 = (DWORD)MapSL(*lParam2); break; case ICM_DECOMPRESSEX_QUERY: if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0)) @@ -657,7 +656,7 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { case ICM_DRAW_BEGIN: { ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWBEGIN)); - ICDRAWBEGIN16 *icdb16 = (ICDRAWBEGIN16*)PTR_SEG_TO_LIN(*lParam1); + ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1); ret = icdb16; COPY(icdb,dwFlags); @@ -683,7 +682,7 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { case ICM_DRAW_SUGGESTFORMAT: { ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWSUGGEST)); - ICDRAWSUGGEST16 *icds16 = (ICDRAWSUGGEST16*)PTR_SEG_TO_LIN(*lParam1); + ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1); ret = icds16; @@ -703,7 +702,7 @@ LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { case ICM_DRAW: { ICDRAW *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAW)); - ICDRAW *icd16 = (ICDRAW*)PTR_SEG_TO_LIN(*lParam1); + ICDRAW *icd16 = MapSL(*lParam1); ret = icd16; COPY(icd,dwFlags); diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index fb5bb8e85d5..31607b80318 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -22,7 +22,6 @@ #include "ole2ver.h" #include "debugtools.h" #include "heap.h" -#include "ldt.h" #include "winreg.h" #include "rpc.h" @@ -597,8 +596,8 @@ HRESULT WINAPI StringFromCLSID16( * everything we need. */ if (!K32WOWCallback16Ex( - (DWORD)((ICOM_VTABLE(IMalloc16)*)PTR_SEG_TO_LIN( - ICOM_VTBL(((LPMALLOC16)PTR_SEG_TO_LIN(mllc)))) + (DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL( + (SEGPTR)ICOM_VTBL(((LPMALLOC16)MapSL((SEGPTR)mllc)))) )->fnAlloc, WCB16_CDECL, 2*sizeof(DWORD), @@ -608,7 +607,7 @@ HRESULT WINAPI StringFromCLSID16( WARN("CallTo16 IMalloc16 failed\n"); return E_FAIL; } - return WINE_StringFromCLSID(id,PTR_SEG_TO_LIN(*idstr)); + return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr)); } /****************************************************************************** diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c index d6fa4e4e3c9..debe2709dbe 100644 --- a/dlls/ole32/ifs.c +++ b/dlls/ole32/ifs.c @@ -9,7 +9,6 @@ #include #include #include "winerror.h" -#include "ldt.h" #include "heap.h" #include "wine/winbase16.h" #include "wine/obj_base.h" @@ -148,7 +147,7 @@ SEGPTR WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) { SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) { ICOM_THIS(IMalloc16Impl,iface); TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb); - return MapLS( HeapReAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, PTR_SEG_TO_LIN(pv), cb ) ); + return MapLS( HeapReAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv), cb ) ); } /****************************************************************************** @@ -157,16 +156,17 @@ SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) { VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) { ICOM_THIS(IMalloc16Impl,iface); TRACE("(%p)->Free(%08lx)\n",This,pv); - HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, PTR_SEG_TO_LIN(pv) ); + HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) ); } /****************************************************************************** * IMalloc16_GetSize [COMPOBJ.506] */ -DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,LPVOID pv) { +DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv) +{ ICOM_CTHIS(IMalloc16Impl,iface); - TRACE("(%p)->GetSize(%p)\n",This,pv); - return HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, PTR_SEG_TO_LIN(pv) ); + TRACE("(%p)->GetSize(%08lx)\n",This,pv); + return HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) ); } /****************************************************************************** diff --git a/dlls/ole32/storage.c b/dlls/ole32/storage.c index 3b6aab50424..d004e6beb0f 100644 --- a/dlls/ole32/storage.c +++ b/dlls/ole32/storage.c @@ -21,7 +21,6 @@ #include "wine/obj_base.h" #include "wine/obj_storage.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ole); @@ -1326,7 +1325,7 @@ HRESULT WINAPI IStorage16_fnCreateStorage( if (grfMode & STGM_TRANSACTED) FIXME("We do not support transacted Compound Storage. Using direct mode.\n"); _create_istorage16(ppstg); - lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstg); + lpstg = MapSL((SEGPTR)*ppstg); lpstg->hf = This->hf; ppsent=STORAGE_get_free_pps_entry(lpstg->hf); @@ -1383,7 +1382,7 @@ HRESULT WINAPI IStorage16_fnCreateStream( if (grfMode & STGM_TRANSACTED) FIXME("We do not support transacted Compound Storage. Using direct mode.\n"); _create_istream16(ppstm); - lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm); + lpstr = MapSL((SEGPTR)*ppstm); DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(), &lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); lpstr->offset.s.LowPart = 0; @@ -1437,7 +1436,7 @@ HRESULT WINAPI IStorage16_fnOpenStorage( if (grfMode & STGM_TRANSACTED) FIXME("We do not support transacted Compound Storage. Using direct mode.\n"); _create_istorage16(ppstg); - lpstg = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstg); + lpstg = MapSL((SEGPTR)*ppstg); DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(), &lpstg->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR)); @@ -1472,7 +1471,7 @@ HRESULT WINAPI IStorage16_fnOpenStream( if (grfMode & STGM_TRANSACTED) FIXME("We do not support transacted Compound Storage. Using direct mode.\n"); _create_istream16(ppstm); - lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm); + lpstr = MapSL((SEGPTR)*ppstm); DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(), &lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR)); @@ -1581,7 +1580,7 @@ HRESULT WINAPI StgCreateDocFile16( WARN("couldn't open file for storage:%ld\n",GetLastError()); return E_FAIL; } - lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstgOpen); + lpstg = MapSL((SEGPTR)*ppstgOpen); lpstg->hf = hf; /* FIXME: check for existance before overwriting? */ if (!STORAGE_init_storage(hf)) { @@ -1678,7 +1677,7 @@ HRESULT WINAPI StgOpenStorage16( WARN("Couldn't open file for storage\n"); return E_FAIL; } - lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstgOpen); + lpstg = MapSL((SEGPTR)*ppstgOpen); lpstg->hf = hf; i=0;ret=0; diff --git a/dlls/oleaut32/ole2disp.c b/dlls/oleaut32/ole2disp.c index 20a56ec1cdd..755ba166dd8 100644 --- a/dlls/oleaut32/ole2disp.c +++ b/dlls/oleaut32/ole2disp.c @@ -13,7 +13,6 @@ #include "olectl.h" #include "oleauto.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ole); @@ -36,7 +35,7 @@ static BSTR16 BSTR_AllocBytes(int n) */ static void BSTR_Free(BSTR16 in) { - SEGPTR_FREE( PTR_SEG_TO_LIN(in) ); + SEGPTR_FREE( MapSL((SEGPTR)in) ); } /****************************************************************************** @@ -44,7 +43,7 @@ static void BSTR_Free(BSTR16 in) */ static void* BSTR_GetAddr(BSTR16 in) { - return in ? PTR_SEG_TO_LIN(in) : 0; + return in ? MapSL((SEGPTR)in) : 0; } /****************************************************************************** diff --git a/dlls/olecli/olecli.spec b/dlls/olecli/olecli.spec index 02cbc445947..2373e4eef7d 100644 --- a/dlls/olecli/olecli.spec +++ b/dlls/olecli/olecli.spec @@ -9,12 +9,12 @@ owner olecli32 6 stub OLECLONE 7 stub OLECOPYFROMLINK 8 stub OLEEQUAL -9 pascal16 OleQueryLinkFromClip(segstr word word) OleQueryLinkFromClip16 -10 pascal16 OleQueryCreateFromClip(segstr word word) OleQueryCreateFromClip16 -11 pascal16 OleCreateLinkFromClip (segstr segptr long segstr long word word) OleCreateLinkFromClip16 -12 pascal16 OleCreateFromClip(segstr segptr long segstr long word word) OleCreateFromClip16 +9 pascal16 OleQueryLinkFromClip(str word word) OleQueryLinkFromClip16 +10 pascal16 OleQueryCreateFromClip(str word word) OleQueryCreateFromClip16 +11 pascal16 OleCreateLinkFromClip (str segptr long str segptr word word) OleCreateLinkFromClip16 +12 pascal16 OleCreateFromClip(str segptr long str long word word) OleCreateFromClip16 13 stub OLECOPYTOCLIPBOARD -14 pascal16 OleQueryType(segptr segptr) OleQueryType16 +14 pascal16 OleQueryType(ptr segptr) OleQueryType16 15 stub OLESETHOSTNAMES 16 stub OLESETTARGETDEVICE 17 stub OLESETBOUNDS diff --git a/dlls/olecli/olecli_main.c b/dlls/olecli/olecli_main.c index ccc481b5f8a..47d54e0c9fa 100644 --- a/dlls/olecli/olecli_main.c +++ b/dlls/olecli/olecli_main.c @@ -9,7 +9,6 @@ #include "winbase.h" #include "wingdi.h" #include "wtypes.h" -#include "ldt.h" #include "ole.h" #include "debugtools.h" @@ -98,14 +97,13 @@ OLESTATUS WINAPI OleEnumObjects16(LHCLIENTDOC hServerDoc, SEGPTR data) /****************************************************************************** * OleCreateLinkFromClip16 [OLECLI.11] */ -OLESTATUS WINAPI OleCreateLinkFromClip16( - LPCSTR name, LPOLECLIENT olecli, LHCLIENTDOC hclientdoc, LPCSTR xname, - LPOLEOBJECT *lpoleob, UINT16 render, UINT16 clipformat -) { +OLESTATUS WINAPI OleCreateLinkFromClip16( LPCSTR name, SEGPTR olecli, LHCLIENTDOC hclientdoc, + LPCSTR xname, SEGPTR lpoleob, UINT16 render, + UINT16 clipformat ) +{ FIXME("(%s, %04x:%04x, %ld, %s, %04x:%04x, %d, %d): stub!\n", - (char *)PTR_SEG_TO_LIN(name), HIWORD(olecli), LOWORD(olecli), - hclientdoc, (char *)PTR_SEG_TO_LIN(xname), HIWORD(lpoleob), - LOWORD(lpoleob), render, clipformat); + name, HIWORD(olecli), LOWORD(olecli), hclientdoc, xname, HIWORD(lpoleob), + LOWORD(lpoleob), render, clipformat); return OLE_OK; } @@ -124,9 +122,9 @@ OLESTATUS WINAPI OleCreateLinkFromClip( /****************************************************************************** * OleQueryLinkFromClip16 [OLECLI.9] */ -OLESTATUS WINAPI OleQueryLinkFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat) { - FIXME("(%s, %d, %d): stub!\n", (char*)(PTR_SEG_TO_LIN(name)), - render, clipformat); +OLESTATUS WINAPI OleQueryLinkFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat) +{ + FIXME("(%s, %d, %d): stub!\n", name, render, clipformat); return OLE_OK; } @@ -141,9 +139,9 @@ OLESTATUS WINAPI OleQueryLinkFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIPFO /****************************************************************************** * OleQueryCreateFromClip16 [OLECLI.10] */ -OLESTATUS WINAPI OleQueryCreateFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat) { - FIXME("(%s, %d, %d): stub!\n", (char*)(PTR_SEG_TO_LIN(name)), - render, clipformat); +OLESTATUS WINAPI OleQueryCreateFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat) +{ + FIXME("(%s, %d, %d): stub!\n", name, render, clipformat); return OLE_OK; } @@ -186,8 +184,7 @@ OLESTATUS WINAPI OleSetHostNames(LPOLEOBJECT oleob,LPCSTR name1,LPCSTR name2) { * OleQueryType16 [OLECLI.14] */ OLESTATUS WINAPI OleQueryType16(LPOLEOBJECT oleob, SEGPTR xlong) { - FIXME("(%p, %p): stub!\n", - PTR_SEG_TO_LIN(oleob), PTR_SEG_TO_LIN(xlong)); + FIXME("(%p, %p): stub!\n", oleob, MapSL(xlong)); return OLE_OK; } @@ -206,14 +203,13 @@ OLESTATUS WINAPI OleQueryType(LPOLEOBJECT oleob,LONG*xlong) { /****************************************************************************** * OleCreateFromClip16 [OLECLI.12] */ -OLESTATUS WINAPI OleCreateFromClip16( - LPCSTR name, LPOLECLIENT olecli, LHCLIENTDOC hclientdoc, LPCSTR xname, - LPOLEOBJECT *lpoleob, UINT16 render, UINT16 clipformat -) { +OLESTATUS WINAPI OleCreateFromClip16( LPCSTR name, SEGPTR olecli, LHCLIENTDOC hclientdoc, + LPCSTR xname, SEGPTR lpoleob, + UINT16 render, UINT16 clipformat ) +{ FIXME("(%s, %04x:%04x, %ld, %s, %04x:%04x, %d, %d): stub!\n", - (char *)PTR_SEG_TO_LIN(name), HIWORD(olecli), LOWORD(olecli), - hclientdoc, (char *)PTR_SEG_TO_LIN(xname), HIWORD(lpoleob), - LOWORD(lpoleob), render, clipformat); + name, HIWORD(olecli), LOWORD(olecli), hclientdoc, xname, HIWORD(lpoleob), + LOWORD(lpoleob), render, clipformat); return OLE_OK; } diff --git a/dlls/shell32/shell.c b/dlls/shell32/shell.c index 5ccc8698752..aa942a9359e 100644 --- a/dlls/shell32/shell.c +++ b/dlls/shell32/shell.c @@ -13,7 +13,6 @@ #include "wine/winbase16.h" #include "wine/shell16.h" #include "winerror.h" -#include "ldt.h" #include "dlgs.h" #include "shellapi.h" #include "shlobj.h" @@ -688,7 +687,7 @@ SEGPTR WINAPI FindEnvironmentString16(LPSTR str) spEnv = GetDOSEnvironment16(); - lpEnv = (LPSTR)PTR_SEG_TO_LIN(spEnv); + lpEnv = MapSL(spEnv); lpString = (spEnv)?SHELL_FindString(lpEnv, str):NULL; if( lpString ) /* offset should be small enough */ @@ -704,7 +703,7 @@ SEGPTR WINAPI FindEnvironmentString16(LPSTR str) */ DWORD WINAPI DoEnvironmentSubst16(LPSTR str,WORD length) { - LPSTR lpEnv = (LPSTR)PTR_SEG_TO_LIN(GetDOSEnvironment16()); + LPSTR lpEnv = MapSL(GetDOSEnvironment16()); LPSTR lpBuffer = (LPSTR)HeapAlloc( GetProcessHeap(), 0, length); LPSTR lpstr = str; LPSTR lpbstr = lpBuffer; diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index ae2690eaf68..ca5378e4496 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -14,7 +14,6 @@ #include "winerror.h" #include "heap.h" #include "dlgs.h" -#include "ldt.h" #include "debugtools.h" #include "winreg.h" #include "authors.h" @@ -676,7 +675,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, case WM_QUERYDROPOBJECT: if( wParam == 0 ) - { LPDRAGINFO16 lpDragInfo = (LPDRAGINFO16)PTR_SEG_TO_LIN((SEGPTR)lParam); + { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam); if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA ) { RECT rect; if( __get_dropline( hWnd, &rect ) ) @@ -695,7 +694,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, case WM_DROPOBJECT: if( wParam == hWnd ) - { LPDRAGINFO16 lpDragInfo = (LPDRAGINFO16)PTR_SEG_TO_LIN((SEGPTR)lParam); + { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam); if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList ) { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) ); if( pstr ) diff --git a/dlls/user/lstr.c b/dlls/user/lstr.c index b5e3e207acc..1fc3c6b2def 100644 --- a/dlls/user/lstr.c +++ b/dlls/user/lstr.c @@ -19,7 +19,6 @@ #include "wine/unicode.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(resource); @@ -79,7 +78,7 @@ SEGPTR WINAPI AnsiUpper16( SEGPTR strOrChar ) /* uppercase only one char if strOrChar < 0x10000 */ if (HIWORD(strOrChar)) { - CharUpperA( PTR_SEG_TO_LIN(strOrChar) ); + CharUpperA( MapSL(strOrChar) ); return strOrChar; } else return toupper((char)strOrChar); @@ -94,7 +93,7 @@ SEGPTR WINAPI AnsiLower16( SEGPTR strOrChar ) /* lowercase only one char if strOrChar < 0x10000 */ if (HIWORD(strOrChar)) { - CharLowerA( PTR_SEG_TO_LIN(strOrChar) ); + CharLowerA( MapSL(strOrChar) ); return strOrChar; } else return tolower((char)strOrChar); @@ -126,7 +125,7 @@ UINT16 WINAPI AnsiLowerBuff16( LPSTR str, UINT16 len ) */ SEGPTR WINAPI AnsiNext16(SEGPTR current) { - char *ptr = (char *)PTR_SEG_TO_LIN(current); + char *ptr = MapSL(current); return current + (CharNextA(ptr) - ptr); } @@ -136,7 +135,7 @@ SEGPTR WINAPI AnsiNext16(SEGPTR current) */ SEGPTR WINAPI AnsiPrev16( LPCSTR start, SEGPTR current ) { - char *ptr = (char *)PTR_SEG_TO_LIN(current); + char *ptr = MapSL(current); return current - (ptr - CharPrevA( start, ptr )); } @@ -530,7 +529,7 @@ DWORD WINAPI FormatMessage16( FIXME("line wrapping (%lu) not supported.\n", width); from = NULL; if (dwFlags & FORMAT_MESSAGE_FROM_STRING) - from = HEAP_strdupA( GetProcessHeap(), 0, PTR_SEG_TO_LIN(lpSource)); + from = HEAP_strdupA( GetProcessHeap(), 0, MapSL(lpSource)); if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) { from = HeapAlloc( GetProcessHeap(),0,200 ); sprintf(from,"Systemmessage, messageid = 0x%08x\n",dwMessageId); @@ -660,7 +659,7 @@ DWORD WINAPI FormatMessage16( /* nSize is the MINIMUM size */ HLOCAL16 h = LocalAlloc16(LPTR,talloced); SEGPTR ptr = LocalLock16(h); - allocstring = PTR_SEG_TO_LIN( ptr ); + allocstring = MapSL( ptr ); memcpy( allocstring,target,talloced); LocalUnlock16( h ); *((HLOCAL16*)lpBuffer) = h; diff --git a/dlls/user/text.c b/dlls/user/text.c index eff3fa42d7f..1463c6d5c23 100644 --- a/dlls/user/text.c +++ b/dlls/user/text.c @@ -15,7 +15,6 @@ #include "winerror.h" #include "winnls.h" #include "cache.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(text); @@ -492,7 +491,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN else if(_32bit) slen = strlen((LPCSTR)lp); else - slen = strlen((LPCSTR)PTR_SEG_TO_LIN(lp)); + slen = strlen(MapSL(lp)); } if((cx == 0 || cy == 0) && slen != -1) @@ -503,7 +502,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN else if(_32bit) GetTextExtentPoint32A(hdc, (LPCSTR)lp, slen, &s); else - GetTextExtentPoint32A(hdc, (LPCSTR)PTR_SEG_TO_LIN(lp), slen, &s); + GetTextExtentPoint32A(hdc, MapSL(lp), slen, &s); if(cx == 0) cx = s.cx; if(cy == 0) cy = s.cy; } @@ -531,7 +530,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN else if(_32bit) TextOutA(memdc, 0, 0, (LPCSTR)lp, slen); else - TextOutA(memdc, 0, 0, (LPCSTR)PTR_SEG_TO_LIN(lp), slen); + TextOutA(memdc, 0, 0, MapSL(lp), slen); } SelectObject(memdc, hfsave); diff --git a/dlls/user/wsprintf.c b/dlls/user/wsprintf.c index ea20a52cff6..346530f6fac 100644 --- a/dlls/user/wsprintf.c +++ b/dlls/user/wsprintf.c @@ -11,9 +11,7 @@ #include "windef.h" #include "wingdi.h" #include "winuser.h" -#include "ldt.h" #include "stackframe.h" -#include "global.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(string); @@ -307,7 +305,7 @@ static INT16 wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, case WPR_STRING: seg_str = VA_ARG16( args, SEGPTR ); if (IsBadReadPtr16(seg_str, 1 )) cur_arg.lpcstr_view = ""; - else cur_arg.lpcstr_view = PTR_SEG_TO_LIN( seg_str ); + else cur_arg.lpcstr_view = MapSL( seg_str ); break; case WPR_SIGNED: if (!(format.flags & WPRINTF_LONG)) @@ -570,8 +568,7 @@ INT16 WINAPIV wsprintf16(void) VA_START16( valist ); buffer = VA_ARG16( valist, SEGPTR ); spec = VA_ARG16( valist, SEGPTR ); - res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 1024, - (LPCSTR)PTR_SEG_TO_LIN(spec), valist ); + res = wvsnprintf16( MapSL(buffer), 1024, MapSL(spec), valist ); VA_END16( valist ); return ( res == -1 ) ? 1024 : res; } diff --git a/dlls/version/ver16.c b/dlls/version/ver16.c index 85f1397680d..889c153433e 100644 --- a/dlls/version/ver16.c +++ b/dlls/version/ver16.c @@ -7,7 +7,6 @@ #include "winbase.h" #include "wine/winbase16.h" #include "winver.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ver); @@ -82,7 +81,7 @@ DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang ) DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPCSTR lpszSubBlock, SEGPTR *lpspBuffer, UINT16 *lpcb ) { - LPVOID lpvBlock = PTR_SEG_TO_LIN( spvBlock ); + LPVOID lpvBlock = MapSL( spvBlock ); LPVOID buffer = lpvBlock; UINT buflen; DWORD retv; diff --git a/dlls/win32s/win32s16.c b/dlls/win32s/win32s16.c index 8736c975bae..cf59faeb3e6 100644 --- a/dlls/win32s/win32s16.c +++ b/dlls/win32s/win32s16.c @@ -8,8 +8,7 @@ #include #include #include "windef.h" -#include "wine/windef16.h" -#include "selectors.h" +#include "wine/winbase16.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(dll); @@ -41,7 +40,7 @@ SEGPTR WINAPI StackLinearToSegmented16(WORD w1, WORD w2) */ LPVOID WINAPI UTSelectorOffsetToLinear16(SEGPTR sptr) { - return PTR_SEG_TO_LIN(sptr); + return MapSL(sptr); } /*********************************************************************** diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c index 2d98e873770..dfad8ea96c7 100644 --- a/dlls/winaspi/winaspi16.c +++ b/dlls/winaspi/winaspi16.c @@ -18,9 +18,7 @@ #include "wine/winaspi.h" #include "heap.h" #include "debugtools.h" -#include "selectors.h" #include "miscemu.h" -#include "ldt.h" DEFAULT_DEBUG_CHANNEL(aspi); @@ -121,7 +119,7 @@ ASPI_DebugPrintCmd(SRB_ExecSCSICmd16 *prb, UINT16 mode) lpBuf = PTR_REAL_TO_LIN( SELECTOROF(prb->SRB_BufPointer), OFFSETOF(prb->SRB_BufPointer)); break; case ASPI_WIN16: - lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer); + lpBuf = MapSL(prb->SRB_BufPointer); break; } @@ -210,7 +208,7 @@ ASPI_DebugPrintResult(SRB_ExecSCSICmd16 *prb, UINT16 mode) lpBuf = PTR_REAL_TO_LIN( SELECTOROF(prb->SRB_BufPointer), OFFSETOF(prb->SRB_BufPointer)); break; case ASPI_WIN16: - lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer); + lpBuf = MapSL(prb->SRB_BufPointer); break; } @@ -242,7 +240,7 @@ ASPI_ExecScsiCmd(DWORD ptrPRB, UINT16 mode) lpPRB = PTR_REAL_TO_LIN( SELECTOROF(ptrPRB), OFFSETOF(ptrPRB)); break; case ASPI_WIN16: - lpPRB = PTR_SEG_TO_LIN(ptrPRB); + lpPRB = MapSL(ptrPRB); break; } @@ -269,7 +267,7 @@ ASPI_ExecScsiCmd(DWORD ptrPRB, UINT16 mode) OFFSETOF(lpPRB->SRB_BufPointer)); break; case ASPI_WIN16: - lpBuf = PTR_SEG_TO_LIN(lpPRB->SRB_BufPointer); + lpBuf = MapSL(lpPRB->SRB_BufPointer); break; } @@ -428,7 +426,7 @@ DWORD ASPI_SendASPICommand(DWORD ptrSRB, UINT16 mode) lpSRB = PTR_REAL_TO_LIN( SELECTOROF(ptrSRB), OFFSETOF(ptrSRB)); break; case ASPI_WIN16: - lpSRB = PTR_SEG_TO_LIN(ptrSRB); + lpSRB = MapSL(ptrSRB); if (ASPIChainFunc) { /* This is not the post proc, it's the chain proc this time */ diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c index 390de10f354..803df157a29 100644 --- a/dlls/wineps/escape.c +++ b/dlls/wineps/escape.c @@ -22,7 +22,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, switch(nEscape) { case NEXTBAND: { - RECT16 *r = (RECT16 *)PTR_SEG_TO_LIN(lpOutData); + RECT16 *r = MapSL(lpOutData); if(!physDev->job.banding) { physDev->job.banding = TRUE; r->left = 0; @@ -58,7 +58,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, WARN("cbInput < 2 (=%d) for QUERYESCSUPPORT\n", cbInput); return 0; } else { - UINT16 num = *(UINT16 *)PTR_SEG_TO_LIN(lpInData); + UINT16 num = *(UINT16 *)MapSL(lpInData); TRACE("QUERYESCSUPPORT for %d\n", num); switch(num) { @@ -103,7 +103,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, /* lpInData may not be 0 terminated so we must copy it */ if(lpInData) { name = HeapAlloc( GetProcessHeap(), 0, cbInput+1 ); - memcpy(name, PTR_SEG_TO_LIN(lpInData), cbInput); + memcpy(name, MapSL(lpInData), cbInput); name[cbInput] = '\0'; } doc.cbSize = sizeof(doc); @@ -125,7 +125,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETPHYSPAGESIZE: { - POINT16 *p = (POINT16 *)PTR_SEG_TO_LIN(lpOutData); + POINT16 *p = MapSL(lpOutData); p->x = dc->devCaps->horzRes; p->y = dc->devCaps->vertRes; @@ -135,7 +135,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETPRINTINGOFFSET: { - POINT16 *p = (POINT16 *)PTR_SEG_TO_LIN(lpOutData); + POINT16 *p = MapSL(lpOutData); p->x = p->y = 0; TRACE("GETPRINTINGOFFSET: returning %dx%d\n", p->x, p->y); @@ -144,7 +144,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETSCALINGFACTOR: { - POINT16 *p = (POINT16 *)PTR_SEG_TO_LIN(lpOutData); + POINT16 *p = MapSL(lpOutData); p->x = p->y = 0; TRACE("GETSCALINGFACTOR: returning %dx%d\n", p->x, p->y); @@ -153,8 +153,8 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SETCOPYCOUNT: { - INT16 *NumCopies = (INT16 *)PTR_SEG_TO_LIN(lpInData); - INT16 *ActualCopies = (INT16 *)PTR_SEG_TO_LIN(lpOutData); + INT16 *NumCopies = MapSL(lpInData); + INT16 *ActualCopies = MapSL(lpOutData); if(cbInput != 2) { WARN("cbInput != 2 (=%d) for SETCOPYCOUNT\n", cbInput); return 0; @@ -166,7 +166,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETTECHNOLOGY: { - LPSTR p = (LPSTR)PTR_SEG_TO_LIN(lpOutData); + LPSTR p = MapSL(lpOutData); strcpy(p, "PostScript"); *(p + strlen(p) + 1) = '\0'; /* 2 '\0's at end of string */ return 1; @@ -174,7 +174,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SETLINECAP: { - INT16 newCap = *(INT16 *)PTR_SEG_TO_LIN(lpInData); + INT16 newCap = *(INT16 *)MapSL(lpInData); if(cbInput != 2) { WARN("cbInput != 2 (=%d) for SETLINECAP\n", cbInput); return 0; @@ -185,7 +185,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SETLINEJOIN: { - INT16 newJoin = *(INT16 *)PTR_SEG_TO_LIN(lpInData); + INT16 newJoin = *(INT16 *)MapSL(lpInData); if(cbInput != 2) { WARN("cbInput != 2 (=%d) for SETLINEJOIN\n", cbInput); return 0; @@ -196,7 +196,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SETMITERLIMIT: { - INT16 newLimit = *(INT16 *)PTR_SEG_TO_LIN(lpInData); + INT16 newLimit = *(INT16 *)MapSL(lpInData); if(cbInput != 2) { WARN("cbInput != 2 (=%d) for SETMITERLIMIT\n", cbInput); return 0; @@ -226,7 +226,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case EXT_DEVICE_CAPS: { - UINT16 cap = *(UINT16 *)PTR_SEG_TO_LIN(lpInData); + UINT16 cap = *(UINT16 *)MapSL(lpInData); if(cbInput != 2) { WARN("cbInput != 2 (=%d) for EXT_DEVICE_CAPS\n", cbInput); @@ -238,7 +238,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SET_BOUNDS: { - RECT16 *r = (RECT16 *)PTR_SEG_TO_LIN(lpInData); + RECT16 *r = MapSL(lpInData); if(cbInput != 8) { WARN("cbInput != 8 (=%d) for SET_BOUNDS\n", cbInput); return 0; diff --git a/dlls/winmm/driver.c b/dlls/winmm/driver.c index 66a91ce3026..343e1f7cecf 100644 --- a/dlls/winmm/driver.c +++ b/dlls/winmm/driver.c @@ -15,7 +15,6 @@ #include "winuser.h" #include "mmddk.h" #include "winemm.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(driver); @@ -133,7 +132,7 @@ static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2) if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL && (str2 = SEGPTR_STRDUP(str1)) != NULL) { - dci16->lpszDCISectionName = (LPSTR)SEGPTR_GET(str2); + dci16->lpszDCISectionName = SEGPTR_GET(str2); if (!HeapFree(GetProcessHeap(), 0, str1)) FIXME("bad free line=%d\n", __LINE__); } else { @@ -141,7 +140,7 @@ static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2) } if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL && (str2 = SEGPTR_STRDUP(str1)) != NULL) { - dci16->lpszDCIAliasName = (LPSTR)SEGPTR_GET(str2); + dci16->lpszDCIAliasName = SEGPTR_GET(str2); if (!HeapFree(GetProcessHeap(), 0, str1)) FIXME("bad free line=%d\n", __LINE__); } else { @@ -195,11 +194,11 @@ static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2) case DRV_INSTALL: /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */ if (lParam2) { - LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)PTR_SEG_TO_LIN(lParam2); + LPDRVCONFIGINFO16 dci16 = MapSL(lParam2); - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(dci16->lpszDCISectionName))) + if (!SEGPTR_FREE(MapSL(dci16->lpszDCISectionName))) FIXME("bad free line=%d\n", __LINE__); - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(dci16->lpszDCIAliasName))) + if (!SEGPTR_FREE(MapSL(dci16->lpszDCIAliasName))) FIXME("bad free line=%d\n", __LINE__); if (!SEGPTR_FREE(dci16)) FIXME("bad free line=%d\n", __LINE__); diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index f1710df5b1c..3afe8abf1a9 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c @@ -11,7 +11,6 @@ #include "wine/winbase16.h" #include "heap.h" #include "user.h" /* should be removed asap; used in MMDRV_(Get|Alloc|Free) */ -#include "selectors.h" #include "winver.h" #include "winemm.h" #include "debugtools.h" @@ -365,7 +364,7 @@ static void CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstan /* dwParam1 points to a MidiHdr, work to be done !!! */ if (mld->bFrom32 && !MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 32 => 16 */ - LPMIDIHDR mh16 = (LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1); + LPMIDIHDR mh16 = MapSL(dwParam1); LPMIDIHDR mh32 = *(LPMIDIHDR*)((LPSTR)mh16 - sizeof(LPMIDIHDR)); dwParam1 = (DWORD)mh32; @@ -376,8 +375,8 @@ static void CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstan } else if (!mld->bFrom32 && MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 16 => 32 */ LPMIDIHDR mh32 = (LPMIDIHDR)(dwParam1); - LPMIDIHDR segmh16 = *(LPMIDIHDR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); - LPMIDIHDR mh16 = PTR_SEG_TO_LIN(segmh16); + SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); + LPMIDIHDR mh16 = MapSL(segmh16); dwParam1 = (DWORD)segmh16; mh16->dwFlags = mh32->dwFlags; @@ -423,7 +422,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case MODM_GETDEVCAPS: { LPMIDIOUTCAPSA moc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSA)); - LPMIDIOUTCAPS16 moc16 = PTR_SEG_TO_LIN(*lpParam1); + LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1); if (moc32) { *(LPMIDIOUTCAPS16*)moc32 = moc16; @@ -440,12 +439,12 @@ static MMDRV_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case MODM_PREPARE: { LPMIDIHDR mh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIHDR) + sizeof(MIDIHDR)); - LPMIDIHDR mh16 = PTR_SEG_TO_LIN(*lpParam1); + LPMIDIHDR mh16 = MapSL(*lpParam1); if (mh32) { *(LPMIDIHDR*)mh32 = (LPMIDIHDR)*lpParam1; mh32 = (LPMIDIHDR)((LPSTR)mh32 + sizeof(LPMIDIHDR)); - mh32->lpData = PTR_SEG_TO_LIN(mh16->lpData); + mh32->lpData = MapSL((SEGPTR)mh16->lpData); mh32->dwBufferLength = mh16->dwBufferLength; mh32->dwBytesRecorded = mh16->dwBytesRecorded; mh32->dwUser = mh16->dwUser; @@ -468,7 +467,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case MODM_UNPREPARE: case MODM_LONGDATA: { - LPMIDIHDR mh16 = PTR_SEG_TO_LIN(*lpParam1); + LPMIDIHDR mh16 = MapSL(*lpParam1); LPMIDIHDR mh32 = (LPMIDIHDR)mh16->lpNext; *lpParam1 = (DWORD)mh32; @@ -537,7 +536,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD case MODM_LONGDATA: { LPMIDIHDR mh32 = (LPMIDIHDR)(*lpParam1); - LPMIDIHDR mh16 = PTR_SEG_TO_LIN(*(LPMIDIHDR*)((LPSTR)mh32 - sizeof(LPMIDIHDR))); + LPMIDIHDR mh16 = MapSL(*(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR))); assert(mh16->lpNext == mh32); mh16->dwBufferLength = mh32->dwBufferLength; @@ -720,7 +719,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD break; case MODM_GETDEVCAPS: { - LPMIDIOUTCAPS16 moc16 = (LPMIDIOUTCAPS16)PTR_SEG_TO_LIN(*lpParam1); + LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)moc16 - sizeof(LPMIDIOUTCAPSA); LPMIDIOUTCAPSA moc32 = *(LPMIDIOUTCAPSA*)ptr; @@ -743,7 +742,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD case MODM_UNPREPARE: case MODM_LONGDATA: { - LPMIDIHDR mh16 = (LPMIDIHDR)PTR_SEG_TO_LIN(*lpParam1); + LPMIDIHDR mh16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)mh16 - sizeof(LPMIDIHDR); LPMIDIHDR mh32 = *(LPMIDIHDR*)ptr; @@ -762,7 +761,7 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD break; case MODM_OPEN: { - LPMIDIOPENDESC16 mod16 = (LPMIDIOPENDESC16)PTR_SEG_TO_LIN(*lpParam1); + LPMIDIOPENDESC16 mod16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)mod16 - sizeof(LPMIDIOPENDESC) - 2*sizeof(DWORD); **(DWORD**)(ptr + sizeof(LPMIDIOPENDESC)) = *(LPDWORD)(ptr + sizeof(LPMIDIOPENDESC) + sizeof(DWORD)); @@ -798,7 +797,7 @@ static void CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInsta case MOM_DONE: if (mld->bFrom32 && !MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 32 => 16 */ - LPMIDIHDR mh16 = (LPMIDIHDR)PTR_SEG_TO_LIN(dwParam1); + LPMIDIHDR mh16 = MapSL(dwParam1); LPMIDIHDR mh32 = *(LPMIDIHDR*)((LPSTR)mh16 - sizeof(LPMIDIHDR)); dwParam1 = (DWORD)mh32; @@ -809,8 +808,8 @@ static void CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInsta } else if (!mld->bFrom32 && MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 16 => 32 */ LPMIDIHDR mh32 = (LPMIDIHDR)(dwParam1); - LPMIDIHDR segmh16 = *(LPMIDIHDR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); - LPMIDIHDR mh16 = PTR_SEG_TO_LIN(segmh16); + SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); + LPMIDIHDR mh16 = MapSL(segmh16); dwParam1 = (DWORD)segmh16; mh16->dwFlags = mh32->dwFlags; @@ -852,7 +851,7 @@ static MMDRV_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_GETDEVCAPS: { LPWAVEINCAPSA wic32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSA)); - LPWAVEINCAPS16 wic16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEINCAPS16 wic16 = MapSL(*lpParam1); if (wic32) { *(LPWAVEINCAPS16*)wic32 = wic16; @@ -869,7 +868,7 @@ static MMDRV_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_GETPOS: { LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); - LPMMTIME16 mmt16 = PTR_SEG_TO_LIN(*lpParam1); + LPMMTIME16 mmt16 = MapSL(*lpParam1); if (mmt32) { *(LPMMTIME16*)mmt32 = mmt16; @@ -888,12 +887,12 @@ static MMDRV_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_PREPARE: { LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); if (wh32) { *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); - wh32->lpData = PTR_SEG_TO_LIN(wh16->lpData); + wh32->lpData = MapSL((SEGPTR)wh16->lpData); wh32->dwBufferLength = wh16->dwBufferLength; wh32->dwBytesRecorded = wh16->dwBytesRecorded; wh32->dwUser = wh16->dwUser; @@ -914,7 +913,7 @@ static MMDRV_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_ADDBUFFER: case WIDM_UNPREPARE: { - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); LPWAVEHDR wh32 = (LPWAVEHDR)wh16->lpNext; *lpParam1 = (DWORD)wh32; @@ -985,7 +984,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_UNPREPARE: { LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*(LPWAVEHDR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); + LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); assert(wh16->lpNext == wh32); wh16->dwBufferLength = wh32->dwBufferLength; @@ -1185,7 +1184,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_OPEN: { - LPWAVEOPENDESC16 wod16 = (LPWAVEOPENDESC16)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEOPENDESC16 wod16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)wod16 - sizeof(LPWAVEOPENDESC) - 2*sizeof(DWORD); LPWAVEOPENDESC wod32 = *(LPWAVEOPENDESC*)ptr; @@ -1203,7 +1202,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW case WIDM_PREPARE: case WIDM_UNPREPARE: { - LPWAVEHDR wh16 = (LPWAVEHDR)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)wh16 - sizeof(LPWAVEHDR); LPWAVEHDR wh32 = *(LPWAVEHDR*)ptr; @@ -1223,7 +1222,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW break; case WIDM_GETDEVCAPS: { - LPWAVEINCAPS16 wic16 = (LPWAVEINCAPS16)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEINCAPS16 wic16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)wic16 - sizeof(LPWAVEINCAPSA); LPWAVEINCAPSA wic32 = *(LPWAVEINCAPSA*)ptr; @@ -1240,7 +1239,7 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW break; case WIDM_GETPOS: { - LPMMTIME16 mmt16 = (LPMMTIME16)PTR_SEG_TO_LIN(*lpParam1); + LPMMTIME16 mmt16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)mmt16 - sizeof(LPMMTIME); LPMMTIME mmt32 = *(LPMMTIME*)ptr; @@ -1274,7 +1273,7 @@ static void CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstan case WIM_DATA: if (mld->bFrom32 && !MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 32 => 16 */ - LPWAVEHDR wh16 = (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1); + LPWAVEHDR wh16 = MapSL(dwParam1); LPWAVEHDR wh32 = *(LPWAVEHDR*)((LPSTR)wh16 - sizeof(LPWAVEHDR)); dwParam1 = (DWORD)wh32; @@ -1283,8 +1282,8 @@ static void CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstan } else if (!mld->bFrom32 && MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 16 => 32 */ LPWAVEHDR wh32 = (LPWAVEHDR)(dwParam1); - LPWAVEHDR segwh16 = *(LPWAVEHDR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(segwh16); + SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); + LPWAVEHDR wh16 = MapSL(segwh16); dwParam1 = (DWORD)segwh16; wh16->dwFlags = wh32->dwFlags; @@ -1334,7 +1333,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case WODM_GETDEVCAPS: { LPWAVEOUTCAPSA woc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) + sizeof(WAVEOUTCAPSA)); - LPWAVEOUTCAPS16 woc16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1); if (woc32) { *(LPWAVEOUTCAPS16*)woc32 = woc16; @@ -1351,7 +1350,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case WODM_GETPOS: { LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); - LPMMTIME16 mmt16 = PTR_SEG_TO_LIN(*lpParam1); + LPMMTIME16 mmt16 = MapSL(*lpParam1); if (mmt32) { *(LPMMTIME16*)mmt32 = mmt16; @@ -1370,12 +1369,12 @@ static MMDRV_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case WODM_PREPARE: { LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); if (wh32) { *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); - wh32->lpData = PTR_SEG_TO_LIN(wh16->lpData); + wh32->lpData = MapSL((SEGPTR)wh16->lpData); wh32->dwBufferLength = wh16->dwBufferLength; wh32->dwBytesRecorded = wh16->dwBytesRecorded; wh32->dwUser = wh16->dwUser; @@ -1396,7 +1395,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD case WODM_UNPREPARE: case WODM_WRITE: { - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); LPWAVEHDR wh32 = (LPWAVEHDR)wh16->lpNext; *lpParam1 = (DWORD)wh32; @@ -1477,7 +1476,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD case WODM_WRITE: { LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(*(LPWAVEHDR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); + LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); assert(wh16->lpNext == wh32); wh16->dwBufferLength = wh32->dwBufferLength; @@ -1700,7 +1699,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD case WODM_GETDEVCAPS: { - LPWAVEOUTCAPS16 woc16 = (LPWAVEOUTCAPS16)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)woc16 - sizeof(LPWAVEOUTCAPSA); LPWAVEOUTCAPSA woc32 = *(LPWAVEOUTCAPSA*)ptr; @@ -1726,7 +1725,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD break; case WODM_GETPOS: { - LPMMTIME16 mmt16 = (LPMMTIME16)PTR_SEG_TO_LIN(*lpParam1); + LPMMTIME16 mmt16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)mmt16 - sizeof(LPMMTIME); LPMMTIME mmt32 = *(LPMMTIME*)ptr; @@ -1740,7 +1739,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD break; case WODM_OPEN: { - LPWAVEOPENDESC16 wod16 = (LPWAVEOPENDESC16)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEOPENDESC16 wod16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)wod16 - sizeof(LPWAVEOPENDESC) - 2*sizeof(DWORD); LPWAVEOPENDESC wod32 = *(LPWAVEOPENDESC*)ptr; @@ -1757,7 +1756,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD case WODM_UNPREPARE: case WODM_WRITE: { - LPWAVEHDR wh16 = (LPWAVEHDR)PTR_SEG_TO_LIN(*lpParam1); + LPWAVEHDR wh16 = MapSL(*lpParam1); LPSTR ptr = (LPSTR)wh16 - sizeof(LPWAVEHDR); LPWAVEHDR wh32 = *(LPWAVEHDR*)ptr; @@ -1802,7 +1801,7 @@ static void CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInsta case WOM_DONE: if (mld->bFrom32 && !MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 32 => 16 */ - LPWAVEHDR wh16 = (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1); + LPWAVEHDR wh16 = MapSL(dwParam1); LPWAVEHDR wh32 = *(LPWAVEHDR*)((LPSTR)wh16 - sizeof(LPWAVEHDR)); dwParam1 = (DWORD)wh32; @@ -1810,8 +1809,8 @@ static void CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInsta } else if (!mld->bFrom32 && MMDrvs[mld->mmdIndex].bIs32) { /* initial map is: 16 => 32 */ LPWAVEHDR wh32 = (LPWAVEHDR)(dwParam1); - LPWAVEHDR segwh16 = *(LPWAVEHDR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); - LPWAVEHDR wh16 = PTR_SEG_TO_LIN(segwh16); + SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); + LPWAVEHDR wh16 = MapSL(segwh16); dwParam1 = (DWORD)segwh16; wh16->dwFlags = wh32->dwFlags; diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 66209a3c002..01b4601fc20 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -15,7 +15,6 @@ #include "winuser.h" #include "heap.h" #include "winemm.h" -#include "selectors.h" #include "digitalv.h" #include "wine/winbase16.h" #include "debugtools.h" @@ -1167,19 +1166,19 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam) case MCI_UNFREEZE: case MCI_UPDATE: case MCI_WHERE: - *lParam = (DWORD)PTR_SEG_TO_LIN(*lParam); + *lParam = (DWORD)MapSL(*lParam); return MCI_MAP_OK; case MCI_WINDOW: /* in fact, I would also need the dwFlags... to see * which members of lParam are effectively used */ - *lParam = (DWORD)PTR_SEG_TO_LIN(*lParam); + *lParam = (DWORD)MapSL(*lParam); FIXME("Current mapping may be wrong\n"); break; case MCI_BREAK: { LPMCI_BREAK_PARMS mbp32 = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_BREAK_PARMS)); - LPMCI_BREAK_PARMS16 mbp16 = PTR_SEG_TO_LIN(*lParam); + LPMCI_BREAK_PARMS16 mbp16 = MapSL(*lParam); if (mbp32) { mbp32->dwCallback = mbp16->dwCallback; @@ -1194,11 +1193,11 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam) case MCI_ESCAPE: { LPMCI_VD_ESCAPE_PARMSA mvep32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_VD_ESCAPE_PARMSA)); - LPMCI_VD_ESCAPE_PARMS16 mvep16 = PTR_SEG_TO_LIN(*lParam); + LPMCI_VD_ESCAPE_PARMS16 mvep16 = MapSL(*lParam); if (mvep32a) { mvep32a->dwCallback = mvep16->dwCallback; - mvep32a->lpstrCommand = PTR_SEG_TO_LIN(mvep16->lpstrCommand); + mvep32a->lpstrCommand = MapSL(mvep16->lpstrCommand); } else { return MCI_MAP_NOMEM; } @@ -1208,14 +1207,14 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam) case MCI_INFO: { LPMCI_INFO_PARMSA mip32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_INFO_PARMSA)); - LPMCI_INFO_PARMS16 mip16 = PTR_SEG_TO_LIN(*lParam); + LPMCI_INFO_PARMS16 mip16 = MapSL(*lParam); /* FIXME this is wrong if device is of type * MCI_DEVTYPE_DIGITAL_VIDEO, some members are not mapped */ if (mip32a) { mip32a->dwCallback = mip16->dwCallback; - mip32a->lpstrReturn = PTR_SEG_TO_LIN(mip16->lpstrReturn); + mip32a->lpstrReturn = MapSL(mip16->lpstrReturn); mip32a->dwRetSize = mip16->dwRetSize; } else { return MCI_MAP_NOMEM; @@ -1227,16 +1226,16 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam) case MCI_OPEN_DRIVER: { LPMCI_OPEN_PARMSA mop32a = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_OPEN_PARMS16) + sizeof(MCI_OPEN_PARMSA) + 2 * sizeof(DWORD)); - LPMCI_OPEN_PARMS16 mop16 = PTR_SEG_TO_LIN(*lParam); + LPMCI_OPEN_PARMS16 mop16 = MapSL(*lParam); if (mop32a) { *(LPMCI_OPEN_PARMS16*)(mop32a) = mop16; mop32a = (LPMCI_OPEN_PARMSA)((char*)mop32a + sizeof(LPMCI_OPEN_PARMS16)); mop32a->dwCallback = mop16->dwCallback; mop32a->wDeviceID = mop16->wDeviceID; - mop32a->lpstrDeviceType = PTR_SEG_TO_LIN(mop16->lpstrDeviceType); - mop32a->lpstrElementName = PTR_SEG_TO_LIN(mop16->lpstrElementName); - mop32a->lpstrAlias = PTR_SEG_TO_LIN(mop16->lpstrAlias); + mop32a->lpstrDeviceType = MapSL(mop16->lpstrDeviceType); + mop32a->lpstrElementName = MapSL(mop16->lpstrElementName); + mop32a->lpstrAlias = MapSL(mop16->lpstrAlias); /* copy extended information if any... * FIXME: this may seg fault if initial structure does not contain them and * the reads after msip16 fail under LDT limits... @@ -1255,11 +1254,11 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam) case MCI_SYSINFO: { LPMCI_SYSINFO_PARMSA msip32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_SYSINFO_PARMSA)); - LPMCI_SYSINFO_PARMS16 msip16 = PTR_SEG_TO_LIN(*lParam); + LPMCI_SYSINFO_PARMS16 msip16 = MapSL(*lParam); if (msip32a) { msip32a->dwCallback = msip16->dwCallback; - msip32a->lpstrReturn = PTR_SEG_TO_LIN(msip16->lpstrReturn); + msip32a->lpstrReturn = MapSL(msip16->lpstrReturn); msip32a->dwRetSize = msip16->dwRetSize; msip32a->dwNumber = msip16->dwNumber; msip32a->wDeviceType = msip16->wDeviceType; @@ -1451,7 +1450,7 @@ static MCI_MapType MCI_MsgMapper32To16_Create(void** ptr, int size16, DWORD map, static MCI_MapType MCI_MsgMapper32To16_Destroy(void* ptr, int size16, DWORD map, BOOLEAN kept) { if (ptr) { - void* msg16 = PTR_SEG_TO_LIN(ptr); + void* msg16 = MapSL((SEGPTR)ptr); void* alloc; LPBYTE p32, p16; unsigned nibble; @@ -1476,8 +1475,8 @@ static MCI_MapType MCI_MsgMapper32To16_Destroy(void* ptr, int size16, DWORD map, case 0x1: *( LPINT)p32 = *( LPINT16)p16; p16 += 2; p32 += 4; size16 -= 2; break; case 0x2: *(LPUINT)p32 = *(LPUINT16)p16; p16 += 2; p32 += 4; size16 -= 2; break; case 0x6: p16 += 4; p32 += 4; size16 -= 4; break; - case 0x7: strcpy(*(LPSTR*)p32, PTR_SEG_TO_LIN(*(DWORD*)p16)); - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(*(DWORD*)p16))) { + case 0x7: strcpy(*(LPSTR*)p32, MapSL(*(DWORD*)p16)); + if (!SEGPTR_FREE(MapSL(*(DWORD*)p16))) { FIXME("bad free line=%d\n", __LINE__); } p16 += 4; p32 += 4; size16 -= 4; break; @@ -1573,7 +1572,7 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW *(LPMCI_INFO_PARMSA*)ptr = mip32a; mip16 = (LPMCI_INFO_PARMS16)(ptr + sizeof(LPMCI_INFO_PARMSA)); mip16->dwCallback = mip32a->dwCallback; - mip16->lpstrReturn = (LPSTR)SEGPTR_GET(SEGPTR_ALLOC(mip32a->dwRetSize)); + mip16->lpstrReturn = SEGPTR_GET(SEGPTR_ALLOC(mip32a->dwRetSize)); mip16->dwRetSize = mip32a->dwRetSize; if (uDevType == MCI_DEVTYPE_DIGITAL_VIDEO) { ((LPMCI_DGV_INFO_PARMS16)mip16)->dwItem = ((LPMCI_DGV_INFO_PARMSA)mip32a)->dwItem; @@ -1602,10 +1601,10 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW if (dwFlags & MCI_OPEN_TYPE) { if (dwFlags & MCI_OPEN_TYPE_ID) { /* dword "transparent" value */ - mop16->lpstrDeviceType = mop32a->lpstrDeviceType; + mop16->lpstrDeviceType = (SEGPTR)mop32a->lpstrDeviceType; } else { /* string */ - mop16->lpstrDeviceType = mop32a->lpstrDeviceType ? (LPSTR)SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrDeviceType)) : 0; + mop16->lpstrDeviceType = mop32a->lpstrDeviceType ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrDeviceType)) : 0; } } else { /* nuthin' */ @@ -1613,15 +1612,15 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW } if (dwFlags & MCI_OPEN_ELEMENT) { if (dwFlags & MCI_OPEN_ELEMENT_ID) { - mop16->lpstrElementName = mop32a->lpstrElementName; + mop16->lpstrElementName = (SEGPTR)mop32a->lpstrElementName; } else { - mop16->lpstrElementName = mop32a->lpstrElementName ? (LPSTR)SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrElementName)) : 0; + mop16->lpstrElementName = mop32a->lpstrElementName ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrElementName)) : 0; } } else { mop16->lpstrElementName = 0; } if (dwFlags & MCI_OPEN_ALIAS) { - mop16->lpstrAlias = mop32a->lpstrAlias ? (LPSTR)SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrAlias)) : 0; + mop16->lpstrAlias = mop32a->lpstrAlias ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrAlias)) : 0; } else { mop16->lpstrAlias = 0; } @@ -1725,7 +1724,7 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW msip16 = (LPMCI_SYSINFO_PARMS16)(ptr + sizeof(LPMCI_SYSINFO_PARMSA)); msip16->dwCallback = msip32a->dwCallback; - msip16->lpstrReturn = (LPSTR)SEGPTR_GET(SEGPTR_ALLOC(msip32a->dwRetSize)); + msip16->lpstrReturn = SEGPTR_GET(SEGPTR_ALLOC(msip32a->dwRetSize)); msip16->dwRetSize = msip32a->dwRetSize; msip16->dwNumber = msip32a->dwNumber; msip16->wDeviceType = msip32a->wDeviceType; @@ -1818,12 +1817,12 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, /* case MCI_INDEX: */ case MCI_INFO: { - LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)PTR_SEG_TO_LIN(lParam); + LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)MapSL(lParam); LPMCI_INFO_PARMSA mip32a = *(LPMCI_INFO_PARMSA*)((char*)mip16 - sizeof(LPMCI_INFO_PARMSA)); - memcpy(mip32a->lpstrReturn, PTR_SEG_TO_LIN(mip16->lpstrReturn), mip32a->dwRetSize); + memcpy(mip32a->lpstrReturn, MapSL(mip16->lpstrReturn), mip32a->dwRetSize); - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(mip16->lpstrReturn))) + if (!SEGPTR_FREE(MapSL(mip16->lpstrReturn))) FIXME("bad free line=%d\n", __LINE__); if (!SEGPTR_FREE((char*)mip16 - sizeof(LPMCI_INFO_PARMSA))) FIXME("bad free line=%d\n", __LINE__); @@ -1834,20 +1833,20 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, case MCI_OPEN: case MCI_OPEN_DRIVER: if (lParam) { - LPMCI_OPEN_PARMS16 mop16 = (LPMCI_OPEN_PARMS16)PTR_SEG_TO_LIN(lParam); + LPMCI_OPEN_PARMS16 mop16 = (LPMCI_OPEN_PARMS16)MapSL(lParam); LPMCI_OPEN_PARMSA mop32a = *(LPMCI_OPEN_PARMSA*)((char*)mop16 - sizeof(LPMCI_OPEN_PARMSA)); mop32a->wDeviceID = mop16->wDeviceID; if ((dwFlags & MCI_OPEN_TYPE) && ! (dwFlags & MCI_OPEN_TYPE_ID) && - !SEGPTR_FREE(PTR_SEG_TO_LIN(mop16->lpstrDeviceType))) + !SEGPTR_FREE(MapSL(mop16->lpstrDeviceType))) FIXME("bad free line=%d\n", __LINE__); if ((dwFlags & MCI_OPEN_ELEMENT) && !(dwFlags & MCI_OPEN_ELEMENT_ID) && - !SEGPTR_FREE(PTR_SEG_TO_LIN(mop16->lpstrElementName))) + !SEGPTR_FREE(MapSL(mop16->lpstrElementName))) FIXME("bad free line=%d\n", __LINE__); if ((dwFlags & MCI_OPEN_ALIAS) && - !SEGPTR_FREE(PTR_SEG_TO_LIN(mop16->lpstrAlias))) + !SEGPTR_FREE(MapSL(mop16->lpstrAlias))) FIXME("bad free line=%d\n", __LINE__); if (!SEGPTR_FREE((char*)mop16 - sizeof(LPMCI_OPEN_PARMSA))) @@ -1880,17 +1879,17 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, switch (uDevType) { case MCI_DEVTYPE_DIGITAL_VIDEO: if (lParam) { - LPMCI_DGV_STATUS_PARMS16 mdsp16 = (LPMCI_DGV_STATUS_PARMS16)PTR_SEG_TO_LIN(lParam); + LPMCI_DGV_STATUS_PARMS16 mdsp16 = (LPMCI_DGV_STATUS_PARMS16)MapSL(lParam); LPMCI_DGV_STATUS_PARMSA mdsp32a = *(LPMCI_DGV_STATUS_PARMSA*)((char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA)); if (mdsp16) { mdsp32a->dwReturn = mdsp16->dwReturn; if (dwFlags & MCI_DGV_STATUS_DISKSPACE) { - TRACE("MCI_STATUS (DGV) lpstrDrive=%p\n", mdsp16->lpstrDrive); - TRACE("MCI_STATUS (DGV) lpstrDrive=%s\n", (LPSTR)PTR_SEG_TO_LIN(mdsp16->lpstrDrive)); + TRACE("MCI_STATUS (DGV) lpstrDrive=%08lx\n", mdsp16->lpstrDrive); + TRACE("MCI_STATUS (DGV) lpstrDrive=%s\n", (LPSTR)MapSL(mdsp16->lpstrDrive)); /* FIXME: see map function */ - strcpy(mdsp32a->lpstrDrive, (LPSTR)PTR_SEG_TO_LIN(mdsp16->lpstrDrive)); + strcpy(mdsp32a->lpstrDrive, (LPSTR)MapSL(mdsp16->lpstrDrive)); } if (!SEGPTR_FREE((char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA))) @@ -1910,13 +1909,13 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, break; case MCI_SYSINFO: if (lParam) { - LPMCI_SYSINFO_PARMS16 msip16 = (LPMCI_SYSINFO_PARMS16)PTR_SEG_TO_LIN(lParam); + LPMCI_SYSINFO_PARMS16 msip16 = (LPMCI_SYSINFO_PARMS16)MapSL(lParam); LPMCI_SYSINFO_PARMSA msip32a = *(LPMCI_SYSINFO_PARMSA*)((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA)); if (msip16) { msip16->dwCallback = msip32a->dwCallback; - memcpy(msip32a->lpstrReturn, PTR_SEG_TO_LIN(msip16->lpstrReturn), msip32a->dwRetSize); - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(msip16->lpstrReturn))) + memcpy(msip32a->lpstrReturn, MapSL(msip16->lpstrReturn), msip32a->dwRetSize); + if (!SEGPTR_FREE(MapSL(msip16->lpstrReturn))) FIXME("bad free line=%d\n", __LINE__); if (!SEGPTR_FREE((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA))) @@ -2447,7 +2446,7 @@ LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32) { LPMCI_GETDEVCAPS_PARMS lmgp; - lmgp = (LPMCI_GETDEVCAPS_PARMS)(bIs32 ? (void*)dwParam2 : PTR_SEG_TO_LIN(dwParam2)); + lmgp = (LPMCI_GETDEVCAPS_PARMS)(bIs32 ? (void*)dwParam2 : MapSL(dwParam2)); TRACE("Changing %08lx to %08lx\n", lmgp->dwReturn, (DWORD)LOWORD(lmgp->dwReturn)); lmgp->dwReturn = LOWORD(lmgp->dwReturn); } @@ -2470,7 +2469,7 @@ LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32) { LPMCI_STATUS_PARMS lsp; - lsp = (LPMCI_STATUS_PARMS)(bIs32 ? (void*)dwParam2 : PTR_SEG_TO_LIN(dwParam2)); + lsp = (LPMCI_STATUS_PARMS)(bIs32 ? (void*)dwParam2 : MapSL(dwParam2)); TRACE("Changing %08lx to %08lx\n", lsp->dwReturn, (DWORD)LOWORD(lsp->dwReturn)); lsp->dwReturn = LOWORD(lsp->dwReturn); } diff --git a/dlls/winmm/mcianim/mcianim.c b/dlls/winmm/mcianim/mcianim.c index acdd5de6f9f..0dcbf8671ef 100644 --- a/dlls/winmm/mcianim/mcianim.c +++ b/dlls/winmm/mcianim/mcianim.c @@ -322,7 +322,7 @@ static DWORD MCIANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTi /************************************************************************** * MCIANIM_mciInfo [internal] */ -static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms) +static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms) { WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID); LPSTR str = 0; @@ -649,7 +649,7 @@ LONG WINAPI MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, case MCI_OPEN_DRIVER: return MCIANIM_mciOpen(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2); case MCI_CLOSE_DRIVER: return MCIANIM_mciClose(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2); case MCI_GETDEVCAPS: return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2); - case MCI_INFO: return MCIANIM_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMS16)dwParam2); + case MCI_INFO: return MCIANIM_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMSA)dwParam2); case MCI_STATUS: return MCIANIM_mciStatus(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2); case MCI_SET: return MCIANIM_mciSet(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2); case MCI_PLAY: return MCIANIM_mciPlay(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2); diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index b21d9a6d3f9..e05ee4455eb 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -25,7 +25,6 @@ #include "windef.h" #include "wine/winbase16.h" #include "heap.h" -#include "selectors.h" #include "mmsystem.h" #include "debugtools.h" #include "winemm.h" @@ -383,11 +382,11 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2, /* nothing to do */ break; case MMIOM_READ: - memcpy((void*)lParam1, PTR_SEG_TO_LIN(lp1), lp2); + memcpy((void*)lParam1, MapSL(lp1), lp2); /* fall thru */ case MMIOM_WRITE: case MMIOM_WRITEFLUSH: - if (!SEGPTR_FREE(PTR_SEG_TO_LIN(lp1))) { + if (!SEGPTR_FREE(MapSL(lp1))) { FIXME("bad free line=%d\n", __LINE__); } break; @@ -420,7 +419,7 @@ static SEGPTR MMIO_GenerateInfoForIOProc(const WINE_MMIO* wm) */ static LRESULT MMIO_UpdateInfoForIOProc(WINE_MMIO* wm, SEGPTR segmmioInfo16) { - MMIOINFO16* mmioInfo16 = PTR_SEG_TO_LIN(segmmioInfo16); + MMIOINFO16* mmioInfo16 = MapSL(segmmioInfo16); wm->info.lDiskOffset = mmioInfo16->lDiskOffset; wm->info.adwInfo[0] = mmioInfo16->adwInfo[0]; @@ -672,7 +671,7 @@ static UINT MMIO_SetBuffer(WINE_MMIO* wm, void* pchBuffer, LONG cchBuffer, wm->info.pchBuffer = pchBuffer; wm->buffer16 = 0; } else { - wm->info.pchBuffer = PTR_SEG_TO_LIN(pchBuffer); + wm->info.pchBuffer = MapSL((SEGPTR)pchBuffer); wm->buffer16 = (SEGPTR)pchBuffer; } wm->hMem = 0; @@ -698,7 +697,7 @@ static UINT MMIO_SetBuffer(WINE_MMIO* wm, void* pchBuffer, LONG cchBuffer, if (wm->hMem) { wm->buffer16 = WIN16_GlobalLock16(wm->hMem); - wm->info.pchBuffer = (void*)PTR_SEG_TO_LIN((void*)wm->buffer16); + wm->info.pchBuffer = MapSL(wm->buffer16); } wm->info.cchBuffer = cchBuffer; @@ -1181,7 +1180,7 @@ UINT16 WINAPI mmioSetInfo16(HMMIO16 hmmio, const MMIOINFO16* lpmmioinfo, UINT16 /* check if seg and lin buffers are the same */ if (wm->info.cchBuffer != lpmmioinfo->cchBuffer || - wm->info.pchBuffer != PTR_SEG_TO_LIN((void*)wm->buffer16)) + wm->info.pchBuffer != MapSL(wm->buffer16)) return MMSYSERR_INVALPARAM; /* check pointers coherence */ diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index b92fc48ef15..7d2c53e0656 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -26,7 +26,6 @@ #include "wine/winuser16.h" #include "heap.h" #include "winemm.h" -#include "selectors.h" #include "debugtools.h" #include "ntddk.h" @@ -673,7 +672,7 @@ BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, * which dwSignalCount has to be incremented */ { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(LOWORD(dwCallBack), 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(LOWORD(dwCallBack), 0) ); TRACE("mmThread (%04x, %p) !\n", LOWORD(dwCallBack), lpMMThd); /* same as mmThreadSignal16 */ @@ -1016,7 +1015,7 @@ UINT16 WINAPI mixerGetControlDetails16(HMIXEROBJ16 hmix, return MMSYSERR_INVALPARAM; sppaDetails = (SEGPTR)lpmcd->paDetails; - lpmcd->paDetails = PTR_SEG_TO_LIN(sppaDetails); + lpmcd->paDetails = MapSL(sppaDetails); ret = mixerGetControlDetailsA(hmix, (LPMIXERCONTROLDETAILS)lpmcd, fdwDetails); lpmcd->paDetails = (LPVOID)sppaDetails; @@ -1139,7 +1138,7 @@ UINT16 WINAPI mixerGetLineControls16(HMIXEROBJ16 hmix, lpmlc16->u.dwControlType = mlcA.u.dwControlType; lpmlc16->cControls = mlcA.cControls; - lpmc16 = PTR_SEG_TO_LIN(lpmlc16->pamxctrl); + lpmc16 = MapSL(lpmlc16->pamxctrl); for (i = 0; i < mlcA.cControls; i++) { lpmc16[i].cbStruct = sizeof(MIXERCONTROL16); @@ -1507,9 +1506,9 @@ DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD /* no argument conversion needed */ break; case AUXDM_GETVOLUME: - return auxGetVolume16(uDeviceID, (LPDWORD)PTR_SEG_TO_LIN(dw1)); + return auxGetVolume16(uDeviceID, MapSL(dw1)); case AUXDM_GETDEVCAPS: - return auxGetDevCaps16(uDeviceID, (LPAUXCAPS16)PTR_SEG_TO_LIN(dw1), dw2); + return auxGetDevCaps16(uDeviceID, MapSL(dw1), dw2); default: TRACE("(%04x, %04x, %08lx, %08lx): unhandled message\n", uDeviceID, uMessage, dw1, dw2); @@ -2194,17 +2193,17 @@ UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, * midiOutPrepareHeader [MMSYSTEM.206] */ UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16 hMidiOut, /* [in] */ - LPMIDIHDR16 lpsegMidiOutHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegMidiOutHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - TRACE("(%04X, %p, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize); + TRACE("(%04X, %08lx, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize); if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; - return MMDRV_Message(wmld, MODM_PREPARE, (DWORD)lpsegMidiOutHdr, uSize, FALSE); + return MMDRV_Message(wmld, MODM_PREPARE, lpsegMidiOutHdr, uSize, FALSE); } /************************************************************************** @@ -2231,13 +2230,13 @@ UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, * midiOutUnprepareHeader [MMSYSTEM.207] */ UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16 hMidiOut, /* [in] */ - LPMIDIHDR16 lpsegMidiOutHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegMidiOutHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPMIDIHDR16 lpMidiOutHdr = PTR_SEG_TO_LIN(lpsegMidiOutHdr); + LPMIDIHDR16 lpMidiOutHdr = MapSL(lpsegMidiOutHdr); - TRACE("(%04X, %p, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize); + TRACE("(%04X, %08lx, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize); if (!(lpMidiOutHdr->dwFlags & MHDR_PREPARED)) { return MMSYSERR_NOERROR; @@ -2489,14 +2488,14 @@ DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage, return MMSYSERR_NOTSUPPORTED; case MODM_GETVOLUME: - return midiOutGetVolume16(hMidiOut, (LPDWORD)PTR_SEG_TO_LIN(dwParam1)); + return midiOutGetVolume16(hMidiOut, MapSL(dwParam1)); case MODM_LONGDATA: - return midiOutLongMsg16(hMidiOut, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiOutLongMsg16(hMidiOut, MapSL(dwParam1), dwParam2); case MODM_PREPARE: /* lpMidiOutHdr is still a segmented pointer for this function */ - return midiOutPrepareHeader16(hMidiOut, (LPMIDIHDR16)dwParam1, dwParam2); + return midiOutPrepareHeader16(hMidiOut, dwParam1, dwParam2); case MODM_UNPREPARE: - return midiOutUnprepareHeader16(hMidiOut, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiOutUnprepareHeader16(hMidiOut, dwParam1, dwParam2); } return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE); } @@ -2707,12 +2706,12 @@ UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn, * midiInPrepareHeader [MMSYSTEM.306] */ UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16 hMidiIn, /* [in] */ - MIDIHDR16* lpsegMidiInHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegMidiInHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - TRACE("(%04X, %p, %d)\n", hMidiIn, lpsegMidiInHdr, uSize); + TRACE("(%04X, %08lx, %d)\n", hMidiIn, lpsegMidiInHdr, uSize); if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) return MMSYSERR_INVALHANDLE; @@ -2744,13 +2743,13 @@ UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn, * midiInUnprepareHeader [MMSYSTEM.307] */ UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16 hMidiIn, /* [in] */ - MIDIHDR16* lpsegMidiInHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegMidiInHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPMIDIHDR16 lpMidiInHdr = PTR_SEG_TO_LIN(lpsegMidiInHdr); + LPMIDIHDR16 lpMidiInHdr = MapSL(lpsegMidiInHdr); - TRACE("(%04X, %p, %d)\n", hMidiIn, lpsegMidiInHdr, uSize); + TRACE("(%04X, %08lx, %d)\n", hMidiIn, lpsegMidiInHdr, uSize); if (!(lpMidiInHdr->dwFlags & MHDR_PREPARED)) { return MMSYSERR_NOERROR; @@ -2941,13 +2940,13 @@ DWORD WINAPI midiInMessage16(HMIDIIN16 hMidiIn, UINT16 uMessage, return MMSYSERR_NOTSUPPORTED; case MIDM_GETDEVCAPS: - return midiInGetDevCaps16(hMidiIn, (LPMIDIINCAPS16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiInGetDevCaps16(hMidiIn, MapSL(dwParam1), dwParam2); case MIDM_PREPARE: - return midiInPrepareHeader16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiInPrepareHeader16(hMidiIn, dwParam1, dwParam2); case MIDM_UNPREPARE: - return midiInUnprepareHeader16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiInUnprepareHeader16(hMidiIn, dwParam1, dwParam2); case MIDM_ADDBUFFER: - return midiInAddBuffer16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2); + return midiInAddBuffer16(hMidiIn, MapSL(dwParam1), dwParam2); } if ((wmld = MMDRV_Get(hMidiIn, MMDRV_MIDIIN, FALSE)) == NULL) @@ -3908,13 +3907,13 @@ UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, * waveOutPrepareHeader [MMSYSTEM.406] */ UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16 hWaveOut, /* [in] */ - WAVEHDR* lpsegWaveOutHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegWaveOutHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPWAVEHDR lpWaveOutHdr = (LPWAVEHDR)PTR_SEG_TO_LIN(lpsegWaveOutHdr); + LPWAVEHDR lpWaveOutHdr = MapSL(lpsegWaveOutHdr); - TRACE("(%04X, %p, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize); + TRACE("(%04X, %08lx, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize); if (lpWaveOutHdr == NULL) return MMSYSERR_INVALPARAM; @@ -3948,13 +3947,13 @@ UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, * waveOutUnprepareHeader [MMSYSTEM.407] */ UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16 hWaveOut, /* [in] */ - LPWAVEHDR lpsegWaveOutHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegWaveOutHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPWAVEHDR lpWaveOutHdr = (LPWAVEHDR)PTR_SEG_TO_LIN(lpsegWaveOutHdr); + LPWAVEHDR lpWaveOutHdr = MapSL(lpsegWaveOutHdr); - TRACE("(%04X, %p, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize); + TRACE("(%04X, %08lx, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize); if (!(lpWaveOutHdr->dwFlags & WHDR_PREPARED)) { return MMSYSERR_NOERROR; @@ -4549,11 +4548,11 @@ UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR* lpWaveInHdr, * waveInPrepareHeader [MMSYSTEM.506] */ UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16 hWaveIn, /* [in] */ - WAVEHDR* lpsegWaveInHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegWaveInHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPWAVEHDR lpWaveInHdr = (LPWAVEHDR)PTR_SEG_TO_LIN(lpsegWaveInHdr); + LPWAVEHDR lpWaveInHdr = MapSL(lpsegWaveInHdr); UINT16 ret; TRACE("(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize); @@ -4593,13 +4592,13 @@ UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR* lpWaveInHdr, * waveInUnprepareHeader [MMSYSTEM.507] */ UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16 hWaveIn, /* [in] */ - WAVEHDR* lpsegWaveInHdr, /* [???] NOTE: SEGPTR */ + SEGPTR lpsegWaveInHdr, /* [???] */ UINT16 uSize) /* [in] */ { LPWINE_MLD wmld; - LPWAVEHDR lpWaveInHdr = (LPWAVEHDR)PTR_SEG_TO_LIN(lpsegWaveInHdr); + LPWAVEHDR lpWaveInHdr = MapSL(lpsegWaveInHdr); - TRACE("(%04X, %p, %u);\n", hWaveIn, lpsegWaveInHdr, uSize); + TRACE("(%04X, %08lx, %u);\n", hWaveIn, lpsegWaveInHdr, uSize); if (lpWaveInHdr == NULL) return MMSYSERR_INVALPARAM; @@ -4912,7 +4911,7 @@ void mmTaskEntryPoint16(LPSTR cmdLine, WORD di, WORD si) int len = cmdLine[0x80]; if (len / 2 == 6) { - void (*fpProc)(DWORD) = (void (*)(DWORD))PTR_SEG_TO_LIN(*((DWORD*)(cmdLine + 1))); + void (*fpProc)(DWORD) = MapSL(*((DWORD*)(cmdLine + 1))); DWORD dwPmt = *((DWORD*)(cmdLine + 5)); #if 0 @@ -4995,7 +4994,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD d if (hndl == 0) { ret = 2; } else { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); #if 0 /* force mmtask routines even if mmthread is required */ @@ -5048,7 +5047,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD d */ FARPROC16 fp = GetProcAddress16(GetModuleHandle16("MMSYSTEM"), (LPCSTR)2047); - TRACE("farproc seg=0x%08lx lin=%p\n", (DWORD)fp, PTR_SEG_TO_LIN(fp)); + TRACE("farproc seg=0x%08lx lin=%p\n", (DWORD)fp, MapSL((SEGPTR)fp)); ret = (fp == 0) ? 2 : mmTaskCreate16((DWORD)fp, 0, hndl); } @@ -5083,7 +5082,7 @@ void WINAPI mmThreadSignal16(HANDLE16 hndl) TRACE("(%04x)!\n", hndl); if (hndl) { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); lpMMThd->dwCounter++; if (lpMMThd->hThread != 0) { @@ -5142,7 +5141,7 @@ void WINAPI mmThreadBlock16(HANDLE16 hndl) TRACE("(%04x)!\n", hndl); if (hndl) { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); if (lpMMThd->hThread != 0) { DWORD lc; @@ -5167,7 +5166,7 @@ BOOL16 WINAPI mmThreadIsCurrent16(HANDLE16 hndl) TRACE("(%04x)!\n", hndl); if (hndl && mmThreadIsValid16(hndl)) { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); ret = (GetCurrentThreadId() == lpMMThd->dwThreadID); } TRACE("=> %d\n", ret); @@ -5184,7 +5183,7 @@ BOOL16 WINAPI mmThreadIsValid16(HANDLE16 hndl) TRACE("(%04x)!\n", hndl); if (hndl) { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); if (!IsBadWritePtr(lpMMThd, sizeof(WINE_MMTHREAD)) && lpMMThd->dwSignature == WINE_MMTHREAD_CREATED && @@ -5216,7 +5215,7 @@ HANDLE16 WINAPI mmThreadGetTask16(HANDLE16 hndl) TRACE("(%04x)\n", hndl); if (mmThreadIsValid16(hndl)) { - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); ret = lpMMThd->hTask; } return ret; @@ -5232,7 +5231,7 @@ extern LONG CALLBACK MMSYSTEM_CallTo16_long_l (FARPROC16,LONG); void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt) { HANDLE16 hndl = (HANDLE16)_pmt; - WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)PTR_SEG_OFF_TO_LIN(hndl, 0); + WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); TRACE("(%04x %p)\n", hndl, lpMMThd); diff --git a/dlls/winmm/winmm.spec b/dlls/winmm/winmm.spec index 56d0ef122ef..30a7f54df6f 100644 --- a/dlls/winmm/winmm.spec +++ b/dlls/winmm/winmm.spec @@ -8,7 +8,7 @@ import advapi32.dll import kernel32.dll import ntdll.dll -debug_channels (mci mmio mmsys mmtime sound) +debug_channels (driver mci mmio mmsys mmtime sound) # ordinal exports 1 stdcall @(ptr long long) PlaySoundA diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c index 2c0fe1170ad..03ed23e9a5f 100644 --- a/dlls/winsock/async.c +++ b/dlls/winsock/async.c @@ -86,7 +86,6 @@ #include "winnt.h" #include "heap.h" #include "task.h" -#include "ldt.h" #include "wine/port.h" #include "debugtools.h" @@ -362,7 +361,7 @@ static DWORD WINAPI _async_queryfun(LPVOID arg) { async_query *aq = (async_query*)arg; int size = 0; WORD fail = 0; - char *targetptr = (HB_WIN32(aq)?(char*)aq->sbuf:(char*)PTR_SEG_TO_LIN(aq->sbuf)); + char *targetptr = (HB_WIN32(aq)?(char*)aq->sbuf:(char*)MapSL(aq->sbuf)); switch (aq->flags & AQ_GETMASK) { case AQ_GETHOST: { diff --git a/files/file.c b/files/file.c index 5259bc8170b..e3e4eeb2612 100644 --- a/files/file.c +++ b/files/file.c @@ -38,10 +38,8 @@ #include "wine/port.h" #include "drive.h" #include "file.h" -#include "global.h" #include "heap.h" #include "msdos.h" -#include "ldt.h" #include "task.h" #include "wincon.h" #include "debugtools.h" @@ -1137,7 +1135,7 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead, while ((result = read( unix_handle, buffer, bytesToRead )) == -1) { if ((errno == EAGAIN) || (errno == EINTR)) continue; - if ((errno == EFAULT) && !VIRTUAL_HandleFault( buffer )) continue; + if ((errno == EFAULT) && !IsBadWritePtr( buffer, bytesToRead )) continue; FILE_SetDosError(); break; } @@ -1171,7 +1169,7 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite, while ((result = write( unix_handle, buffer, bytesToWrite )) == -1) { if ((errno == EAGAIN) || (errno == EINTR)) continue; - if ((errno == EFAULT) && !VIRTUAL_HandleFault( buffer )) continue; + if ((errno == EFAULT) && !IsBadReadPtr( buffer, bytesToWrite )) continue; if (errno == ENOSPC) SetLastError( ERROR_DISK_FULL ); else @@ -1198,7 +1196,7 @@ LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count ) /* Some programs pass a count larger than the allocated buffer */ maxlen = GetSelectorLimit16( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1; if (count > maxlen) count = maxlen; - return _lread(DosFileHandleToWin32Handle(hFile), PTR_SEG_TO_LIN(buffer), count ); + return _lread(DosFileHandleToWin32Handle(hFile), MapSL(buffer), count ); } @@ -1418,7 +1416,7 @@ UINT16 WINAPI SetHandleCount16( UINT16 count ) { HGLOBAL16 hPDB = GetCurrentPDB16(); PDB16 *pdb = (PDB16 *)GlobalLock16( hPDB ); - BYTE *files = PTR_SEG_TO_LIN( pdb->fileHandlesPtr ); + BYTE *files = MapSL( pdb->fileHandlesPtr ); TRACE("(%d)\n", count ); diff --git a/graphics/escape.c b/graphics/escape.c index cc1b315f3af..a9828a56a14 100644 --- a/graphics/escape.c +++ b/graphics/escape.c @@ -9,7 +9,6 @@ #include "wingdi.h" #include "gdi.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(driver); @@ -173,63 +172,63 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, case QUERYESCSUPPORT: if (ret) TRACE("target DC implements Escape %d\n",nEscape); - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); + SEGPTR_FREE(MapSL(segin)); break; case SETLINECAP: case SETLINEJOIN: case SETMITERLIMIT: - *(LPINT)lpvOutData = *(LPINT16)PTR_SEG_TO_LIN(segout); - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); - SEGPTR_FREE(PTR_SEG_TO_LIN(segout)); + *(LPINT)lpvOutData = *(LPINT16)MapSL(segout); + SEGPTR_FREE(MapSL(segin)); + SEGPTR_FREE(MapSL(segout)); break; case GETSCALINGFACTOR: case GETPRINTINGOFFSET: case GETPHYSPAGESIZE: { - LPPOINT16 x = (LPPOINT16)PTR_SEG_TO_LIN(segout); + LPPOINT16 x = MapSL(segout); CONV_POINT16TO32(x,(LPPOINT)lpvOutData); SEGPTR_FREE(x); break; } case EXT_DEVICE_CAPS: - *(LPDWORD)lpvOutData = *(LPDWORD)PTR_SEG_TO_LIN(segout); - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); - SEGPTR_FREE(PTR_SEG_TO_LIN(segout)); + *(LPDWORD)lpvOutData = *(LPDWORD)MapSL(segout); + SEGPTR_FREE(MapSL(segin)); + SEGPTR_FREE(MapSL(segout)); break; case GETTECHNOLOGY: { - LPSTR x=PTR_SEG_TO_LIN(segout); + LPSTR x=MapSL(segout); strcpy(lpvOutData,x); SEGPTR_FREE(x); break; } case ENABLEPAIRKERNING: { - LPINT16 enab = (LPINT16)PTR_SEG_TO_LIN(segout); + LPINT16 enab = MapSL(segout); *(LPINT)lpvOutData = *enab; SEGPTR_FREE(enab); - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); + SEGPTR_FREE(MapSL(segin)); break; } case GETFACENAME: { - LPSTR x = (LPSTR)PTR_SEG_TO_LIN(segout); + LPSTR x = (LPSTR)MapSL(segout); strcpy(lpvOutData,x); SEGPTR_FREE(x); break; } case STARTDOC: { - DOCINFO16 *doc = PTR_SEG_TO_LIN(segout); - SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszDocName)); - SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszOutput)); - SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszDatatype)); + DOCINFO16 *doc = MapSL(segout); + SEGPTR_FREE(MapSL(doc->lpszDocName)); + SEGPTR_FREE(MapSL(doc->lpszOutput)); + SEGPTR_FREE(MapSL(doc->lpszDatatype)); SEGPTR_FREE(doc); - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); + SEGPTR_FREE(MapSL(segin)); break; } case CLIP_TO_PATH: case END_PATH: - SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); + SEGPTR_FREE(MapSL(segin)); break; default: diff --git a/graphics/mapping.c b/graphics/mapping.c index e94ea7cf5b9..4bf481550b0 100644 --- a/graphics/mapping.c +++ b/graphics/mapping.c @@ -212,7 +212,7 @@ BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) { SIZE size32; BOOL16 ret = SetViewportExtEx( hdc, x, y, &size32 ); - if (size) CONV_SIZE32TO16( &size32, size ); + if (size) { size->cx = size32.cx; size->cy = size32.cy; } return ret; } @@ -319,7 +319,7 @@ BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) { SIZE size32; BOOL16 ret = SetWindowExtEx( hdc, x, y, &size32 ); - if (size) CONV_SIZE32TO16( &size32, size ); + if (size) { size->cx = size32.cx; size->cy = size32.cy; } return ret; } @@ -527,7 +527,7 @@ BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, SIZE size32; BOOL16 ret = ScaleViewportExtEx( hdc, xNum, xDenom, yNum, yDenom, &size32 ); - if (size) CONV_SIZE32TO16( &size32, size ); + if (size) { size->cx = size32.cx; size->cy = size32.cy; } return ret; } @@ -592,7 +592,7 @@ BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, SIZE size32; BOOL16 ret = ScaleWindowExtEx( hdc, xNum, xDenom, yNum, yDenom, &size32 ); - if (size) CONV_SIZE32TO16( &size32, size ); + if (size) { size->cx = size32.cx; size->cy = size32.cy; } return ret; } diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c index cdcae1d57c4..5398302f1dd 100644 --- a/graphics/win16drv/init.c +++ b/graphics/win16drv/init.c @@ -258,11 +258,11 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, /* TTD Shouldn't really do pointer arithmetic on segment points */ physDev->segptrPDEVICE = WIN16_GlobalLock16(GlobalAlloc16(GHND, nPDEVICEsize))+sizeof(PDEVICE_HEADER); - *((BYTE *)PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+0) = 'N'; - *((BYTE *)PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+1) = 'B'; + *((BYTE *)MapSL(physDev->segptrPDEVICE)+0) = 'N'; + *((BYTE *)MapSL(physDev->segptrPDEVICE)+1) = 'B'; /* Set up the header */ - pPDH = (PDEVICE_HEADER *)((BYTE*)PTR_SEG_TO_LIN(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER)); + pPDH = (PDEVICE_HEADER *)((BYTE*)MapSL(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER)); pPDH->pLPD = pLPD; TRACE("PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE)); @@ -274,13 +274,13 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, physDev->BrushInfo = NULL; physDev->PenInfo = NULL; win16drv_SegPtr_TextXForm = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(TEXTXFORM16))); - win16drv_TextXFormP = PTR_SEG_TO_LIN(win16drv_SegPtr_TextXForm); + win16drv_TextXFormP = MapSL(win16drv_SegPtr_TextXForm); InitTextXForm(win16drv_TextXFormP); /* TTD Lots more to do here */ win16drv_SegPtr_DrawMode = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(DRAWMODE))); - win16drv_DrawModeP = PTR_SEG_TO_LIN(win16drv_SegPtr_DrawMode); + win16drv_DrawModeP = MapSL(win16drv_SegPtr_DrawMode); InitDrawMode(win16drv_DrawModeP); @@ -366,7 +366,7 @@ static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput, { /* lpInData is not necessarily \0 terminated so make it so */ char *cp = SEGPTR_ALLOC(cbInput + 1); - memcpy(cp, PTR_SEG_TO_LIN(lpInData), cbInput); + memcpy(cp, MapSL(lpInData), cbInput); cp[cbInput] = '\0'; nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape, diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c index f1d44f90119..b48b4c6f75e 100644 --- a/graphics/win16drv/prtdrv.c +++ b/graphics/win16drv/prtdrv.c @@ -123,10 +123,9 @@ static LOADED_PRINTER_DRIVER *FindPrinterDriverFromPDEVICE(SEGPTR segptrPDEVICE) /* Find the printer driver associated with this PDEVICE */ /* Each of the PDEVICE structures has a PDEVICE_HEADER structure */ /* just before it */ - if (segptrPDEVICE != (SEGPTR)NULL) + if (segptrPDEVICE != 0) { - PDEVICE_HEADER *pPDH = (PDEVICE_HEADER *) - ((char *) PTR_SEG_TO_LIN(segptrPDEVICE) - sizeof(PDEVICE_HEADER)); + PDEVICE_HEADER *pPDH = ((PDEVICE_HEADER *)MapSL(segptrPDEVICE)) - 1; pLPD = pPDH->pLPD; } return pLPD; diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index 9a6ba92daba..f71bb9b5951 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -3578,9 +3578,9 @@ HBITMAP16 X11DRV_DIB_CreateDIBSection16( } TRACE("ptr = %p, size =%d, selector = %04x, segptr = %ld\n", dib->dsBm.bmBits, size, ((X11DRV_DIBSECTION *) bmp->dib)->selector, - PTR_SEG_OFF_TO_SEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0)); + MAKESEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0)); if ( bits ) - *bits = PTR_SEG_OFF_TO_SEGPTR( ((X11DRV_DIBSECTION *) bmp->dib)->selector, 0 ); + *bits = MAKESEGPTR( ((X11DRV_DIBSECTION *) bmp->dib)->selector, 0 ); } if (bmp) GDI_ReleaseObj( res ); } diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index f966af3bb5e..d1fcb4efe03 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -13,8 +13,6 @@ #include "bitmap.h" #include "color.h" #include "debugtools.h" -#include "ldt.h" -#include "local.h" #include "winnt.h" #include "x11drv.h" @@ -324,7 +322,7 @@ static INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETSCALINGFACTOR: if( lpOutData ) { - LPPOINT16 lppt = (LPPOINT16)PTR_SEG_TO_LIN(lpOutData); + LPPOINT16 lppt = MapSL(lpOutData); lppt->x = lppt->y = 0; /* no device scaling */ return 1; } diff --git a/if1632/builtin.c b/if1632/builtin.c index 907c4cdaa46..11528e8d074 100644 --- a/if1632/builtin.c +++ b/if1632/builtin.c @@ -17,7 +17,6 @@ #include "module.h" #include "miscemu.h" #include "stackframe.h" -#include "selectors.h" #include "task.h" #include "debugtools.h" #include "toolhelp.h" @@ -204,7 +203,7 @@ LPCSTR BUILTIN_GetEntryPoint16( STACK16FRAME *frame, LPSTR name, WORD *pOrd ) *pOrd, *p, (char *)(p + 1) ); /* Retrieve type info string */ - return *(LPCSTR *)((LPBYTE)PTR_SEG_OFF_TO_LIN( frame->module_cs, frame->callfrom_ip ) + 4); + return *(LPCSTR *)((LPBYTE)MapSL( MAKESEGPTR( frame->module_cs, frame->callfrom_ip )) + 4); } diff --git a/if1632/relay.c b/if1632/relay.c index f7ace86c048..4ecc93e6510 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -48,11 +48,11 @@ BOOL RELAY_Init(void) CallTo16_DataSelector = __get_ds(); CallTo16_RetAddr = - PTR_SEG_OFF_TO_SEGPTR( codesel, (char*)CallTo16_Ret - (char*)Call16_Ret_Start ); + MAKESEGPTR( codesel, (char*)CallTo16_Ret - (char*)Call16_Ret_Start ); CALL32_CBClient_RetAddr = - PTR_SEG_OFF_TO_SEGPTR( codesel, (char*)CALL32_CBClient_Ret - (char*)Call16_Ret_Start ); + MAKESEGPTR( codesel, (char*)CALL32_CBClient_Ret - (char*)Call16_Ret_Start ); CALL32_CBClientEx_RetAddr = - PTR_SEG_OFF_TO_SEGPTR( codesel, (char*)CALL32_CBClientEx_Ret - (char*)Call16_Ret_Start ); + MAKESEGPTR( codesel, (char*)CALL32_CBClientEx_Ret - (char*)Call16_Ret_Start ); #endif return TRUE; } @@ -186,7 +186,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) case 't': case 'T': DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16, - debugres_a( (LPSTR)PTR_SEG_TO_LIN(*(SEGPTR *)args16 )) ); + debugres_a( MapSL(*(SEGPTR *)args16 )) ); args16 += 4; break; } @@ -230,7 +230,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) case 't': args16 -= 4; DPRINTF( "0x%08x %s", *(int *)args16, - debugres_a( (LPSTR)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ))); + debugres_a( MapSL(*(SEGPTR *)args16 ))); break; case 'p': args16 -= 4; @@ -239,7 +239,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) case 'T': args16 -= 4; DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16, - debugres_a( (LPSTR)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ))); + debugres_a( MapSL(*(SEGPTR *)args16 ))); break; } args++; diff --git a/if1632/snoop.c b/if1632/snoop.c index 57107a8b8c4..dafc14d84b8 100644 --- a/if1632/snoop.c +++ b/if1632/snoop.c @@ -11,9 +11,9 @@ #include "windef.h" #include "winnt.h" #include "wine/winbase16.h" +#include "wine/library.h" #include "heap.h" #include "global.h" -#include "selectors.h" #include "stackframe.h" #include "builtin16.h" #include "toolhelp.h" @@ -145,7 +145,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) { if (!TRACE_ON(snoop) || !pModule || !HIWORD(origfun)) return origfun; - if (!*(LPBYTE)PTR_SEG_TO_LIN(origfun)) /* 0x00 is an imposs. opcode, poss. dataref. */ + if (!*(LPBYTE)MapSL((SEGPTR)origfun)) /* 0x00 is an imposs. opcode, poss. dataref. */ return origfun; while (dll) { if (hmod == dll->hmod) @@ -207,10 +207,10 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) { return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle); } -#define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp)+4))) +#define CALLER1REF (*(DWORD*)(MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)+4)))) void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { DWORD ordinal=0; - DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(context->SegCs,LOWORD(context->Eip))-5; + DWORD entry=(DWORD)MapSL( MAKESEGPTR(context->SegCs,LOWORD(context->Eip)) )-5; WORD xcs = context->SegCs; SNOOP16_DLL *dll = firstdll; SNOOP16_FUN *fun = NULL; @@ -263,19 +263,19 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { max = fun->nrofargs; if (max>16) max=16; for (i=max;i--;) - DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp))+8+sizeof(WORD)*i),i?",":""); + DPRINTF("%04x%s",*(WORD*)((char *) MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)) )+8+sizeof(WORD)*i),i?",":""); if (max!=fun->nrofargs) DPRINTF(" ..."); } else if (fun->nrofargs<0) { DPRINTF(""); ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(WORD)); - memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(context->SegSs,LOWORD(context->Esp))+8),sizeof(WORD)*16); + memcpy(ret->args,(LPBYTE)((char *) MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)) )+8),sizeof(WORD)*16); } DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn)); } void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) { - SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(context->SegCs,LOWORD(context->Eip))-5); + SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) MapSL( MAKESEGPTR(context->SegCs,LOWORD(context->Eip)) )-5); /* We haven't found out the nrofargs yet. If we called a cdecl * function it is too late anyway and we can just set '0' (which diff --git a/if1632/thunk.c b/if1632/thunk.c index 34a0d5fa990..5155193ffc4 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -12,7 +12,6 @@ #include "heap.h" #include "module.h" #include "stackframe.h" -#include "selectors.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(thunk); @@ -85,7 +84,7 @@ FARPROC THUNK_Alloc( FARPROC16 func, RELAY relay ) if ( pModule && (pModule->flags & NE_FFLAGS_BUILTIN) && NE_SEG_TABLE(pModule)[0].hSeg == hSeg ) { - FARPROC proc = (FARPROC)((ENTRYPOINT16 *)PTR_SEG_TO_LIN( func ))->target; + FARPROC proc = (FARPROC)((ENTRYPOINT16 *)MapSL( (SEGPTR)func ))->target; TRACE( "(%04x:%04x, %p) -> built-in API %p\n", SELECTOROF( func ), OFFSETOF( func ), relay, proc ); @@ -153,7 +152,7 @@ static FARPROC THUNK_GetCalloutThunk( NE_MODULE *pModule, LPSTR name, RELAY rela if ( !proc ) return 0; if ( pModule->flags & NE_FFLAGS_BUILTIN ) - return (FARPROC)((ENTRYPOINT16 *)PTR_SEG_TO_LIN( proc ))->target; + return (FARPROC)((ENTRYPOINT16 *)MapSL( (SEGPTR)proc ))->target; else return (FARPROC)THUNK_Alloc( proc, relay ); } diff --git a/include/digitalv.h b/include/digitalv.h index e70e8811599..2adf5eaafa8 100644 --- a/include/digitalv.h +++ b/include/digitalv.h @@ -916,7 +916,7 @@ typedef struct { DWORD dwReturn; DWORD dwItem; DWORD dwTrack; - LPSTR lpstrDrive; + SEGPTR lpstrDrive; DWORD dwReference; } MCI_DGV_STATUS_PARMS16, *LPMCI_DGV_STATUS_PARMS16; diff --git a/include/mmddk.h b/include/mmddk.h index 7509fc80e29..53b517dae2d 100644 --- a/include/mmddk.h +++ b/include/mmddk.h @@ -426,7 +426,7 @@ typedef struct tMIXEROPENDESC typedef struct { UINT16 wDeviceID; /* device ID */ - LPSTR lpstrParams; /* parameter string for entry in SYSTEM.INI */ + SEGPTR lpstrParams; /* parameter string for entry in SYSTEM.INI */ UINT16 wCustomCommandTable; /* custom command table (0xFFFF if none) * filled in by the driver */ UINT16 wType; /* driver type (filled in by the driver) */ diff --git a/include/ole.h b/include/ole.h index 2539496a4db..11ff4c79e4a 100644 --- a/include/ole.h +++ b/include/ole.h @@ -304,13 +304,11 @@ OLESTATUS WINAPI OleRevokeClientDoc16(LHCLIENTDOC); OLESTATUS WINAPI OleRevokeServer16(LHSERVER); OLESTATUS WINAPI OleRevertClientDoc16(LHCLIENTDOC hServerDoc); OLESTATUS WINAPI OleEnumObjects16(LHCLIENTDOC hServerDoc, SEGPTR data); -OLESTATUS WINAPI OleCreateLinkFromClip16( - LPCSTR name, LPOLECLIENT olecli, LHCLIENTDOC hclientdoc, LPCSTR xname, - LPOLEOBJECT *lpoleob, UINT16 render, UINT16 clipformat); +OLESTATUS WINAPI OleCreateLinkFromClip16(LPCSTR,SEGPTR,LHCLIENTDOC,LPCSTR,SEGPTR,UINT16,UINT16); OLESTATUS WINAPI OleQueryLinkFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat); OLESTATUS WINAPI OleQueryCreateFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat); OLESTATUS WINAPI OleQueryType16(LPOLEOBJECT oleob, SEGPTR xlong); -OLESTATUS WINAPI OleCreateFromClip16(LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT*,UINT16,UINT16); +OLESTATUS WINAPI OleCreateFromClip16(LPCSTR,SEGPTR,LHCLIENTDOC,LPCSTR,SEGPTR,UINT16,UINT16); HRESULT WINAPI RegisterDragDrop16(HWND16,LPDROPTARGET); HRESULT WINAPI RevokeDragDrop16(HWND16); diff --git a/include/stackframe.h b/include/stackframe.h index 9cc0389b8f8..d97d7914751 100644 --- a/include/stackframe.h +++ b/include/stackframe.h @@ -9,9 +9,9 @@ #include -#include "ldt.h" #include "thread.h" #include "winnt.h" +#include "wine/winbase16.h" #include "pshpack1.h" @@ -55,7 +55,7 @@ typedef struct _STACK16FRAME #include "poppack.h" -#define THREAD_STACK16(teb) ((STACK16FRAME*)PTR_SEG_TO_LIN((teb)->cur_stack)) +#define THREAD_STACK16(teb) ((STACK16FRAME*)MapSL((teb)->cur_stack)) #define CURRENT_STACK16 (THREAD_STACK16(NtCurrentTeb())) #define CURRENT_DS (CURRENT_STACK16->ds) diff --git a/include/user.h b/include/user.h index ec6b129e989..eb8d2af5700 100644 --- a/include/user.h +++ b/include/user.h @@ -7,7 +7,6 @@ #ifndef __WINE_USER_H #define __WINE_USER_H -#include "ldt.h" #include "local.h" extern WORD USER_HeapSel; @@ -19,9 +18,7 @@ extern WORD USER_HeapSel; #define USER_HEAP_FREE(handle) \ LOCAL_Free( USER_HeapSel, (handle) ) #define USER_HEAP_LIN_ADDR(handle) \ - ((handle) ? PTR_SEG_OFF_TO_LIN(USER_HeapSel, (handle)) : NULL) -#define USER_HEAP_SEG_ADDR(handle) \ - ((handle) ? PTR_SEG_OFF_TO_SEGPTR(USER_HeapSel, (handle)) : (SEGPTR)0) + ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, (handle))) : NULL) #define USUD_LOCALALLOC 0x0001 #define USUD_LOCALFREE 0x0002 diff --git a/include/wine/mmsystem16.h b/include/wine/mmsystem16.h index 37bd4d0e034..291fa11abb3 100644 --- a/include/wine/mmsystem16.h +++ b/include/wine/mmsystem16.h @@ -38,8 +38,8 @@ typedef struct { typedef struct { DWORD dwDCISize; - LPCSTR lpszDCISectionName; - LPCSTR lpszDCIAliasName; + SEGPTR lpszDCISectionName; + SEGPTR lpszDCIAliasName; } DRVCONFIGINFO16, *LPDRVCONFIGINFO16; /* GetDriverInfo16 references this structure, so this a struct defined @@ -94,8 +94,8 @@ UINT16 WINAPI waveOutSetVolume16(UINT16,DWORD); UINT16 WINAPI waveOutGetErrorText16(UINT16,LPSTR,UINT16); UINT16 WINAPI waveOutOpen16(HWAVEOUT16*,UINT16,const LPWAVEFORMATEX,DWORD,DWORD,DWORD); UINT16 WINAPI waveOutClose16(HWAVEOUT16); -UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16,WAVEHDR*,UINT16); -UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16,WAVEHDR*,UINT16); +UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16,SEGPTR,UINT16); +UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16,SEGPTR,UINT16); UINT16 WINAPI waveOutWrite16(HWAVEOUT16,WAVEHDR*,UINT16); UINT16 WINAPI waveOutPause16(HWAVEOUT16); UINT16 WINAPI waveOutRestart16(HWAVEOUT16); @@ -113,8 +113,8 @@ UINT16 WINAPI waveInGetDevCaps16(UINT16,LPWAVEINCAPS16,UINT16); UINT16 WINAPI waveInGetErrorText16(UINT16,LPSTR,UINT16); UINT16 WINAPI waveInOpen16(HWAVEIN16*,UINT16,const LPWAVEFORMATEX,DWORD,DWORD,DWORD); UINT16 WINAPI waveInClose16(HWAVEIN16); -UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16,WAVEHDR*,UINT16); -UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16,WAVEHDR*,UINT16); +UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16,SEGPTR,UINT16); +UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16,SEGPTR,UINT16); UINT16 WINAPI waveInAddBuffer16(HWAVEIN16,WAVEHDR*,UINT16); UINT16 WINAPI waveInStart16(HWAVEIN16); UINT16 WINAPI waveInStop16(HWAVEIN16); @@ -162,8 +162,8 @@ UINT16 WINAPI midiOutSetVolume16(UINT16,DWORD); UINT16 WINAPI midiOutGetErrorText16(UINT16,LPSTR,UINT16); UINT16 WINAPI midiOutOpen16(HMIDIOUT16*,UINT16,DWORD,DWORD,DWORD); UINT16 WINAPI midiOutClose16(HMIDIOUT16); -UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16,MIDIHDR16*,UINT16); -UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16,MIDIHDR16*,UINT16); +UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16,SEGPTR,UINT16); +UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16,SEGPTR,UINT16); UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16,DWORD); UINT16 WINAPI midiOutLongMsg16(HMIDIOUT16,MIDIHDR16*,UINT16); UINT16 WINAPI midiOutReset16(HMIDIOUT16); @@ -176,8 +176,8 @@ UINT16 WINAPI midiInGetDevCaps16(UINT16,LPMIDIINCAPS16,UINT16); UINT16 WINAPI midiInGetErrorText16(UINT16,LPSTR,UINT16); UINT16 WINAPI midiInOpen16(HMIDIIN16*,UINT16,DWORD,DWORD,DWORD); UINT16 WINAPI midiInClose16(HMIDIIN16); -UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16,MIDIHDR16*,UINT16); -UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16,MIDIHDR16*,UINT16); +UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16,SEGPTR,UINT16); +UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16,SEGPTR,UINT16); UINT16 WINAPI midiInAddBuffer16(HMIDIIN16,MIDIHDR16*,UINT16); UINT16 WINAPI midiInStart16(HMIDIIN16); UINT16 WINAPI midiInStop16(HMIDIIN16); @@ -311,7 +311,7 @@ typedef struct { } DUMMYUNIONNAME; DWORD cControls; /* count of controls pmxctrl points to */ DWORD cbmxctrl; /* size in bytes of _one_ MIXERCONTROL */ - LPMIXERCONTROL16 pamxctrl;/* pointer to first MIXERCONTROL array */ + SEGPTR pamxctrl; /* pointer to first MIXERCONTROL array */ } MIXERLINECONTROLS16, *LPMIXERLINECONTROLS16; typedef struct { @@ -418,20 +418,20 @@ typedef struct { DWORD dwCallback; WORD wDeviceID; WORD wReserved0; - LPSTR lpstrDeviceType; - LPSTR lpstrElementName; - LPSTR lpstrAlias; + SEGPTR lpstrDeviceType; + SEGPTR lpstrElementName; + SEGPTR lpstrAlias; } MCI_OPEN_PARMS16, *LPMCI_OPEN_PARMS16; typedef struct { DWORD dwCallback; - LPSTR lpstrReturn; + SEGPTR lpstrReturn; DWORD dwRetSize; } MCI_INFO_PARMS16, *LPMCI_INFO_PARMS16; typedef struct { DWORD dwCallback; - LPSTR lpstrReturn; + SEGPTR lpstrReturn; DWORD dwRetSize; DWORD dwNumber; WORD wDeviceType; @@ -453,7 +453,7 @@ typedef struct { typedef struct { DWORD dwCallback; - LPCSTR lpstrCommand; + SEGPTR lpstrCommand; } MCI_VD_ESCAPE_PARMS16, *LPMCI_VD_ESCAPE_PARMS16; typedef struct { diff --git a/include/wine/port.h b/include/wine/port.h index 8f14188b1cc..877ab781dd5 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -11,6 +11,7 @@ #include #include #include +#include /* Types */ diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h index b5bcbdf63ff..3eaac04b24e 100644 --- a/include/wine/winbase16.h +++ b/include/wine/winbase16.h @@ -143,6 +143,9 @@ typedef struct #define NE_RSCTYPE_GROUP_ICON 0x800e +#define __AHSHIFT 3 /* don't change! */ +#define __AHINCR (1 << __AHSHIFT) + /* undocumented functions */ WORD WINAPI AllocCStoDSAlias16(WORD); WORD WINAPI AllocDStoCSAlias16(WORD); @@ -202,7 +205,7 @@ VOID WINAPI PostEvent16(HTASK16); WORD WINAPI PrestoChangoSelector16(WORD,WORD); WORD WINAPI SelectorAccessRights16(WORD,WORD,WORD); VOID WINAPI SetPriority16(HTASK16,INT16); -FARPROC16 WINAPI SetResourceHandler16(HINSTANCE16,SEGPTR,FARPROC16); +FARPROC16 WINAPI SetResourceHandler16(HINSTANCE16,LPCSTR,FARPROC16); WORD WINAPI SetSelectorLimit16(WORD,DWORD); HQUEUE16 WINAPI SetTaskQueue16(HTASK16,HQUEUE16); VOID WINAPI SwitchStackTo16(WORD,WORD,WORD); diff --git a/include/wine/windef16.h b/include/wine/windef16.h index cf0907b1bda..caa6a45ecff 100644 --- a/include/wine/windef16.h +++ b/include/wine/windef16.h @@ -23,6 +23,8 @@ typedef UINT16 WPARAM16; typedef INT16 *LPINT16; typedef UINT16 *LPUINT16; +#define MAKESEGPTR(seg,off) ((SEGPTR)MAKELONG(off,seg)) + #define HFILE_ERROR16 ((HFILE16)-1) #define DECLARE_HANDLE16(a) \ @@ -109,23 +111,6 @@ typedef struct INT16 bottom; } RECT16, *LPRECT16; -#define CONV_SIZE16TO32(s16,s32) \ - ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy) -#define CONV_SIZE32TO16(s32,s16) \ - ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy) - -#define CONV_POINT16TO32(p16,p32) \ - ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y) -#define CONV_POINT32TO16(p32,p16) \ - ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y) - -#define CONV_RECT16TO32(r16,r32) \ - ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \ - (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom) -#define CONV_RECT32TO16(r32,r16) \ - ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \ - (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom) - /* Callback function pointers types */ typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); diff --git a/include/wine/wingdi16.h b/include/wine/wingdi16.h index ccf25f1810d..915af954da2 100644 --- a/include/wine/wingdi16.h +++ b/include/wine/wingdi16.h @@ -257,6 +257,35 @@ typedef struct HMETAFILE16 hMF; } METAFILEPICT16, *LPMETAFILEPICT16; +typedef struct { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINT16 apts[1]; +} EMRPOLYLINE16, *PEMRPOLYLINE16, + EMRPOLYBEZIER16, *PEMRPOLYBEZIER16, + EMRPOLYGON16, *PEMRPOLYGON16, + EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16, + EMRPOLYLINETO16, *PEMRPOLYLINETO16; + +typedef struct { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINT16 apts[1]; + BYTE abTypes[1]; +} EMRPOLYDRAW16, *PEMRPOLYDRAW16; + +typedef struct { + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cpts; + DWORD aPolyCounts[1]; + POINT16 apts[1]; +} EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16, + EMRPOLYPOLYGON16, *PEMRPOLYPOLYGON16; + typedef INT16 CALLBACK (*MFENUMPROC16)(HDC16,HANDLETABLE16*,METARECORD*, INT16,LPARAM); typedef struct @@ -455,12 +484,10 @@ BOOL16 WINAPI Polyline16(HDC16,const POINT16*,INT16); BOOL16 WINAPI PtInRegion16(HRGN16,INT16,INT16); BOOL16 WINAPI PtVisible16(HDC16,INT16,INT16); UINT16 WINAPI RealizeDefaultPalette16(HDC16); -/* FIXME This is defined in user.spec !? */ -UINT16 WINAPI RealizePalette16(HDC16); BOOL16 WINAPI Rectangle16(HDC16,INT16,INT16,INT16,INT16); BOOL16 WINAPI RectInRegion16(HRGN16,const RECT16 *); BOOL16 WINAPI RectVisible16(HDC16,const RECT16*); -BOOL16 WINAPI RemoveFontResource16(SEGPTR); +BOOL16 WINAPI RemoveFontResource16(LPCSTR); HDC16 WINAPI ResetDC16(HDC16,const DEVMODEA *); BOOL16 WINAPI ResizePalette16(HPALETTE16,UINT16); BOOL16 WINAPI RestoreDC16(HDC16,INT16); @@ -476,8 +503,6 @@ BOOL16 WINAPI ScaleWindowExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16); BOOL16 WINAPI SelectClipPath16(HDC16,INT16); INT16 WINAPI SelectClipRgn16(HDC16,HRGN16); HGDIOBJ16 WINAPI SelectObject16(HDC16,HGDIOBJ16); -/* FIXME This is defined in user.spec !? */ -HPALETTE16 WINAPI SelectPalette16(HDC16,HPALETTE16,BOOL16); INT16 WINAPI SelectVisRgn16(HDC16,HRGN16); INT16 WINAPI SetAbortProc16(HDC16,SEGPTR); INT16 WINAPI SetArcDirection16(HDC16,INT16); @@ -537,4 +562,32 @@ INT16 WINAPI WriteDialog16(HPJOB16,LPSTR,INT16); INT16 WINAPI WriteSpool16(HPJOB16,LPSTR,INT16); +inline static void CONV_POINT16TO32( const POINT16 *p16, POINT *p32 ) +{ + p32->x = p16->x; + p32->y = p16->y; +} + +inline static void CONV_POINT32TO16( const POINT *p32, POINT16 *p16 ) +{ + p16->x = (INT16)p32->x; + p16->y = (INT16)p32->y; +} + +inline static void CONV_RECT16TO32( const RECT16 *r16, RECT *r32 ) +{ + r32->left = r16->left; + r32->top = r16->top; + r32->right = r16->right; + r32->bottom = r16->bottom; +} + +inline static void CONV_RECT32TO16( const RECT *r32, RECT16 *r16 ) +{ + r16->left = (INT16)r32->left; + r16->top = (INT16)r32->top; + r16->right = (INT16)r32->right; + r16->bottom = (INT16)r32->bottom; +} + #endif /* __WINE_WINE_WINGDI16_H */ diff --git a/include/wine/winuser16.h b/include/wine/winuser16.h index 8df3b658b61..9b53e3b4065 100644 --- a/include/wine/winuser16.h +++ b/include/wine/winuser16.h @@ -166,7 +166,7 @@ typedef struct { HBITMAP16 hbmpChecked; HBITMAP16 hbmpUnchecked; DWORD dwItemData; - LPSTR dwTypeData; + SEGPTR dwTypeData; UINT16 cch; } MENUITEMINFO16, *LPMENUITEMINFO16; @@ -831,6 +831,7 @@ BOOL16 WINAPI PostAppMessage16(HTASK16,UINT16,WPARAM16,LPARAM); BOOL16 WINAPI PostMessage16(HWND16,UINT16,WPARAM16,LPARAM); void WINAPI PostQuitMessage16(INT16); BOOL16 WINAPI PtInRect16(const RECT16*,POINT16); +UINT16 WINAPI RealizePalette16(HDC16); BOOL16 WINAPI RedrawWindow16(HWND16,const RECT16*,HRGN16,UINT16); ATOM WINAPI RegisterClass16(const WNDCLASS16*); ATOM WINAPI RegisterClassEx16(const WNDCLASSEX16*); @@ -847,6 +848,7 @@ BOOL16 WINAPI ScrollDC16(HDC16,INT16,INT16,const RECT16*,const RECT16*, void WINAPI ScrollWindow16(HWND16,INT16,INT16,const RECT16*,const RECT16*); INT16 WINAPI ScrollWindowEx16(HWND16,INT16,INT16,const RECT16*, const RECT16*,HRGN16,LPRECT16,UINT16); +HPALETTE16 WINAPI SelectPalette16(HDC16,HPALETTE16,BOOL16); LRESULT WINAPI SendDlgItemMessage16(HWND16,INT16,UINT16,WPARAM16,LPARAM); LRESULT WINAPI SendMessage16(HWND16,UINT16,WPARAM16,LPARAM); HWND16 WINAPI SetActiveWindow16(HWND16); diff --git a/include/wingdi.h b/include/wingdi.h index d6f7db94736..0560f2c0b6a 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -2269,17 +2269,6 @@ typedef struct { EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO, EMRPOLYLINETO, *PEMRPOLYLINETO; -typedef struct { - EMR emr; - RECTL rclBounds; - DWORD cpts; - POINTS apts[1]; -} EMRPOLYLINE16, *PEMRPOLYLINE16, - EMRPOLYBEZIER16, *PEMRPOLYBEZIER16, - EMRPOLYGON16, *PEMRPOLYGON16, - EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16, - EMRPOLYLINETO16, *PEMRPOLYLINETO16; - typedef struct { EMR emr; RECTL rclBounds; @@ -2288,14 +2277,6 @@ typedef struct { BYTE abTypes[1]; } EMRPOLYDRAW, *PEMRPOLYDRAW; -typedef struct { - EMR emr; - RECTL rclBounds; - DWORD cpts; - POINTS apts[1]; - BYTE abTypes[1]; -} EMRPOLYDRAW16, *PEMRPOLYDRAW16; - typedef struct { EMR emr; RECTL rclBounds; @@ -2306,16 +2287,6 @@ typedef struct { } EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE, EMRPOLYPOLYGON, *PEMRPOLYPOLYGON; -typedef struct { - EMR emr; - RECTL rclBounds; - DWORD nPolys; - DWORD cpts; - DWORD aPolyCounts[1]; - POINTS apts[1]; -} EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16, - EMRPOLYPOLYGON16, *PEMRPOLYPOLYGON16; - typedef struct { EMR emr; RECTL rclBounds; diff --git a/include/winnt.h b/include/winnt.h index 1ed24e2cec7..9b460ad31ae 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -818,6 +818,35 @@ typedef HANDLE *PHANDLE; # endif #endif /* __GNUC__ */ +/* Segment register access */ + +#ifdef __i386__ +# ifdef __GNUC__ +# define __DEFINE_GET_SEG(seg) \ + extern inline unsigned short __get_##seg(void) \ + { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; } +# define __DEFINE_SET_SEG(seg) \ + extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); } +# else /* __GNUC__ */ +# define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void); +# define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int); +# endif /* __GNUC__ */ +#else /* __i386__ */ +# define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; } +# define __DEFINE_SET_SEG(seg) /* nothing */ +#endif /* __i386__ */ + +__DEFINE_GET_SEG(cs) +__DEFINE_GET_SEG(ds) +__DEFINE_GET_SEG(es) +__DEFINE_GET_SEG(fs) +__DEFINE_GET_SEG(gs) +__DEFINE_GET_SEG(ss) +__DEFINE_SET_SEG(fs) +__DEFINE_SET_SEG(gs) +#undef __DEFINE_GET_SEG +#undef __DEFINE_SET_SEG + #endif /* __WINE__ */ diff --git a/loader/dos/module.c b/loader/dos/module.c index d1193f82e32..ce766fa1cbc 100644 --- a/loader/dos/module.c +++ b/loader/dos/module.c @@ -23,9 +23,7 @@ #include "winerror.h" #include "module.h" #include "task.h" -#include "selectors.h" #include "file.h" -#include "ldt.h" #include "miscemu.h" #include "debugtools.h" #include "dosexe.h" @@ -144,9 +142,9 @@ static void MZ_InitHandlers(void) LPBYTE start=DOSMEM_GetBlock(sizeof(int08),&seg); memcpy(start,int08,sizeof(int08)); /* INT 08: point it at our tick-incrementing handler */ - ((SEGPTR*)0)[0x08]=PTR_SEG_OFF_TO_SEGPTR(seg,0); + ((SEGPTR*)0)[0x08]=MAKESEGPTR(seg,0); /* INT 1C: just point it to IRET, we don't want to handle it ourselves */ - ((SEGPTR*)0)[0x1C]=PTR_SEG_OFF_TO_SEGPTR(seg,sizeof(int08)-1); + ((SEGPTR*)0)[0x1C]=MAKESEGPTR(seg,sizeof(int08)-1); } static WORD MZ_InitEnvironment( LPCSTR env, LPCSTR name ) @@ -382,7 +380,7 @@ BOOL MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk ) /* save current process's return SS:SP now */ LPBYTE psp_start = (LPBYTE)((DWORD)lpDosTask->psp_seg << 4); PDB16 *psp = (PDB16 *)psp_start; - psp->saveStack = (DWORD)PTR_SEG_OFF_TO_SEGPTR(context->SegSs, LOWORD(context->Esp)); + psp->saveStack = (DWORD)MAKESEGPTR(context->SegSs, LOWORD(context->Esp)); } ret = MZ_DoLoadImage( hFile, filename, NULL ); if (ret) { @@ -392,7 +390,7 @@ BOOL MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk ) ExecBlock *blk = (ExecBlock *)paramblk; MZ_FillPSP(psp_start, DOSMEM_MapRealToLinear(blk->cmdline)); /* the lame MS-DOS engineers decided that the return address should be in int22 */ - INT_SetRMHandler(0x22, (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(context->SegCs, LOWORD(context->Eip))); + INT_SetRMHandler(0x22, (FARPROC16)MAKESEGPTR(context->SegCs, LOWORD(context->Eip))); if (func) { /* don't execute, just return startup state */ blk->init_cs = init_cs; diff --git a/loader/module.c b/loader/module.c index a741b915efe..bd64dbecf0e 100644 --- a/loader/module.c +++ b/loader/module.c @@ -16,7 +16,6 @@ #include "heap.h" #include "file.h" #include "module.h" -#include "selectors.h" #include "debugtools.h" #include "callback.h" #include "loadorder.h" @@ -1748,15 +1747,14 @@ SEGPTR WINAPI HasGPHandler16( SEGPTR address ) && (gpOrdinal = NE_GetOrdinal( hModule, "__GP" )) != 0 && (gpPtr = (SEGPTR)NE_GetEntryPointEx( hModule, gpOrdinal, FALSE )) != 0 && !IsBadReadPtr16( gpPtr, sizeof(GPHANDLERDEF) ) - && (gpHandler = PTR_SEG_TO_LIN( gpPtr )) != NULL ) + && (gpHandler = MapSL( gpPtr )) != NULL ) { while (gpHandler->selector) { if ( SELECTOROF(address) == gpHandler->selector && OFFSETOF(address) >= gpHandler->rangeStart && OFFSETOF(address) < gpHandler->rangeEnd ) - return PTR_SEG_OFF_TO_SEGPTR( gpHandler->selector, - gpHandler->handler ); + return MAKESEGPTR( gpHandler->selector, gpHandler->handler ); gpHandler++; } } diff --git a/loader/ne/module.c b/loader/ne/module.c index f6cbefc15f7..3cc10d79938 100644 --- a/loader/ne/module.c +++ b/loader/ne/module.c @@ -11,11 +11,11 @@ #include #include #include "wine/winbase16.h" +#include "wine/library.h" #include "winerror.h" #include "module.h" #include "toolhelp.h" #include "file.h" -#include "ldt.h" #include "heap.h" #include "task.h" #include "global.h" @@ -336,11 +336,11 @@ FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop ) if (sel == 0xfe) sel = 0xffff; /* constant entry */ else sel = GlobalHandleToSel16(NE_SEG_TABLE(pModule)[sel-1].hSeg); if (sel==0xffff) - return (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( sel, offset ); + return (FARPROC16)MAKESEGPTR( sel, offset ); if (!snoop) - return (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( sel, offset ); + return (FARPROC16)MAKESEGPTR( sel, offset ); else - return (FARPROC16)SNOOP16_GetProcAddress16(hModule,ordinal,(FARPROC16)PTR_SEG_OFF_TO_SEGPTR( sel, offset )); + return (FARPROC16)SNOOP16_GetProcAddress16(hModule,ordinal,(FARPROC16)MAKESEGPTR( sel, offset )); } @@ -1078,8 +1078,8 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock ) /* Create a task for this process */ params = (LOADPARAMS16 *)paramBlock; - cmdShow = ((WORD *)PTR_SEG_TO_LIN(params->showCmd))[1]; - cmdline = PTR_SEG_TO_LIN( params->cmdLine ); + cmdShow = ((WORD *)MapSL(params->showCmd))[1]; + cmdline = MapSL( params->cmdLine ); if (!TASK_Create( pModule, cmdShow, teb, cmdline + 1, *cmdline )) goto error; hTask = teb->htask16; @@ -1169,7 +1169,7 @@ static void NE_InitProcess(void) sp = pSegTable[pModule->ss-1].minsize + pModule->stack_size; sp &= ~1; sp -= sizeof(STACK16FRAME); - pTask->teb->cur_stack = PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel16(hInstance), sp ); + pTask->teb->cur_stack = MAKESEGPTR( GlobalHandleToSel16(hInstance), sp ); /* Registers at initialization must be: * ax zero @@ -1424,7 +1424,7 @@ DWORD WINAPI WIN16_GetModuleHandle( SEGPTR name ) { if (HIWORD(name) == 0) return MAKELONG(GetExePtr( (HINSTANCE16)name), hFirstModule ); - return MAKELONG(GetModuleHandle16( PTR_SEG_TO_LIN(name)), hFirstModule ); + return MAKELONG(GetModuleHandle16( MapSL(name)), hFirstModule ); } /*********************************************************************** diff --git a/loader/ne/resource.c b/loader/ne/resource.c index 779bc49b358..531585ec7b9 100644 --- a/loader/ne/resource.c +++ b/loader/ne/resource.c @@ -15,8 +15,8 @@ #include #include "windef.h" #include "wine/winbase16.h" +#include "wine/library.h" #include "global.h" -#include "ldt.h" #include "module.h" #include "callback.h" #include "debugtools.h" @@ -269,7 +269,7 @@ BOOL NE_InitResourceHandler( HMODULE16 hModule ) /********************************************************************** * SetResourceHandler (KERNEL.43) */ -FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, SEGPTR typeId, +FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId, FARPROC16 resourceHandler ) { FARPROC16 prevHandler = NULL; @@ -279,12 +279,11 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, SEGPTR typeId, if (!pModule || !pModule->res_table) return NULL; - TRACE("module=%04x type=%s\n", - hModule, debugres_a(PTR_SEG_TO_LIN(typeId)) ); + TRACE("module=%04x type=%s\n", hModule, debugres_a(typeId) ); for (;;) { - if (!(pTypeInfo = NE_FindTypeSection( pResTab, pTypeInfo, PTR_SEG_TO_LIN(typeId) ))) + if (!(pTypeInfo = NE_FindTypeSection( pResTab, pTypeInfo, typeId ))) break; prevHandler = pTypeInfo->resloader; pTypeInfo->resloader = resourceHandler; diff --git a/loader/ne/segment.c b/loader/ne/segment.c index 2b780dbb790..0d3df107215 100644 --- a/loader/ne/segment.c +++ b/loader/ne/segment.c @@ -16,6 +16,7 @@ #include #include "wine/winbase16.h" +#include "wine/library.h" #include "global.h" #include "task.h" #include "file.h" @@ -141,11 +142,10 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) HFILE hFile32; HFILE16 hFile16; - selfloadheader = (SELFLOADHEADER *) - PTR_SEG_OFF_TO_LIN(SEL(pSegTable->hSeg),0); + selfloadheader = MapSL( MAKESEGPTR(SEL(pSegTable->hSeg),0) ); oldstack = NtCurrentTeb()->cur_stack; - NtCurrentTeb()->cur_stack = PTR_SEG_OFF_TO_SEGPTR(pModule->self_loading_sel, - 0xff00 - sizeof(STACK16FRAME)); + NtCurrentTeb()->cur_stack = MAKESEGPTR(pModule->self_loading_sel, + 0xff00 - sizeof(STACK16FRAME)); TRACE_(dll)("CallLoadAppSegProc(hmodule=0x%04x,hf=0x%04x,segnum=%d\n", pModule->self,hf,segnum ); @@ -307,7 +307,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) } else { - address = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( SEL(pSegTable[rep->target1-1].hSeg), rep->target2 ); + address = (FARPROC16)MAKESEGPTR( SEL(pSegTable[rep->target1-1].hSeg), rep->target2 ); } TRACE_(fixup)("%d: %04x:%04x %s\n", @@ -345,7 +345,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) if (additive) { - sp = PTR_SEG_OFF_TO_LIN( SEL(pSeg->hSeg), offset ); + sp = MapSL( MAKESEGPTR( SEL(pSeg->hSeg), offset ) ); TRACE_(fixup)(" %04x:%04x\n", offset, *sp ); switch (rep->address_type & 0x7f) { @@ -374,7 +374,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) { do { - sp = PTR_SEG_OFF_TO_LIN( SEL(pSeg->hSeg), offset ); + sp = MapSL( MAKESEGPTR( SEL(pSeg->hSeg), offset ) ); next_offset = *sp; TRACE_(fixup)(" %04x:%04x\n", offset, *sp ); switch (rep->address_type & 0x7f) @@ -435,15 +435,14 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule ) *((BYTE*)pModule + pModule->name_table), (char *)pModule + pModule->name_table + 1); if (!NE_LoadSegment( pModule, 1 )) return FALSE; - selfloadheader = (SELFLOADHEADER *) - PTR_SEG_OFF_TO_LIN(SEL(pSegTable->hSeg), 0); + selfloadheader = MapSL( MAKESEGPTR(SEL(pSegTable->hSeg), 0) ); selfloadheader->EntryAddrProc = GetProcAddress16(mod,"EntryAddrProc"); selfloadheader->MyAlloc = GetProcAddress16(mod,"MyAlloc"); selfloadheader->SetOwner = GetProcAddress16(mod,"FarSetOwner"); pModule->self_loading_sel = SEL(GLOBAL_Alloc(GMEM_ZEROINIT, 0xFF00, pModule->self, WINE_LDT_FLAGS_DATA)); oldstack = NtCurrentTeb()->cur_stack; - NtCurrentTeb()->cur_stack = PTR_SEG_OFF_TO_SEGPTR(pModule->self_loading_sel, - 0xff00 - sizeof(STACK16FRAME) ); + NtCurrentTeb()->cur_stack = MAKESEGPTR(pModule->self_loading_sel, + 0xff00 - sizeof(STACK16FRAME) ); DuplicateHandle( GetCurrentProcess(), NE_OpenFile(pModule), GetCurrentProcess(), &hf, 0, FALSE, DUPLICATE_SAME_ACCESS ); @@ -492,7 +491,7 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum) if (!(dgroup = SEL(pSegTable[pModule->dgroup-1].hSeg))) return; - pSeg = PTR_SEG_OFF_TO_LIN(sel, 0); + pSeg = MapSL( MAKESEGPTR(sel, 0) ); bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->entry_table); @@ -714,8 +713,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason ) if ( pModule->flags & NE_FFLAGS_BUILTIN ) { - WinNEEntryProc entryProc = (WinNEEntryProc) - ((ENTRYPOINT16 *)PTR_SEG_TO_LIN( entryPoint ))->target; + WinNEEntryProc entryProc = (WinNEEntryProc)((ENTRYPOINT16 *)MapSL( (SEGPTR)entryPoint ))->target; entryProc( dwReason, hInst, ds, heap, 0, 0 ); } diff --git a/loader/resource.c b/loader/resource.c index 06cd3552887..2a8d5910156 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -16,8 +16,6 @@ #include "winbase.h" #include "wine/winbase16.h" #include "wine/exception.h" -#include "ldt.h" -#include "global.h" #include "heap.h" #include "callback.h" #include "cursoricon.h" @@ -393,7 +391,7 @@ SEGPTR WINAPI WIN16_LockResource16( HGLOBAL16 handle ) */ LPVOID WINAPI LockResource16( HGLOBAL16 handle ) { - return PTR_SEG_TO_LIN( WIN16_LockResource16(handle) ); + return MapSL( WIN16_LockResource16(handle) ); } /********************************************************************** diff --git a/loader/task.c b/loader/task.c index 4cb9f816a19..f38f2b2969b 100644 --- a/loader/task.c +++ b/loader/task.c @@ -177,7 +177,7 @@ static SEGPTR TASK_AllocThunk( HTASK16 hTask ) } base += pThunk->free; pThunk->free = *(WORD *)((BYTE *)pThunk + pThunk->free); - return PTR_SEG_OFF_TO_SEGPTR( sel, base ); + return MAKESEGPTR( sel, base ); } @@ -278,8 +278,7 @@ BOOL TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, TEB *teb, LPCSTR cmdline, pTask->pdb.savedint23 = INT_GetPMHandler( 0x23 ); pTask->pdb.savedint24 = INT_GetPMHandler( 0x24 ); pTask->pdb.fileHandlesPtr = - PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel16(pTask->hPDB), - (int)&((PDB16 *)0)->fileHandles ); + MAKESEGPTR( GlobalHandleToSel16(pTask->hPDB), (int)&((PDB16 *)0)->fileHandles ); pTask->pdb.hFileHandles = 0; memset( pTask->pdb.fileHandles, 0xff, sizeof(pTask->pdb.fileHandles) ); /* FIXME: should we make a copy of the environment? */ @@ -316,8 +315,7 @@ BOOL TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, TEB *teb, LPCSTR cmdline, /* Default DTA overwrites command line */ - pTask->dta = PTR_SEG_OFF_TO_SEGPTR( pTask->hPDB, - (int)&pTask->pdb.cmdLine - (int)&pTask->pdb ); + pTask->dta = MAKESEGPTR( pTask->hPDB, (int)&pTask->pdb.cmdLine - (int)&pTask->pdb ); /* Create scheduler event for 16-bit tasks */ @@ -617,7 +615,7 @@ void WINAPI InitTask16( CONTEXT86 *context ) size of the instance data segment before calling InitTask() */ /* Initialize the INSTANCEDATA structure */ - pinstance = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN(CURRENT_DS, 0); + pinstance = MapSL( MAKESEGPTR(CURRENT_DS, 0) ); pinstance->stackmin = OFFSETOF( pTask->teb->cur_stack ) + sizeof( STACK16FRAME ); pinstance->stackbottom = pinstance->stackmin; /* yup, that's right. Confused me too. */ pinstance->stacktop = ( pinstance->stackmin > LOWORD(context->Ebx) ? @@ -642,7 +640,7 @@ void WINAPI InitTask16( CONTEXT86 *context ) * 0 (=%bp) is pushed on the stack */ ptr = stack16_push( sizeof(WORD) ); - *(WORD *)PTR_SEG_TO_LIN(ptr) = 0; + *(WORD *)MapSL(ptr) = 0; context->Esp -= 2; context->Eax = 1; @@ -882,8 +880,8 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance ) thunkaddr = TASK_AllocThunk( GetCurrentTask() ); if (!thunkaddr) return (FARPROC16)0; - thunk = PTR_SEG_TO_LIN( thunkaddr ); - lfunc = PTR_SEG_TO_LIN( func ); + thunk = MapSL( thunkaddr ); + lfunc = MapSL( (SEGPTR)func ); TRACE("(%08lx,%04x): got thunk %08lx\n", (DWORD)func, hInstance, (DWORD)thunkaddr ); @@ -947,7 +945,7 @@ static BOOL TASK_GetCodeSegment( FARPROC16 proc, NE_MODULE **ppModule, /* Try thunk or function */ else { - BYTE *thunk = (BYTE *)PTR_SEG_TO_LIN( proc ); + BYTE *thunk = MapSL( (SEGPTR)proc ); WORD selector; if ((thunk[0] == 0xb8) && (thunk[3] == 0xea)) @@ -1156,7 +1154,7 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top ) /* pop frame + args and push bp */ pData->old_ss_sp = pTask->teb->cur_stack + sizeof(STACK16FRAME) + 2 * sizeof(WORD); - *(WORD *)PTR_SEG_TO_LIN(pData->old_ss_sp) = oldFrame->bp; + *(WORD *)MapSL(pData->old_ss_sp) = oldFrame->bp; pData->stacktop = top; pData->stackmin = ptr; pData->stackbottom = ptr; @@ -1168,14 +1166,14 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top ) */ copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp); copySize += 3 * sizeof(WORD) + sizeof(STACK16FRAME); - pTask->teb->cur_stack = PTR_SEG_OFF_TO_SEGPTR( seg, ptr - copySize ); + pTask->teb->cur_stack = MAKESEGPTR( seg, ptr - copySize ); newFrame = THREAD_STACK16( pTask->teb ); /* Copy the stack frame and the local variables to the new stack */ memmove( newFrame, oldFrame, copySize ); newFrame->bp = ptr; - *(WORD *)PTR_SEG_OFF_TO_LIN( seg, ptr ) = 0; /* clear previous bp */ + *(WORD *)MapSL( MAKESEGPTR( seg, ptr ) ) = 0; /* clear previous bp */ } @@ -1201,7 +1199,7 @@ void WINAPI SwitchStackBack16( CONTEXT86 *context ) /* Pop bp from the previous stack */ - BP_reg(context) = *(WORD *)PTR_SEG_TO_LIN(pData->old_ss_sp); + BP_reg(context) = *(WORD *)MapSL(pData->old_ss_sp); pData->old_ss_sp += sizeof(WORD); /* Switch back to the old stack */ @@ -1544,7 +1542,7 @@ BOOL16 WINAPI TaskNext16( TASKENTRY *lpte ) break; lpte->hNext = pTask->hNext; } - pInstData = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( GlobalHandleToSel16(pTask->hInstance), 0 ); + pInstData = MapSL( MAKESEGPTR( GlobalHandleToSel16(pTask->hInstance), 0 ) ); lpte->hTask = lpte->hNext; lpte->hTaskParent = pTask->hParent; lpte->hInst = pTask->hInstance; diff --git a/memory/atom.c b/memory/atom.c index 2d634241aa6..f1ea5bf5943 100644 --- a/memory/atom.c +++ b/memory/atom.c @@ -22,7 +22,6 @@ #include "wine/unicode.h" #include "winerror.h" #include "instance.h" -#include "ldt.h" #include "stackframe.h" #include "debugtools.h" #include "server.h" @@ -76,7 +75,7 @@ BOOL ATOM_Init( WORD globalTableSel ) */ static ATOMTABLE *ATOM_GetTable( BOOL create /* [in] Create */ ) { - INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ); + INSTANCEDATA *ptr = MapSL( MAKESEGPTR( CURRENT_DS, 0 ) ); if (ptr->atomtable) { ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable); @@ -85,7 +84,7 @@ static ATOMTABLE *ATOM_GetTable( BOOL create /* [in] Create */ ) if (!create) return NULL; if (!InitAtomTable16( 0 )) return NULL; /* Reload ptr in case it moved in linear memory */ - ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ); + ptr = MapSL( MAKESEGPTR( CURRENT_DS, 0 ) ); return (ATOMTABLE *)((char *)ptr + ptr->atomtable); } @@ -170,7 +169,7 @@ static BOOL ATOM_IsIntAtomW(LPCWSTR atomstr,WORD *atomid) */ static inline ATOMENTRY *ATOM_MakePtr( HANDLE16 handle /* [in] Handle */ ) { - return (ATOMENTRY *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle ); + return MapSL( MAKESEGPTR( CURRENT_DS, handle ) ); } @@ -200,13 +199,13 @@ WORD WINAPI InitAtomTable16( WORD entries ) if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */ handle = LocalAlloc16( LMEM_FIXED, sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) ); if (!handle) return 0; - table = (ATOMTABLE *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle ); + table = MapSL( MAKESEGPTR( CURRENT_DS, handle ) ); table->size = entries; for (i = 0; i < entries; i++) table->entries[i] = 0; /* Store a pointer to the table in the instance data */ - ((INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ))->atomtable = handle; + ((INSTANCEDATA *)MapSL( MAKESEGPTR( CURRENT_DS, 0 )))->atomtable = handle; return handle; } diff --git a/memory/environ.c b/memory/environ.c index e5e1781c86b..508df1449c9 100644 --- a/memory/environ.c +++ b/memory/environ.c @@ -489,7 +489,7 @@ DWORD WINAPI ExpandEnvironmentStringsW( LPCWSTR src, LPWSTR dst, DWORD len ) */ SEGPTR WINAPI GetDOSEnvironment16(void) { - return PTR_SEG_OFF_TO_SEGPTR( env_sel, 0 ); + return MAKESEGPTR( env_sel, 0 ); } diff --git a/memory/global.c b/memory/global.c index 57d1e7f8711..5d7401845a6 100644 --- a/memory/global.c +++ b/memory/global.c @@ -14,6 +14,7 @@ #include "wine/winbase16.h" #include "wine/exception.h" +#include "wine/port.h" #include "global.h" #include "heap.h" #include "toolhelp.h" @@ -412,7 +413,7 @@ SEGPTR WINAPI WIN16_GlobalLock16( HGLOBAL16 handle ) } CURRENT_STACK16->ecx = sel; /* selector must be returned in CX as well */ - return PTR_SEG_OFF_TO_SEGPTR( sel, 0 ); + return MAKESEGPTR( sel, 0 ); } @@ -930,7 +931,7 @@ BOOL16 WINAPI MemManInfo16( MEMMANINFO *info ) * (under Windows) always fills the structure and returns true. */ GlobalMemoryStatus( &status ); - info->wPageSize = VIRTUAL_GetPageSize(); + info->wPageSize = getpagesize(); info->dwLargestFreeBlock = status.dwAvailVirtual; info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; info->dwMaxPagesLockable = info->dwMaxPagesAvailable; @@ -1046,13 +1047,13 @@ HGLOBAL WINAPI GlobalAlloc( /* HeapLock(heap); */ pintern=HeapAlloc(heap, 0, sizeof(GLOBAL32_INTERN)); - if (!pintern) return NULL; + if (!pintern) return 0; if(size) { size = (size + 0x1f) & ~0x1f; if (!(palloc=HeapAlloc(heap, hpflags, size+sizeof(HGLOBAL)))) { HeapFree(heap, 0, pintern); - return NULL; + return 0; } *(HGLOBAL *)palloc=INTERN_TO_HANDLE(pintern); pintern->Pointer=(char *) palloc+sizeof(HGLOBAL); diff --git a/memory/heap.c b/memory/heap.c index 3210422ddf0..0437a0c9e59 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -861,7 +861,7 @@ SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr ) /* Get the subheap */ if ((subheap = HEAP_FindSubHeap( heapPtr, ptr ))) - ret = PTR_SEG_OFF_TO_SEGPTR(subheap->selector, (char *)ptr - (char *)subheap); + ret = MAKESEGPTR(subheap->selector, (char *)ptr - (char *)subheap); if (!(flags & HEAP_NO_SERIALIZE)) LeaveCriticalSection( &heapPtr->critSection ); return ret; @@ -882,14 +882,14 @@ SEGPTR WINAPI MapLS( LPCVOID ptr ) /* check if the pointer is inside the segptr heap */ EnterCriticalSection( &segptrHeap->critSection ); if ((subheap = HEAP_FindSubHeap( segptrHeap, ptr ))) - ret = PTR_SEG_OFF_TO_SEGPTR( subheap->selector, (char *)ptr - (char *)subheap ); + ret = MAKESEGPTR( subheap->selector, (char *)ptr - (char *)subheap ); LeaveCriticalSection( &segptrHeap->critSection ); /* otherwise, allocate a brand-new selector */ if (!ret) { WORD sel = SELECTOR_AllocBlock( ptr, 0x10000, WINE_LDT_FLAGS_DATA ); - ret = PTR_SEG_OFF_TO_SEGPTR( sel, 0 ); + ret = MAKESEGPTR( sel, 0 ); } return ret; } @@ -907,7 +907,7 @@ void WINAPI UnMapLS( SEGPTR sptr ) /* check if ptr is inside segptr heap */ EnterCriticalSection( &segptrHeap->critSection ); - subheap = HEAP_FindSubHeap( segptrHeap, PTR_SEG_TO_LIN(sptr) ); + subheap = HEAP_FindSubHeap( segptrHeap, MapSL(sptr) ); if ((subheap) && (subheap->selector != SELECTOROF(sptr))) subheap = NULL; LeaveCriticalSection( &segptrHeap->critSection ); /* if not inside heap, free the selector */ @@ -1844,7 +1844,7 @@ static VOID Local32_ToHandle( LOCAL32HEADER *header, INT16 type, switch (type) { case -2: /* 16:16 pointer, no handles */ - *ptr = PTR_SEG_TO_LIN( addr ); + *ptr = MapSL( addr ); *handle = (LPDWORD)*ptr; break; @@ -1864,7 +1864,7 @@ static VOID Local32_ToHandle( LOCAL32HEADER *header, INT16 type, break; case 1: /* 16:16 pointer */ - *ptr = PTR_SEG_TO_LIN( addr ); + *ptr = MapSL( addr ); *handle = Local32_SearchHandle( header, *ptr - header->base ); break; diff --git a/memory/instr.c b/memory/instr.c index d74c20e22d8..39167e5b644 100644 --- a/memory/instr.c +++ b/memory/instr.c @@ -7,8 +7,6 @@ #include "windef.h" #include "wingdi.h" #include "wine/winuser16.h" -#include "ldt.h" -#include "global.h" #include "module.h" #include "miscemu.h" #include "selectors.h" @@ -32,7 +30,7 @@ inline static void *make_ptr( CONTEXT86 *context, DWORD seg, DWORD off, int long if (ISV86(context)) return PTR_REAL_TO_LIN( seg, off ); if (IS_SELECTOR_SYSTEM(seg)) return (void *)off; if (!long_addr) off = LOWORD(off); - return PTR_SEG_OFF_TO_LIN( seg, off ); + return MapSL( MAKESEGPTR( seg, off ) ); } inline static void *get_stack( CONTEXT86 *context ) @@ -42,8 +40,8 @@ inline static void *get_stack( CONTEXT86 *context ) if (IS_SELECTOR_SYSTEM(context->SegSs)) return (void *)context->Esp; if (IS_SELECTOR_32BIT(context->SegSs)) - return PTR_SEG_OFF_TO_LIN( context->SegSs, context->Esp ); - return PTR_SEG_OFF_TO_LIN( context->SegSs, LOWORD(context->Esp) ); + return MapSL( MAKESEGPTR( context->SegSs, context->Esp ) ); + return MapSL( MAKESEGPTR( context->SegSs, LOWORD(context->Esp) ) ); } /*********************************************************************** @@ -237,7 +235,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT86 *context, BYTE *instr, if (IS_SELECTOR_SYSTEM(seg)) return (BYTE *)(base + (index << ss)); if (((seg & 7) != 7) || IS_SELECTOR_FREE(seg)) return NULL; if (wine_ldt_copy.limit[seg >> 3] < (base + (index << ss))) return NULL; - return (BYTE *)PTR_SEG_OFF_TO_LIN( seg, (base + (index << ss)) ); + return MapSL( MAKESEGPTR( seg, (base + (index << ss))) ); #undef GET_VAL } @@ -780,7 +778,7 @@ BOOL INSTR_EmulateInstruction( CONTEXT86 *context ) /* Check for Win16 __GP handler */ - gpHandler = HasGPHandler16( PTR_SEG_OFF_TO_SEGPTR( context->SegCs, context->Eip ) ); + gpHandler = HasGPHandler16( MAKESEGPTR( context->SegCs, context->Eip ) ); if (gpHandler) { WORD *stack = get_stack( context ); diff --git a/memory/local.c b/memory/local.c index af507d25554..524807fa1db 100644 --- a/memory/local.c +++ b/memory/local.c @@ -15,9 +15,7 @@ #include #include #include "wine/winbase16.h" -#include "ldt.h" #include "task.h" -#include "global.h" #include "heap.h" #include "instance.h" #include "local.h" @@ -136,7 +134,7 @@ extern WORD CALLBACK LOCAL_CallTo16_word_www(FARPROC16,WORD,HLOCAL16,WORD); static LOCALHEAPINFO *LOCAL_GetHeap( HANDLE16 ds ) { LOCALHEAPINFO *pInfo; - INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 ); + INSTANCEDATA *ptr = MapSL( MAKESEGPTR( ds, 0 )); TRACE("Heap at %p, %04x\n", ptr, (ptr != NULL ? ptr->heap : 0xFFFF)); if (!ptr || !ptr->heap) return NULL; if (IsBadReadPtr16( (SEGPTR)MAKELONG(ptr->heap,ds), sizeof(LOCALHEAPINFO))) @@ -280,7 +278,7 @@ static void LOCAL_PrintHeap( HANDLE16 ds ) only when TRACE_ON is on! */ if(!TRACE_ON(local)) return; - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + ptr = MapSL( MAKESEGPTR( ds, 0 )); pInfo = LOCAL_GetHeap( ds ); if (!pInfo) @@ -392,7 +390,7 @@ BOOL16 WINAPI LocalInit16( HANDLE16 selector, WORD start, WORD end ) } } } - ptr = PTR_SEG_OFF_TO_LIN( selector, 0 ); + ptr = MapSL( MAKESEGPTR( selector, 0 ) ); start = LALIGN( max( start, sizeof(INSTANCEDATA) ) ); heapInfoArena = LALIGN(start + sizeof(LOCALARENA) ); @@ -482,7 +480,7 @@ static BOOL16 LOCAL_GrowHeap( HANDLE16 ds ) /* if nothing can be gained, return */ if (oldsize > 0xfff0) return FALSE; hseg = GlobalReAlloc16( hseg, 0x10000, GMEM_FIXED ); - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); pHeapInfo = LOCAL_GetHeap( ds ); if (pHeapInfo == NULL) { ERR("Heap not found\n" ); @@ -530,7 +528,7 @@ static BOOL16 LOCAL_GrowHeap( HANDLE16 ds ) */ static HLOCAL16 LOCAL_FreeArena( WORD ds, WORD arena ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena, *pPrev, *pNext; @@ -583,7 +581,7 @@ static HLOCAL16 LOCAL_FreeArena( WORD ds, WORD arena ) */ static void LOCAL_ShrinkArena( WORD ds, WORD arena, WORD size ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALARENA *pArena = ARENA_PTR( ptr, arena ); if (arena + size + LALIGN(sizeof(LOCALARENA)) < pArena->next) @@ -604,7 +602,7 @@ static void LOCAL_ShrinkArena( WORD ds, WORD arena, WORD size ) */ static void LOCAL_GrowArenaDownward( WORD ds, WORD arena, WORD newsize ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena = ARENA_PTR( ptr, arena ); WORD prevArena = pArena->prev & ~3; @@ -639,7 +637,7 @@ static void LOCAL_GrowArenaDownward( WORD ds, WORD arena, WORD newsize ) */ static void LOCAL_GrowArenaUpward( WORD ds, WORD arena, WORD newsize ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena = ARENA_PTR( ptr, arena ); WORD nextArena = pArena->next; @@ -656,7 +654,7 @@ static void LOCAL_GrowArenaUpward( WORD ds, WORD arena, WORD newsize ) */ static WORD LOCAL_GetFreeSpace(WORD ds, WORD countdiscard) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena; WORD arena; @@ -689,7 +687,7 @@ static WORD LOCAL_GetFreeSpace(WORD ds, WORD countdiscard) */ WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena, *pMoveArena, *pFinalArena; WORD arena, movearena, finalarena, table; @@ -816,7 +814,7 @@ WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags ) */ static HLOCAL16 LOCAL_FindFreeBlock( HANDLE16 ds, WORD size ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena; WORD arena; @@ -871,7 +869,7 @@ static const char *get_heap_name( WORD ds ) */ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena; WORD arena; @@ -907,7 +905,7 @@ notify_done: #endif return 0; } - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); pInfo = LOCAL_GetHeap( ds ); arena = LOCAL_FindFreeBlock( ds, size ); } @@ -941,7 +939,7 @@ notify_done: */ static BOOL16 LOCAL_NewHTable( HANDLE16 ds ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALHANDLEENTRY *pEntry; HLOCAL16 handle; @@ -958,7 +956,7 @@ static BOOL16 LOCAL_NewHTable( HANDLE16 ds ) if (!(handle = LOCAL_GetBlock( ds, pInfo->hdelta * sizeof(LOCALHANDLEENTRY) + 2 * sizeof(WORD), LMEM_FIXED ))) return FALSE; - if (!(ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ))) + if (!(ptr = MapSL( MAKESEGPTR( ds, 0 ) ))) ERR("ptr == NULL after GetBlock.\n"); if (!(pInfo = LOCAL_GetHeap( ds ))) ERR("pInfo == NULL after GetBlock.\n"); @@ -982,7 +980,7 @@ static BOOL16 LOCAL_NewHTable( HANDLE16 ds ) */ static HLOCAL16 LOCAL_GetNewHandleEntry( HANDLE16 ds ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALHANDLEENTRY *pEntry = NULL; WORD table; @@ -1010,7 +1008,7 @@ static HLOCAL16 LOCAL_GetNewHandleEntry( HANDLE16 ds ) if (!table) /* We need to create a new table */ { if (!LOCAL_NewHTable( ds )) return 0; - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); pInfo = LOCAL_GetHeap( ds ); pEntry = (LOCALHANDLEENTRY *)(ptr + pInfo->htable + sizeof(WORD)); } @@ -1032,7 +1030,7 @@ static HLOCAL16 LOCAL_GetNewHandleEntry( HANDLE16 ds ) */ static void LOCAL_FreeHandleEntry( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle); LOCALHEAPINFO *pInfo; WORD *pTable; @@ -1085,7 +1083,7 @@ static void LOCAL_FreeHandleEntry( HANDLE16 ds, HLOCAL16 handle ) */ HLOCAL16 LOCAL_Free( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); TRACE("%04x ds=%04x\n", handle, ds ); @@ -1144,7 +1142,7 @@ HLOCAL16 LOCAL_Alloc( HANDLE16 ds, WORD flags, WORD size ) LOCAL_FreeArena( ds, ARENA_HEADER(hmem) ); return 0; } - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); plhe = (LOCALHANDLEENTRY *)(ptr + handle); plhe->lock = 0; if(hmem) @@ -1176,7 +1174,7 @@ HLOCAL16 LOCAL_Alloc( HANDLE16 ds, WORD flags, WORD size ) */ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena, *pNext; LOCALHANDLEENTRY *pEntry = NULL; @@ -1207,7 +1205,7 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) if(size <= 4) size = 5; if (!(hl = LOCAL_GetBlock( ds, size + sizeof(HLOCAL16), flags))) return 0; - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); /* Reload ptr */ + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); /* Reload ptr */ pEntry = (LOCALHANDLEENTRY *) (ptr + handle); pEntry->addr = hl + sizeof(HLOCAL16); pEntry->flags = 0; @@ -1325,7 +1323,7 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) } if(HANDLE_MOVEABLE(handle)) size += sizeof(HLOCAL16); hmem = LOCAL_GetBlock( ds, size, flags ); - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); /* Reload ptr */ + ptr = MapSL( MAKESEGPTR( ds, 0 )); /* Reload ptr */ if(HANDLE_MOVEABLE(handle)) /* LOCAL_GetBlock might have triggered */ { /* a compaction, which might in turn have */ blockhandle = pEntry->addr ; /* moved the very block we are resizing */ @@ -1348,7 +1346,7 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) } size = oldsize; } - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); /* Reload ptr */ + ptr = MapSL( MAKESEGPTR( ds, 0 ) ); /* Reload ptr */ memcpy( ptr + hmem, buffer, oldsize ); HeapFree( GetProcessHeap(), 0, buffer ); } @@ -1398,7 +1396,7 @@ static HLOCAL16 LOCAL_InternalLock( LPSTR heap, HLOCAL16 handle ) */ void *LOCAL_Lock( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); return handle ? ptr + LOCAL_InternalLock( ptr, handle ) : NULL; } @@ -1408,7 +1406,7 @@ void *LOCAL_Lock( HANDLE16 ds, HLOCAL16 handle ) */ BOOL16 LOCAL_Unlock( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); TRACE("%04x\n", handle ); if (HANDLE_MOVEABLE(handle)) @@ -1430,7 +1428,7 @@ BOOL16 LOCAL_Unlock( HANDLE16 ds, HLOCAL16 handle ) */ WORD LOCAL_Size( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALARENA *pArena; TRACE("%04x ds=%04x\n", handle, ds ); @@ -1449,7 +1447,7 @@ WORD LOCAL_Size( HANDLE16 ds, HLOCAL16 handle ) */ WORD LOCAL_Flags( HANDLE16 ds, HLOCAL16 handle ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); if (HANDLE_MOVEABLE(handle)) { @@ -1490,7 +1488,7 @@ WORD LOCAL_CountFree( HANDLE16 ds ) WORD arena, total; LOCALARENA *pArena; LOCALHEAPINFO *pInfo; - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); if (!(pInfo = LOCAL_GetHeap( ds ))) { @@ -1521,7 +1519,7 @@ WORD LOCAL_CountFree( HANDLE16 ds ) */ HLOCAL16 LOCAL_Handle( HANDLE16 ds, WORD addr ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo; WORD table; @@ -1585,8 +1583,8 @@ HLOCAL16 WINAPI LocalFree16( HLOCAL16 handle ) SEGPTR WINAPI LocalLock16( HLOCAL16 handle ) { WORD ds = CURRENT_DS; - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); - return PTR_SEG_OFF_TO_SEGPTR( ds, LOCAL_InternalLock( ptr, handle ) ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); + return MAKESEGPTR( ds, LOCAL_InternalLock( ptr, handle ) ); } @@ -1755,7 +1753,7 @@ BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle ) BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle ) { WORD ds = GlobalHandleToSel16( handle ); - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo = LOCAL_GetHeap( ds ); if (!pInfo) return FALSE; @@ -1778,7 +1776,7 @@ BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle ) BOOL16 WINAPI LocalNext16( LOCALENTRY *pLocalEntry ) { WORD ds = GlobalHandleToSel16( pLocalEntry->hHeap ); - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALARENA *pArena; if (!LOCAL_GetHeap( ds )) return FALSE; diff --git a/memory/selector.c b/memory/selector.c index 35ac9a9bffa..e27e35d8150 100644 --- a/memory/selector.c +++ b/memory/selector.c @@ -9,7 +9,6 @@ #include "config.h" #include "winerror.h" #include "wine/winbase16.h" -#include "ldt.h" #include "miscemu.h" #include "selectors.h" #include "stackframe.h" @@ -410,7 +409,7 @@ BOOL16 WINAPI IsBadStringPtr16( SEGPTR ptr, UINT16 size ) /* check for data or readable code segment */ if (!(entry.HighWord.Bits.Type & 0x10)) return TRUE; /* system descriptor */ if ((entry.HighWord.Bits.Type & 0x0a) == 0x08) return TRUE; /* non-readable code segment */ - if (strlen(PTR_SEG_TO_LIN(ptr)) < size) size = strlen(PTR_SEG_TO_LIN(ptr)) + 1; + if (strlen(MapSL(ptr)) < size) size = strlen(MapSL(ptr)) + 1; if (size && (OFFSETOF(ptr) + size - 1 > wine_ldt_get_limit(&entry))) return TRUE; return FALSE; } @@ -537,7 +536,7 @@ LPVOID WINAPI MapSL( SEGPTR sptr ) LPVOID WINAPI MapSLFix( SEGPTR sptr ) { - return (LPVOID)PTR_SEG_TO_LIN(sptr); + return MapSL(sptr); } /*********************************************************************** diff --git a/memory/string.c b/memory/string.c index cdd22bd5bcf..3ee70441926 100644 --- a/memory/string.c +++ b/memory/string.c @@ -15,7 +15,6 @@ #include "wine/unicode.h" #include "winerror.h" #include "winnls.h" -#include "ldt.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(string); @@ -44,7 +43,7 @@ void WINAPI hmemcpy16( LPVOID dst, LPCVOID src, LONG count ) SEGPTR WINAPI lstrcat16( SEGPTR dst, LPCSTR src ) { /* Windows does not check for NULL pointers here, so we don't either */ - strcat( (LPSTR)PTR_SEG_TO_LIN(dst), src ); + strcat( MapSL(dst), src ); return dst; } @@ -92,10 +91,11 @@ LPWSTR WINAPI lstrcatW( LPWSTR dst, LPCWSTR src ) */ SEGPTR WINAPI lstrcatn16( SEGPTR dst, LPCSTR src, INT16 n ) { - LPSTR p = (LPSTR)PTR_SEG_TO_LIN(dst); + LPSTR p = MapSL(dst); + LPSTR start = p; while (*p) p++; - if ((n -= (p - (LPSTR)PTR_SEG_TO_LIN(dst))) <= 0) return dst; + if ((n -= (p - start)) <= 0) return dst; lstrcpynA( p, src, n ); return dst; } @@ -156,7 +156,7 @@ INT WINAPI lstrcmpiW( LPCWSTR str1, LPCWSTR str2 ) */ SEGPTR WINAPI lstrcpy16( SEGPTR dst, LPCSTR src ) { - if (!lstrcpyA( PTR_SEG_TO_LIN(dst), src )) dst = 0; + if (!lstrcpyA( MapSL(dst), src )) dst = 0; return dst; } @@ -206,7 +206,7 @@ LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src ) */ SEGPTR WINAPI lstrcpyn16( SEGPTR dst, LPCSTR src, INT16 n ) { - lstrcpynA( (LPSTR)PTR_SEG_TO_LIN(dst), src, n ); + lstrcpynA( MapSL(dst), src, n ); return dst; } diff --git a/misc/error.c b/misc/error.c index 03c581a8919..fba7762f520 100644 --- a/misc/error.c +++ b/misc/error.c @@ -163,7 +163,7 @@ void WINAPI LogParamError16(UINT16 uErr, FARPROC16 lpfn, LPVOID lpvParam) void WINAPI HandleParamError( CONTEXT86 *context ) { UINT16 uErr = LOWORD(context->Ebx); - FARPROC16 lpfn = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( context->SegCs, context->Eip ); + FARPROC16 lpfn = (FARPROC16)MAKESEGPTR( context->SegCs, context->Eip ); LPVOID lpvParam = (LPVOID)MAKELONG( LOWORD(context->Eax), LOWORD(context->Ecx) ); LogParamError16( uErr, lpfn, lpvParam ); @@ -173,7 +173,7 @@ void WINAPI HandleParamError( CONTEXT86 *context ) /* Abort current procedure: Unwind stack frame and jump to error handler (location at [bp-2]) */ - WORD *stack = PTR_SEG_OFF_TO_LIN( context->SegSs, LOWORD(context->Ebp) ); + WORD *stack = MapSL( MAKESEGPTR( context->SegSs, LOWORD(context->Ebp) )); context->Esp = LOWORD(context->Ebp) - 2; context->Ebp = stack[0] & 0xfffe; diff --git a/msdos/devices.c b/msdos/devices.c index f0e1efaeaa3..2cbae1226bf 100644 --- a/msdos/devices.c +++ b/msdos/devices.c @@ -444,13 +444,13 @@ void DOSDEV_InstallDOSDevices(void) /* allocate DOS data segment or something */ DOS_LOLSeg = GlobalDOSAlloc16(sizeof(DOS_DATASEG)); seg = HIWORD(DOS_LOLSeg); - dataseg = PTR_SEG_OFF_TO_LIN(LOWORD(DOS_LOLSeg), 0); + dataseg = MapSL( MAKESEGPTR(LOWORD(DOS_LOLSeg), 0) ); /* initialize the magnificent List Of Lists */ InitListOfLists(&dataseg->lol); /* Set up first device (NUL) */ - dataseg->lol.NUL_dev.next_dev = PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[0])); + dataseg->lol.NUL_dev.next_dev = MAKESEGPTR(seg, DOS_DATASEG_OFF(dev[0])); dataseg->lol.NUL_dev.attr = devs[0].attr; dataseg->lol.NUL_dev.strategy = DOS_DATASEG_OFF(thunk[0].ljmp1); dataseg->lol.NUL_dev.interrupt = DOS_DATASEG_OFF(thunk[0].ljmp2); @@ -460,7 +460,7 @@ void DOSDEV_InstallDOSDevices(void) for (n = 1; n < NR_DEVS; n++) { dataseg->dev[n-1].next_dev = (n+1) == NR_DEVS ? NONEXT : - PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[n])); + MAKESEGPTR(seg, DOS_DATASEG_OFF(dev[n])); dataseg->dev[n-1].attr = devs[n].attr; dataseg->dev[n-1].strategy = DOS_DATASEG_OFF(thunk[n].ljmp1); dataseg->dev[n-1].interrupt = DOS_DATASEG_OFF(thunk[n].ljmp2); @@ -477,7 +477,7 @@ void DOSDEV_InstallDOSDevices(void) } /* CON is device 1 */ - dataseg->lol.ptr_CON_dev_hdr = PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[0])); + dataseg->lol.ptr_CON_dev_hdr = MAKESEGPTR(seg, DOS_DATASEG_OFF(dev[0])); } DWORD DOSDEV_Console(void) @@ -487,8 +487,7 @@ DWORD DOSDEV_Console(void) DWORD DOSDEV_FindCharDevice(char*name) { - SEGPTR cur_ptr = PTR_SEG_OFF_TO_SEGPTR(HIWORD(DOS_LOLSeg), - FIELD_OFFSET(DOS_LISTOFLISTS,NUL_dev)); + SEGPTR cur_ptr = MAKESEGPTR(HIWORD(DOS_LOLSeg), FIELD_OFFSET(DOS_LISTOFLISTS,NUL_dev)); DOS_DEVICE_HEADER *cur = DOSMEM_MapRealToLinear(cur_ptr); char dname[8]; int cnt; diff --git a/msdos/dosmem.c b/msdos/dosmem.c index 96a612e056c..ec0ce122cbc 100644 --- a/msdos/dosmem.c +++ b/msdos/dosmem.c @@ -17,9 +17,9 @@ #include "winbase.h" #include "wine/winbase16.h" +#include "wine/port.h" #include "global.h" -#include "ldt.h" #include "selectors.h" #include "miscemu.h" #include "vga.h" @@ -145,7 +145,7 @@ static void DOSMEM_FillIsrTable(void) SEGPTR *isr = (SEGPTR*)DOSMEM_sysmem; int x; - for (x=0; x<256; x++) isr[x]=PTR_SEG_OFF_TO_SEGPTR(VM_STUB_SEGMENT,x*4); + for (x=0; x<256; x++) isr[x]=MAKESEGPTR(VM_STUB_SEGMENT,x*4); } static void DOSMEM_MakeIsrStubs(void) @@ -228,7 +228,7 @@ BYTE * DOSMEM_BiosSys() struct _DOS_LISTOFLISTS * DOSMEM_LOL() { return (struct _DOS_LISTOFLISTS *)DOSMEM_MapRealToLinear - (PTR_SEG_OFF_TO_SEGPTR(HIWORD(DOS_LOLSeg),0)); + (MAKESEGPTR(HIWORD(DOS_LOLSeg),0)); } /*********************************************************************** @@ -449,14 +449,13 @@ static void DOSMEM_InitMemory(void) static void setup_dos_mem( int dos_init ) { int sys_offset = 0; - int page_size = VIRTUAL_GetPageSize(); - void *addr = VIRTUAL_mmap( -1, (void *)page_size, 0x110000-page_size, 0, - PROT_READ | PROT_WRITE | PROT_EXEC, 0 ); + int page_size = getpagesize(); + void *addr = wine_anon_mmap( (void *)page_size, 0x110000-page_size, + PROT_READ | PROT_WRITE | PROT_EXEC, 0 ); if (addr == (void *)page_size) /* we got what we wanted */ { /* now map from address 0 */ - addr = VIRTUAL_mmap( -1, NULL, 0x110000, 0, - PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED ); + addr = wine_anon_mmap( NULL, 0x110000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED ); if (addr) { ERR("MAP_FIXED failed at address 0 for DOS address space\n" ); diff --git a/msdos/dpmi.c b/msdos/dpmi.c index 692da542c59..f3255ce19cc 100644 --- a/msdos/dpmi.c +++ b/msdos/dpmi.c @@ -10,9 +10,8 @@ #include "config.h" #include "windef.h" #include "wine/winbase16.h" -#include "ldt.h" +#include "wine/port.h" #include "builtin16.h" -#include "global.h" #include "miscemu.h" #include "msdos.h" #include "dosexe.h" @@ -260,7 +259,7 @@ static void DPMI_CallRMCBProc( CONTEXT86 *context, RMCB *rmcb, WORD flag ) UINT16 ss,es; DWORD esp,edi; - INT_SetRealModeContext((REALMODECALL *)PTR_SEG_OFF_TO_LIN( rmcb->regs_sel, rmcb->regs_ofs ), context); + INT_SetRealModeContext(MapSL(MAKESEGPTR( rmcb->regs_sel, rmcb->regs_ofs )), context); ss = SELECTOR_AllocBlock( (void *)(context->SegSs<<4), 0x10000, WINE_LDT_FLAGS_DATA ); esp = context->Esp; @@ -291,7 +290,7 @@ static void DPMI_CallRMCBProc( CONTEXT86 *context, RMCB *rmcb, WORD flag ) edi = ctx.Edi; } FreeSelector16(ss); - INT_GetRealModeContext((REALMODECALL*)PTR_SEG_OFF_TO_LIN( es, edi ), context); + INT_GetRealModeContext( MapSL( MAKESEGPTR( es, edi )), context); #else ERR("RMCBs only implemented for i386\n"); #endif @@ -417,8 +416,7 @@ static void CallRMInt( CONTEXT86 *context ) { CONTEXT86 realmode_ctx; FARPROC16 rm_int = INT_GetRMHandler( BL_reg(context) ); - REALMODECALL *call = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( context->SegEs, - DI_reg(context) ); + REALMODECALL *call = MapSL( MAKESEGPTR( context->SegEs, DI_reg(context) )); INT_GetRealModeContext( call, &realmode_ctx ); /* we need to check if a real-mode program has hooked the interrupt */ @@ -449,7 +447,7 @@ static void CallRMInt( CONTEXT86 *context ) static void CallRMProc( CONTEXT86 *context, int iret ) { - REALMODECALL *p = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( context->SegEs, DI_reg(context) ); + REALMODECALL *p = MapSL( MAKESEGPTR( context->SegEs, DI_reg(context) )); CONTEXT86 context16; TRACE("RealModeCall: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n", @@ -464,7 +462,7 @@ static void CallRMProc( CONTEXT86 *context, int iret ) return; } INT_GetRealModeContext(p, &context16); - DPMI_CallRMProc( &context16, ((LPWORD)PTR_SEG_OFF_TO_LIN(context->SegSs, LOWORD(context->Esp)))+3, + DPMI_CallRMProc( &context16, ((LPWORD)MapSL(MAKESEGPTR(context->SegSs, LOWORD(context->Esp))))+3, CX_reg(context), iret ); INT_SetRealModeContext(p, &context16); } @@ -853,15 +851,14 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context ) LDT_ENTRY entry; wine_ldt_set_base( &entry, (void*)W32S_WINE2APP(wine_ldt_get_base(&entry)) ); /* FIXME: should use ES:EDI for 32-bit clients */ - *(LDT_ENTRY *)PTR_SEG_OFF_TO_LIN( context->SegEs, LOWORD(context->Edi) ) = entry; + *(LDT_ENTRY *)MapSL( MAKESEGPTR( context->SegEs, LOWORD(context->Edi) )) = entry; } break; case 0x000c: /* Set descriptor */ TRACE("set descriptor (0x%04x)\n",BX_reg(context)); { - LDT_ENTRY entry = *(LDT_ENTRY *)PTR_SEG_OFF_TO_LIN( context->SegEs, - LOWORD(context->Edi) ); + LDT_ENTRY entry = *(LDT_ENTRY *)MapSL(MAKESEGPTR( context->SegEs, LOWORD(context->Edi))); wine_ldt_set_base( &entry, (void*)W32S_APP2WINE(wine_ldt_get_base(&entry)) ); wine_ldt_set_entry( LOWORD(context->Ebx), &entry ); } @@ -910,10 +907,9 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context ) case 0x0205: /* Set protected mode interrupt vector */ TRACE("set protected mode interrupt handler (0x%02x,%p), stub!\n", - BL_reg(context),PTR_SEG_OFF_TO_LIN(CX_reg(context),DX_reg(context))); + BL_reg(context),MapSL(MAKESEGPTR(CX_reg(context),DX_reg(context)))); INT_SetPMHandler( BL_reg(context), - (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( CX_reg(context), - DX_reg(context) )); + (FARPROC16)MAKESEGPTR( CX_reg(context), DX_reg(context) )); break; case 0x0300: /* Simulate real mode interrupt */ @@ -977,7 +973,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context ) mmi.dwSize = sizeof(mmi); MemManInfo16(&mmi); - ptr = (BYTE *)PTR_SEG_OFF_TO_LIN(context->SegEs,DI_reg(context)); + ptr = MapSL(MAKESEGPTR(context->SegEs,DI_reg(context))); /* the layout is just the same as MEMMANINFO, but without * the dwSize entry. */ @@ -1041,7 +1037,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context ) case 0x0604: /* Get page size */ TRACE("get pagesize\n"); BX_reg(context) = 0; - CX_reg(context) = VIRTUAL_GetPageSize(); + CX_reg(context) = getpagesize(); break; case 0x0702: /* Mark page as demand-paging candidate */ diff --git a/msdos/int21.c b/msdos/int21.c index 40be8123eb9..15c541d57bb 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -29,7 +29,6 @@ #include "file.h" #include "heap.h" #include "msdos.h" -#include "ldt.h" #include "options.h" #include "miscemu.h" #include "task.h" @@ -121,7 +120,7 @@ static BOOL INT21_CreateHeap(void) return FALSE; } heap = (struct DosHeap *) GlobalLock16(DosHeapHandle); - dpbsegptr = PTR_SEG_OFF_TO_SEGPTR(DosHeapHandle,(int)&heap->dpb-(int)heap); + dpbsegptr = MAKESEGPTR(DosHeapHandle,(int)&heap->dpb-(int)heap); heap->InDosFlag = 0; strcpy(heap->biosdate, "01/01/80"); memset(heap->DummyDBCSLeadTable, 0, 6); @@ -1300,7 +1299,7 @@ void WINAPI DOS3Call( CONTEXT86 *context ) case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */ { TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); - pTask->dta = PTR_SEG_OFF_TO_SEGPTR(context->SegDs,DX_reg(context)); + pTask->dta = MAKESEGPTR(context->SegDs,DX_reg(context)); TRACE("Set DTA: %08lx\n", pTask->dta); } break; @@ -1320,8 +1319,7 @@ void WINAPI DOS3Call( CONTEXT86 *context ) case 0x25: /* SET INTERRUPT VECTOR */ INT_CtxSetHandler( context, AL_reg(context), - (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( context->SegDs, - DX_reg(context))); + (FARPROC16)MAKESEGPTR( context->SegDs, DX_reg(context))); break; case 0x29: /* PARSE FILENAME INTO FCB */ @@ -1544,8 +1542,7 @@ void WINAPI DOS3Call( CONTEXT86 *context ) CX_reg(context) ); else result = WIN16_hread( BX_reg(context), - PTR_SEG_OFF_TO_SEGPTR( context->SegDs, - context->Edx ), + MAKESEGPTR( context->SegDs, context->Edx ), CX_reg(context) ); if (result == -1) bSetDOSExtendedError = TRUE; else AX_reg(context) = (WORD)result; diff --git a/msdos/int2f.c b/msdos/int2f.c index 3ab033ee1bc..06a2874aa85 100644 --- a/msdos/int2f.c +++ b/msdos/int2f.c @@ -398,7 +398,7 @@ static void MSCDEX_Dump(char* pfx, BYTE* req, int dorealmode) case 12: ptr += sprintf(ptr, "\n\t\t\t\tIO_struct => "); ios = (dorealmode) ? PTR_REAL_TO_LIN( PTR_AT(req, 16, WORD), PTR_AT(req, 14, WORD)) : - PTR_SEG_OFF_TO_LIN(PTR_AT(req, 16, WORD), PTR_AT(req, 14, WORD)); + MapSL(MAKESEGPTR(PTR_AT(req, 16, WORD), PTR_AT(req, 14, WORD))); for (i = 0; i < PTR_AT(req, 18, WORD); i++) { ptr += sprintf(ptr, "%02x ", ios[i]); @@ -515,7 +515,7 @@ static void MSCDEX_Handler(CONTEXT86* context) case 3: io_stru = (dorealmode) ? PTR_REAL_TO_LIN( PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD) ) : - PTR_SEG_OFF_TO_LIN(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)); + MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD))); TRACE(" --> IOCTL INPUT <%d>\n", io_stru[0]); switch (io_stru[0]) { @@ -680,7 +680,7 @@ static void MSCDEX_Handler(CONTEXT86* context) case 12: io_stru = (dorealmode) ? PTR_REAL_TO_LIN( PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)) : - PTR_SEG_OFF_TO_LIN(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD)); + MapSL( MAKESEGPTR(PTR_AT(driver_request, 16, WORD), PTR_AT(driver_request, 14, WORD))); TRACE(" --> IOCTL OUTPUT <%d>\n", io_stru[0]); switch (io_stru[0]) { diff --git a/msdos/int33.c b/msdos/int33.c index dad2070242b..a74bafe5aa5 100644 --- a/msdos/int33.c +++ b/msdos/int33.c @@ -64,7 +64,7 @@ void WINAPI INT_Int33Handler( CONTEXT86 *context ) case 0x0C: TRACE("Define mouse interrupt subroutine\n"); mouse_info.callmask = CX_reg(context); - mouse_info.callback = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR(context->SegEs, LOWORD(context->Edx)); + mouse_info.callback = (FARPROC16)MAKESEGPTR(context->SegEs, LOWORD(context->Edx)); break; case 0x10: FIXME("Define screen region for update\n"); diff --git a/msdos/int5c.c b/msdos/int5c.c index b4a8b22af05..ea4653e9b28 100644 --- a/msdos/int5c.c +++ b/msdos/int5c.c @@ -4,7 +4,6 @@ * Copyright 1995 Alexandre Julliard, Alex Korobka */ -#include "ldt.h" #include "miscemu.h" #include "debugtools.h" @@ -19,7 +18,7 @@ DEFAULT_DEBUG_CHANNEL(int); void WINAPI NetBIOSCall16( CONTEXT86 *context ) { BYTE* ptr; - ptr = (BYTE*) PTR_SEG_OFF_TO_LIN(context->SegEs,BX_reg(context)); + ptr = MapSL( MAKESEGPTR(context->SegEs,BX_reg(context)) ); FIXME("(%p): command code %02x (ignored)\n",context, *ptr); AL_reg(context) = *(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */ } diff --git a/msdos/vxd.c b/msdos/vxd.c index da9aa0add59..a4a35c62f07 100644 --- a/msdos/vxd.c +++ b/msdos/vxd.c @@ -198,7 +198,7 @@ void WINAPI VXD_VXDLoader( CONTEXT86 *context ) case 0x0001: /* load device */ FIXME("load device %04lx:%04x (%s)\n", context->SegDs, DX_reg(context), - debugstr_a(PTR_SEG_OFF_TO_LIN(context->SegDs, DX_reg(context)))); + debugstr_a(MapSL(MAKESEGPTR(context->SegDs, DX_reg(context))))); AX_reg(context) = 0x0000; context->SegEs = 0x0000; DI_reg(context) = 0x0000; @@ -604,8 +604,8 @@ void WINAPI VXD_Win32s( CONTEXT86 *context ) if ( hModule && func1 && func2 && SELECTOROF(func1) == SELECTOROF(func2)) { - BYTE *start = PTR_SEG_TO_LIN(func1); - BYTE *end = PTR_SEG_TO_LIN(func2); + BYTE *start = MapSL(func1); + BYTE *end = MapSL(func2); BYTE *p, *retv = NULL; int found = 0; @@ -1375,7 +1375,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context ) context->Edx = 0x80; else { - PDB16 *psp = PTR_SEG_OFF_TO_LIN(BX_reg(context), 0); + PDB16 *psp = MapSL( MAKESEGPTR( BX_reg(context), 0 )); psp->nbFiles = 32; psp->fileHandlesPtr = MAKELONG(HIWORD(context->Ebx), 0x5c); memset((LPBYTE)psp + 0x5c, '\xFF', 32); @@ -1544,8 +1544,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context ) * EDX: Flat base address of allocated region */ { - DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(context->Edx), - HIWORD(context->Edx)); + DWORD *stack = MapSL( MAKESEGPTR( LOWORD(context->Edx), HIWORD(context->Edx) )); LPVOID base = (LPVOID)W32S_APP2WINE(stack[0]); DWORD size = stack[1]; DWORD type = stack[2]; @@ -1586,8 +1585,7 @@ void WINAPI VXD_Win32s( CONTEXT86 *context ) * EDX: TRUE if success, FALSE if failure */ { - DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(context->Edx), - HIWORD(context->Edx)); + DWORD *stack = MapSL( MAKESEGPTR( LOWORD(context->Edx), HIWORD(context->Edx) )); LPVOID base = (LPVOID)W32S_APP2WINE(stack[0]); DWORD size = stack[1]; DWORD type = stack[2]; diff --git a/objects/bitmap.c b/objects/bitmap.c index 77278b98090..c07e05f4fb1 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -12,7 +12,6 @@ #include "gdi.h" #include "bitmap.h" #include "heap.h" -#include "global.h" #include "debugtools.h" #include "wine/winuser16.h" @@ -200,7 +199,7 @@ HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height) HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp ) { return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes, - bmp->bmBitsPixel, PTR_SEG_TO_LIN( bmp->bmBits ) ); + bmp->bmBitsPixel, MapSL( bmp->bmBits ) ); } @@ -521,7 +520,8 @@ BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size ) { BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); if (!bmp) return FALSE; - CONV_SIZE32TO16( &bmp->size, size ); + size->cx = bmp->size.cx; + size->cy = bmp->size.cy; GDI_ReleaseObj( hbitmap ); return TRUE; } @@ -565,7 +565,11 @@ BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, { BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); if (!bmp) return FALSE; - if (prevSize) CONV_SIZE32TO16( &bmp->size, prevSize ); + if (prevSize) + { + prevSize->cx = bmp->size.cx; + prevSize->cy = bmp->size.cy; + } bmp->size.cx = x; bmp->size.cy = y; GDI_ReleaseObj( hbitmap ); diff --git a/objects/font.c b/objects/font.c index 96714854607..79edaf2f3ee 100644 --- a/objects/font.c +++ b/objects/font.c @@ -885,10 +885,10 @@ BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, { SIZE size32; BOOL ret; - TRACE("%04x, %p (%s), %d, %p\n", hdc, str, debugstr_an(str, count), count, - size); + TRACE("%04x, %p (%s), %d, %p\n", hdc, str, debugstr_an(str, count), count, size); ret = GetTextExtentPoint32A( hdc, str, count, &size32 ); - CONV_SIZE32TO16( &size32, size ); + size->cx = size32.cx; + size->cy = size32.cy; return (BOOL16)ret; } @@ -1772,9 +1772,9 @@ INT WINAPI AddFontResourceW( LPCWSTR str ) /*********************************************************************** * RemoveFontResource16 (GDI.136) */ -BOOL16 WINAPI RemoveFontResource16( SEGPTR str ) +BOOL16 WINAPI RemoveFontResource16( LPCSTR str ) { - FIXME("(%s): stub\n", debugres_a(PTR_SEG_TO_LIN(str))); + FIXME("(%s): stub\n", debugres_a(str)); return TRUE; } diff --git a/objects/metafile.c b/objects/metafile.c index 8cc1f7fb80d..02ad857481b 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -608,7 +608,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, { mr = (METARECORD *)((char *)mh + offset); if (!lpEnumFunc( hdc, (HANDLETABLE16 *)spht, - (METARECORD *) PTR_SEG_OFF_TO_HUGEPTR(seg, offset), + (METARECORD *)MAKESEGPTR( seg + (HIWORD(offset) << __AHSHIFT), LOWORD(offset) ), mh->mtNoObjects, (LONG)lpData )) { result = FALSE; diff --git a/scheduler/thread.c b/scheduler/thread.c index cd06bbd891b..e8942925e20 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -14,10 +14,10 @@ #endif #include #include "wine/winbase16.h" +#include "wine/port.h" #include "thread.h" #include "task.h" #include "module.h" -#include "global.h" #include "winerror.h" #include "heap.h" #include "selectors.h" @@ -130,7 +130,7 @@ static void CALLBACK THREAD_FreeTEB( TEB *teb ) TEB *THREAD_InitStack( TEB *teb, DWORD stack_size, BOOL alloc_stack16 ) { DWORD old_prot, total_size; - DWORD page_size = VIRTUAL_GetPageSize(); + DWORD page_size = getpagesize(); void *base; /* Allocate the stack */ @@ -199,8 +199,7 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size, BOOL alloc_stack16 ) { teb->stack_sel = SELECTOR_AllocBlock( teb->stack_top, 0x10000, WINE_LDT_FLAGS_DATA ); if (!teb->stack_sel) goto error; - teb->cur_stack = PTR_SEG_OFF_TO_SEGPTR( teb->stack_sel, - 0x10000 - sizeof(STACK16FRAME) ); + teb->cur_stack = MAKESEGPTR( teb->stack_sel, 0x10000 - sizeof(STACK16FRAME) ); } return teb; diff --git a/windows/class.c b/windows/class.c index 05d41ff4f3f..da44e66abbe 100644 --- a/windows/class.c +++ b/windows/class.c @@ -24,7 +24,6 @@ #include "win.h" #include "controls.h" #include "dce.h" -#include "ldt.h" #include "toolhelp.h" #include "winproc.h" #include "debugtools.h" @@ -424,7 +423,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) int iSmIconWidth, iSmIconHeight; HINSTANCE16 hInstance=GetExePtr(wc->hInstance); - if (!(atom = GlobalAddAtomA( PTR_SEG_TO_LIN(wc->lpszClassName) ))) return 0; + if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0; if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra ))) { @@ -438,7 +437,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr, HIWORD(wc->lpszClassName) ? - (char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "" ); + (char *)MapSL(wc->lpszClassName) : "" ); iSmIconWidth = GetSystemMetrics(SM_CXSMICON); iSmIconHeight = GetSystemMetrics(SM_CYSMICON); @@ -452,7 +451,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, WIN_PROC_16, WIN_PROC_CLASS ); - CLASS_SetMenuNameA( classPtr, PTR_SEG_TO_LIN(wc->lpszMenuName) ); + CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) ); return atom; } @@ -551,7 +550,7 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) CLASS *classPtr; HINSTANCE16 hInstance = GetExePtr( wc->hInstance ); - if (!(atom = GlobalAddAtomA( PTR_SEG_TO_LIN(wc->lpszClassName) ))) return 0; + if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0; if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, wc->cbClsExtra, wc->cbWndExtra ))) { @@ -571,7 +570,7 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, WIN_PROC_16, WIN_PROC_CLASS ); - CLASS_SetMenuNameA( classPtr, PTR_SEG_TO_LIN(wc->lpszMenuName) ); + CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) ); return atom; } @@ -936,7 +935,7 @@ LONG WINAPI SetClassLong16( HWND16 hwnd, INT16 offset, LONG newval ) WIN_ReleaseWndPtr(wndPtr); return retval; case GCL_MENUNAME: - return SetClassLongA( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) ); + return SetClassLongA( hwnd, offset, (LONG)MapSL(newval) ); default: return SetClassLongA( hwnd, offset, newval ); } @@ -1075,10 +1074,10 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ATOM atom; CLASS *classPtr; - TRACE("%x %s %p\n",hInstance, debugres_a(PTR_SEG_TO_LIN(name)), wc); + TRACE("%x %s %p\n",hInstance, debugres_a(MapSL(name)), wc); hInstance = GetExePtr( hInstance ); - if (!(atom = GlobalFindAtomA( PTR_SEG_TO_LIN(name) )) || + if (!(atom = GlobalFindAtomA( MapSL(name) )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) return FALSE; if ((hInstance != classPtr->hInstance) && @@ -1189,10 +1188,10 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 ATOM atom; CLASS *classPtr; - TRACE("%x %s %p\n",hInstance,debugres_a( PTR_SEG_TO_LIN(name) ), wc); + TRACE("%x %s %p\n",hInstance,debugres_a( MapSL(name) ), wc); hInstance = GetExePtr( hInstance ); - if (!(atom = GlobalFindAtomA( PTR_SEG_TO_LIN(name) )) || + if (!(atom = GlobalFindAtomA( MapSL(name) )) || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || (hInstance != classPtr->hInstance)) return FALSE; wc->style = classPtr->style; diff --git a/windows/cursoricon.c b/windows/cursoricon.c index 6c9b4ff50fb..a08a34efe86 100644 --- a/windows/cursoricon.c +++ b/windows/cursoricon.c @@ -40,7 +40,6 @@ #include "palette.h" #include "bitmap.h" #include "cursoricon.h" -#include "global.h" #include "module.h" #include "debugtools.h" #include "task.h" @@ -82,6 +81,35 @@ static ICONCACHE *IconAnchor = NULL; static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT; static WORD ICON_HOTSPOT = 0x4242; + +/*********************************************************************** + * map_fileW + * + * Helper function to map a file to memory: + * name - file name + * [RETURN] ptr - pointer to mapped file + */ +static void *map_fileW( LPCWSTR name ) +{ + HANDLE hFile, hMapping; + LPVOID ptr = NULL; + + hFile = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0 ); + if (hFile != INVALID_HANDLE_VALUE) + { + hMapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY, 0, 0, NULL ); + CloseHandle( hFile ); + if (hMapping) + { + ptr = MapViewOfFile( hMapping, FILE_MAP_READ, 0, 0, 0 ); + CloseHandle( hMapping ); + } + } + return ptr; +} + + /********************************************************************** * CURSORICON_FindSharedIcon */ @@ -342,7 +370,7 @@ BOOL CURSORICON_SimulateLoadingFromResourceW( LPWSTR filename, BOOL fCursor, *res = NULL; *ptr = NULL; - if (!(bits = (CURSORICONFILEDIR *)VIRTUAL_MapFileW( filename ))) return FALSE; + if (!(bits = map_fileW( filename ))) return FALSE; /* FIXME: test for inimated icons * hack to load the first icon from the *.ani file @@ -1351,7 +1379,7 @@ DWORD WINAPI IconSize16( void ) DWORD WINAPI DumpIcon16( SEGPTR pInfo, WORD *lpLen, SEGPTR *lpXorBits, SEGPTR *lpAndBits ) { - CURSORICONINFO *info = PTR_SEG_TO_LIN( pInfo ); + CURSORICONINFO *info = MapSL( pInfo ); int sizeAnd, sizeXor; if (!info) return 0; @@ -2103,7 +2131,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance,LPCWSTR name, UINT loadflags ) } else { - if (!(ptr = (char *)VIRTUAL_MapFileW( name ))) return 0; + if (!(ptr = map_fileW( name ))) return 0; info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER)); } size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS); diff --git a/windows/defwnd.c b/windows/defwnd.c index 1b6a08df703..c62eb1f7709 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -225,12 +225,12 @@ static HWND DEFWND_ImmGetDefaultIMEWnd( HWND hwnd ) { HINSTANCE hInstIMM = GetModuleHandleA( "imm32" ); HWND (WINAPI* pFunc)(HWND); - HWND hwndRet = NULL; + HWND hwndRet = 0; if (!hInstIMM) { ERR( "cannot get IMM32 handle\n" ); - return NULL; + return 0; } pFunc = (void*)GetProcAddress(hInstIMM,"ImmGetDefaultIMEWnd"); @@ -665,9 +665,9 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, { case WM_NCCREATE: { - CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT16 *cs = MapSL(lParam); if (cs->lpszName) - DEFWND_SetTextA( wndPtr, (LPCSTR)PTR_SEG_TO_LIN(cs->lpszName) ); + DEFWND_SetTextA( wndPtr, MapSL(cs->lpszName) ); result = 1; } break; @@ -675,20 +675,19 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, case WM_NCCALCSIZE: { RECT rect32; - CONV_RECT16TO32( (RECT16 *)PTR_SEG_TO_LIN(lParam), &rect32 ); + CONV_RECT16TO32( MapSL(lParam), &rect32 ); result = NC_HandleNCCalcSize( wndPtr, &rect32 ); - CONV_RECT32TO16( &rect32, (RECT16 *)PTR_SEG_TO_LIN(lParam) ); + CONV_RECT32TO16( &rect32, MapSL(lParam) ); } break; case WM_WINDOWPOSCHANGING: - result = WINPOS_HandleWindowPosChanging16( wndPtr, - (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam) ); + result = WINPOS_HandleWindowPosChanging16( wndPtr, MapSL(lParam) ); break; case WM_WINDOWPOSCHANGED: { - WINDOWPOS16 * winPos = (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam); + WINDOWPOS16 * winPos = MapSL(lParam); DEFWND_HandleWindowPosChanged( wndPtr, winPos->flags ); } break; @@ -696,7 +695,7 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, case WM_GETTEXT: if (wParam && wndPtr->text) { - LPSTR dest = PTR_SEG_TO_LIN(lParam); + LPSTR dest = MapSL(lParam); if (!WideCharToMultiByte( CP_ACP, 0, wndPtr->text, -1, dest, wParam, NULL, NULL )) dest[wParam-1] = 0; result = strlen(dest); @@ -704,7 +703,7 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, break; case WM_SETTEXT: - DEFWND_SetTextA( wndPtr, (LPCSTR)PTR_SEG_TO_LIN(lParam) ); + DEFWND_SetTextA( wndPtr, MapSL(lParam) ); if( (wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION ) NC_HandleNCPaint( hwnd , (HRGN)1 ); result = 1; /* success. FIXME: check text length */ @@ -803,7 +802,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, HWND hwndIME; hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd ); - if ( hwndIME != NULL ) + if (hwndIME) result = SendMessageA( hwndIME, msg, wParam, lParam ); } break; @@ -812,7 +811,7 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, HWND hwndIME; hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd ); - if ( hwndIME != NULL ) + if (hwndIME) result = DEFWND_ImmIsUIMessageA( hwndIME, msg, wParam, lParam ); } break; @@ -883,7 +882,7 @@ LRESULT WINAPI DefWindowProcW( HWND hwndIME; hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd ); - if ( hwndIME != NULL ) + if (hwndIME) result = DEFWND_ImmIsUIMessageW( hwndIME, msg, wParam, lParam ); } break; diff --git a/windows/dialog.c b/windows/dialog.c index 51e03637d7a..b9edb20a8e9 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -1491,7 +1491,7 @@ static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg, */ BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, SEGPTR msg16 ) { - LPMSG16 msg = PTR_SEG_TO_LIN(msg16); + LPMSG16 msg = MapSL(msg16); BOOL ret, translate, dispatch; INT dlgCode = 0; diff --git a/windows/hook.c b/windows/hook.c index 9f3ace11670..68ca4c1b7f5 100644 --- a/windows/hook.c +++ b/windows/hook.c @@ -71,7 +71,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, case WH_GETMESSAGE: case WH_JOURNALRECORD: { - LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(*plParam); + LPMSG16 lpmsg16 = MapSL(*plParam); LPMSG lpmsg32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpmsg32) ); STRUCT32_MSG16to32( lpmsg16, lpmsg32 ); @@ -81,7 +81,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, case WH_JOURNALPLAYBACK: { - LPEVENTMSG16 lpem16 = PTR_SEG_TO_LIN(*plParam); + LPEVENTMSG16 lpem16 = MapSL(*plParam); LPEVENTMSG lpem32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpem32) ); lpem32->message = lpem16->message; @@ -96,7 +96,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, case WH_CALLWNDPROC: { - LPCWPSTRUCT16 lpcwp16 = PTR_SEG_TO_LIN(*plParam); + LPCWPSTRUCT16 lpcwp16 = MapSL(*plParam); LPCWPSTRUCT lpcwp32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcwp32) ); lpcwp32->hwnd = lpcwp16->hwnd; @@ -117,8 +117,8 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, { case HCBT_CREATEWND: { - LPCBT_CREATEWND16 lpcbtcw16 = PTR_SEG_TO_LIN(*plParam); - LPCREATESTRUCT16 lpcs16 = PTR_SEG_TO_LIN(lpcbtcw16->lpcs); + LPCBT_CREATEWND16 lpcbtcw16 = MapSL(*plParam); + LPCREATESTRUCT16 lpcs16 = MapSL((SEGPTR)lpcbtcw16->lpcs); LPCBT_CREATEWNDA lpcbtcw32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcbtcw32) ); lpcbtcw32->lpcs = HeapAlloc( GetProcessHeap(), 0, @@ -129,17 +129,17 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, if (HIWORD(lpcs16->lpszName)) lpcbtcw32->lpcs->lpszName = - (bA) ? PTR_SEG_TO_LIN(lpcs16->lpszName) + (bA) ? MapSL(lpcs16->lpszName) : HEAP_strdupAtoW( GetProcessHeap(), 0, - PTR_SEG_TO_LIN(lpcs16->lpszName) ); + MapSL(lpcs16->lpszName) ); else lpcbtcw32->lpcs->lpszName = (LPCSTR)lpcs16->lpszName; if (HIWORD(lpcs16->lpszClass)) lpcbtcw32->lpcs->lpszClass = - (bA) ? PTR_SEG_TO_LIN(lpcs16->lpszClass) + (bA) ? MapSL(lpcs16->lpszClass) : HEAP_strdupAtoW( GetProcessHeap(), 0, - PTR_SEG_TO_LIN(lpcs16->lpszClass) ); + MapSL(lpcs16->lpszClass) ); else lpcbtcw32->lpcs->lpszClass = (LPCSTR)lpcs16->lpszClass; @@ -150,7 +150,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, } case HCBT_ACTIVATE: { - LPCBTACTIVATESTRUCT16 lpcas16 = PTR_SEG_TO_LIN(*plParam); + LPCBTACTIVATESTRUCT16 lpcas16 = MapSL(*plParam); LPCBTACTIVATESTRUCT lpcas32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcas32) ); lpcas32->fMouse = lpcas16->fMouse; @@ -160,7 +160,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, } case HCBT_CLICKSKIPPED: { - LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam); + LPMOUSEHOOKSTRUCT16 lpms16 = MapSL(*plParam); LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpms32) ); @@ -177,7 +177,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, } case HCBT_MOVESIZE: { - LPRECT16 lprect16 = PTR_SEG_TO_LIN(*plParam); + LPRECT16 lprect16 = MapSL(*plParam); LPRECT lprect32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lprect32) ); @@ -190,7 +190,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, case WH_MOUSE: { - LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam); + LPMOUSEHOOKSTRUCT16 lpms16 = MapSL(*plParam); LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpms32) ); @@ -207,7 +207,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam, case WH_DEBUG: { - LPDEBUGHOOKINFO16 lpdh16 = PTR_SEG_TO_LIN(*plParam); + LPDEBUGHOOKINFO16 lpdh16 = MapSL(*plParam); LPDEBUGHOOKINFO lpdh32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpdh32) ); @@ -286,7 +286,7 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig, case WH_GETMESSAGE: { - LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(lParamOrig); + LPMSG16 lpmsg16 = MapSL(lParamOrig); STRUCT32_MSG32to16( (LPMSG)lParam, lpmsg16 ); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam ); break; @@ -304,7 +304,7 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig, case HCBT_CREATEWND: { LPCBT_CREATEWNDA lpcbtcw32 = (LPCBT_CREATEWNDA)lParam; - LPCBT_CREATEWND16 lpcbtcw16 = PTR_SEG_TO_LIN(lParamOrig); + LPCBT_CREATEWND16 lpcbtcw16 = MapSL(lParamOrig); if( !bA ) { @@ -583,12 +583,12 @@ static void HOOK_UnMap32To16Common(INT id, INT code, WPARAM wParamOrig, case WH_JOURNALPLAYBACK: case WH_MOUSE: case WH_DEBUG: - SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) ); + SEGPTR_FREE( MapSL(lParam) ); break; case WH_CALLWNDPROC: { - LPCWPSTRUCT16 lpcwp16 = (LPCWPSTRUCT16)PTR_SEG_TO_LIN(lParam); + LPCWPSTRUCT16 lpcwp16 = MapSL(lParam); LPCWPSTRUCT lpcwp32 = (LPCWPSTRUCT)lParamOrig; MSGPARAM16 mp16; @@ -600,7 +600,7 @@ static void HOOK_UnMap32To16Common(INT id, INT code, WPARAM wParamOrig, lpcwp32->lParam, &mp16 ); else WINPROC_UnmapMsg32WTo16( lpcwp32->hwnd,lpcwp32->message, lpcwp32->wParam, lpcwp32->lParam, &mp16 ); - SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) ); + SEGPTR_FREE( MapSL(lParam) ); break; } @@ -608,8 +608,8 @@ static void HOOK_UnMap32To16Common(INT id, INT code, WPARAM wParamOrig, { LPMSG lpmsg32 = (LPMSG)lParamOrig; - STRUCT32_MSG16to32( (LPMSG16)PTR_SEG_TO_LIN(lParam), lpmsg32 ); - SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) ); + STRUCT32_MSG16to32( MapSL(lParam), lpmsg32 ); + SEGPTR_FREE( MapSL(lParam) ); break; } @@ -619,14 +619,14 @@ static void HOOK_UnMap32To16Common(INT id, INT code, WPARAM wParamOrig, case HCBT_CREATEWND: { LPCBT_CREATEWNDA lpcbtcw32 = (LPCBT_CREATEWNDA)(lParamOrig); - LPCBT_CREATEWND16 lpcbtcw16 = PTR_SEG_TO_LIN(lParam); - LPCREATESTRUCT16 lpcs16 = PTR_SEG_TO_LIN(lpcbtcw16->lpcs); + LPCBT_CREATEWND16 lpcbtcw16 = MapSL(lParam); + LPCREATESTRUCT16 lpcs16 = MapSL((SEGPTR)lpcbtcw16->lpcs); if (HIWORD(lpcs16->lpszName)) - SEGPTR_FREE( PTR_SEG_TO_LIN(lpcs16->lpszName) ); + SEGPTR_FREE( MapSL(lpcs16->lpszName) ); if (HIWORD(lpcs16->lpszClass)) - SEGPTR_FREE( PTR_SEG_TO_LIN(lpcs16->lpszClass) ); + SEGPTR_FREE( MapSL(lpcs16->lpszClass) ); lpcbtcw32->hwndInsertAfter = lpcbtcw16->hwndInsertAfter; @@ -637,7 +637,7 @@ static void HOOK_UnMap32To16Common(INT id, INT code, WPARAM wParamOrig, case HCBT_CLICKSKIPPED: case HCBT_MOVESIZE: - SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) ); + SEGPTR_FREE( MapSL(lParam) ); break; } break; @@ -1396,7 +1396,7 @@ BOOL16 WINAPI CallMsgFilter16( SEGPTR msg, INT16 code ) */ BOOL16 WINAPI CallMsgFilter32_16( SEGPTR msg16_32, INT16 code, BOOL16 wHaveParamHigh ) { - MSG32_16 *lpmsg16_32 = (MSG32_16 *)PTR_SEG_TO_LIN(msg16_32); + MSG32_16 *lpmsg16_32 = MapSL(msg16_32); if (wHaveParamHigh == FALSE) { diff --git a/windows/mdi.c b/windows/mdi.c index bd2e2dfb26b..ca96da60caf 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -1275,8 +1275,7 @@ static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, } else { - LPCLIENTCREATESTRUCT16 ccs = (LPCLIENTCREATESTRUCT16) - PTR_SEG_TO_LIN(cs->lpCreateParams); + LPCLIENTCREATESTRUCT16 ccs = MapSL((SEGPTR)cs->lpCreateParams); ci->hWindowMenu = ccs->hWindowMenu; ci->idFirstChild = ccs->idFirstChild; } @@ -1539,8 +1538,7 @@ LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient, case WM_SETTEXT: { - LPWSTR text = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)PTR_SEG_TO_LIN(lParam) ); + LPWSTR text = HEAP_strdupAtoW( GetProcessHeap(), 0, MapSL(lParam) ); wndPtr = WIN_FindWndPtr(hwnd); MDI_UpdateFrameText(wndPtr, hwndMDIClient, MDI_REPAINTFRAME, text ); @@ -1766,7 +1764,7 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, break; case WM_GETMINMAXINFO: - MDI_ChildGetMinMaxInfo(clientWnd, hwnd, (MINMAXINFO16*) PTR_SEG_TO_LIN(lParam)); + MDI_ChildGetMinMaxInfo(clientWnd, hwnd, MapSL(lParam)); retvalue = 0; goto END; diff --git a/windows/message.c b/windows/message.c index ee656a0b390..5b117ee0c8f 100644 --- a/windows/message.c +++ b/windows/message.c @@ -23,7 +23,6 @@ #include "queue.h" #include "winproc.h" #include "task.h" -#include "selectors.h" #include "thread.h" #include "options.h" #include "controls.h" @@ -1386,7 +1385,7 @@ BOOL16 WINAPI PeekMessage32_16( SEGPTR msg16_32, HWND16 hwnd, BOOL16 wHaveParamHigh ) { BOOL ret; - MSG32_16 *lpmsg16_32 = (MSG32_16 *)PTR_SEG_TO_LIN(msg16_32); + MSG32_16 *lpmsg16_32 = MapSL(msg16_32); MSG msg; ret = MSG_PeekMessage( QMSG_WIN16, &msg, hwnd, first, last, flags, TRUE ); @@ -1479,7 +1478,7 @@ BOOL WINAPI PeekMessageW( BOOL16 WINAPI GetMessage32_16( SEGPTR msg16_32, HWND16 hWnd, UINT16 first, UINT16 last, BOOL16 wHaveParamHigh ) { - MSG32_16 *lpmsg16_32 = (MSG32_16 *)PTR_SEG_TO_LIN(msg16_32); + MSG32_16 *lpmsg16_32 = MapSL(msg16_32); MSG msg; MSG_PeekMessage( QMSG_WIN16, &msg, hWnd, first, last, PM_REMOVE, FALSE ); diff --git a/windows/msgbox.c b/windows/msgbox.c index 2266a160e46..63075f162a6 100644 --- a/windows/msgbox.c +++ b/windows/msgbox.c @@ -12,7 +12,6 @@ #include "wine/winuser16.h" #include "dlgs.h" #include "heap.h" -#include "ldt.h" #include "debugtools.h" #include "tweak.h" @@ -349,10 +348,10 @@ INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox ) msgbox32.cbSize = msgbox->cbSize; msgbox32.hwndOwner = msgbox->hwndOwner; msgbox32.hInstance = msgbox->hInstance; - msgbox32.lpszText = PTR_SEG_TO_LIN(msgbox->lpszText); - msgbox32.lpszCaption = PTR_SEG_TO_LIN(msgbox->lpszCaption); + msgbox32.lpszText = MapSL(msgbox->lpszText); + msgbox32.lpszCaption = MapSL(msgbox->lpszCaption); msgbox32.dwStyle = msgbox->dwStyle; - msgbox32.lpszIcon = PTR_SEG_TO_LIN(msgbox->lpszIcon); + msgbox32.lpszIcon = MapSL(msgbox->lpszIcon); msgbox32.dwContextHelpId = msgbox->dwContextHelpId; msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback; msgbox32.dwLanguageId = msgbox->dwLanguageId; diff --git a/windows/painting.c b/windows/painting.c index dbe7dbd263d..fd8f890ee0b 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -1431,7 +1431,7 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode, else if(_32bit) return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags); else - return DrawTextA(hdc, (LPSTR)PTR_SEG_TO_LIN(lp), (INT)wp, rc, dtflags); + return DrawTextA(hdc, MapSL(lp), (INT)wp, rc, dtflags); case DST_ICON: return DrawIcon(hdc, rc->left, rc->top, (HICON)lp); @@ -1495,7 +1495,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, else if(_32bit) len = strlen((LPSTR)lp); else - len = strlen((LPSTR)PTR_SEG_TO_LIN(lp)); + len = strlen(MapSL(lp)); } /* Find out what size the image has if not given by caller */ @@ -1514,7 +1514,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, else if(_32bit) retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s); else - retval = GetTextExtentPoint32A(hdc, PTR_SEG_TO_LIN(lp), len, &s); + retval = GetTextExtentPoint32A(hdc, MapSL(lp), len, &s); if(!retval) return FALSE; break; diff --git a/windows/scroll.c b/windows/scroll.c index 6dd5892ae7d..b6cba187aa4 100644 --- a/windows/scroll.c +++ b/windows/scroll.c @@ -326,7 +326,7 @@ rc.left, rc.top, rc.right, rc.bottom, (UINT16)flags ); WND* w; for( w =WIN_LockWndPtr(wnd->child); w; WIN_UpdateWndPtr(&w, w->next)) { - CONV_RECT16TO32( &w->rectWindow, &r ); + r = w->rectWindow; if( !rect || IntersectRect(&r, &r, &rc) ) SetWindowPos(w->hwndSelf, 0, w->rectWindow.left + dx, w->rectWindow.top + dy, 0,0, SWP_NOZORDER | diff --git a/windows/win.c b/windows/win.c index c684504adb6..4500a21af77 100644 --- a/windows/win.c +++ b/windows/win.c @@ -3136,7 +3136,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) { BOOL16 wParam, bResult = 0; POINT pt; - LPDRAGINFO16 ptrDragInfo = (LPDRAGINFO16) PTR_SEG_TO_LIN(spDragInfo); + LPDRAGINFO16 ptrDragInfo = MapSL(spDragInfo); WND *ptrQueryWnd = WIN_FindWndPtr(hQueryWnd),*ptrWnd; RECT tempRect; diff --git a/windows/winhelp.c b/windows/winhelp.c index 22117e20d18..e445c227614 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -12,7 +12,6 @@ #include "wine/winuser16.h" #include "wine/winbase16.h" #include "heap.h" -#include "ldt.h" DEFAULT_DEBUG_CHANNEL(win); @@ -40,13 +39,13 @@ BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand, /* We might call WinExec() */ ReleaseThunkLock( &mutex_count ); - if (!(ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) ))) + if (!(ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)MapSL(dwData) ))) { /* try to start the 16-bit winhelp */ if (WinExec( "winhelp.exe -x", SW_SHOWNORMAL ) >= 32) { Yield16(); - ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) ); + ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)MapSL(dwData) ); } } diff --git a/windows/winproc.c b/windows/winproc.c index bd57cf7694e..2826eed6aab 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -17,7 +17,6 @@ #include "builtin16.h" #include "controls.h" #include "heap.h" -#include "selectors.h" #include "struct32.h" #include "win.h" #include "winproc.h" @@ -225,9 +224,9 @@ static LRESULT WINAPI WINPROC_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, } if (offset) { - void *s = PTR_SEG_TO_LIN(lParam); + void *s = MapSL(lParam); lParam = stack16_push( offset ); - memcpy( PTR_SEG_TO_LIN(lParam), s, offset ); + memcpy( MapSL(lParam), s, offset ); } } @@ -279,7 +278,7 @@ static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle ) if (!IsBadReadPtr16( (SEGPTR)handle, sizeof(proc->thunk) )) { - ptr = (BYTE *)PTR_SEG_TO_LIN(handle); + ptr = MapSL( (SEGPTR)handle ); /* It must be the thunk address */ proc = (WINDOWPROC *)(ptr - (int)&((WINDOWPROC *)0)->thunk); if (HeapValidate( WinProcHeap, 0, proc ) && (proc->magic == WINPROC_MAGIC)) @@ -1068,7 +1067,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, return 0; case WM_COMPAREITEM: { - COMPAREITEMSTRUCT16* cis16 = (COMPAREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + COMPAREITEMSTRUCT16* cis16 = MapSL(*plparam); COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *) HeapAlloc(GetProcessHeap(), 0, sizeof(*cis)); if (!cis) return -1; @@ -1085,7 +1084,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, return 1; case WM_DELETEITEM: { - DELETEITEMSTRUCT16* dis16 = (DELETEITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + DELETEITEMSTRUCT16* dis16 = MapSL(*plparam); DELETEITEMSTRUCT *dis = (DELETEITEMSTRUCT *) HeapAlloc(GetProcessHeap(), 0, sizeof(*dis)); if (!dis) return -1; @@ -1098,7 +1097,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, return 1; case WM_MEASUREITEM: { - MEASUREITEMSTRUCT16* mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + MEASUREITEMSTRUCT16* mis16 = MapSL(*plparam); MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) HeapAlloc(GetProcessHeap(), 0, sizeof(*mis) + sizeof(LPARAM)); @@ -1115,7 +1114,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, return 1; case WM_DRAWITEM: { - DRAWITEMSTRUCT16* dis16 = (DRAWITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + DRAWITEMSTRUCT16* dis16 = MapSL(*plparam); DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)HeapAlloc(GetProcessHeap(), 0, sizeof(*dis)); if (!dis) return -1; @@ -1136,27 +1135,23 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, MINMAXINFO *mmi = (MINMAXINFO *)HeapAlloc( GetProcessHeap(), 0, sizeof(*mmi) + sizeof(LPARAM)); if (!mmi) return -1; - STRUCT32_MINMAXINFO16to32( (MINMAXINFO16*)PTR_SEG_TO_LIN(*plparam), - mmi ); + STRUCT32_MINMAXINFO16to32( MapSL(*plparam), mmi ); *(LPARAM *)(mmi + 1) = *plparam; /* Store the previous lParam */ *plparam = (LPARAM)mmi; } return 1; case WM_GETTEXT: case WM_SETTEXT: - *plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam); + *plparam = (LPARAM)MapSL(*plparam); return 0; case WM_MDICREATE: { - MDICREATESTRUCT16 *cs16 = - (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); - MDICREATESTRUCTA *cs = - (MDICREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0, - sizeof(*cs) + sizeof(LPARAM) ); + MDICREATESTRUCT16 *cs16 = MapSL(*plparam); + MDICREATESTRUCTA *cs = HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) + sizeof(LPARAM) ); if (!cs) return -1; STRUCT32_MDICREATESTRUCT16to32A( cs16, cs ); - cs->szTitle = (LPCSTR)PTR_SEG_TO_LIN(cs16->szTitle); - cs->szClass = (LPCSTR)PTR_SEG_TO_LIN(cs16->szClass); + cs->szTitle = MapSL(cs16->szTitle); + cs->szClass = MapSL(cs16->szClass); *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */ *plparam = (LPARAM)cs; } @@ -1203,7 +1198,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, nc = (NCCALCSIZE_PARAMS *)HeapAlloc( GetProcessHeap(), 0, sizeof(*nc) + sizeof(LPARAM) ); if (!nc) return -1; - nc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(*plparam); + nc16 = MapSL(*plparam); CONV_RECT16TO32( &nc16->rgrc[0], &nc->rgrc[0] ); if (wParam16) { @@ -1211,7 +1206,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, sizeof(*nc->lppos) ); CONV_RECT16TO32( &nc16->rgrc[1], &nc->rgrc[1] ); CONV_RECT16TO32( &nc16->rgrc[2], &nc->rgrc[2] ); - if (nc->lppos) STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(nc16->lppos), nc->lppos ); + if (nc->lppos) STRUCT32_WINDOWPOS16to32( MapSL(nc16->lppos), nc->lppos ); } *(LPARAM *)(nc + 1) = *plparam; /* Store the previous lParam */ *plparam = (LPARAM)nc; @@ -1220,13 +1215,13 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, case WM_NCCREATE: case WM_CREATE: { - CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + CREATESTRUCT16 *cs16 = MapSL(*plparam); CREATESTRUCTA *cs = (CREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) + sizeof(LPARAM) ); if (!cs) return -1; STRUCT32_CREATESTRUCT16to32A( cs16, cs ); - cs->lpszName = (LPCSTR)PTR_SEG_TO_LIN(cs16->lpszName); - cs->lpszClass = (LPCSTR)PTR_SEG_TO_LIN(cs16->lpszClass); + cs->lpszName = MapSL(cs16->lpszName); + cs->lpszClass = MapSL(cs16->lpszClass); *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */ *plparam = (LPARAM)cs; } @@ -1244,8 +1239,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, WINDOWPOS *wp = (WINDOWPOS *)HeapAlloc( GetProcessHeap(), 0, sizeof(*wp) + sizeof(LPARAM) ); if (!wp) return -1; - STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(*plparam), - wp ); + STRUCT32_WINDOWPOS16to32( MapSL(*plparam), wp ); *(LPARAM *)(wp + 1) = *plparam; /* Store the previous lParam */ *plparam = (LPARAM)wp; } @@ -1253,7 +1247,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, case WM_GETDLGCODE: if (*plparam) { - LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam); + LPMSG16 msg16 = MapSL(*plparam); LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) ); if (!msg32) return -1; @@ -1273,7 +1267,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32, } else return 0; case WM_NOTIFY: - *plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam); + *plparam = (LPARAM)MapSL(*plparam); return 1; case WM_ACTIVATEAPP: if (*plparam) @@ -1320,7 +1314,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP MEASUREITEMSTRUCT16 *mis16; MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam; lParam = *(LPARAM *)(mis + 1); - mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam); + mis16 = MapSL(lParam); mis16->itemWidth = (UINT16)mis->itemWidth; mis16->itemHeight = (UINT16)mis->itemHeight; HeapFree( GetProcessHeap(), 0, mis ); @@ -1330,8 +1324,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { MINMAXINFO *mmi = (MINMAXINFO *)lParam; lParam = *(LPARAM *)(mmi + 1); - STRUCT32_MINMAXINFO32to16( mmi, - (MINMAXINFO16 *)PTR_SEG_TO_LIN(lParam)); + STRUCT32_MINMAXINFO32to16( mmi, MapSL(lParam)); HeapFree( GetProcessHeap(), 0, mmi ); } break; @@ -1339,8 +1332,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { MDICREATESTRUCTA *cs = (MDICREATESTRUCTA *)lParam; lParam = *(LPARAM *)(cs + 1); - STRUCT32_MDICREATESTRUCT32Ato16( cs, - (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); + STRUCT32_MDICREATESTRUCT32Ato16( cs, MapSL(lParam) ); HeapFree( GetProcessHeap(), 0, cs ); } break; @@ -1353,7 +1345,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP NCCALCSIZE_PARAMS16 *nc16; NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lParam; lParam = *(LPARAM *)(nc + 1); - nc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(lParam); + nc16 = MapSL(lParam); CONV_RECT32TO16( &nc->rgrc[0], &nc16->rgrc[0] ); if (wParam) { @@ -1361,8 +1353,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP CONV_RECT32TO16( &nc->rgrc[2], &nc16->rgrc[2] ); if (nc->lppos) { - STRUCT32_WINDOWPOS32to16( nc->lppos, - (WINDOWPOS16 *)PTR_SEG_TO_LIN(nc16->lppos)); + STRUCT32_WINDOWPOS32to16( nc->lppos, MapSL(nc16->lppos)); HeapFree( GetProcessHeap(), 0, nc->lppos ); } } @@ -1374,8 +1365,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam; lParam = *(LPARAM *)(cs + 1); - STRUCT32_CREATESTRUCT32Ato16( cs, - (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); + STRUCT32_CREATESTRUCT32Ato16( cs, MapSL(lParam) ); HeapFree( GetProcessHeap(), 0, cs ); } break; @@ -1384,7 +1374,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { WINDOWPOS *wp = (WINDOWPOS *)lParam; lParam = *(LPARAM *)(wp + 1); - STRUCT32_WINDOWPOS32to16(wp,(WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam)); + STRUCT32_WINDOWPOS32to16(wp, MapSL(lParam)); HeapFree( GetProcessHeap(), 0, wp ); } break; @@ -1431,7 +1421,7 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p { WCHAR *str; INT len; - *plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam); + *plparam = (LPARAM)MapSL(*plparam); len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*plparam, -1, NULL, 0); str = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if(!str) return -1; @@ -1442,18 +1432,18 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p case WM_GETTEXT: case WM_SETTEXT: - *plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam); + *plparam = (LPARAM)MapSL(*plparam); return WINPROC_MapMsg32ATo32W( hwnd, *pmsg32, pwparam32, plparam ); case WM_NCCREATE: case WM_CREATE: { - CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + CREATESTRUCT16 *cs16 = MapSL(*plparam); CREATESTRUCTW *cs = (CREATESTRUCTW *)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) + sizeof(LPARAM) ); if (!cs) return -1; STRUCT32_CREATESTRUCT16to32A( cs16, (CREATESTRUCTA *)cs ); - cs->lpszName = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszName); - cs->lpszClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszClass); + cs->lpszName = MapSL(cs16->lpszName); + cs->lpszClass = MapSL(cs16->lpszClass); if (HIWORD(cs->lpszName)) cs->lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)cs->lpszName ); @@ -1466,15 +1456,14 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p return 1; case WM_MDICREATE: { - MDICREATESTRUCT16 *cs16 = - (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); + MDICREATESTRUCT16 *cs16 = MapSL(*plparam); MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) + sizeof(LPARAM) ); if (!cs) return -1; STRUCT32_MDICREATESTRUCT16to32A( cs16, (MDICREATESTRUCTA *)cs ); - cs->szTitle = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szTitle); - cs->szClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szClass); + cs->szTitle = MapSL(cs16->szTitle); + cs->szClass = MapSL(cs16->szClass); if (HIWORD(cs->szTitle)) cs->szTitle = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)cs->szTitle ); @@ -1488,7 +1477,7 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p case WM_GETDLGCODE: if (*plparam) { - LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam); + LPMSG16 msg16 = MapSL(*plparam); LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) ); if (!msg32) return -1; @@ -1542,7 +1531,7 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { LPARAM *ptr = (LPARAM *)lParam - 1; /* get the old lParam */ WORD len = *(WORD *)lParam; - *ptr = (LPARAM)PTR_SEG_TO_LIN(*ptr); + *ptr = (LPARAM)MapSL(*ptr); if(len > 0 && !WideCharToMultiByte(CP_ACP, 0, (LPWSTR)lParam, -1, (LPSTR)*ptr, len, NULL, NULL)) ((LPSTR)*ptr)[len-1] = 0; @@ -1563,8 +1552,7 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam; lParam = *(LPARAM *)(cs + 1); - STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA *)cs, - (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); + STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA *)cs, MapSL(lParam) ); if (HIWORD(cs->lpszName)) HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszName ); if (HIWORD(cs->lpszClass)) @@ -1576,8 +1564,7 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP { MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lParam; lParam = *(LPARAM *)(cs + 1); - STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA *)cs, - (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); + STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA *)cs, MapSL(lParam) ); if (HIWORD(cs->szTitle)) HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szTitle ); if (HIWORD(cs->szClass)) @@ -2083,13 +2070,13 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_DELETEITEM: case WM_DRAWITEM: case WM_SETTEXT: - SEGPTR_FREE( PTR_SEG_TO_LIN(p16->lParam) ); + SEGPTR_FREE( MapSL(p16->lParam) ); break; case CB_GETDROPPEDCONTROLRECT: case LB_GETITEMRECT: { - RECT16 *rect = (RECT16 *)PTR_SEG_TO_LIN(p16->lParam); + RECT16 *rect = MapSL(p16->lParam); p16->lParam = *(LPARAM *)(rect + 1); CONV_RECT16TO32( rect, (RECT *)(p16->lParam)); SEGPTR_FREE( rect ); @@ -2098,7 +2085,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case LB_GETSELITEMS: { INT i; - LPINT16 items = (LPINT16)PTR_SEG_TO_LIN(lParam); + LPINT16 items = MapSL(lParam); p16->lParam = *((LPARAM *)items - 1); for (i = 0; i < p16->wParam; i++) *((LPINT)(p16->lParam) + i) = items[i]; SEGPTR_FREE( (LPARAM *)items - 1 ); @@ -2119,7 +2106,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_MEASUREITEM: { - MEASUREITEMSTRUCT16 *mis = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(p16->lParam); + MEASUREITEMSTRUCT16 *mis = MapSL(p16->lParam); MEASUREITEMSTRUCT *mis32 = *(MEASUREITEMSTRUCT **)(mis + 1); mis32->itemWidth = mis->itemWidth; mis32->itemHeight = mis->itemHeight; @@ -2128,7 +2115,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, break; case WM_GETMINMAXINFO: { - MINMAXINFO16 *mmi = (MINMAXINFO16 *)PTR_SEG_TO_LIN(p16->lParam); + MINMAXINFO16 *mmi = MapSL(p16->lParam); p16->lParam = *(LPARAM *)(mmi + 1); STRUCT32_MINMAXINFO16to32( mmi, (MINMAXINFO *)(p16->lParam) ); SEGPTR_FREE(mmi); @@ -2136,7 +2123,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, break; case WM_GETTEXT: { - LPSTR str = (LPSTR)PTR_SEG_TO_LIN(p16->lParam); + LPSTR str = MapSL(p16->lParam); p16->lParam = *((LPARAM *)str - 1); lstrcpynA( (LPSTR)(p16->lParam), str, p16->wParam ); SEGPTR_FREE( (LPARAM *)str - 1 ); @@ -2144,9 +2131,9 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, break; case WM_MDICREATE: { - MDICREATESTRUCT16 *cs = (MDICREATESTRUCT16*)PTR_SEG_TO_LIN(p16->lParam); - SEGPTR_FREE( PTR_SEG_TO_LIN(cs->szTitle) ); - SEGPTR_FREE( PTR_SEG_TO_LIN(cs->szClass) ); + MDICREATESTRUCT16 *cs = MapSL(p16->lParam); + SEGPTR_FREE( MapSL(cs->szTitle) ); + SEGPTR_FREE( MapSL(cs->szClass) ); SEGPTR_FREE( cs ); } break; @@ -2157,7 +2144,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_NCCALCSIZE: { NCCALCSIZE_PARAMS *nc32; - NCCALCSIZE_PARAMS16 *nc = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(p16->lParam); + NCCALCSIZE_PARAMS16 *nc = MapSL(p16->lParam); p16->lParam = *(LPARAM *)(nc + 1); nc32 = (NCCALCSIZE_PARAMS *)(p16->lParam); CONV_RECT16TO32( &nc->rgrc[0], &nc32->rgrc[0] ); @@ -2165,9 +2152,8 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, { CONV_RECT16TO32( &nc->rgrc[1], &nc32->rgrc[1] ); CONV_RECT16TO32( &nc->rgrc[2], &nc32->rgrc[2] ); - STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(nc->lppos), - nc32->lppos ); - SEGPTR_FREE( PTR_SEG_TO_LIN(nc->lppos) ); + STRUCT32_WINDOWPOS16to32( MapSL(nc->lppos), nc32->lppos ); + SEGPTR_FREE( MapSL(nc->lppos) ); } SEGPTR_FREE(nc); } @@ -2175,16 +2161,16 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_NCCREATE: case WM_CREATE: { - CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(p16->lParam); - SEGPTR_FREE( PTR_SEG_TO_LIN(cs->lpszName) ); - SEGPTR_FREE( PTR_SEG_TO_LIN(cs->lpszClass) ); + CREATESTRUCT16 *cs = MapSL(p16->lParam); + SEGPTR_FREE( MapSL(cs->lpszName) ); + SEGPTR_FREE( MapSL(cs->lpszClass) ); SEGPTR_FREE( cs ); } break; case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: { - WINDOWPOS16 *wp = (WINDOWPOS16 *)PTR_SEG_TO_LIN(p16->lParam); + WINDOWPOS16 *wp = MapSL(p16->lParam); p16->lParam = *(LPARAM *)(wp + 1); STRUCT32_WINDOWPOS16to32( wp, (WINDOWPOS *)p16->lParam ); SEGPTR_FREE(wp); @@ -2196,7 +2182,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_GETDLGCODE: if (p16->lParam) { - LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(p16->lParam); + LPMSG16 msg16 = MapSL(p16->lParam); MSGPARAM16 msgp16; msgp16.wParam=msg16->wParam; msgp16.lParam=msg16->lParam; @@ -2333,7 +2319,7 @@ void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, { case WM_GETTEXT: { - LPSTR str = (LPSTR)PTR_SEG_TO_LIN(p16->lParam); + LPSTR str = MapSL(p16->lParam); p16->lParam = *((LPARAM *)str - 1); MultiByteToWideChar( CP_ACP, 0, str, -1, (LPWSTR)p16->lParam, 0x7fffffff ); SEGPTR_FREE( (LPARAM *)str - 1 ); @@ -2343,7 +2329,7 @@ void WINPROC_UnmapMsg32WTo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case CB_GETLBTEXT: if ( WINPROC_TestLBForStr( hwnd )) { - LPSTR str = (LPSTR)PTR_SEG_TO_LIN(p16->lParam); + LPSTR str = MapSL(p16->lParam); MultiByteToWideChar( CP_ACP, 0, str, -1, (LPWSTR)lParam, 0x7fffffff ); SEGPTR_FREE( (LPARAM *) str ); }