
Sun Mar 2 14:57:37 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [*/*] Completed transition to new Win32 types. * [tools/build.c] Changed CallTo16_regs to take a CONTEXT argument. * [memory/virtual.c] Rewrote Virtual* functions. Implemented CreateFileMapping and OpenFileMapping. Broke MapViewOfFile ;-) * [win32/k32obj.c] Implemented named objects. Sun Mar 2 00:33:21 1997 Mikolaj Zalewski <zmikolaj@free.polbox.pl> * [misc/ole2nls.c] [resources/sysres_Pl.c] Added Polish language support. Sat Mar 1 13:31:25 1997 David Faure <david.faure@ifhamy.insa-lyon.fr> * [windows/keyboard.c] Wrote VkKeyScan and tested with Winword. Works ok except for dead chars. Fri Feb 28 09:34:03 1997 John Harvey <john@division.co.uk> * [graphics/win16drv/font.c] [graphics/win16drv/init.c] [graphics/win16drv/obects.c] Added start of SelectObject call for printer driver. Write should now run with the printer driver enabled. Wed Feb 26 20:03:32 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [debugger/*.c] Re-added a disassembly command (list serves another functionality now). * [loader/pe_resource.c] Added # support. * [misc/ole2nls.c] GetStringType* added. * [objects/color.c] VGA16 fixes. * [windows/class.c] Look for global widget classes too in GetClassInfo32. * [windows/sysmetrics.c] [include/windows.h] Added Win32 sysmetrics. Sat Feb 22 23:56:29 1997 Jukka Iivonen <iivonen@cc.helsinki.fi> * [documentation/languages] The fourth case updated. * [if1632/ntdll.spec] Added some is* and to* functions. Sat Feb 22 23:05:47 1997 Morten Welinder <terra@diku.dk> * [configure.in] Add tests for wait4 and waitpid. * [loader/signal.c] Clean up OS-dependent code. I hope I got it right, :-) * [tools/wineconf] Recognise vfat file systems. Ignore floppy drives specified in /etc/fstab. * [files/*] Fix function names in error messages. Sat Feb 22 06:15:13 1997 Pablo Saratxaga <srtxg@chanae.stben.be> * [windows/keyboard.c] [windows/message.c] Support for more latin alphabet dead keys for iso-8859-{1,2,3,4,9} characters sets. Fri Feb 21 20:37:50 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk> * [controls/edit.c] Fix incorrect arg order in LOCAL_Alloc() call. Fri Feb 21 18:19:17 1997 Andrew Taylor <andrew@riscan.com> * [multimedia/mmsystem.c] [multimedia/mcistring.c] Fixed bug related to device IDs returned by multimedia system. Implemented mciGetDeviceID. Sat Feb 15 00:58:19 1997 Jimen Ching <jching@aloha.com> * [debugger/dbg.y] Do not dereference invalid expressions.
222 lines
6.2 KiB
C
222 lines
6.2 KiB
C
/*
|
|
* MMSYTEM time functions
|
|
*
|
|
* Copyright 1993 Martin Ayotte
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "windows.h"
|
|
#include "win.h"
|
|
#include "ldt.h"
|
|
#include "module.h"
|
|
#include "callback.h"
|
|
#include "user.h"
|
|
#include "driver.h"
|
|
#include "mmsystem.h"
|
|
#include "stddebug.h"
|
|
#include "debug.h"
|
|
|
|
static BOOL32 mmTimeStarted = FALSE;
|
|
static MMTIME mmSysTimeMS;
|
|
static MMTIME mmSysTimeSMPTE;
|
|
|
|
typedef struct tagTIMERENTRY {
|
|
WORD wDelay;
|
|
WORD wResol;
|
|
FARPROC16 lpFunc;
|
|
HINSTANCE16 hInstance;
|
|
DWORD dwUser;
|
|
WORD wFlags;
|
|
WORD wTimerID;
|
|
WORD wCurTime;
|
|
struct tagTIMERENTRY *Next;
|
|
struct tagTIMERENTRY *Prev;
|
|
} TIMERENTRY, *LPTIMERENTRY;
|
|
|
|
static LPTIMERENTRY lpTimerList = NULL;
|
|
|
|
/**************************************************************************
|
|
* TIME_MMSysTimeCallback
|
|
*/
|
|
static VOID TIME_MMSysTimeCallback( HWND32 hwnd, UINT32 msg,
|
|
UINT32 id, DWORD dwTime )
|
|
{
|
|
LPTIMERENTRY lpTimer = lpTimerList;
|
|
mmSysTimeMS.u.ms += 33;
|
|
mmSysTimeSMPTE.u.smpte.frame++;
|
|
while (lpTimer != NULL) {
|
|
lpTimer->wCurTime--;
|
|
if (lpTimer->wCurTime == 0) {
|
|
lpTimer->wCurTime = lpTimer->wDelay;
|
|
if (lpTimer->lpFunc != (FARPROC16) NULL) {
|
|
dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
|
|
dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
|
|
lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
|
|
dprintf_mmtime(stddeb, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
|
|
|
|
/* This is wrong (lpFunc is NULL all the time)
|
|
|
|
lpFunc = MODULE_GetEntryPoint( lpTimer->hInstance,
|
|
MODULE_GetOrdinal(lpTimer->hInstance,"TimerCallBack" ));
|
|
dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%08lx !\n", lpFunc);
|
|
*/
|
|
|
|
|
|
/* - TimeProc callback that is called here is something strange, under Windows 3.1x it is called
|
|
* during interrupt time, is allowed to execute very limited number of API calls (like
|
|
* PostMessage), and must reside in DLL (therefore uses stack of active application). So I
|
|
* guess current implementation via SetTimer has to be improved upon.
|
|
*/
|
|
|
|
CallTimeFuncProc(lpTimer->lpFunc, lpTimer->wTimerID,
|
|
0, lpTimer->dwUser, 0, 0);
|
|
|
|
dprintf_mmtime(stddeb, "MMSysTimeCallback // after CallBack16 !\n");
|
|
fflush(stdout);
|
|
}
|
|
if (lpTimer->wFlags & TIME_ONESHOT)
|
|
timeKillEvent(lpTimer->wTimerID);
|
|
}
|
|
lpTimer = lpTimer->Next;
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
* StartMMTime [internal]
|
|
*/
|
|
void StartMMTime()
|
|
{
|
|
if (!mmTimeStarted) {
|
|
mmTimeStarted = TRUE;
|
|
mmSysTimeMS.wType = TIME_MS;
|
|
mmSysTimeMS.u.ms = 0;
|
|
mmSysTimeSMPTE.wType = TIME_SMPTE;
|
|
mmSysTimeSMPTE.u.smpte.hour = 0;
|
|
mmSysTimeSMPTE.u.smpte.min = 0;
|
|
mmSysTimeSMPTE.u.smpte.sec = 0;
|
|
mmSysTimeSMPTE.u.smpte.frame = 0;
|
|
mmSysTimeSMPTE.u.smpte.fps = 0;
|
|
mmSysTimeSMPTE.u.smpte.dummy = 0;
|
|
SetTimer32( 0, 1, 33, TIME_MMSysTimeCallback );
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeGetSystemTime [MMSYSTEM.601]
|
|
*/
|
|
WORD timeGetSystemTime(LPMMTIME lpTime, WORD wSize)
|
|
{
|
|
dprintf_mmsys(stddeb, "timeGetSystemTime(%p, %u);\n", lpTime, wSize);
|
|
if (!mmTimeStarted)
|
|
StartMMTime();
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeSetEvent [MMSYSTEM.602]
|
|
*/
|
|
WORD timeSetEvent(WORD wDelay, WORD wResol, LPTIMECALLBACK lpFunc,
|
|
DWORD dwUser, WORD wFlags)
|
|
{
|
|
WORD wNewID = 0;
|
|
LPTIMERENTRY lpNewTimer;
|
|
LPTIMERENTRY lpTimer = lpTimerList;
|
|
dprintf_mmtime(stddeb, "timeSetEvent(%u, %u, %p, %08lX, %04X);\n",
|
|
wDelay, wResol, lpFunc, dwUser, wFlags);
|
|
if (!mmTimeStarted)
|
|
StartMMTime();
|
|
lpNewTimer = (LPTIMERENTRY) malloc(sizeof(TIMERENTRY));
|
|
if (lpNewTimer == NULL)
|
|
return 0;
|
|
while (lpTimer != NULL) {
|
|
wNewID = MAX(wNewID, lpTimer->wTimerID);
|
|
if (lpTimer->Next == NULL)
|
|
break;
|
|
lpTimer = lpTimer->Next;
|
|
}
|
|
if (lpTimerList == NULL) {
|
|
lpTimerList = lpNewTimer;
|
|
lpNewTimer->Prev = NULL;
|
|
} else {
|
|
lpTimer->Next = lpNewTimer;
|
|
lpNewTimer->Prev = lpTimer;
|
|
}
|
|
lpNewTimer->Next = NULL;
|
|
lpNewTimer->wTimerID = wNewID + 1;
|
|
lpNewTimer->wCurTime = wDelay;
|
|
lpNewTimer->wDelay = wDelay;
|
|
lpNewTimer->wResol = wResol;
|
|
lpNewTimer->lpFunc = (FARPROC16) lpFunc;
|
|
lpNewTimer->hInstance = GetTaskDS();
|
|
dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
|
|
dprintf_mmtime(stddeb, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n",
|
|
PTR_SEG_TO_LIN(lpFunc));
|
|
lpNewTimer->dwUser = dwUser;
|
|
lpNewTimer->wFlags = wFlags;
|
|
return lpNewTimer->wTimerID;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeKillEvent [MMSYSTEM.603]
|
|
*/
|
|
WORD timeKillEvent(WORD wID)
|
|
{
|
|
LPTIMERENTRY lpTimer = lpTimerList;
|
|
while (lpTimer != NULL) {
|
|
if (wID == lpTimer->wTimerID) {
|
|
if (lpTimer->Prev != NULL)
|
|
lpTimer->Prev->Next = lpTimer->Next;
|
|
if (lpTimer->Next != NULL)
|
|
lpTimer->Next->Prev = lpTimer->Prev;
|
|
free(lpTimer);
|
|
if (lpTimer==lpTimerList)
|
|
lpTimerList=NULL;
|
|
return TRUE;
|
|
}
|
|
lpTimer = lpTimer->Next;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeGetDevCaps [MMSYSTEM.604]
|
|
*/
|
|
WORD timeGetDevCaps(LPTIMECAPS lpCaps, WORD wSize)
|
|
{
|
|
dprintf_mmsys(stddeb, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeBeginPeriod [MMSYSTEM.605]
|
|
*/
|
|
WORD timeBeginPeriod(WORD wPeriod)
|
|
{
|
|
dprintf_mmsys(stddeb, "timeBeginPeriod(%u) !\n", wPeriod);
|
|
if (!mmTimeStarted)
|
|
StartMMTime();
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeEndPeriod [MMSYSTEM.606]
|
|
*/
|
|
WORD timeEndPeriod(WORD wPeriod)
|
|
{
|
|
dprintf_mmsys(stddeb, "timeEndPeriod(%u) !\n", wPeriod);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* timeGetTime [MMSYSTEM.607]
|
|
*/
|
|
DWORD timeGetTime()
|
|
{
|
|
dprintf_mmsys(stddeb, "timeGetTime(); !\n");
|
|
if (!mmTimeStarted)
|
|
StartMMTime();
|
|
return 0;
|
|
}
|