Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56260
-- v4: mmsystem: Simulate a hardware interrupt in MMSYSTDRV_Callback3216. krnl386: Add a function to simulate a hardware interrupt.
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56260 --- dlls/krnl386.exe16/krnl386.exe16.spec | 3 +++ dlls/krnl386.exe16/wowthunk.c | 33 +++++++++++++++++++-------- include/wine/winbase16.h | 2 ++ 3 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/dlls/krnl386.exe16/krnl386.exe16.spec b/dlls/krnl386.exe16/krnl386.exe16.spec index d98e136c77e..34f9c9b3846 100644 --- a/dlls/krnl386.exe16/krnl386.exe16.spec +++ b/dlls/krnl386.exe16/krnl386.exe16.spec @@ -744,6 +744,9 @@ 2000 pascal -register __wine_call_int_handler(word) __wine_call_int_handler16 @ stdcall -arch=win32 __wine_call_int_handler16(long ptr)
+# Hardware interrupt simulation +@ cdecl -arch=win32 __wine_wow_interrupt16(long long long ptr ptr) + # VxDs @ cdecl -arch=win32 -private __wine_vxd_open(wstr long ptr) @ cdecl -arch=win32 -private __wine_vxd_get_proc(long) diff --git a/dlls/krnl386.exe16/wowthunk.c b/dlls/krnl386.exe16/wowthunk.c index b729c38e8f1..6ff4e5a6b65 100644 --- a/dlls/krnl386.exe16/wowthunk.c +++ b/dlls/krnl386.exe16/wowthunk.c @@ -421,11 +421,7 @@ WORD WINAPI K32WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type ) } }
-/********************************************************************** - * K32WOWCallback16Ex (KERNEL32.55) - */ -BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, - DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode ) +static BOOL wow_callback16( DWORD vpfn16, DWORD dwFlags, DWORD cbArgs, void *pArgs, DWORD *pdwRetCode, BOOL interrupt ) { /* * Arguments must be prepared in the correct order by the caller @@ -460,9 +456,9 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, *((SEGPTR *)stack) = call16_ret_addr; cbArgs += sizeof(SEGPTR);
- _EnterWin16Lock(); + if (!interrupt) _EnterWin16Lock(); wine_call_to_16_regs( context, cbArgs, call16_handler ); - _LeaveWin16Lock(); + if (!interrupt) _LeaveWin16Lock();
if (TRACE_ON(relay)) { @@ -500,10 +496,10 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, * the callee to do so; after the routine has returned, the 16-bit * stack pointer is always reset to the position it had before. */ - _EnterWin16Lock(); + if (!interrupt) _EnterWin16Lock(); ret = wine_call_to_16( (FARPROC16)vpfn16, cbArgs, call16_handler ); if (pdwRetCode) *pdwRetCode = ret; - _LeaveWin16Lock(); + if (!interrupt) _LeaveWin16Lock();
if (TRACE_ON(relay)) { @@ -515,6 +511,25 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, return TRUE; /* success */ }
+/********************************************************************** + * __wine_wow_interrupt16 + * + * Simulates a hardware interrupt by running the callback without waiting for + * the current task to yield. + */ +BOOL __wine_wow_interrupt16( DWORD func, DWORD flags, DWORD arg_count, void *args, DWORD *ret_code ) +{ + return wow_callback16( func, flags, arg_count, args, ret_code, TRUE ); +} + +/********************************************************************** + * K32WOWCallback16Ex (KERNEL32.55) + */ +BOOL WINAPI K32WOWCallback16Ex( DWORD func, DWORD flags, DWORD arg_count, void *args, DWORD *ret_code ) +{ + return wow_callback16( func, flags, arg_count, args, ret_code, FALSE ); +} + /********************************************************************** * K32WOWCallback16 (KERNEL32.54) */ diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h index 28cde59f9b3..b7ba1bb9a7e 100644 --- a/include/wine/winbase16.h +++ b/include/wine/winbase16.h @@ -562,6 +562,8 @@ BOOL16 WINAPI WritePrivateProfileSection16(LPCSTR,LPCSTR,LPCSTR); BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR); BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR);
+BOOL __wine_wow_interrupt16(DWORD,DWORD,DWORD,void*,DWORD*); + #define CURRENT_STACK16 ((STACK16FRAME *)MapSL((SEGPTR)NtCurrentTeb()->SystemReserved1[0])) #define CURRENT_DS (CURRENT_STACK16->ds) #define CURRENT_SP (((WORD *)NtCurrentTeb()->SystemReserved1)[0])
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56260 --- dlls/mmsystem.dll16/message16.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mmsystem.dll16/message16.c b/dlls/mmsystem.dll16/message16.c index b12b9b94327..bf3f9a71f6b 100644 --- a/dlls/mmsystem.dll16/message16.c +++ b/dlls/mmsystem.dll16/message16.c @@ -838,7 +838,7 @@ static LRESULT CALLBACK MMSYSTDRV_Callback3216(struct mmsystdrv_thunk* thunk, HD args[2] = LOWORD(dwParam1); args[1] = HIWORD(dwParam2); args[0] = LOWORD(dwParam2); - return WOWCallback16Ex(thunk->callback, WCB16_PASCAL, sizeof(args), args, NULL); + return __wine_wow_interrupt16(thunk->callback, WCB16_PASCAL, sizeof(args), args, NULL); case CALLBACK_EVENT: TRACE("Event(%08lx) !\n", thunk->callback); SetEvent((HANDLE)thunk->callback);