ReactOS 0.4.17-dev-116-ga4b6fe9
istream.c
Go to the documentation of this file.
1/*
2 * SHLWAPI IStream functions
3 *
4 * Copyright 2002 Jon Griffiths
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20#include <stdarg.h>
21#include <string.h>
22
23#define COBJMACROS
24#define NONAMELESSUNION
25
26#include "windef.h"
27#include "winbase.h"
28#include "winerror.h"
29#include "winnls.h"
30#define NO_SHLWAPI_REG
31#define NO_SHLWAPI_PATH
32#include "shlwapi.h"
33#ifdef __REACTOS__
34#include "shlobj.h"
35#endif
36#include "wine/debug.h"
37
39
40#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
41#define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0)
42#define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000)
43
44/* Layout of ISHFileStream object */
45typedef struct
46{
55
57{
58 return CONTAINING_RECORD(iface, ISHFileStream, IStream_iface);
59}
60
62
63
64/**************************************************************************
65* IStream_fnQueryInterface
66*/
68{
70
71 TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
72
73 *ppvObj = NULL;
74
76 IsEqualIID(riid, &IID_IStream))
77 {
78 IStream_AddRef(iface);
79 *ppvObj = iface;
80 return S_OK;
81 }
82 return E_NOINTERFACE;
83}
84
85/**************************************************************************
86* IStream_fnAddRef
87*/
89{
91 ULONG refCount = InterlockedIncrement(&This->ref);
92
93 TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
94
95 return refCount;
96}
97
98/**************************************************************************
99* IStream_fnRelease
100*/
102{
104 ULONG refCount = InterlockedDecrement(&This->ref);
105
106 TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
107
108 if (!refCount)
109 {
110 IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
111 LocalFree(This->lpszPath);
112 CloseHandle(This->hFile);
114 }
115
116 return refCount;
117}
118
119/**************************************************************************
120 * IStream_fnRead
121 */
122static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG* pcbRead)
123{
125 DWORD dwRead = 0;
126
127 TRACE("(%p,%p,0x%08x,%p)\n", This, pv, cb, pcbRead);
128
129 if (!ReadFile(This->hFile, pv, cb, &dwRead, NULL))
130 {
131 WARN("error %d reading file\n", GetLastError());
132 return S_FALSE;
133 }
134 if (pcbRead)
135 *pcbRead = dwRead;
136 return dwRead == cb ? S_OK : S_FALSE;
137}
138
139/**************************************************************************
140 * IStream_fnWrite
141 */
142static HRESULT WINAPI IStream_fnWrite(IStream *iface, const void* pv, ULONG cb, ULONG* pcbWritten)
143{
145 DWORD dwWritten = 0;
146
147 TRACE("(%p,%p,0x%08x,%p)\n", This, pv, cb, pcbWritten);
148
149 switch (STGM_ACCESS_MODE(This->dwMode))
150 {
151 case STGM_WRITE:
152 case STGM_READWRITE:
153 break;
154 default:
155 return STG_E_ACCESSDENIED;
156 }
157
158 if (!WriteFile(This->hFile, pv, cb, &dwWritten, NULL))
160
161 if (pcbWritten)
162 *pcbWritten = dwWritten;
163 return S_OK;
164}
165
166/**************************************************************************
167 * IStream_fnSeek
168 */
170 DWORD dwOrigin, ULARGE_INTEGER* pNewPos)
171{
173 DWORD dwPos;
174
175 TRACE("(%p,%d,%d,%p)\n", This, dlibMove.u.LowPart, dwOrigin, pNewPos);
176
177 IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
178 dwPos = SetFilePointer(This->hFile, dlibMove.u.LowPart, NULL, dwOrigin);
179 if( dwPos == INVALID_SET_FILE_POINTER )
181
182 if (pNewPos)
183 {
184 pNewPos->u.HighPart = 0;
185 pNewPos->u.LowPart = dwPos;
186 }
187 return S_OK;
188}
189
190/**************************************************************************
191 * IStream_fnSetSize
192 */
194{
196
197 TRACE("(%p,%d)\n", This, libNewSize.u.LowPart);
198
199 IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
200 if( ! SetFilePointer( This->hFile, libNewSize.QuadPart, NULL, FILE_BEGIN ) )
201 return E_FAIL;
202
203 if( ! SetEndOfFile( This->hFile ) )
204 return E_FAIL;
205
206 return S_OK;
207}
208
209/**************************************************************************
210 * IStream_fnCopyTo
211 */
213 ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)
214{
216 char copyBuff[1024];
217 ULONGLONG ulSize;
218 HRESULT hRet = S_OK;
219
220 TRACE("(%p,%p,%d,%p,%p)\n", This, pstm, cb.u.LowPart, pcbRead, pcbWritten);
221
222 if (pcbRead)
223 pcbRead->QuadPart = 0;
224 if (pcbWritten)
225 pcbWritten->QuadPart = 0;
226
227 if (!pstm)
228 return S_OK;
229
230 IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
231
232 /* Copy data */
233 ulSize = cb.QuadPart;
234 while (ulSize)
235 {
236 ULONG ulLeft, ulRead, ulWritten;
237
238 ulLeft = ulSize > sizeof(copyBuff) ? sizeof(copyBuff) : ulSize;
239
240 /* Read */
241 hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulRead);
242 if (FAILED(hRet) || ulRead == 0)
243 break;
244 if (pcbRead)
245 pcbRead->QuadPart += ulRead;
246
247 /* Write */
248 hRet = IStream_fnWrite(pstm, copyBuff, ulRead, &ulWritten);
249 if (pcbWritten)
250 pcbWritten->QuadPart += ulWritten;
251 if (FAILED(hRet) || ulWritten != ulLeft)
252 break;
253
254 ulSize -= ulLeft;
255 }
256 return hRet;
257}
258
259/**************************************************************************
260 * IStream_fnCommit
261 */
262static HRESULT WINAPI IStream_fnCommit(IStream *iface, DWORD grfCommitFlags)
263{
265
266 TRACE("(%p,%d)\n", This, grfCommitFlags);
267 /* Currently unbuffered: This function is not needed */
268 return S_OK;
269}
270
271/**************************************************************************
272 * IStream_fnRevert
273 */
275{
277
278 TRACE("(%p)\n", This);
279 return E_NOTIMPL;
280}
281
282/**************************************************************************
283 * IStream_fnLockUnlockRegion
284 */
286 ULARGE_INTEGER cb, DWORD dwLockType)
287{
289 TRACE("(%p,%d,%d,%d)\n", This, libOffset.u.LowPart, cb.u.LowPart, dwLockType);
290 return E_NOTIMPL;
291}
292
293/*************************************************************************
294 * IStream_fnStat
295 */
296static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG* lpStat,
297 DWORD grfStatFlag)
298{
301
302 TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag);
303
304 if (!lpStat)
306
307 memset(&fi, 0, sizeof(fi));
308 GetFileInformationByHandle(This->hFile, &fi);
309
310 if (grfStatFlag & STATFLAG_NONAME)
311 lpStat->pwcsName = NULL;
312 else
313 lpStat->pwcsName = StrDupW(This->lpszPath);
314 lpStat->type = This->type;
315 lpStat->cbSize.u.LowPart = fi.nFileSizeLow;
316 lpStat->cbSize.u.HighPart = fi.nFileSizeHigh;
317 lpStat->mtime = fi.ftLastWriteTime;
318 lpStat->ctime = fi.ftCreationTime;
319 lpStat->atime = fi.ftLastAccessTime;
320 lpStat->grfMode = This->dwMode;
321 lpStat->grfLocksSupported = 0;
322 memcpy(&lpStat->clsid, &IID_IStream, sizeof(CLSID));
323 lpStat->grfStateBits = This->grfStateBits;
324 lpStat->reserved = 0;
325
326 return S_OK;
327}
328
329/*************************************************************************
330 * IStream_fnClone
331 */
333{
335
336 TRACE("(%p)\n",This);
337 if (ppstm)
338 *ppstm = NULL;
339 return E_NOTIMPL;
340}
341
342static const IStreamVtbl SHLWAPI_fsVTable =
343{
358};
359
360/**************************************************************************
361 * IStream_Create
362 *
363 * Internal helper: Create and initialise a new file stream object.
364 */
365static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode)
366{
367 ISHFileStream *fileStream;
368
369 fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream));
370 if (!fileStream) return NULL;
371
372 fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable;
373 fileStream->ref = 1;
374 fileStream->hFile = hFile;
375 fileStream->dwMode = dwMode;
376 fileStream->lpszPath = StrDupW(lpszPath);
377 fileStream->type = 0; /* FIXME */
378 fileStream->grfStateBits = 0; /* FIXME */
379
380 TRACE ("Returning %p\n", fileStream);
381 return &fileStream->IStream_iface;
382}
383
384/*************************************************************************
385 * SHCreateStreamOnFileEx [SHLWAPI.@]
386 *
387 * Create a stream on a file.
388 *
389 * PARAMS
390 * lpszPath [I] Path of file to create stream on
391 * dwMode [I] Mode to create stream in
392 * dwAttributes [I] Attributes of the file
393 * bCreate [I] Whether to create the file if it doesn't exist
394 * lpTemplate [I] Reserved, must be NULL
395 * lppStream [O] Destination for created stream
396 *
397 * RETURNS
398 * Success: S_OK. lppStream contains the new stream object
399 * Failure: E_INVALIDARG if any parameter is invalid, or an HRESULT error code
400 *
401 * NOTES
402 * This function is available in Unicode only.
403 */
406 IStream *lpTemplate, IStream **lppStream)
407{
408 DWORD dwAccess, dwShare, dwCreate;
410
411 TRACE("(%s,%d,0x%08X,%d,%p,%p)\n", debugstr_w(lpszPath), dwMode,
412 dwAttributes, bCreate, lpTemplate, lppStream);
413
414 if (!lpszPath || !lppStream || lpTemplate)
415 return E_INVALIDARG;
416
417 *lppStream = NULL;
418
419 /* Access */
420 switch (STGM_ACCESS_MODE(dwMode))
421 {
422 case STGM_WRITE:
423 case STGM_READWRITE:
424 dwAccess = GENERIC_READ|GENERIC_WRITE;
425 break;
426 case STGM_READ:
427 dwAccess = GENERIC_READ;
428 break;
429 default:
430 return E_INVALIDARG;
431 }
432
433 /* Sharing */
434 switch (STGM_SHARE_MODE(dwMode))
435 {
436 case 0:
439 break;
441 dwShare = FILE_SHARE_WRITE;
442 break;
444 dwShare = FILE_SHARE_READ;
445 break;
447 dwShare = 0;
448 break;
449 default:
450 return E_INVALIDARG;
451 }
452
453 switch(STGM_CREATE_MODE(dwMode))
454 {
455 case STGM_FAILIFTHERE:
456 dwCreate = bCreate ? CREATE_NEW : OPEN_EXISTING;
457 break;
458 case STGM_CREATE:
459 dwCreate = CREATE_ALWAYS;
460 break;
461 default:
462 return E_INVALIDARG;
463 }
464
465 /* Open HANDLE to file */
466 hFile = CreateFileW(lpszPath, dwAccess, dwShare, NULL, dwCreate,
467 dwAttributes, 0);
468
471
472 *lppStream = IStream_Create(lpszPath, hFile, dwMode);
473
474 if(!*lppStream)
475 {
477 return E_OUTOFMEMORY;
478 }
479 return S_OK;
480}
481
482/*************************************************************************
483 * SHCreateStreamOnFileW [SHLWAPI.@]
484 *
485 * See SHCreateStreamOnFileA.
486 */
488 IStream **lppStream)
489{
490 TRACE("(%s,%d,%p)\n", debugstr_w(lpszPath), dwMode, lppStream);
491
492 if (!lpszPath || !lppStream)
493 return E_INVALIDARG;
494
496 return E_INVALIDARG;
497
498 return SHCreateStreamOnFileEx(lpszPath, dwMode, 0, FALSE, NULL, lppStream);
499}
500
501/*************************************************************************
502 * SHCreateStreamOnFileA [SHLWAPI.@]
503 *
504 * Create a stream on a file.
505 *
506 * PARAMS
507 * lpszPath [I] Path of file to create stream on
508 * dwMode [I] Mode to create stream in
509 * lppStream [O] Destination for created IStream object
510 *
511 * RETURNS
512 * Success: S_OK. lppStream contains the new IStream object
513 * Failure: E_INVALIDARG if any parameter is invalid, or an HRESULT error code
514 */
516 IStream **lppStream)
517{
519
520 TRACE("(%s,%d,%p)\n", debugstr_a(lpszPath), dwMode, lppStream);
521
522 if (!lpszPath)
524
525 MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, szPath, MAX_PATH);
526 return SHCreateStreamOnFileW(szPath, dwMode, lppStream);
527}
528
529/*************************************************************************
530 * @ [SHLWAPI.184]
531 *
532 * Call IStream_Read() on a stream.
533 *
534 * PARAMS
535 * lpStream [I] IStream object
536 * lpvDest [O] Destination for data read
537 * ulSize [I] Size of data to read
538 *
539 * RETURNS
540 * Success: S_OK. ulSize bytes have been read from the stream into lpvDest.
541 * Failure: An HRESULT error code, or E_FAIL if the read succeeded but the
542 * number of bytes read does not match.
543 */
544HRESULT WINAPI SHIStream_Read(IStream *lpStream, LPVOID lpvDest, ULONG ulSize)
545{
546 ULONG ulRead;
547 HRESULT hRet;
548
549 TRACE("(%p,%p,%d)\n", lpStream, lpvDest, ulSize);
550
551 hRet = IStream_Read(lpStream, lpvDest, ulSize, &ulRead);
552
553 if (SUCCEEDED(hRet) && ulRead != ulSize)
554 hRet = E_FAIL;
555 return hRet;
556}
557
558/*************************************************************************
559 * @ [SHLWAPI.166]
560 *
561 * Determine if a stream has 0 length.
562 *
563 * PARAMS
564 * lpStream [I] IStream object
565 *
566 * RETURNS
567 * TRUE: If the stream has 0 length
568 * FALSE: Otherwise.
569 */
571{
572 STATSTG statstg;
573 BOOL bRet = TRUE;
574
575 TRACE("(%p)\n", lpStream);
576
577 memset(&statstg, 0, sizeof(statstg));
578
579 if(SUCCEEDED(IStream_Stat(lpStream, &statstg, 1)))
580 {
581 if(statstg.cbSize.QuadPart)
582 bRet = FALSE; /* Non-Zero */
583 }
584 else
585 {
586 DWORD dwDummy;
587
588 /* Try to read from the stream */
589 if(SUCCEEDED(SHIStream_Read(lpStream, &dwDummy, sizeof(dwDummy))))
590 {
592 zero.QuadPart = 0;
593
594 IStream_Seek(lpStream, zero, 0, NULL);
595 bRet = FALSE; /* Non-Zero */
596 }
597 }
598 return bRet;
599}
600
601/*************************************************************************
602 * @ [SHLWAPI.212]
603 *
604 * Call IStream_Write() on a stream.
605 *
606 * PARAMS
607 * lpStream [I] IStream object
608 * lpvSrc [I] Source for data to write
609 * ulSize [I] Size of data
610 *
611 * RETURNS
612 * Success: S_OK. ulSize bytes have been written to the stream from lpvSrc.
613 * Failure: An HRESULT error code, or E_FAIL if the write succeeded but the
614 * number of bytes written does not match.
615 */
617{
618 ULONG ulWritten;
619 HRESULT hRet;
620
621 TRACE("(%p,%p,%d)\n", lpStream, lpvSrc, ulSize);
622
623 hRet = IStream_Write(lpStream, lpvSrc, ulSize, &ulWritten);
624
625 if (SUCCEEDED(hRet) && ulWritten != ulSize)
626 hRet = E_FAIL;
627
628 return hRet;
629}
630
631/*************************************************************************
632 * @ [SHLWAPI.213]
633 *
634 * Seek to the start of a stream.
635 *
636 * PARAMS
637 * lpStream [I] IStream object
638 *
639 * RETURNS
640 * Success: S_OK. The current position within the stream is updated
641 * Failure: An HRESULT error code.
642 */
644{
646 TRACE("(%p)\n", lpStream);
647 zero.QuadPart = 0;
648 return IStream_Seek(lpStream, zero, 0, NULL);
649}
650
651/*************************************************************************
652 * @ [SHLWAPI.214]
653 *
654 * Get the size of a stream.
655 *
656 * PARAMS
657 * lpStream [I] IStream object
658 * lpulSize [O] Destination for size
659 *
660 * RETURNS
661 * Success: S_OK. lpulSize contains the size of the stream.
662 * Failure: An HRESULT error code.
663 */
665{
666 STATSTG statstg;
667 HRESULT hRet;
668
669 TRACE("(%p,%p)\n", lpStream, lpulSize);
670
671 memset(&statstg, 0, sizeof(statstg));
672
673 hRet = IStream_Stat(lpStream, &statstg, 1);
674
675 if (SUCCEEDED(hRet) && lpulSize)
676 *lpulSize = statstg.cbSize;
677 return hRet;
678}
679
680#ifdef __REACTOS__
681/*************************************************************************
682 * IStream_ReadPidl [SHLWAPI.512]
683 *
684 * https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/util/istream/readpidl.htm
685 */
688{
689 LPITEMIDLIST pidl, pidlEnd;
690 LPSHITEMID pItem;
691 UINT cbSize;
692 HRESULT hr;
693
694 *ppidlOut = NULL;
695
696 hr = SHIStream_Read(pstm, &cbSize, sizeof(cbSize));
697 if (FAILED(hr))
698 return hr;
699
700 if (cbSize < sizeof(USHORT))
701 return E_INVALIDARG;
702
703 pidl = CoTaskMemAlloc(cbSize);
704 if (!pidl)
705 return E_OUTOFMEMORY;
706
707 hr = SHIStream_Read(pstm, pidl, cbSize);
708 if (FAILED(hr))
709 {
710 CoTaskMemFree(pidl);
711 return hr;
712 }
713
714 /* Validate that the PIDL is well-formed */
715 pidlEnd = (LPITEMIDLIST)((PBYTE)pidl + cbSize - sizeof(USHORT));
716 for (pItem = &pidl->mkid; pItem <= (LPSHITEMID)pidlEnd;
717 pItem = (LPSHITEMID)((PBYTE)pItem + pItem->cb))
718 {
719 if (!pItem->cb)
720 break;
721 }
722
723 if ((LPITEMIDLIST)pItem == pidlEnd && !pItem->cb)
724 {
725 *ppidlOut = pidl;
726 hr = S_OK;
727 }
728 else
729 {
730 CoTaskMemFree(pidl);
732 }
733
734 return hr;
735}
736
737/*************************************************************************
738 * IStream_WritePidl [SHLWAPI.513]
739 *
740 * https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/util/istream/writepidl.htm
741 */
744{
745 UINT cbSize = ILGetSize(pidlWrite);
746 HRESULT hr = SHIStream_Write(pstm, &cbSize, sizeof(cbSize));
747 if (FAILED(hr))
748 return hr;
749 return SHIStream_Write(pstm, pidlWrite, cbSize);
750}
751#endif /* def __REACTOS__ */
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:573
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define FILE_BEGIN
Definition: compat.h:761
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:442
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:988
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
WCHAR *WINAPI StrDupW(const WCHAR *str)
Definition: string.c:313
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
static HRESULT WINAPI IStream_fnSetSize(IStream *iface, ULARGE_INTEGER libNewSize)
Definition: istream.c:193
HRESULT WINAPI IStream_Size(IStream *lpStream, ULARGE_INTEGER *lpulSize)
Definition: istream.c:664
static const IStreamVtbl SHLWAPI_fsVTable
Definition: istream.c:342
static IStream * IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode)
Definition: istream.c:365
static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
Definition: istream.c:212
#define STGM_CREATE_MODE(stgm)
Definition: istream.c:42
static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj)
Definition: istream.c:67
static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG *lpStat, DWORD grfStatFlag)
Definition: istream.c:296
HRESULT WINAPI IStream_Reset(IStream *lpStream)
Definition: istream.c:643
static HRESULT WINAPI IStream_fnWrite(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
Definition: istream.c:142
HRESULT WINAPI SHCreateStreamOnFileA(LPCSTR lpszPath, DWORD dwMode, IStream **lppStream)
Definition: istream.c:515
static ULONG WINAPI IStream_fnRelease(IStream *iface)
Definition: istream.c:101
BOOL WINAPI SHIsEmptyStream(IStream *lpStream)
Definition: istream.c:570
static HRESULT WINAPI IStream_fnCommit(IStream *, DWORD)
Definition: istream.c:262
#define STGM_SHARE_MODE(stgm)
Definition: istream.c:41
static HRESULT WINAPI IStream_fnRevert(IStream *iface)
Definition: istream.c:274
static HRESULT WINAPI IStream_fnSeek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *pNewPos)
Definition: istream.c:169
static HRESULT WINAPI IStream_fnLockUnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: istream.c:285
HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, DWORD dwAttributes, BOOL bCreate, IStream *lpTemplate, IStream **lppStream)
Definition: istream.c:404
#define STGM_ACCESS_MODE(stgm)
Definition: istream.c:40
HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode, IStream **lppStream)
Definition: istream.c:487
HRESULT WINAPI SHIStream_Write(IStream *lpStream, LPCVOID lpvSrc, ULONG ulSize)
Definition: istream.c:616
static HRESULT WINAPI IStream_fnRead(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: istream.c:122
HRESULT WINAPI SHIStream_Read(IStream *lpStream, LPVOID lpvDest, ULONG ulSize)
Definition: istream.c:544
static HRESULT WINAPI IStream_fnClone(IStream *iface, IStream **ppstm)
Definition: istream.c:332
static ISHFileStream * impl_from_IStream(IStream *iface)
Definition: istream.c:56
static ULONG WINAPI IStream_fnAddRef(IStream *iface)
Definition: istream.c:88
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
CONST void * LPCVOID
Definition: minwindef.h:164
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
LPCWSTR szPath
Definition: env.c:37
static BSTR *static LPOLESTR
Definition: varformat.c:44
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
#define STGM_CREATE
Definition: objbase.h:945
#define STGM_SHARE_DENY_NONE
Definition: objbase.h:939
#define STGM_CONVERT
Definition: objbase.h:946
#define STGM_READWRITE
Definition: objbase.h:938
#define STGM_TRANSACTED
Definition: objbase.h:934
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:942
#define STGM_FAILIFTHERE
Definition: objbase.h:947
#define STGM_DELETEONRELEASE
Definition: objbase.h:944
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:941
#define STGM_WRITE
Definition: objbase.h:937
#define STGM_READ
Definition: objbase.h:936
#define STGM_SHARE_DENY_READ
Definition: objbase.h:940
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
UINT WINAPI ILGetSize(LPCITEMIDLIST pidl)
Definition: pidl.c:941
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define memset(x, y, z)
Definition: compat.h:39
int zero
Definition: sehframes.cpp:29
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1527
HRESULT WINAPI IStream_WritePidl(_In_ IStream *pstm, _In_ LPCITEMIDLIST pidlWrite)
HRESULT WINAPI IStream_ReadPidl(_In_ IStream *pstm, _Out_ LPITEMIDLIST *ppidlOut)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
struct SHITEMID * LPSHITEMID
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define TRACE(s)
Definition: solgame.cpp:4
DWORD type
Definition: istream.c:52
DWORD grfStateBits
Definition: istream.c:53
HANDLE hFile
Definition: istream.c:49
LPOLESTR lpszPath
Definition: istream.c:51
LONG ref
Definition: istream.c:48
DWORD dwMode
Definition: istream.c:50
IStream IStream_iface
Definition: istream.c:47
WORD cb
Definition: shtypes.idl:27
struct _ULARGE_INTEGER::@4610 u
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint64_t ULONGLONG
Definition: typedefs.h:67
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
struct _LARGE_INTEGER::@2500 u
DWORD dwAttributes
Definition: vdmdbg.h:34
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define STG_E_INVALIDPOINTER
Definition: winerror.h:3666
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOINTERFACE
Definition: winerror.h:3479
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define STG_E_ACCESSDENIED
Definition: winerror.h:3663