Commit d5041fc4 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved thunking functions off to kernel32.dll.

parent cd770eaf
......@@ -388,7 +388,7 @@ ddraw/libddraw.so: libx11drv.so
dplayx/libdplayx.so: libole32.so
dsound/libdsound.so: libwinmm.so
msvideo/libmsvfw32.so: libwinmm.so
ole32/libole32.so: librpcrt4.so
ole32/libole32.so: librpcrt4.so libkernel32.so
oleaut32/liboleaut32.so: libole32.so libcomctl32.so
olecli/libolecli32.so: libolesvr32.so libole32.so
olepro32/libolepro32.so: liboleaut32.so libole32.so
......@@ -398,6 +398,7 @@ shfolder/libshfolder.so: libshell32.so
shlwapi/libshlwapi.so: libshell32.so
urlmon/liburlmon.so: libole32.so
version/libversion.so: liblz32.so
win32s/libw32skrnl.so: libkernel32.so
winmm/joystick/libjoystick.drv.so: libwinmm.so
winmm/mcianim/libmcianim.drv.so: libwinmm.so
winmm/mciavi/libmciavi.drv.so: libwinmm.so
......
......@@ -8,8 +8,11 @@ ALTNAMES = comm kernel system toolhelp windebug win87em wprocs
C_SRCS = \
kernel_main.c \
thunk.c \
utthunk.c \
win87em.c \
windebug.c
windebug.c \
wowthunk.c
RC_SRCS = \
locale_rc.rc
......
......@@ -9,8 +9,6 @@
#include "windef.h"
struct _PDB;
struct ThunkDataCommon
{
char magic[4]; /* 00 */
......@@ -100,7 +98,7 @@ struct ThunkDataSL
struct SLTargetDB
{
struct SLTargetDB * next;
struct _PDB * process;
DWORD process;
DWORD * targetTable;
};
......
......@@ -16,6 +16,8 @@
#include "global.h"
extern void CODEPAGE_Init(void);
extern BOOL THUNK_Init(void);
/***********************************************************************
* KERNEL process initialisation routine
......@@ -27,6 +29,9 @@ static BOOL process_attach(void)
/* Setup codepage info */
CODEPAGE_Init();
/* Initialize thunking */
if (!THUNK_Init()) return FALSE;
/* Initialize DOS memory */
if (!DOSMEM_Init(0)) return FALSE;
......
......@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = ole32
SOVERSION = 1.0
ALTNAMES = ole2 ole2nls ole2conv ole2prox ole2thk storage compobj
IMPORTS = rpcrt4
IMPORTS = rpcrt4 kernel32
C_SRCS = \
antimoniker.c \
......
name ole32
type win32
import rpcrt4
import kernel32
1 stub BindMoniker # stdcall (ptr long ptr ptr) return 0,ERR_NOTIMPLEMENTED
2 stdcall CLSIDFromProgID(wstr ptr) CLSIDFromProgID
......
......@@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE = w32skrnl
SOVERSION = 1.0
ALTNAMES = w32sys win32s16
IMPORTS = kernel32
C_SRCS = \
w32skernel.c \
......
name w32skrnl
type win32
import kernel32.dll
1 stub _kSetEnvironmentVariable@8
2 stub _SzFromImte@4
3 stdcall GetCurrentTask32() GetCurrentTask
......
......@@ -53,9 +53,7 @@ BOOL RELAY_Init(void)
CALL32_CBClientEx_RetAddr =
PTR_SEG_OFF_TO_SEGPTR( codesel, (char*)CALL32_CBClientEx_Ret - (char*)Call16_Ret_Start );
#endif
/* Initialize thunking */
return THUNK_Init();
return TRUE;
}
/*
......@@ -338,85 +336,3 @@ void RELAY_DebugCallTo16Ret( int ret_val )
OFFSETOF(NtCurrentTeb()->cur_stack), ret_val);
SYSLEVEL_CheckNotLevel( 2 );
}
/**********************************************************************
* Catch (KERNEL.55)
*
* Real prototype is:
* INT16 WINAPI Catch( LPCATCHBUF lpbuf );
*/
void WINAPI Catch16( LPCATCHBUF lpbuf, CONTEXT86 *context )
{
/* Note: we don't save the current ss, as the catch buffer is */
/* only 9 words long. Hopefully no one will have the silly */
/* idea to change the current stack before calling Throw()... */
/* Windows uses:
* lpbuf[0] = ip
* lpbuf[1] = cs
* lpbuf[2] = sp
* lpbuf[3] = bp
* lpbuf[4] = si
* lpbuf[5] = di
* lpbuf[6] = ds
* lpbuf[7] = unused
* lpbuf[8] = ss
*/
lpbuf[0] = LOWORD(EIP_reg(context));
lpbuf[1] = CS_reg(context);
/* Windows pushes 4 more words before saving sp */
lpbuf[2] = LOWORD(ESP_reg(context)) - 4 * sizeof(WORD);
lpbuf[3] = LOWORD(EBP_reg(context));
lpbuf[4] = LOWORD(ESI_reg(context));
lpbuf[5] = LOWORD(EDI_reg(context));
lpbuf[6] = DS_reg(context);
lpbuf[7] = 0;
lpbuf[8] = SS_reg(context);
AX_reg(context) = 0; /* Return 0 */
}
/**********************************************************************
* Throw (KERNEL.56)
*
* Real prototype is:
* INT16 WINAPI Throw( LPCATCHBUF lpbuf, INT16 retval );
*/
void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT86 *context )
{
STACK16FRAME *pFrame;
STACK32FRAME *frame32;
TEB *teb = NtCurrentTeb();
AX_reg(context) = retval;
/* Find the frame32 corresponding to the frame16 we are jumping to */
pFrame = THREAD_STACK16(teb);
frame32 = pFrame->frame32;
while (frame32 && frame32->frame16)
{
if (OFFSETOF(frame32->frame16) < OFFSETOF(teb->cur_stack))
break; /* Something strange is going on */
if (OFFSETOF(frame32->frame16) > lpbuf[2])
{
/* We found the right frame */
pFrame->frame32 = frame32;
break;
}
frame32 = ((STACK16FRAME *)PTR_SEG_TO_LIN(frame32->frame16))->frame32;
}
EIP_reg(context) = lpbuf[0];
CS_reg(context) = lpbuf[1];
ESP_reg(context) = lpbuf[2] + 4 * sizeof(WORD) - sizeof(WORD) /*extra arg*/;
EBP_reg(context) = lpbuf[3];
ESI_reg(context) = lpbuf[4];
EDI_reg(context) = lpbuf[5];
DS_reg(context) = lpbuf[6];
if (lpbuf[8] != SS_reg(context))
ERR("Switching stack segment with Throw() not supported; expect crash now\n" );
}
......@@ -23,7 +23,6 @@ C_SRCS = \
toolhelp.c \
tweak.c \
version.c \
w32scomb.c \
wsprintf.c
GLUE = printdrv.c
......
/*
* W32SCOMB
* DLL for Win32s
*
* Copyright (c) 1997 Andreas Mohr
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "wine/winbase16.h"
#include "module.h"
#include "ldt.h"
#include "selectors.h"
#include "heap.h"
/***********************************************************************
* Get16DLLAddress (KERNEL32)
*
* This function is used by a Win32s DLL if it wants to call a Win16 function.
* A 16:16 segmented pointer to the function is returned.
* Written without any docu.
*/
SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name) {
HANDLE ThunkHeap = HeapCreate(HEAP_WINE_SEGPTR | HEAP_WINE_CODESEG, 0, 64);
LPBYTE x;
LPVOID tmpheap = HeapAlloc(ThunkHeap, 0, 32);
SEGPTR thunk = HEAP_GetSegptr(ThunkHeap, 0, tmpheap);
DWORD proc_16;
if (!handle) handle=GetModuleHandle16("WIN32S16");
proc_16 = (DWORD)WIN32_GetProcAddress16(handle, func_name);
x=PTR_SEG_TO_LIN(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();
return thunk;
}
......@@ -8,9 +8,7 @@ MODULE = relay32
C_SRCS = \
builtin32.c \
relay386.c \
snoop.c \
utthunk.c \
wowthunk.c
snoop.c
all: $(MODULE).o
......
......@@ -17,77 +17,8 @@
#include "stackframe.h"
#include "debugtools.h"
DECLARE_DEBUG_CHANNEL(dosmem)
DECLARE_DEBUG_CHANNEL(thread)
DECLARE_DEBUG_CHANNEL(win)
DECLARE_DEBUG_CHANNEL(win32)
DECLARE_DEBUG_CHANNEL(win);
/***********************************************************************
* GetWin16DOSEnv (KERNEL32.34)
* Returns some internal value.... probably the default environment database?
*/
DWORD WINAPI GetWin16DOSEnv()
{
FIXME_(dosmem)("stub, returning 0\n");
return 0;
}
/**********************************************************************
* GetPK16SysVar (KERNEL32.92)
*/
LPVOID WINAPI GetPK16SysVar(void)
{
static BYTE PK16SysVar[128];
FIXME_(win32)("()\n");
return PK16SysVar;
}
/**********************************************************************
* CommonUnimpStub (KERNEL32.17)
*/
void WINAPI CommonUnimpStub( CONTEXT86 *context )
{
if (EAX_reg(context))
MESSAGE( "*** Unimplemented Win32 API: %s\n", (LPSTR)EAX_reg(context) );
switch ((ECX_reg(context) >> 4) & 0x0f)
{
case 15: EAX_reg(context) = -1; break;
case 14: EAX_reg(context) = 0x78; break;
case 13: EAX_reg(context) = 0x32; break;
case 1: EAX_reg(context) = 1; break;
default: EAX_reg(context) = 0; break;
}
ESP_reg(context) += (ECX_reg(context) & 0x0f) * 4;
}
/**********************************************************************
* HouseCleanLogicallyDeadHandles (KERNEL32.33)
*/
void WINAPI HouseCleanLogicallyDeadHandles(void)
{
/* Whatever this is supposed to do, our handles probably
don't need it :-) */
}
/**********************************************************************
* _KERNEL32_100
*/
BOOL WINAPI _KERNEL32_100(HANDLE threadid,DWORD exitcode,DWORD x) {
FIXME_(thread)("(%d,%ld,0x%08lx): stub\n",threadid,exitcode,x);
return TRUE;
}
/**********************************************************************
* _KERNEL32_99
*/
DWORD WINAPI _KERNEL32_99(DWORD x) {
FIXME_(win32)("(0x%08lx): stub\n",x);
return 1;
}
/***********************************************************************
* RegisterShellHookWindow [USER32.459]
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment