Use the proper WOW functions everywhere instead of the K32WOW variant.

This commit is contained in:
Alexandre Julliard 2005-08-10 10:59:19 +00:00
parent 0df36de530
commit 628939d567
13 changed files with 62 additions and 68 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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;

View File

@ -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 );
}

View File

@ -1612,5 +1612,5 @@ SEGPTR WINAPI GetDOSEnvironment16(void)
}
FreeEnvironmentStringsA( env );
}
return K32WOWGlobalLock16( handle );
return WOWGlobalLock16( handle );
}

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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)

View File

@ -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);

View File

@ -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))