d3dx10: Handle null filename for W->A conversion explicitly in D3DX10CreateEffectFromResourceW().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-09 11:22:41 +03:00 committed by Alexandre Julliard
parent 0727bba57f
commit 613044fab7

View file

@ -176,7 +176,7 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso
ID3D10EffectPool *effect_pool, ID3DX10ThreadPump *pump, ID3D10Effect **effect,
ID3D10Blob **errors, HRESULT *hresult)
{
char *filename;
char *filename = NULL;
HRSRC resinfo;
void *data;
DWORD size;
@ -195,10 +195,13 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso
if (FAILED(hr = get_resource_data(module, resinfo, &data, &size)))
return hr;
len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
if (!(filename = heap_alloc(len)))
return E_OUTOFMEMORY;
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, len, NULL, NULL);
if (filenameW)
{
len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
if (!(filename = heap_alloc(len)))
return E_OUTOFMEMORY;
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, len, NULL, NULL);
}
hr = D3DX10CreateEffectFromMemory(data, size, filename, defines, include, profile,
shader_flags, effect_flags, device, effect_pool, pump, effect, errors, hresult);