ReactOS  0.4.14-dev-614-gbfd8a84
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 }
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
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

◆ HTMLLoadOptions_Create()

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

Definition at line 173 of file loadopts.c.

174 {
176  HRESULT hres;
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 const IHtmlLoadOptionsVtbl HtmlLoadOptionsVtbl
Definition: loadopts.c:165
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
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 E_NOINTERFACE
Definition: winerror.h:2364
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ 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 }
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
#define E_FAIL
Definition: ddrawi.h:102
PVOID pBuffer
struct load_opt * next
Definition: loadopts.c:26
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
DWORD option
Definition: loadopts.c:22
PVOID buffer
Definition: loadopts.c:23
DWORD size
Definition: loadopts.c:24

◆ 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);
90  heap_free(last);
91  }
92 
93  heap_free(This);
94  }
95 
96  return ref;
97 }
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
POINT last
Definition: font.c:46
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
struct load_opt * next
Definition: loadopts.c:26
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 }
static HTMLLoadOptions * impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
Definition: loadopts.c:37
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
struct load_opt * next
Definition: loadopts.c:26
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
DWORD option
Definition: loadopts.c:22
PVOID buffer
Definition: loadopts.c:23
DWORD size
Definition: loadopts.c:24
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 }
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 HtmlLoadOptions_AddRef(), HtmlLoadOptions_QueryInterface(), HtmlLoadOptions_QueryOption(), HtmlLoadOptions_Release(), and HtmlLoadOptions_SetOption().

Variable Documentation

◆ HtmlLoadOptionsVtbl

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

Definition at line 165 of file loadopts.c.

Referenced by HTMLLoadOptions_Create().