[2/5] d3dx9: Forward D3DXSaveSurfaceToFileA to D3DXSaveSurfaceToFileW.

Henri Verbeet hverbeet at gmail.com
Thu May 3 06:08:52 CDT 2012

On 2 May 2012 23:32, Józef Kucia <joseph.kucia at gmail.com> wrote:
> +HRESULT WINAPI D3DXSaveSurfaceToFileA(LPCSTR dst_filename, D3DXIMAGE_FILEFORMAT file_format,
> +        IDirect3DSurface9 *src_surface, const PALETTEENTRY *src_palette, const RECT *src_rect)
If you're changing these anyway, LPCSTR is a broken way of saying
"const char *".

> +    TRACE("(%s, %d, %p, %p, %p): relay\n",
> +            wine_dbgstr_a(dst_filename), file_format, src_surface, src_palette, src_rect);
I generally prefer %#x for things like file_format, but don't care
particularly strongly. For src_rect you should use %s and
wine_dbgstr_rect(). I don't care much for the "relay" suffix, but I
suppose half the existing code has it as well.

> +    len = MultiByteToWideChar(CP_ACP, 0, dst_filename, -1, NULL, 0);
> +    filename = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR));
The HEAP_ZERO_MEMORY flag is useless, you're immediately going to
overwrite all the memory afterwards. Sadly the existing d3dx9 code
isn't a very good example here either.

More information about the wine-devel mailing list