Fix several bugs in msrle32 preventing it to load.

Remove a hack in ICOpen compensating a bug in msrle32.
Use MSVFW32_hModule directly in ICCompressorChoose, and avoid a
convoluted GWLP_HINSTANCE hack.
This commit is contained in:
Dmitry Timoshkov 2005-11-28 10:44:34 +01:00 committed by Alexandre Julliard
parent 966df981a1
commit e1e83cac75
2 changed files with 7 additions and 35 deletions

View File

@ -58,7 +58,6 @@ inline WORD Intensity(RGBQUAD clr)
/* utility functions */ /* utility functions */
static BOOL isSupportedDIB(LPCBITMAPINFOHEADER lpbi); static BOOL isSupportedDIB(LPCBITMAPINFOHEADER lpbi);
static BOOL isSupportedMRLE(LPCBITMAPINFOHEADER lpbi); static BOOL isSupportedMRLE(LPCBITMAPINFOHEADER lpbi);
static void LoadWideString(UINT id, LPWSTR str, INT len);
static BYTE MSRLE32_GetNearestPaletteIndex(UINT count, const RGBQUAD *clrs, RGBQUAD clr); static BYTE MSRLE32_GetNearestPaletteIndex(UINT count, const RGBQUAD *clrs, RGBQUAD clr);
/* compression functions */ /* compression functions */
@ -98,14 +97,6 @@ static LRESULT DecompressGetPalette(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
/*****************************************************************************/ /*****************************************************************************/
static void LoadWideString(UINT id, LPWSTR str, INT len)
{
char szTemp[80];
LoadStringA(MSRLE32_hModule, id, szTemp, sizeof(szTemp));
MultiByteToWideChar(CP_ACP, 0, szTemp, -1, str, len);
}
static BOOL isSupportedMRLE(LPCBITMAPINFOHEADER lpbi) static BOOL isSupportedMRLE(LPCBITMAPINFOHEADER lpbi)
{ {
/* pre-conditions */ /* pre-conditions */
@ -1113,9 +1104,6 @@ static CodecInfo* Open(LPICOPEN icinfo)
icinfo->fccHandler, (char*)&icinfo->fccHandler, icinfo->fccHandler, (char*)&icinfo->fccHandler,
icinfo->dwVersion,icinfo->dwFlags); icinfo->dwVersion,icinfo->dwFlags);
if (icinfo->fccType != ICTYPE_VIDEO)
return NULL;
switch (icinfo->fccHandler) { switch (icinfo->fccHandler) {
case FOURCC_RLE: case FOURCC_RLE:
case FOURCC_RLE4: case FOURCC_RLE4:
@ -1176,14 +1164,14 @@ static LRESULT GetInfo(CodecInfo *pi, ICINFO *icinfo, DWORD dwSize)
return 0; return 0;
icinfo->dwSize = sizeof(ICINFO); icinfo->dwSize = sizeof(ICINFO);
icinfo->fccType = streamtypeVIDEO; icinfo->fccType = ICTYPE_VIDEO;
icinfo->fccHandler = (pi != NULL ? pi->fccHandler : FOURCC_MRLE); icinfo->fccHandler = (pi != NULL ? pi->fccHandler : FOURCC_MRLE);
icinfo->dwFlags = VIDCF_QUALITY | VIDCF_TEMPORAL | VIDCF_CRUNCH | VIDCF_FASTTEMPORALC; icinfo->dwFlags = VIDCF_QUALITY | VIDCF_TEMPORAL | VIDCF_CRUNCH | VIDCF_FASTTEMPORALC;
icinfo->dwVersion = MSRLE32_VERSION; icinfo->dwVersion = MSRLE32_VERSION;
icinfo->dwVersionICM = 0x01040000; /* Version 1.4 build 0 */ icinfo->dwVersionICM = 0x01040000; /* Version 1.4 build 0 */
LoadWideString(IDS_NAME, icinfo->szName, sizeof(icinfo->szName)); LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, sizeof(icinfo->szName)/sizeof(WCHAR));
LoadWideString(IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)); LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)/sizeof(WCHAR));
return sizeof(ICINFO); return sizeof(ICINFO);
} }
@ -1796,9 +1784,6 @@ LRESULT CALLBACK MSRLE32_DriverProc(DWORD dwDrvID, HDRVR hDrv, UINT uMsg,
case DRV_LOAD: case DRV_LOAD:
return DRVCNF_OK; return DRVCNF_OK;
case DRV_OPEN: case DRV_OPEN:
if (lParam2 == 0)
return (LRESULT)0xFFFF0000;
else
return (LRESULT)Open((ICOPEN*)lParam2); return (LRESULT)Open((ICOPEN*)lParam2);
case DRV_CLOSE: case DRV_CLOSE:
if (dwDrvID != 0xFFFF0000 && (LPVOID)dwDrvID != NULL) if (dwDrvID != 0xFFFF0000 && (LPVOID)dwDrvID != NULL)
@ -1910,7 +1895,7 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
break; break;
}; }
return TRUE; return TRUE;
} }

View File

@ -139,6 +139,7 @@ static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param)
{ {
for (s = buf; *s; s += strlen(s) + 1) for (s = buf; *s; s += strlen(s) + 1)
{ {
TRACE("got %s\n", s);
if (strncasecmp(s, fccTypeStr, 5) || s[9] != '=') continue; if (strncasecmp(s, fccTypeStr, 5) || s[9] != '=') continue;
if ((result = handler(s, cnt++, param))) break; if ((result = handler(s, cnt++, param))) break;
} }
@ -348,21 +349,8 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
codecname[9] = '\0'; codecname[9] = '\0';
hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen); hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
if (!hdrv)
{
if (fccType == streamtypeVIDEO)
{
codecname[0] = 'v';
codecname[1] = 'i';
codecname[2] = 'd';
codecname[3] = 'c';
fccType = ICTYPE_VIDEO;
hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
}
if (!hdrv) if (!hdrv)
return 0; return 0;
}
} else { } else {
/* The driver has been registered at runtime with its name */ /* The driver has been registered at runtime with its name */
hdrv = OpenDriver(driver->name, NULL, (LPARAM)&icopen); hdrv = OpenDriver(driver->name, NULL, (LPARAM)&icopen);
@ -767,8 +755,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA
if (choose_comp->title) if (choose_comp->title)
SetWindowTextA(hdlg, choose_comp->title); SetWindowTextA(hdlg, choose_comp->title);
LoadStringW((HINSTANCE)GetWindowLongPtrW(hdlg, GWLP_HINSTANCE), LoadStringW(MSVFW32_hModule, IDS_FULLFRAMES, buf, 128);
IDS_FULLFRAMES, buf, 128);
SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_ADDSTRING, 0, (LPARAM)buf); SendDlgItemMessageW(hdlg, IDC_COMP_LIST, CB_ADDSTRING, 0, (LPARAM)buf);
enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST)); enum_compressors(GetDlgItem(hdlg, IDC_COMP_LIST));