#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "objbase.h"
#include "ole2.h"
#include "winerror.h"
#include "wine/debug.h"
Go to the source code of this file.
|
| | WINE_DEFAULT_DEBUG_CHANNEL (ole) |
| |
| static HGLOBALLockBytesImpl * | impl_from_ILockBytes (ILockBytes *iface) |
| |
| HRESULT WINAPI | CreateILockBytesOnHGlobal (HGLOBAL global, BOOL delete_on_release, ILockBytes **ret) |
| |
| HRESULT WINAPI | GetHGlobalFromILockBytes (ILockBytes *iface, HGLOBAL *phglobal) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_QueryInterface (ILockBytes *iface, REFIID riid, void **ppvObject) |
| |
| static ULONG WINAPI | HGLOBALLockBytesImpl_AddRef (ILockBytes *iface) |
| |
| static ULONG WINAPI | HGLOBALLockBytesImpl_Release (ILockBytes *iface) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_ReadAt (ILockBytes *iface, ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_WriteAt (ILockBytes *iface, ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_Flush (ILockBytes *iface) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_SetSize (ILockBytes *iface, ULARGE_INTEGER libNewSize) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_LockRegion (ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_UnlockRegion (ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) |
| |
| static HRESULT WINAPI | HGLOBALLockBytesImpl_Stat (ILockBytes *iface, STATSTG *pstatstg, DWORD grfStatFlag) |
| |
◆ COBJMACROS
◆ HGLOBALLockBytesImpl
◆ CreateILockBytesOnHGlobal()
Definition at line 96 of file memlockbytes.c.
97{
99
102
105
106
107
108
111
112
113
114
117
118
119
120
123
125
127}
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
static const ILockBytesVtbl HGLOBALLockBytesImpl_Vtbl
ILockBytes ILockBytes_iface
ULARGE_INTEGER byteArraySize
Referenced by create_storage(), DataObjectImpl_CreateComplex(), get_data_from_storage(), get_stgmed_for_storage(), render_embed_source_hack(), stream_to_storage(), test_data_cache_save(), test_data_cache_save_data(), test_hglobal_storage_creation(), test_hglobal_storage_stat(), and test_OleCreateStaticFromData().
◆ GetHGlobalFromILockBytes()
Definition at line 143 of file memlockbytes.c.
144{
146 STATSTG stbuf;
150
151 *phglobal = 0;
153 *phglobal =
This->supportHandle;
154 if (*phglobal == 0)
157 }
158
159 hres = ILockBytes_Stat(iface,&stbuf,STATFLAG_NONAME);
161 ERR(
"Cannot ILockBytes_Stat, %lx\n",
hres);
163 }
166 if (!*phglobal)
169 hres = ILockBytes_ReadAt(iface,
start,
GlobalLock(*phglobal), stbuf.cbSize.LowPart, &xread);
172 FIXME(
"%p->ReadAt failed with %lx\n",iface,
hres);
174 }
175 if (stbuf.cbSize.LowPart != xread) {
176 FIXME(
"Read size is not requested size %ld vs %ld?\n",stbuf.cbSize.LowPart, xread);
177 }
179}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
static ERESOURCE GlobalLock
static HGLOBALLockBytesImpl * impl_from_ILockBytes(ILockBytes *iface)
Referenced by create_storage().
◆ HGLOBALLockBytesImpl_AddRef()
Definition at line 220 of file memlockbytes.c.
221{
224}
#define InterlockedIncrement
◆ HGLOBALLockBytesImpl_Flush()
◆ HGLOBALLockBytesImpl_LockRegion()
Definition at line 442 of file memlockbytes.c.
447{
449}
#define STG_E_INVALIDFUNCTION
◆ HGLOBALLockBytesImpl_QueryInterface()
Definition at line 191 of file memlockbytes.c.
195{
197
198 if (ppvObject==0)
200
201 *ppvObject = 0;
202
205 {
206 *ppvObject = &
This->ILockBytes_iface;
207 }
208 else
210
211 ILockBytes_AddRef(iface);
212
214}
#define IsEqualIID(riid1, riid2)
◆ HGLOBALLockBytesImpl_ReadAt()
Definition at line 257 of file memlockbytes.c.
263{
265
266 void* supportBuffer;
267 ULONG bytesReadBuffer = 0;
268 ULONG bytesToReadFromBuffer;
269
270
271
272
273
274 if (pcbRead == 0)
275 pcbRead = &bytesReadBuffer;
276
277
278
279
280 if (ulOffset.
LowPart >
This->byteArraySize.LowPart)
282
283
284
285
286
287 bytesToReadFromBuffer =
min(
This->byteArraySize.LowPart - ulOffset.
LowPart,
cb);
288
289
290
291
293
295 (
char *) supportBuffer + ulOffset.
LowPart,
296 bytesToReadFromBuffer);
297
298
299
300
301 *pcbRead = bytesToReadFromBuffer;
302
303
304
305
307
308
309
310
311
312
313
316
318}
#define memcpy(s1, s2, n)
◆ HGLOBALLockBytesImpl_Release()
Definition at line 230 of file memlockbytes.c.
231{
234
237 {
238 if (
This->deleteOnRelease)
239 {
241 This->supportHandle = 0;
242 }
244 }
245
247}
#define InterlockedDecrement
#define HeapFree(x, y, z)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
◆ HGLOBALLockBytesImpl_SetSize()
Definition at line 405 of file memlockbytes.c.
408{
411
412
413
414
417
418 if (
This->byteArraySize.LowPart == libNewSize.
LowPart)
420
421
422
423
425
426 if (supportHandle == 0)
428
429 This->supportHandle = supportHandle;
431
433}
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
◆ HGLOBALLockBytesImpl_Stat()
Definition at line 475 of file memlockbytes.c.
479{
481
482 memset(pstatstg, 0,
sizeof(STATSTG));
483
484 pstatstg->pwcsName =
NULL;
485 pstatstg->type = STGTY_LOCKBYTES;
486 pstatstg->cbSize =
This->byteArraySize;
487
489}
◆ HGLOBALLockBytesImpl_UnlockRegion()
◆ HGLOBALLockBytesImpl_WriteAt()
Definition at line 328 of file memlockbytes.c.
334{
336
337 void* supportBuffer;
340
341
342
343
344
345 if (pcbWritten == 0)
347
349 {
351 }
352 else
353 {
356 }
357
358
359
360
362 {
363
366 }
367
368
369
370
372
374
375
376
377
379
380
381
382
384
386}
GLenum GLsizei GLuint GLint * bytesWritten
◆ impl_from_ILockBytes()
◆ WINE_DEFAULT_DEBUG_CHANNEL()
| WINE_DEFAULT_DEBUG_CHANNEL |
( |
ole |
| ) |
|
◆ HGLOBALLockBytesImpl_Vtbl
| static const ILockBytesVtbl HGLOBALLockBytesImpl_Vtbl |
|
static |
Initial value:=
{
}
static ULONG WINAPI HGLOBALLockBytesImpl_AddRef(ILockBytes *iface)
static ULONG WINAPI HGLOBALLockBytesImpl_Release(ILockBytes *iface)
static HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt(ILockBytes *iface, ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten)
static HRESULT WINAPI HGLOBALLockBytesImpl_Stat(ILockBytes *iface, STATSTG *pstatstg, DWORD grfStatFlag)
static HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(ILockBytes *iface, ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead)
static HRESULT WINAPI HGLOBALLockBytesImpl_LockRegion(ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static HRESULT WINAPI HGLOBALLockBytesImpl_UnlockRegion(ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static HRESULT WINAPI HGLOBALLockBytesImpl_QueryInterface(ILockBytes *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI HGLOBALLockBytesImpl_Flush(ILockBytes *iface)
static HRESULT WINAPI HGLOBALLockBytesImpl_SetSize(ILockBytes *iface, ULARGE_INTEGER libNewSize)
Definition at line 73 of file memlockbytes.c.
Referenced by CreateILockBytesOnHGlobal(), and GetHGlobalFromILockBytes().