#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
◆ NONAMELESSUNION
◆ HGLOBALLockBytesImpl
◆ CreateILockBytesOnHGlobal()
Definition at line 98 of file memlockbytes.c.
99{
101
104
107
108
109
110
113
114
115
116
119
120
121
122
125
127
129}
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
struct _ULARGE_INTEGER::@4188 u
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 145 of file memlockbytes.c.
146{
148 STATSTG stbuf;
152
153 *phglobal = 0;
155 *phglobal =
This->supportHandle;
156 if (*phglobal == 0)
159 }
160
161 hres = ILockBytes_Stat(iface,&stbuf,STATFLAG_NONAME);
163 ERR(
"Cannot ILockBytes_Stat, %x\n",
hres);
165 }
168 if (!*phglobal)
171 hres = ILockBytes_ReadAt(iface,
start,
GlobalLock(*phglobal), stbuf.cbSize.u.LowPart, &xread);
174 FIXME(
"%p->ReadAt failed with %x\n",iface,
hres);
176 }
177 if (stbuf.cbSize.u.LowPart != xread) {
178 FIXME(
"Read size is not requested size %d vs %d?\n",stbuf.cbSize.u.LowPart, xread);
179 }
181}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
static HGLOBALLockBytesImpl * impl_from_ILockBytes(ILockBytes *iface)
Referenced by create_storage().
◆ HGLOBALLockBytesImpl_AddRef()
Definition at line 222 of file memlockbytes.c.
223{
226}
#define InterlockedIncrement
◆ HGLOBALLockBytesImpl_Flush()
◆ HGLOBALLockBytesImpl_LockRegion()
Definition at line 445 of file memlockbytes.c.
450{
452}
#define STG_E_INVALIDFUNCTION
◆ HGLOBALLockBytesImpl_QueryInterface()
Definition at line 193 of file memlockbytes.c.
197{
199
202
204
207 {
209 }
210 else
212
213 ILockBytes_AddRef(iface);
214
216}
#define IsEqualIID(riid1, riid2)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
◆ HGLOBALLockBytesImpl_ReadAt()
Definition at line 259 of file memlockbytes.c.
265{
267
268 void* supportBuffer;
269 ULONG bytesReadBuffer = 0;
270 ULONG bytesToReadFromBuffer;
271
272
273
274
275
276 if (pcbRead == 0)
277 pcbRead = &bytesReadBuffer;
278
279
280
281
282 if (ulOffset.
u.LowPart >
This->byteArraySize.u.LowPart)
284
285
286
287
288
289 bytesToReadFromBuffer =
min(
This->byteArraySize.u.LowPart -
290 ulOffset.
u.LowPart,
cb);
291
292
293
294
296
298 (
char *) supportBuffer + ulOffset.
u.LowPart,
299 bytesToReadFromBuffer);
300
301
302
303
304 *pcbRead = bytesToReadFromBuffer;
305
306
307
308
310
311
312
313
314
315
316
319
321}
#define memcpy(s1, s2, n)
static HMODULE MODULEINFO DWORD cb
◆ HGLOBALLockBytesImpl_Release()
Definition at line 232 of file memlockbytes.c.
233{
236
239 {
240 if (
This->deleteOnRelease)
241 {
243 This->supportHandle = 0;
244 }
246 }
247
249}
#define InterlockedDecrement
#define HeapFree(x, y, z)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
◆ HGLOBALLockBytesImpl_SetSize()
Definition at line 408 of file memlockbytes.c.
411{
414
415
416
417
418 if (libNewSize.
u.HighPart != 0)
420
421 if (
This->byteArraySize.u.LowPart == libNewSize.
u.LowPart)
423
424
425
426
428
429 if (supportHandle == 0)
431
432 This->supportHandle = supportHandle;
433 This->byteArraySize.u.LowPart = libNewSize.
u.LowPart;
434
436}
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
◆ HGLOBALLockBytesImpl_Stat()
Definition at line 478 of file memlockbytes.c.
482{
484
485 memset(pstatstg, 0,
sizeof(STATSTG));
486
487 pstatstg->pwcsName =
NULL;
488 pstatstg->type = STGTY_LOCKBYTES;
489 pstatstg->cbSize =
This->byteArraySize;
490
492}
◆ HGLOBALLockBytesImpl_UnlockRegion()
◆ HGLOBALLockBytesImpl_WriteAt()
Definition at line 331 of file memlockbytes.c.
337{
339
340 void* supportBuffer;
343
344
345
346
347
348 if (pcbWritten == 0)
350
352 {
354 }
355 else
356 {
357 newSize.
u.HighPart = 0;
358 newSize.
u.LowPart = ulOffset.
u.LowPart +
cb;
359 }
360
361
362
363
364 if (newSize.
u.LowPart >
This->byteArraySize.u.LowPart)
365 {
366
369 }
370
371
372
373
375
376 memcpy((
char *) supportBuffer + ulOffset.
u.LowPart, pv,
cb);
377
378
379
380
382
383
384
385
387
389}
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 75 of file memlockbytes.c.
Referenced by CreateILockBytesOnHGlobal(), and GetHGlobalFromILockBytes().