Moved implementation of WOW routines to single file.

Added all missing WOW routines, fixed WOWCallback16Ex.
This commit is contained in:
Ulrich Weigand 1999-08-18 18:31:26 +00:00 committed by Alexandre Julliard
parent 16b901c552
commit c3d9f28172
16 changed files with 617 additions and 463 deletions

View File

@ -418,11 +418,11 @@ file krnl386.exe
511 stub WOWKILLREMOTETASK 511 stub WOWKILLREMOTETASK
512 stub WOWQUERYDEBUG 512 stub WOWQUERYDEBUG
513 pascal LoadLibraryEx32W(ptr long long) LoadLibraryEx32W16 # Both NT/95 513 pascal LoadLibraryEx32W(ptr long long) LoadLibraryEx32W16 # Both NT/95
514 pascal16 FreeLibrary32W(long) FreeLibrary # Both NT/95 514 pascal FreeLibrary32W(long) FreeLibrary32W16 # Both NT/95
515 pascal GetProcAddress32W(long str) GetProcAddress # Both NT/95 515 pascal GetProcAddress32W(long str) GetProcAddress32W16 # Both NT/95
516 pascal GetVDMPointer32W(segptr word) GetVDMPointer32W # Both NT/95 516 pascal GetVDMPointer32W(segptr word) GetVDMPointer32W16 # Both NT/95
517 pascal CallProc32W() CallProc32W_16 # Both NT/95 517 pascal CallProc32W() CallProc32W16 # Both NT/95
518 pascal CallProcEx32W() CallProcEx32W_16 # Both NT/95 518 pascal CallProcEx32W() CallProcEx32W16 # Both NT/95
519 stub EXITKERNELTHUNK 519 stub EXITKERNELTHUNK
# the __MOD_ variables are WORD datareferences, the current values are invented. # the __MOD_ variables are WORD datareferences, the current values are invented.
520 equate __MOD_KERNEL 4200 520 equate __MOD_KERNEL 4200

View File

@ -394,112 +394,3 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT86 *context )
ERR("Switching stack segment with Throw() not supported; expect crash now\n" ); ERR("Switching stack segment with Throw() not supported; expect crash now\n" );
} }
/**********************************************************************
* RELAY_CallProc32W
*
* Helper for CallProc[Ex]32W
*/
static DWORD RELAY_CallProc32W(int Ex)
{
DWORD nrofargs, argconvmask;
FARPROC proc32;
DWORD *args, ret;
VA_LIST16 valist;
int i;
int aix;
SYSLEVEL_ReleaseWin16Lock();
VA_START16( valist );
nrofargs = VA_ARG16( valist, DWORD );
argconvmask = VA_ARG16( valist, DWORD );
proc32 = VA_ARG16( valist, FARPROC );
TRACE("CallProc32W(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
args = (DWORD*)HEAP_xalloc( GetProcessHeap(), 0,
sizeof(DWORD)*nrofargs );
/* CallProcEx doesn't need its args reversed */
for (i=0;i<nrofargs;i++) {
if (Ex) {
aix = i;
} else {
aix = nrofargs - i - 1;
}
if (argconvmask & (1<<i))
{
SEGPTR ptr = VA_ARG16( valist, SEGPTR );
args[aix] = (DWORD)PTR_SEG_TO_LIN(ptr);
if (TRACE_ON(relay)) DPRINTF("%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
}
else
{
args[aix] = VA_ARG16( valist, DWORD );
if (TRACE_ON(relay)) DPRINTF("%ld,",args[aix]);
}
}
if (TRACE_ON(relay)) DPRINTF("])\n");
VA_END16( valist );
if (!proc32) ret = 0;
else switch (nrofargs)
{
case 0: ret = proc32();
break;
case 1: ret = proc32(args[0]);
break;
case 2: ret = proc32(args[0],args[1]);
break;
case 3: ret = proc32(args[0],args[1],args[2]);
break;
case 4: ret = proc32(args[0],args[1],args[2],args[3]);
break;
case 5: ret = proc32(args[0],args[1],args[2],args[3],args[4]);
break;
case 6: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5]);
break;
case 7: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
break;
case 8: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
break;
case 9: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
break;
case 10: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);
break;
case 11: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]);
break;
default:
/* FIXME: should go up to 32 arguments */
ERR("Unsupported number of arguments %ld, please report.\n",nrofargs);
ret = 0;
break;
}
/* POP nrofargs DWORD arguments and 3 DWORD parameters */
if (!Ex) stack16_pop( (3 + nrofargs) * sizeof(DWORD) );
TRACE("CallProc32W - returns %08lx\n",ret);
HeapFree( GetProcessHeap(), 0, args );
SYSLEVEL_RestoreWin16Lock();
return ret;
}
/**********************************************************************
* CallProc32W (KERNEL.517)
*/
DWORD WINAPI CallProc32W_16()
{
return RELAY_CallProc32W(0);
}
/**********************************************************************
* CallProcEx32W() (KERNEL.518)
*
* C - style linkage to CallProc32W - caller pops stack.
*/
DWORD WINAPI CallProcEx32W_16()
{
return RELAY_CallProc32W(TRUE);
}

View File

@ -27,9 +27,6 @@ DECLARE_DEBUG_CHANNEL(system)
DECLARE_DEBUG_CHANNEL(thunk) DECLARE_DEBUG_CHANNEL(thunk)
extern LONG CALLBACK CallTo16RegisterShort(const CONTEXT86 *context, INT offset);
extern LONG CALLBACK CallTo16RegisterLong(const CONTEXT86 *context, INT offset);
/* List of the 16-bit callback functions. This list is used */ /* List of the 16-bit callback functions. This list is used */
/* by the build program to generate the file if1632/callto16.S */ /* by the build program to generate the file if1632/callto16.S */
@ -47,7 +44,6 @@ extern WORD CALLBACK THUNK_CallTo16_word_www (FARPROC16,WORD,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wwl (FARPROC16,WORD,WORD,LONG); extern WORD CALLBACK THUNK_CallTo16_word_wwl (FARPROC16,WORD,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wlw (FARPROC16,WORD,LONG,WORD); extern WORD CALLBACK THUNK_CallTo16_word_wlw (FARPROC16,WORD,LONG,WORD);
extern LONG CALLBACK THUNK_CallTo16_long_wwl (FARPROC16,WORD,WORD,LONG); extern LONG CALLBACK THUNK_CallTo16_long_wwl (FARPROC16,WORD,WORD,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lll (FARPROC16,LONG,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG); extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lwll (FARPROC16,LONG,WORD,LONG,LONG); extern WORD CALLBACK THUNK_CallTo16_word_lwll (FARPROC16,LONG,WORD,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lwww (FARPROC16,LONG,WORD,WORD,WORD); extern WORD CALLBACK THUNK_CallTo16_word_lwww (FARPROC16,LONG,WORD,WORD,WORD);
@ -56,7 +52,6 @@ extern WORD CALLBACK THUNK_CallTo16_word_wwll (FARPROC16,WORD,WORD,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wwwl (FARPROC16,WORD,WORD,WORD,LONG); extern WORD CALLBACK THUNK_CallTo16_word_wwwl (FARPROC16,WORD,WORD,WORD,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_wwwl (FARPROC16,WORD,WORD,WORD,LONG); extern LONG CALLBACK THUNK_CallTo16_long_wwwl (FARPROC16,WORD,WORD,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_llll (FARPROC16,LONG,LONG,LONG,LONG); extern WORD CALLBACK THUNK_CallTo16_word_llll (FARPROC16,LONG,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llll (FARPROC16,LONG,LONG,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wllwl(FARPROC16,WORD,LONG,LONG,WORD,LONG); extern WORD CALLBACK THUNK_CallTo16_word_wllwl(FARPROC16,WORD,LONG,LONG,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lwwww(FARPROC16,LONG,WORD,WORD,WORD,WORD); extern WORD CALLBACK THUNK_CallTo16_word_lwwww(FARPROC16,LONG,WORD,WORD,WORD,WORD);
extern LONG CALLBACK THUNK_CallTo16_long_lwwll(FARPROC16,LONG,WORD,WORD,LONG,LONG); extern LONG CALLBACK THUNK_CallTo16_long_lwwll(FARPROC16,LONG,WORD,WORD,LONG,LONG);
@ -64,46 +59,16 @@ extern WORD CALLBACK THUNK_CallTo16_word_wwlll(FARPROC16,WORD,WORD,LONG,LONG,LON
extern WORD CALLBACK THUNK_CallTo16_word_wwwww(FARPROC16,WORD,WORD,WORD,WORD,WORD); extern WORD CALLBACK THUNK_CallTo16_word_wwwww(FARPROC16,WORD,WORD,WORD,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG); extern WORD CALLBACK THUNK_CallTo16_word_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG); extern LONG CALLBACK THUNK_CallTo16_long_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lllll(FARPROC16,LONG,LONG,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllll(FARPROC16,LONG,LONG,LONG,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lllllll(FARPROC16,LONG,LONG,LONG,LONG,LONG,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_llwwlll(FARPROC16,LONG,LONG,WORD,WORD,LONG,LONG,LONG); extern WORD CALLBACK THUNK_CallTo16_word_llwwlll(FARPROC16,LONG,LONG,WORD,WORD,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_word_lwwlllll(FARPROC16,LONG,WORD,WORD,LONG,LONG, extern LONG CALLBACK THUNK_CallTo16_word_lwwlllll(FARPROC16,LONG,WORD,WORD,LONG,LONG,
LONG,LONG,LONG); LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllllll(FARPROC16,LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lllllllll(FARPROC16,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllllllll(FARPROC16,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lllllllllll(FARPROC16,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,LONG,
LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllllllllll(FARPROC16,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,LONG,
LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lwwllwlllllw(FARPROC16,LONG,WORD,WORD,LONG, extern LONG CALLBACK THUNK_CallTo16_long_lwwllwlllllw(FARPROC16,LONG,WORD,WORD,LONG,
LONG,WORD,LONG,LONG,LONG,LONG, LONG,WORD,LONG,LONG,LONG,LONG,
LONG,WORD); LONG,WORD);
extern LONG CALLBACK THUNK_CallTo16_long_lllllllllllll(FARPROC16,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllllllllllll(FARPROC16,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG);
extern LONG CALLBACK THUNK_CallTo16_word_lwwwwlwwwwllll(FARPROC16,LONG,WORD,WORD, extern LONG CALLBACK THUNK_CallTo16_word_lwwwwlwwwwllll(FARPROC16,LONG,WORD,WORD,
WORD,WORD,LONG,WORD,WORD, WORD,WORD,LONG,WORD,WORD,
WORD,WORD,LONG,LONG,LONG, WORD,WORD,LONG,LONG,LONG,
LONG); LONG);
extern LONG CALLBACK THUNK_CallTo16_long_lllllllllllllll(FARPROC16,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_llllllllllllllll(FARPROC16,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG,LONG,LONG,
LONG,LONG,LONG);
/* ### stop build ### */ /* ### stop build ### */
@ -136,8 +101,6 @@ typedef struct tagTHUNK
static THUNK *firstThunk = NULL; static THUNK *firstThunk = NULL;
static BOOL WINAPI THUNK_WOWCallback16Ex( FARPROC16,DWORD,DWORD,
LPVOID,LPDWORD );
static BOOL THUNK_ThunkletInit( void ); static BOOL THUNK_ThunkletInit( void );
/* Callbacks function table for the emulator */ /* Callbacks function table for the emulator */
@ -154,8 +117,6 @@ static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
(void *)THUNK_CallTo16_word_www, /* CallLoadAppSegProc */ (void *)THUNK_CallTo16_word_www, /* CallLoadAppSegProc */
(void *)THUNK_CallTo16_word_www, /* CallLocalNotifyFunc */ (void *)THUNK_CallTo16_word_www, /* CallLocalNotifyFunc */
(void *)THUNK_CallTo16_word_www, /* CallResourceHandlerProc */ (void *)THUNK_CallTo16_word_www, /* CallResourceHandlerProc */
(void *)THUNK_CallTo16_long_l, /* CallWOWCallbackProc */
THUNK_WOWCallback16Ex, /* CallWOWCallback16Ex */
(void *)THUNK_CallTo16_long_ll, /* CallUTProc */ (void *)THUNK_CallTo16_long_ll, /* CallUTProc */
(void *)THUNK_CallTo16_long_l, /* CallASPIPostProc */ (void *)THUNK_CallTo16_long_l, /* CallASPIPostProc */
(void *)THUNK_CallTo16_word_lwll, /* CallDrvControlProc */ (void *)THUNK_CallTo16_word_lwll, /* CallDrvControlProc */
@ -514,105 +475,6 @@ HANDLE WINAPI THUNK_CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
return CreateThread( sa, stack, THUNK_StartThread16, threadArgs, flags, id ); return CreateThread( sa, stack, THUNK_StartThread16, threadArgs, flags, id );
} }
/***********************************************************************
* THUNK_WOWCallback16Ex (WOW32.3)(KERNEL32.55)
* Generic thunking routine to call 16 bit functions from 32bit code.
*
* RETURNS
* TRUE if the call was done
*/
static BOOL WINAPI THUNK_WOWCallback16Ex(
FARPROC16 proc, /* [in] 16bit function to call */
DWORD dwFlags, /* [in] flags (WCB_*) */
DWORD cbArgs, /* [in] number of arguments */
LPVOID xargs, /* [in/out] arguments */
LPDWORD pdwret /* [out] return value of the 16bit call */
) {
LPDWORD args = (LPDWORD)xargs;
DWORD ret,i;
TRACE_(relay)("(%p,0x%08lx,%ld,%p,%p)\n",
proc,dwFlags,cbArgs,xargs,pdwret
);
if (dwFlags == WCB16_CDECL) {
/* swap the arguments */
args = HeapAlloc(GetProcessHeap(),0,cbArgs*sizeof(DWORD));
for (i=0;i<cbArgs;i++)
args[i] = ((DWORD*)xargs)[cbArgs-i-1];
}
switch (cbArgs) {
case 0: ret = THUNK_CallTo16_long_(proc);break;
case 1: ret = THUNK_CallTo16_long_l(proc,args[0]);break;
case 2: ret = THUNK_CallTo16_long_ll(proc,args[0],args[1]);break;
case 3: ret = THUNK_CallTo16_long_lll(proc,args[0],args[1],args[2]);break;
case 4: ret = THUNK_CallTo16_long_llll(proc,args[0],args[1],args[2],args[3]);
break;
case 5: ret = THUNK_CallTo16_long_lllll(proc,args[0],args[1],args[2],args[3],
args[4]
);
break;
case 6: ret = THUNK_CallTo16_long_llllll(proc,args[0],args[1],args[2],args[3],
args[4],args[5]
);
break;
case 7: ret = THUNK_CallTo16_long_lllllll(proc,args[0],args[1],args[2],args[3],
args[4],args[5],args[6]
);
break;
case 8: ret = THUNK_CallTo16_long_llllllll(proc,args[0],args[1],args[2],args[3],
args[4],args[5],args[6],args[7]
);
break;
case 9: ret = THUNK_CallTo16_long_lllllllll(proc,args[0],args[1],args[2],args[3],
args[4],args[5],args[6],args[7],args[8]
);
break;
case 10:ret = THUNK_CallTo16_long_llllllllll(proc,args[0],args[1],args[2],args[3],
args[4],args[5],args[6],args[7],args[8],args[9]
);
break;
case 11:ret = THUNK_CallTo16_long_lllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]
);
break;
case 12:ret = THUNK_CallTo16_long_llllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],
args[10],args[11]
);
break;
case 13:ret = THUNK_CallTo16_long_lllllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],
args[10],args[11],args[12]
);
break;
case 14:ret = THUNK_CallTo16_long_llllllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],
args[10],args[11],args[12],args[13]
);
break;
case 15:ret = THUNK_CallTo16_long_lllllllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],
args[10],args[11],args[12],args[13],args[14]
);
break;
case 16:ret = THUNK_CallTo16_long_llllllllllllllll(proc,args[0],args[1],args[2],
args[3],args[4],args[5],args[6],args[7],args[8],args[9],
args[10],args[11],args[12],args[13],args[14],args[15]
);
break;
default:
ERR_(thunk)("%ld arguments not supported.\n",cbArgs);
if (dwFlags == WCB16_CDECL)
HeapFree(GetProcessHeap(),0,args);
return FALSE;
}
if (dwFlags == WCB16_CDECL)
HeapFree(GetProcessHeap(),0,args);
if (pdwret)
*pdwret = ret;
return TRUE;
}
/*********************************************************************** /***********************************************************************
* THUNK_MOUSE_Enable (MOUSE.2) * THUNK_MOUSE_Enable (MOUSE.2)
*/ */
@ -1084,24 +946,6 @@ void WINAPI C16ThkSL01(CONTEXT86 *context)
} }
} }
DWORD WINAPI
WOW16Call(WORD x,WORD y,WORD z) {
int i;
DWORD calladdr;
VA_LIST16 args;
FIXME_(thunk)("(0x%04x,0x%04x,%d),calling (",x,y,z);
VA_START16(args);
for (i=0;i<x/2;i++) {
WORD a = VA_ARG16(args,WORD);
DPRINTF("%04x ",a);
}
calladdr = VA_ARG16(args,DWORD);
VA_END16(args);
stack16_pop( x + sizeof(DWORD) );
DPRINTF(") calling address was 0x%08lx\n",calladdr);
return 0;
}
/*********************************************************************** /***********************************************************************

View File

@ -35,9 +35,6 @@ typedef struct
WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD ); WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
WORD (CALLBACK *CallLocalNotifyFunc)( FARPROC16, WORD, HLOCAL16, WORD ); WORD (CALLBACK *CallLocalNotifyFunc)( FARPROC16, WORD, HLOCAL16, WORD );
HGLOBAL16 (CALLBACK *CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 ); HGLOBAL16 (CALLBACK *CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 );
DWORD (CALLBACK *CallWOWCallbackProc)( FARPROC16, DWORD );
BOOL (CALLBACK *CallWOWCallback16Ex)( FARPROC16, DWORD, DWORD, LPVOID,
LPDWORD );
DWORD (CALLBACK *CallUTProc)( FARPROC16, DWORD, DWORD ); DWORD (CALLBACK *CallUTProc)( FARPROC16, DWORD, DWORD );
LRESULT (CALLBACK *CallASPIPostProc)( FARPROC16, SEGPTR ); LRESULT (CALLBACK *CallASPIPostProc)( FARPROC16, SEGPTR );
/* Following are the graphics driver callbacks */ /* Following are the graphics driver callbacks */

View File

@ -863,30 +863,6 @@ typedef struct _LDT_ENTRY {
} HighWord; } HighWord;
} LDT_ENTRY, *LPLDT_ENTRY; } LDT_ENTRY, *LPLDT_ENTRY;
/* for WOWHandle{16,32} */
typedef enum _WOW_HANDLE_TYPE { /* WOW */
WOW_TYPE_HWND,
WOW_TYPE_HMENU,
WOW_TYPE_HDWP,
WOW_TYPE_HDROP,
WOW_TYPE_HDC,
WOW_TYPE_HFONT,
WOW_TYPE_HMETAFILE,
WOW_TYPE_HRGN,
WOW_TYPE_HBITMAP,
WOW_TYPE_HBRUSH,
WOW_TYPE_HPALETTE,
WOW_TYPE_HPEN,
WOW_TYPE_HACCEL,
WOW_TYPE_HTASK,
WOW_TYPE_FULLHWND
} WOW_HANDLE_TYPE;
/* WOWCallback16Ex defines */
#define WCB16_MAX_CBARGS 16
/* ... dwFlags */
#define WCB16_PASCAL 0x0
#define WCB16_CDECL 0x1
typedef enum _GET_FILEEX_INFO_LEVELS { typedef enum _GET_FILEEX_INFO_LEVELS {
GetFileExInfoStandard GetFileExInfoStandard
@ -1534,10 +1510,6 @@ DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,BOOL,DWORD);
DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL); DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL);
DWORD WINAPI WaitForSingleObject(HANDLE,DWORD); DWORD WINAPI WaitForSingleObject(HANDLE,DWORD);
DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL); DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL);
SEGPTR WINAPI WOWGlobalAllocLock16(DWORD,DWORD,HGLOBAL16*);
DWORD WINAPI WOWCallback16(FARPROC16,DWORD);
BOOL WINAPI WOWCallback16Ex(FARPROC16,DWORD,DWORD,LPVOID,LPDWORD);
HANDLE WINAPI WOWHandle32(WORD,WOW_HANDLE_TYPE);
BOOL WINAPI WriteConsoleA(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID); BOOL WINAPI WriteConsoleA(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
BOOL WINAPI WriteConsoleW(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID); BOOL WINAPI WriteConsoleW(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
#define WriteConsole WINELIB_NAME_AW(WriteConsole) #define WriteConsole WINELIB_NAME_AW(WriteConsole)

View File

@ -89,7 +89,6 @@ WORD WINAPI LocalCountFree16(void);
WORD WINAPI LocalHandleDelta16(WORD); WORD WINAPI LocalHandleDelta16(WORD);
WORD WINAPI LocalHeapSize16(void); WORD WINAPI LocalHeapSize16(void);
BOOL16 WINAPI LocalInit16(HANDLE16,WORD,WORD); BOOL16 WINAPI LocalInit16(HANDLE16,WORD,WORD);
HMODULE WINAPI LoadLibraryEx32W16(LPCSTR,HANDLE16,DWORD);
FARPROC16 WINAPI LocalNotify16(FARPROC16); FARPROC16 WINAPI LocalNotify16(FARPROC16);
HTASK16 WINAPI LockCurrentTask16(BOOL16); HTASK16 WINAPI LockCurrentTask16(BOOL16);
VOID WINAPI OldYield16(void); VOID WINAPI OldYield16(void);

110
include/wownt32.h Normal file
View File

@ -0,0 +1,110 @@
/*
* WOW Generic Thunk API
*/
#ifndef _WOWNT32_H_
#define _WOWNT32_H_
LPVOID WINAPI WOWGetVDMPointer(DWORD,DWORD,BOOL);
LPVOID WINAPI WOWGetVDMPointerFix(DWORD,DWORD,BOOL);
VOID WINAPI WOWGetVDMPointerUnfix(DWORD);
WORD WINAPI WOWGlobalAlloc16(WORD,DWORD);
WORD WINAPI WOWGlobalFree16(WORD);
DWORD WINAPI WOWGlobalLock16(WORD);
BOOL WINAPI WOWGlobalUnlock16(WORD);
DWORD WINAPI WOWGlobalAllocLock16(WORD,DWORD,WORD *);
WORD WINAPI WOWGlobalUnlockFree16(DWORD);
DWORD WINAPI WOWGlobalLockSize16(WORD,PDWORD);
VOID WINAPI WOWYield16(VOID);
VOID WINAPI WOWDirectedYield16(WORD);
typedef enum
{
WOW_TYPE_HWND,
WOW_TYPE_HMENU,
WOW_TYPE_HDWP,
WOW_TYPE_HDROP,
WOW_TYPE_HDC,
WOW_TYPE_HFONT,
WOW_TYPE_HMETAFILE,
WOW_TYPE_HRGN,
WOW_TYPE_HBITMAP,
WOW_TYPE_HBRUSH,
WOW_TYPE_HPALETTE,
WOW_TYPE_HPEN,
WOW_TYPE_HACCEL,
WOW_TYPE_HTASK,
WOW_TYPE_FULLHWND
} WOW_HANDLE_TYPE;
HANDLE WINAPI WOWHandle32(WORD,WOW_HANDLE_TYPE);
WORD WINAPI WOWHandle16(HANDLE,WOW_HANDLE_TYPE);
#define HWND_32(h16) ((HWND) (WOWHandle32(h16, WOW_TYPE_HWND)))
#define HMENU_32(h16) ((HMENU) (WOWHandle32(h16, WOW_TYPE_HMENU)))
#define HDWP_32(h16) ((HDWP) (WOWHandle32(h16, WOW_TYPE_HDWP)))
#define HDROP_32(h16) ((HDROP) (WOWHandle32(h16, WOW_TYPE_HDROP)))
#define HDC_32(h16) ((HDC) (WOWHandle32(h16, WOW_TYPE_HDC)))
#define HFONT_32(h16) ((HFONT) (WOWHandle32(h16, WOW_TYPE_HFONT)))
#define HMETAFILE_32(h16) ((HMETAFILE) (WOWHandle32(h16, WOW_TYPE_HMETAFILE)))
#define HRGN_32(h16) ((HRGN) (WOWHandle32(h16, WOW_TYPE_HRGN)))
#define HBITMAP_32(h16) ((HBITMAP) (WOWHandle32(h16, WOW_TYPE_HBITMAP)))
#define HBRUSH_32(h16) ((HBRUSH) (WOWHandle32(h16, WOW_TYPE_HBRUSH)))
#define HPALETTE_32(h16) ((HPALETTE) (WOWHandle32(h16, WOW_TYPE_HPALETTE)))
#define HPEN_32(h16) ((HPEN) (WOWHandle32(h16, WOW_TYPE_HPEN)))
#define HACCEL_32(h16) ((HACCEL) (WOWHandle32(h16, WOW_TYPE_HACCEL)))
#define HTASK_32(h16) ((DWORD) (WOWHandle32(h16, WOW_TYPE_HTASK)))
#define FULLHWND_32(h16) ((HWND) (WOWHandle32(h16, WOW_TYPE_FULLHWND)))
#define HWND_16(h32) (WOWHandle16(h32, WOW_TYPE_HWND))
#define HMENU_16(h32) (WOWHandle16(h32, WOW_TYPE_HMENU))
#define HDWP_16(h32) (WOWHandle16(h32, WOW_TYPE_HDWP))
#define HDROP_16(h32) (WOWHandle16(h32, WOW_TYPE_HDROP))
#define HDC_16(h32) (WOWHandle16(h32, WOW_TYPE_HDC))
#define HFONT_16(h32) (WOWHandle16(h32, WOW_TYPE_HFONT))
#define HMETAFILE_16(h32) (WOWHandle16(h32, WOW_TYPE_HMETAFILE))
#define HRGN_16(h32) (WOWHandle16(h32, WOW_TYPE_HRGN))
#define HBITMAP_16(h32) (WOWHandle16(h32, WOW_TYPE_HBITMAP))
#define HBRUSH_16(h32) (WOWHandle16(h32, WOW_TYPE_HBRUSH))
#define HPALETTE_16(h32) (WOWHandle16(h32, WOW_TYPE_HPALETTE))
#define HPEN_16(h32) (WOWHandle16(h32, WOW_TYPE_HPEN))
#define HACCEL_16(h32) (WOWHandle16(h32, WOW_TYPE_HACCEL))
#define HTASK_16(h32) (WOWHandle16(h32, WOW_TYPE_HTASK))
#define WCB16_PASCAL 0
#define WCB16_CDECL 1
#define WCB16_MAX_CBARGS 16
DWORD WINAPI WOWCallback16(DWORD,DWORD);
BOOL WINAPI WOWCallback16Ex(DWORD,DWORD,DWORD,LPVOID,LPDWORD);
#ifdef __WINE__
/*
* These are the 16-bit side WOW routines. They reside in wownt16.h
* in the SDK; since we don't support Win16 source code anyway, I've
* placed them here for compilation with Wine ...
*/
DWORD WINAPI GetVDMPointer32W16(SEGPTR,UINT16);
DWORD WINAPI LoadLibraryEx32W16(LPCSTR,DWORD,DWORD);
DWORD WINAPI GetProcAddress32W16(DWORD,LPCSTR);
DWORD WINAPI FreeLibrary32W16(DWORD);
#define CPEX_DEST_STDCALL 0x00000000L
#define CPEX_DEST_CDECL 0x80000000L
DWORD WINAPI CallProcExW16(VOID);
DWORD WINAPI CallProcEx32W16(VOID);
#endif /* __WINE__ */
#endif /* _WOWNT32_H_ */

View File

@ -1363,29 +1363,6 @@ DWORD WINAPI GetModuleFileNameW( HMODULE hModule, LPWSTR lpFileName,
} }
/***********************************************************************
* LoadLibraryEx32W (KERNEL.513)
*/
HMODULE WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf,
DWORD flags )
{
HMODULE hModule;
SYSLEVEL_ReleaseWin16Lock();
hModule = LoadLibraryExA( libname, hf, flags );
SYSLEVEL_RestoreWin16Lock();
return hModule;
}
/***********************************************************************
* LoadLibrary32_16 (KERNEL.452)
*/
HMODULE WINAPI LoadLibrary32_16( LPCSTR libname )
{
return LoadLibraryEx32W16( libname, 0, 0 );
}
/*********************************************************************** /***********************************************************************
* LoadLibraryExA (KERNEL32) * LoadLibraryExA (KERNEL32)
*/ */
@ -1523,6 +1500,20 @@ HMODULE WINAPI LoadLibraryW(LPCWSTR libnameW)
return LoadLibraryExW(libnameW,0,0); return LoadLibraryExW(libnameW,0,0);
} }
/***********************************************************************
* LoadLibrary32_16 (KERNEL.452)
*/
HMODULE WINAPI LoadLibrary32_16( LPCSTR libname )
{
HMODULE hModule;
SYSLEVEL_ReleaseWin16Lock();
hModule = LoadLibraryA( libname );
SYSLEVEL_RestoreWin16Lock();
return hModule;
}
/*********************************************************************** /***********************************************************************
* LoadLibraryExW (KERNEL32) * LoadLibraryExW (KERNEL32)
*/ */

View File

@ -1494,33 +1494,6 @@ VOID WINAPI GlobalMemoryStatus(
lpmem->dwAvailVirtual = 32*1024*1024; lpmem->dwAvailVirtual = 32*1024*1024;
} }
/**********************************************************************
* WOWGlobalAllocLock (KERNEL32.62)
*
* Combined GlobalAlloc and GlobalLock.
*/
SEGPTR WINAPI WOWGlobalAllocLock16(DWORD flags,DWORD cb,HGLOBAL16 *hmem)
{
HGLOBAL16 xhmem;
xhmem = GlobalAlloc16(flags,cb);
if (hmem) *hmem = xhmem;
return WIN16_GlobalLock16(xhmem);
}
/**********************************************************************
* WOWGlobalUnlockFree (KERNEL32.64)
*
* Combined GlobalUnlock and GlobalFree.
*/
WORD WINAPI WOWGlobalUnlockFree16(DWORD vpmem) {
if (!GlobalUnlock16(HIWORD(vpmem)))
return 0;
return GlobalFree16(HIWORD(vpmem));
}
/*********************************************************************** /***********************************************************************
* A20Proc16 (KERNEL.165) * A20Proc16 (KERNEL.165)
*/ */

View File

@ -770,44 +770,6 @@ void WINAPI REGS_FUNC(FreeMappedBuffer)( CONTEXT *context )
#endif #endif
} }
/**********************************************************************
* WOWGetVDMPointer (KERNEL32.55)
* Get linear from segmented pointer. (MSDN lib)
*/
LPVOID WINAPI WOWGetVDMPointer(DWORD vp,DWORD nrofbytes,BOOL protected)
{
/* FIXME: add size check too */
if (protected)
return PTR_SEG_TO_LIN(vp);
else
return DOSMEM_MapRealToLinear(vp);
}
/**********************************************************************
* GetVDMPointer32W (KERNEL.516)
*/
LPVOID WINAPI GetVDMPointer32W(DWORD vp,WORD mode)
{
return WOWGetVDMPointer(vp,0,(DWORD)mode);
}
/**********************************************************************
* WOWGetVDMPointerFix (KERNEL32.55)
* Dito, but fix heapsegment (MSDN lib)
*/
LPVOID WINAPI WOWGetVDMPointerFix(DWORD vp,DWORD nrofbytes,BOOL protected)
{
/* FIXME: fix heapsegment */
return WOWGetVDMPointer(vp,nrofbytes,protected);
}
/**********************************************************************
* WOWGetVDMPointerUnFix (KERNEL32.56)
*/
void WINAPI WOWGetVDMPointerUnfix(DWORD vp)
{
/* FIXME: unfix heapsegment */
}
/*********************************************************************** /***********************************************************************
* UTSelectorOffsetToLinear (WIN32S16.48) * UTSelectorOffsetToLinear (WIN32S16.48)

View File

@ -32,7 +32,8 @@ C_SRCS = \
builtin32.c \ builtin32.c \
relay386.c \ relay386.c \
snoop.c \ snoop.c \
utthunk.c utthunk.c \
wowthunk.c
GEN_ASM_SRCS = \ GEN_ASM_SRCS = \
call32.s call32.s

View File

@ -72,16 +72,16 @@ import ntdll.dll
55 stdcall K32WOWCallback16Ex(ptr long long ptr ptr) WOWCallback16Ex 55 stdcall K32WOWCallback16Ex(ptr long long ptr ptr) WOWCallback16Ex
56 stdcall K32WOWGetVDMPointer(long long long) WOWGetVDMPointer 56 stdcall K32WOWGetVDMPointer(long long long) WOWGetVDMPointer
57 stdcall K32WOWHandle32(long long) WOWHandle32 57 stdcall K32WOWHandle32(long long) WOWHandle32
58 stub K32WOWHandle16 58 stdcall K32WOWHandle16(long long) WOWHandle16
59 stdcall K32WOWGlobalAlloc16(long long) GlobalAlloc16 59 stdcall K32WOWGlobalAlloc16(long long) WOWGlobalAlloc16
60 stdcall K32WOWGlobalLock16(long) WIN16_GlobalLock16 60 stdcall K32WOWGlobalLock16(long) WOWGlobalLock16
61 stdcall K32WOWGlobalUnlock16(long) GlobalUnlock16 61 stdcall K32WOWGlobalUnlock16(long) WOWGlobalUnlock16
62 stdcall K32WOWGlobalFree16(long) GlobalFree16 62 stdcall K32WOWGlobalFree16(long) WOWGlobalFree16
63 stdcall K32WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16 63 stdcall K32WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16
64 stdcall K32WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16 64 stdcall K32WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16
65 stub K32WOWGlobalLockSize16 65 stdcall K32WOWGlobalLockSize16(long ptr) WOWGlobalLockSize16
66 stub K32WOWYield16 66 stdcall K32WOWYield16() WOWYield16
67 stub K32WOWDirectedYield16 67 stdcall K32WOWDirectedYield16(long) WOWDirectedYield16
68 stdcall K32WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix 68 stdcall K32WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix
69 stdcall K32WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix 69 stdcall K32WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix
70 stdcall K32WOWGetDescriptor(long long) WOWGetDescriptor 70 stdcall K32WOWGetDescriptor(long long) WOWGetDescriptor

View File

@ -4,17 +4,17 @@ type win32
1 stdcall WOWGetDescriptor(long long) WOWGetDescriptor 1 stdcall WOWGetDescriptor(long long) WOWGetDescriptor
2 stdcall WOWCallback16(long long) WOWCallback16 2 stdcall WOWCallback16(long long) WOWCallback16
3 stdcall WOWCallback16Ex(ptr long long ptr ptr) WOWCallback16Ex 3 stdcall WOWCallback16Ex(ptr long long ptr ptr) WOWCallback16Ex
4 stub WOWDirectedYield16 4 stdcall WOWDirectedYield16(long) WOWDirectedYield16
5 stdcall WOWGetVDMPointer(long long long) WOWGetVDMPointer 5 stdcall WOWGetVDMPointer(long long long) WOWGetVDMPointer
6 stdcall WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix 6 stdcall WOWGetVDMPointerFix(long long long) WOWGetVDMPointerFix
7 stdcall WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix 7 stdcall WOWGetVDMPointerUnfix(long) WOWGetVDMPointerUnfix
8 stub WOWGlobalAlloc16 8 stdcall WOWGlobalAlloc16(long long) WOWGlobalAlloc16
9 stdcall WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16 9 stdcall WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16
10 stub WOWGlobalFree16 10 stdcall WOWGlobalFree16(long) WOWGlobalFree16
11 stub WOWGlobalLock16 11 stdcall WOWGlobalLock16(long) WOWGlobalLock16
12 stub WOWGlobalLockSize16 12 stdcall WOWGlobalLockSize16(long ptr) WOWGlobalLockSize16
13 stub WOWGlobalUnlock16 13 stdcall WOWGlobalUnlock16(long) WOWGlobalUnlock16
14 stdcall WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16 14 stdcall WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16
15 stub WOWHandle16 15 stdcall WOWHandle16(long long) WOWHandle16
16 stdcall WOWHandle32(long long) WOWHandle32 16 stdcall WOWHandle32(long long) WOWHandle32
17 stub WOWYield16 17 stdcall WOWYield16() WOWYield16

469
relay32/wowthunk.c Normal file
View File

@ -0,0 +1,469 @@
/*
* Win32 WOW Generic Thunk API
*
* Copyright 1999 Ulrich Weigand
*/
#include "wine/winbase16.h"
#include "winbase.h"
#include "wownt32.h"
#include "heap.h"
#include "miscemu.h"
#include "syslevel.h"
#include "stackframe.h"
#include "builtin16.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(thunk)
/*
* 32-bit WOW routines (in WOW32, but actually forwarded to KERNEL32)
*/
/**********************************************************************
* WOWGetDescriptor (WOW32.1) (KERNEL32.70)
*/
BOOL WINAPI WOWGetDescriptor( SEGPTR segptr, LPLDT_ENTRY ldtent )
{
return GetThreadSelectorEntry( GetCurrentThreadId(),
segptr >> 16, ldtent );
}
/**********************************************************************
* WOWGetVDMPointer (WOW32.5) (KERNEL32.56)
*/
LPVOID WINAPI WOWGetVDMPointer( DWORD vp, DWORD dwBytes, BOOL fProtectedMode )
{
/* FIXME: add size check too */
if ( fProtectedMode )
return PTR_SEG_TO_LIN( vp );
else
return DOSMEM_MapRealToLinear( vp );
}
/**********************************************************************
* WOWGetVDMPointerFix (WOW32.6) (KERNEL32.68)
*/
LPVOID WINAPI WOWGetVDMPointerFix( DWORD vp, DWORD dwBytes, BOOL fProtectedMode )
{
/*
* Hmmm. According to the docu, we should call:
*
* GlobalFix16( SELECTOROF(vp) );
*
* But this is unnecessary under Wine, as we never move global
* memory segments in linear memory anyway.
*
* (I'm not so sure what we are *supposed* to do if
* fProtectedMode is TRUE, anyway ...)
*/
return WOWGetVDMPointer( vp, dwBytes, fProtectedMode );
}
/**********************************************************************
* WOWGetVDMPointerUnFix (WOW32.7) (KERNEL32.69)
*/
VOID WINAPI WOWGetVDMPointerUnfix( DWORD vp )
{
/*
* See above why we don't call:
*
* GlobalUnfix16( SELECTOROF(vp) );
*
*/
}
/**********************************************************************
* WOWGlobalAlloc16 (WOW32.8) (KERNEL32.59)
*/
WORD WINAPI WOWGlobalAlloc16( WORD wFlags, DWORD cb )
{
return (WORD)GlobalAlloc16( wFlags, cb );
}
/**********************************************************************
* WOWGlobalFree16 (WOW32.10) (KERNEL32.62)
*/
WORD WINAPI WOWGlobalFree16( WORD hMem )
{
return (WORD)GlobalFree16( (HGLOBAL16)hMem );
}
/**********************************************************************
* WOWGlobalLock16 (WOW32.11) (KERNEL32.60)
*/
DWORD WINAPI WOWGlobalLock16( WORD hMem )
{
return (DWORD)WIN16_GlobalLock16( (HGLOBAL16)hMem );
}
/**********************************************************************
* WOWGlobalUnlock16 (WOW32.13) (KERNEL32.61)
*/
BOOL WINAPI WOWGlobalUnlock16( WORD hMem )
{
return (BOOL)GlobalUnlock16( (HGLOBAL16)hMem );
}
/**********************************************************************
* WOWGlobalAllocLock16 (WOW32.9) (KERNEL32.63)
*/
DWORD WINAPI WOWGlobalAllocLock16( WORD wFlags, DWORD cb, WORD *phMem )
{
WORD hMem = WOWGlobalAlloc16( wFlags, cb );
if (phMem) *phMem = hMem;
return WOWGlobalLock16( hMem );
}
/**********************************************************************
* WOWGlobalLockSize16 (WOW32.12) (KERNEL32.65)
*/
DWORD WINAPI WOWGlobalLockSize16( WORD hMem, PDWORD pcb )
{
if ( pcb )
*pcb = GlobalSize16( (HGLOBAL16)hMem );
return WOWGlobalLock16( hMem );
}
/**********************************************************************
* WOWGlobalUnlockFree16 (WOW32.14) (KERNEL32.64)
*/
WORD WINAPI WOWGlobalUnlockFree16( DWORD vpMem )
{
if ( !WOWGlobalUnlock16( HIWORD(vpMem) ) )
return FALSE;
return WOWGlobalFree16( HIWORD(vpMem) );
}
/**********************************************************************
* WOWYield16 (WOW32.17) (KERNEL32.66)
*/
VOID WINAPI WOWYield16( void )
{
/*
* This does the right thing for both Win16 and Win32 tasks.
* More or less, at least :-/
*/
Yield16();
}
/**********************************************************************
* WOWDirectedYield16 (WOW32.4) (KERNEL32.67)
*/
VOID WINAPI WOWDirectedYield16( WORD htask16 )
{
/*
* Argh. Our scheduler doesn't like DirectedYield by Win32
* tasks at all. So we do hope that this routine is indeed
* only ever called by Win16 tasks that have thunked up ...
*/
DirectedYield16( (HTASK16)htask16 );
}
/***********************************************************************
* WOWHandle32 (WOW32.16) (KERNEL32.57)
*/
HANDLE WINAPI WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
{
switch ( type )
{
case WOW_TYPE_HWND:
case WOW_TYPE_HMENU:
case WOW_TYPE_HDWP:
case WOW_TYPE_HDROP:
case WOW_TYPE_HDC:
case WOW_TYPE_HFONT:
case WOW_TYPE_HMETAFILE:
case WOW_TYPE_HRGN:
case WOW_TYPE_HBITMAP:
case WOW_TYPE_HBRUSH:
case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND:
return (HANDLE)handle;
default:
ERR( "handle 0x%04x of unknown type %d\n", handle, type );
return (HANDLE)handle;
}
}
/***********************************************************************
* WOWHandle16 (WOW32.15) (KERNEL32.58)
*/
WORD WINAPI WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type )
{
if ( HIWORD(handle ) )
ERR( "handle 0x%08x of type %d has non-zero HIWORD\n", handle, type );
switch ( type )
{
case WOW_TYPE_HWND:
case WOW_TYPE_HMENU:
case WOW_TYPE_HDWP:
case WOW_TYPE_HDROP:
case WOW_TYPE_HDC:
case WOW_TYPE_HFONT:
case WOW_TYPE_HMETAFILE:
case WOW_TYPE_HRGN:
case WOW_TYPE_HBITMAP:
case WOW_TYPE_HBRUSH:
case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND:
return LOWORD(handle);
default:
ERR( "handle 0x%08x of unknown type %d\n", handle, type );
return LOWORD(handle);
}
}
/**********************************************************************
* WOWCallback16 (WOW32.2) (KERNEL32.54)
*/
DWORD WINAPI WOWCallback16( DWORD vpfn16, DWORD dwParam )
{
DWORD ret;
if ( !WOWCallback16Ex( vpfn16, WCB16_PASCAL,
sizeof(DWORD), &dwParam, &ret ) )
ret = 0L;
return ret;
}
/**********************************************************************
* WOWCallback16Ex (WOW32.3) (KERNEL32.55)
*/
BOOL WINAPI WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode )
{
DWORD ret;
/*
* Arguments must be prepared in the correct order by the caller
* (both for PASCAL and CDECL calling convention), so we simply
* copy them to the 16-bit stack ...
*/
memcpy( (LPBYTE)CURRENT_STACK16 - cbArgs, (LPBYTE)pArgs, cbArgs );
/*
* Actually, we should take care whether the called routine cleans up
* its stack or not. Fortunately, our CallTo16 core doesn't rely on
* the callee to do so; after the routine has returned, the 16-bit
* stack pointer is always reset to the position it had before.
*/
ret = CallTo16Long( (FARPROC16)vpfn16, cbArgs );
if ( pdwRetCode )
*pdwRetCode = ret;
return TRUE; /* success */
}
/*
* 16-bit WOW routines (in KERNEL)
*/
/**********************************************************************
* GetVDMPointer32W16 (KERNEL.516)
*/
DWORD WINAPI GetVDMPointer32W16( SEGPTR vp, UINT16 fMode )
{
return (DWORD)WOWGetVDMPointer( vp, 0, (DWORD)fMode );
}
/***********************************************************************
* LoadLibraryEx32W16 (KERNEL.513)
*/
DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags )
{
HMODULE hModule;
SYSLEVEL_ReleaseWin16Lock();
hModule = LoadLibraryExA( lpszLibFile, (HANDLE)hFile, dwFlags );
SYSLEVEL_RestoreWin16Lock();
return (DWORD)hModule;
}
/***********************************************************************
* GetProcAddress32W16 (KERNEL.515)
*/
DWORD WINAPI GetProcAddress32W16( DWORD hModule, LPCSTR lpszProc )
{
return (DWORD)GetProcAddress( (HMODULE)hModule, lpszProc );
}
/***********************************************************************
* FreeLibrary32W16 (KERNEL.514)
*/
DWORD WINAPI FreeLibrary32W16( DWORD hLibModule )
{
BOOL retv;
SYSLEVEL_ReleaseWin16Lock();
retv = FreeLibrary( (HMODULE)hLibModule );
SYSLEVEL_RestoreWin16Lock();
return (DWORD)retv;
}
/**********************************************************************
* WOW_CallProc32W
*/
static DWORD WOW_CallProc32W16( BOOL Ex )
{
DWORD nrofargs, argconvmask;
FARPROC proc32;
DWORD *args, ret;
VA_LIST16 valist;
int i;
int aix;
SYSLEVEL_ReleaseWin16Lock();
VA_START16( valist );
nrofargs = VA_ARG16( valist, DWORD );
argconvmask = VA_ARG16( valist, DWORD );
proc32 = VA_ARG16( valist, FARPROC );
TRACE("(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
args = (DWORD*)HEAP_xalloc( GetProcessHeap(), 0,
sizeof(DWORD)*nrofargs );
/* CallProcEx doesn't need its args reversed */
for (i=0;i<nrofargs;i++) {
if (Ex) {
aix = i;
} else {
aix = nrofargs - i - 1;
}
if (argconvmask & (1<<i))
{
SEGPTR ptr = VA_ARG16( valist, SEGPTR );
args[aix] = (DWORD)PTR_SEG_TO_LIN(ptr);
if (TRACE_ON(thunk)) DPRINTF("%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
}
else
{
args[aix] = VA_ARG16( valist, DWORD );
if (TRACE_ON(thunk)) DPRINTF("%ld,",args[aix]);
}
}
if (TRACE_ON(thunk)) DPRINTF("])\n");
VA_END16( valist );
/*
* FIXME: If ( nrofargs & CPEX_DEST_CDECL ) != 0, we should call a
* 32-bit CDECL routine ...
*/
if (!proc32) ret = 0;
else switch (nrofargs)
{
case 0: ret = proc32();
break;
case 1: ret = proc32(args[0]);
break;
case 2: ret = proc32(args[0],args[1]);
break;
case 3: ret = proc32(args[0],args[1],args[2]);
break;
case 4: ret = proc32(args[0],args[1],args[2],args[3]);
break;
case 5: ret = proc32(args[0],args[1],args[2],args[3],args[4]);
break;
case 6: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5]);
break;
case 7: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
break;
case 8: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
break;
case 9: ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
break;
case 10:ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);
break;
case 11:ret = proc32(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]);
break;
default:
/* FIXME: should go up to 32 arguments */
ERR("Unsupported number of arguments %ld, please report.\n",nrofargs);
ret = 0;
break;
}
/* POP nrofargs DWORD arguments and 3 DWORD parameters */
if (!Ex) stack16_pop( (3 + nrofargs) * sizeof(DWORD) );
TRACE("returns %08lx\n",ret);
HeapFree( GetProcessHeap(), 0, args );
SYSLEVEL_RestoreWin16Lock();
return ret;
}
/**********************************************************************
* CallProc32W16 (KERNEL.517)
*
* DWORD PASCAL CallProc32W( DWORD p1, ... , DWORD lpProcAddress,
* DWORD fAddressConvert, DWORD cParams );
*/
DWORD WINAPI CallProc32W16( void )
{
return WOW_CallProc32W16( FALSE );
}
/**********************************************************************
* CallProcEx32W16 (KERNEL.518)
*
* DWORD CallProcEx32W( DWORD cParams, DWORD fAddressConvert,
* DWORD lpProcAddress, DWORD p1, ... );
*/
DWORD WINAPI CallProcEx32W16( void )
{
return WOW_CallProc32W16( TRUE );
}
/**********************************************************************
* WOW16Call (KERNEL.501)
*
* FIXME!!!
*
*/
DWORD WINAPI WOW16Call(WORD x,WORD y,WORD z)
{
int i;
DWORD calladdr;
VA_LIST16 args;
FIXME("(0x%04x,0x%04x,%d),calling (",x,y,z);
VA_START16(args);
for (i=0;i<x/2;i++) {
WORD a = VA_ARG16(args,WORD);
DPRINTF("%04x ",a);
}
calladdr = VA_ARG16(args,DWORD);
VA_END16(args);
stack16_pop( x + sizeof(DWORD) );
DPRINTF(") calling address was 0x%08lx\n",calladdr);
return 0;
}

View File

@ -495,39 +495,6 @@ void WINAPI REGS_FUNC(FT_Exit52)(CONTEXT *context) { FT_Exit(context, 52); }
void WINAPI REGS_FUNC(FT_Exit56)(CONTEXT *context) { FT_Exit(context, 56); } void WINAPI REGS_FUNC(FT_Exit56)(CONTEXT *context) { FT_Exit(context, 56); }
/**********************************************************************
* WOWCallback16 (KERNEL32.62)(WOW32.2)
* Calls a win16 function with a single DWORD argument.
* RETURNS
* the return value
*/
DWORD WINAPI WOWCallback16(
FARPROC16 fproc, /* [in] win16 function to call */
DWORD arg /* [in] single DWORD argument to function */
) {
DWORD ret;
TRACE_(thunk)("(%p,0x%08lx)...\n",fproc,arg);
ret = Callbacks->CallWOWCallbackProc(fproc,arg);
TRACE_(thunk)("... returns %ld\n",ret);
return ret;
}
/**********************************************************************
* WOWCallback16Ex (KERNEL32.55)(WOW32.3)
* Calls a function in 16bit code.
* RETURNS
* TRUE for success
*/
BOOL WINAPI WOWCallback16Ex(
FARPROC16 vpfn16, /* [in] win16 function to call */
DWORD dwFlags, /* [in] flags */
DWORD cbArgs, /* [in] nr of arguments */
LPVOID pArgs, /* [in] pointer to arguments (LPDWORD) */
LPDWORD pdwRetCode /* [out] return value of win16 function */
) {
return Callbacks->CallWOWCallback16Ex(vpfn16,dwFlags,cbArgs,pArgs,pdwRetCode);
}
/*********************************************************************** /***********************************************************************
* ThunkInitLS (KERNEL32.43) * ThunkInitLS (KERNEL32.43)
* A thunkbuffer link routine * A thunkbuffer link routine
@ -1064,21 +1031,6 @@ BOOL16 WINAPI IsPeFormat16(
return (xmagic == IMAGE_NT_SIGNATURE); return (xmagic == IMAGE_NT_SIGNATURE);
} }
/***********************************************************************
* WOWHandle32 (KERNEL32.57)(WOW32.16)
* Converts a win16 handle of type into the respective win32 handle.
* We currently just return this handle, since most handles are the same
* for win16 and win32.
* RETURNS
* The new handle
*/
HANDLE WINAPI WOWHandle32(
WORD handle, /* [in] win16 handle */
WOW_HANDLE_TYPE type /* [in] handle type */
) {
TRACE_(win32)("(0x%04x,%d)\n",handle,type);
return (HANDLE)handle;
}
/*********************************************************************** /***********************************************************************
* K32Thk1632Prolog (KERNEL32.492) * K32Thk1632Prolog (KERNEL32.492)

View File

@ -22,13 +22,6 @@ DECLARE_DEBUG_CHANNEL(thread)
DECLARE_DEBUG_CHANNEL(win) DECLARE_DEBUG_CHANNEL(win)
DECLARE_DEBUG_CHANNEL(win32) DECLARE_DEBUG_CHANNEL(win32)
/**********************************************************************
* WOWGetDescriptor (KERNEL32.88) (WOW32.1)
*/
BOOL WINAPI WOWGetDescriptor(SEGPTR segptr,LPLDT_ENTRY ldtent)
{
return GetThreadSelectorEntry(GetCurrentThreadId(),segptr>>16,ldtent);
}
/*********************************************************************** /***********************************************************************
* GetWin16DOSEnv (KERNEL32.34) * GetWin16DOSEnv (KERNEL32.34)