this patch will help compiling winmm with non-wine headers A+ -- Eric Pouech
Name: mm_inc ChangeLog: - Moved wine's extension to get DSound interface from a wave device from include/mmsystem.h to include/mmddk.h - Removed all dependencies on heap.h - Fixed a few prototypes (mmioRename[AW], mciSendStringW, *Message) License: X11 GenDate: 2003/09/13 18:56:15 UTC ModifiedFiles: include/mmsystem.h include/mmddk.h dlls/msvideo/msvideo_main.c dlls/winmm/driver.c dlls/winmm/mci.c dlls/winmm/mmio.c dlls/winmm/mmsystem.c dlls/winmm/winemm.h dlls/winmm/winmm.c dlls/winmm/winmm.spec =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/include/mmsystem.h,v retrieving revision 1.68 diff -u -u -r1.68 mmsystem.h --- include/mmsystem.h 12 Sep 2003 00:24:16 -0000 1.68 +++ include/mmsystem.h 12 Sep 2003 17:25:27 -0000 @@ -297,9 +297,6 @@ #define WAVE_MAPPED 0x0004 #define WAVE_FORMAT_DIRECT 0x0008 #define WAVE_FORMAT_DIRECT_QUERY (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT) -#ifdef __WINESRC__ -#define WAVE_DIRECTSOUND 0x0080 -#endif typedef struct wavehdr_tag { LPSTR lpData; /* pointer to locked data buffer */ @@ -449,7 +446,7 @@ UINT WINAPI waveOutGetPlaybackRate(HWAVEOUT,DWORD*); UINT WINAPI waveOutSetPlaybackRate(HWAVEOUT,DWORD); UINT WINAPI waveOutGetID(HWAVEOUT,UINT*); -DWORD WINAPI waveOutMessage(HWAVEOUT,UINT,DWORD,DWORD); +UINT WINAPI waveOutMessage(HWAVEOUT,UINT,DWORD,DWORD); UINT WINAPI waveInGetNumDevs(void); UINT WINAPI waveInGetDevCapsA(UINT,LPWAVEINCAPSA,UINT); UINT WINAPI waveInGetDevCapsW(UINT,LPWAVEINCAPSW,UINT); @@ -467,7 +464,7 @@ UINT WINAPI waveInReset(HWAVEIN); UINT WINAPI waveInGetPosition(HWAVEIN,LPMMTIME,UINT); UINT WINAPI waveInGetID(HWAVEIN,UINT*); -DWORD WINAPI waveInMessage(HWAVEIN,UINT,DWORD,DWORD); +UINT WINAPI waveInMessage(HWAVEIN,UINT,DWORD,DWORD); #define MIDIERR_UNPREPARED (MIDIERR_BASE + 0) /* header not prepared */ #define MIDIERR_STILLPLAYING (MIDIERR_BASE + 1) /* still something playing */ @@ -646,7 +643,7 @@ UINT WINAPI midiOutCachePatches(HMIDIOUT,UINT,WORD*,UINT); UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT,UINT,WORD*,UINT); UINT WINAPI midiOutGetID(HMIDIOUT,UINT*); -DWORD WINAPI midiOutMessage(HMIDIOUT,UINT,DWORD,DWORD); +UINT WINAPI midiOutMessage(HMIDIOUT,UINT,DWORD,DWORD); UINT WINAPI midiInGetNumDevs(void); UINT WINAPI midiInGetDevCapsA(UINT,LPMIDIINCAPSA,UINT); @@ -664,7 +661,7 @@ UINT WINAPI midiInStop(HMIDIIN); UINT WINAPI midiInReset(HMIDIIN); UINT WINAPI midiInGetID(HMIDIIN,UINT*); -DWORD WINAPI midiInMessage(HMIDIIN,UINT,DWORD,DWORD); +UINT WINAPI midiInMessage(HMIDIIN,UINT,DWORD,DWORD); MMRESULT WINAPI midiStreamClose(HMIDISTRM hms); MMRESULT WINAPI midiStreamOpen(HMIDISTRM* phms, LPUINT uDeviceID, DWORD cMidi, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen); @@ -712,7 +709,7 @@ #define auxGetDevCaps WINELIB_NAME_AW(auxGetDevCaps) UINT WINAPI auxSetVolume(UINT,DWORD); UINT WINAPI auxGetVolume(UINT,LPDWORD); -DWORD WINAPI auxOutMessage(UINT,UINT,DWORD,DWORD); +UINT WINAPI auxOutMessage(UINT,UINT,DWORD,DWORD); #define TIMERR_NOERROR (0) /* no error */ #define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */ @@ -1389,9 +1386,9 @@ #define mmioOpen WINELIB_NAME_AW(mmioOpen) MMRESULT WINAPI mmioRenameA(LPCSTR szFileName, LPCSTR szNewFileName, - MMIOINFO * lpmmioinfo, DWORD dwRenameFlags); + const MMIOINFO * lpmmioinfo, DWORD dwRenameFlags); MMRESULT WINAPI mmioRenameW(LPCWSTR szFileName, LPCWSTR szNewFileName, - MMIOINFO * lpmmioinfo, DWORD dwRenameFlags); + const MMIOINFO * lpmmioinfo, DWORD dwRenameFlags); #define mmioRename WINELIB_NAME_AW(mmioRename) MMRESULT WINAPI mmioClose(HMMIO,UINT); @@ -1414,7 +1411,7 @@ DWORD WINAPI mciSendCommandW(UINT,UINT,DWORD,DWORD); #define mciSendCommand WINELIB_NAME_AW(mciSendCommand) DWORD WINAPI mciSendStringA(LPCSTR,LPSTR,UINT,HWND); -DWORD WINAPI mciSendStringW(LPCWSTR,LPSTR,UINT,HWND); +DWORD WINAPI mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND); #define mciSendString WINELIB_NAME_AW(mciSendString) UINT WINAPI mciGetDeviceIDA(LPCSTR); UINT WINAPI mciGetDeviceIDW(LPCWSTR); Index: include/mmddk.h =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/include/mmddk.h,v retrieving revision 1.17 diff -u -u -r1.17 mmddk.h --- include/mmddk.h 28 Aug 2003 21:43:35 -0000 1.17 +++ include/mmddk.h 30 Aug 2003 11:52:02 -0000 @@ -439,6 +439,10 @@ BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); +#ifdef __WINESRC__ +#define WAVE_DIRECTSOUND 0x0080 +#endif + #include <poppack.h> #endif /* __MMDDK_H */ Index: dlls/winmm/driver.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/driver.c,v retrieving revision 1.23 diff -u -u -r1.23 driver.c --- dlls/winmm/driver.c 11 Nov 2002 19:53:01 -0000 1.23 +++ dlls/winmm/driver.c 6 Sep 2003 06:19:02 -0000 @@ -23,10 +23,12 @@ */ #include <string.h> -#include "heap.h" +#include <stdarg.h> #include "windef.h" +#include "winbase.h" #include "wingdi.h" #include "winuser.h" +#include "winnls.h" #include "mmddk.h" #include "winemm.h" #include "wine/debug.h" @@ -326,9 +328,28 @@ */ HDRVR WINAPI OpenDriverW(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam) { - LPSTR dn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDriverName); - LPSTR sn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpSectionName); - HDRVR ret = OpenDriverA(dn, sn, lParam); + INT len; + LPSTR dn = NULL; + LPSTR sn = NULL; + HDRVR ret; + + if (lpDriverName) + { + len = WideCharToMultiByte( CP_ACP, 0, lpDriverName, -1, NULL, 0, NULL, NULL ); + dn = HeapAlloc( GetProcessHeap(), 0, len ); + if (!dn) return 0; + WideCharToMultiByte( CP_ACP, 0, lpDriverName, -1, dn, len, NULL, NULL ); + } + + if (lpSectionName) + { + len = WideCharToMultiByte( CP_ACP, 0, lpSectionName, -1, NULL, 0, NULL, NULL ); + sn = HeapAlloc( GetProcessHeap(), 0, len ); + if (!sn) return 0; + WideCharToMultiByte( CP_ACP, 0, lpSectionName, -1, sn, len, NULL, NULL ); + } + + ret = OpenDriverA(dn, sn, lParam); if (dn) HeapFree(GetProcessHeap(), 0, dn); if (sn) HeapFree(GetProcessHeap(), 0, sn); Index: dlls/winmm/mci.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mci.c,v retrieving revision 1.45 diff -u -u -r1.45 mci.c --- dlls/winmm/mci.c 10 Sep 2003 03:56:47 -0000 1.45 +++ dlls/winmm/mci.c 10 Sep 2003 19:32:32 -0000 @@ -1050,10 +1073,11 @@ /************************************************************************** * mciSendStringW [WINMM.@] */ -DWORD WINAPI mciSendStringW(LPCWSTR lpwstrCommand, LPSTR lpstrRet, +DWORD WINAPI mciSendStringW(LPCWSTR lpwstrCommand, LPWSTR lpwstrRet, UINT uRetLen, HWND hwndCallback) { LPSTR lpstrCommand; + LPSTR lpstrRet = NULL; UINT ret; INT len; @@ -1061,8 +1085,16 @@ len = WideCharToMultiByte( CP_ACP, 0, lpwstrCommand, -1, NULL, 0, NULL, NULL ); lpstrCommand = HeapAlloc( GetProcessHeap(), 0, len ); WideCharToMultiByte( CP_ACP, 0, lpwstrCommand, -1, lpstrCommand, len, NULL, NULL ); + if (lpwstrRet) + { + lpstrRet = HeapAlloc(GetProcessHeap(), 0, uRetLen * sizeof(WCHAR)); + if (!lpstrRet) return MMSYSERR_NOMEM; + } ret = mciSendStringA(lpstrCommand, lpstrRet, uRetLen, hwndCallback); + if (lpwstrRet) + MultiByteToWideChar( CP_ACP, 0, lpstrRet, -1, lpwstrRet, uRetLen ); HeapFree(GetProcessHeap(), 0, lpstrCommand); + if (lpstrRet) HeapFree(GetProcessHeap(), 0, lpstrRet); return ret; } Index: dlls/winmm/mmio.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmio.c,v retrieving revision 1.40 diff -u -u -r1.40 mmio.c --- dlls/winmm/mmio.c 5 Sep 2003 23:08:28 -0000 1.40 +++ dlls/winmm/mmio.c 6 Sep 2003 06:01:46 -0000 @@ -38,8 +38,8 @@ #include "windef.h" #include "winbase.h" +#include "winnls.h" #include "mmsystem.h" -#include "heap.h" #include "winemm.h" #include "wine/debug.h" @@ -686,7 +686,15 @@ DWORD dwOpenFlags) { HMMIO ret; - LPSTR szFn = HEAP_strdupWtoA(GetProcessHeap(), 0, szFileName); + LPSTR szFn = NULL; + + if (szFileName) + { + INT len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1, NULL, 0, NULL, NULL ); + szFn = HeapAlloc( GetProcessHeap(), 0, len ); + if (!szFn) return (HMMIO)NULL; + WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len, NULL, NULL ); + } ret = MMIO_Open(szFn, lpmmioinfo, dwOpenFlags, MMIO_PROC_32W); @@ -1063,11 +1071,10 @@ */ FOURCC WINAPI mmioStringToFOURCCW(LPCWSTR sz, UINT uFlags) { - LPSTR szA = HEAP_strdupWtoA(GetProcessHeap(),0,sz); - FOURCC ret = mmioStringToFOURCCA(szA,uFlags); + char szA[4]; - HeapFree(GetProcessHeap(), 0, szA); - return ret; + WideCharToMultiByte( CP_ACP, 0, sz, 4 * sizeof(WCHAR), szA, sizeof(szA), NULL, NULL ); + return mmioStringToFOURCCA(szA,uFlags); } /************************************************************************** @@ -1299,20 +1306,24 @@ * mmioRenameA [WINMM.@] */ MMRESULT WINAPI mmioRenameA(LPCSTR szFileName, LPCSTR szNewFileName, - MMIOINFO* lpmmioinfo, DWORD dwFlags) + const MMIOINFO* lpmmioinfo, DWORD dwFlags) { struct IOProcList* ioProc = NULL; struct IOProcList tmp; + FOURCC fcc; TRACE("('%s', '%s', %p, %08lX);\n", debugstr_a(szFileName), debugstr_a(szNewFileName), lpmmioinfo, dwFlags); /* If both params are NULL, then parse the file name */ if (lpmmioinfo && lpmmioinfo->fccIOProc == 0 && lpmmioinfo->pIOProc == NULL) - lpmmioinfo->fccIOProc = MMIO_ParseExtA(szFileName); + { + fcc = MMIO_ParseExtA(szFileName); + if (fcc) ioProc = MMIO_FindProcNode(fcc); + } /* Handle any unhandled/error case from above. Assume DOS file */ - if (!lpmmioinfo || (lpmmioinfo->fccIOProc == 0 && lpmmioinfo->pIOProc == NULL)) + if (!lpmmioinfo || (lpmmioinfo->fccIOProc == 0 && lpmmioinfo->pIOProc == NULL && ioProc == NULL)) ioProc = MMIO_FindProcNode(FOURCC_DOS); /* if just the four character code is present, look up IO proc */ else if (lpmmioinfo->pIOProc == NULL) @@ -1326,7 +1337,10 @@ tmp.count = 1; } - return send_message(ioProc, lpmmioinfo, MMIOM_RENAME, + /* FIXME: should we actually pass lpmmioinfo down the drain ??? + * or make a copy of it because it's const ??? + */ + return send_message(ioProc, (LPMMIOINFO)lpmmioinfo, MMIOM_RENAME, (LPARAM)szFileName, (LPARAM)szNewFileName, MMIO_PROC_32A); } @@ -1334,11 +1348,29 @@ * mmioRenameW [WINMM.@] */ MMRESULT WINAPI mmioRenameW(LPCWSTR szFileName, LPCWSTR szNewFileName, - MMIOINFO* lpmmioinfo, DWORD dwFlags) + const MMIOINFO* lpmmioinfo, DWORD dwFlags) { - LPSTR szFn = HEAP_strdupWtoA(GetProcessHeap(), 0, szFileName); - LPSTR sznFn = HEAP_strdupWtoA(GetProcessHeap(), 0, szNewFileName); - UINT ret = mmioRenameA(szFn, sznFn, lpmmioinfo, dwFlags); + LPSTR szFn = NULL; + LPSTR sznFn = NULL; + UINT ret; + INT len; + + if (szFileName) + { + len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1, NULL, 0, NULL, NULL ); + szFn = HeapAlloc( GetProcessHeap(), 0, len ); + if (!szFn) return MMSYSERR_NOMEM; + WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len, NULL, NULL ); + } + if (szNewFileName) + { + len = WideCharToMultiByte( CP_ACP, 0, szNewFileName, -1, NULL, 0, NULL, NULL ); + sznFn = HeapAlloc( GetProcessHeap(), 0, len ); + if (!sznFn) return MMSYSERR_NOMEM; + WideCharToMultiByte( CP_ACP, 0, szNewFileName, -1, sznFn, len, NULL, NULL ); + } + + ret = mmioRenameA(szFn, sznFn, lpmmioinfo, dwFlags); HeapFree(GetProcessHeap(),0,szFn); HeapFree(GetProcessHeap(),0,sznFn); Index: dlls/winmm/mmsystem.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v retrieving revision 1.95 diff -u -u -r1.95 mmsystem.c --- dlls/winmm/mmsystem.c 10 Sep 2003 03:56:47 -0000 1.95 +++ dlls/winmm/mmsystem.c 10 Sep 2003 19:32:32 -0000 @@ -38,10 +38,10 @@ #include "ntstatus.h" #include "winternl.h" #include "wownt32.h" +#include "winnls.h" #include "wine/winuser16.h" #include "winemm.h" -#include "heap.h" #include "wine/debug.h" @@ -2237,20 +2237,32 @@ if (dci16) { LPSTR str1; - + INT len; dci16->dwDCISize = sizeof(DRVCONFIGINFO16); - if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL) - { - dci16->lpszDCISectionName = MapLS( str1 ); + if (dci32->lpszDCISectionName) { + len = WideCharToMultiByte( CP_ACP, 0, dci32->lpszDCISectionName, -1, NULL, 0, NULL, NULL ); + str1 = HeapAlloc( GetProcessHeap(), 0, len ); + if (str1) { + WideCharToMultiByte( CP_ACP, 0, dci32->lpszDCISectionName, -1, str1, len, NULL, NULL ); + dci16->lpszDCISectionName = MapLS( str1 ); + } else { + return WINMM_MAP_NOMEM; + } } else { - return WINMM_MAP_NOMEM; + dci16->lpszDCISectionName = 0L; } - if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL) - { - dci16->lpszDCIAliasName = MapLS( str1 ); + if (dci32->lpszDCIAliasName) { + len = WideCharToMultiByte( CP_ACP, 0, dci32->lpszDCIAliasName, -1, NULL, 0, NULL, NULL ); + str1 = HeapAlloc( GetProcessHeap(), 0, len ); + if (str1) { + WideCharToMultiByte( CP_ACP, 0, dci32->lpszDCIAliasName, -1, str1, len, NULL, NULL ); + dci16->lpszDCIAliasName = MapLS( str1 ); + } else { + return WINMM_MAP_NOMEM; + } } else { - return WINMM_MAP_NOMEM; + dci16->lpszDCISectionName = 0L; } } else { return WINMM_MAP_NOMEM; Index: dlls/winmm/winmm.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winmm.c,v retrieving revision 1.19 diff -u -u -r1.19 winmm.c --- dlls/winmm/winmm.c 5 Sep 2003 23:08:28 -0000 1.19 +++ dlls/winmm/winmm.c 6 Sep 2003 06:19:48 -0000 @@ -37,8 +37,8 @@ #include "winbase.h" #include "mmsystem.h" #include "winuser.h" +#include "winnls.h" #include "winreg.h" -#include "heap.h" #include "winternl.h" #include "winemm.h" @@ -680,7 +680,7 @@ /************************************************************************** * auxOutMessage [WINMM.@] */ -DWORD WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2) +UINT WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2) { LPWINE_MLD wmld; @@ -810,10 +810,15 @@ */ UINT WINAPI mciGetDeviceIDW(LPCWSTR lpwstrName) { - LPSTR lpstrName; + LPSTR lpstrName = NULL; UINT ret; + INT len; - lpstrName = HEAP_strdupWtoA(GetProcessHeap(), 0, lpwstrName); + if (lpwstrName) { + len = WideCharToMultiByte( CP_ACP, 0, lpwstrName, -1, NULL, 0, NULL, NULL ); + lpstrName = HeapAlloc( GetProcessHeap(), 0, len ); + if (lpstrName) WideCharToMultiByte( CP_ACP, 0, lpwstrName, -1, lpstrName, len, NULL, NULL ); + } ret = MCI_GetDriverFromString(lpstrName); HeapFree(GetProcessHeap(), 0, lpstrName); return ret; @@ -1273,8 +1278,8 @@ /************************************************************************** * midiOutMessage [WINMM.@] */ -DWORD WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, - DWORD dwParam1, DWORD dwParam2) +UINT WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, + DWORD dwParam1, DWORD dwParam2) { LPWINE_MLD wmld; @@ -1545,8 +1550,8 @@ /************************************************************************** * midiInMessage [WINMM.@] */ -DWORD WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage, - DWORD dwParam1, DWORD dwParam2) +UINT WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage, + DWORD dwParam1, DWORD dwParam2) { LPWINE_MLD wmld; @@ -2590,8 +2595,8 @@ /************************************************************************** * waveOutMessage [WINMM.@] */ -DWORD WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, - DWORD dwParam1, DWORD dwParam2) +UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, + DWORD dwParam1, DWORD dwParam2) { LPWINE_MLD wmld; @@ -2844,8 +2849,8 @@ /************************************************************************** * waveInMessage [WINMM.@] */ -DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, - DWORD dwParam1, DWORD dwParam2) +UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, + DWORD dwParam1, DWORD dwParam2) { LPWINE_MLD wmld; Index: dlls/winmm/winmm.spec =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winmm.spec,v retrieving revision 1.19 diff -u -u -r1.19 winmm.spec --- dlls/winmm/winmm.spec 20 Mar 2003 03:53:13 -0000 1.19 +++ dlls/winmm/winmm.spec 6 Sep 2003 07:11:32 -0000 @@ -52,7 +52,7 @@ @ stdcall mciSendCommandA(long long long long) @ stdcall mciSendCommandW(long long long long) @ stdcall mciSendStringA(str ptr long long) -@ stdcall mciSendStringW(str ptr long long) +@ stdcall mciSendStringW(wstr ptr long long) @ stdcall mciSetDriverData(long long) @ stdcall mciSetYieldProc(long ptr long) @ stub midiConnect @@ -125,8 +125,8 @@ @ stdcall mmioOpenA(str ptr long) @ stdcall mmioOpenW(wstr ptr long) @ stdcall mmioRead(long ptr long) -@ stdcall mmioRenameA(ptr ptr ptr long) -@ stdcall mmioRenameW(ptr ptr ptr long) +@ stdcall mmioRenameA(str str ptr long) +@ stdcall mmioRenameW(wstr wstr ptr long) @ stdcall mmioSeek(long long long) @ stdcall mmioSendMessage(long long long long) @ stdcall mmioSetBuffer(long ptr long long)