ReactOS 0.4.16-dev-297-gc569aee
metadatahandler.c File Reference
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wine/winternl.h"
#include "objbase.h"
#include "propvarutil.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
Include dependency graph for metadatahandler.c:

Go to the source code of this file.

Classes

struct  MetadataHandler
 
struct  MetadataHandlerEnum
 
struct  IFD_entry
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define SWAP_USHORT(x)   do { if (!native_byte_order) (x) = RtlUshortByteSwap(x); } while(0)
 
#define SWAP_ULONG(x)   do { if (!native_byte_order) (x) = RtlUlongByteSwap(x); } while(0)
 
#define SWAP_ULONGLONG(x)   do { if (!native_byte_order) (x) = RtlUlonglongByteSwap(x); } while(0)
 
#define IFD_BYTE   1
 
#define IFD_ASCII   2
 
#define IFD_SHORT   3
 
#define IFD_LONG   4
 
#define IFD_RATIONAL   5
 
#define IFD_SBYTE   6
 
#define IFD_UNDEFINED   7
 
#define IFD_SSHORT   8
 
#define IFD_SLONG   9
 
#define IFD_SRATIONAL   10
 
#define IFD_FLOAT   11
 
#define IFD_DOUBLE   12
 
#define IFD_IFD   13
 

Typedefs

typedef struct MetadataHandler MetadataHandler
 
typedef struct MetadataHandlerEnum MetadataHandlerEnum
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
static MetadataHandlerimpl_from_IWICMetadataWriter (IWICMetadataWriter *iface)
 
static MetadataHandlerimpl_from_IWICPersistStream (IWICPersistStream *iface)
 
static void MetadataHandler_FreeItems (MetadataHandler *This)
 
static HRESULT MetadataHandlerEnum_Create (MetadataHandler *parent, DWORD index, IWICEnumMetadataItem **ppIEnumMetadataItem)
 
static HRESULT WINAPI MetadataHandler_QueryInterface (IWICMetadataWriter *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI MetadataHandler_AddRef (IWICMetadataWriter *iface)
 
static ULONG WINAPI MetadataHandler_Release (IWICMetadataWriter *iface)
 
static HRESULT WINAPI MetadataHandler_GetMetadataHandlerInfo (IWICMetadataWriter *iface, IWICMetadataHandlerInfo **ppIHandler)
 
static HRESULT WINAPI MetadataHandler_GetMetadataFormat (IWICMetadataWriter *iface, GUID *pguidMetadataFormat)
 
static HRESULT WINAPI MetadataHandler_GetCount (IWICMetadataWriter *iface, UINT *pcCount)
 
static HRESULT WINAPI MetadataHandler_GetValueByIndex (IWICMetadataWriter *iface, UINT index, PROPVARIANT *schema, PROPVARIANT *id, PROPVARIANT *value)
 
static HRESULT WINAPI MetadataHandler_GetValue (IWICMetadataWriter *iface, const PROPVARIANT *schema, const PROPVARIANT *id, PROPVARIANT *value)
 
static HRESULT WINAPI MetadataHandler_GetEnumerator (IWICMetadataWriter *iface, IWICEnumMetadataItem **ppIEnumMetadata)
 
static HRESULT WINAPI MetadataHandler_SetValue (IWICMetadataWriter *iface, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue)
 
static HRESULT WINAPI MetadataHandler_SetValueByIndex (IWICMetadataWriter *iface, UINT nIndex, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue)
 
static HRESULT WINAPI MetadataHandler_RemoveValue (IWICMetadataWriter *iface, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId)
 
static HRESULT WINAPI MetadataHandler_RemoveValueByIndex (IWICMetadataWriter *iface, UINT nIndex)
 
static HRESULT WINAPI MetadataHandler_PersistStream_QueryInterface (IWICPersistStream *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI MetadataHandler_PersistStream_AddRef (IWICPersistStream *iface)
 
static ULONG WINAPI MetadataHandler_PersistStream_Release (IWICPersistStream *iface)
 
static HRESULT WINAPI MetadataHandler_GetClassID (IWICPersistStream *iface, CLSID *pClassID)
 
static HRESULT WINAPI MetadataHandler_IsDirty (IWICPersistStream *iface)
 
static HRESULT WINAPI MetadataHandler_Load (IWICPersistStream *iface, IStream *pStm)
 
static HRESULT WINAPI MetadataHandler_Save (IWICPersistStream *iface, IStream *pStm, BOOL fClearDirty)
 
static HRESULT WINAPI MetadataHandler_GetSizeMax (IWICPersistStream *iface, ULARGE_INTEGER *pcbSize)
 
static HRESULT WINAPI MetadataHandler_LoadEx (IWICPersistStream *iface, IStream *pIStream, const GUID *pguidPreferredVendor, DWORD dwPersistOptions)
 
static HRESULT WINAPI MetadataHandler_SaveEx (IWICPersistStream *iface, IStream *pIStream, DWORD dwPersistOptions, BOOL fClearDirty)
 
HRESULT MetadataReader_Create (const MetadataHandlerVtbl *vtable, REFIID iid, void **ppv)
 
static MetadataHandlerEnumimpl_from_IWICEnumMetadataItem (IWICEnumMetadataItem *iface)
 
static HRESULT WINAPI MetadataHandlerEnum_QueryInterface (IWICEnumMetadataItem *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI MetadataHandlerEnum_AddRef (IWICEnumMetadataItem *iface)
 
static ULONG WINAPI MetadataHandlerEnum_Release (IWICEnumMetadataItem *iface)
 
static HRESULT WINAPI MetadataHandlerEnum_Next (IWICEnumMetadataItem *iface, ULONG celt, PROPVARIANT *rgeltSchema, PROPVARIANT *rgeltId, PROPVARIANT *rgeltValue, ULONG *pceltFetched)
 
static HRESULT WINAPI MetadataHandlerEnum_Skip (IWICEnumMetadataItem *iface, ULONG celt)
 
static HRESULT WINAPI MetadataHandlerEnum_Reset (IWICEnumMetadataItem *iface)
 
static HRESULT WINAPI MetadataHandlerEnum_Clone (IWICEnumMetadataItem *iface, IWICEnumMetadataItem **ppIEnumMetadataItem)
 
static HRESULT LoadUnknownMetadata (IStream *input, const GUID *preferred_vendor, DWORD persist_options, MetadataItem **items, DWORD *item_count)
 
HRESULT UnknownMetadataReader_CreateInstance (REFIID iid, void **ppv)
 
static int tag_to_vt (SHORT tag)
 
static HRESULT load_IFD_entry (IStream *input, const struct IFD_entry *entry, MetadataItem *item, BOOL native_byte_order)
 
static HRESULT LoadIfdMetadata (IStream *input, const GUID *preferred_vendor, DWORD persist_options, MetadataItem **items, DWORD *item_count)
 
HRESULT IfdMetadataReader_CreateInstance (REFIID iid, void **ppv)
 

Variables

static const IWICMetadataWriterVtbl MetadataHandler_Vtbl
 
static const IWICPersistStreamVtbl MetadataHandler_PersistStream_Vtbl
 
static const IWICEnumMetadataItemVtbl MetadataHandlerEnum_Vtbl
 
static const MetadataHandlerVtbl UnknownMetadataReader_Vtbl
 
static const MetadataHandlerVtbl IfdMetadataReader_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file metadatahandler.c.

◆ IFD_ASCII

#define IFD_ASCII   2

Definition at line 683 of file metadatahandler.c.

◆ IFD_BYTE

#define IFD_BYTE   1

Definition at line 682 of file metadatahandler.c.

◆ IFD_DOUBLE

#define IFD_DOUBLE   12

Definition at line 693 of file metadatahandler.c.

◆ IFD_FLOAT

#define IFD_FLOAT   11

Definition at line 692 of file metadatahandler.c.

◆ IFD_IFD

#define IFD_IFD   13

Definition at line 694 of file metadatahandler.c.

◆ IFD_LONG

#define IFD_LONG   4

Definition at line 685 of file metadatahandler.c.

◆ IFD_RATIONAL

#define IFD_RATIONAL   5

Definition at line 686 of file metadatahandler.c.

◆ IFD_SBYTE

#define IFD_SBYTE   6

Definition at line 687 of file metadatahandler.c.

◆ IFD_SHORT

#define IFD_SHORT   3

Definition at line 684 of file metadatahandler.c.

◆ IFD_SLONG

#define IFD_SLONG   9

Definition at line 690 of file metadatahandler.c.

◆ IFD_SRATIONAL

#define IFD_SRATIONAL   10

Definition at line 691 of file metadatahandler.c.

◆ IFD_SSHORT

#define IFD_SSHORT   8

Definition at line 689 of file metadatahandler.c.

◆ IFD_UNDEFINED

#define IFD_UNDEFINED   7

Definition at line 688 of file metadatahandler.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 26 of file metadatahandler.c.

◆ SWAP_ULONG

#define SWAP_ULONG (   x)    do { if (!native_byte_order) (x) = RtlUlongByteSwap(x); } while(0)

Definition at line 671 of file metadatahandler.c.

◆ SWAP_ULONGLONG

#define SWAP_ULONGLONG (   x)    do { if (!native_byte_order) (x) = RtlUlonglongByteSwap(x); } while(0)

Definition at line 672 of file metadatahandler.c.

◆ SWAP_USHORT

#define SWAP_USHORT (   x)    do { if (!native_byte_order) (x) = RtlUshortByteSwap(x); } while(0)

Definition at line 670 of file metadatahandler.c.

Typedef Documentation

◆ MetadataHandler

◆ MetadataHandlerEnum

Function Documentation

◆ IfdMetadataReader_CreateInstance()

HRESULT IfdMetadataReader_CreateInstance ( REFIID  iid,
void **  ppv 
)

Definition at line 1093 of file metadatahandler.c.

1094{
1096}
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void **ppv)
static const MetadataHandlerVtbl IfdMetadataReader_Vtbl

◆ impl_from_IWICEnumMetadataItem()

static MetadataHandlerEnum * impl_from_IWICEnumMetadataItem ( IWICEnumMetadataItem iface)
inlinestatic

◆ impl_from_IWICMetadataWriter()

◆ impl_from_IWICPersistStream()

static MetadataHandler * impl_from_IWICPersistStream ( IWICPersistStream iface)
inlinestatic

◆ load_IFD_entry()

static HRESULT load_IFD_entry ( IStream input,
const struct IFD_entry entry,
MetadataItem item,
BOOL  native_byte_order 
)
static

Definition at line 718 of file metadatahandler.c.

720{
721 ULONG count, value, i;
722 SHORT type;
724 HRESULT hr;
725
726 item->schema.vt = VT_EMPTY;
727 item->id.vt = VT_UI2;
728 item->id.u.uiVal = entry->id;
729 SWAP_USHORT(item->id.u.uiVal);
730
731 count = entry->count;
733 type = entry->type;
735 item->value.vt = tag_to_vt(type);
736 value = entry->value;
738
739 switch (type)
740 {
741 case IFD_BYTE:
742 case IFD_SBYTE:
743 if (!count) count = 1;
744
745 if (count <= 4)
746 {
747 const BYTE *data = (const BYTE *)&entry->value;
748
749 if (count == 1)
750 item->value.u.bVal = data[0];
751 else
752 {
753 item->value.vt |= VT_VECTOR;
754 item->value.u.caub.cElems = count;
755 item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, count);
756 memcpy(item->value.u.caub.pElems, data, count);
757 }
758 break;
759 }
760
761 item->value.vt |= VT_VECTOR;
762 item->value.u.caub.cElems = count;
763 item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count);
764 if (!item->value.u.caub.pElems) return E_OUTOFMEMORY;
765
766 pos.QuadPart = value;
767 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
768 if (FAILED(hr))
769 {
770 HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
771 return hr;
772 }
773 hr = IStream_Read(input, item->value.u.caub.pElems, count, NULL);
774 if (FAILED(hr))
775 {
776 HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
777 return hr;
778 }
779 break;
780 case IFD_SHORT:
781 case IFD_SSHORT:
782 if (!count) count = 1;
783
784 if (count <= 2)
785 {
786 const SHORT *data = (const SHORT *)&entry->value;
787
788 if (count == 1)
789 {
790 item->value.u.uiVal = data[0];
791 SWAP_USHORT(item->value.u.uiVal);
792 }
793 else
794 {
795 item->value.vt |= VT_VECTOR;
796 item->value.u.caui.cElems = count;
797 item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), 0, count * 2);
798 memcpy(item->value.u.caui.pElems, data, count * 2);
799 for (i = 0; i < count; i++)
800 SWAP_USHORT(item->value.u.caui.pElems[i]);
801 }
802 break;
803 }
804
805 item->value.vt |= VT_VECTOR;
806 item->value.u.caui.cElems = count;
807 item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 2);
808 if (!item->value.u.caui.pElems) return E_OUTOFMEMORY;
809
810 pos.QuadPart = value;
811 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
812 if (FAILED(hr))
813 {
814 HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
815 return hr;
816 }
817 hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, NULL);
818 if (FAILED(hr))
819 {
820 HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
821 return hr;
822 }
823 for (i = 0; i < count; i++)
824 SWAP_USHORT(item->value.u.caui.pElems[i]);
825 break;
826 case IFD_LONG:
827 case IFD_SLONG:
828 case IFD_FLOAT:
829 if (!count) count = 1;
830
831 if (count == 1)
832 {
833 item->value.u.ulVal = value;
834 break;
835 }
836
837 item->value.vt |= VT_VECTOR;
838 item->value.u.caul.cElems = count;
839 item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 4);
840 if (!item->value.u.caul.pElems) return E_OUTOFMEMORY;
841
842 pos.QuadPart = value;
843 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
844 if (FAILED(hr))
845 {
846 HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
847 return hr;
848 }
849 hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, NULL);
850 if (FAILED(hr))
851 {
852 HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
853 return hr;
854 }
855 for (i = 0; i < count; i++)
856 SWAP_ULONG(item->value.u.caul.pElems[i]);
857 break;
858 case IFD_RATIONAL:
859 case IFD_SRATIONAL:
860 case IFD_DOUBLE:
861 if (!count)
862 {
863 FIXME("IFD field type %d, count 0\n", type);
864 item->value.vt = VT_EMPTY;
865 break;
866 }
867
868 if (count == 1)
869 {
870 ULONGLONG ull;
871
872 pos.QuadPart = value;
873 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
874 if (FAILED(hr)) return hr;
875
876 hr = IStream_Read(input, &ull, sizeof(ull), NULL);
877 if (hr != S_OK) return hr;
878
879 item->value.u.uhVal.QuadPart = ull;
880
881 if (type == IFD_DOUBLE)
882 SWAP_ULONGLONG(item->value.u.uhVal.QuadPart);
883 else
884 {
885 SWAP_ULONG(item->value.u.uhVal.u.LowPart);
886 SWAP_ULONG(item->value.u.uhVal.u.HighPart);
887 }
888 break;
889 }
890 else
891 {
892 item->value.vt |= VT_VECTOR;
893 item->value.u.cauh.cElems = count;
894 item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 8);
895 if (!item->value.u.cauh.pElems) return E_OUTOFMEMORY;
896
897 pos.QuadPart = value;
898 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
899 if (FAILED(hr))
900 {
901 HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
902 return hr;
903 }
904 hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, NULL);
905 if (FAILED(hr))
906 {
907 HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
908 return hr;
909 }
910 for (i = 0; i < count; i++)
911 {
912 if (type == IFD_DOUBLE)
913 SWAP_ULONGLONG(item->value.u.cauh.pElems[i].QuadPart);
914 else
915 {
916 SWAP_ULONG(item->value.u.cauh.pElems[i].u.LowPart);
917 SWAP_ULONG(item->value.u.cauh.pElems[i].u.HighPart);
918 }
919 }
920 }
921 break;
922 case IFD_ASCII:
923 item->value.u.pszVal = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count + 1);
924 if (!item->value.u.pszVal) return E_OUTOFMEMORY;
925
926 if (count <= 4)
927 {
928 const char *data = (const char *)&entry->value;
929 memcpy(item->value.u.pszVal, data, count);
930 item->value.u.pszVal[count] = 0;
931 break;
932 }
933
934 pos.QuadPart = value;
935 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
936 if (FAILED(hr))
937 {
938 HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
939 return hr;
940 }
941 hr = IStream_Read(input, item->value.u.pszVal, count, NULL);
942 if (FAILED(hr))
943 {
944 HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
945 return hr;
946 }
947 item->value.u.pszVal[count] = 0;
948 break;
949 case IFD_UNDEFINED:
950 if (!count)
951 {
952 FIXME("IFD field type %d, count 0\n", type);
953 item->value.vt = VT_EMPTY;
954 break;
955 }
956
957 item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count);
958 if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
959
960 item->value.u.blob.cbSize = count;
961
962 if (count <= 4)
963 {
964 const char *data = (const char *)&entry->value;
965 memcpy(item->value.u.blob.pBlobData, data, count);
966 break;
967 }
968
969 pos.QuadPart = value;
970 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
971 if (FAILED(hr))
972 {
973 HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
974 return hr;
975 }
976 hr = IStream_Read(input, item->value.u.blob.pBlobData, count, NULL);
977 if (FAILED(hr))
978 {
979 HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
980 return hr;
981 }
982 break;
983 default:
984 FIXME("loading field of type %d, count %u is not implemented\n", type, count);
985 break;
986 }
987 return S_OK;
988}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
@ VT_UI2
Definition: compat.h:2312
@ VT_EMPTY
Definition: compat.h:2295
@ VT_VECTOR
Definition: compat.h:2340
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLenum GLenum input
Definition: glext.h:9031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define SEEK_SET
Definition: jmemansi.c:26
if(dx< 0)
Definition: linetemp.h:194
#define SWAP_USHORT(x)
#define SWAP_ULONGLONG(x)
#define IFD_BYTE
#define IFD_SBYTE
#define IFD_UNDEFINED
static int tag_to_vt(SHORT tag)
#define IFD_SRATIONAL
#define IFD_SLONG
#define IFD_SHORT
#define IFD_SSHORT
#define IFD_DOUBLE
#define SWAP_ULONG(x)
#define IFD_RATIONAL
#define IFD_ASCII
#define IFD_LONG
#define IFD_FLOAT
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static ATOM item
Definition: dde.c:856
short SHORT
Definition: pedump.c:59
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
Definition: pdh_main.c:94
unsigned char BYTE
Definition: xxhash.c:193

Referenced by LoadIfdMetadata().

◆ LoadIfdMetadata()

static HRESULT LoadIfdMetadata ( IStream input,
const GUID preferred_vendor,
DWORD  persist_options,
MetadataItem **  items,
DWORD item_count 
)
static

Definition at line 990 of file metadatahandler.c.

992{
993 HRESULT hr;
995 USHORT count, i;
996 struct IFD_entry *entry;
997 BOOL native_byte_order = TRUE;
998 ULONG bytesread;
999
1000 TRACE("\n");
1001
1002#ifdef WORDS_BIGENDIAN
1003 if (persist_options & WICPersistOptionLittleEndian)
1004#else
1005 if (persist_options & WICPersistOptionBigEndian)
1006#endif
1007 native_byte_order = FALSE;
1008
1009 hr = IStream_Read(input, &count, sizeof(count), &bytesread);
1010 if (bytesread != sizeof(count)) hr = E_FAIL;
1011 if (hr != S_OK) return hr;
1012
1014
1015 entry = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*entry));
1016 if (!entry) return E_OUTOFMEMORY;
1017
1018 hr = IStream_Read(input, entry, count * sizeof(*entry), &bytesread);
1019 if (bytesread != count * sizeof(*entry)) hr = E_FAIL;
1020 if (hr != S_OK)
1021 {
1023 return hr;
1024 }
1025
1026 /* limit number of IFDs to 4096 to avoid infinite loop */
1027 for (i = 0; i < 4096; i++)
1028 {
1029 ULONG next_ifd_offset;
1031 USHORT next_ifd_count;
1032
1033 hr = IStream_Read(input, &next_ifd_offset, sizeof(next_ifd_offset), &bytesread);
1034 if (bytesread != sizeof(next_ifd_offset)) hr = E_FAIL;
1035 if (hr != S_OK) break;
1036
1037 SWAP_ULONG(next_ifd_offset);
1038 if (!next_ifd_offset) break;
1039
1040 pos.QuadPart = next_ifd_offset;
1041 hr = IStream_Seek(input, pos, SEEK_SET, NULL);
1042 if (FAILED(hr)) break;
1043
1044 hr = IStream_Read(input, &next_ifd_count, sizeof(next_ifd_count), &bytesread);
1045 if (bytesread != sizeof(next_ifd_count)) hr = E_FAIL;
1046 if (hr != S_OK) break;
1047
1048 SWAP_USHORT(next_ifd_count);
1049
1050 pos.QuadPart = next_ifd_count * sizeof(*entry);
1051 hr = IStream_Seek(input, pos, SEEK_CUR, NULL);
1052 if (FAILED(hr)) break;
1053 }
1054
1055 if (hr != S_OK || i == 4096)
1056 {
1059 }
1060
1062 if (!result)
1063 {
1065 return E_OUTOFMEMORY;
1066 }
1067
1068 for (i = 0; i < count; i++)
1069 {
1070 hr = load_IFD_entry(input, &entry[i], &result[i], native_byte_order);
1071 if (FAILED(hr))
1072 {
1075 return hr;
1076 }
1077 }
1078
1080
1081 *items = result;
1082 *item_count = count;
1083
1084 return S_OK;
1085}
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, MetadataItem *item, BOOL native_byte_order)
#define SEEK_CUR
Definition: util.h:63
static TCHAR * items[]
Definition: page1.c:45
unsigned short USHORT
Definition: pedump.c:61
#define TRACE(s)
Definition: solgame.cpp:4
@ WICPersistOptionBigEndian
Definition: wincodecsdk.idl:25
@ WICPersistOptionLittleEndian
Definition: wincodecsdk.idl:24
#define WINCODEC_ERR_BADMETADATAHEADER
Definition: winerror.h:3302

◆ LoadUnknownMetadata()

static HRESULT LoadUnknownMetadata ( IStream input,
const GUID preferred_vendor,
DWORD  persist_options,
MetadataItem **  items,
DWORD item_count 
)
static

Definition at line 612 of file metadatahandler.c.

614{
615 HRESULT hr;
617 STATSTG stat;
618 BYTE *data;
619 ULONG bytesread;
620
621 TRACE("\n");
622
623 hr = IStream_Stat(input, &stat, STATFLAG_NONAME);
624 if (FAILED(hr))
625 return hr;
626
627 data = HeapAlloc(GetProcessHeap(), 0, stat.cbSize.QuadPart);
628 if (!data) return E_OUTOFMEMORY;
629
630 hr = IStream_Read(input, data, stat.cbSize.QuadPart, &bytesread);
631 if (bytesread != stat.cbSize.QuadPart) hr = E_FAIL;
632 if (hr != S_OK)
633 {
635 return hr;
636 }
637
639 if (!result)
640 {
642 return E_OUTOFMEMORY;
643 }
644
645 PropVariantInit(&result[0].schema);
646 PropVariantInit(&result[0].id);
647 PropVariantInit(&result[0].value);
648
649 result[0].value.vt = VT_BLOB;
650 result[0].value.u.blob.cbSize = bytesread;
651 result[0].value.u.blob.pBlobData = data;
652
653 *items = result;
654 *item_count = 1;
655
656 return S_OK;
657}
#define stat
Definition: acwin.h:99
@ VT_BLOB
Definition: compat.h:2330
const WCHAR * schema
Definition: stat.h:55

◆ MetadataHandler_AddRef()

static ULONG WINAPI MetadataHandler_AddRef ( IWICMetadataWriter iface)
static

Definition at line 107 of file metadatahandler.c.

108{
111
112 TRACE("(%p) refcount=%u\n", iface, ref);
113
114 return ref;
115}
#define InterlockedIncrement
Definition: armddk.h:53
static MetadataHandler * impl_from_IWICMetadataWriter(IWICMetadataWriter *iface)
Definition: send.c:48

◆ MetadataHandler_FreeItems()

static void MetadataHandler_FreeItems ( MetadataHandler This)
static

Definition at line 60 of file metadatahandler.c.

61{
62 DWORD i;
63
64 for (i=0; i<This->item_count; i++)
65 {
66 PropVariantClear(&This->items[i].schema);
67 PropVariantClear(&This->items[i].id);
68 PropVariantClear(&This->items[i].value);
69 }
70
71 HeapFree(GetProcessHeap(), 0, This->items);
72}
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by MetadataHandler_LoadEx(), and MetadataHandler_Release().

◆ MetadataHandler_GetClassID()

static HRESULT WINAPI MetadataHandler_GetClassID ( IWICPersistStream iface,
CLSID pClassID 
)
static

Definition at line 316 of file metadatahandler.c.

318{
319 FIXME("(%p,%p): stub\n", iface, pClassID);
320 return E_NOTIMPL;
321}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MetadataHandler_GetCount()

static HRESULT WINAPI MetadataHandler_GetCount ( IWICMetadataWriter iface,
UINT pcCount 
)
static

Definition at line 173 of file metadatahandler.c.

175{
177
178 TRACE("%p,%p\n", iface, pcCount);
179
180 if (!pcCount) return E_INVALIDARG;
181
182 *pcCount = This->item_count;
183 return S_OK;
184}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ MetadataHandler_GetEnumerator()

static HRESULT WINAPI MetadataHandler_GetEnumerator ( IWICMetadataWriter iface,
IWICEnumMetadataItem **  ppIEnumMetadata 
)
static

Definition at line 245 of file metadatahandler.c.

247{
249 TRACE("(%p,%p)\n", iface, ppIEnumMetadata);
250 return MetadataHandlerEnum_Create(This, 0, ppIEnumMetadata);
251}
static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index, IWICEnumMetadataItem **ppIEnumMetadataItem)

◆ MetadataHandler_GetMetadataFormat()

static HRESULT WINAPI MetadataHandler_GetMetadataFormat ( IWICMetadataWriter iface,
GUID pguidMetadataFormat 
)
static

Definition at line 154 of file metadatahandler.c.

156{
157 HRESULT hr;
158 IWICMetadataHandlerInfo *metadata_info;
159
160 TRACE("%p,%p\n", iface, pguidMetadataFormat);
161
162 if (!pguidMetadataFormat) return E_INVALIDARG;
163
164 hr = MetadataHandler_GetMetadataHandlerInfo(iface, &metadata_info);
165 if (FAILED(hr)) return hr;
166
167 hr = IWICMetadataHandlerInfo_GetMetadataFormat(metadata_info, pguidMetadataFormat);
168 IWICMetadataHandlerInfo_Release(metadata_info);
169
170 return hr;
171}
static HRESULT WINAPI MetadataHandler_GetMetadataHandlerInfo(IWICMetadataWriter *iface, IWICMetadataHandlerInfo **ppIHandler)

◆ MetadataHandler_GetMetadataHandlerInfo()

static HRESULT WINAPI MetadataHandler_GetMetadataHandlerInfo ( IWICMetadataWriter iface,
IWICMetadataHandlerInfo **  ppIHandler 
)
static

Definition at line 135 of file metadatahandler.c.

137{
138 HRESULT hr;
139 IWICComponentInfo *component_info;
141
142 TRACE("%p,%p\n", iface, ppIHandler);
143
144 hr = CreateComponentInfo(This->vtable->clsid, &component_info);
145 if (FAILED(hr)) return hr;
146
147 hr = IWICComponentInfo_QueryInterface(component_info, &IID_IWICMetadataHandlerInfo,
148 (void **)ppIHandler);
149
150 IWICComponentInfo_Release(component_info);
151 return hr;
152}
HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo)
Definition: info.c:2075

Referenced by MetadataHandler_GetMetadataFormat().

◆ MetadataHandler_GetSizeMax()

static HRESULT WINAPI MetadataHandler_GetSizeMax ( IWICPersistStream iface,
ULARGE_INTEGER pcbSize 
)
static

Definition at line 344 of file metadatahandler.c.

346{
347 FIXME("(%p,%p): stub\n", iface, pcbSize);
348 return E_NOTIMPL;
349}

◆ MetadataHandler_GetValue()

static HRESULT WINAPI MetadataHandler_GetValue ( IWICMetadataWriter iface,
const PROPVARIANT *  schema,
const PROPVARIANT *  id,
PROPVARIANT *  value 
)
static

Definition at line 215 of file metadatahandler.c.

217{
218 UINT i;
221
222 TRACE("(%p,%s,%s,%p)\n", iface, wine_dbgstr_variant((const VARIANT *)schema), wine_dbgstr_variant((const VARIANT *)id), value);
223
224 if (!id) return E_INVALIDARG;
225
227
228 for (i = 0; i < This->item_count; i++)
229 {
230 if (schema && This->items[i].schema.vt != VT_EMPTY)
231 {
232 if (PropVariantCompareEx(schema, &This->items[i].schema, 0, PVCF_USESTRCMPI) != 0) continue;
233 }
234
235 if (PropVariantCompareEx(id, &This->items[i].id, 0, PVCF_USESTRCMPI) != 0) continue;
236
237 hr = value ? PropVariantCopy(value, &This->items[i].value) : S_OK;
238 break;
239 }
240
242 return hr;
243}
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3086
INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT unit, PROPVAR_COMPARE_FLAGS flags)
Definition: propvar.c:814
unsigned int UINT
Definition: ndis.h:50
@ PVCF_USESTRCMPI
Definition: propvarutil.h:60
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINCODEC_ERR_PROPERTYNOTFOUND
Definition: winerror.h:3287

◆ MetadataHandler_GetValueByIndex()

static HRESULT WINAPI MetadataHandler_GetValueByIndex ( IWICMetadataWriter iface,
UINT  index,
PROPVARIANT *  schema,
PROPVARIANT *  id,
PROPVARIANT *  value 
)
static

Definition at line 186 of file metadatahandler.c.

188{
189 HRESULT hr = S_OK;
191
192 TRACE("%p,%u,%p,%p,%p\n", iface, index, schema, id, value);
193
195
196 if (index >= This->item_count)
197 {
199 return E_INVALIDARG;
200 }
201
202 if (schema)
203 hr = PropVariantCopy(schema, &This->items[index].schema);
204
205 if (SUCCEEDED(hr) && id)
206 hr = PropVariantCopy(id, &This->items[index].id);
207
208 if (SUCCEEDED(hr) && value)
209 hr = PropVariantCopy(value, &This->items[index].value);
210
212 return hr;
213}
GLuint index
Definition: glext.h:6031
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ MetadataHandler_IsDirty()

static HRESULT WINAPI MetadataHandler_IsDirty ( IWICPersistStream iface)
static

Definition at line 323 of file metadatahandler.c.

324{
325 FIXME("(%p): stub\n", iface);
326 return E_NOTIMPL;
327}

◆ MetadataHandler_Load()

static HRESULT WINAPI MetadataHandler_Load ( IWICPersistStream iface,
IStream pStm 
)
static

Definition at line 329 of file metadatahandler.c.

331{
333 TRACE("(%p,%p)\n", iface, pStm);
334 return IWICPersistStream_LoadEx(&This->IWICPersistStream_iface, pStm, NULL, WICPersistOptionDefault);
335}
static MetadataHandler * impl_from_IWICPersistStream(IWICPersistStream *iface)
@ WICPersistOptionDefault
Definition: wincodecsdk.idl:23

◆ MetadataHandler_LoadEx()

static HRESULT WINAPI MetadataHandler_LoadEx ( IWICPersistStream iface,
IStream pIStream,
const GUID pguidPreferredVendor,
DWORD  dwPersistOptions 
)
static

Definition at line 351 of file metadatahandler.c.

353{
355 HRESULT hr;
356 MetadataItem *new_items=NULL;
357 DWORD item_count=0;
358
359 TRACE("(%p,%p,%s,%x)\n", iface, pIStream, debugstr_guid(pguidPreferredVendor), dwPersistOptions);
360
362
363 hr = This->vtable->fnLoad(pIStream, pguidPreferredVendor, dwPersistOptions,
364 &new_items, &item_count);
365
366 if (SUCCEEDED(hr))
367 {
369 This->items = new_items;
370 This->item_count = item_count;
371 }
372
374
375 return hr;
376}
#define debugstr_guid
Definition: kernel32.h:35
static void MetadataHandler_FreeItems(MetadataHandler *This)

◆ MetadataHandler_PersistStream_AddRef()

static ULONG WINAPI MetadataHandler_PersistStream_AddRef ( IWICPersistStream iface)
static

Definition at line 304 of file metadatahandler.c.

305{
307 return IWICMetadataWriter_AddRef(&This->IWICMetadataWriter_iface);
308}

◆ MetadataHandler_PersistStream_QueryInterface()

static HRESULT WINAPI MetadataHandler_PersistStream_QueryInterface ( IWICPersistStream iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 297 of file metadatahandler.c.

299{
301 return IWICMetadataWriter_QueryInterface(&This->IWICMetadataWriter_iface, iid, ppv);
302}

◆ MetadataHandler_PersistStream_Release()

static ULONG WINAPI MetadataHandler_PersistStream_Release ( IWICPersistStream iface)
static

Definition at line 310 of file metadatahandler.c.

311{
313 return IWICMetadataWriter_Release(&This->IWICMetadataWriter_iface);
314}

◆ MetadataHandler_QueryInterface()

static HRESULT WINAPI MetadataHandler_QueryInterface ( IWICMetadataWriter iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 77 of file metadatahandler.c.

79{
81 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
82
83 if (!ppv) return E_INVALIDARG;
84
85 if (IsEqualIID(&IID_IUnknown, iid) ||
86 IsEqualIID(&IID_IWICMetadataReader, iid) ||
87 (IsEqualIID(&IID_IWICMetadataWriter, iid) && This->vtable->is_writer))
88 {
89 *ppv = &This->IWICMetadataWriter_iface;
90 }
91 else if (IsEqualIID(&IID_IPersist, iid) ||
93 IsEqualIID(&IID_IWICPersistStream, iid))
94 {
95 *ppv = &This->IWICPersistStream_iface;
96 }
97 else
98 {
99 *ppv = NULL;
100 return E_NOINTERFACE;
101 }
102
103 IUnknown_AddRef((IUnknown*)*ppv);
104 return S_OK;
105}
const GUID IID_IUnknown
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ MetadataHandler_Release()

static ULONG WINAPI MetadataHandler_Release ( IWICMetadataWriter iface)
static

Definition at line 117 of file metadatahandler.c.

118{
121
122 TRACE("(%p) refcount=%u\n", iface, ref);
123
124 if (ref == 0)
125 {
127 This->lock.DebugInfo->Spare[0] = 0;
130 }
131
132 return ref;
133}
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ MetadataHandler_RemoveValue()

static HRESULT WINAPI MetadataHandler_RemoveValue ( IWICMetadataWriter iface,
const PROPVARIANT *  pvarSchema,
const PROPVARIANT *  pvarId 
)
static

Definition at line 267 of file metadatahandler.c.

269{
270 FIXME("(%p,%p,%p): stub\n", iface, pvarSchema, pvarId);
271 return E_NOTIMPL;
272}

◆ MetadataHandler_RemoveValueByIndex()

static HRESULT WINAPI MetadataHandler_RemoveValueByIndex ( IWICMetadataWriter iface,
UINT  nIndex 
)
static

Definition at line 274 of file metadatahandler.c.

276{
277 FIXME("(%p,%u): stub\n", iface, nIndex);
278 return E_NOTIMPL;
279}

◆ MetadataHandler_Save()

static HRESULT WINAPI MetadataHandler_Save ( IWICPersistStream iface,
IStream pStm,
BOOL  fClearDirty 
)
static

Definition at line 337 of file metadatahandler.c.

339{
340 FIXME("(%p,%p,%i): stub\n", iface, pStm, fClearDirty);
341 return E_NOTIMPL;
342}

◆ MetadataHandler_SaveEx()

static HRESULT WINAPI MetadataHandler_SaveEx ( IWICPersistStream iface,
IStream pIStream,
DWORD  dwPersistOptions,
BOOL  fClearDirty 
)
static

Definition at line 378 of file metadatahandler.c.

380{
381 FIXME("(%p,%p,%x,%i): stub\n", iface, pIStream, dwPersistOptions, fClearDirty);
382 return E_NOTIMPL;
383}

◆ MetadataHandler_SetValue()

static HRESULT WINAPI MetadataHandler_SetValue ( IWICMetadataWriter iface,
const PROPVARIANT *  pvarSchema,
const PROPVARIANT *  pvarId,
const PROPVARIANT *  pvarValue 
)
static

Definition at line 253 of file metadatahandler.c.

255{
256 FIXME("(%p,%p,%p,%p): stub\n", iface, pvarSchema, pvarId, pvarValue);
257 return E_NOTIMPL;
258}

◆ MetadataHandler_SetValueByIndex()

static HRESULT WINAPI MetadataHandler_SetValueByIndex ( IWICMetadataWriter iface,
UINT  nIndex,
const PROPVARIANT *  pvarSchema,
const PROPVARIANT *  pvarId,
const PROPVARIANT *  pvarValue 
)
static

Definition at line 260 of file metadatahandler.c.

262{
263 FIXME("(%p,%u,%p,%p,%p): stub\n", iface, nIndex, pvarSchema, pvarId, pvarValue);
264 return E_NOTIMPL;
265}

◆ MetadataHandlerEnum_AddRef()

static ULONG WINAPI MetadataHandlerEnum_AddRef ( IWICEnumMetadataItem iface)
static

Definition at line 462 of file metadatahandler.c.

463{
466
467 TRACE("(%p) refcount=%u\n", iface, ref);
468
469 return ref;
470}
static MetadataHandlerEnum * impl_from_IWICEnumMetadataItem(IWICEnumMetadataItem *iface)

◆ MetadataHandlerEnum_Clone()

static HRESULT WINAPI MetadataHandlerEnum_Clone ( IWICEnumMetadataItem iface,
IWICEnumMetadataItem **  ppIEnumMetadataItem 
)
static

Definition at line 563 of file metadatahandler.c.

565{
567 HRESULT hr;
568
569 EnterCriticalSection(&This->parent->lock);
570
571 hr = MetadataHandlerEnum_Create(This->parent, This->index, ppIEnumMetadataItem);
572
573 LeaveCriticalSection(&This->parent->lock);
574
575 return hr;
576}

◆ MetadataHandlerEnum_Create()

static HRESULT MetadataHandlerEnum_Create ( MetadataHandler parent,
DWORD  index,
IWICEnumMetadataItem **  ppIEnumMetadataItem 
)
static

Definition at line 588 of file metadatahandler.c.

590{
592
593 if (!ppIEnumMetadataItem) return E_INVALIDARG;
594
595 *ppIEnumMetadataItem = NULL;
596
598 if (!This) return E_OUTOFMEMORY;
599
600 IWICMetadataWriter_AddRef(&parent->IWICMetadataWriter_iface);
601
602 This->IWICEnumMetadataItem_iface.lpVtbl = &MetadataHandlerEnum_Vtbl;
603 This->ref = 1;
604 This->parent = parent;
605 This->index = index;
606
607 *ppIEnumMetadataItem = &This->IWICEnumMetadataItem_iface;
608
609 return S_OK;
610}
#define index(s, c)
Definition: various.h:29
r parent
Definition: btrfs.c:3010
static const IWICEnumMetadataItemVtbl MetadataHandlerEnum_Vtbl

Referenced by MetadataHandler_GetEnumerator(), and MetadataHandlerEnum_Clone().

◆ MetadataHandlerEnum_Next()

static HRESULT WINAPI MetadataHandlerEnum_Next ( IWICEnumMetadataItem iface,
ULONG  celt,
PROPVARIANT *  rgeltSchema,
PROPVARIANT *  rgeltId,
PROPVARIANT *  rgeltValue,
ULONG pceltFetched 
)
static

Definition at line 488 of file metadatahandler.c.

491{
493 ULONG new_index;
495 ULONG i;
496
497 TRACE("(%p,%i)\n", iface, celt);
498
499 EnterCriticalSection(&This->parent->lock);
500
501 if (This->index >= This->parent->item_count)
502 {
503 *pceltFetched = 0;
504 LeaveCriticalSection(&This->parent->lock);
505 return S_FALSE;
506 }
507
508 new_index = min(This->parent->item_count, This->index + celt);
509 *pceltFetched = new_index - This->index;
510
511 if (rgeltSchema)
512 {
513 for (i=0; SUCCEEDED(hr) && i < *pceltFetched; i++)
514 hr = PropVariantCopy(&rgeltSchema[i], &This->parent->items[i+This->index].schema);
515 }
516
517 for (i=0; SUCCEEDED(hr) && i < *pceltFetched; i++)
518 hr = PropVariantCopy(&rgeltId[i], &This->parent->items[i+This->index].id);
519
520 if (rgeltValue)
521 {
522 for (i=0; SUCCEEDED(hr) && i < *pceltFetched; i++)
523 hr = PropVariantCopy(&rgeltValue[i], &This->parent->items[i+This->index].value);
524 }
525
526 if (SUCCEEDED(hr))
527 {
528 This->index = new_index;
529 }
530
531 LeaveCriticalSection(&This->parent->lock);
532
533 return hr;
534}
#define min(a, b)
Definition: monoChain.cc:55
#define S_FALSE
Definition: winerror.h:2357

◆ MetadataHandlerEnum_QueryInterface()

static HRESULT WINAPI MetadataHandlerEnum_QueryInterface ( IWICEnumMetadataItem iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 439 of file metadatahandler.c.

441{
443 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
444
445 if (!ppv) return E_INVALIDARG;
446
447 if (IsEqualIID(&IID_IUnknown, iid) ||
448 IsEqualIID(&IID_IWICEnumMetadataItem, iid))
449 {
450 *ppv = &This->IWICEnumMetadataItem_iface;
451 }
452 else
453 {
454 *ppv = NULL;
455 return E_NOINTERFACE;
456 }
457
458 IUnknown_AddRef((IUnknown*)*ppv);
459 return S_OK;
460}

◆ MetadataHandlerEnum_Release()

static ULONG WINAPI MetadataHandlerEnum_Release ( IWICEnumMetadataItem iface)
static

Definition at line 472 of file metadatahandler.c.

473{
476
477 TRACE("(%p) refcount=%u\n", iface, ref);
478
479 if (ref == 0)
480 {
481 IWICMetadataWriter_Release(&This->parent->IWICMetadataWriter_iface);
483 }
484
485 return ref;
486}

◆ MetadataHandlerEnum_Reset()

static HRESULT WINAPI MetadataHandlerEnum_Reset ( IWICEnumMetadataItem iface)
static

Definition at line 550 of file metadatahandler.c.

551{
553
554 EnterCriticalSection(&This->parent->lock);
555
556 This->index = 0;
557
558 LeaveCriticalSection(&This->parent->lock);
559
560 return S_OK;
561}

◆ MetadataHandlerEnum_Skip()

static HRESULT WINAPI MetadataHandlerEnum_Skip ( IWICEnumMetadataItem iface,
ULONG  celt 
)
static

Definition at line 536 of file metadatahandler.c.

538{
540
541 EnterCriticalSection(&This->parent->lock);
542
543 This->index += celt;
544
545 LeaveCriticalSection(&This->parent->lock);
546
547 return S_OK;
548}

◆ MetadataReader_Create()

HRESULT MetadataReader_Create ( const MetadataHandlerVtbl vtable,
REFIID  iid,
void **  ppv 
)

Definition at line 398 of file metadatahandler.c.

399{
401 HRESULT hr;
402
403 TRACE("%s\n", debugstr_guid(vtable->clsid));
404
405 *ppv = NULL;
406
408 if (!This) return E_OUTOFMEMORY;
409
410 This->IWICMetadataWriter_iface.lpVtbl = &MetadataHandler_Vtbl;
411 This->IWICPersistStream_iface.lpVtbl = &MetadataHandler_PersistStream_Vtbl;
412 This->ref = 1;
413 This->vtable = vtable;
414 This->items = NULL;
415 This->item_count = 0;
416
418 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MetadataHandler.lock");
419
420 hr = IWICMetadataWriter_QueryInterface(&This->IWICMetadataWriter_iface, iid, ppv);
421
422 IWICMetadataWriter_Release(&This->IWICMetadataWriter_iface);
423
424 return hr;
425}
static const IWICPersistStreamVtbl MetadataHandler_PersistStream_Vtbl
static const IWICMetadataWriterVtbl MetadataHandler_Vtbl
static void * vtable[]
Definition: typelib.c:1231
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

Referenced by APEReader_CreateInstance(), GCEReader_CreateInstance(), GifCommentReader_CreateInstance(), IfdMetadataReader_CreateInstance(), IMDReader_CreateInstance(), LSDReader_CreateInstance(), PngChrmReader_CreateInstance(), PngGamaReader_CreateInstance(), PngTextReader_CreateInstance(), and UnknownMetadataReader_CreateInstance().

◆ tag_to_vt()

static int tag_to_vt ( SHORT  tag)
static

Definition at line 696 of file metadatahandler.c.

697{
698 static const int tag2vt[] =
699 {
700 VT_EMPTY, /* 0 */
701 VT_UI1, /* IFD_BYTE 1 */
702 VT_LPSTR, /* IFD_ASCII 2 */
703 VT_UI2, /* IFD_SHORT 3 */
704 VT_UI4, /* IFD_LONG 4 */
705 VT_UI8, /* IFD_RATIONAL 5 */
706 VT_I1, /* IFD_SBYTE 6 */
707 VT_BLOB, /* IFD_UNDEFINED 7 */
708 VT_I2, /* IFD_SSHORT 8 */
709 VT_I4, /* IFD_SLONG 9 */
710 VT_I8, /* IFD_SRATIONAL 10 */
711 VT_R4, /* IFD_FLOAT 11 */
712 VT_R8, /* IFD_DOUBLE 12 */
713 VT_BLOB, /* IFD_IFD 13 */
714 };
715 return (tag > 0 && tag <= 13) ? tag2vt[tag] : VT_BLOB;
716}
@ VT_UI8
Definition: compat.h:2315
@ VT_LPSTR
Definition: compat.h:2324
@ VT_R4
Definition: compat.h:2299
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UI1
Definition: compat.h:2311
Definition: ecma_167.h:138

Referenced by load_IFD_entry().

◆ UnknownMetadataReader_CreateInstance()

HRESULT UnknownMetadataReader_CreateInstance ( REFIID  iid,
void **  ppv 
)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ IfdMetadataReader_Vtbl

const MetadataHandlerVtbl IfdMetadataReader_Vtbl
static
Initial value:
= {
0,
&CLSID_WICIfdMetadataReader,
}
static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor, DWORD persist_options, MetadataItem **items, DWORD *item_count)

Definition at line 1087 of file metadatahandler.c.

Referenced by IfdMetadataReader_CreateInstance().

◆ MetadataHandler_PersistStream_Vtbl

const IWICPersistStreamVtbl MetadataHandler_PersistStream_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI MetadataHandler_SaveEx(IWICPersistStream *iface, IStream *pIStream, DWORD dwPersistOptions, BOOL fClearDirty)
static HRESULT WINAPI MetadataHandler_PersistStream_QueryInterface(IWICPersistStream *iface, REFIID iid, void **ppv)
static HRESULT WINAPI MetadataHandler_GetClassID(IWICPersistStream *iface, CLSID *pClassID)
static HRESULT WINAPI MetadataHandler_Save(IWICPersistStream *iface, IStream *pStm, BOOL fClearDirty)
static HRESULT WINAPI MetadataHandler_LoadEx(IWICPersistStream *iface, IStream *pIStream, const GUID *pguidPreferredVendor, DWORD dwPersistOptions)
static HRESULT WINAPI MetadataHandler_IsDirty(IWICPersistStream *iface)
static HRESULT WINAPI MetadataHandler_Load(IWICPersistStream *iface, IStream *pStm)
static ULONG WINAPI MetadataHandler_PersistStream_AddRef(IWICPersistStream *iface)
static ULONG WINAPI MetadataHandler_PersistStream_Release(IWICPersistStream *iface)
static HRESULT WINAPI MetadataHandler_GetSizeMax(IWICPersistStream *iface, ULARGE_INTEGER *pcbSize)

Definition at line 385 of file metadatahandler.c.

Referenced by MetadataReader_Create().

◆ MetadataHandler_Vtbl

const IWICMetadataWriterVtbl MetadataHandler_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI MetadataHandler_RemoveValue(IWICMetadataWriter *iface, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId)
static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface, const PROPVARIANT *schema, const PROPVARIANT *id, PROPVARIANT *value)
static HRESULT WINAPI MetadataHandler_QueryInterface(IWICMetadataWriter *iface, REFIID iid, void **ppv)
static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface, UINT index, PROPVARIANT *schema, PROPVARIANT *id, PROPVARIANT *value)
static HRESULT WINAPI MetadataHandler_GetCount(IWICMetadataWriter *iface, UINT *pcCount)
static ULONG WINAPI MetadataHandler_Release(IWICMetadataWriter *iface)
static HRESULT WINAPI MetadataHandler_GetEnumerator(IWICMetadataWriter *iface, IWICEnumMetadataItem **ppIEnumMetadata)
static HRESULT WINAPI MetadataHandler_RemoveValueByIndex(IWICMetadataWriter *iface, UINT nIndex)
static ULONG WINAPI MetadataHandler_AddRef(IWICMetadataWriter *iface)
static HRESULT WINAPI MetadataHandler_SetValue(IWICMetadataWriter *iface, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue)
static HRESULT WINAPI MetadataHandler_SetValueByIndex(IWICMetadataWriter *iface, UINT nIndex, const PROPVARIANT *pvarSchema, const PROPVARIANT *pvarId, const PROPVARIANT *pvarValue)
static HRESULT WINAPI MetadataHandler_GetMetadataFormat(IWICMetadataWriter *iface, GUID *pguidMetadataFormat)

Definition at line 281 of file metadatahandler.c.

Referenced by MetadataReader_Create().

◆ MetadataHandlerEnum_Vtbl

const IWICEnumMetadataItemVtbl MetadataHandlerEnum_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI MetadataHandlerEnum_Reset(IWICEnumMetadataItem *iface)
static HRESULT WINAPI MetadataHandlerEnum_Next(IWICEnumMetadataItem *iface, ULONG celt, PROPVARIANT *rgeltSchema, PROPVARIANT *rgeltId, PROPVARIANT *rgeltValue, ULONG *pceltFetched)
static ULONG WINAPI MetadataHandlerEnum_AddRef(IWICEnumMetadataItem *iface)
static HRESULT WINAPI MetadataHandlerEnum_Clone(IWICEnumMetadataItem *iface, IWICEnumMetadataItem **ppIEnumMetadataItem)
static HRESULT WINAPI MetadataHandlerEnum_QueryInterface(IWICEnumMetadataItem *iface, REFIID iid, void **ppv)
static ULONG WINAPI MetadataHandlerEnum_Release(IWICEnumMetadataItem *iface)
static HRESULT WINAPI MetadataHandlerEnum_Skip(IWICEnumMetadataItem *iface, ULONG celt)

Definition at line 578 of file metadatahandler.c.

Referenced by MetadataHandlerEnum_Create().

◆ UnknownMetadataReader_Vtbl

const MetadataHandlerVtbl UnknownMetadataReader_Vtbl
static
Initial value:
= {
0,
&CLSID_WICUnknownMetadataReader,
}
static HRESULT LoadUnknownMetadata(IStream *input, const GUID *preferred_vendor, DWORD persist_options, MetadataItem **items, DWORD *item_count)

Definition at line 659 of file metadatahandler.c.

Referenced by UnknownMetadataReader_CreateInstance().