/************************************************************************* * RegisterShellHook [SHELL.102] */ BOOL WINAPI RegisterShellHook16(HWND16 hWnd, UINT16 uAction) { TRACE("%04x [%u]\n", hWnd, uAction ); switch( uAction ) { case 2: /* register hWnd as a shell window */ if( !SHELL_hHook ) { SHELL_hHook = SetWindowsHookExA( WH_SHELL, SHELL_HookProc, GetModuleHandleA("shell32.dll"), 0 ); if ( SHELL_hHook ) { uMsgWndCreated = RegisterWindowMessageA( lpstrMsgWndCreated ); uMsgWndDestroyed = RegisterWindowMessageA( lpstrMsgWndDestroyed ); uMsgShellActivate = RegisterWindowMessageA( lpstrMsgShellActivate ); } else WARN("-- unable to install ShellHookProc()!\n"); } if ( SHELL_hHook ) return ((SHELL_hWnd = HWND_32(hWnd)) != 0); break; default: WARN("-- unknown code %i\n", uAction ); SHELL_hWnd = 0; /* just in case */ } return FALSE; }
/************************************************************************* * ShellExecute [SHELL.20] */ HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT16 iShowCmd ) { return HINSTANCE_16( WOWShellExecute( HWND_32(hWnd), lpOperation, lpFile, lpParameters, lpDirectory, iShowCmd, SHELL_Execute16 )); }
/************************************************************************* * ShellAbout (SHELL.22) */ BOOL16 WINAPI ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON16 icon16 ) { HICON icon = convert_icon_to_32( icon16 ); BOOL ret = ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, icon ); DestroyIcon( icon ); return ret; }
static void CFn_CHOOSEFONT16to32W(LPCHOOSEFONT16 chf16, LPCHOOSEFONTW chf32w) { int len; if (chf16->Flags & CF_ENABLETEMPLATE) { len = MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpTemplateName), -1, NULL, 0); chf32w->lpTemplateName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpTemplateName), -1, (LPWSTR)chf32w->lpTemplateName, len); } if (chf16->Flags & CF_USESTYLE) { len = MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpszStyle), -1, NULL, 0); chf32w->lpszStyle = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, MapSL(chf16->lpszStyle), -1, chf32w->lpszStyle, len); } chf32w->lStructSize=sizeof(CHOOSEFONTW); chf32w->hwndOwner=HWND_32(chf16->hwndOwner); chf32w->hDC=HDC_32(chf16->hDC); chf32w->iPointSize=chf16->iPointSize; chf32w->Flags=chf16->Flags; chf32w->rgbColors=chf16->rgbColors; chf32w->lCustData=chf16->lCustData; chf32w->lpfnHook=NULL; chf32w->hInstance=HINSTANCE_32(chf16->hInstance); chf32w->nFontType=chf16->nFontType; chf32w->nSizeMax=chf16->nSizeMax; chf32w->nSizeMin=chf16->nSizeMin; FONT_LogFont16To32W(MapSL(chf16->lpLogFont), chf32w->lpLogFont); }
/****************************************************************************** * MCIAVI_mciStep [internal] */ static DWORD MCIAVI_mciStep(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms) { WINE_MCIAVI *wma; DWORD position; int delta = 1; TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms); if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIAVI_mciGetOpenDev(wDevID); if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; if (dwFlags & MCI_DGV_STEP_FRAMES) delta = lpParms->dwFrames; if (dwFlags & MCI_DGV_STEP_REVERSE) delta = -delta; position = wma->dwCurrVideoFrame + delta; if (position >= wma->dwPlayableVideoFrames) return MCIERR_OUTOFRANGE; if (dwFlags & MCI_TEST) return 0; MCIAVI_mciStop(wDevID, MCI_WAIT, NULL); EnterCriticalSection(&wma->cs); wma->dwCurrVideoFrame = position; TRACE("Stepping to frame=%u\n", wma->dwCurrVideoFrame); if (dwFlags & MCI_NOTIFY) { mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); } LeaveCriticalSection(&wma->cs); return 0; }
/************************************************************************** * MCICDA_mciNotify [internal] * * Notifications in MCI work like a 1-element queue. * Each new notification request supersedes the previous one. */ static void MCICDA_Notify(DWORD_PTR hWndCallBack, WINE_MCICDAUDIO* wmcda, UINT wStatus) { MCIDEVICEID wDevID = wmcda->wNotifyDeviceID; HANDLE old = InterlockedExchangePointer(&wmcda->hCallback, NULL); if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED); mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus); }
/************************************************************************ * FD16_MapOfnStruct16 [internal] * map a 16 bits structure to an Unicode one */ static void FD16_MapOfnStruct16(LPOPENFILENAME16 ofn16, LPOPENFILENAMEW ofnW, BOOL open) { OPENFILENAMEA ofnA; /* first convert to linear pointers */ memset(&ofnA, 0, sizeof(OPENFILENAMEA)); ofnA.lStructSize = sizeof(OPENFILENAMEA); ofnA.hwndOwner = HWND_32(ofn16->hwndOwner); ofnA.hInstance = HINSTANCE_32(ofn16->hInstance); if (ofn16->lpstrFilter) ofnA.lpstrFilter = MapSL(ofn16->lpstrFilter); if (ofn16->lpstrCustomFilter) ofnA.lpstrCustomFilter = MapSL(ofn16->lpstrCustomFilter); ofnA.nMaxCustFilter = ofn16->nMaxCustFilter; ofnA.nFilterIndex = ofn16->nFilterIndex; ofnA.lpstrFile = MapSL(ofn16->lpstrFile); ofnA.nMaxFile = ofn16->nMaxFile; ofnA.lpstrFileTitle = MapSL(ofn16->lpstrFileTitle); ofnA.nMaxFileTitle = ofn16->nMaxFileTitle; ofnA.lpstrInitialDir = MapSL(ofn16->lpstrInitialDir); ofnA.lpstrTitle = MapSL(ofn16->lpstrTitle); ofnA.Flags = ofn16->Flags; ofnA.nFileOffset = ofn16->nFileOffset; ofnA.nFileExtension = ofn16->nFileExtension; ofnA.lpstrDefExt = MapSL(ofn16->lpstrDefExt); if (HIWORD(ofn16->lpTemplateName)) ofnA.lpTemplateName = MapSL(ofn16->lpTemplateName); else ofnA.lpTemplateName = (LPSTR) ofn16->lpTemplateName; /* ressource number */ /* now calls the 32 bits Ansi to Unicode version to complete the job */ FD31_MapOfnStructA(&ofnA, ofnW, open); }
/*************************************************************************** * MCIAVI_mciClose [internal] */ DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) { WINE_MCIAVI *wma; DWORD dwRet = 0; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); wma = MCIAVI_mciGetOpenDev(wDevID); if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; MCIAVI_mciStop(wDevID, MCI_WAIT, NULL); EnterCriticalSection(&wma->cs); if (wma->nUseCount == 1) { MCIAVI_CleanUp(wma); if ((dwFlags & MCI_NOTIFY) && lpParms) { mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); } LeaveCriticalSection(&wma->cs); return dwRet; } wma->nUseCount--; LeaveCriticalSection(&wma->cs); return dwRet; }
/************************************************************************** * MCIQTZ_mciNotify [internal] * * Notifications in MCI work like a 1-element queue. * Each new notification request supersedes the previous one. */ static void MCIQTZ_mciNotify(DWORD_PTR hWndCallBack, WINE_MCIQTZ* wma, UINT wStatus) { MCIDEVICEID wDevID = wma->notify_devid; HANDLE old = InterlockedExchangePointer(&wma->callback, NULL); if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED); mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus); }
/*********************************************************************** * MCIWndCreate(MSVIDEO.250) */ HWND16 CDECL MCIWndCreate16(HWND16 parent, HINSTANCE16 hinst16, DWORD style, LPSTR file) { HWND hwnd = MCIWndCreateA(HWND_32(parent), 0, style, file); if (hwnd) pMCIWndProc = (void *)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (ULONG_PTR)MCIWndProc16); return HWND_16(hwnd); }
/*************************************************************************** * MCIQTZ_mciPlay [internal] */ static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) { WINE_MCIQTZ* wma; HRESULT hr; REFERENCE_TIME time1 = 0, time2 = 0; GUID format; DWORD pos1; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); if(!lpParms) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIQTZ_mciGetOpenDev(wDevID); if (!wma) return MCIERR_INVALID_DEVICE_ID; ResetEvent(wma->stop_event); if (dwFlags & MCI_NOTIFY) { HANDLE old; old = InterlockedExchangePointer(&wma->callback, HWND_32(LOWORD(lpParms->dwCallback))); if (old) mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED); } IMediaSeeking_GetTimeFormat(wma->seek, &format); if (dwFlags & MCI_FROM) { if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME)) time1 = lpParms->dwFrom * 10000; else time1 = lpParms->dwFrom; pos1 = AM_SEEKING_AbsolutePositioning; } else pos1 = AM_SEEKING_NoPositioning; if (dwFlags & MCI_TO) { if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME)) time2 = lpParms->dwTo * 10000; else time2 = lpParms->dwTo; } else IMediaSeeking_GetDuration(wma->seek, &time2); IMediaSeeking_SetPositions(wma->seek, &time1, pos1, &time2, AM_SEEKING_AbsolutePositioning); hr = IMediaControl_Run(wma->pmctrl); if (FAILED(hr)) { TRACE("Cannot run filtergraph (hr = %x)\n", hr); return MCIERR_INTERNAL; } IVideoWindow_put_Visible(wma->vidwin, OATRUE); wma->thread = CreateThread(NULL, 0, MCIQTZ_notifyThread, wma, 0, NULL); if (!wma->thread) { TRACE("Can't create thread\n"); return MCIERR_INTERNAL; } return 0; }
/*********************************************************************** * FontStyleEnumProc (COMMDLG.18) */ INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics, UINT16 nFontType, LPARAM lParam ) { HWND hcmb2=HWND_32(LOWORD(lParam)); HWND hcmb3=HWND_32(HIWORD(lParam)); HWND hDlg=GetParent(hcmb3); LPCHOOSEFONT16 lpcf; LOGFONT16 *lplf = MapSL(logfont); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); ENUMLOGFONTEXW elf32w; NEWTEXTMETRICEXW nmtrx32w; lpcf = (LPCHOOSEFONT16)GetPropW(hDlg, strWineFontData16); FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); return AddFontStyle(&elf32w, &nmtrx32w, nFontType, (LPCHOOSEFONTW)lpcf->lpTemplateName, hcmb2, hcmb3, hDlg, TRUE); }
/************************************************************************** * MCICDA_Seek [internal] */ static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) { DWORD at; WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); CDROM_SEEK_AUDIO_MSF seek; DWORD br, ret; CDROM_TOC toc; TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID; if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &br, NULL)) { WARN("error reading TOC !\n"); return MCICDA_GetError(wmcda); } switch (dwFlags & ~(MCI_NOTIFY|MCI_WAIT)) { case MCI_SEEK_TO_START: TRACE("Seeking to start\n"); at = FRAME_OF_TOC(toc,toc.FirstTrack); if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) ) return ret; break; case MCI_SEEK_TO_END: TRACE("Seeking to end\n"); at = FRAME_OF_TOC(toc, toc.LastTrack + 1) - 1; if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) ) return ret; break; case MCI_TO: TRACE("Seeking to %lu\n", lpParms->dwTo); at = MCICDA_CalcFrame(wmcda, lpParms->dwTo); if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) ) return ret; break; default: TRACE("Unknown seek action %08lX\n", (dwFlags & ~(MCI_NOTIFY|MCI_WAIT))); return MCIERR_UNSUPPORTED_FUNCTION; } seek.M = at / CDFRAMES_PERMIN; seek.S = (at / CDFRAMES_PERSEC) % 60; seek.F = at % CDFRAMES_PERSEC; if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_SEEK_AUDIO_MSF, &seek, sizeof(seek), NULL, 0, &br, NULL)) return MCIERR_HARDWARE; if (dwFlags & MCI_NOTIFY) { TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); } return 0; }
/*************************************************************** * ExtDeviceMode [WINEPS16.90] */ INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver, LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode) { if (!load_wineps() || !pExtDeviceMode) return -1; return pExtDeviceMode( NULL, HWND_32(hwnd), lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode ); }
/*************************************************************************** * MCIQTZ_mciSeek [internal] */ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) { WINE_MCIQTZ* wma; HRESULT hr; IMediaPosition* pmpos; LONGLONG newpos; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); if (!lpParms) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIQTZ_mciGetOpenDev(wDevID); if (!wma) return MCIERR_INVALID_DEVICE_ID; MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); if (dwFlags & MCI_SEEK_TO_START) { newpos = 0; } else if (dwFlags & MCI_SEEK_TO_END) { FIXME("MCI_SEEK_TO_END not implemented yet\n"); return MCIERR_INTERNAL; } else if (dwFlags & MCI_TO) { FIXME("MCI_TO not implemented yet\n"); return MCIERR_INTERNAL; } else { WARN("dwFlag doesn't tell where to seek to...\n"); return MCIERR_MISSING_PARAMETER; } hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos); if (FAILED(hr)) { FIXME("Cannot get IMediaPostion interface (hr = %x)\n", hr); return MCIERR_INTERNAL; } hr = IMediaPosition_put_CurrentPosition(pmpos, newpos); if (FAILED(hr)) { FIXME("Cannot set position (hr = %x)\n", hr); IMediaPosition_Release(pmpos); return MCIERR_INTERNAL; } IMediaPosition_Release(pmpos); if (dwFlags & MCI_NOTIFY) mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); return 0; }
/*************************************************************************** * MCIAVI_mciStop [internal] */ static DWORD MCIAVI_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) { WINE_MCIAVI *wma; DWORD dwRet = 0; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); wma = MCIAVI_mciGetOpenDev(wDevID); if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; if (dwFlags & MCI_TEST) return 0; EnterCriticalSection(&wma->cs); TRACE("current status %04x\n", wma->dwStatus); switch (wma->dwStatus) { case MCI_MODE_PLAY: case MCI_MODE_RECORD: LeaveCriticalSection(&wma->cs); SetEvent(wma->hStopEvent); EnterCriticalSection(&wma->cs); /* fall through */ case MCI_MODE_PAUSE: /* Since our wave notification callback takes the lock, * we must release it before resetting the device */ LeaveCriticalSection(&wma->cs); dwRet = waveOutReset(wma->hWave); EnterCriticalSection(&wma->cs); /* fall through */ default: do /* one more chance for an async thread to finish */ { LeaveCriticalSection(&wma->cs); Sleep(10); EnterCriticalSection(&wma->cs); } while (wma->dwStatus != MCI_MODE_STOP); break; case MCI_MODE_NOT_READY: break; } if ((dwFlags & MCI_NOTIFY) && lpParms) { mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); } LeaveCriticalSection(&wma->cs); return dwRet; }
/************************************************************************** * MCICDA_Set [internal] */ static DWORD MCICDA_Set(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) { WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID; if (dwFlags & MCI_SET_DOOR_OPEN) { MCICDA_SetDoor(wDevID, TRUE); } if (dwFlags & MCI_SET_DOOR_CLOSED) { MCICDA_SetDoor(wDevID, FALSE); } /* only functions which require valid lpParms below this line ! */ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; /* TRACE("dwTimeFormat=%08lX\n", lpParms->dwTimeFormat); TRACE("dwAudio=%08lX\n", lpParms->dwAudio); */ if (dwFlags & MCI_SET_TIME_FORMAT) { switch (lpParms->dwTimeFormat) { case MCI_FORMAT_MILLISECONDS: TRACE("MCI_FORMAT_MILLISECONDS !\n"); break; case MCI_FORMAT_MSF: TRACE("MCI_FORMAT_MSF !\n"); break; case MCI_FORMAT_TMSF: TRACE("MCI_FORMAT_TMSF !\n"); break; default: WARN("bad time format !\n"); return MCIERR_BAD_TIME_FORMAT; } wmcda->dwTimeFormat = lpParms->dwTimeFormat; } if (dwFlags & MCI_SET_VIDEO) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_NOTIFY) { TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); } return 0; }
/*************************************************************************** * MCIQTZ_mciPlay [internal] */ static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) { WINE_MCIQTZ* wma; HRESULT hr; REFERENCE_TIME time1 = 0, time2 = 0; GUID format; DWORD pos1; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); if (!lpParms) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIQTZ_mciGetOpenDev(wDevID); if (!wma) return MCIERR_INVALID_DEVICE_ID; IMediaSeeking_GetTimeFormat(wma->seek, &format); if (dwFlags & MCI_FROM) { if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME)) time1 = lpParms->dwFrom * 10000; else time1 = lpParms->dwFrom; pos1 = AM_SEEKING_AbsolutePositioning; } else pos1 = AM_SEEKING_NoPositioning; if (dwFlags & MCI_TO) { if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME)) time2 = lpParms->dwTo * 10000; else time2 = lpParms->dwTo; } else IMediaSeeking_GetDuration(wma->seek, &time2); IMediaSeeking_SetPositions(wma->seek, &time1, pos1, &time2, AM_SEEKING_AbsolutePositioning); hr = IMediaControl_Run(wma->pmctrl); if (FAILED(hr)) { TRACE("Cannot run filtergraph (hr = %x)\n", hr); return MCIERR_INTERNAL; } IVideoWindow_put_Visible(wma->vidwin, OATRUE); if (dwFlags & MCI_NOTIFY) mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); return 0; }
/************************************************************************** * MCICDA_Resume [internal] */ static DWORD MCICDA_Resume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) { WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); DWORD br; TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID; if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL, 0, &br, NULL)) return MCIERR_HARDWARE; if (lpParms && (dwFlags & MCI_NOTIFY)) { TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); } return 0; }
/*************************************************************************** * MCIAVI_mciSeek [internal] */ static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) { WINE_MCIAVI *wma; DWORD position; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIAVI_mciGetOpenDev(wDevID); if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; position = dwFlags & (MCI_SEEK_TO_START|MCI_SEEK_TO_END|MCI_TO); if (!position) return MCIERR_MISSING_PARAMETER; if (position&(position-1)) return MCIERR_FLAGS_NOT_COMPATIBLE; if (dwFlags & MCI_TO) { position = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo); if (position >= wma->dwPlayableVideoFrames) return MCIERR_OUTOFRANGE; } else if (dwFlags & MCI_SEEK_TO_START) { position = 0; } else { position = wma->dwPlayableVideoFrames - 1; } if (dwFlags & MCI_TEST) return 0; MCIAVI_mciStop(wDevID, MCI_WAIT, NULL); EnterCriticalSection(&wma->cs); wma->dwCurrVideoFrame = position; TRACE("Seeking to frame=%u\n", wma->dwCurrVideoFrame); if (dwFlags & MCI_NOTIFY) { mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); } LeaveCriticalSection(&wma->cs); return 0; }
/*************************************************************************** * MCIQTZ_mciSeek [internal] */ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) { WINE_MCIQTZ* wma; HRESULT hr; LONGLONG newpos; TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); if (!lpParms) return MCIERR_NULL_PARAMETER_BLOCK; wma = MCIQTZ_mciGetOpenDev(wDevID); if (!wma) return MCIERR_INVALID_DEVICE_ID; MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); if (dwFlags & MCI_SEEK_TO_START) { newpos = 0; } else if (dwFlags & MCI_SEEK_TO_END) { FIXME("MCI_SEEK_TO_END not implemented yet\n"); return MCIERR_INTERNAL; } else if (dwFlags & MCI_TO) { FIXME("MCI_TO not implemented yet\n"); return MCIERR_INTERNAL; } else { WARN("dwFlag doesn't tell where to seek to...\n"); return MCIERR_MISSING_PARAMETER; } hr = IMediaSeeking_SetPositions(wma->seek, &newpos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); if (FAILED(hr)) { FIXME("Cannot set position (hr = %x)\n", hr); return MCIERR_INTERNAL; } if (dwFlags & MCI_NOTIFY) mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); return 0; }
/************************************************************************** * mciSendString [MMSYSTEM.702] */ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet, UINT16 uRetLen, HWND16 hwndCallback) { return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback)); }
/************************************************************************** * mciDriverNotify [MMSYSTEM.711] */ BOOL16 WINAPI mciDriverNotify16(HWND16 hWndCallBack, UINT16 wDevID, UINT16 wStatus) { TRACE("(%04X, %04x, %04X)\n", hWndCallBack, wDevID, wStatus); return PostMessageA(HWND_32(hWndCallBack), MM_MCINOTIFY, wStatus, wDevID); }
/************************************************************************** * MCI_MapMsg16To32W [internal] */ static MMSYSTEM_MapType MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* lParam) { if (*lParam == 0) return MMSYSTEM_MAP_OK; /* FIXME: to add also (with seg/linear modifications to do): * MCI_LIST, MCI_LOAD, MCI_QUALITY, MCI_RESERVE, MCI_RESTORE, MCI_SAVE * MCI_SETAUDIO, MCI_SETTUNER, MCI_SETVIDEO */ switch (wMsg) { /* case MCI_CAPTURE */ case MCI_CLOSE: case MCI_CLOSE_DRIVER: case MCI_CONFIGURE: case MCI_COPY: case MCI_CUE: case MCI_CUT: case MCI_DELETE: case MCI_GETDEVCAPS: /* case MCI_INDEX: */ /* case MCI_MARK: */ /* case MCI_MONITOR: */ case MCI_PASTE: case MCI_PAUSE: case MCI_PLAY: case MCI_REALIZE: case MCI_RECORD: case MCI_RESUME: case MCI_SEEK: case MCI_SET: /* case MCI_SETTIMECODE:*/ /* case MCI_SIGNAL:*/ case MCI_SPIN: case MCI_STEP: case MCI_STOP: /* case MCI_UNDO: */ case MCI_UPDATE: *lParam = (DWORD)MapSL(*lParam); return MMSYSTEM_MAP_OK; case MCI_WHERE: case MCI_FREEZE: case MCI_UNFREEZE: case MCI_PUT: { LPMCI_DGV_RECT_PARMS mdrp32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_DGV_RECT_PARMS16) + sizeof(MCI_DGV_RECT_PARMS)); LPMCI_DGV_RECT_PARMS16 mdrp16 = MapSL(*lParam); if (mdrp32) { *(LPMCI_DGV_RECT_PARMS16*)(mdrp32) = mdrp16; mdrp32 = (LPMCI_DGV_RECT_PARMS)((char*)mdrp32 + sizeof(LPMCI_DGV_RECT_PARMS16)); mdrp32->dwCallback = mdrp16->dwCallback; mdrp32->rc.left = mdrp16->rc.left; mdrp32->rc.top = mdrp16->rc.top; mdrp32->rc.right = mdrp16->rc.right; mdrp32->rc.bottom = mdrp16->rc.bottom; } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mdrp32; } return MMSYSTEM_MAP_OKMEM; case MCI_STATUS: { if (dwFlags & (MCI_DGV_STATUS_REFERENCE | MCI_DGV_STATUS_DISKSPACE)) { LPMCI_DGV_STATUS_PARMSW mdsp32w = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LPMCI_DGV_STATUS_PARMS16) + sizeof(MCI_DGV_STATUS_PARMSW)); LPMCI_DGV_STATUS_PARMS16 mdsp16 = MapSL(*lParam); if (mdsp32w) { *(LPMCI_DGV_STATUS_PARMS16*)(mdsp32w) = mdsp16; mdsp32w = (LPMCI_DGV_STATUS_PARMSW)((char*)mdsp32w + sizeof(LPMCI_DGV_STATUS_PARMS16)); mdsp32w->dwCallback = mdsp16->dwCallback; mdsp32w->dwReturn = mdsp16->dwReturn; mdsp32w->dwItem = mdsp16->dwItem; mdsp32w->dwTrack = mdsp16->dwTrack; if (dwFlags & MCI_DGV_STATUS_DISKSPACE) mdsp32w->lpstrDrive = MCI_strdupAtoW(MapSL(mdsp16->lpstrDrive)); if (dwFlags & MCI_DGV_STATUS_REFERENCE) mdsp32w->dwReference = mdsp16->dwReference; *lParam = (DWORD)mdsp32w; } else { return MMSYSTEM_MAP_NOMEM; } } else { *lParam = (DWORD)MapSL(*lParam); return MMSYSTEM_MAP_OK; } } return MMSYSTEM_MAP_OKMEM; case MCI_WINDOW: { LPMCI_OVLY_WINDOW_PARMSW mowp32w = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MCI_OVLY_WINDOW_PARMSW)); LPMCI_OVLY_WINDOW_PARMS16 mowp16 = MapSL(*lParam); if (mowp32w) { mowp32w->dwCallback = mowp16->dwCallback; mowp32w->hWnd = HWND_32(mowp16->hWnd); mowp32w->nCmdShow = mowp16->nCmdShow; if (dwFlags & (MCI_DGV_WINDOW_TEXT | MCI_OVLY_WINDOW_TEXT)) mowp32w->lpstrText = MCI_strdupAtoW(MapSL(mowp16->lpstrText)); } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mowp32w; } return MMSYSTEM_MAP_OKMEM; case MCI_BREAK: { LPMCI_BREAK_PARMS mbp32 = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_BREAK_PARMS)); LPMCI_BREAK_PARMS16 mbp16 = MapSL(*lParam); if (mbp32) { mbp32->dwCallback = mbp16->dwCallback; mbp32->nVirtKey = mbp16->nVirtKey; mbp32->hwndBreak = HWND_32(mbp16->hwndBreak); } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mbp32; } return MMSYSTEM_MAP_OKMEM; case MCI_ESCAPE: { LPMCI_VD_ESCAPE_PARMSW mvep32w = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_VD_ESCAPE_PARMSW)); LPMCI_VD_ESCAPE_PARMS16 mvep16 = MapSL(*lParam); if (mvep32w) { mvep32w->dwCallback = mvep16->dwCallback; mvep32w->lpstrCommand = MCI_strdupAtoW(MapSL(mvep16->lpstrCommand)); } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mvep32w; } return MMSYSTEM_MAP_OKMEM; case MCI_INFO: { LPMCI_DGV_INFO_PARMSW mip32w = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_DGV_INFO_PARMS16) + sizeof(MCI_DGV_INFO_PARMSW)); LPMCI_DGV_INFO_PARMS16 mip16 = MapSL(*lParam); if (mip32w) { *(LPMCI_DGV_INFO_PARMS16*)(mip32w) = mip16; mip32w = (LPMCI_DGV_INFO_PARMSW)((char*)mip32w + sizeof(LPMCI_DGV_INFO_PARMS16)); mip32w->dwCallback = mip16->dwCallback; mip32w->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, mip16->dwRetSize * sizeof(WCHAR)); mip32w->dwRetSize = mip16->dwRetSize; if (dwFlags & MCI_DGV_INFO_ITEM) mip32w->dwItem = mip16->dwItem; } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mip32w; } return MMSYSTEM_MAP_OKMEM; case MCI_OPEN: case MCI_OPEN_DRIVER: { LPMCI_OPEN_PARMSW mop32w = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_OPEN_PARMS16) + sizeof(MCI_ANIM_OPEN_PARMSW)); LPMCI_OPEN_PARMS16 mop16 = MapSL(*lParam); if (mop32w) { *(LPMCI_OPEN_PARMS16*)(mop32w) = mop16; mop32w = (LPMCI_OPEN_PARMSW)((char*)mop32w + sizeof(LPMCI_OPEN_PARMS16)); mop32w->dwCallback = mop16->dwCallback; mop32w->wDeviceID = mop16->wDeviceID; if( ( dwFlags & ( MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID)) == MCI_OPEN_TYPE) mop32w->lpstrDeviceType = MCI_strdupAtoW(MapSL(mop16->lpstrDeviceType)); else mop32w->lpstrDeviceType = (LPWSTR) mop16->lpstrDeviceType; if( ( dwFlags & ( MCI_OPEN_ELEMENT | MCI_OPEN_ELEMENT_ID)) == MCI_OPEN_ELEMENT) mop32w->lpstrElementName = MCI_strdupAtoW(MapSL(mop16->lpstrElementName)); else mop32w->lpstrElementName = (LPWSTR) mop16->lpstrElementName; if( ( dwFlags & MCI_OPEN_ALIAS)) mop32w->lpstrAlias = MCI_strdupAtoW(MapSL(mop16->lpstrAlias)); else mop32w->lpstrAlias = (LPWSTR) mop16->lpstrAlias; /* copy extended information if any... * FIXME: this may seg fault if initial structure does not contain them and * the reads after msip16 fail under LDT limits... * NOTE: this should be split in two. First pass, while calling MCI_OPEN, and * should not take care of extended parameters, and should be used by MCI_Open * to fetch uDevType. When, this is known, the mapping for sending the * MCI_OPEN_DRIVER shall be done depending on uDevType. */ if (HIWORD(dwFlags)) memcpy(mop32w + 1, mop16 + 1, sizeof(MCI_ANIM_OPEN_PARMS16) - sizeof(MCI_OPEN_PARMS16)); } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mop32w; } return MMSYSTEM_MAP_OKMEM; case MCI_SYSINFO: { MCI_SYSINFO_PARMSW *origmsip32w; MCI_SYSINFO_PARMSW *msip32w = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_OPEN_PARMS16 *) + sizeof(MCI_SYSINFO_PARMSW)); MCI_SYSINFO_PARMS16 *msip16 = MapSL(*lParam); if (!msip32w) return MMSYSTEM_MAP_NOMEM; origmsip32w = msip32w; *(MCI_SYSINFO_PARMS16 **)msip32w = msip16; msip32w = (MCI_SYSINFO_PARMSW *)((char *)msip32w + sizeof(MCI_OPEN_PARMS16 *)); msip32w->dwCallback = msip16->dwCallback; msip32w->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, (dwFlags & MCI_SYSINFO_QUANTITY) ? sizeof(DWORD) : msip16->dwRetSize * sizeof(WCHAR)); if (!msip32w->lpstrReturn) { HeapFree(GetProcessHeap(), 0, origmsip32w); return MMSYSTEM_MAP_NOMEM; } msip32w->dwRetSize = (dwFlags & MCI_SYSINFO_QUANTITY) ? sizeof(DWORD) : msip16->dwRetSize; msip32w->dwNumber = msip16->dwNumber; msip32w->wDeviceType = msip16->wDeviceType; *lParam = (DWORD)msip32w; } return MMSYSTEM_MAP_OKMEM; case MCI_SOUND: { LPMCI_SOUND_PARMSW mbp32 = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_SOUND_PARMSW)); LPMCI_SOUND_PARMS16 mbp16 = MapSL(*lParam); if (mbp32) { mbp32->dwCallback = mbp16->dwCallback; mbp32->lpstrSoundName = MCI_strdupAtoW(MapSL(mbp16->lpstrSoundName)); } else { return MMSYSTEM_MAP_NOMEM; } *lParam = (DWORD)mbp32; } return MMSYSTEM_MAP_OKMEM; case DRV_LOAD: case DRV_ENABLE: case DRV_OPEN: case DRV_CLOSE: case DRV_DISABLE: case DRV_FREE: case DRV_CONFIGURE: case DRV_QUERYCONFIGURE: case DRV_INSTALL: case DRV_REMOVE: case DRV_EXITSESSION: case DRV_EXITAPPLICATION: case DRV_POWER: FIXME("This is a hack\n"); return MMSYSTEM_MAP_OK; default: FIXME("Don't know how to map msg=%s\n", MCI_MessageToString(wMsg)); } return MMSYSTEM_MAP_MSGERROR; }
/*********************************************************************** * CC_WMInitDialog16 [internal] */ static LONG CC_WMInitDialog16( HWND hDlg, WPARAM wParam, LPARAM lParam ) { int i, res; int r, g, b; HWND hwnd; RECT rect; POINT point; LCCPRIV lpp; CHOOSECOLORW *ch32; CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam; TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) ); if (ch16->lStructSize != sizeof(CHOOSECOLOR16) ) { HeapFree(GetProcessHeap(), 0, lpp); EndDialog (hDlg, 0) ; return FALSE; } ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) ); lpp->lpcc = ch32; lpp->lpcc16 = ch16; ch32->lStructSize = sizeof(CHOOSECOLORW); ch32->hwndOwner = HWND_32(ch16->hwndOwner); /* Should be an HINSTANCE but MS made a typo */ ch32->hInstance = HWND_32(ch16->hInstance); ch32->lpCustColors = MapSL(ch16->lpCustColors); ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */ ch32->Flags = ch16->Flags; SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)lpp); if (!(lpp->lpcc->Flags & CC_SHOWHELP)) ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE); lpp->msetrgb = RegisterWindowMessageA(SETRGBSTRINGA); #if 0 cpos = MAKELONG(5,7); /* init */ if (lpp->lpcc->Flags & CC_RGBINIT) { for (i = 0; i < 6; i++) for (j = 0; j < 8; j++) if (predefcolors[i][j] == lpp->lpcc->rgbResult) { cpos = MAKELONG(i,j); goto found; } } found: /* FIXME: Draw_a_focus_rect & set_init_values */ #endif GetWindowRect(hDlg, &lpp->fullsize); if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN) { hwnd = GetDlgItem(hDlg, 0x2cf); EnableWindow(hwnd, FALSE); } if (!(lpp->lpcc->Flags & CC_FULLOPEN ) || lpp->lpcc->Flags & CC_PREVENTFULLOPEN) { rect = lpp->fullsize; res = rect.bottom - rect.top; hwnd = GetDlgItem(hDlg, 0x2c6); /* cut at left border */ point.x = point.y = 0; ClientToScreen(hwnd, &point); ScreenToClient(hDlg,&point); GetClientRect(hDlg, &rect); point.x += GetSystemMetrics(SM_CXDLGFRAME); SetWindowPos(hDlg, 0, 0, 0, point.x, res, SWP_NOMOVE|SWP_NOZORDER); for (i = 0x2bf; i < 0x2c5; i++) ShowWindow( GetDlgItem(hDlg, i), SW_HIDE); for (i = 0x2d3; i < 0x2d9; i++) ShowWindow( GetDlgItem(hDlg, i), SW_HIDE); ShowWindow( GetDlgItem(hDlg, 0x2c9), SW_HIDE); ShowWindow( GetDlgItem(hDlg, 0x2c8), SW_HIDE); ShowWindow( GetDlgItem(hDlg, 0x2c6), SW_HIDE); ShowWindow( GetDlgItem(hDlg, 0x2c5), SW_HIDE); ShowWindow( GetDlgItem(hDlg, 1090 ), SW_HIDE); } else CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, NULL); res = TRUE; for (i = 0x2bf; i < 0x2c5; i++) SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0); /* max 3 digits: xyz */ if (CC_HookCallChk(lpp->lpcc)) { res = CallWindowProc16( (WNDPROC16)lpp->lpcc16->lpfnHook, HWND_16(hDlg), WM_INITDIALOG, wParam, lParam); } /* Set the initial values of the color chooser dialog */ r = GetRValue(lpp->lpcc->rgbResult); g = GetGValue(lpp->lpcc->rgbResult); b = GetBValue(lpp->lpcc->rgbResult); CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); lpp->h = CC_RGBtoHSL('H', r, g, b); lpp->s = CC_RGBtoHSL('S', r, g, b); lpp->l = CC_RGBtoHSL('L', r, g, b); /* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */ SetDlgItemInt(hDlg, 703, lpp->h, TRUE); SetDlgItemInt(hDlg, 704, lpp->s, TRUE); SetDlgItemInt(hDlg, 705, lpp->l, TRUE); SetDlgItemInt(hDlg, 706, r, TRUE); SetDlgItemInt(hDlg, 707, g, TRUE); SetDlgItemInt(hDlg, 708, b, TRUE); CC_PaintCross(hDlg, lpp->h, lpp->s); CC_PaintTriangle(hDlg, lpp->l); return res; }
/*********************************************************************** * ColorDlgProc (COMMDLG.8) */ BOOL16 CALLBACK ColorDlgProc16( HWND16 hDlg16, UINT16 message, WPARAM16 wParam, LONG lParam ) { BOOL16 res; HWND hDlg = HWND_32(hDlg16); LCCPRIV lpp = (LCCPRIV)GetWindowLongPtrW(hDlg, DWLP_USER); if (message != WM_INITDIALOG) { if (!lpp) return FALSE; res=0; if (CC_HookCallChk(lpp->lpcc)) res = CallWindowProc16( (WNDPROC16)lpp->lpcc16->lpfnHook, hDlg16, message, wParam, lParam); if (res) return res; } /* FIXME: SetRGB message if (message && message == msetrgb) return HandleSetRGB(hDlg, lParam); */ switch (message) { case WM_INITDIALOG: return CC_WMInitDialog16(hDlg, wParam, lParam); case WM_NCDESTROY: DeleteDC(lpp->hdcMem); DeleteObject(lpp->hbmMem); HeapFree(GetProcessHeap(), 0, lpp->lpcc); HeapFree(GetProcessHeap(), 0, lpp); SetWindowLongPtrW(hDlg, DWLP_USER, 0); /* we don't need it anymore */ break; case WM_COMMAND: if (CC_WMCommand16(hDlg, wParam, lParam, HIWORD(lParam), HWND_32(LOWORD(lParam)))) return TRUE; break; case WM_PAINT: if (CC_WMPaint(hDlg, wParam, lParam)) return TRUE; break; case WM_LBUTTONDBLCLK: if (CC_MouseCheckResultWindow(hDlg,lParam)) return TRUE; break; case WM_MOUSEMOVE: if (CC_WMMouseMove(hDlg, lParam)) return TRUE; break; case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/ if (CC_WMLButtonUp(hDlg, wParam, lParam)) return TRUE; break; case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ if (CC_WMLButtonDown(hDlg, wParam, lParam)) return TRUE; break; } return FALSE ; }
/*********************************************************************** * WINNLSEnableIME (WINNLS.16) */ BOOL WINAPI WINNLSEnableIME16( HWND16 hwnd, BOOL enable ) { return WINNLS32EnableIME( HWND_32(hwnd), enable ); }
/****************************************************************** * MSVIDEO_MapMsg16To32 * * */ static LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { LPVOID ret = 0; TRACE("Mapping %d\n", msg); switch (msg) { case DRV_LOAD: case DRV_ENABLE: case DRV_CLOSE: case DRV_DISABLE: case DRV_FREE: case ICM_ABOUT: case ICM_CONFIGURE: case ICM_COMPRESS_END: case ICM_DECOMPRESS_END: case ICM_DECOMPRESSEX_END: case ICM_SETQUALITY: case ICM_DRAW_START_PLAY: case ICM_DRAW_STOP_PLAY: case ICM_DRAW_REALIZE: case ICM_DRAW_RENDERBUFFER: case ICM_DRAW_END: break; case DRV_OPEN: case ICM_GETDEFAULTQUALITY: case ICM_GETQUALITY: case ICM_SETSTATE: case ICM_DRAW_WINDOW: case ICM_GETBUFFERSWANTED: *lParam1 = (DWORD)MapSL(*lParam1); break; case ICM_GETINFO: { ICINFO *ici = HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO)); ICINFO16 *ici16; ici16 = MapSL(*lParam1); ret = ici16; ici->dwSize = sizeof(ICINFO); COPY(ici, fccType); COPY(ici, fccHandler); COPY(ici, dwFlags); COPY(ici, dwVersion); COPY(ici, dwVersionICM); MultiByteToWideChar( CP_ACP, 0, ici16->szName, -1, ici->szName, 16 ); MultiByteToWideChar( CP_ACP, 0, ici16->szDescription, -1, ici->szDescription, 128 ); MultiByteToWideChar( CP_ACP, 0, ici16->szDriver, -1, ici->szDriver, 128 ); *lParam1 = (DWORD)(ici); *lParam2 = sizeof(ICINFO); } break; case ICM_COMPRESS: { ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS)); ICCOMPRESS *icc16; icc16 = MapSL(*lParam1); ret = icc16; COPY(icc, dwFlags); COPYPTR(icc, lpbiOutput); COPYPTR(icc, lpOutput); COPYPTR(icc, lpbiInput); COPYPTR(icc, lpInput); COPYPTR(icc, lpckid); COPYPTR(icc, lpdwFlags); COPY(icc, lFrameNum); COPY(icc, dwFrameSize); COPY(icc, dwQuality); COPYPTR(icc, lpbiPrev); COPYPTR(icc, lpPrev); *lParam1 = (DWORD)(icc); *lParam2 = sizeof(ICCOMPRESS); } break; case ICM_DECOMPRESS: { ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESS)); ICDECOMPRESS *icd16; /* Same structure except for the pointers */ icd16 = MapSL(*lParam1); ret = icd16; COPY(icd, dwFlags); COPYPTR(icd, lpbiInput); COPYPTR(icd, lpInput); COPYPTR(icd, lpbiOutput); COPYPTR(icd, lpOutput); COPY(icd, ckid); *lParam1 = (DWORD)(icd); *lParam2 = sizeof(ICDECOMPRESS); } break; case ICM_COMPRESS_BEGIN: case ICM_COMPRESS_GET_FORMAT: case ICM_COMPRESS_GET_SIZE: case ICM_COMPRESS_QUERY: case ICM_DECOMPRESS_GET_FORMAT: case ICM_DECOMPRESS_QUERY: case ICM_DECOMPRESS_BEGIN: case ICM_DECOMPRESS_SET_PALETTE: case ICM_DECOMPRESS_GET_PALETTE: *lParam1 = (DWORD)MapSL(*lParam1); *lParam2 = (DWORD)MapSL(*lParam2); break; case ICM_DECOMPRESSEX_QUERY: if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0)) WARN("*lParam2 has unknown value %p\n", (ICDECOMPRESSEX16*)*lParam2); /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16) * This is because of ICMessage(). Special case it? { LPVOID* addr = HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPVOID)); addr[0] = MSVIDEO_MapICDEX16To32(lParam1); if (*lParam2) addr[1] = MSVIDEO_MapICDEX16To32(lParam2); else addr[1] = 0; ret = addr; } break;*/ case ICM_DECOMPRESSEX_BEGIN: case ICM_DECOMPRESSEX: ret = MSVIDEO_MapICDEX16To32(lParam1); *lParam2 = sizeof(ICDECOMPRESSEX); break; case ICM_DRAW_BEGIN: { ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWBEGIN)); ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1); ret = icdb16; COPY(icdb, dwFlags); icdb->hpal = HPALETTE_32(icdb16->hpal); icdb->hwnd = HWND_32(icdb16->hwnd); icdb->hdc = HDC_32(icdb16->hdc); COPY(icdb, xDst); COPY(icdb, yDst); COPY(icdb, dxDst); COPY(icdb, dyDst); COPYPTR(icdb, lpbi); COPY(icdb, xSrc); COPY(icdb, ySrc); COPY(icdb, dxSrc); COPY(icdb, dySrc); COPY(icdb, dwRate); COPY(icdb, dwScale); *lParam1 = (DWORD)(icdb); *lParam2 = sizeof(ICDRAWBEGIN); } break; case ICM_DRAW_SUGGESTFORMAT: { ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWSUGGEST)); ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1); ret = icds16; COPY(icds, dwFlags); COPYPTR(icds, lpbiIn); COPYPTR(icds, lpbiSuggest); COPY(icds, dxSrc); COPY(icds, dySrc); COPY(icds, dxDst); COPY(icds, dyDst); icds->hicDecompressor = HIC_32(icds16->hicDecompressor); *lParam1 = (DWORD)(icds); *lParam2 = sizeof(ICDRAWSUGGEST); } break; case ICM_DRAW: { ICDRAW *icd = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAW)); ICDRAW *icd16 = MapSL(*lParam1); ret = icd16; COPY(icd, dwFlags); COPYPTR(icd, lpFormat); COPYPTR(icd, lpData); COPY(icd, cbData); COPY(icd, lTime); *lParam1 = (DWORD)(icd); *lParam2 = sizeof(ICDRAW); } break; case ICM_DRAW_START: case ICM_DRAW_STOP: break; default: FIXME("%d is not yet handled. Expect a crash.\n", msg); } return ret; }
/*********************************************************************** * MCIWndCreate(MSVIDEO.250) */ HWND16 CDECL MCIWndCreate16(HWND16 hwnd, HINSTANCE16 hinst16, DWORD style, LPSTR file) { return HWND_16(MCIWndCreateA(HWND_32(hwnd), 0, style, file)); }
/*********************************************************************** * WINNLSGetEnableStatus (WINNLS.18) */ BOOL WINAPI WINNLSGetEnableStatus16( HWND16 hwnd ) { return WINNLS32GetEnableStatus( HWND_32(hwnd) ); }