Add Unicode->ANSI MCI message mapping, implement mciSendCommandW, fix
a bug with a window creation belonging to another hInstance, add support for MCI_WINDOW command in mciavi.drv, add support for MCI_PLAY and MCI_STOP in the MCIWndClass implementation.
This commit is contained in:
parent
042f8953ff
commit
be6d014f35
|
@ -60,7 +60,7 @@ typedef struct
|
|||
SendMessageW((info)->hwndOwner, MCIWNDM_NOTIFYMODE, (WPARAM)(info)->hWnd, (LPARAM)SendMessageW((info)->hWnd, MCIWNDM_GETMODEW, 0, 0))
|
||||
|
||||
#define MCIWND_NOTIFY_SIZE(info) \
|
||||
if (mwi->dwStyle & MCIWNDF_NOTIFYSIZE) \
|
||||
if ((info)->dwStyle & MCIWNDF_NOTIFYSIZE) \
|
||||
SendMessageW((info)->hwndOwner, MCIWNDM_NOTIFYSIZE, (WPARAM)(info)->hWnd, 0);
|
||||
|
||||
#define MCIWND_NOTIFY_ERROR(info) \
|
||||
|
@ -84,7 +84,13 @@ BOOL VFWAPIV MCIWndRegisterClass(HINSTANCE hInst)
|
|||
{
|
||||
WNDCLASSW wc;
|
||||
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC;
|
||||
/* Since we are going to register a class belonging to MSVFW32
|
||||
* and later we will create windows with a different hInstance
|
||||
* CS_GLOBALCLASS is needed. And because the second attempt
|
||||
* to register a global class will fail we need to test whether
|
||||
* the class was already registered.
|
||||
*/
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC | CS_GLOBALCLASS;
|
||||
wc.lpfnWndProc = MCIWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = sizeof(MCIWndInfo*);
|
||||
|
@ -95,7 +101,10 @@ BOOL VFWAPIV MCIWndRegisterClass(HINSTANCE hInst)
|
|||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = mciWndClassW;
|
||||
|
||||
return RegisterClassW(&wc);
|
||||
if (RegisterClassW(&wc)) return TRUE;
|
||||
if (GetLastError() == ERROR_CLASS_ALREADY_EXISTS) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -394,7 +403,6 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
|
|||
MCIWND_NOTIFY_MODE(mwi);
|
||||
return 0;
|
||||
|
||||
|
||||
case MCIWNDM_OPENA:
|
||||
{
|
||||
UNICODE_STRING nameW;
|
||||
|
@ -450,10 +458,6 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
|
|||
(DWORD_PTR)&mci_devcaps);
|
||||
if (mwi->lasterror)
|
||||
{
|
||||
WCHAR error_str[MAXERRORLENGTH];
|
||||
|
||||
mciGetErrorStringW(mwi->lasterror, error_str, MAXERRORLENGTH);
|
||||
|
||||
MCIWND_NOTIFY_ERROR(mwi);
|
||||
goto end_of_mci_open;
|
||||
}
|
||||
|
@ -486,10 +490,8 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
|
|||
if (!(mwi->dwStyle & MCIWNDF_NOPLAYBAR))
|
||||
rc.bottom += 32; /* add the height of the playbar */
|
||||
SetWindowPos(hWnd, 0, 0, 0, rc.right - rc.left,
|
||||
rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
|
||||
rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
if (mwi->dwStyle & MCIWNDF_NOOPEN)
|
||||
ShowWindow(mwi->hWnd, SW_SHOW);
|
||||
MCIWND_NOTIFY_MEDIA(mwi);
|
||||
|
||||
SendDlgItemMessageW(hWnd, CTL_TRACKBAR, TBM_SETRANGEMIN, 0L, 0L);
|
||||
|
@ -670,6 +672,27 @@ end_of_mci_open:
|
|||
mwi->hwndOwner = (HWND)wParam;
|
||||
return 0;
|
||||
|
||||
case MCI_PLAY:
|
||||
{
|
||||
LRESULT end = SendMessageW(hWnd, MCIWNDM_GETEND, 0, 0);
|
||||
return SendMessageW(hWnd, MCIWNDM_PLAYTO, 0, end);
|
||||
}
|
||||
|
||||
case MCI_STOP:
|
||||
{
|
||||
MCI_GENERIC_PARMS mci_generic;
|
||||
|
||||
mci_generic.dwCallback = 0;
|
||||
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_STOP, 0, (DWORD_PTR)&mci_generic);
|
||||
|
||||
if (mwi->lasterror)
|
||||
{
|
||||
MCIWND_NOTIFY_ERROR(mwi);
|
||||
return mwi->lasterror;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case MCI_SEEK:
|
||||
{
|
||||
MCI_SEEK_PARMS mci_seek;
|
||||
|
@ -697,16 +720,20 @@ end_of_mci_open:
|
|||
}
|
||||
|
||||
case MCI_CLOSE:
|
||||
if (mwi->mci)
|
||||
{
|
||||
MCI_GENERIC_PARMS mci_generic;
|
||||
|
||||
mci_generic.dwCallback = 0;
|
||||
mciSendCommandW(mwi->mci, MCI_CLOSE, 0, (DWORD_PTR)&mci_generic);
|
||||
mwi->mci = 0;
|
||||
mwi->lasterror = mciSendCommandW(mwi->mci, MCI_CLOSE, 0, (DWORD_PTR)&mci_generic);
|
||||
|
||||
if (mwi->lasterror)
|
||||
{
|
||||
MCIWND_NOTIFY_ERROR(mwi);
|
||||
return mwi->lasterror;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((wMsg >= WM_USER) && (wMsg < WM_APP))
|
||||
{
|
||||
|
|
|
@ -1157,7 +1157,7 @@ BOOL WINAPI mciFreeCommandResource(UINT uTable)
|
|||
/**************************************************************************
|
||||
* MCI_SendCommandFrom32 [internal]
|
||||
*/
|
||||
DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2)
|
||||
DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
DWORD dwRet = MCIERR_INVALID_DEVICE_ID;
|
||||
LPWINE_MCIDRIVER wmd = MCI_GetDriver(wDevID);
|
||||
|
@ -1192,7 +1192,7 @@ DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwPa
|
|||
/**************************************************************************
|
||||
* MCI_SendCommandFrom16 [internal]
|
||||
*/
|
||||
DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2)
|
||||
DWORD MCI_SendCommandFrom16(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
DWORD dwRet = MCIERR_INVALID_DEVICE_ID;
|
||||
LPWINE_MCIDRIVER wmd = MCI_GetDriver(wDevID);
|
||||
|
|
|
@ -401,8 +401,8 @@ DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpPar
|
|||
TRACE("MCI_DGV_STATUS_HPAL => %lx\n", lpParms->dwReturn);
|
||||
break;
|
||||
case MCI_DGV_STATUS_HWND:
|
||||
lpParms->dwReturn = (DWORD)wma->hWnd;
|
||||
TRACE("MCI_DGV_STATUS_HWND => %p\n", wma->hWnd);
|
||||
lpParms->dwReturn = (DWORD)wma->hWndPaint;
|
||||
TRACE("MCI_DGV_STATUS_HWND => %p\n", wma->hWndPaint);
|
||||
break;
|
||||
#if 0
|
||||
case MCI_DGV_STATUS_KEY_COLOR:
|
||||
|
|
|
@ -135,7 +135,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|||
static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
|
||||
{
|
||||
WINE_MCIAVI* wma;
|
||||
static WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
|
||||
static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
|
||||
|
||||
if (!modp) return 0xFFFFFFFF;
|
||||
|
||||
|
@ -356,7 +356,7 @@ static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
|||
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||
|
||||
if (!wma->hFile) return MCIERR_FILE_NOT_FOUND;
|
||||
if (!wma->hWnd) return MCIERR_NO_WINDOW;
|
||||
if (!wma->hWndPaint) return MCIERR_NO_WINDOW;
|
||||
|
||||
wma->dwStatus = MCI_MODE_PLAY;
|
||||
|
||||
|
@ -365,7 +365,7 @@ static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
|||
(DWORD)lpParms, sizeof(MCI_PLAY_PARMS));
|
||||
}
|
||||
|
||||
ShowWindow(wma->hWnd, SW_SHOW);
|
||||
ShowWindow(wma->hWndPaint, SW_SHOW);
|
||||
|
||||
dwFromFrame = wma->dwCurrVideoFrame;
|
||||
dwToFrame = wma->dwPlayableVideoFrames - 1;
|
||||
|
|
|
@ -575,13 +575,12 @@ LRESULT MCIAVI_DrawFrame(WINE_MCIAVI* wma)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (IsWindowVisible(wma->hWnd) && (hDC = GetDC(wma->hWnd)) != 0) {
|
||||
if (IsWindowVisible(wma->hWndPaint) && (hDC = GetDC(wma->hWndPaint)) != 0) {
|
||||
MCIAVI_PaintFrame(wma, hDC);
|
||||
ReleaseDC(wma->hWnd, hDC);
|
||||
ReleaseDC(wma->hWndPaint, hDC);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&wma->cs);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ typedef struct {
|
|||
HANDLE hEvent; /* for synchronization */
|
||||
DWORD dwEventCount; /* for synchronization */
|
||||
/* data for play back */
|
||||
HWND hWnd;
|
||||
HWND hWnd, hWndPaint;
|
||||
DWORD dwCurrVideoFrame; /* video frame to display and current position */
|
||||
DWORD dwCurrAudioBlock; /* current audio block being played */
|
||||
/* data for the background mechanism */
|
||||
|
|
|
@ -87,6 +87,7 @@ BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARM
|
|||
HWND hParent = 0;
|
||||
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
|
||||
int p = CW_USEDEFAULT;
|
||||
RECT rc;
|
||||
|
||||
/* what should be done ? */
|
||||
if (wma->hWnd) return TRUE;
|
||||
|
@ -106,11 +107,17 @@ BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARM
|
|||
if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle;
|
||||
if (dwStyle & WS_CHILD) p = 0;
|
||||
|
||||
rc.left = p;
|
||||
rc.top = p;
|
||||
rc.right = (wma->hic ? wma->outbih : wma->inbih)->biWidth;
|
||||
rc.bottom = (wma->hic ? wma->outbih : wma->inbih)->biHeight;
|
||||
AdjustWindowRect(&rc, dwStyle, FALSE);
|
||||
|
||||
wma->hWnd = CreateWindowA("MCIAVI", "Wine MCI-AVI player",
|
||||
dwStyle, p, p,
|
||||
(wma->hic ? wma->outbih : wma->inbih)->biWidth,
|
||||
(wma->hic ? wma->outbih : wma->inbih)->biHeight,
|
||||
dwStyle, rc.left, rc.top,
|
||||
rc.right, rc.bottom,
|
||||
hParent, 0, MCIAVI_hInstance, wma);
|
||||
wma->hWndPaint = wma->hWnd;
|
||||
return (BOOL)wma->hWnd;
|
||||
}
|
||||
|
||||
|
@ -193,7 +200,7 @@ DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
|
|||
}
|
||||
if (dwFlags & MCI_DGV_WHERE_WINDOW) {
|
||||
x = "Window";
|
||||
GetClientRect(wma->hWnd, &lpParms->rc);
|
||||
GetClientRect(wma->hWndPaint, &lpParms->rc);
|
||||
}
|
||||
TRACE("%s -> (%ld,%ld,%ld,%ld)\n",
|
||||
x, lpParms->rc.left, lpParms->rc.top, lpParms->rc.right, lpParms->rc.bottom);
|
||||
|
@ -214,20 +221,18 @@ DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpPar
|
|||
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||
|
||||
if (dwFlags & MCI_DGV_WINDOW_HWND) {
|
||||
FIXME("Setting hWnd to %08lx\n", (DWORD)lpParms->hWnd);
|
||||
#if 0
|
||||
if (wma->hWnd) DestroyWindow(wma->hWnd);
|
||||
/* is the window to be subclassed ? */
|
||||
wma->hWnd = lpParms->hWnd;
|
||||
#endif
|
||||
TRACE("Setting hWnd to %p\n", lpParms->hWnd);
|
||||
if (wma->hWnd) ShowWindow(wma->hWnd, SW_HIDE);
|
||||
wma->hWndPaint = (lpParms->hWnd == MCI_DGV_WINDOW_DEFAULT) ? wma->hWnd : lpParms->hWnd;
|
||||
InvalidateRect(wma->hWndPaint, NULL, FALSE);
|
||||
}
|
||||
if (dwFlags & MCI_DGV_WINDOW_STATE) {
|
||||
TRACE("Setting nCmdShow to %d\n", lpParms->nCmdShow);
|
||||
ShowWindow(wma->hWnd, lpParms->nCmdShow);
|
||||
ShowWindow(wma->hWndPaint, lpParms->nCmdShow);
|
||||
}
|
||||
if (dwFlags & MCI_DGV_WINDOW_TEXT) {
|
||||
TRACE("Setting caption to '%s'\n", lpParms->lpstrText);
|
||||
SetWindowTextA(wma->hWnd, lpParms->lpstrText);
|
||||
SetWindowTextA(wma->hWndPaint, lpParms->lpstrText);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -707,20 +707,19 @@ UINT WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
|
|||
/**************************************************************************
|
||||
* mciGetErrorStringW [WINMM.@]
|
||||
*/
|
||||
BOOL WINAPI mciGetErrorStringW(DWORD wError, LPWSTR lpstrBuffer, UINT uLength)
|
||||
BOOL WINAPI mciGetErrorStringW(MCIERROR wError, LPWSTR lpstrBuffer, UINT uLength)
|
||||
{
|
||||
LPSTR bufstr = HeapAlloc(GetProcessHeap(), 0, uLength);
|
||||
BOOL ret = mciGetErrorStringA(wError, bufstr, uLength);
|
||||
char bufstr[MAXERRORLENGTH];
|
||||
BOOL ret = mciGetErrorStringA(wError, bufstr, MAXERRORLENGTH);
|
||||
|
||||
MultiByteToWideChar( CP_ACP, 0, bufstr, -1, lpstrBuffer, uLength );
|
||||
HeapFree(GetProcessHeap(), 0, bufstr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* mciGetErrorStringA [WINMM.@]
|
||||
*/
|
||||
BOOL WINAPI mciGetErrorStringA(DWORD dwError, LPSTR lpstrBuffer, UINT uLength)
|
||||
BOOL WINAPI mciGetErrorStringA(MCIERROR dwError, LPSTR lpstrBuffer, UINT uLength)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
|
@ -738,18 +737,18 @@ BOOL WINAPI mciGetErrorStringA(DWORD dwError, LPSTR lpstrBuffer, UINT uLength)
|
|||
/**************************************************************************
|
||||
* mciDriverNotify [WINMM.@]
|
||||
*/
|
||||
BOOL WINAPI mciDriverNotify(HWND hWndCallBack, UINT wDevID, UINT wStatus)
|
||||
BOOL WINAPI mciDriverNotify(HWND hWndCallBack, MCIDEVICEID wDevID, UINT wStatus)
|
||||
{
|
||||
|
||||
TRACE("(%p, %04x, %04X)\n", hWndCallBack, wDevID, wStatus);
|
||||
|
||||
return PostMessageA(hWndCallBack, MM_MCINOTIFY, wStatus, wDevID);
|
||||
return PostMessageW(hWndCallBack, MM_MCINOTIFY, wStatus, wDevID);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* mciGetDriverData [WINMM.@]
|
||||
*/
|
||||
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
|
||||
DWORD WINAPI mciGetDriverData(MCIDEVICEID uDeviceID)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
|
||||
|
@ -768,7 +767,7 @@ DWORD WINAPI mciGetDriverData(UINT uDeviceID)
|
|||
/**************************************************************************
|
||||
* mciSetDriverData [WINMM.@]
|
||||
*/
|
||||
BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD data)
|
||||
BOOL WINAPI mciSetDriverData(MCIDEVICEID uDeviceID, DWORD data)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
|
||||
|
@ -788,7 +787,7 @@ BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD data)
|
|||
/**************************************************************************
|
||||
* mciSendCommandA [WINMM.@]
|
||||
*/
|
||||
DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
|
||||
DWORD WINAPI mciSendCommandA(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
DWORD dwRet;
|
||||
|
||||
|
@ -801,14 +800,189 @@ DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwPar
|
|||
return dwRet;
|
||||
}
|
||||
|
||||
inline static LPSTR strdupWtoA( LPCWSTR str )
|
||||
{
|
||||
LPSTR ret;
|
||||
INT len;
|
||||
|
||||
if (!str) return NULL;
|
||||
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
ret = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int MCI_MapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case MCI_CLOSE:
|
||||
case MCI_PLAY:
|
||||
case MCI_SEEK:
|
||||
case MCI_STOP:
|
||||
case MCI_PAUSE:
|
||||
case MCI_GETDEVCAPS:
|
||||
case MCI_SPIN:
|
||||
case MCI_SET:
|
||||
case MCI_STEP:
|
||||
case MCI_RECORD:
|
||||
case MCI_BREAK:
|
||||
case MCI_SOUND:
|
||||
case MCI_STATUS:
|
||||
case MCI_CUE:
|
||||
case MCI_REALIZE:
|
||||
case MCI_PUT:
|
||||
case MCI_WHERE:
|
||||
case MCI_FREEZE:
|
||||
case MCI_UNFREEZE:
|
||||
case MCI_CUT:
|
||||
case MCI_COPY:
|
||||
case MCI_PASTE:
|
||||
case MCI_UPDATE:
|
||||
case MCI_RESUME:
|
||||
case MCI_DELETE:
|
||||
return 0;
|
||||
|
||||
case MCI_OPEN:
|
||||
{
|
||||
MCI_OPEN_PARMSW *mci_openW = (MCI_OPEN_PARMSW *)*dwParam2;
|
||||
MCI_OPEN_PARMSA *mci_openA;
|
||||
DWORD_PTR *ptr;
|
||||
|
||||
ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_openA) + sizeof(DWORD_PTR));
|
||||
if (!ptr) return -1;
|
||||
|
||||
*ptr++ = *dwParam2; /* save the previous pointer */
|
||||
*dwParam2 = (DWORD_PTR)ptr;
|
||||
mci_openA = (MCI_OPEN_PARMSA *)ptr;
|
||||
|
||||
if (dwParam1 & MCI_NOTIFY)
|
||||
mci_openA->dwCallback = mci_openW->dwCallback;
|
||||
|
||||
if (dwParam1 & MCI_OPEN_TYPE)
|
||||
{
|
||||
if (dwParam1 & MCI_OPEN_TYPE_ID)
|
||||
mci_openA->lpstrDeviceType = (LPSTR)mci_openW->lpstrDeviceType;
|
||||
else
|
||||
mci_openA->lpstrDeviceType = strdupWtoA(mci_openW->lpstrDeviceType);
|
||||
}
|
||||
if (dwParam1 & MCI_OPEN_ELEMENT)
|
||||
{
|
||||
if (dwParam1 & MCI_OPEN_ELEMENT_ID)
|
||||
mci_openA->lpstrElementName = (LPSTR)mci_openW->lpstrElementName;
|
||||
else
|
||||
mci_openA->lpstrElementName = strdupWtoA(mci_openW->lpstrElementName);
|
||||
}
|
||||
if (dwParam1 & MCI_OPEN_ALIAS)
|
||||
mci_openA->lpstrAlias = strdupWtoA(mci_openW->lpstrAlias);
|
||||
}
|
||||
return 1;
|
||||
|
||||
case MCI_WINDOW:
|
||||
if (dwParam1 & MCI_ANIM_WINDOW_TEXT)
|
||||
{
|
||||
MCI_ANIM_WINDOW_PARMSW *mci_windowW = (MCI_ANIM_WINDOW_PARMSW *)*dwParam2;
|
||||
MCI_ANIM_WINDOW_PARMSA *mci_windowA;
|
||||
|
||||
mci_windowA = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_windowA));
|
||||
if (!mci_windowA) return -1;
|
||||
|
||||
*dwParam2 = (DWORD_PTR)mci_windowA;
|
||||
|
||||
mci_windowA->lpstrText = strdupWtoA(mci_windowW->lpstrText);
|
||||
|
||||
if (dwParam1 & MCI_NOTIFY)
|
||||
mci_windowA->dwCallback = mci_windowW->dwCallback;
|
||||
if (dwParam1 & MCI_ANIM_WINDOW_HWND)
|
||||
mci_windowA->hWnd = mci_windowW->hWnd;
|
||||
if (dwParam1 & MCI_ANIM_WINDOW_STATE)
|
||||
mci_windowA->nCmdShow = mci_windowW->nCmdShow;
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case MCI_INFO:
|
||||
case MCI_SYSINFO:
|
||||
case MCI_SAVE:
|
||||
case MCI_LOAD:
|
||||
case MCI_ESCAPE:
|
||||
default:
|
||||
FIXME("Message 0x%04x needs translation\n", msg);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void MCI_UnmapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case MCI_OPEN:
|
||||
{
|
||||
DWORD_PTR *ptr = (DWORD_PTR *)dwParam2 - 1;
|
||||
MCI_OPEN_PARMSW *mci_openW = (MCI_OPEN_PARMSW *)*ptr;
|
||||
MCI_OPEN_PARMSA *mci_openA = (MCI_OPEN_PARMSA *)(ptr + 1);
|
||||
|
||||
mci_openW->wDeviceID = mci_openA->wDeviceID;
|
||||
|
||||
if (dwParam1 & MCI_OPEN_TYPE)
|
||||
{
|
||||
if (!(dwParam1 & MCI_OPEN_TYPE_ID))
|
||||
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrDeviceType);
|
||||
}
|
||||
if (dwParam1 & MCI_OPEN_ELEMENT)
|
||||
{
|
||||
if (!(dwParam1 & MCI_OPEN_ELEMENT_ID))
|
||||
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrElementName);
|
||||
}
|
||||
if (dwParam1 & MCI_OPEN_ALIAS)
|
||||
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrAlias);
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case MCI_WINDOW:
|
||||
if (dwParam1 & MCI_ANIM_WINDOW_TEXT)
|
||||
{
|
||||
MCI_ANIM_WINDOW_PARMSA *mci_windowA = (MCI_ANIM_WINDOW_PARMSA *)dwParam2;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, (void *)mci_windowA->lpstrText);
|
||||
HeapFree(GetProcessHeap(), 0, mci_windowA);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Message 0x%04x needs unmapping\n", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* mciSendCommandW [WINMM.@]
|
||||
*
|
||||
* FIXME: we should do the things other way around, but since our
|
||||
* MM subsystem is not unicode aware...
|
||||
*/
|
||||
DWORD WINAPI mciSendCommandW(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
|
||||
DWORD WINAPI mciSendCommandW(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
FIXME("(%08x, %s, %08lx, %08lx): stub\n",
|
||||
DWORD ret;
|
||||
int mapped;
|
||||
|
||||
TRACE("(%08x, %s, %08lx, %08lx)\n",
|
||||
wDevID, MCI_MessageToString(wMsg), dwParam1, dwParam2);
|
||||
return MCIERR_UNSUPPORTED_FUNCTION;
|
||||
|
||||
mapped = MCI_MapMsgWtoA(wMsg, dwParam1, &dwParam2);
|
||||
if (mapped == -1)
|
||||
{
|
||||
FIXME("message %04x mapping failed\n", wMsg);
|
||||
return MMSYSERR_NOMEM;
|
||||
}
|
||||
ret = mciSendCommandA(wDevID, wMsg, dwParam1, dwParam2);
|
||||
if (mapped)
|
||||
MCI_UnmapMsgWtoA(wMsg, dwParam1, dwParam2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -864,7 +1038,7 @@ UINT WINAPI MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data)
|
|||
/**************************************************************************
|
||||
* mciSetYieldProc [WINMM.@]
|
||||
*/
|
||||
BOOL WINAPI mciSetYieldProc(UINT uDeviceID, YIELDPROC fpYieldProc, DWORD dwYieldData)
|
||||
BOOL WINAPI mciSetYieldProc(MCIDEVICEID uDeviceID, YIELDPROC fpYieldProc, DWORD dwYieldData)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
|
||||
|
@ -897,7 +1071,7 @@ UINT WINAPI mciGetDeviceIDFromElementIDW(DWORD dwElementID, LPCWSTR lpstrType)
|
|||
/**************************************************************************
|
||||
* mciGetYieldProc [WINMM.@]
|
||||
*/
|
||||
YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD* lpdwYieldData)
|
||||
YIELDPROC WINAPI mciGetYieldProc(MCIDEVICEID uDeviceID, DWORD* lpdwYieldData)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
|
||||
|
@ -921,7 +1095,7 @@ YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD* lpdwYieldData)
|
|||
/**************************************************************************
|
||||
* mciGetCreatorTask [WINMM.@]
|
||||
*/
|
||||
HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
|
||||
HTASK WINAPI mciGetCreatorTask(MCIDEVICEID uDeviceID)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
HTASK ret = 0;
|
||||
|
@ -935,7 +1109,7 @@ HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
|
|||
/**************************************************************************
|
||||
* mciDriverYield [WINMM.@]
|
||||
*/
|
||||
UINT WINAPI mciDriverYield(UINT uDeviceID)
|
||||
UINT WINAPI mciDriverYield(MCIDEVICEID uDeviceID)
|
||||
{
|
||||
LPWINE_MCIDRIVER wmd;
|
||||
UINT ret = 0;
|
||||
|
|
|
@ -1407,8 +1407,8 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO,MMCKINFO*,UINT);
|
|||
|
||||
typedef UINT (CALLBACK *YIELDPROC)(MCIDEVICEID,DWORD);
|
||||
|
||||
DWORD WINAPI mciSendCommandA(UINT,UINT,DWORD,DWORD);
|
||||
DWORD WINAPI mciSendCommandW(UINT,UINT,DWORD,DWORD);
|
||||
DWORD WINAPI mciSendCommandA(MCIDEVICEID,UINT,DWORD_PTR,DWORD_PTR);
|
||||
DWORD WINAPI mciSendCommandW(MCIDEVICEID,UINT,DWORD_PTR,DWORD_PTR);
|
||||
#define mciSendCommand WINELIB_NAME_AW(mciSendCommand)
|
||||
DWORD WINAPI mciSendStringA(LPCSTR,LPSTR,UINT,HWND);
|
||||
DWORD WINAPI mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND);
|
||||
|
@ -1416,12 +1416,12 @@ DWORD WINAPI mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND);
|
|||
UINT WINAPI mciGetDeviceIDA(LPCSTR);
|
||||
UINT WINAPI mciGetDeviceIDW(LPCWSTR);
|
||||
#define mciGetDeviceID WINELIB_NAME_AW(mciGetDeviceID)
|
||||
BOOL WINAPI mciGetErrorStringA(DWORD,LPSTR,UINT);
|
||||
BOOL WINAPI mciGetErrorStringW(DWORD,LPWSTR,UINT);
|
||||
BOOL WINAPI mciGetErrorStringA(MCIERROR,LPSTR,UINT);
|
||||
BOOL WINAPI mciGetErrorStringW(MCIERROR,LPWSTR,UINT);
|
||||
#define mciGetErrorString WINELIB_NAME_AW(mciGetErrorString)
|
||||
BOOL WINAPI mciSetYieldProc(UINT,YIELDPROC,DWORD);
|
||||
HTASK WINAPI mciGetCreatorTask(UINT);
|
||||
YIELDPROC WINAPI mciGetYieldProc(UINT,DWORD*);
|
||||
BOOL WINAPI mciSetYieldProc(MCIDEVICEID,YIELDPROC,DWORD);
|
||||
HTASK WINAPI mciGetCreatorTask(MCIDEVICEID);
|
||||
YIELDPROC WINAPI mciGetYieldProc(MCIDEVICEID,DWORD*);
|
||||
|
||||
#define MCIERR_INVALID_DEVICE_ID (MCIERR_BASE + 1)
|
||||
#define MCIERR_UNRECOGNIZED_KEYWORD (MCIERR_BASE + 3)
|
||||
|
|
Loading…
Reference in New Issue