32#define NONAMELESSUNION
66 if (
handle->delete_on_release)
72 handle->lock.DebugInfo->Spare[0] = 0;
84 if (*pos < handle->
size)
98 WARN(
"read from invalid hglobal %p\n",
handle->hglobal);
120 handle->hglobal = hglobal;
139 WARN(
"write to invalid hglobal %p\n",
handle->hglobal);
164 handle->hglobal = hglobal;
192 handle->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": handle_wrapper.lock");
241 IStream_AddRef(iface);
285 TRACE(
"(%p, %p, %d, %p)\n", iface, pv,
cb, pcbRead);
288 if (pcbRead) *pcbRead = num_bytes;
312 TRACE(
"(%p, %p, %d, %p)\n", iface, pv,
cb, pcbWritten);
315 if (pcbWritten) *pcbWritten = num_bytes;
339 TRACE(
"(%p, %x%08x, %d, %p)\n", iface, dlibMove.
u.HighPart,
340 dlibMove.
u.LowPart, dwOrigin, plibNewPosition);
348 case STREAM_SEEK_SET:
349 newPosition.
u.HighPart = 0;
350 newPosition.
u.LowPart = 0;
352 case STREAM_SEEK_CUR:
354 case STREAM_SEEK_END:
367 newPosition.
u.HighPart = 0;
368 newPosition.
u.LowPart += dlibMove.
QuadPart;
370 if (dlibMove.
u.LowPart >= 0x80000000 &&
371 newPosition.
u.LowPart >= dlibMove.
u.LowPart)
378 This->currentPosition = newPosition;
381 if (plibNewPosition) *plibNewPosition =
This->currentPosition;
401 TRACE(
"(%p, %d)\n", iface, libNewSize.
u.LowPart);
429 TRACE(
"(%p, %p, %d, %p, %p)\n", iface, pstm,
430 cb.u.LowPart, pcbRead, pcbWritten);
438 while (
cb.QuadPart > 0 )
440 if (
cb.QuadPart >=
sizeof(tmpBuffer) )
441 copySize =
sizeof(tmpBuffer);
443 copySize =
cb.u.LowPart;
445 hr = IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
449 totalBytesRead.
QuadPart += bytesRead;
460 if (bytesRead!=copySize)
463 cb.QuadPart -= bytesRead;
482 DWORD grfCommitFlags)
550 memset(pstatstg, 0,
sizeof(STATSTG));
552 pstatstg->pwcsName =
NULL;
553 pstatstg->type = STGTY_STREAM;
587 TRACE(
" Cloning %p (seek position=%d)\n", iface,
This->currentPosition.u.LowPart);
598 IStream_Seek(*ppstm,
offset, STREAM_SEEK_SET, &
dummy);
625 BOOL fDeleteOnRelease,
643 This->currentPosition.u.HighPart = 0;
644 This->currentPosition.u.LowPart = 0;
646 *ppstm = &
This->IStream_iface;
658 if (!pstm || !phglobal)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define HeapFree(x, y, z)
static ULONG handle_getsize(struct handle_wrapper *handle)
static ULONG handle_read(struct handle_wrapper *handle, ULONG *pos, void *dest, ULONG len)
static ULONG WINAPI HGLOBALStreamImpl_Release(IStream *iface)
static HRESULT WINAPI HGLOBALStreamImpl_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
static HRESULT WINAPI HGLOBALStreamImpl_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
static HRESULT WINAPI HGLOBALStreamImpl_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
static HGLOBALStreamImpl * HGLOBALStreamImpl_Create(void)
static void handle_release(struct handle_wrapper *handle)
static HRESULT WINAPI HGLOBALStreamImpl_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
static ULONG handle_write(struct handle_wrapper *handle, ULONG *pos, const void *source, ULONG len)
static HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static HGLOBAL handle_gethglobal(struct handle_wrapper *handle)
static HRESULT WINAPI HGLOBALStreamImpl_QueryInterface(IStream *iface, REFIID riid, void **ppvObject)
static HRESULT handle_setsize(struct handle_wrapper *handle, ULONG size)
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
static void handle_addref(struct handle_wrapper *handle)
static HRESULT WINAPI HGLOBALStreamImpl_Clone(IStream *iface, IStream **ppstm)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static ULONG WINAPI HGLOBALStreamImpl_AddRef(IStream *iface)
static HRESULT WINAPI HGLOBALStreamImpl_Stat(IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag)
static HRESULT WINAPI HGLOBALStreamImpl_Commit(IStream *iface, DWORD grfCommitFlags)
static HRESULT WINAPI HGLOBALStreamImpl_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static HGLOBALStreamImpl * impl_from_IStream(IStream *iface)
static const IStreamVtbl HGLOBALStreamImplVtbl
static HRESULT WINAPI HGLOBALStreamImpl_Revert(IStream *iface)
static struct handle_wrapper * handle_create(HGLOBAL hglobal, BOOL delete_on_release)
static HRESULT WINAPI HGLOBALStreamImpl_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
GLenum GLsizei GLuint GLint * bytesWritten
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
#define memcpy(s1, s2, n)
static HMODULE MODULEINFO DWORD cb
interface IStream * LPSTREAM
#define IsEqualIID(riid1, riid2)
ULARGE_INTEGER currentPosition
struct handle_wrapper * handle
struct _ULARGE_INTEGER::@4136 u
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
struct _LARGE_INTEGER::@2299 u
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
#define STG_E_INVALIDPOINTER
#define STG_E_INVALIDFUNCTION