From 628939d567a746b05fdaf049b40c6a00f0c6b9a4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 10 Aug 2005 10:59:19 +0000 Subject: [PATCH] Use the proper WOW functions everywhere instead of the K32WOW variant. --- dlls/gdi/metafile.c | 2 +- dlls/kernel/kernel_main.c | 5 +++-- dlls/kernel/local16.c | 2 +- dlls/kernel/resource16.c | 2 +- dlls/kernel/task.c | 2 +- dlls/ole32/ole16.c | 2 +- dlls/ole32/storage.c | 30 +++++++++++++++--------------- dlls/user/edit.c | 2 +- dlls/user/user16.c | 2 +- dlls/winmm/mmsystem.c | 4 ++-- dlls/wow32/wow_main.c | 28 ++++++++++++++-------------- include/wine/winbase16.h | 17 +---------------- include/wownt32.h | 32 ++++++++++++++++++++------------ 13 files changed, 62 insertions(+), 68 deletions(-) diff --git a/dlls/gdi/metafile.c b/dlls/gdi/metafile.c index 42128e81f7c..2e95947b57c 100644 --- a/dlls/gdi/metafile.c +++ b/dlls/gdi/metafile.c @@ -666,7 +666,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc16, HMETAFILE16 hmf, hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(HANDLETABLE16) * mh->mtNoObjects); - spht = K32WOWGlobalLock16(hHT); + spht = WOWGlobalLock16(hHT); seg = hmf | 7; offset = mh->mtHeaderSize * 2; diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index 2fc8fcbe359..36acafb3639 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c @@ -38,6 +38,7 @@ #include "winbase.h" #include "wincon.h" #include "winternl.h" +#include "wownt32.h" #include "wine/winbase16.h" #include "wine/library.h" @@ -82,7 +83,7 @@ static void ldt_unlock(void) static void thread_attach(void) { /* allocate the 16-bit stack (FIXME: should be done lazily) */ - HGLOBAL16 hstack = K32WOWGlobalAlloc16( GMEM_FIXED, 0x10000 ); + HGLOBAL16 hstack = WOWGlobalAlloc16( GMEM_FIXED, 0x10000 ); kernel_get_thread_data()->stack_sel = GlobalHandleToSel16( hstack ); NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( kernel_get_thread_data()->stack_sel, 0x10000 - sizeof(STACK16FRAME) ); @@ -95,7 +96,7 @@ static void thread_attach(void) static void thread_detach(void) { /* free the 16-bit stack */ - K32WOWGlobalFree16( kernel_get_thread_data()->stack_sel ); + WOWGlobalFree16( kernel_get_thread_data()->stack_sel ); NtCurrentTeb()->WOW32Reserved = 0; if (NtCurrentTeb()->Tib.SubSystemTib) TASK_ExitTask(); } diff --git a/dlls/kernel/local16.c b/dlls/kernel/local16.c index 6d0f2d040b6..784a5a6a82f 100644 --- a/dlls/kernel/local16.c +++ b/dlls/kernel/local16.c @@ -1683,7 +1683,7 @@ WORD WINAPI LocalHandleDelta16( WORD delta ) */ BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle ) { - LOCALHEAPINFO *pInfo = LOCAL_GetHeap(SELECTOROF(K32WOWGlobalLock16(handle))); + LOCALHEAPINFO *pInfo = LOCAL_GetHeap(SELECTOROF(WOWGlobalLock16(handle))); if (!pInfo) return FALSE; pLocalInfo->wcItems = pInfo->items; return TRUE; diff --git a/dlls/kernel/resource16.c b/dlls/kernel/resource16.c index 2cd203662b6..3f178f786aa 100644 --- a/dlls/kernel/resource16.c +++ b/dlls/kernel/resource16.c @@ -1066,7 +1066,7 @@ SEGPTR WINAPI WIN16_LockResource16( HGLOBAL16 handle ) { TRACE("(%04x)\n", handle ); /* May need to reload the resource if discarded */ - return K32WOWGlobalLock16( handle ); + return WOWGlobalLock16( handle ); } diff --git a/dlls/kernel/task.c b/dlls/kernel/task.c index c7fd75ec8e2..5ccccd71785 100644 --- a/dlls/kernel/task.c +++ b/dlls/kernel/task.c @@ -1612,5 +1612,5 @@ SEGPTR WINAPI GetDOSEnvironment16(void) } FreeEnvironmentStringsA( env ); } - return K32WOWGlobalLock16( handle ); + return WOWGlobalLock16( handle ); } diff --git a/dlls/ole32/ole16.c b/dlls/ole32/ole16.c index bf69b1f58f2..4beb8e6e74e 100644 --- a/dlls/ole32/ole16.c +++ b/dlls/ole32/ole16.c @@ -305,7 +305,7 @@ _xmalloc16(DWORD size, SEGPTR *ptr) { /* No need for a Callback entry, we have WOWCallback16Ex which does * everything we need. */ - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const IMalloc16Vtbl*)MapSL( (SEGPTR)((LPMALLOC16)MapSL((SEGPTR)mllc))->lpVtbl ) )->Alloc, diff --git a/dlls/ole32/storage.c b/dlls/ole32/storage.c index 9edce10a675..db123ad24ab 100644 --- a/dlls/ole32/storage.c +++ b/dlls/ole32/storage.c @@ -369,11 +369,11 @@ STORAGE_get_big_block(stream_access16 *str,int n,BYTE *block) args[0] = (DWORD)str->lockbytes; /* iface */ args[1] = (n+1)*BIGSIZE; args[2] = 0; /* ULARGE_INTEGER offset */ - args[3] = (DWORD)K32WOWGlobalAllocLock16( 0, BIGSIZE, &hsig ); /* sig */ + args[3] = WOWGlobalAllocLock16( 0, BIGSIZE, &hsig ); /* sig */ args[4] = BIGSIZE; args[5] = 0; - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(str->lockbytes))->lpVtbl) )->ReadAt, @@ -386,7 +386,7 @@ STORAGE_get_big_block(stream_access16 *str,int n,BYTE *block) return FALSE; } memcpy(block, MapSL(args[3]), BIGSIZE); - K32WOWGlobalUnlockFree16(args[3]); + WOWGlobalUnlockFree16(args[3]); } return TRUE; } @@ -405,7 +405,7 @@ _ilockbytes16_writeat(SEGPTR lockbytes, DWORD offset, DWORD length, void *buffer /* THIS_ ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten); */ - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(lockbytes))->lpVtbl) )->WriteAt, @@ -1098,7 +1098,7 @@ _ilockbytes16_addref(SEGPTR lockbytes) { HRESULT hres; args[0] = (DWORD)lockbytes; /* iface */ - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(lockbytes))->lpVtbl) )->AddRef, @@ -1116,7 +1116,7 @@ _ilockbytes16_release(SEGPTR lockbytes) { HRESULT hres; args[0] = (DWORD)lockbytes; /* iface */ - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(lockbytes))->lpVtbl) )->Release, @@ -1134,7 +1134,7 @@ _ilockbytes16_flush(SEGPTR lockbytes) { HRESULT hres; args[0] = (DWORD)lockbytes; /* iface */ - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(lockbytes))->lpVtbl) )->Flush, @@ -2155,11 +2155,11 @@ HRESULT WINAPI StgIsStorageILockBytes16(SEGPTR plkbyt) args[0] = (DWORD)plkbyt; /* iface */ args[1] = args[2] = 0; /* ULARGE_INTEGER offset */ - args[3] = (DWORD)K32WOWGlobalAllocLock16( 0, 8, &hsig ); /* sig */ + args[3] = WOWGlobalAllocLock16( 0, 8, &hsig ); /* sig */ args[4] = 8; args[5] = 0; - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const ILockBytes16Vtbl*)MapSL( (SEGPTR)((LPLOCKBYTES16)MapSL(plkbyt))->lpVtbl) )->ReadAt, @@ -2172,10 +2172,10 @@ HRESULT WINAPI StgIsStorageILockBytes16(SEGPTR plkbyt) return hres; } if (memcmp(MapSL(args[3]), STORAGE_magic, sizeof(STORAGE_magic)) == 0) { - K32WOWGlobalUnlockFree16(args[3]); + WOWGlobalUnlockFree16(args[3]); return S_OK; } - K32WOWGlobalUnlockFree16(args[3]); + WOWGlobalUnlockFree16(args[3]); return S_FALSE; } @@ -2239,10 +2239,10 @@ HRESULT WINAPI ReadClassStg16(SEGPTR /*IStorage **/pstg,CLSID *pclsid){ * read a STATSTG structure (contains the clsid) from the storage */ args[0] = (DWORD)pstg; /* iface */ - args[1] = (DWORD)K32WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg ); + args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg ); args[2] = STATFLAG_DEFAULT; - if (!K32WOWCallback16Ex( + if (!WOWCallback16Ex( (DWORD)((const IStorage16Vtbl*)MapSL( (SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl) )->Stat, @@ -2251,12 +2251,12 @@ HRESULT WINAPI ReadClassStg16(SEGPTR /*IStorage **/pstg,CLSID *pclsid){ (LPVOID)args, (LPDWORD)&hres )) { - K32WOWGlobalUnlockFree16(args[1]); + WOWGlobalUnlockFree16(args[1]); ERR("CallTo16 IStorage16::Stat() failed, hres %lx\n",hres); return hres; } memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16)); - K32WOWGlobalUnlockFree16(args[1]); + WOWGlobalUnlockFree16(args[1]); if(SUCCEEDED(hres)) { *pclsid=statstg.clsid; diff --git a/dlls/user/edit.c b/dlls/user/edit.c index f048d61a599..c89e3117c31 100644 --- a/dlls/user/edit.c +++ b/dlls/user/edit.c @@ -1354,7 +1354,7 @@ static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count countA = WideCharToMultiByte(CP_ACP, 0, es->text + start, count, NULL, 0, NULL, NULL); hglob16 = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT, countA); - segptr = K32WOWGlobalLock16(hglob16); + segptr = WOWGlobalLock16(hglob16); WideCharToMultiByte(CP_ACP, 0, es->text + start, count, MapSL(segptr), countA, NULL, NULL); args[4] = SELECTOROF(segptr); args[3] = OFFSETOF(segptr); diff --git a/dlls/user/user16.c b/dlls/user/user16.c index 07bc767b1b8..76008a3b4c6 100644 --- a/dlls/user/user16.c +++ b/dlls/user/user16.c @@ -1547,7 +1547,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj, HWND16 hCurrentWnd = 0; lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo); - spDragInfo = K32WOWGlobalLock16(hDragInfo); + spDragInfo = WOWGlobalLock16(hDragInfo); if( !lpDragInfo || !spDragInfo ) return 0L; diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index 30250a763db..6f16798daf3 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -1863,7 +1863,7 @@ void WINAPI mmTaskYield16(void) MSG msg; if (PeekMessageA(&msg, 0, 0, 0, 0)) { - K32WOWYield16(); + WOWYield16(); } } @@ -2150,7 +2150,7 @@ DWORD WINAPI WINE_mmThreadEntryPoint(LPVOID p) TRACE("[30-%p]\n", lpMMThd->hThread); while (lpMMThd->dwCounter) { Sleep(1); - /* K32WOWYield16();*/ + /* WOWYield16();*/ } TRACE("[XX-%p]\n", lpMMThd->hThread); /* paranoia */ diff --git a/dlls/wow32/wow_main.c b/dlls/wow32/wow_main.c index d998fd22a98..ea9deb4a425 100644 --- a/dlls/wow32/wow_main.c +++ b/dlls/wow32/wow_main.c @@ -23,24 +23,24 @@ #include "winbase.h" #include "wownt32.h" -#undef WOWHandle32 -#undef WOWHandle16 #undef WOWCallback16 #undef WOWCallback16Ex +#undef WOWDirectedYield16 +#undef WOWGetVDMPointer +#undef WOWGetVDMPointerFix +#undef WOWGetVDMPointerUnfix +#undef WOWGlobalAlloc16 +#undef WOWGlobalAllocLock16 +#undef WOWGlobalFree16 +#undef WOWGlobalLock16 +#undef WOWGlobalLockSize16 +#undef WOWGlobalUnlock16 +#undef WOWGlobalUnlockFree16 +#undef WOWHandle16 +#undef WOWHandle32 +#undef WOWYield16 BOOL WINAPI K32WOWGetDescriptor(DWORD,LPLDT_ENTRY); -LPVOID WINAPI K32WOWGetVDMPointer(DWORD,DWORD,BOOL); -LPVOID WINAPI K32WOWGetVDMPointerFix(DWORD,DWORD,BOOL); -void WINAPI K32WOWGetVDMPointerUnfix(DWORD); -WORD WINAPI K32WOWGlobalAlloc16(WORD,DWORD); -WORD WINAPI K32WOWGlobalFree16(WORD); -DWORD WINAPI K32WOWGlobalLock16(WORD); -BOOL WINAPI K32WOWGlobalUnlock16(WORD); -DWORD WINAPI K32WOWGlobalAllocLock16(WORD,DWORD,WORD *); -WORD WINAPI K32WOWGlobalUnlockFree16(DWORD); -DWORD WINAPI K32WOWGlobalLockSize16(WORD,PDWORD); -void WINAPI K32WOWYield16(void); -void WINAPI K32WOWDirectedYield16(WORD); /********************************************************************** * WOWGetDescriptor (WOW32.1) diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h index 0eed9a0fd3c..7994c3b82fb 100644 --- a/include/wine/winbase16.h +++ b/include/wine/winbase16.h @@ -373,21 +373,6 @@ SEGPTR WINAPI HasGPHandler16(SEGPTR); BOOL16 WINAPI IsSharedSelector16(HANDLE16); BOOL16 WINAPI IsTask16(HTASK16); HTASK16 WINAPI IsTaskLocked16(void); -DWORD WINAPI K32WOWCallback16(DWORD,DWORD); -BOOL WINAPI K32WOWCallback16Ex(DWORD,DWORD,DWORD,LPVOID,LPDWORD); -VOID WINAPI K32WOWDirectedYield16(WORD); -BOOL WINAPI K32WOWGetDescriptor(SEGPTR,LPLDT_ENTRY); -LPVOID WINAPI K32WOWGetVDMPointer(DWORD,DWORD,BOOL); -LPVOID WINAPI K32WOWGetVDMPointerFix(DWORD,DWORD,BOOL); -VOID WINAPI K32WOWGetVDMPointerUnfix(DWORD); -WORD WINAPI K32WOWGlobalAlloc16(WORD,DWORD); -DWORD WINAPI K32WOWGlobalAllocLock16(WORD,DWORD,WORD*); -WORD WINAPI K32WOWGlobalFree16(WORD); -SEGPTR WINAPI K32WOWGlobalLock16(HGLOBAL16); -DWORD WINAPI K32WOWGlobalLockSize16(WORD,PDWORD); -BOOL WINAPI K32WOWGlobalUnlock16(WORD); -WORD WINAPI K32WOWGlobalUnlockFree16(DWORD); -VOID WINAPI K32WOWYield16(void); VOID WINAPI LogError16(UINT16, LPVOID); VOID WINAPI LogParamError16(UINT16,FARPROC16,LPVOID); WORD WINAPI LocalCountFree16(void); @@ -522,7 +507,7 @@ DWORD WINAPI SizeofResource16(HMODULE16,HRSRC16); void WINAPI UnlockSegment16(HGLOBAL16); BOOL16 WINAPI WritePrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPCSTR); BOOL16 WINAPI WriteProfileString16(LPCSTR,LPCSTR,LPCSTR); -/* Yield16 will only be available from kernel module, use K32WOWYield instead */ +/* Yield16 will only be available from kernel module, use WOWYield instead */ VOID WINAPI Yield16(void); SEGPTR WINAPI lstrcat16(SEGPTR,LPCSTR); SEGPTR WINAPI lstrcatn16(SEGPTR,LPCSTR,INT16); diff --git a/include/wownt32.h b/include/wownt32.h index 415c4873099..d8b2336f652 100644 --- a/include/wownt32.h +++ b/include/wownt32.h @@ -21,6 +21,26 @@ #ifndef _WOWNT32_H_ #define _WOWNT32_H_ +#ifdef __WINESRC__ +/* under Wine use the kernel functions directly so we don't have to import wow32 */ +#define WOWCallback16 K32WOWCallback16 +#define WOWCallback16Ex K32WOWCallback16Ex +#define WOWDirectedYield16 K32WOWDirectedYield16 +#define WOWGetVDMPointer K32WOWGetVDMPointer +#define WOWGetVDMPointerFix K32WOWGetVDMPointerFix +#define WOWGetVDMPointerUnfix K32WOWGetVDMPointerUnfix +#define WOWGlobalAlloc16 K32WOWGlobalAlloc16 +#define WOWGlobalAllocLock16 K32WOWGlobalAllocLock16 +#define WOWGlobalFree16 K32WOWGlobalFree16 +#define WOWGlobalLock16 K32WOWGlobalLock16 +#define WOWGlobalLockSize16 K32WOWGlobalLockSize16 +#define WOWGlobalUnlock16 K32WOWGlobalUnlock16 +#define WOWGlobalUnlockFree16 K32WOWGlobalUnlockFree16 +#define WOWHandle16 K32WOWHandle16 +#define WOWHandle32 K32WOWHandle32 +#define WOWYield16 K32WOWYield16 +#endif + LPVOID WINAPI WOWGetVDMPointer(DWORD,DWORD,BOOL); LPVOID WINAPI WOWGetVDMPointerFix(DWORD,DWORD,BOOL); VOID WINAPI WOWGetVDMPointerUnfix(DWORD); @@ -59,18 +79,6 @@ typedef enum HANDLE WINAPI WOWHandle32(WORD,WOW_HANDLE_TYPE); WORD WINAPI WOWHandle16(HANDLE,WOW_HANDLE_TYPE); -#ifdef __WINESRC__ -/* under Wine use the kernel functions directly so we don't have to import wow32 */ -HANDLE WINAPI K32WOWHandle32(WORD,WOW_HANDLE_TYPE); -WORD WINAPI K32WOWHandle16(HANDLE,WOW_HANDLE_TYPE); -DWORD WINAPI K32WOWCallback16(DWORD,DWORD); -BOOL WINAPI K32WOWCallback16Ex(DWORD,DWORD,DWORD,PVOID,PDWORD); -#define WOWHandle32 K32WOWHandle32 -#define WOWHandle16 K32WOWHandle16 -#define WOWCallback16 K32WOWCallback16 -#define WOWCallback16Ex K32WOWCallback16Ex -#endif - #ifdef __WINESRC__ /* under Wine we use optimized versions where we can */ #define HWND_32(h16) ((HWND) (ULONG_PTR)(h16))