ReactOS 0.4.16-dev-297-gc569aee
loadopts.c File Reference
#include "mshtml_private.h"
Include dependency graph for loadopts.c:

Go to the source code of this file.

Classes

struct  load_opt
 
struct  HTMLLoadOptions
 

Typedefs

typedef struct load_opt load_opt
 

Functions

static HTMLLoadOptionsimpl_from_IHtmlLoadOptions (IHtmlLoadOptions *iface)
 
static HRESULT WINAPI HtmlLoadOptions_QueryInterface (IHtmlLoadOptions *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HtmlLoadOptions_AddRef (IHtmlLoadOptions *iface)
 
static ULONG WINAPI HtmlLoadOptions_Release (IHtmlLoadOptions *iface)
 
static HRESULT WINAPI HtmlLoadOptions_QueryOption (IHtmlLoadOptions *iface, DWORD dwOption, LPVOID pBuffer, ULONG *pcbBuf)
 
static HRESULT WINAPI HtmlLoadOptions_SetOption (IHtmlLoadOptions *iface, DWORD dwOption, LPVOID pBuffer, ULONG cbBuf)
 
HRESULT HTMLLoadOptions_Create (IUnknown *pUnkOuter, REFIID riid, void **ppv)
 

Variables

static const IHtmlLoadOptionsVtbl HtmlLoadOptionsVtbl
 

Typedef Documentation

◆ load_opt

Function Documentation

◆ HtmlLoadOptions_AddRef()

static ULONG WINAPI HtmlLoadOptions_AddRef ( IHtmlLoadOptions iface)
static

Definition at line 65 of file loadopts.c.

66{
69
70 TRACE("(%p) ref=%d\n", This, ref);
71
72 return ref;
73}
#define InterlockedIncrement
Definition: armddk.h:53
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48

◆ HTMLLoadOptions_Create()

HRESULT HTMLLoadOptions_Create ( IUnknown pUnkOuter,
REFIID  riid,
void **  ppv 
)

Definition at line 173 of file loadopts.c.

174{
177
178 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_mshtml_guid(riid), ppv);
179
180 ret = heap_alloc(sizeof(HTMLLoadOptions));
181 if(!ret)
182 return E_OUTOFMEMORY;
183
184 ret->IHtmlLoadOptions_iface.lpVtbl = &HtmlLoadOptionsVtbl;
185 ret->ref = 1;
186 ret->opts = NULL;
187
188 hres = IHtmlLoadOptions_QueryInterface(&ret->IHtmlLoadOptions_iface, riid, ppv);
189 IHtmlLoadOptions_Release(&ret->IHtmlLoadOptions_iface);
190 return hres;
191}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IHtmlLoadOptionsVtbl HtmlLoadOptionsVtbl
Definition: loadopts.c:165
HRESULT hres
Definition: protocol.c:465
int ret

Referenced by DllGetClassObject().

◆ HtmlLoadOptions_QueryInterface()

static HRESULT WINAPI HtmlLoadOptions_QueryInterface ( IHtmlLoadOptions iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 42 of file loadopts.c.

44{
46
47 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
48
50 *ppv = &This->IHtmlLoadOptions_iface;
51 }else if(IsEqualGUID(&IID_IOptionArray, riid)) {
52 *ppv = &This->IHtmlLoadOptions_iface;
53 }else if(IsEqualGUID(&IID_IHtmlLoadOptions, riid)) {
54 *ppv = &This->IHtmlLoadOptions_iface;
55 }else {
56 *ppv = NULL;
57 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
58 return E_NOINTERFACE;
59 }
60
61 IUnknown_AddRef((IUnknown*)*ppv);
62 return S_OK;
63}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ HtmlLoadOptions_QueryOption()

static HRESULT WINAPI HtmlLoadOptions_QueryOption ( IHtmlLoadOptions iface,
DWORD  dwOption,
LPVOID  pBuffer,
ULONG pcbBuf 
)
static

Definition at line 99 of file loadopts.c.

101{
103 load_opt *iter;
104
105 TRACE("(%p)->(%d %p %p)\n", This, dwOption, pBuffer, pcbBuf);
106
107 for(iter = This->opts; iter; iter = iter->next) {
108 if(iter->option == dwOption)
109 break;
110 }
111
112 if(!iter) {
113 *pcbBuf = 0;
114 return S_OK;
115 }
116
117 if(*pcbBuf < iter->size) {
118 *pcbBuf = iter->size;
119 return E_FAIL;
120 }
121
122 memcpy(pBuffer, iter->buffer, iter->size);
123 *pcbBuf = iter->size;
124
125 return S_OK;
126}
#define E_FAIL
Definition: ddrawi.h:102
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PVOID pBuffer
DWORD size
Definition: loadopts.c:24
DWORD option
Definition: loadopts.c:22
struct load_opt * next
Definition: loadopts.c:26
PVOID buffer
Definition: loadopts.c:23

◆ HtmlLoadOptions_Release()

static ULONG WINAPI HtmlLoadOptions_Release ( IHtmlLoadOptions iface)
static

Definition at line 75 of file loadopts.c.

76{
79
80 TRACE("(%p) ref=%d\n", This, ref);
81
82 if(!ref) {
83 load_opt *iter = This->opts, *last;
84
85 while(iter) {
86 last = iter;
87 iter = iter->next;
88
89 heap_free(last->buffer);
91 }
92
94 }
95
96 return ref;
97}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52
static UINT UINT last
Definition: font.c:45

◆ HtmlLoadOptions_SetOption()

static HRESULT WINAPI HtmlLoadOptions_SetOption ( IHtmlLoadOptions iface,
DWORD  dwOption,
LPVOID  pBuffer,
ULONG  cbBuf 
)
static

Definition at line 128 of file loadopts.c.

130{
132 load_opt *iter = NULL;
133
134 TRACE("(%p)->(%d %p %d)\n", This, dwOption, pBuffer, cbBuf);
135
136 for(iter = This->opts; iter; iter = iter->next) {
137 if(iter->option == dwOption)
138 break;
139 }
140
141 if(!iter) {
142 iter = heap_alloc(sizeof(load_opt));
143 iter->next = This->opts;
144 This->opts = iter;
145
146 iter->option = dwOption;
147 }else {
148 heap_free(iter->buffer);
149 }
150
151 if(!cbBuf) {
152 iter->buffer = NULL;
153 iter->size = 0;
154
155 return S_OK;
156 }
157
158 iter->size = cbBuf;
159 iter->buffer = heap_alloc(cbBuf);
160 memcpy(iter->buffer, pBuffer, iter->size);
161
162 return S_OK;
163}

◆ impl_from_IHtmlLoadOptions()

static HTMLLoadOptions * impl_from_IHtmlLoadOptions ( IHtmlLoadOptions iface)
inlinestatic

Definition at line 37 of file loadopts.c.

38{
39 return CONTAINING_RECORD(iface, HTMLLoadOptions, IHtmlLoadOptions_iface);
40}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by HtmlLoadOptions_AddRef(), HtmlLoadOptions_QueryInterface(), HtmlLoadOptions_QueryOption(), HtmlLoadOptions_Release(), and HtmlLoadOptions_SetOption().

Variable Documentation

◆ HtmlLoadOptionsVtbl

const IHtmlLoadOptionsVtbl HtmlLoadOptionsVtbl
static
Initial value:
= {
}
static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
Definition: loadopts.c:75
static ULONG WINAPI HtmlLoadOptions_AddRef(IHtmlLoadOptions *iface)
Definition: loadopts.c:65
static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD dwOption, LPVOID pBuffer, ULONG cbBuf)
Definition: loadopts.c:128
static HRESULT WINAPI HtmlLoadOptions_QueryInterface(IHtmlLoadOptions *iface, REFIID riid, void **ppv)
Definition: loadopts.c:42
static HRESULT WINAPI HtmlLoadOptions_QueryOption(IHtmlLoadOptions *iface, DWORD dwOption, LPVOID pBuffer, ULONG *pcbBuf)
Definition: loadopts.c:99

Definition at line 165 of file loadopts.c.

Referenced by HTMLLoadOptions_Create().