Commit f98a32ad authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

windowscodecs: Return fail for unsupported format in DdsDecoder_Initialize().

parent 81405aa8
......@@ -626,10 +626,26 @@ static HRESULT WINAPI DdsDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
WICDecodeOptions cacheOptions)
{
DdsDecoder *This = impl_from_IWICBitmapDecoder(iface);
HRESULT hr;
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
return IWICWineDecoder_Initialize(&This->IWICWineDecoder_iface, pIStream, cacheOptions);
EnterCriticalSection(&This->lock);
hr = IWICWineDecoder_Initialize(&This->IWICWineDecoder_iface, pIStream, cacheOptions);
if (FAILED(hr)) goto end;
if (!This->info.compressed || This->info.dimension == WICDdsTextureCube) {
IStream_Release(pIStream);
This->stream = NULL;
This->initialized = FALSE;
hr = WINCODEC_ERR_BADHEADER;
}
end:
LeaveCriticalSection(&This->lock);
return hr;
}
static HRESULT WINAPI DdsDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
......
......@@ -237,7 +237,6 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
if (index == -1) {
ok(hr == S_OK, "Decoder initialize failed, hr %#x\n", hr);
} else {
todo_wine_if(wine_init)
ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr);
}
......@@ -251,10 +250,8 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
if (hr == S_OK) {
hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
if (index == -1) {
todo_wine
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
} else {
todo_wine
ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment