Commit d6c0d864 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved gdi/user thunking functions into their respective dlls.

Moved keyboard.spec into user dll.
parent 5eee0bff
......@@ -2,3 +2,4 @@
*.spec.glue.s
Makefile
libgdi32.so.1.0
thunk.glue.c
......@@ -9,7 +9,10 @@ ALTNAMES = gdi
SPEC_SRCS = gdi32.spec gdi.spec
C_SRCS = \
gdi_main.c
gdi_main.c \
thunk.c
GLUE = thunk.c
@MAKE_DLL_RULES@
......
......@@ -108,7 +108,7 @@ file gdi.exe
98 pascal16 IntersectVisRect(word s_word s_word s_word s_word)
IntersectVisRect16
99 pascal16 LPtoDP(word ptr s_word) LPtoDP16
100 pascal16 LineDDA(s_word s_word s_word s_word segptr long) THUNK_LineDDA16
100 pascal16 LineDDA(s_word s_word s_word s_word segptr long) LineDDA16
101 pascal16 OffsetRgn(word s_word s_word) OffsetRgn16
102 pascal16 OffsetVisRgn(word s_word s_word) OffsetVisRgn16
103 pascal16 PtVisible(word s_word s_word) PtVisible16
......
/*
* GDI 16-bit thunks
*
* Copyright 1996, 1997 Alexandre Julliard
* Copyright 1998 Ulrich Weigand
*/
#include "windef.h"
#include "wingdi.h"
#include "wine/wingdi16.h"
#include "callback.h"
/* ### start build ### */
extern WORD CALLBACK THUNK_CallTo16_word_ll (FARPROC16,LONG,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wllwl(FARPROC16,WORD,LONG,LONG,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wwl (FARPROC16,WORD,WORD,LONG);
/* ### stop build ### */
/***********************************************************************
* THUNK_EnumObjects16 (GDI.71)
*/
INT16 WINAPI THUNK_EnumObjects16( HDC16 hdc, INT16 nObjType,
GOBJENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_ll );
return EnumObjects16( hdc, nObjType, (GOBJENUMPROC16)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFonts16 (GDI.70)
*/
INT16 WINAPI THUNK_EnumFonts16( HDC16 hdc, LPCSTR lpFaceName,
FONTENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFonts16( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam );
}
/******************************************************************
* THUNK_EnumMetaFile16 (GDI.175)
*/
BOOL16 WINAPI THUNK_EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf,
MFENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wllwl );
return EnumMetaFile16( hdc, hmf, (MFENUMPROC16)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFontFamilies16 (GDI.330)
*/
INT16 WINAPI THUNK_EnumFontFamilies16( HDC16 hdc, LPCSTR lpszFamily,
FONTENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFontFamilies16(hdc, lpszFamily, (FONTENUMPROC16)&thunk, lParam);
}
/*************************************************************************
* THUNK_EnumFontFamiliesEx16 (GDI.613)
*/
INT16 WINAPI THUNK_EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 lpLF,
FONTENUMPROCEX16 func, LPARAM lParam,
DWORD reserved )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFontFamiliesEx16( hdc, lpLF, (FONTENUMPROCEX16)&thunk,
lParam, reserved );
}
/**********************************************************************
* LineDDA16 (GDI.100)
*/
void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
INT16 nYEnd, LINEDDAPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wwl );
LineDDA( nXStart, nYStart, nXEnd, nYEnd, (LINEDDAPROC)&thunk, lParam );
}
......@@ -2,3 +2,4 @@
*.spec.glue.s
Makefile
libuser32.so.1.0
thunk.glue.c
......@@ -9,7 +9,10 @@ ALTNAMES = user
SPEC_SRCS = user32.spec user.spec
C_SRCS = \
user_main.c
user_main.c \
thunk.c
GLUE = thunk.c
@MAKE_DLL_RULES@
......
/*
* USER 16-bit thunks
*
* Copyright 1996, 1997 Alexandre Julliard
* Copyright 1998 Ulrich Weigand
*/
#include "windef.h"
#include "wingdi.h"
#include "wine/winuser16.h"
#include "callback.h"
/* ### start build ### */
extern WORD CALLBACK THUNK_CallTo16_word_wl (FARPROC16,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_wlw (FARPROC16,WORD,LONG,WORD);
/* ### stop build ### */
/*******************************************************************
* EnumWindows16 (USER.54)
*/
BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumWindows( (WNDENUMPROC)&thunk, lParam );
}
/**********************************************************************
* EnumChildWindows16 (USER.55)
*/
BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumChildWindows( parent, (WNDENUMPROC)&thunk, lParam );
}
/**********************************************************************
* THUNK_EnumTaskWindows16 (USER.225)
*/
BOOL16 WINAPI THUNK_EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func,
LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumTaskWindows16( hTask, (WNDENUMPROC16)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumProps16 (USER.27)
*/
INT16 WINAPI THUNK_EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw );
return EnumProps16( hwnd, (PROPENUMPROC16)&thunk );
}
/***********************************************************************
* THUNK_GrayString16 (USER.185)
*/
BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr,
GRAYSTRINGPROC16 func, LPARAM lParam,
INT16 cch, INT16 x, INT16 y,
INT16 cx, INT16 cy )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw );
if (!func)
return GrayString16( hdc, hbr, NULL, lParam, cch, x, y, cx, cy );
else
return GrayString16( hdc, hbr, (GRAYSTRINGPROC16)&thunk, lParam, cch,
x, y, cx, cy );
}
......@@ -55,8 +55,8 @@ file user.exe
51 stub BEAR51 # IsTwoByteCharPrefix
52 pascal16 AnyPopup() AnyPopup16
53 pascal16 DestroyWindow(word) DestroyWindow16
54 pascal16 EnumWindows(segptr long) THUNK_EnumWindows16
55 pascal16 EnumChildWindows(word segptr long) THUNK_EnumChildWindows16
54 pascal16 EnumWindows(segptr long) EnumWindows16
55 pascal16 EnumChildWindows(word segptr long) EnumChildWindows16
56 pascal16 MoveWindow(word word word word word word) MoveWindow16
57 pascal16 RegisterClass(ptr) RegisterClass16
58 pascal16 GetClassName(word ptr word) GetClassName16
......
......@@ -4,7 +4,6 @@ comm.spec.c
ddeml.spec.c
dispdib.spec.c
kernel.spec.c
keyboard.spec.c
ole2conv.spec.c
ole2nls.spec.c
ole2prox.spec.c
......
......@@ -10,7 +10,6 @@ SPEC_SRCS = \
ddeml.spec \
dispdib.spec \
kernel.spec \
keyboard.spec \
ole2conv.spec \
ole2nls.spec \
ole2prox.spec \
......
......@@ -35,53 +35,16 @@ extern WORD CALLBACK THUNK_CallTo16_word_w (FARPROC16,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_l (FARPROC16,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_l (FARPROC16,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_ww (FARPROC16,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wl (FARPROC16,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_ll (FARPROC16,LONG,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_ll (FARPROC16,LONG,LONG);
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_wlw (FARPROC16,WORD,LONG,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_lllw (FARPROC16,LONG,LONG,LONG,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lwww (FARPROC16,LONG,WORD,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wlww (FARPROC16,WORD,LONG,WORD,WORD);
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 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);
/* ### stop build ### */
#include "pshpack1.h"
typedef struct tagTHUNK
{
BYTE popl_eax; /* 0x58 popl %eax (return address)*/
BYTE pushl_func; /* 0x68 pushl $proc */
FARPROC16 proc WINE_PACKED;
BYTE pushl_eax; /* 0x50 pushl %eax */
BYTE jmp; /* 0xe9 jmp relay (relative jump)*/
RELAY relay WINE_PACKED;
struct tagTHUNK *next WINE_PACKED;
DWORD magic;
} THUNK;
#define CALLTO16_THUNK_MAGIC 0x54484e4b /* "THNK" */
#include "poppack.h"
#define DECL_THUNK(aname,aproc,arelay) \
THUNK aname; \
aname.popl_eax = 0x58; \
aname.pushl_func = 0x68; \
aname.proc = (FARPROC) (aproc); \
aname.pushl_eax = 0x50; \
aname.jmp = 0xe9; \
aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
aname.next = NULL; \
aname.magic = CALLTO16_THUNK_MAGIC;
static THUNK *firstThunk = NULL;
static BOOL THUNK_ThunkletInit( void );
......@@ -197,132 +160,6 @@ void THUNK_Free( FARPROC thunk )
/***********************************************************************
* THUNK_EnumObjects16 (GDI.71)
*/
INT16 WINAPI THUNK_EnumObjects16( HDC16 hdc, INT16 nObjType,
GOBJENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_ll );
return EnumObjects16( hdc, nObjType, (GOBJENUMPROC16)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFonts16 (GDI.70)
*/
INT16 WINAPI THUNK_EnumFonts16( HDC16 hdc, LPCSTR lpFaceName,
FONTENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFonts16( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam );
}
/******************************************************************
* THUNK_EnumMetaFile16 (GDI.175)
*/
BOOL16 WINAPI THUNK_EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf,
MFENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wllwl );
return EnumMetaFile16( hdc, hmf, (MFENUMPROC16)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFontFamilies16 (GDI.330)
*/
INT16 WINAPI THUNK_EnumFontFamilies16( HDC16 hdc, LPCSTR lpszFamily,
FONTENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFontFamilies16(hdc, lpszFamily, (FONTENUMPROC16)&thunk, lParam);
}
/*************************************************************************
* THUNK_EnumFontFamiliesEx16 (GDI.613)
*/
INT16 WINAPI THUNK_EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 lpLF,
FONTENUMPROCEX16 func, LPARAM lParam,
DWORD reserved )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl );
return EnumFontFamiliesEx16( hdc, lpLF, (FONTENUMPROCEX16)&thunk,
lParam, reserved );
}
/**********************************************************************
* THUNK_LineDDA16 (GDI.100)
*/
void WINAPI THUNK_LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
INT16 nYEnd, LINEDDAPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wwl );
LineDDA16( nXStart, nYStart, nXEnd, nYEnd, (LINEDDAPROC16)&thunk, lParam );
}
/*******************************************************************
* THUNK_EnumWindows16 (USER.54)
*/
BOOL16 WINAPI THUNK_EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumWindows16( (WNDENUMPROC16)&thunk, lParam );
}
/**********************************************************************
* THUNK_EnumChildWindows16 (USER.55)
*/
BOOL16 WINAPI THUNK_EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func,
LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumChildWindows16( parent, (WNDENUMPROC16)&thunk, lParam );
}
/**********************************************************************
* THUNK_EnumTaskWindows16 (USER.225)
*/
BOOL16 WINAPI THUNK_EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func,
LPARAM lParam )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl );
return EnumTaskWindows16( hTask, (WNDENUMPROC16)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumProps16 (USER.27)
*/
INT16 WINAPI THUNK_EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw );
return EnumProps16( hwnd, (PROPENUMPROC16)&thunk );
}
/***********************************************************************
* THUNK_GrayString16 (USER.185)
*/
BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr,
GRAYSTRINGPROC16 func, LPARAM lParam,
INT16 cch, INT16 x, INT16 y,
INT16 cx, INT16 cy )
{
DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw );
if (!func)
return GrayString16( hdc, hbr, NULL, lParam, cch, x, y, cx, cy );
else
return GrayString16( hdc, hbr, (GRAYSTRINGPROC16)&thunk, lParam, cch,
x, y, cx, cy );
}
/***********************************************************************
* THUNK_GetCalloutThunk
*
* Retrieve API entry point with given name from given module.
......@@ -353,25 +190,26 @@ void THUNK_InitCallout(void)
hModule = GetModuleHandleA( "USER32" );
if ( hModule )
{
#define GETADDR( var, name ) \
*(FARPROC *)&Callout.##var = GetProcAddress( hModule, name )
GETADDR( PeekMessageA, "PeekMessageA" );
GETADDR( PeekMessageW, "PeekMessageW" );
GETADDR( GetMessageA, "GetMessageA" );
GETADDR( GetMessageW, "GetMessageW" );
GETADDR( SendMessageA, "SendMessageA" );
GETADDR( SendMessageW, "SendMessageW" );
GETADDR( PostMessageA, "PostMessageA" );
GETADDR( PostMessageW, "PostMessageW" );
GETADDR( PostThreadMessageA, "PostThreadMessageA" );
GETADDR( PostThreadMessageW, "PostThreadMessageW" );
GETADDR( TranslateMessage, "TranslateMessage" );
GETADDR( DispatchMessageW, "DispatchMessageW" );
GETADDR( DispatchMessageA, "DispatchMessageA" );
GETADDR( RedrawWindow, "RedrawWindow" );
GETADDR( WaitForInputIdle, "WaitForInputIdle" );
#define GETADDR( name ) \
*(FARPROC *)&Callout.##name = GetProcAddress( hModule, #name )
GETADDR( PeekMessageA );
GETADDR( PeekMessageW );
GETADDR( GetMessageA );
GETADDR( GetMessageW );
GETADDR( SendMessageA );
GETADDR( SendMessageW );
GETADDR( PostMessageA );
GETADDR( PostMessageW );
GETADDR( PostThreadMessageA );
GETADDR( PostThreadMessageW );
GETADDR( TranslateMessage );
GETADDR( DispatchMessageW );
GETADDR( DispatchMessageA );
GETADDR( RedrawWindow );
GETADDR( WaitForInputIdle );
GETADDR( MessageBoxA );
GETADDR( MessageBoxW );
#undef GETADDR
}
......
......@@ -100,9 +100,40 @@ typedef struct
WORD WINAPI (*DestroyIcon32)( HGLOBAL16 handle, UINT16 flags );
DWORD WINAPI (*WaitForInputIdle)( HANDLE hProcess, DWORD dwTimeOut );
INT WINAPI (*MessageBoxA)( HWND hWnd, LPCSTR text, LPCSTR title, UINT type );
INT WINAPI (*MessageBoxW)( HWND hwnd, LPCWSTR text, LPCWSTR title, UINT type );
} CALLOUT_TABLE;
extern CALLOUT_TABLE Callout;
#include "pshpack1.h"
typedef struct tagTHUNK
{
BYTE popl_eax; /* 0x58 popl %eax (return address)*/
BYTE pushl_func; /* 0x68 pushl $proc */
FARPROC16 proc WINE_PACKED;
BYTE pushl_eax; /* 0x50 pushl %eax */
BYTE jmp; /* 0xe9 jmp relay (relative jump)*/
RELAY relay WINE_PACKED;
struct tagTHUNK *next WINE_PACKED;
DWORD magic;
} THUNK;
#include "poppack.h"
#define CALLTO16_THUNK_MAGIC 0x54484e4b /* "THNK" */
#define DECL_THUNK(aname,aproc,arelay) \
THUNK aname; \
aname.popl_eax = 0x58; \
aname.pushl_func = 0x68; \
aname.proc = (FARPROC) (aproc); \
aname.pushl_eax = 0x50; \
aname.jmp = 0xe9; \
aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
aname.next = NULL; \
aname.magic = CALLTO16_THUNK_MAGIC;
#endif /* __WINE_CALLBACK_H */
......@@ -9,16 +9,6 @@
#include "wingdi.h"
#include "wine/wingdi16.h"
/**********************************************************************
* LineDDA16 (GDI.100)
*/
void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd, INT16 nYEnd,
LINEDDAPROC16 callback, LPARAM lParam )
{
LineDDA( nXStart, nYStart, nXEnd, nYEnd,
(LINEDDAPROC)callback, lParam );
}
/**********************************************************************
* LineDDA32 (GDI32.248)
......
......@@ -2756,9 +2756,9 @@ void WIN_ReleaseWinArray(WND **wndArray)
}
/*******************************************************************
* EnumWindows16 (USER.54)
* EnumWindows (USER32.193)
*/
BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 lpEnumFunc, LPARAM lParam )
BOOL WINAPI EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam )
{
WND **list, **ppWnd;
......@@ -2796,15 +2796,6 @@ BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 lpEnumFunc, LPARAM lParam )
}
/*******************************************************************
* EnumWindows32 (USER32.193)
*/
BOOL WINAPI EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam )
{
return (BOOL)EnumWindows16( (WNDENUMPROC16)lpEnumFunc, lParam );
}
/**********************************************************************
* EnumTaskWindows16 (USER.225)
*/
......@@ -2863,8 +2854,7 @@ BOOL WINAPI EnumThreadWindows( DWORD id, WNDENUMPROC func, LPARAM lParam )
*
* Helper function for EnumChildWindows().
*/
static BOOL16 WIN_EnumChildWindows( WND **ppWnd, WNDENUMPROC16 func,
LPARAM lParam )
static BOOL16 WIN_EnumChildWindows( WND **ppWnd, WNDENUMPROC func, LPARAM lParam )
{
WND **childList;
BOOL16 ret = FALSE;
......@@ -2897,9 +2887,9 @@ static BOOL16 WIN_EnumChildWindows( WND **ppWnd, WNDENUMPROC16 func,
/**********************************************************************
* EnumChildWindows16 (USER.55)
* EnumChildWindows (USER32.178)
*/
BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func,
BOOL WINAPI EnumChildWindows( HWND parent, WNDENUMPROC func,
LPARAM lParam )
{
WND **list, *pParent;
......@@ -2917,17 +2907,6 @@ BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func,
}
/**********************************************************************
* EnumChildWindows32 (USER32.178)
*/
BOOL WINAPI EnumChildWindows( HWND parent, WNDENUMPROC func,
LPARAM lParam )
{
return (BOOL)EnumChildWindows16( (HWND16)parent, (WNDENUMPROC16)func,
lParam );
}
/*******************************************************************
* AnyPopup16 (USER.52)
*/
......
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