ReactOS  0.4.14-dev-390-g34947ad
format.c File Reference
#include "urlmon_main.h"
#include "wine/debug.h"
Include dependency graph for format.c:

Go to the source code of this file.

Classes

struct  EnumFORMATETC
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (urlmon)
 
static EnumFORMATETCimpl_from_IEnumFORMATETC (IEnumFORMATETC *iface)
 
static IEnumFORMATETCEnumFORMATETC_Create (UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it)
 
static HRESULT WINAPI EnumFORMATETC_QueryInterface (IEnumFORMATETC *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumFORMATETC_AddRef (IEnumFORMATETC *iface)
 
static ULONG WINAPI EnumFORMATETC_Release (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFORMATETC_Next (IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumFORMATETC_Skip (IEnumFORMATETC *iface, ULONG celt)
 
static HRESULT WINAPI EnumFORMATETC_Reset (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFORMATETC_Clone (IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
 
HRESULT WINAPI CreateFormatEnumerator (UINT cfmtetc, FORMATETC *rgfmtetc, IEnumFORMATETC **ppenumfmtetc)
 
HRESULT WINAPI RegisterFormatEnumerator (LPBC pBC, IEnumFORMATETC *pEFetc, DWORD reserved)
 
HRESULT WINAPI RevokeFormatEnumerator (LPBC pbc, IEnumFORMATETC *pEFetc)
 

Variables

static WCHAR wszEnumFORMATETC [] = {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0}
 
static const IEnumFORMATETCVtbl EnumFORMATETCVtbl
 

Function Documentation

◆ CreateFormatEnumerator()

HRESULT WINAPI CreateFormatEnumerator ( UINT  cfmtetc,
FORMATETC *  rgfmtetc,
IEnumFORMATETC **  ppenumfmtetc 
)

Definition at line 177 of file format.c.

179 {
180  TRACE("(%d %p %p)\n", cfmtetc, rgfmtetc, ppenumfmtetc);
181 
182  if(!ppenumfmtetc)
183  return E_INVALIDARG;
184  if(!cfmtetc)
185  return E_FAIL;
186 
187  *ppenumfmtetc = EnumFORMATETC_Create(cfmtetc, rgfmtetc, 0);
188  return S_OK;
189 }
static IEnumFORMATETC * EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it)
Definition: format.c:157
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by RegisterDefaultAcceptHeaders(), test_CreateFormatEnum(), and test_RegisterFormatEnumerator().

◆ EnumFORMATETC_AddRef()

static ULONG WINAPI EnumFORMATETC_AddRef ( IEnumFORMATETC iface)
static

Definition at line 61 of file format.c.

62 {
65  TRACE("(%p) ref=%d\n", This, ref);
66  return ref;
67 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ EnumFORMATETC_Clone()

static HRESULT WINAPI EnumFORMATETC_Clone ( IEnumFORMATETC iface,
IEnumFORMATETC **  ppenum 
)
static

Definition at line 134 of file format.c.

135 {
137 
138  TRACE("(%p)->(%p)\n", This, ppenum);
139 
140  if(!ppenum)
141  return E_INVALIDARG;
142 
143  *ppenum = EnumFORMATETC_Create(This->fetc_cnt, This->fetc, This->it);
144  return S_OK;
145 }
static IEnumFORMATETC * EnumFORMATETC_Create(UINT cfmtetc, const FORMATETC *rgfmtetc, UINT it)
Definition: format.c:157
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ EnumFORMATETC_Create()

static IEnumFORMATETC * EnumFORMATETC_Create ( UINT  cfmtetc,
const FORMATETC *  rgfmtetc,
UINT  it 
)
static

Definition at line 157 of file format.c.

158 {
160 
162 
163  ret->IEnumFORMATETC_iface.lpVtbl = &EnumFORMATETCVtbl;
164  ret->ref = 1;
165  ret->it = it;
166  ret->fetc_cnt = cfmtetc;
167 
168  ret->fetc = heap_alloc(cfmtetc*sizeof(FORMATETC));
169  memcpy(ret->fetc, rgfmtetc, cfmtetc*sizeof(FORMATETC));
170 
171  return &ret->IEnumFORMATETC_iface;
172 }
static const IEnumFORMATETCVtbl EnumFORMATETCVtbl
Definition: format.c:147
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void URLMON_LockModule(void)
Definition: urlmon_main.h:67

Referenced by CreateFormatEnumerator(), and EnumFORMATETC_Clone().

◆ EnumFORMATETC_Next()

static HRESULT WINAPI EnumFORMATETC_Next ( IEnumFORMATETC iface,
ULONG  celt,
FORMATETC *  rgelt,
ULONG pceltFetched 
)
static

Definition at line 86 of file format.c.

88 {
90  ULONG cnt;
91 
92  TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
93 
94  if(!rgelt)
95  return E_INVALIDARG;
96 
97  if(This->it >= This->fetc_cnt || !celt) {
98  if(pceltFetched)
99  *pceltFetched = 0;
100  return celt ? S_FALSE : S_OK;
101  }
102 
103  cnt = This->fetc_cnt-This->it > celt ? celt : This->fetc_cnt-This->it;
104 
105  memcpy(rgelt, This->fetc+This->it, cnt*sizeof(FORMATETC));
106  This->it += cnt;
107 
108  if(pceltFetched)
109  *pceltFetched = cnt;
110 
111  return cnt == celt ? S_OK : S_FALSE;
112 }
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ EnumFORMATETC_QueryInterface()

static HRESULT WINAPI EnumFORMATETC_QueryInterface ( IEnumFORMATETC iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 43 of file format.c.

44 {
46 
47  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
48 
49  *ppv = NULL;
50 
52  IEnumFORMATETC_AddRef(iface);
53  *ppv = iface;
54  return S_OK;
55  }
56 
57  WARN("not supported interface %s\n", debugstr_guid(riid));
58  return E_NOINTERFACE;
59 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
const GUID IID_IEnumFORMATETC
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ EnumFORMATETC_Release()

static ULONG WINAPI EnumFORMATETC_Release ( IEnumFORMATETC iface)
static

Definition at line 69 of file format.c.

70 {
73 
74  TRACE("(%p) ref=%d\n", This, ref);
75 
76  if(!ref) {
77  heap_free(This->fetc);
78  heap_free(This);
79 
81  }
82 
83  return ref;
84 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:68
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ EnumFORMATETC_Reset()

static HRESULT WINAPI EnumFORMATETC_Reset ( IEnumFORMATETC iface)
static

Definition at line 124 of file format.c.

125 {
127 
128  TRACE("(%p)\n", This);
129 
130  This->it = 0;
131  return S_OK;
132 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ EnumFORMATETC_Skip()

static HRESULT WINAPI EnumFORMATETC_Skip ( IEnumFORMATETC iface,
ULONG  celt 
)
static

Definition at line 114 of file format.c.

115 {
117 
118  TRACE("(%p)->(%d)\n", This, celt);
119 
120  This->it += celt;
121  return This->it > This->fetc_cnt ? S_FALSE : S_OK;
122 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static EnumFORMATETC * impl_from_IEnumFORMATETC(IEnumFORMATETC *iface)
Definition: format.c:36

◆ impl_from_IEnumFORMATETC()

static EnumFORMATETC* impl_from_IEnumFORMATETC ( IEnumFORMATETC iface)
inlinestatic

Definition at line 36 of file format.c.

37 {
38  return CONTAINING_RECORD(iface, EnumFORMATETC, IEnumFORMATETC_iface);
39 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by EnumFORMATETC_AddRef(), EnumFORMATETC_Clone(), EnumFORMATETC_Next(), EnumFORMATETC_QueryInterface(), EnumFORMATETC_Release(), EnumFORMATETC_Reset(), and EnumFORMATETC_Skip().

◆ RegisterFormatEnumerator()

HRESULT WINAPI RegisterFormatEnumerator ( LPBC  pBC,
IEnumFORMATETC pEFetc,
DWORD  reserved 
)

Definition at line 194 of file format.c.

195 {
196  TRACE("(%p %p %d)\n", pBC, pEFetc, reserved);
197 
198  if(reserved)
199  WARN("reserved != 0\n");
200 
201  if(!pBC || !pEFetc)
202  return E_INVALIDARG;
203 
204  return IBindCtx_RegisterObjectParam(pBC, wszEnumFORMATETC, (IUnknown*)pEFetc);
205 }
#define WARN(fmt,...)
Definition: debug.h:111
r reserved
Definition: btrfs.c:2865
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static WCHAR wszEnumFORMATETC[]
Definition: format.c:24

Referenced by RegisterDefaultAcceptHeaders(), and test_RegisterFormatEnumerator().

◆ RevokeFormatEnumerator()

HRESULT WINAPI RevokeFormatEnumerator ( LPBC  pbc,
IEnumFORMATETC pEFetc 
)

Definition at line 210 of file format.c.

211 {
212  TRACE("(%p %p)\n", pbc, pEFetc);
213 
214  if(!pbc)
215  return E_INVALIDARG;
216 
217  return IBindCtx_RevokeObjectParam(pbc, wszEnumFORMATETC);
218 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static WCHAR wszEnumFORMATETC[]
Definition: format.c:24

Referenced by test_RegisterFormatEnumerator().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( urlmon  )

Variable Documentation

◆ EnumFORMATETCVtbl

const IEnumFORMATETCVtbl EnumFORMATETCVtbl
static
Initial value:
= {
}
static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface)
Definition: format.c:61
static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface)
Definition: format.c:69
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: format.c:114
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: format.c:86
static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, REFIID riid, void **ppv)
Definition: format.c:43
static HRESULT WINAPI EnumFORMATETC_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: format.c:134
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
Definition: format.c:124

Definition at line 147 of file format.c.

Referenced by EnumFORMATETC_Create().

◆ wszEnumFORMATETC

WCHAR wszEnumFORMATETC[] = {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0}
static