windowscodecs: Implement IWICBitmapCodecInfo::GetMimeTypes.
This commit is contained in:
parent
2d2a6526d8
commit
a53a57b79e
|
@ -36,8 +36,34 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
|
||||
|
||||
static WCHAR const mimetypes_valuename[] = {'M','i','m','e','T','y','p','e','s',0};
|
||||
static WCHAR const pixelformats_keyname[] = {'P','i','x','e','l','F','o','r','m','a','t','s',0};
|
||||
|
||||
static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value,
|
||||
UINT buffer_size, WCHAR *buffer, UINT *actual_size)
|
||||
{
|
||||
LONG ret;
|
||||
DWORD cbdata=buffer_size * sizeof(WCHAR);
|
||||
|
||||
if (!actual_size)
|
||||
return E_INVALIDARG;
|
||||
|
||||
ret = RegGetValueW(classkey, NULL, value, RRF_RT_REG_SZ|RRF_NOEXPAND, NULL,
|
||||
buffer, &cbdata);
|
||||
|
||||
if (ret == 0 || ret == ERROR_MORE_DATA)
|
||||
*actual_size = cbdata/sizeof(WCHAR);
|
||||
|
||||
if (!buffer && buffer_size != 0)
|
||||
/* Yes, native returns the correct size in this case. */
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (ret == ERROR_MORE_DATA)
|
||||
return WINCODEC_ERR_INSUFFICIENTBUFFER;
|
||||
|
||||
return HRESULT_FROM_WIN32(ret);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const IWICBitmapDecoderInfoVtbl *lpIWICBitmapDecoderInfoVtbl;
|
||||
LONG ref;
|
||||
|
@ -188,8 +214,12 @@ static HRESULT WINAPI BitmapDecoderInfo_GetDeviceModels(IWICBitmapDecoderInfo *i
|
|||
static HRESULT WINAPI BitmapDecoderInfo_GetMimeTypes(IWICBitmapDecoderInfo *iface,
|
||||
UINT cchMimeTypes, WCHAR *wzMimeTypes, UINT *pcchActual)
|
||||
{
|
||||
FIXME("(%p,%u,%p,%p): stub\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
return E_NOTIMPL;
|
||||
BitmapDecoderInfo *This = (BitmapDecoderInfo*)iface;
|
||||
|
||||
TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
|
||||
return ComponentInfo_GetStringValue(This->classkey, mimetypes_valuename,
|
||||
cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BitmapDecoderInfo_GetFileExtensions(IWICBitmapDecoderInfo *iface,
|
||||
|
@ -616,8 +646,12 @@ static HRESULT WINAPI BitmapEncoderInfo_GetDeviceModels(IWICBitmapEncoderInfo *i
|
|||
static HRESULT WINAPI BitmapEncoderInfo_GetMimeTypes(IWICBitmapEncoderInfo *iface,
|
||||
UINT cchMimeTypes, WCHAR *wzMimeTypes, UINT *pcchActual)
|
||||
{
|
||||
FIXME("(%p,%u,%p,%p): stub\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
return E_NOTIMPL;
|
||||
BitmapEncoderInfo *This = (BitmapEncoderInfo*)iface;
|
||||
|
||||
TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
|
||||
return ComponentInfo_GetStringValue(This->classkey, mimetypes_valuename,
|
||||
cchMimeTypes, wzMimeTypes, pcchActual);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BitmapEncoderInfo_GetFileExtensions(IWICBitmapEncoderInfo *iface,
|
||||
|
|
|
@ -47,7 +47,6 @@ static void test_decoder_info(void)
|
|||
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void**)&decoder_info);
|
||||
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
|
||||
|
||||
todo_wine {
|
||||
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
|
||||
|
||||
|
@ -76,7 +75,6 @@ todo_wine {
|
|||
ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
|
||||
ok(lstrcmpW(value, expected_mimetype) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
|
||||
ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
|
||||
}
|
||||
|
||||
IWICBitmapDecoderInfo_Release(decoder_info);
|
||||
|
||||
|
|
Loading…
Reference in New Issue