From ba41fe20bc8c5587d832ee93528f2f976d5aa66d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 12 Sep 2005 21:22:32 +0000 Subject: [PATCH] Fixed a few more pointer to integer typecast issues for 64-bit platforms. --- dlls/comctl32/tests/updown.c | 2 +- dlls/kernel/locale.c | 4 ++-- dlls/kernel/module.c | 2 +- dlls/kernel/resource16.c | 12 ++++++------ dlls/kernel/selector.c | 2 +- dlls/user/dialog.c | 6 +++--- dlls/user/menu.c | 24 ++++++++++++------------ dlls/user/message.c | 8 ++++---- dlls/user/winproc.c | 4 ++-- include/win.h | 2 +- include/winnt.h | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index 92b85389eec..db1e076c473 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -59,7 +59,7 @@ static HWND create_updown_control (HWND hWndEdit) NULL, NULL, hinst, NULL); assert (hWndUpDown); /* set the buddy. */ - SendMessage (hWndUpDown, UDM_SETBUDDY, (LONG)hWndEdit, 0L ); + SendMessage (hWndUpDown, UDM_SETBUDDY, (WPARAM)hWndEdit, 0L ); /* set the range. */ SendMessage (hWndUpDown, UDM_SETRANGE, 0L, (LPARAM) MAKELONG(32000, 0)); /* maybe show it. */ diff --git a/dlls/kernel/locale.c b/dlls/kernel/locale.c index 0346a61ef9b..3a3df32c174 100644 --- a/dlls/kernel/locale.c +++ b/dlls/kernel/locale.c @@ -1820,7 +1820,7 @@ BOOL WINAPI EnumSystemLocalesA( LOCALE_ENUMPROCA lpfnLocaleEnum, DWORD dwFlags ) TRACE("(%p,%08lx)\n", lpfnLocaleEnum, dwFlags); EnumResourceLanguagesA( kernel32_handle, (LPSTR)RT_STRING, (LPCSTR)LOCALE_ILANGUAGE, enum_lang_proc_a, - (LONG)lpfnLocaleEnum); + (LONG_PTR)lpfnLocaleEnum); return TRUE; } @@ -1835,7 +1835,7 @@ BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags ) TRACE("(%p,%08lx)\n", lpfnLocaleEnum, dwFlags); EnumResourceLanguagesW( kernel32_handle, (LPWSTR)RT_STRING, (LPCWSTR)LOCALE_ILANGUAGE, enum_lang_proc_w, - (LONG)lpfnLocaleEnum); + (LONG_PTR)lpfnLocaleEnum); return TRUE; } diff --git a/dlls/kernel/module.c b/dlls/kernel/module.c index 961afeb9c09..a2fe5b59e04 100644 --- a/dlls/kernel/module.c +++ b/dlls/kernel/module.c @@ -941,7 +941,7 @@ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) nts = LdrGetProcedureAddress( hModule, &str, 0, (void**)&fp ); } else - nts = LdrGetProcedureAddress( hModule, NULL, (DWORD)function, (void**)&fp ); + nts = LdrGetProcedureAddress( hModule, NULL, LOWORD(function), (void**)&fp ); if (nts != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError( nts ) ); diff --git a/dlls/kernel/resource16.c b/dlls/kernel/resource16.c index 20794b37f89..5afee94fb34 100644 --- a/dlls/kernel/resource16.c +++ b/dlls/kernel/resource16.c @@ -202,7 +202,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId TRACE("NameTable entry: type=%04x id=%04x\n", pTypeInfo->type_id, pNameInfo->id ); handle = LoadResource16( pModule->self, - (HRSRC16)((int)pNameInfo - (int)pModule) ); + (HRSRC16)((char *)pNameInfo - (char *)pModule) ); for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p)) { TRACE(" type=%04x '%s' id=%04x '%s'\n", @@ -226,7 +226,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId if (strcasecmp( resId, (char*)(p+3)+strlen((char*)(p+3))+1 )) continue; } - else if (HIWORD(resId) || (((DWORD)resId & ~0x8000) != p[2])) + else if (HIWORD(resId) || ((LOWORD(resId) & ~0x8000) != p[2])) continue; /* If we get here, we've found the entry */ @@ -507,7 +507,7 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 ) while (nbItems) { /* align on DWORD boundary (32-bit only) */ - dialog32 = (LPVOID)((((int)dialog32) + 3) & ~3); + dialog32 = (LPVOID)(((UINT_PTR)dialog32 + 3) & ~3); if (dialogEx) { @@ -636,7 +636,7 @@ WORD WINAPI GetDialog32Size16( LPVOID dialog32 ) while (nbItems) { /* align on DWORD boundary */ - p = (LPVOID)((((int)p) + 3) & ~3); + p = (LPVOID)(((UINT_PTR)p + 3) & ~3); if (dialogEx) { @@ -736,7 +736,7 @@ VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 ) menu32 = (LPWSTR)menu32 + strlenW( (LPWSTR)menu32 ) + 1; /* align on DWORD boundary (32-bit only) */ - menu32 = (LPVOID)((((int)menu32) + 3) & ~3); + menu32 = (LPVOID)(((UINT_PTR)menu32 + 3) & ~3); /* If popup, transfer helpid */ if ( flags & 1) @@ -787,7 +787,7 @@ WORD WINAPI GetMenu32Size16( LPVOID menu32 ) p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; /* align on DWORD boundary (32-bit only) */ - p = (LPVOID)((((int)p) + 3) & ~3); + p = (LPVOID)(((UINT_PTR)p + 3) & ~3); /* If popup, skip helpid */ if ( flags & 1) diff --git a/dlls/kernel/selector.c b/dlls/kernel/selector.c index 678850a3aec..2bd91804a49 100644 --- a/dlls/kernel/selector.c +++ b/dlls/kernel/selector.c @@ -481,7 +481,7 @@ SEGPTR WINAPI MapLS( LPCVOID ptr ) const void *base; SEGPTR ret = 0; - if (!HIWORD(ptr)) return (SEGPTR)ptr; + if (!HIWORD(ptr)) return (SEGPTR)LOWORD(ptr); base = (const char *)ptr - ((unsigned int)ptr & 0x7fff); HeapLock( GetProcessHeap() ); diff --git a/dlls/user/dialog.c b/dlls/user/dialog.c index 46993a1dacb..085d7fdaeae 100644 --- a/dlls/user/dialog.c +++ b/dlls/user/dialog.c @@ -55,7 +55,7 @@ typedef struct INT16 y; INT16 cx; INT16 cy; - UINT id; + UINT_PTR id; LPCWSTR className; LPCWSTR windowName; LPCVOID data; @@ -244,7 +244,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info, p++; /* Next control is on dword boundary */ - return (const WORD *)((((int)p) + 3) & ~3); + return (const WORD *)(((UINT_PTR)p + 3) & ~3); } @@ -446,7 +446,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result ) } /* First control is on dword boundary */ - return (LPCSTR)((((int)p) + 3) & ~3); + return (LPCSTR)(((UINT_PTR)p + 3) & ~3); } diff --git a/dlls/user/menu.c b/dlls/user/menu.c index c0993edfeab..ec8cd854a36 100644 --- a/dlls/user/menu.c +++ b/dlls/user/menu.c @@ -73,8 +73,8 @@ typedef struct { HBITMAP hCheckBit; /* Bitmap when checked. */ HBITMAP hUnCheckBit; /* Bitmap when unchecked. */ LPWSTR text; /* Item text or bitmap handle. */ - DWORD dwItemData; /* Application defined. */ - DWORD dwTypeData; /* depends on fMask */ + ULONG_PTR dwItemData; /* Application defined. */ + LPWSTR dwTypeData; /* depends on fMask */ HBITMAP hbmpItem; /* bitmap in win98 style menus */ /* ----------- Wine stuff ----------- */ RECT rect; /* Item area (relative to menu window) */ @@ -863,7 +863,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner, mis.CtlType = ODT_MENU; mis.CtlID = 0; mis.itemID = lpitem->wID; - mis.itemData = (DWORD)lpitem->dwItemData; + mis.itemData = lpitem->dwItemData; mis.itemHeight = ODitemheight; mis.itemWidth = 0; SendMessageW( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)&mis ); @@ -1188,7 +1188,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, dis.CtlType = ODT_MENU; dis.CtlID = 0; dis.itemID = lpitem->wID; - dis.itemData = (DWORD)lpitem->dwItemData; + dis.itemData = lpitem->dwItemData; dis.itemState = 0; if (lpitem->fState & MF_CHECKED) dis.itemState |= ODS_CHECKED; if (lpitem->fState & MF_GRAYED) dis.itemState |= ODS_GRAYED|ODS_DISABLED; @@ -1777,7 +1777,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT_PTR id, else item->text = NULL; if (flags & MF_OWNERDRAW) - item->dwItemData = (DWORD)str; + item->dwItemData = (DWORD_PTR)str; else item->dwItemData = 0; @@ -1901,8 +1901,8 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode ) if (!hSubMenu) return NULL; if (!(res = MENU_ParseResource( res, hSubMenu, unicode ))) return NULL; - if (!unicode) AppendMenuA( hMenu, flags, (UINT)hSubMenu, str ); - else AppendMenuW( hMenu, flags, (UINT)hSubMenu, (LPCWSTR)str ); + if (!unicode) AppendMenuA( hMenu, flags, (UINT_PTR)hSubMenu, str ); + else AppendMenuW( hMenu, flags, (UINT_PTR)hSubMenu, (LPCWSTR)str ); } else /* Not a popup */ { @@ -1938,11 +1938,11 @@ static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu) resinfo = GET_WORD(res); /* FIXME: for 16-bit apps this is a byte. */ res += sizeof(WORD); /* Align the text on a word boundary. */ - res += (~((int)res - 1)) & 1; + res += (~((UINT_PTR)res - 1)) & 1; mii.dwTypeData = (LPWSTR) res; res += (1 + strlenW(mii.dwTypeData)) * sizeof(WCHAR); /* Align the following fields on a dword boundary. */ - res += (~((int)res - 1)) & 3; + res += (~((UINT_PTR)res - 1)) & 3; TRACE("Menu item: [%08x,%08x,%04x,%04x,%s]\n", mii.fType, mii.fState, mii.wID, resinfo, debugstr_w(mii.dwTypeData)); @@ -3425,8 +3425,8 @@ BOOL WINAPI InsertMenuW( HMENU hMenu, UINT pos, UINT flags, if (IS_STRING_ITEM(flags) && str) TRACE("hMenu %p, pos %d, flags %08x, id %04x, str %s\n", hMenu, pos, flags, id, debugstr_w(str) ); - else TRACE("hMenu %p, pos %d, flags %08x, id %04x, str %08lx (not a string)\n", - hMenu, pos, flags, id, (DWORD)str ); + else TRACE("hMenu %p, pos %d, flags %08x, id %04x, str %p (not a string)\n", + hMenu, pos, flags, id, str ); if (!(item = MENU_InsertItem( hMenu, pos, flags ))) return FALSE; @@ -3552,7 +3552,7 @@ BOOL WINAPI ModifyMenuW( HMENU hMenu, UINT pos, UINT flags, } else { - TRACE("%p %d %04x %04x %08lx\n", hMenu, pos, flags, id, (DWORD)str ); + TRACE("%p %d %04x %04x %p\n", hMenu, pos, flags, id, str ); } if (!(item = MENU_FindItem( &hMenu, &pos, flags ))) return FALSE; diff --git a/dlls/user/message.c b/dlls/user/message.c index 74461f33f94..ba962da7e92 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -1280,7 +1280,7 @@ static BOOL post_dde_message( DWORD dest_tid, struct packed_message *data, const { void* ptr = NULL; int size = 0; - UINT uiLo, uiHi; + UINT_PTR uiLo, uiHi; LPARAM lp = 0; HGLOBAL hunlock = 0; int i; @@ -1399,7 +1399,7 @@ static BOOL post_dde_message( DWORD dest_tid, struct packed_message *data, const static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void **buffer, size_t size ) { - UINT uiLo, uiHi; + UINT_PTR uiLo, uiHi; HGLOBAL hMem = 0; void* ptr; @@ -1413,7 +1413,7 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM if (!buffer || !*buffer) return FALSE; uiLo = *lparam; memcpy( &hMem, *buffer, size ); - uiHi = (UINT)hMem; + uiHi = (UINT_PTR)hMem; TRACE("recv dde-ack %x mem=%x[%lx]\n", uiLo, uiHi, GlobalSize( hMem )); } else @@ -1445,7 +1445,7 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM return FALSE; } } - uiLo = (UINT)hMem; + uiLo = (UINT_PTR)hMem; *lparam = PackDDElParam( message, uiLo, uiHi ); break; diff --git a/dlls/user/winproc.c b/dlls/user/winproc.c index 8bec671ef67..7c79ebd991d 100644 --- a/dlls/user/winproc.c +++ b/dlls/user/winproc.c @@ -2434,7 +2434,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32, case WM_DDE_DATA: case WM_DDE_POKE: { - UINT lo32, hi; + UINT_PTR lo32, hi; HANDLE16 lo16 = 0; *pwparam16 = HWND_16((HWND)wParam32); @@ -2446,7 +2446,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32, return 0; /* FIXME don't know how to free allocated memory (handle) !! */ case WM_DDE_ACK: { - UINT lo, hi; + UINT_PTR lo, hi; int flag = 0; char buf[2]; diff --git a/include/win.h b/include/win.h index a1714761c14..437aecf48d8 100644 --- a/include/win.h +++ b/include/win.h @@ -50,7 +50,7 @@ typedef struct tagWND DWORD dwStyle; /* Window style (from CreateWindow) */ DWORD dwExStyle; /* Extended style (from CreateWindowEx) */ DWORD clsStyle; /* Class style at window creation */ - UINT wIDmenu; /* ID or hmenu (from CreateWindow) */ + UINT_PTR wIDmenu; /* ID or hmenu (from CreateWindow) */ DWORD helpContext; /* Help context ID */ UINT flags; /* Misc. flags (see below) */ HMENU hSysMenu; /* window's copy of System Menu */ diff --git a/include/winnt.h b/include/winnt.h index 8ffb6903fff..183486953be 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -545,7 +545,7 @@ typedef struct _MEMORY_BASIC_INFORMATION #define MAXDWORD 0xffffffff #define FIELD_OFFSET(type, field) \ - ((LONG)(INT)&(((type *)0)->field)) + ((LONG)(INT_PTR)&(((type *)0)->field)) #define CONTAINING_RECORD(address, type, field) \ ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))