Commit b6c7eda2 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winmm: Get rid of WINE_TIMER_IS32 internal flag.

parent 09a9c87d
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "wownt32.h" #include "wownt32.h"
#include "winnls.h" #include "winnls.h"
#include "wine/list.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "winemm.h" #include "winemm.h"
#include "winemm16.h" #include "winemm16.h"
...@@ -51,6 +52,15 @@ static LPWINE_DRIVER DRIVER_OpenDriver16(LPCWSTR, LPCWSTR, LPARAM); ...@@ -51,6 +52,15 @@ static LPWINE_DRIVER DRIVER_OpenDriver16(LPCWSTR, LPCWSTR, LPARAM);
static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM); static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM);
static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM); static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM);
static CRITICAL_SECTION mmdrv_cs;
static CRITICAL_SECTION_DEBUG mmdrv_critsect_debug =
{
0, 0, &mmdrv_cs,
{ &mmdrv_critsect_debug.ProcessLocksList, &mmdrv_critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": mmsystem_mmdrv_cs") }
};
static CRITICAL_SECTION mmdrv_cs = { &mmdrv_critsect_debug, -1, 0, 0, 0, 0 };
/* ################################################### /* ###################################################
* # LIBRARY # * # LIBRARY #
* ################################################### * ###################################################
...@@ -2371,17 +2381,66 @@ MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize) ...@@ -2371,17 +2381,66 @@ MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
return 0; return 0;
} }
struct timer_entry {
struct list entry;
UINT id;
LPTIMECALLBACK16 func16;
DWORD user;
};
static struct list timer_list = LIST_INIT(timer_list);
static void CALLBACK timeCB3216(UINT id, UINT uMsg, DWORD_PTR user, DWORD_PTR dw1, DWORD_PTR dw2)
{
struct timer_entry* te = (void*)user;
WORD args[8];
DWORD ret;
args[7] = LOWORD(id);
args[6] = LOWORD(uMsg);
args[5] = HIWORD(te->user);
args[4] = LOWORD(te->user);
args[3] = HIWORD(dw1);
args[2] = LOWORD(dw2);
args[1] = HIWORD(dw2);
args[0] = LOWORD(dw2);
WOWCallback16Ex((DWORD)te->func16, WCB16_PASCAL, sizeof(args), args, &ret);
}
/************************************************************************** /**************************************************************************
* timeSetEvent [MMSYSTEM.602] * timeSetEvent [MMSYSTEM.602]
*/ */
MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc, MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc,
DWORD dwUser, UINT16 wFlags) DWORD dwUser, UINT16 wFlags)
{ {
if (wFlags & WINE_TIMER_IS32) MMRESULT16 id;
WARN("Unknown windows flag... wine internally used.. ooch\n"); struct timer_entry* te;
return TIME_SetEventInternal(wDelay, wResol, (LPTIMECALLBACK)lpFunc, switch (wFlags & (TIME_CALLBACK_EVENT_SET|TIME_CALLBACK_EVENT_PULSE))
dwUser, wFlags & ~WINE_TIMER_IS32); {
case TIME_CALLBACK_EVENT_SET:
case TIME_CALLBACK_EVENT_PULSE:
id = timeSetEvent(wDelay, wResol, (LPTIMECALLBACK)lpFunc, dwUser, wFlags);
break;
case TIME_CALLBACK_FUNCTION:
te = HeapAlloc(GetProcessHeap(), 0, sizeof(*te));
if (!te) return 0;
te->func16 = lpFunc;
te->user = dwUser;
id = te->id = timeSetEvent(wDelay, wResol, timeCB3216, (DWORD_PTR)te, wFlags);
if (id)
{
EnterCriticalSection(&mmdrv_cs);
list_add_tail(&timer_list, &te->entry);
LeaveCriticalSection(&mmdrv_cs);
}
else HeapFree(GetProcessHeap(), 0, te);
break;
default:
id = 0;
break;
}
return id;
} }
/************************************************************************** /**************************************************************************
...@@ -2389,7 +2448,24 @@ MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 ...@@ -2389,7 +2448,24 @@ MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16
*/ */
MMRESULT16 WINAPI timeKillEvent16(UINT16 wID) MMRESULT16 WINAPI timeKillEvent16(UINT16 wID)
{ {
return timeKillEvent(wID); MMRESULT16 ret = timeKillEvent(wID);
struct timer_entry* te;
if (ret == TIMERR_NOERROR)
{
EnterCriticalSection(&mmdrv_cs);
LIST_FOR_EACH_ENTRY(te, &timer_list, struct timer_entry, entry)
{
if (wID == te->id)
{
list_remove(&te->entry);
HeapFree(GetProcessHeap(), 0, te);
break;
}
}
LeaveCriticalSection(&mmdrv_cs);
}
return ret;
} }
/************************************************************************** /**************************************************************************
......
...@@ -179,8 +179,7 @@ static int TIME_MMSysTimeCallback(void) ...@@ -179,8 +179,7 @@ static int TIME_MMSysTimeCallback(void)
if (flags & TIME_KILL_SYNCHRONOUS) EnterCriticalSection(&TIME_cbcrst); if (flags & TIME_KILL_SYNCHRONOUS) EnterCriticalSection(&TIME_cbcrst);
LeaveCriticalSection(&WINMM_cs); LeaveCriticalSection(&WINMM_cs);
if (flags & WINE_TIMER_IS32) func(id, 0, user, 0, 0); func(id, 0, user, 0, 0);
else if (pFnCallMMDrvFunc16) pFnCallMMDrvFunc16((DWORD_PTR)func, id, 0, user, 0, 0);
EnterCriticalSection(&WINMM_cs); EnterCriticalSection(&WINMM_cs);
if (flags & TIME_KILL_SYNCHRONOUS) LeaveCriticalSection(&TIME_cbcrst); if (flags & TIME_KILL_SYNCHRONOUS) LeaveCriticalSection(&TIME_cbcrst);
...@@ -301,10 +300,10 @@ MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize) ...@@ -301,10 +300,10 @@ MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize)
} }
/************************************************************************** /**************************************************************************
* TIME_SetEventInternal [internal] * timeSetEvent [WINMM.@]
*/ */
WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc,
LPTIMECALLBACK lpFunc, DWORD_PTR dwUser, UINT wFlags) DWORD_PTR dwUser, UINT wFlags)
{ {
WORD wNewID = 0; WORD wNewID = 0;
LPWINE_TIMERENTRY lpNewTimer; LPWINE_TIMERENTRY lpNewTimer;
...@@ -351,19 +350,6 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, ...@@ -351,19 +350,6 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol,
} }
/************************************************************************** /**************************************************************************
* timeSetEvent [WINMM.@]
*/
MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc,
DWORD_PTR dwUser, UINT wFlags)
{
if (wFlags & WINE_TIMER_IS32)
WARN("Unknown windows flag... wine internally used.. ooch\n");
return TIME_SetEventInternal(wDelay, wResol, lpFunc,
dwUser, wFlags|WINE_TIMER_IS32);
}
/**************************************************************************
* timeKillEvent [WINMM.@] * timeKillEvent [WINMM.@]
*/ */
MMRESULT WINAPI timeKillEvent(UINT wID) MMRESULT WINAPI timeKillEvent(UINT wID)
......
...@@ -151,8 +151,6 @@ typedef struct tagWINE_MCIDRIVER { ...@@ -151,8 +151,6 @@ typedef struct tagWINE_MCIDRIVER {
struct tagWINE_MCIDRIVER*lpNext; struct tagWINE_MCIDRIVER*lpNext;
} WINE_MCIDRIVER, *LPWINE_MCIDRIVER; } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
#define WINE_TIMER_IS32 0x80
struct IOProcList struct IOProcList
{ {
struct IOProcList*pNext; /* Next item in linked list */ struct IOProcList*pNext; /* Next item in linked list */
...@@ -220,8 +218,6 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType, ...@@ -220,8 +218,6 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32); DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);
WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc,
DWORD_PTR dwUser, UINT wFlags);
void TIME_MMTimeStop(void); void TIME_MMTimeStop(void);
/* Global variables */ /* Global variables */
......
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