From 63a25cf3233e1c8b20b9341c00a8c35d02cc4f1d Mon Sep 17 00:00:00 2001 From: Andrew Greenwood Date: Mon, 18 Aug 2003 19:14:57 +0000 Subject: [PATCH] I've attempted to (correctly) re-stub some of the WinMM.DLL functions, and have partly implemented some parameter checking, etc. This is still a complete mess and won't link. And it doesn't like me using file mappings. svn path=/trunk/; revision=5654 --- reactos/lib/winmm/Makefile | 4 +- reactos/lib/winmm/midiin.c | 164 +++++++++++++++ reactos/lib/winmm/midiout.c | 369 +++++++++++++++++++++++++++++++++ reactos/lib/winmm/midistream.c | 0 reactos/lib/winmm/misc/stubs.c | 226 +++++++++----------- reactos/lib/winmm/time.c | 9 +- reactos/lib/winmm/winmm.h | 52 +++++ reactos/lib/winmm/winmm.rc | 277 +++++++++++++++++++++++++ 8 files changed, 973 insertions(+), 128 deletions(-) create mode 100644 reactos/lib/winmm/midiin.c create mode 100644 reactos/lib/winmm/midiout.c create mode 100644 reactos/lib/winmm/midistream.c create mode 100644 reactos/lib/winmm/winmm.h diff --git a/reactos/lib/winmm/Makefile b/reactos/lib/winmm/Makefile index 67b47b966c3..01ad21b1f88 100644 --- a/reactos/lib/winmm/Makefile +++ b/reactos/lib/winmm/Makefile @@ -17,8 +17,10 @@ TARGET_SDKLIBS = ntdll.a kernel32.a TARGET_OBJECTS = \ dllmain.o \ + midiin.o \ + midiout.o \ time.o \ - misc/stubs.o +# misc/stubs.o include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/lib/winmm/midiin.c b/reactos/lib/winmm/midiin.c new file mode 100644 index 00000000000..29a700eaeaf --- /dev/null +++ b/reactos/lib/winmm/midiin.c @@ -0,0 +1,164 @@ +/* + * WinMM (midiin.c) : MIDI input related functions + * + * [8-18-2003] AG: Started adding stubs and implemented a few functions +*/ + +#include +typedef UINT *LPUINT; +#include + +#define NDEBUG +#include + + +#define IsValidMidiInHandle(hmi) \ + (((LPMidiInHandleInfo*)hmi < mi_HandleInfo) || \ + ((LPMidiInHandleInfo*)hmi >= mi_HandleInfo + (mi_HandleCount * sizeof(MidiInHandleInfo)))) + + +typedef struct MidiInDeviceInfo +{ + BOOL IsOpen; // Correct? +} MidiInDeviceInfo, *LPMidiInDeviceInfo; + +LPMidiInDeviceInfo *mi_DeviceInfo = NULL; +UINT mi_DeviceCount = 0; + + +typedef struct MidiInHandleInfo +{ + UINT DeviceID; // Needs to be first + BOOL IsOpen; +} MidiInHandleInfo, *LPMidiInHandleInfo; + + +// Array of MidiInHandleInfo structures +LPMidiInHandleInfo *mi_HandleInfo = NULL; +UINT mi_HandleCount = 0; + + +/* ------------------------------------------------------------------------- */ + +MMRESULT WINAPI midiInOpen( + LPHMIDIIN lphMidiIn, + UINT uDeviceID, + DWORD dwCallback, + DWORD dwCallbackInstance, + DWORD dwFlags) +{ + // TODO: Add device open checking and return MMSYSERR_ALLOCATED, but what + // happens for multi-client drivers? + + MidiInHandleInfo *Info = NULL; + int i; + + if (! lphMidiIn) + return MMSYSERR_INVALPARAM; + + if ((uDeviceID >= mi_DeviceCount) && (uDeviceID != MIDI_MAPPER)) + return MMSYSERR_BADDEVICEID; + + // Make sure we have a callback address if a callback is desired + if ((! dwCallback) && (dwFlags != CALLBACK_NULL)) + return MMSYSERR_INVALPARAM; + + + // Check existing handles to see if one is free + for (i = 0; i < mi_HandleCount; i ++) + if (! mi_HandleInfo[i]->IsOpen) + { + Info = mi_HandleInfo[i]; + break; + } + + // Allocate a new handle info structure + if (! Info) + { + mi_HandleCount ++; + + LPMidiInHandleInfo *Old = mi_HandleInfo; + + // File mapping stuff to replace this needed: +// if (! mi_HandleInfo) +// mi_HandleInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(MidiInHandleInfo) * mi_HandleCount); +// else +// mi_HandleInfo = HeapReAlloc(GetProcessHeap(), 0, mi_HandleInfo, sizeof(MidiInHandleInfo) * mi_HandleCount); + + if (! mi_HandleInfo) + { + mi_HandleCount --; + mi_HandleInfo = Old; + return MMSYSERR_NOMEM; // Correct? + } + + Info = mi_HandleInfo[mi_HandleCount - 1]; + } + + Info->DeviceID = uDeviceID; + + // Pretend we opened OK (really need to query device driver) + Info->IsOpen = TRUE; + + if (Info->IsOpen) + { + LPMIDICALLBACK mi_Proc = (LPMIDICALLBACK) dwCallback; + + switch(dwFlags) + { + case CALLBACK_FUNCTION : + mi_Proc((HMIDIIN) Info, MM_MOM_OPEN, dwCallbackInstance, 0, 0); + break; + + case CALLBACK_EVENT : + // Do something + break; + + case CALLBACK_THREAD : + // Do something + break; + + case CALLBACK_WINDOW : + // Do something + break; + } + } + + else + return MMSYSERR_ERROR; // Correct if can't be opened? + + // Copy the handle (really a pointer to Info): + *lphMidiIn = (HMIDIIN) Info; + + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiInClose(HMIDIIN hMidiIn) +{ + LPMidiInHandleInfo Info = NULL; + + if (IsValidMidiInHandle(hMidiIn)) + return MMSYSERR_INVALHANDLE; + + // Check if buffers still queued and return MIDIERR_STILLPLAYING if so... + // TODO + + Info = (LPMidiInHandleInfo) hMidiIn; + Info->IsOpen = FALSE; + + return MMSYSERR_NOERROR; +} + + +/* ------------------------------------------------------------------------- */ + +void mi_Init() +{ + // Internal routine for initializing MIDI-Out related stuff + + // Just set up a fake device for now + // FILE MAPPING! +// mi_DeviceCount ++; +// HeapAlloc(GetProcessHeap(), 0, sizeof(MidiInDeviceInfo) * mi_DeviceCount); +} diff --git a/reactos/lib/winmm/midiout.c b/reactos/lib/winmm/midiout.c new file mode 100644 index 00000000000..cb42a998526 --- /dev/null +++ b/reactos/lib/winmm/midiout.c @@ -0,0 +1,369 @@ +/* + * WinMM (midiout.c) : MIDI output related functions + * + * [8-18-2003] AG: Started adding stubs and implemented a few functions +*/ + +#include +typedef UINT *LPUINT; +#include +#include "winmm.h" + +#define NDEBUG +#include + + +#define IsValidMidiOutHandle(hmo) \ + (((LPMidiOutHandleInfo*)hmo < mo_HandleInfo) || \ + ((LPMidiOutHandleInfo*)hmo >= mo_HandleInfo + (mo_HandleCount * sizeof(MidiOutHandleInfo)))) + + +LPMidiOutDeviceInfo *mo_DeviceInfo = NULL; +UINT mo_DeviceCount = 0; +LPMidiOutHandleInfo *mo_HandleInfo = NULL; +UINT mo_HandleCount = 0; + + +/* ------------------------------------------------------------------------- */ + +MMRESULT WINAPI midiOutOpen( + LPHMIDIOUT lphmo, + UINT uDeviceID, + DWORD dwCallback, + DWORD dwCallbackInstance, + DWORD dwFlags) +{ + // TODO: Add device open checking and return MMSYSERR_ALLOCATED, but what + // happens for multi-client drivers? + // Also, MIDI_MAPPER needs to be implemented somehow... + + MidiOutHandleInfo *Info = NULL; + int i; + + if (! lphmo) + return MMSYSERR_INVALPARAM; + + if ((uDeviceID >= mo_DeviceCount) && (uDeviceID != MIDI_MAPPER)) + return MMSYSERR_BADDEVICEID; + + // Make sure we have a callback address if a callback is desired + if ((! dwCallback) && (dwFlags != CALLBACK_NULL)) + return MMSYSERR_INVALPARAM; + + + // Check existing handles to see if one is free + for (i = 0; i < mo_HandleCount; i ++) + if (! mo_HandleInfo[i]->IsOpen) + { + Info = mo_HandleInfo[i]; + break; + } + + // Allocate a new handle info structure + if (! Info) + { + mo_HandleCount ++; + + LPMidiOutHandleInfo *Old = mo_HandleInfo; + + // This was before I added file mapping stuff +// if (! mo_HandleInfo) +// mo_HandleInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(MidiOutHandleInfo) * mo_HandleCount); +// else +// mo_HandleInfo = HeapReAlloc(GetProcessHeap(), 0, mo_HandleInfo, sizeof(MidiOutHandleInfo) * mo_HandleCount); + + if (! mo_HandleInfo) + { + mo_HandleCount --; + mo_HandleInfo = Old; + return MMSYSERR_NOMEM; // Correct? + } + + Info = mo_HandleInfo[mo_HandleCount - 1]; + } + + Info->DeviceID = uDeviceID; + + // Pretend we opened OK (really need to query device driver) + Info->IsOpen = TRUE; + + if (Info->IsOpen) + { + LPMIDICALLBACK mo_Proc = (LPMIDICALLBACK) dwCallback; + + switch(dwFlags) + { + case CALLBACK_FUNCTION : + mo_Proc((HMIDIOUT) Info, MM_MOM_OPEN, dwCallbackInstance, 0, 0); + break; + + case CALLBACK_EVENT : + // Do something + break; + + case CALLBACK_THREAD : + // Do something + break; + + case CALLBACK_WINDOW : + // Do something + break; + } + } + + else + return MMSYSERR_ERROR; // Correct if can't be opened? + + // Copy the handle (really a pointer to Info): + *lphmo = (HMIDIOUT) Info; + + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutClose(HMIDIOUT hmo) +{ + LPMidiOutHandleInfo Info = NULL; + + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + // Check if buffers still queued and return MIDIERR_STILLPLAYING if so... + // TODO + + Info = (LPMidiOutHandleInfo) hmo; + Info->IsOpen = FALSE; + + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutGetDevCaps( + UINT uDeviceID, + LPMIDIOUTCAPS lpMidiOutCaps, + UINT cbMidiOutCaps) +{ + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutGetErrorText( + MMRESULT mmrError, + LPSTR lpText, + UINT cchText) +{ + if (! cchText) + return MMSYSERR_NOERROR; + + if (! lpText) + return MMSYSERR_INVALPARAM; + + if (((mmrError >= MMSYSERR_BASE) && (mmrError <= MMSYSERR_LASTERROR)) || + ((mmrError >= MIDIERR_BASE) && (mmrError <= MIDIERR_LASTERROR))) + { +// LoadString(GetModuleHandle(NULL), mmrError, lpText, cchText); // bytes/chars? + return MMSYSERR_NOERROR; + } + else + return MMSYSERR_BADERRNUM; +} + + +MMRESULT WINAPI midiOutGetID( + HMIDIOUT hmo, + LPUINT puDeviceID) +{ + // What triggers MMSYSERR_NODRIVER and MMSYSERR_NOMEM error codes? + + LPMidiOutHandleInfo Info = NULL; + + if (! puDeviceID) + return MMSYSERR_INVALPARAM; + + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + Info = (LPMidiOutHandleInfo) hmo; + *puDeviceID = Info->DeviceID; + + return MMSYSERR_NOERROR; +} + + +UINT WINAPI midiOutGetNumDevs(VOID) +{ + // +1 for MIDI_MAPPER : + return mo_DeviceCount ? mo_DeviceCount + 1 : 0; +} + + +MMRESULT WINAPI midiOutSetVolume( + HMIDIOUT hmo, + DWORD dwVolume) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutGetVolume( + HMIDIOUT hmo, + LPDWORD lpdwVolume) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutLongMsg( + HMIDIOUT hmo, + LPMIDIHDR lpMidiOutHdr, + UINT cbMidiOutHdr) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +// This is *supposed* to return a DWORD: +MMRESULT WINAPI midiOutMessage( + HMIDIOUT hmo, + UINT msg, + DWORD dw1, + DWORD dw2) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return 0; +} + + +MMRESULT WINAPI midiOutPrepareHeader( + HMIDIOUT hmo, + LPMIDIHDR lpMidiOutHdr, + UINT cbMidiOutHdr) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + if (! lpMidiOutHdr) + return MMSYSERR_INVALPARAM; + + if (! lpMidiOutHdr->lpData) + return MMSYSERR_INVALPARAM; + + // Yup, we're prepared! dwFlags must be 0 to begin with, so no | needed: + lpMidiOutHdr->dwFlags = MHDR_PREPARED; + + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutUnprepareHeader( + HMIDIOUT hmo, + LPMIDIHDR lpMidiOutHdr, + UINT cbMidiOutHdr) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + if (! lpMidiOutHdr) + return MMSYSERR_INVALPARAM; + + if (! lpMidiOutHdr->lpData) + return MMSYSERR_INVALPARAM; + + // We're unprepared! Clear the MHDR_PREPARED flag: + lpMidiOutHdr->dwFlags &= ! MHDR_PREPARED; + + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutReset(HMIDIOUT hmo) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutShortMsg( + HMIDIOUT hmo, + DWORD dwMsg) +{ + if (IsValidMidiOutHandle(hmo)) + return MMSYSERR_INVALHANDLE; + + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutCacheDrumPatches( + HMIDIOUT hmo, + UINT wPatch, + WORD* lpKeyArray, + UINT wFlags) +{ + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +MMRESULT WINAPI midiOutCachePatches( + HMIDIOUT hmo, + UINT wBank, + WORD* lpPatchArray, + UINT wFlags) +{ + UNIMPLEMENTED; + return MMSYSERR_NOERROR; +} + + +/* ------------------------------------------------------------------------- */ + +void mo_Init() +{ + // Internal routine for initializing MIDI-Out related stuff + + BOOL First; + HANDLE modi_fm, mohi_fm; + +// modi_fm = CreateFileMapping((HANDLE)0xFFFFFFFF, (LPSECURITY_ATTRIBUTES)NULL, +// PAGE_READWRITE, 0, 64 * 1024, FM_MIDI_OUT_DEV_INFO); + + First = ! GetLastError(); + +// mo_DeviceInfo = MapViewOfFile(modi_fm, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SomeStruct) + + if (First) + { + mo_DeviceInfo = MapViewOfFile(modi_fm, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(MidiOutDeviceInfo)); + + // Just set up a fake device for now + mo_DeviceCount ++; // need mapping for this +// mo_DeviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(MidiOutDeviceInfo) * mo_DeviceCount); + // Set info now + + UnmapViewOfFile(mo_DeviceInfo); + } + +// mohi_fm = CreateFileMapping((HANDLE)0xFFFFFFFF, (LPSECURITY_ATTRIBUTES)NULL, +// PAGE_READWRITE, 0, 64 * 1024, FM_MIDI_OUT_HANDLE_INFO); +} diff --git a/reactos/lib/winmm/midistream.c b/reactos/lib/winmm/midistream.c new file mode 100644 index 00000000000..e69de29bb2d diff --git a/reactos/lib/winmm/misc/stubs.c b/reactos/lib/winmm/misc/stubs.c index 2b3ec39182c..642a7499177 100644 --- a/reactos/lib/winmm/misc/stubs.c +++ b/reactos/lib/winmm/misc/stubs.c @@ -5,222 +5,202 @@ * Added more stubs for bochs 1.3 once again still mostly wrong * but bochs gets further now. 12-14-02 * + * [8-18-03] AG: I've added PlaySound/A/W and implemented sndPlaySoundA/W to + * call these. I've also tried to match the parameter names and types with the + * correct ones. + * */ #include - -DECLARE_HANDLE(HWAVEOUT); // mmsystem.h +typedef UINT *LPUINT; +#include +#define NDEBUG +#include #define NEAR #define FAR -typedef UINT MMRESULT; // error returncode, 0 means no error -typedef UINT MCIDEVICEID; /* MCI device ID type */ -typedef DWORD MCIERROR; - /* general constants */ #define MAXPNAMELEN 32 /* max product name length (including NULL) */ #define MAXERRORLENGTH 256 /* max error text length (including NULL) */ #define MAX_JOYSTICKOEMVXDNAME 260 /* max oem vxd name length (including NULL) */ -#define MMSYSERR_BASE 0 - -#define MMSYSERR_NOERROR 0 -#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) - -/* joystick device capabilities data structure */ -typedef struct tagJOYCAPSA { - WORD wMid; /* manufacturer ID */ - WORD wPid; /* product ID */ - CHAR szPname[MAXPNAMELEN];/* product name (NULL terminated string) */ - UINT wXmin; /* minimum x position value */ - UINT wXmax; /* maximum x position value */ - UINT wYmin; /* minimum y position value */ - UINT wYmax; /* maximum y position value */ - UINT wZmin; /* minimum z position value */ - UINT wZmax; /* maximum z position value */ - UINT wNumButtons; /* number of buttons */ - UINT wPeriodMin; /* minimum message period when captured */ - UINT wPeriodMax; /* maximum message period when captured */ - UINT wRmin; /* minimum r position value */ - UINT wRmax; /* maximum r position value */ - UINT wUmin; /* minimum u (5th axis) position value */ - UINT wUmax; /* maximum u (5th axis) position value */ - UINT wVmin; /* minimum v (6th axis) position value */ - UINT wVmax; /* maximum v (6th axis) position value */ - UINT wCaps; /* joystick capabilites */ - UINT wMaxAxes; /* maximum number of axes supported */ - UINT wNumAxes; /* number of axes in use */ - UINT wMaxButtons; /* maximum number of buttons supported */ - CHAR szRegKey[MAXPNAMELEN];/* registry key */ - CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; /* OEM VxD in use */ -} JOYCAPSA, *PJOYCAPSA, *NPJOYCAPSA, *LPJOYCAPSA; - -typedef struct joyinfoex_tag { - DWORD dwSize; /* size of structure */ - DWORD dwFlags; /* flags to indicate what to return */ - DWORD dwXpos; /* x position */ - DWORD dwYpos; /* y position */ - DWORD dwZpos; /* z position */ - DWORD dwRpos; /* rudder/4th axis position */ - DWORD dwUpos; /* 5th axis position */ - DWORD dwVpos; /* 6th axis position */ - DWORD dwButtons; /* button states */ - DWORD dwButtonNumber; /* current button number pressed */ - DWORD dwPOV; /* point of view state */ - DWORD dwReserved1; /* reserved for communication between winmm & driver */ - DWORD dwReserved2; /* reserved for future expansion */ -} JOYINFOEX, *PJOYINFOEX, NEAR *NPJOYINFOEX, FAR *LPJOYINFOEX; - // mmsystem.h ends here -UINT +MMRESULT WINAPI -waveOutReset(HWAVEOUT hWaveOut) +waveOutReset(HWAVEOUT hwo) { + // Possible return values: + // MMSYSERR_INVALHANDLE, MMSYSERR_NODRIVER, MMSYSERR_NOMEM, MMSYSERR_NOTSUPPORTED + DbgPrint("waveOutReset stub\n"); + UNIMPLEMENTED; return 1; } -UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, LPWAVEHDR pwh, + UINT cbwh) { + // Posible return values: + // MMSYSERR_INVALHANDLE, MMSYSERR_NODRIVER, MMSYSERR_NOMEM, WAVERR_UNPREPARED + DbgPrint("waveOutWrite stub\n"); + UNIMPLEMENTED; return 1; } +// PlaySound() needs exporting +#undef PlaySound -WINBOOL -STDCALL -sndPlaySoundA(LPCSTR pszSoundA, UINT uFlags) + +BOOL WINAPI +PlaySoundA(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound) { - DbgPrint("sndPlaySoundA stub\n"); - return 1; + DbgPrint("PlaySoundA stub\n"); + UNIMPLEMENTED; + return TRUE; } -WINBOOL -STDCALL -sndPlaySoundW(LPCSTR pszSoundA, UINT uFlags) + +BOOL WINAPI +PlaySoundW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound) { - DbgPrint("sndPlaySoundW stub\n"); - return 1; + DbgPrint("PlaySoundW stub\n"); + UNIMPLEMENTED; + return TRUE; } -WINBOOL -STDCALL -midiOutReset(HWAVEOUT hWaveOut) + +BOOL WINAPI +PlaySound(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound) +{ + // ANSI? + return PlaySoundA(pszSound, hmod, fdwSound); +} + + +BOOL +WINAPI +sndPlaySoundA(LPCSTR lpszSound, UINT fuSound) +{ + fuSound &= SND_ASYNC | SND_LOOP | SND_MEMORY | SND_NODEFAULT | SND_NOSTOP | SND_SYNC; + return PlaySoundA(lpszSound, NULL, fuSound); +} + +BOOL +WINAPI +sndPlaySoundW(LPCWSTR lpszSound, UINT fuSound) +{ + fuSound &= SND_ASYNC | SND_LOOP | SND_MEMORY | SND_NODEFAULT | SND_NOSTOP | SND_SYNC; + return PlaySoundW(lpszSound, NULL, fuSound); +} + +MMRESULT +WINAPI +midiOutReset(HMIDIOUT hmo) { DbgPrint("midiOutReset stub\n"); + UNIMPLEMENTED; return 1; } -WINBOOL -STDCALL -waveOutPrepareHeader(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +waveOutPrepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, + UINT cbwh) { DbgPrint("waveOutPrepareHeader stub\n"); + UNIMPLEMENTED; + pwh->dwFlags |= WHDR_PREPARED; return 1; } -WINBOOL -STDCALL -waveOutGetErrorTextA(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +waveOutGetErrorTextA(MMRESULT mmrError, LPSTR pszText, + UINT cchText) { DbgPrint("waveOutGetErrorTextA stub\n"); + UNIMPLEMENTED; return 1; } -WINBOOL -STDCALL -waveOutOpen(HWAVEOUT* lphWaveOut, UINT uDeviceID, - const lpFormat, DWORD dwCallback, - DWORD dwInstance, DWORD dwFlags) +MMRESULT +WINAPI +waveOutOpen(LPHWAVEOUT pwho, UINT uDeviceID, + LPCWAVEFORMATEX pwfx, DWORD dwCallback, + DWORD dwCallbackInstance, DWORD fdwOpen) { DbgPrint("waveOutOpen stub\n"); + UNIMPLEMENTED; return 1; } -UINT +MMRESULT WINAPI -waveOutClose(HWAVEOUT hWaveOut) +waveOutClose(HWAVEOUT hwo) { DbgPrint("waveOutClose stub\n"); return 1; } -WINBOOL -STDCALL -midiOutClose(HWAVEOUT hWaveOut) +MMRESULT +WINAPI +midiOutClose(HMIDIOUT hmo) { DbgPrint("midiOutClose stub\n"); return 1; } -WINBOOL -STDCALL -midiOutUnprepareHeader(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +midiOutUnprepareHeader(HWAVEOUT hwo, LPMIDIHDR pwh, + UINT cbwh) { DbgPrint("midiOutUnprepareHeader stub\n"); return 1; } -WINBOOL -STDCALL -waveOutUnprepareHeader(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +waveOutUnprepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, + UINT cbwh) { DbgPrint("waveOutUnprepareHeader stub\n"); + pwh->dwFlags &= ! WHDR_PREPARED; return 1; } -WINBOOL -STDCALL -midiOutPrepareHeader(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +midiOutPrepareHeader(HMIDIOUT hmo, LPMIDIHDR lpMidiOutHdr, + UINT cbMidiOutHdr) { DbgPrint("midiOutPrepareHeader stub\n"); return 1; } -WINBOOL -STDCALL -midiOutLongMsg(HWAVEOUT hWaveOut, LPCSTR pszSoundA, - UINT uSize) +MMRESULT +WINAPI +midiOutLongMsg(HMIDIOUT hmo, LPMIDIHDR lpMidiOutHdr, + UINT cbMidiOutHdr) { DbgPrint("midiOutLongMsg stub\n"); return 1; } -UINT/*MMRESULT*/ -STDCALL -timeBeginPeriod(UINT uPeriod) -{ - DbgPrint("timeBeginPeriod stub\n"); - return 97/*TIMERR_NOCANDO*/; -} - DWORD -STDCALL +WINAPI timeGetTime(VOID) { DbgPrint("timeGetTime stub\n"); return 0; } -UINT/*MMRESULT*/ -STDCALL -timeEndPeriod(UINT uPeriod) -{ - DbgPrint("timeEndPeriod stub\n"); - return 97/*TIMERR_NOCANDO*/; -} - MMRESULT WINAPI joyGetDevCapsA(UINT uJoyID, LPJOYCAPSA pjc, UINT cbjc) { DbgPrint("joyGetDevCapsA stub\n"); diff --git a/reactos/lib/winmm/time.c b/reactos/lib/winmm/time.c index d50197bd56c..b62daf37f8e 100644 --- a/reactos/lib/winmm/time.c +++ b/reactos/lib/winmm/time.c @@ -2,13 +2,14 @@ However, this should work fine for our needs */ #include -#include +typedef UINT *LPUINT; +#include /* This is what it seems to be on my machine. (WinXP) */ #define MMSYSTIME_MININTERVAL 1 #define MMSYSTIME_MAXINTERVAL 1000000 -MMRESULT timeGetDevCaps( +MMRESULT WINAPI timeGetDevCaps( LPTIMECAPS ptc, UINT cbtc ) @@ -19,7 +20,7 @@ MMRESULT timeGetDevCaps( return TIMERR_NOERROR; } -MMRESULT timeBeginPeriod( +MMRESULT WINAPI timeBeginPeriod( UINT uPeriod ) { @@ -29,7 +30,7 @@ MMRESULT timeBeginPeriod( return TIMERR_NOERROR; } -MMRESULT timeEndPeriod( +MMRESULT WINAPI timeEndPeriod( UINT uPeriod ) { diff --git a/reactos/lib/winmm/winmm.h b/reactos/lib/winmm/winmm.h new file mode 100644 index 00000000000..b70a0bddda7 --- /dev/null +++ b/reactos/lib/winmm/winmm.h @@ -0,0 +1,52 @@ +/* + * WinMM (winmm.h) : Common internal header + * + * [8-18-2003] AG: Created + */ + + +#include + + +// These are the memory-mapped file names used +#define FM_WINMM_GENERAL_INFO "WINMM_000" +#define FM_MIDI_IN_DEV_INFO "WINMM_001" +#define FM_MIDI_IN_HANDLE_INFO "WINMM_002" +#define FM_MIDI_OUT_DEV_INFO "WINMM_003" +#define FM_MIDI_OUT_HANDLE_INFO "WINMM_004" +#define FM_WAVE_IN_DEV_INFO "WINMM_005" +#define FM_WAVE_IN_HANDLE_INFO "WINMM_006" +#define FM_WAVE_OUT_DEV_INFO "WINMM_007" +#define FM_WAVE_OUT_HANDLE_INFO "WINMM_008" + + + +typedef struct // WINMM_000 +{ + UINT MidiInDeviceCount; + UINT MidiInHandleCount; + UINT MidiOutDeviceCount; + UINT MidiOutHandleCount; + UINT WaveInDeviceCount; + UINT WaveInHandleCount; + UINT WaveOutDeviceCount; + UINT WaveOutHandleCount; +} WinMMGeneralInfo, *LPWinMMGeneralInfo; + + +typedef struct // WINMM_003 +{ + BOOL IsOpen; // Correct? +} MidiOutDeviceInfo, *LPMidiOutDeviceInfo; + +typedef struct // WINMM_004 +{ + UINT DeviceID; // Needs to be first + BOOL IsOpen; +} MidiOutHandleInfo, *LPMidiOutHandleInfo; + + + +// Initialization routines +void mi_Init(); +void mo_Init(); diff --git a/reactos/lib/winmm/winmm.rc b/reactos/lib/winmm/winmm.rc index b40fb9e6e27..c3b31d02220 100644 --- a/reactos/lib/winmm/winmm.rc +++ b/reactos/lib/winmm/winmm.rc @@ -1,8 +1,285 @@ #include #include +#include LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +/* + * These strings are exactly as the original winmm's. I think we might be + * able to improve on them, as most of them are meaningless to the end + * user! +*/ + +STRINGTABLE +{ + MMSYSERR_NOERROR, "The specified command was carried out." + MMSYSERR_ERROR, "Undefined external error." + MMSYSERR_BADDEVICEID, "A device ID has been used that is out of range for your system." + MMSYSERR_NOTENABLED, "The driver was not enabled." + MMSYSERR_ALLOCATED, "The specified device is already in use. Wait until it is free, and then try again." + MMSYSERR_INVALHANDLE, "The specified device handle is invalid." + MMSYSERR_NODRIVER, "There is no driver installed on your system." + MMSYSERR_NOMEM, "There is not enough memory available for this tak. Quit one or more applications to increase available memory, and then try again." + MMSYSERR_NOTSUPPORTED, "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports." + MMSYSERR_BADERRNUM, "An error number was specified that is not defined in the system." + MMSYSERR_INVALFLAG, "An invalid flag was passed to a system function." + MMSYSERR_INVALPARAM, "An invalid parameter was passed to a system function." + MMSYSERR_HANDLEBUSY, "Handle being used simultaneously on another thread (eg callback)." + MMSYSERR_INVALIDALIAS, "Specified alias not found in WIN.INI." + MMSYSERR_BADDB, "The registry database is corrupt." + MMSYSERR_KEYNOTFOUND, "The specified registry key was not found." +} + +STRINGTABLE +{ + MMSYSERR_READERROR, "The registry could not be opened or could not be read." + MMSYSERR_WRITEERROR, "The registry could not be written to." + MMSYSERR_DELETEERROR, "The specified registry key could not be deleted." + MMSYSERR_VALNOTFOUND, "The specified registry key value could not be found." + MMSYSERR_NODRIVERCB, "The driver did not generate a valid OPEN callback." +} + +STRINGTABLE +{ + WAVERR_BADFORMAT, "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats." + WAVERR_STILLPLAYING, "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing." + WAVERR_UNPREPARED, "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again." + WAVERR_SYNC, "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again." +} + +STRINGTABLE +{ + MIDIERR_UNPREPARED, "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again." + MIDIERR_STILLPLAYING, "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing." + MIDIERR_NOMAP, "A MIDI map was not found. There may be a problem with the driver, or the MIDIMAP.CFG file may be corrupt or missing." + MIDIERR_NOTREADY, "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again." + MIDIERR_NODEVICE, "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup." + MIDIERR_INVALIDSETUP, "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again." + MIDIERR_BADOPENMODE, "A MIDI call was made which is invalid with the current open mode. Reopen the device with the correct mode." + MIDIERR_DONT_CONTINUE, "Driver condition - do not callback this input event" +} + + +STRINGTABLE +{ + MCIERR_INVALID_DEVICE_ID, "Invalid MCI device ID. Use the ID returned when opening the MCI device." + MCIERR_UNRECOGNIZED_KEYWORD, "The driver cannot recognize the specified command parameter." + MCIERR_UNRECOGNIZED_COMMAND, "The driver cannot recognize the specified command." + MCIERR_HARDWARE, "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer." + MCIERR_INVALID_DEVICE_NAME, "The specified device is not open or is not recognized by MCI." + MCIERR_OUT_OF_MEMORY, "Not enough memory available for this task.\n\nQuit one or more applications to increase available memory, and then try again." + MCIERR_DEVICE_OPEN, "The device name is already being used as an alias by this application. Use a unique alias." + MCIERR_CANNOT_LOAD_DRIVER, "Unknown problem while loading the specified device driver." + MCIERR_MISSING_COMMAND_STRING, "No command was specified." + MCIERR_PARAM_OVERFLOW, "The output string was too large to fit in the return buffer. Increase the size of the buffer." + MCIERR_MISSING_STRING_ARGUMENT, "The specified command requires a character-string parameter. Please provide one." + MCIERR_BAD_INTEGER, "The specified integer is invalid for this command." + MCIERR_PARSER_INTERNAL, "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver." +} + +STRINGTABLE +{ + MCIERR_DRIVER_INTERNAL, "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver." + MCIERR_MISSING_PARAMETER, "The specified command requires a parameter. Please supply one." + MCIERR_UNSUPPORTED_FUNCTION, "The MCI device you are using does not support the specified command." + MCIERR_FILE_NOT_FOUND, "Cannot find the specified file. Make sure the path and filename are correct." + MCIERR_DEVICE_NOT_READY, "The device driver is not ready." + MCIERR_INTERNAL, "A problem occurred in initializing MCI." + MCIERR_DRIVER, "There is a problem with the device driver. The driver has closed. Cannot access error." + MCIERR_CANNOT_USE_ALL, "Cannot use 'all' as the device name with the specified command." + MCIERR_MULTIPLE, "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the errors." + MCIERR_EXTENSION_NOT_FOUND, "Cannot determine the device type from the given filename extension." + MCIERR_OUTOFRANGE, "The specified parameter is out of range for the specified command." + MCIERR_FLAGS_NOT_COMPATIBLE, "The specified parameters cannot be used together." + MCIERR_FILE_NOT_SAVED, "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network." + MCIERR_DEVICE_TYPE_REQUIRED, "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly." +} + + +STRINGTABLE +{ + MCIERR_DEVICE_LOCKED, "The specified device is now being closed. Wait a few seconds, and then try again." + MCIERR_DUPLICATE_ALIAS, "The specified alias is already being used in this application. Use a unique alias." + MCIERR_BAD_CONSTANT, "The specified parameter is invalid for this command." + MCIERR_MUST_USE_SHAREABLE, "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command." + MCIERR_MISSING_DEVICE_NAME, "The specified command requires an alias, file, driver, or device name. Please supply one." + MCIERR_BAD_TIME_FORMAT, "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats." + MCIERR_NO_CLOSING_QUOTE, "A closing double-quotation mark is missing from the parameter value. Please supply one." + MCIERR_DUPLICATE_FLAGS, "A parameter or value was specified twice. Only specify it once." + MCIERR_INVALID_FILE, "The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler available for this format." + MCIERR_NULL_PARAMETER_BLOCK, "A null parameter block was passed to MCI." + MCIERR_UNNAMED_RESOURCE, "Cannot save an unnamed file. Supply a filename." + MCIERR_NEW_REQUIRES_ALIAS, "You must specify an alias when using the 'new' parameter." + MCIERR_NOTIFY_ON_AUTO_OPEN, "Cannot use the 'notify' flag with auto-opened devices." + MCIERR_NO_ELEMENT_ALLOWED, "Cannot use a filename with the specified device." + MCIERR_NONAPPLICABLE_FUNCTION, "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again." + MCIERR_ILLEGAL_FOR_AUTO_OPEN, "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again." +} + +STRINGTABLE +{ + MCIERR_FILENAME_REQUIRED, "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension." + MCIERR_EXTRA_CHARACTERS, "Cannot specify extra characters after a string enclosed in quotation marks." + MCIERR_DEVICE_NOT_INSTALLED, "The specified device is not installed on the system. Use the Add/Remove Hardware Wizard in Control Panel to install the device." + MCIERR_GET_CD, "Cannot access the specified file or MCI device. Try changing directories or restarting your computer." + MCIERR_SET_CD, "Cannot access the specified file or MCI device because the application cannot change directories." + MCIERR_SET_DRIVE, "Cannot access specified file or MCI device because the application cannot change drives." + MCIERR_DEVICE_LENGTH, "Specify a device or driver name that is less than 79 characters." + MCIERR_DEVICE_ORD_LENGTH, "Specify a device or driver name that is less than 69 characters." + MCIERR_NO_INTEGER, "The specified command requires an integer parameter. Please provide one." +} + + +STRINGTABLE +{ + MCIERR_WAVE_OUTPUTSINUSE, "All wave devices that can play files in the current format are in use. Wait until a wave device is free, and then try again." + MCIERR_WAVE_SETOUTPUTINUSE, "Cannot set the current wave device for play back because it is in use. Wait until the device is free, and then try again." + MCIERR_WAVE_INPUTSINUSE, "All wave devices that can record files in the current format are in use. Wait until a wave device is free, and then try again." + MCIERR_WAVE_SETINPUTINUSE, "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again." + MCIERR_WAVE_OUTPUTUNSPECIFIED, "Any compatible waveform playback device may be used." + MCIERR_WAVE_INPUTUNSPECIFIED, "Any compatible waveform recording device may be used." + MCIERR_WAVE_OUTPUTSUNSUITABLE, "No wave device that can play files in the current format is installed. Use the Add/Remove Hardware Wizard in Control Panel to install the wave device." + MCIERR_WAVE_SETOUTPUTUNSUITABLE,"The device you are trying to play to cannot recognize the current file format." + MCIERR_WAVE_INPUTSUNSUITABLE, "No wave device that can record files in the current format is installed. Use the Add/Remove Hardware Wizard in Control Panel to install the wave device." + MCIERR_WAVE_SETINPUTUNSUITABLE, "The device you are trying to record from cannot recognize the current file format." +} + + +STRINGTABLE +{ + MCIERR_SEQ_DIV_INCOMPATIBLE, "Cannot use the song-pointer time format and the SMPTE time-format together." + MCIERR_SEQ_PORT_INUSE, "The specified MIDI device is already in use. Wait until it is free, and then try again." + MCIERR_SEQ_PORT_NONEXISTENT, "The specified MIDI device is not installed on the system. Use the Add/Remove Hardware Wizard in Control Panel to install the driver." + MCIERR_SEQ_PORT_MAPNODEVICE, "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup." + MCIERR_SEQ_PORT_MISCERROR, "An error occurred using the specified port." + MCIERR_SEQ_TIMER, "All multimedia timers are being used by other applications. Quit one of these applications, and then try again." + MCIERR_SEQ_PORTUNSPECIFIED, "There is no current MIDI port." + MCIERR_SEQ_NOMIDIPRESENT, "There are no MIDI devices installed on the system. Use the Add/Remove Hardware Wizard in Control Panel to install the driver." + MCIERR_NO_WINDOW, "There is no display window." + MCIERR_CREATEWINDOW, "Could not create or use window." + MCIERR_FILE_READ, "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection." + MCIERR_FILE_WRITE, "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network." + MCIERR_NO_IDENTITY, "Cannot determine media identity or universal product code." +} + +STRINGTABLE +{ +MCI_DEVTYPE_VCR, "vcr" +MCI_DEVTYPE_VIDEODISC, "videodisc" +MCI_DEVTYPE_OVERLAY, "overlay" +MCI_DEVTYPE_CD_AUDIO, "cdaudio" +MCI_DEVTYPE_DAT, "dat" +MCI_DEVTYPE_SCANNER, "scanner" +MCI_DEVTYPE_ANIMATION, "animation" +MCI_DEVTYPE_DIGITAL_VIDEO, "digitalvideo" +MCI_DEVTYPE_OTHER, "other" +MCI_DEVTYPE_WAVEFORM_AUDIO, "waveaudio" +MCI_DEVTYPE_SEQUENCER, "sequencer" +MCI_MODE_NOT_READY, "not ready" +MCI_MODE_STOP, "stopped" +MCI_MODE_PLAY, "playing" +MCI_MODE_RECORD, "recording" +} + +STRINGTABLE +{ +MCI_MODE_SEEK, "seeking" +MCI_MODE_PAUSE, "paused" +MCI_MODE_OPEN, "open" +531, "false" +532, "true" +533, "milliseconds" +534, "hms" +535, "msf" +536, "frames" +537, "smpte 24" +538, "smpte 25" +539, "smpte 30" +540, "smpte 30 drop" +541, "bytes" +542, "samples" +543, "tmsf" +} + +STRINGTABLE +{ +1025, "parked" +1026, "CLV" +1027, "CAV" +1028, "other" +1029, "track" +} + +STRINGTABLE +{ +1152, "pcm" +1153, "mapper" +} + +STRINGTABLE +{ +1216, "PPQN" +1217, "SMPTE 24 Frame" +1218, "SMPTE 25 Frame" +1219, "SMPTE 30 Drop Frame" +1220, "SMPTE 30 Frame" +1222, "file" +1223, "midi" +1224, "smpte" +1225, "song pointer" +1226, "none" +1227, "mapper" +} + +STRINGTABLE +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +{ +2001, "Unknown error returned from MCI command" +} + +STRINGTABLE +{ +3000, "SystemAsterisk" +3001, "SystemQuestion" +3002, "SystemHand" +3003, "SystemExit" +3004, "SystemStart" +3006, "SystemExclamation" +3007, ".Default" +} + +STRINGTABLE +{ +3008, "Program error" +3009, "Close program" +3010, "Empty Recycle Bin" +3011, "Maximize" +3012, "Menu command" +3013, "Menu popup" +3014, "Minimize" +3015, "Open program" +3016, "Restore Down" +3017, "Restore Up" +3018, "Incoming Call" +3019, "Outgoing Call" +3020, "Asterisk" +3021, "Default Beep" +3022, "Exclamation" +3023, "Exit Windows" +} + +STRINGTABLE +{ +3024, "Critical Stop" +3025, "Question" +3026, "Start Windows" +3027, "Windows" +3028, "Windows Explorer" +} + + + VS_VERSION_INFO VERSIONINFO FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD