2020-10-09 21:56:16 +02:00
|
|
|
/*
|
|
|
|
* unix_lib.c - This is the Unix side of the Unix interface.
|
|
|
|
*
|
|
|
|
* Copyright 2020 Esme Povirk
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
|
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winternl.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "wincodecs_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2020-10-09 21:56:19 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
#include "wincodecs_common.h"
|
|
|
|
|
2020-10-09 21:56:17 +02:00
|
|
|
static const struct win32_funcs *win32_funcs;
|
|
|
|
|
|
|
|
HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read)
|
|
|
|
{
|
|
|
|
return win32_funcs->stream_read(stream, buffer, read, bytes_read);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position)
|
|
|
|
{
|
|
|
|
return win32_funcs->stream_seek(stream, ofs, origin, new_position);
|
|
|
|
}
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result)
|
|
|
|
{
|
|
|
|
if (IsEqualGUID(decoder_clsid, &CLSID_WICPngDecoder))
|
|
|
|
return png_decoder_create(info, result);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct unix_funcs unix_funcs = {
|
|
|
|
decoder_create,
|
2020-10-09 21:56:17 +02:00
|
|
|
decoder_initialize,
|
2020-10-09 21:56:18 +02:00
|
|
|
decoder_get_frame_info,
|
2020-10-09 21:56:19 +02:00
|
|
|
decoder_copy_pixels,
|
2020-10-09 21:56:20 +02:00
|
|
|
decoder_get_metadata_blocks,
|
2020-10-09 21:56:21 +02:00
|
|
|
decoder_get_color_context,
|
2020-10-09 21:56:16 +02:00
|
|
|
decoder_destroy
|
|
|
|
};
|
|
|
|
|
|
|
|
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
|
|
|
{
|
|
|
|
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
|
|
|
|
|
2020-10-09 21:56:17 +02:00
|
|
|
win32_funcs = ptr_in;
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
*(const struct unix_funcs **)ptr_out = &unix_funcs;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|