ReactOS  0.4.13-dev-651-g5dbc677
stg_prop.c File Reference
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "dictionary.h"
#include "storage32.h"
#include "enumx.h"
#include "oleauto.h"
Include dependency graph for stg_prop.c:

Go to the source code of this file.

Classes

struct  tagPROPERTYSETHEADER
 
struct  tagFORMATIDOFFSET
 
struct  tagPROPERTYSECTIONHEADER
 
struct  tagPROPERTYIDOFFSET
 
struct  tagPropertyStorage_impl
 
struct  DictionaryClosure
 
struct  PropertyClosure
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define PROPSETHDR_BYTEORDER_MAGIC   0xfffe
 
#define PROPSETHDR_OSVER_KIND_WIN16   0
 
#define PROPSETHDR_OSVER_KIND_MAC   1
 
#define PROPSETHDR_OSVER_KIND_WIN32   2
 
#define CP_UNICODE   1200
 
#define MAX_VERSION_0_PROP_NAME_LENGTH   256
 
#define CFTAG_WINDOWS   (-1L)
 
#define CFTAG_MACINTOSH   (-2L)
 
#define CFTAG_FMTID   (-3L)
 
#define CFTAG_NODATA   0L
 
#define PropertyStorage_ByteSwapString(s, l)
 
#define __thiscall_wrapper   __cdecl
 
#define SECTIONHEADER_OFFSET   sizeof(PROPERTYSETHEADER) + sizeof(FORMATIDOFFSET)
 
#define BITS_PER_BYTE   8
 
#define CHARMASK   0x1f
 
#define BITS_IN_CHARMASK   5
 
#define NUM_ALPHA_CHARS   26
 

Typedefs

typedef struct tagPROPERTYSETHEADER PROPERTYSETHEADER
 
typedef struct tagFORMATIDOFFSET FORMATIDOFFSET
 
typedef struct tagPROPERTYSECTIONHEADER PROPERTYSECTIONHEADER
 
typedef struct tagPROPERTYIDOFFSET PROPERTYIDOFFSET
 
typedef struct tagPropertyStorage_impl PropertyStorage_impl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (storage)
 
static StorageImplimpl_from_IPropertySetStorage (IPropertySetStorage *iface)
 
static HRESULT PropertyStorage_ReadFromStream (PropertyStorage_impl *)
 
static HRESULT PropertyStorage_WriteToStream (PropertyStorage_impl *)
 
static HRESULT PropertyStorage_CreateDictionaries (PropertyStorage_impl *)
 
static void PropertyStorage_DestroyDictionaries (PropertyStorage_impl *)
 
static HRESULT PropertyStorage_PropVariantCopy (PROPVARIANT *prop, const PROPVARIANT *propvar, LCID targetCP, LCID srcCP)
 
static HRESULT PropertyStorage_StringCopy (LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
 
static HRESULT create_EnumSTATPROPSETSTG (StorageImpl *, IEnumSTATPROPSETSTG **)
 
static HRESULT create_EnumSTATPROPSTG (PropertyStorage_impl *, IEnumSTATPROPSTG **)
 
static PropertyStorage_implimpl_from_IPropertyStorage (IPropertyStorage *iface)
 
static HRESULT WINAPI IPropertyStorage_fnQueryInterface (IPropertyStorage *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IPropertyStorage_fnAddRef (IPropertyStorage *iface)
 
static ULONG WINAPI IPropertyStorage_fnRelease (IPropertyStorage *iface)
 
static PROPVARIANT * PropertyStorage_FindProperty (PropertyStorage_impl *This, DWORD propid)
 
static PROPVARIANT * PropertyStorage_FindPropertyByName (PropertyStorage_impl *This, LPCWSTR name)
 
static LPWSTR PropertyStorage_FindPropertyNameById (PropertyStorage_impl *This, DWORD propid)
 
static HRESULT WINAPI IPropertyStorage_fnReadMultiple (IPropertyStorage *iface, ULONG cpspec, const PROPSPEC rgpspec[], PROPVARIANT rgpropvar[])
 
static HRESULT PropertyStorage_StorePropWithId (PropertyStorage_impl *This, PROPID propid, const PROPVARIANT *propvar, LCID lcid)
 
static HRESULT PropertyStorage_StoreNameWithId (PropertyStorage_impl *This, LPCSTR srcName, LCID cp, PROPID id)
 
static HRESULT WINAPI IPropertyStorage_fnWriteMultiple (IPropertyStorage *iface, ULONG cpspec, const PROPSPEC rgpspec[], const PROPVARIANT rgpropvar[], PROPID propidNameFirst)
 
static HRESULT WINAPI IPropertyStorage_fnDeleteMultiple (IPropertyStorage *iface, ULONG cpspec, const PROPSPEC rgpspec[])
 
static HRESULT WINAPI IPropertyStorage_fnReadPropertyNames (IPropertyStorage *iface, ULONG cpropid, const PROPID rgpropid[], LPOLESTR rglpwstrName[])
 
static HRESULT WINAPI IPropertyStorage_fnWritePropertyNames (IPropertyStorage *iface, ULONG cpropid, const PROPID rgpropid[], const LPOLESTR rglpwstrName[])
 
static HRESULT WINAPI IPropertyStorage_fnDeletePropertyNames (IPropertyStorage *iface, ULONG cpropid, const PROPID rgpropid[])
 
static HRESULT WINAPI IPropertyStorage_fnCommit (IPropertyStorage *iface, DWORD grfCommitFlags)
 
static HRESULT WINAPI IPropertyStorage_fnRevert (IPropertyStorage *iface)
 
static HRESULT WINAPI IPropertyStorage_fnEnum (IPropertyStorage *iface, IEnumSTATPROPSTG **ppenum)
 
static HRESULT WINAPI IPropertyStorage_fnSetTimes (IPropertyStorage *iface, const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime)
 
static HRESULT WINAPI IPropertyStorage_fnSetClass (IPropertyStorage *iface, REFCLSID clsid)
 
static HRESULT WINAPI IPropertyStorage_fnStat (IPropertyStorage *iface, STATPROPSETSTG *statpsstg)
 
static int PropertyStorage_PropNameCompare (const void *a, const void *b, void *extra)
 
static void PropertyStorage_PropNameDestroy (void *k, void *d, void *extra)
 
static int PropertyStorage_PropCompare (const void *a, const void *b, void *extra)
 
static void PropertyStorage_PropertyDestroy (void *k, void *d, void *extra)
 
static HRESULT PropertyStorage_ReadDictionary (PropertyStorage_impl *This, BYTE *ptr)
 
static void *__thiscall_wrapper Allocate_CoTaskMemAlloc (void *this, ULONG size)
 
static HRESULT PropertyStorage_ReadProperty (PROPVARIANT *prop, const BYTE *data, UINT codepage, void *(__thiscall_wrapper *allocate)(void *this, ULONG size), void *allocate_data)
 
static HRESULT PropertyStorage_ReadHeaderFromStream (IStream *stm, PROPERTYSETHEADER *hdr)
 
static HRESULT PropertyStorage_ReadFmtIdOffsetFromStream (IStream *stm, FORMATIDOFFSET *fmt)
 
static HRESULT PropertyStorage_ReadSectionHeaderFromStream (IStream *stm, PROPERTYSECTIONHEADER *hdr)
 
static void PropertyStorage_MakeHeader (PropertyStorage_impl *This, PROPERTYSETHEADER *hdr)
 
static void PropertyStorage_MakeFmtIdOffset (PropertyStorage_impl *This, FORMATIDOFFSET *fmtOffset)
 
static void PropertyStorage_MakeSectionHdr (DWORD cbSection, DWORD numProps, PROPERTYSECTIONHEADER *hdr)
 
static void PropertyStorage_MakePropertyIdOffset (DWORD propid, DWORD dwOffset, PROPERTYIDOFFSET *propIdOffset)
 
static HRESULT PropertStorage_WriteWStringToStream (IStream *stm, LPCWSTR str, DWORD len, DWORD *written)
 
static BOOL PropertyStorage_DictionaryWriter (const void *key, const void *value, void *extra, void *closure)
 
static HRESULT PropertyStorage_WriteDictionaryToStream (PropertyStorage_impl *This, DWORD *sectionOffset)
 
static HRESULT PropertyStorage_WritePropertyToStream (PropertyStorage_impl *This, DWORD propNum, DWORD propid, const PROPVARIANT *var, DWORD *sectionOffset)
 
static BOOL PropertyStorage_PropertiesWriter (const void *key, const void *value, void *extra, void *closure)
 
static HRESULT PropertyStorage_WritePropertiesToStream (PropertyStorage_impl *This, DWORD startingPropNum, DWORD *sectionOffset)
 
static HRESULT PropertyStorage_WriteHeadersToStream (PropertyStorage_impl *This)
 
static HRESULT PropertyStorage_BaseConstruct (IStream *stm, REFFMTID rfmtid, DWORD grfMode, PropertyStorage_impl **pps)
 
static HRESULT PropertyStorage_ConstructFromStream (IStream *stm, REFFMTID rfmtid, DWORD grfMode, IPropertyStorage **pps)
 
static HRESULT PropertyStorage_ConstructEmpty (IStream *stm, REFFMTID rfmtid, DWORD grfFlags, DWORD grfMode, IPropertyStorage **pps)
 
static HRESULT WINAPI IPropertySetStorage_fnQueryInterface (IPropertySetStorage *ppstg, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IPropertySetStorage_fnAddRef (IPropertySetStorage *ppstg)
 
static ULONG WINAPI IPropertySetStorage_fnRelease (IPropertySetStorage *ppstg)
 
static HRESULT WINAPI IPropertySetStorage_fnCreate (IPropertySetStorage *ppstg, REFFMTID rfmtid, const CLSID *pclsid, DWORD grfFlags, DWORD grfMode, IPropertyStorage **ppprstg)
 
static HRESULT WINAPI IPropertySetStorage_fnOpen (IPropertySetStorage *ppstg, REFFMTID rfmtid, DWORD grfMode, IPropertyStorage **ppprstg)
 
static HRESULT WINAPI IPropertySetStorage_fnDelete (IPropertySetStorage *ppstg, REFFMTID rfmtid)
 
static HRESULT WINAPI IPropertySetStorage_fnEnum (IPropertySetStorage *ppstg, IEnumSTATPROPSETSTG **ppenum)
 
static HRESULT WINAPI IEnumSTATPROPSETSTG_fnQueryInterface (IEnumSTATPROPSETSTG *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IEnumSTATPROPSETSTG_fnAddRef (IEnumSTATPROPSETSTG *iface)
 
static ULONG WINAPI IEnumSTATPROPSETSTG_fnRelease (IEnumSTATPROPSETSTG *iface)
 
static HRESULT WINAPI IEnumSTATPROPSETSTG_fnNext (IEnumSTATPROPSETSTG *iface, ULONG celt, STATPROPSETSTG *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI IEnumSTATPROPSETSTG_fnSkip (IEnumSTATPROPSETSTG *iface, ULONG celt)
 
static HRESULT WINAPI IEnumSTATPROPSETSTG_fnReset (IEnumSTATPROPSETSTG *iface)
 
static HRESULT WINAPI IEnumSTATPROPSETSTG_fnClone (IEnumSTATPROPSETSTG *iface, IEnumSTATPROPSETSTG **ppenum)
 
static HRESULT WINAPI IEnumSTATPROPSTG_fnQueryInterface (IEnumSTATPROPSTG *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IEnumSTATPROPSTG_fnAddRef (IEnumSTATPROPSTG *iface)
 
static ULONG WINAPI IEnumSTATPROPSTG_fnRelease (IEnumSTATPROPSTG *iface)
 
static HRESULT WINAPI IEnumSTATPROPSTG_fnNext (IEnumSTATPROPSTG *iface, ULONG celt, STATPROPSTG *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI IEnumSTATPROPSTG_fnSkip (IEnumSTATPROPSTG *iface, ULONG celt)
 
static HRESULT WINAPI IEnumSTATPROPSTG_fnReset (IEnumSTATPROPSTG *iface)
 
static HRESULT WINAPI IEnumSTATPROPSTG_fnClone (IEnumSTATPROPSTG *iface, IEnumSTATPROPSTG **ppenum)
 
static void prop_enum_copy_cb (IUnknown *parent, void *orig, void *dest)
 
static BOOL prop_enum_stat (const void *k, const void *v, void *extra, void *arg)
 
HRESULT WINAPI FmtIdToPropStgName (const FMTID *rfmtid, LPOLESTR str)
 
HRESULT WINAPI PropStgNameToFmtId (const LPOLESTR str, FMTID *rfmtid)
 
static void *__cdecl Allocate_PMemoryAllocator (void *this, ULONG cbSize)
 
BOOLEAN WINAPI StgConvertPropertyToVariant (const SERIALIZEDPROPERTYVALUE *prop, USHORT CodePage, PROPVARIANT *pvar, void *pma)
 
SERIALIZEDPROPERTYVALUE *WINAPI StgConvertVariantToProperty (const PROPVARIANT *pvar, USHORT CodePage, SERIALIZEDPROPERTYVALUE *pprop, ULONG *pcb, PROPID pid, BOOLEAN fReserved, ULONG *pcIndirect)
 
HRESULT WINAPI StgCreatePropStg (IUnknown *unk, REFFMTID fmt, const CLSID *clsid, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
 
HRESULT WINAPI StgOpenPropStg (IUnknown *unk, REFFMTID fmt, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
 

Variables

static const IPropertyStorageVtbl IPropertyStorage_Vtbl
 
static const IEnumSTATPROPSETSTGVtbl IEnumSTATPROPSETSTG_Vtbl
 
static const IEnumSTATPROPSTGVtbl IEnumSTATPROPSTG_Vtbl
 
const IPropertySetStorageVtbl IPropertySetStorage_Vtbl
 
static const WCHAR szSummaryInfo []
 
static const WCHAR szDocSummaryInfo []
 

Macro Definition Documentation

◆ __thiscall_wrapper

#define __thiscall_wrapper   __cdecl

Definition at line 1046 of file stg_prop.c.

◆ BITS_IN_CHARMASK

#define BITS_IN_CHARMASK   5

Definition at line 2626 of file stg_prop.c.

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   8

Definition at line 2624 of file stg_prop.c.

◆ CFTAG_FMTID

#define CFTAG_FMTID   (-3L)

Definition at line 87 of file stg_prop.c.

◆ CFTAG_MACINTOSH

#define CFTAG_MACINTOSH   (-2L)

Definition at line 86 of file stg_prop.c.

◆ CFTAG_NODATA

#define CFTAG_NODATA   0L

Definition at line 88 of file stg_prop.c.

◆ CFTAG_WINDOWS

#define CFTAG_WINDOWS   (-1L)

Definition at line 85 of file stg_prop.c.

◆ CHARMASK

#define CHARMASK   0x1f

Definition at line 2625 of file stg_prop.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 48 of file stg_prop.c.

◆ CP_UNICODE

#define CP_UNICODE   1200

Definition at line 81 of file stg_prop.c.

◆ MAX_VERSION_0_PROP_NAME_LENGTH

#define MAX_VERSION_0_PROP_NAME_LENGTH   256

Definition at line 83 of file stg_prop.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 49 of file stg_prop.c.

◆ NUM_ALPHA_CHARS

#define NUM_ALPHA_CHARS   26

Definition at line 2627 of file stg_prop.c.

◆ PropertyStorage_ByteSwapString

#define PropertyStorage_ByteSwapString (   s,
  l 
)

Definition at line 993 of file stg_prop.c.

◆ PROPSETHDR_BYTEORDER_MAGIC

#define PROPSETHDR_BYTEORDER_MAGIC   0xfffe

Definition at line 76 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_MAC

#define PROPSETHDR_OSVER_KIND_MAC   1

Definition at line 78 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_WIN16

#define PROPSETHDR_OSVER_KIND_WIN16   0

Definition at line 77 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_WIN32

#define PROPSETHDR_OSVER_KIND_WIN32   2

Definition at line 79 of file stg_prop.c.

◆ SECTIONHEADER_OFFSET

#define SECTIONHEADER_OFFSET   sizeof(PROPERTYSETHEADER) + sizeof(FORMATIDOFFSET)

Definition at line 1656 of file stg_prop.c.

Typedef Documentation

◆ FORMATIDOFFSET

◆ PROPERTYIDOFFSET

◆ PROPERTYSECTIONHEADER

◆ PROPERTYSETHEADER

◆ PropertyStorage_impl

Definition at line 117 of file stg_prop.c.

Function Documentation

◆ Allocate_CoTaskMemAlloc()

static void* __thiscall_wrapper Allocate_CoTaskMemAlloc ( void this,
ULONG  size 
)
static

Definition at line 1049 of file stg_prop.c.

1050 {
1051  return CoTaskMemAlloc(size);
1052 }
GLsizeiptr size
Definition: glext.h:5919
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by PropertyStorage_ReadFromStream().

◆ Allocate_PMemoryAllocator()

static void* __cdecl Allocate_PMemoryAllocator ( void this,
ULONG  cbSize 
)
static

Definition at line 2794 of file stg_prop.c.

2795 {
2796  void* (__cdecl *fn)(void*,ULONG) = **(void***)this;
2797  return fn(this, cbSize);
2798 }
#define __cdecl
Definition: accygwin.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
unsigned int ULONG
Definition: retypes.h:1

Referenced by StgConvertPropertyToVariant().

◆ create_EnumSTATPROPSETSTG()

static HRESULT create_EnumSTATPROPSETSTG ( StorageImpl This,
IEnumSTATPROPSETSTG **  ppenum 
)
static

Definition at line 2392 of file stg_prop.c.

2395 {
2396  IStorage *stg = &This->base.IStorage_iface;
2397  IEnumSTATSTG *penum = NULL;
2398  STATSTG stat;
2399  ULONG count;
2400  HRESULT r;
2401  STATPROPSETSTG statpss;
2402  enumx_impl *enumx;
2403 
2404  TRACE("%p %p\n", This, ppenum);
2405 
2406  enumx = enumx_allocate(&IID_IEnumSTATPROPSETSTG,
2408  sizeof (STATPROPSETSTG),
2409  (IUnknown*)&This->base.IStorage_iface,
2410  NULL);
2411 
2412  /* add all the property set elements into a list */
2413  r = IStorage_EnumElements(stg, 0, NULL, 0, &penum);
2414  if (FAILED(r))
2415  {
2416  enumx_Release(enumx);
2417  return E_OUTOFMEMORY;
2418  }
2419 
2420  while (1)
2421  {
2422  count = 0;
2423  r = IEnumSTATSTG_Next(penum, 1, &stat, &count);
2424  if (FAILED(r))
2425  break;
2426  if (!count)
2427  break;
2428  if (!stat.pwcsName)
2429  continue;
2430  if (stat.pwcsName[0] == 5 && stat.type == STGTY_STREAM)
2431  {
2432  PropStgNameToFmtId(stat.pwcsName, &statpss.fmtid);
2433  TRACE("adding %s (%s)\n", debugstr_w(stat.pwcsName),
2434  debugstr_guid(&statpss.fmtid));
2435  statpss.mtime = stat.mtime;
2436  statpss.atime = stat.atime;
2437  statpss.ctime = stat.ctime;
2438  statpss.grfFlags = stat.grfMode;
2439  statpss.clsid = stat.clsid;
2440  enumx_add_element(enumx, &statpss);
2441  }
2442  CoTaskMemFree(stat.pwcsName);
2443  }
2444  IEnumSTATSTG_Release(penum);
2445 
2446  *ppenum = (IEnumSTATPROPSETSTG*) enumx;
2447 
2448  return S_OK;
2449 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
void * enumx_add_element(enumx_impl *enumx, const void *data)
Definition: enumx.c:207
static const IEnumSTATPROPSETSTGVtbl IEnumSTATPROPSETSTG_Vtbl
Definition: stg_prop.c:152
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI PropStgNameToFmtId(const LPOLESTR str, FMTID *rfmtid)
Definition: stg_prop.c:2707
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
enumx_impl * enumx_allocate(REFIID riid, const void *vtbl, ULONG elem_size, IUnknown *parent, enumx_copy_cb copy_cb)
Definition: enumx.c:178
Definition: stat.h:55
ULONG WINAPI enumx_Release(enumx_impl *This)
Definition: enumx.c:83
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1

Referenced by IPropertySetStorage_fnEnum().

◆ create_EnumSTATPROPSTG()

static HRESULT create_EnumSTATPROPSTG ( PropertyStorage_impl This,
IEnumSTATPROPSTG **  ppenum 
)
static

Definition at line 2540 of file stg_prop.c.

2543 {
2544  enumx_impl *enumx;
2545 
2546  TRACE("%p %p\n", This, ppenum);
2547 
2548  enumx = enumx_allocate(&IID_IEnumSTATPROPSTG,
2550  sizeof (STATPROPSTG),
2551  (IUnknown*)&This->IPropertyStorage_iface,
2553 
2554  dictionary_enumerate(This->propid_to_prop, prop_enum_stat, enumx);
2555 
2556  *ppenum = (IEnumSTATPROPSTG*) enumx;
2557 
2558  return S_OK;
2559 }
void dictionary_enumerate(struct dictionary *d, enumeratefunc e, void *closure)
Definition: dictionary.c:179
static const IEnumSTATPROPSTGVtbl IEnumSTATPROPSTG_Vtbl
Definition: stg_prop.c:153
#define TRACE(s)
Definition: solgame.cpp:4
enumx_impl * enumx_allocate(REFIID riid, const void *vtbl, ULONG elem_size, IUnknown *parent, enumx_copy_cb copy_cb)
Definition: enumx.c:178
#define S_OK
Definition: intsafe.h:59
static void prop_enum_copy_cb(IUnknown *parent, void *orig, void *dest)
Definition: stg_prop.c:2503
static BOOL prop_enum_stat(const void *k, const void *v, void *extra, void *arg)
Definition: stg_prop.c:2524

Referenced by IPropertyStorage_fnEnum().

◆ FmtIdToPropStgName()

HRESULT WINAPI FmtIdToPropStgName ( const FMTID rfmtid,
LPOLESTR  str 
)

Definition at line 2642 of file stg_prop.c.

2643 {
2644  static const char fmtMap[] = "abcdefghijklmnopqrstuvwxyz012345";
2645 
2646  TRACE("%s, %p\n", debugstr_guid(rfmtid), str);
2647 
2648  if (!rfmtid) return E_INVALIDARG;
2649  if (!str) return E_INVALIDARG;
2650 
2651  if (IsEqualGUID(&FMTID_SummaryInformation, rfmtid))
2653  else if (IsEqualGUID(&FMTID_DocSummaryInformation, rfmtid))
2655  else if (IsEqualGUID(&FMTID_UserDefinedProperties, rfmtid))
2657  else
2658  {
2659  const BYTE *fmtptr;
2660  WCHAR *pstr = str;
2661  ULONG bitsRemaining = BITS_PER_BYTE;
2662 
2663  *pstr++ = 5;
2664  for (fmtptr = (const BYTE *)rfmtid; fmtptr < (const BYTE *)rfmtid + sizeof(FMTID); )
2665  {
2666  ULONG i = *fmtptr >> (BITS_PER_BYTE - bitsRemaining);
2667 
2668  if (bitsRemaining >= BITS_IN_CHARMASK)
2669  {
2670  *pstr = (WCHAR)(fmtMap[i & CHARMASK]);
2671  if (bitsRemaining == BITS_PER_BYTE && *pstr >= 'a' &&
2672  *pstr <= 'z')
2673  *pstr += 'A' - 'a';
2674  pstr++;
2675  bitsRemaining -= BITS_IN_CHARMASK;
2676  if (bitsRemaining == 0)
2677  {
2678  fmtptr++;
2679  bitsRemaining = BITS_PER_BYTE;
2680  }
2681  }
2682  else
2683  {
2684  if (++fmtptr < (const BYTE *)rfmtid + sizeof(FMTID))
2685  i |= *fmtptr << bitsRemaining;
2686  *pstr++ = (WCHAR)(fmtMap[i & CHARMASK]);
2687  bitsRemaining += BITS_PER_BYTE - BITS_IN_CHARMASK;
2688  }
2689  }
2690  *pstr = 0;
2691  }
2692  TRACE("returning %s\n", debugstr_w(str));
2693  return S_OK;
2694 }
GUID FMTID
Definition: guiddef.h:89
#define CHARMASK
Definition: stg_prop.c:2625
const FMTID FMTID_UserDefinedProperties
const FMTID FMTID_SummaryInformation
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BITS_IN_CHARMASK
Definition: stg_prop.c:2626
const FMTID FMTID_DocSummaryInformation
unsigned char BYTE
Definition: mem.h:68
static const WCHAR szSummaryInfo[]
Definition: stg_prop.c:2619
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
#define BITS_PER_BYTE
Definition: stg_prop.c:2624
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static const WCHAR szDocSummaryInfo[]
Definition: stg_prop.c:2621
unsigned int ULONG
Definition: retypes.h:1

Referenced by IPropertySetStorage_fnCreate(), IPropertySetStorage_fnDelete(), and IPropertySetStorage_fnOpen().

◆ IEnumSTATPROPSETSTG_fnAddRef()

static ULONG WINAPI IEnumSTATPROPSETSTG_fnAddRef ( IEnumSTATPROPSETSTG *  iface)
static

Definition at line 2351 of file stg_prop.c.

2353 {
2354  return enumx_AddRef((enumx_impl*)iface);
2355 }
ULONG WINAPI enumx_AddRef(enumx_impl *This)
Definition: enumx.c:75

◆ IEnumSTATPROPSETSTG_fnClone()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnClone ( IEnumSTATPROPSETSTG *  iface,
IEnumSTATPROPSETSTG **  ppenum 
)
static

Definition at line 2385 of file stg_prop.c.

2388 {
2389  return enumx_Clone((enumx_impl*)iface, (enumx_impl**)ppenum);
2390 }
HRESULT WINAPI enumx_Clone(enumx_impl *iface, enumx_impl **ppenum)
Definition: enumx.c:165

◆ IEnumSTATPROPSETSTG_fnNext()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnNext ( IEnumSTATPROPSETSTG *  iface,
ULONG  celt,
STATPROPSETSTG *  rgelt,
ULONG pceltFetched 
)
static

Definition at line 2363 of file stg_prop.c.

2368 {
2369  return enumx_Next((enumx_impl*)iface, celt, rgelt, pceltFetched);
2370 }
HRESULT WINAPI enumx_Next(enumx_impl *This, ULONG celt, void *rgelt, ULONG *pceltFetched)
Definition: enumx.c:105

◆ IEnumSTATPROPSETSTG_fnQueryInterface()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnQueryInterface ( IEnumSTATPROPSETSTG *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 2343 of file stg_prop.c.

2347 {
2348  return enumx_QueryInterface((enumx_impl*)iface, riid, ppvObject);
2349 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppvObject
Definition: precomp.h:44
HRESULT WINAPI enumx_QueryInterface(enumx_impl *This, REFIID riid, void **ppvObject)
Definition: enumx.c:51

◆ IEnumSTATPROPSETSTG_fnRelease()

static ULONG WINAPI IEnumSTATPROPSETSTG_fnRelease ( IEnumSTATPROPSETSTG *  iface)
static

Definition at line 2357 of file stg_prop.c.

2359 {
2360  return enumx_Release((enumx_impl*)iface);
2361 }
ULONG WINAPI enumx_Release(enumx_impl *This)
Definition: enumx.c:83

◆ IEnumSTATPROPSETSTG_fnReset()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnReset ( IEnumSTATPROPSETSTG *  iface)
static

Definition at line 2379 of file stg_prop.c.

2381 {
2382  return enumx_Reset((enumx_impl*)iface);
2383 }
HRESULT WINAPI enumx_Reset(enumx_impl *This)
Definition: enumx.c:154

◆ IEnumSTATPROPSETSTG_fnSkip()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnSkip ( IEnumSTATPROPSETSTG *  iface,
ULONG  celt 
)
static

Definition at line 2372 of file stg_prop.c.

2375 {
2376  return enumx_Skip((enumx_impl*)iface, celt);
2377 }
HRESULT WINAPI enumx_Skip(enumx_impl *This, ULONG celt)
Definition: enumx.c:136

◆ IEnumSTATPROPSTG_fnAddRef()

static ULONG WINAPI IEnumSTATPROPSTG_fnAddRef ( IEnumSTATPROPSTG iface)
static

Definition at line 2462 of file stg_prop.c.

2464 {
2465  return enumx_AddRef((enumx_impl*)iface);
2466 }
ULONG WINAPI enumx_AddRef(enumx_impl *This)
Definition: enumx.c:75

◆ IEnumSTATPROPSTG_fnClone()

static HRESULT WINAPI IEnumSTATPROPSTG_fnClone ( IEnumSTATPROPSTG iface,
IEnumSTATPROPSTG **  ppenum 
)
static

Definition at line 2496 of file stg_prop.c.

2499 {
2500  return enumx_Clone((enumx_impl*)iface, (enumx_impl**)ppenum);
2501 }
HRESULT WINAPI enumx_Clone(enumx_impl *iface, enumx_impl **ppenum)
Definition: enumx.c:165

◆ IEnumSTATPROPSTG_fnNext()

static HRESULT WINAPI IEnumSTATPROPSTG_fnNext ( IEnumSTATPROPSTG iface,
ULONG  celt,
STATPROPSTG *  rgelt,
ULONG pceltFetched 
)
static

Definition at line 2474 of file stg_prop.c.

2479 {
2480  return enumx_Next((enumx_impl*)iface, celt, rgelt, pceltFetched);
2481 }
HRESULT WINAPI enumx_Next(enumx_impl *This, ULONG celt, void *rgelt, ULONG *pceltFetched)
Definition: enumx.c:105

◆ IEnumSTATPROPSTG_fnQueryInterface()

static HRESULT WINAPI IEnumSTATPROPSTG_fnQueryInterface ( IEnumSTATPROPSTG iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 2454 of file stg_prop.c.

2458 {
2459  return enumx_QueryInterface((enumx_impl*)iface, riid, ppvObject);
2460 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppvObject
Definition: precomp.h:44
HRESULT WINAPI enumx_QueryInterface(enumx_impl *This, REFIID riid, void **ppvObject)
Definition: enumx.c:51

◆ IEnumSTATPROPSTG_fnRelease()

static ULONG WINAPI IEnumSTATPROPSTG_fnRelease ( IEnumSTATPROPSTG iface)
static

Definition at line 2468 of file stg_prop.c.

2470 {
2471  return enumx_Release((enumx_impl*)iface);
2472 }
ULONG WINAPI enumx_Release(enumx_impl *This)
Definition: enumx.c:83

◆ IEnumSTATPROPSTG_fnReset()

static HRESULT WINAPI IEnumSTATPROPSTG_fnReset ( IEnumSTATPROPSTG iface)
static

Definition at line 2490 of file stg_prop.c.

2492 {
2493  return enumx_Reset((enumx_impl*)iface);
2494 }
HRESULT WINAPI enumx_Reset(enumx_impl *This)
Definition: enumx.c:154

◆ IEnumSTATPROPSTG_fnSkip()

static HRESULT WINAPI IEnumSTATPROPSTG_fnSkip ( IEnumSTATPROPSTG iface,
ULONG  celt 
)
static

Definition at line 2483 of file stg_prop.c.

2486 {
2487  return enumx_Skip((enumx_impl*)iface, celt);
2488 }
HRESULT WINAPI enumx_Skip(enumx_impl *This, ULONG celt)
Definition: enumx.c:136

◆ impl_from_IPropertySetStorage()

static StorageImpl* impl_from_IPropertySetStorage ( IPropertySetStorage iface)
inlinestatic

Definition at line 68 of file stg_prop.c.

69 {
70  return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface);
71 }
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 IPropertySetStorage_fnAddRef(), IPropertySetStorage_fnCreate(), IPropertySetStorage_fnDelete(), IPropertySetStorage_fnEnum(), IPropertySetStorage_fnOpen(), IPropertySetStorage_fnQueryInterface(), and IPropertySetStorage_fnRelease().

◆ impl_from_IPropertyStorage()

static PropertyStorage_impl* impl_from_IPropertyStorage ( IPropertyStorage iface)
inlinestatic

◆ IPropertySetStorage_fnAddRef()

static ULONG WINAPI IPropertySetStorage_fnAddRef ( IPropertySetStorage ppstg)
static

Definition at line 2181 of file stg_prop.c.

2183 {
2185  return IStorage_AddRef( &This->base.IStorage_iface );
2186 }
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68

◆ IPropertySetStorage_fnCreate()

static HRESULT WINAPI IPropertySetStorage_fnCreate ( IPropertySetStorage ppstg,
REFFMTID  rfmtid,
const CLSID pclsid,
DWORD  grfFlags,
DWORD  grfMode,
IPropertyStorage **  ppprstg 
)
static

Definition at line 2203 of file stg_prop.c.

2210 {
2212  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2213  IStream *stm = NULL;
2214  HRESULT r;
2215 
2216  TRACE("%p %s %08x %08x %p\n", This, debugstr_guid(rfmtid), grfFlags,
2217  grfMode, ppprstg);
2218 
2219  /* be picky */
2221  {
2222  r = STG_E_INVALIDFLAG;
2223  goto end;
2224  }
2225 
2226  if (!rfmtid)
2227  {
2228  r = E_INVALIDARG;
2229  goto end;
2230  }
2231 
2232  /* FIXME: if (grfFlags & PROPSETFLAG_NONSIMPLE), we need to create a
2233  * storage, not a stream. For now, disallow it.
2234  */
2235  if (grfFlags & PROPSETFLAG_NONSIMPLE)
2236  {
2237  FIXME("PROPSETFLAG_NONSIMPLE not supported\n");
2238  r = STG_E_INVALIDFLAG;
2239  goto end;
2240  }
2241 
2242  r = FmtIdToPropStgName(rfmtid, name);
2243  if (FAILED(r))
2244  goto end;
2245 
2246  r = IStorage_CreateStream( &This->base.IStorage_iface, name, grfMode, 0, 0, &stm );
2247  if (FAILED(r))
2248  goto end;
2249 
2250  r = PropertyStorage_ConstructEmpty(stm, rfmtid, grfFlags, grfMode, ppprstg);
2251 
2252  IStream_Release( stm );
2253 
2254 end:
2255  TRACE("returning 0x%08x\n", r);
2256  return r;
2257 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define STGM_CREATE
Definition: objbase.h:925
GLuint GLuint end
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI FmtIdToPropStgName(const FMTID *rfmtid, LPOLESTR str)
Definition: stg_prop.c:2642
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_INVALIDFLAG
Definition: winerror.h:2587
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68
#define STGM_READWRITE
Definition: objbase.h:918
Definition: name.c:36
static HRESULT PropertyStorage_ConstructEmpty(IStream *stm, REFFMTID rfmtid, DWORD grfFlags, DWORD grfMode, IPropertyStorage **pps)
Definition: stg_prop.c:2129

◆ IPropertySetStorage_fnDelete()

static HRESULT WINAPI IPropertySetStorage_fnDelete ( IPropertySetStorage ppstg,
REFFMTID  rfmtid 
)
static

Definition at line 2309 of file stg_prop.c.

2312 {
2314  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2315  HRESULT r;
2316 
2317  TRACE("%p %s\n", This, debugstr_guid(rfmtid));
2318 
2319  if (!rfmtid)
2320  return E_INVALIDARG;
2321 
2322  r = FmtIdToPropStgName(rfmtid, name);
2323  if (FAILED(r))
2324  return r;
2325 
2326  return IStorage_DestroyElement(&This->base.IStorage_iface, name);
2327 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI FmtIdToPropStgName(const FMTID *rfmtid, LPOLESTR str)
Definition: stg_prop.c:2642
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68
Definition: name.c:36

◆ IPropertySetStorage_fnEnum()

static HRESULT WINAPI IPropertySetStorage_fnEnum ( IPropertySetStorage ppstg,
IEnumSTATPROPSETSTG **  ppenum 
)
static

Definition at line 2332 of file stg_prop.c.

2335 {
2337  return create_EnumSTATPROPSETSTG(This, ppenum);
2338 }
static HRESULT create_EnumSTATPROPSETSTG(StorageImpl *, IEnumSTATPROPSETSTG **)
Definition: stg_prop.c:2392
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68

◆ IPropertySetStorage_fnOpen()

static HRESULT WINAPI IPropertySetStorage_fnOpen ( IPropertySetStorage ppstg,
REFFMTID  rfmtid,
DWORD  grfMode,
IPropertyStorage **  ppprstg 
)
static

Definition at line 2262 of file stg_prop.c.

2267 {
2269  IStream *stm = NULL;
2270  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2271  HRESULT r;
2272 
2273  TRACE("%p %s %08x %p\n", This, debugstr_guid(rfmtid), grfMode, ppprstg);
2274 
2275  /* be picky */
2276  if (grfMode != (STGM_READWRITE|STGM_SHARE_EXCLUSIVE) &&
2277  grfMode != (STGM_READ|STGM_SHARE_EXCLUSIVE))
2278  {
2279  r = STG_E_INVALIDFLAG;
2280  goto end;
2281  }
2282 
2283  if (!rfmtid)
2284  {
2285  r = E_INVALIDARG;
2286  goto end;
2287  }
2288 
2289  r = FmtIdToPropStgName(rfmtid, name);
2290  if (FAILED(r))
2291  goto end;
2292 
2293  r = IStorage_OpenStream( &This->base.IStorage_iface, name, 0, grfMode, 0, &stm );
2294  if (FAILED(r))
2295  goto end;
2296 
2297  r = PropertyStorage_ConstructFromStream(stm, rfmtid, grfMode, ppprstg);
2298 
2299  IStream_Release( stm );
2300 
2301 end:
2302  TRACE("returning 0x%08x\n", r);
2303  return r;
2304 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint end
Definition: gl.h:1545
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI FmtIdToPropStgName(const FMTID *rfmtid, LPOLESTR str)
Definition: stg_prop.c:2642
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_INVALIDFLAG
Definition: winerror.h:2587
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68
#define STGM_READWRITE
Definition: objbase.h:918
static HRESULT PropertyStorage_ConstructFromStream(IStream *stm, REFFMTID rfmtid, DWORD grfMode, IPropertyStorage **pps)
Definition: stg_prop.c:2107
Definition: name.c:36

◆ IPropertySetStorage_fnQueryInterface()

static HRESULT WINAPI IPropertySetStorage_fnQueryInterface ( IPropertySetStorage ppstg,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 2167 of file stg_prop.c.

2171 {
2173  return IStorage_QueryInterface( &This->base.IStorage_iface, riid, ppvObject );
2174 }
REFIID riid
Definition: precomp.h:44
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68
REFIID LPVOID * ppvObject
Definition: precomp.h:44

◆ IPropertySetStorage_fnRelease()

static ULONG WINAPI IPropertySetStorage_fnRelease ( IPropertySetStorage ppstg)
static

Definition at line 2193 of file stg_prop.c.

2195 {
2197  return IStorage_Release( &This->base.IStorage_iface );
2198 }
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:68

◆ IPropertyStorage_fnAddRef()

static ULONG WINAPI IPropertyStorage_fnAddRef ( IPropertyStorage iface)
static

Definition at line 217 of file stg_prop.c.

219 {
221  return InterlockedIncrement(&This->ref);
222 }
#define InterlockedIncrement
Definition: armddk.h:53
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181

◆ IPropertyStorage_fnCommit()

static HRESULT WINAPI IPropertyStorage_fnCommit ( IPropertyStorage iface,
DWORD  grfCommitFlags 
)
static

Definition at line 816 of file stg_prop.c.

819 {
821  HRESULT hr;
822 
823  TRACE("(%p, 0x%08x)\n", iface, grfCommitFlags);
824 
825  if (!(This->grfMode & STGM_READWRITE))
826  return STG_E_ACCESSDENIED;
828  if (This->dirty)
830  else
831  hr = S_OK;
833  return hr;
834 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *)
Definition: stg_prop.c:1940
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IPropertyStorage_fnDeleteMultiple()

static HRESULT WINAPI IPropertyStorage_fnDeleteMultiple ( IPropertyStorage iface,
ULONG  cpspec,
const PROPSPEC  rgpspec[] 
)
static

Definition at line 660 of file stg_prop.c.

664 {
666  ULONG i;
667  HRESULT hr;
668 
669  TRACE("(%p, %d, %p)\n", iface, cpspec, rgpspec);
670 
671  if (cpspec && !rgpspec)
672  return E_INVALIDARG;
673  if (!(This->grfMode & STGM_READWRITE))
674  return STG_E_ACCESSDENIED;
675  hr = S_OK;
677  This->dirty = TRUE;
678  for (i = 0; i < cpspec; i++)
679  {
680  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
681  {
682  void *propid;
683 
684  if (dictionary_find(This->name_to_propid, rgpspec[i].u.lpwstr, &propid))
685  dictionary_remove(This->propid_to_prop, propid);
686  }
687  else
688  {
689  if (rgpspec[i].u.propid >= PID_FIRST_USABLE &&
690  rgpspec[i].u.propid < PID_MIN_READONLY)
691  dictionary_remove(This->propid_to_prop, UlongToPtr(rgpspec[i].u.propid));
692  else
694  }
695  }
696  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
697  IPropertyStorage_Commit(iface, STGC_DEFAULT);
699  return hr;
700 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
void dictionary_remove(struct dictionary *d, const void *k)
Definition: dictionary.c:161
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define PID_FIRST_USABLE
Definition: propkeydef.h:20
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define E_INVALIDARG
Definition: ddrawi.h:101
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IPropertyStorage_fnDeletePropertyNames()

static HRESULT WINAPI IPropertyStorage_fnDeletePropertyNames ( IPropertyStorage iface,
ULONG  cpropid,
const PROPID  rgpropid[] 
)
static

Definition at line 779 of file stg_prop.c.

783 {
785  ULONG i;
786  HRESULT hr;
787 
788  TRACE("(%p, %d, %p)\n", iface, cpropid, rgpropid);
789 
790  if (cpropid && !rgpropid)
791  return E_INVALIDARG;
792  if (!(This->grfMode & STGM_READWRITE))
793  return STG_E_ACCESSDENIED;
794  hr = S_OK;
796  This->dirty = TRUE;
797  for (i = 0; i < cpropid; i++)
798  {
799  LPWSTR name = NULL;
800 
801  if (dictionary_find(This->propid_to_name, UlongToPtr(rgpropid[i]), (void **)&name))
802  {
803  dictionary_remove(This->propid_to_name, UlongToPtr(rgpropid[i]));
804  dictionary_remove(This->name_to_propid, name);
805  }
806  }
807  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
808  IPropertyStorage_Commit(iface, STGC_DEFAULT);
810  return hr;
811 }
void dictionary_remove(struct dictionary *d, const void *k)
Definition: dictionary.c:161
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ IPropertyStorage_fnEnum()

static HRESULT WINAPI IPropertyStorage_fnEnum ( IPropertyStorage iface,
IEnumSTATPROPSTG **  ppenum 
)
static

Definition at line 864 of file stg_prop.c.

867 {
869  return create_EnumSTATPROPSTG(This, ppenum);
870 }
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
static HRESULT create_EnumSTATPROPSTG(PropertyStorage_impl *, IEnumSTATPROPSTG **)
Definition: stg_prop.c:2540

◆ IPropertyStorage_fnQueryInterface()

static HRESULT WINAPI IPropertyStorage_fnQueryInterface ( IPropertyStorage iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 189 of file stg_prop.c.

193 {
195 
196  TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
197 
198  if (!ppvObject)
199  return E_INVALIDARG;
200 
201  *ppvObject = 0;
202 
203  if (IsEqualGUID(&IID_IUnknown, riid) ||
204  IsEqualGUID(&IID_IPropertyStorage, riid))
205  {
206  IPropertyStorage_AddRef(iface);
207  *ppvObject = iface;
208  return S_OK;
209  }
210 
211  return E_NOINTERFACE;
212 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181

◆ IPropertyStorage_fnReadMultiple()

static HRESULT WINAPI IPropertyStorage_fnReadMultiple ( IPropertyStorage iface,
ULONG  cpspec,
const PROPSPEC  rgpspec[],
PROPVARIANT  rgpropvar[] 
)
static

Definition at line 302 of file stg_prop.c.

307 {
309  HRESULT hr = S_OK;
310  ULONG i;
311 
312  TRACE("(%p, %d, %p, %p)\n", iface, cpspec, rgpspec, rgpropvar);
313 
314  if (!cpspec)
315  return S_FALSE;
316  if (!rgpspec || !rgpropvar)
317  return E_INVALIDARG;
319  for (i = 0; i < cpspec; i++)
320  {
321  PropVariantInit(&rgpropvar[i]);
322  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
323  {
324  PROPVARIANT *prop = PropertyStorage_FindPropertyByName(This,
325  rgpspec[i].u.lpwstr);
326 
327  if (prop)
328  PropertyStorage_PropVariantCopy(&rgpropvar[i], prop, GetACP(),
329  This->codePage);
330  }
331  else
332  {
333  switch (rgpspec[i].u.propid)
334  {
335  case PID_CODEPAGE:
336  rgpropvar[i].vt = VT_I2;
337  rgpropvar[i].u.iVal = This->codePage;
338  break;
339  case PID_LOCALE:
340  rgpropvar[i].vt = VT_I4;
341  rgpropvar[i].u.lVal = This->locale;
342  break;
343  default:
344  {
345  PROPVARIANT *prop = PropertyStorage_FindProperty(This,
346  rgpspec[i].u.propid);
347 
348  if (prop)
349  PropertyStorage_PropVariantCopy(&rgpropvar[i], prop,
350  GetACP(), This->codePage);
351  else
352  hr = S_FALSE;
353  }
354  }
355  }
356  }
358  return hr;
359 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static PROPVARIANT * PropertyStorage_FindProperty(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:248
Definition: compat.h:1939
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define PID_CODEPAGE
Definition: suminfo.c:43
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop, const PROPVARIANT *propvar, LCID targetCP, LCID srcCP)
Definition: stg_prop.c:445
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static PROPVARIANT * PropertyStorage_FindPropertyByName(PropertyStorage_impl *This, LPCWSTR name)
Definition: stg_prop.c:259
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
Definition: compat.h:1938

◆ IPropertyStorage_fnReadPropertyNames()

static HRESULT WINAPI IPropertyStorage_fnReadPropertyNames ( IPropertyStorage iface,
ULONG  cpropid,
const PROPID  rgpropid[],
LPOLESTR  rglpwstrName[] 
)
static

Definition at line 705 of file stg_prop.c.

710 {
712  ULONG i;
713  HRESULT hr = S_FALSE;
714 
715  TRACE("(%p, %d, %p, %p)\n", iface, cpropid, rgpropid, rglpwstrName);
716 
717  if (cpropid && (!rgpropid || !rglpwstrName))
718  return E_INVALIDARG;
720  for (i = 0; i < cpropid && SUCCEEDED(hr); i++)
721  {
723 
724  if (name)
725  {
726  size_t len = lstrlenW(name);
727 
728  hr = S_OK;
729  rglpwstrName[i] = CoTaskMemAlloc((len + 1) * sizeof(WCHAR));
730  if (rglpwstrName[i])
731  memcpy(rglpwstrName[i], name, (len + 1) * sizeof(WCHAR));
732  else
734  }
735  else
736  rglpwstrName[i] = NULL;
737  }
739  return hr;
740 }
HRESULT hr
Definition: shlfolder.c:183
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:407
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static LPWSTR PropertyStorage_FindPropertyNameById(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:289
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IPropertyStorage_fnRelease()

static ULONG WINAPI IPropertyStorage_fnRelease ( IPropertyStorage iface)
static

Definition at line 227 of file stg_prop.c.

229 {
231  ULONG ref;
232 
233  ref = InterlockedDecrement(&This->ref);
234  if (ref == 0)
235  {
236  TRACE("Destroying %p\n", This);
237  if (This->dirty)
238  IPropertyStorage_Commit(iface, STGC_DEFAULT);
239  IStream_Release(This->stm);
240  This->cs.DebugInfo->Spare[0] = 0;
244  }
245  return ref;
246 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2033
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define InterlockedDecrement
Definition: armddk.h:52
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ IPropertyStorage_fnRevert()

static HRESULT WINAPI IPropertyStorage_fnRevert ( IPropertyStorage iface)
static

Definition at line 839 of file stg_prop.c.

841 {
842  HRESULT hr;
844 
845  TRACE("%p\n", iface);
846 
848  if (This->dirty)
849  {
852  if (SUCCEEDED(hr))
854  }
855  else
856  hr = S_OK;
858  return hr;
859 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2033
static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *)
Definition: stg_prop.c:1345
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT PropertyStorage_CreateDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2043
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IPropertyStorage_fnSetClass()

static HRESULT WINAPI IPropertyStorage_fnSetClass ( IPropertyStorage iface,
REFCLSID  clsid 
)
static

Definition at line 888 of file stg_prop.c.

891 {
893 
894  TRACE("%p, %s\n", iface, debugstr_guid(clsid));
895 
896  if (!clsid)
897  return E_INVALIDARG;
898  if (!(This->grfMode & STGM_READWRITE))
899  return STG_E_ACCESSDENIED;
900  This->clsid = *clsid;
901  This->dirty = TRUE;
902  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
903  IPropertyStorage_Commit(iface, STGC_DEFAULT);
904  return S_OK;
905 }
#define TRUE
Definition: types.h:120
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
REFCLSID clsid
Definition: msctf.c:84
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181

◆ IPropertyStorage_fnSetTimes()

static HRESULT WINAPI IPropertyStorage_fnSetTimes ( IPropertyStorage iface,
const FILETIME pctime,
const FILETIME patime,
const FILETIME pmtime 
)
static

Definition at line 875 of file stg_prop.c.

880 {
881  FIXME("\n");
882  return E_NOTIMPL;
883 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IPropertyStorage_fnStat()

static HRESULT WINAPI IPropertyStorage_fnStat ( IPropertyStorage iface,
STATPROPSETSTG *  statpsstg 
)
static

Definition at line 910 of file stg_prop.c.

913 {
915  STATSTG stat;
916  HRESULT hr;
917 
918  TRACE("%p, %p\n", iface, statpsstg);
919 
920  if (!statpsstg)
921  return E_INVALIDARG;
922 
923  hr = IStream_Stat(This->stm, &stat, STATFLAG_NONAME);
924  if (SUCCEEDED(hr))
925  {
926  statpsstg->fmtid = This->fmtid;
927  statpsstg->clsid = This->clsid;
928  statpsstg->grfFlags = This->grfFlags;
929  statpsstg->mtime = stat.mtime;
930  statpsstg->ctime = stat.ctime;
931  statpsstg->atime = stat.atime;
932  statpsstg->dwOSVersion = This->originatorOS;
933  }
934  return hr;
935 }
HRESULT hr
Definition: shlfolder.c:183
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IPropertyStorage_fnWriteMultiple()

static HRESULT WINAPI IPropertyStorage_fnWriteMultiple ( IPropertyStorage iface,
ULONG  cpspec,
const PROPSPEC  rgpspec[],
const PROPVARIANT  rgpropvar[],
PROPID  propidNameFirst 
)
static

Definition at line 559 of file stg_prop.c.

565 {
567  HRESULT hr = S_OK;
568  ULONG i;
569 
570  TRACE("(%p, %d, %p, %p)\n", iface, cpspec, rgpspec, rgpropvar);
571 
572  if (cpspec && (!rgpspec || !rgpropvar))
573  return E_INVALIDARG;
574  if (!(This->grfMode & STGM_READWRITE))
575  return STG_E_ACCESSDENIED;
577  This->dirty = TRUE;
578  This->originatorOS = (DWORD)MAKELONG(LOWORD(GetVersion()),
580  for (i = 0; i < cpspec; i++)
581  {
582  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
583  {
584  PROPVARIANT *prop = PropertyStorage_FindPropertyByName(This,
585  rgpspec[i].u.lpwstr);
586 
587  if (prop)
588  PropVariantCopy(prop, &rgpropvar[i]);
589  else
590  {
591  /* Note that I don't do the special cases here that I do below,
592  * because naming the special PIDs isn't supported.
593  */
594  if (propidNameFirst < PID_FIRST_USABLE ||
595  propidNameFirst >= PID_MIN_READONLY)
597  else
598  {
599  PROPID nextId = max(propidNameFirst, This->highestProp + 1);
600 
602  (LPCSTR)rgpspec[i].u.lpwstr, CP_UNICODE, nextId);
603  if (SUCCEEDED(hr))
605  &rgpropvar[i], GetACP());
606  }
607  }
608  }
609  else
610  {
611  switch (rgpspec[i].u.propid)
612  {
613  case PID_DICTIONARY:
614  /* Can't set the dictionary */
616  break;
617  case PID_CODEPAGE:
618  /* Can only set the code page if nothing else has been set */
619  if (dictionary_num_entries(This->propid_to_prop) == 0 &&
620  rgpropvar[i].vt == VT_I2)
621  {
622  This->codePage = rgpropvar[i].u.iVal;
623  if (This->codePage == CP_UNICODE)
624  This->grfFlags &= ~PROPSETFLAG_ANSI;
625  else
626  This->grfFlags |= PROPSETFLAG_ANSI;
627  }
628  else
630  break;
631  case PID_LOCALE:
632  /* Can only set the locale if nothing else has been set */
633  if (dictionary_num_entries(This->propid_to_prop) == 0 &&
634  rgpropvar[i].vt == VT_I4)
635  This->locale = rgpropvar[i].u.lVal;
636  else
638  break;
639  case PID_ILLEGAL:
640  /* silently ignore like MSDN says */
641  break;
642  default:
643  if (rgpspec[i].u.propid >= PID_MIN_READONLY)
645  else
647  rgpspec[i].u.propid, &rgpropvar[i], GetACP());
648  }
649  }
650  }
651  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
652  IPropertyStorage_Commit(iface, STGC_DEFAULT);
654  return hr;
655 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
Definition: compat.h:1939
HRESULT hr
Definition: shlfolder.c:183
UINT dictionary_num_entries(struct dictionary *d)
Definition: dictionary.c:85
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static const CLSID IPropertyStorage UINT *static const PROPSPEC PROPVARIANT *static UINT const PROPSPEC PROPVARIANT PROPID
Definition: shellole.c:77
#define PROPSETHDR_OSVER_KIND_WIN32
Definition: stg_prop.c:79
#define PID_CODEPAGE
Definition: suminfo.c:43
static HRESULT PropertyStorage_StoreNameWithId(PropertyStorage_impl *This, LPCSTR srcName, LCID cp, PROPID id)
Definition: stg_prop.c:526
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
#define PID_FIRST_USABLE
Definition: propkeydef.h:20
static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This, PROPID propid, const PROPVARIANT *propvar, LCID lcid)
Definition: stg_prop.c:471
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define E_INVALIDARG
Definition: ddrawi.h:101
#define MAKELONG(a, b)
Definition: typedefs.h:248
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
const char * LPCSTR
Definition: xmlstorage.h:183
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3068
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
static PROPVARIANT * PropertyStorage_FindPropertyByName(PropertyStorage_impl *This, LPCWSTR name)
Definition: stg_prop.c:259
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
#define PID_DICTIONARY
Definition: suminfo.c:42
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define CP_UNICODE
Definition: stg_prop.c:81
#define LOWORD(l)
Definition: pedump.c:82
Definition: compat.h:1938
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IPropertyStorage_fnWritePropertyNames()

static HRESULT WINAPI IPropertyStorage_fnWritePropertyNames ( IPropertyStorage iface,
ULONG  cpropid,
const PROPID  rgpropid[],
const LPOLESTR  rglpwstrName[] 
)
static

Definition at line 745 of file stg_prop.c.

750 {
752  ULONG i;
753  HRESULT hr;
754 
755  TRACE("(%p, %d, %p, %p)\n", iface, cpropid, rgpropid, rglpwstrName);
756 
757  if (cpropid && (!rgpropid || !rglpwstrName))
758  return E_INVALIDARG;
759  if (!(This->grfMode & STGM_READWRITE))
760  return STG_E_ACCESSDENIED;
761  hr = S_OK;
763  This->dirty = TRUE;
764  for (i = 0; SUCCEEDED(hr) && i < cpropid; i++)
765  {
766  if (rgpropid[i] != PID_ILLEGAL)
767  hr = PropertyStorage_StoreNameWithId(This, (LPCSTR)rglpwstrName[i],
768  CP_UNICODE, rgpropid[i]);
769  }
770  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
771  IPropertyStorage_Commit(iface, STGC_DEFAULT);
773  return hr;
774 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT PropertyStorage_StoreNameWithId(PropertyStorage_impl *This, LPCSTR srcName, LCID cp, PROPID id)
Definition: stg_prop.c:526
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define E_INVALIDARG
Definition: ddrawi.h:101
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ prop_enum_copy_cb()

static void prop_enum_copy_cb ( IUnknown parent,
void orig,
void dest 
)
static

Definition at line 2503 of file stg_prop.c.

2504 {
2506  STATPROPSTG *src_prop = orig;
2507  STATPROPSTG *dest_prop = dest;
2508  LPWSTR name;
2509 
2510  dest_prop->propid = src_prop->propid;
2511  dest_prop->vt = src_prop->vt;
2512  dest_prop->lpwstrName = NULL;
2513 
2514  if (dictionary_find(storage->propid_to_name, UlongToPtr(src_prop->propid), (void**)&name))
2515  {
2516  DWORD size = (strlenW(name) + 1) * sizeof(WCHAR);
2517 
2518  dest_prop->lpwstrName = CoTaskMemAlloc(size);
2519  if (!dest_prop->lpwstrName) return;
2520  memcpy(dest_prop->lpwstrName, name, size);
2521  }
2522 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
smooth NULL
Definition: ftsmooth.c:416
struct dictionary * propid_to_name
Definition: stg_prop.c:177
#define UlongToPtr(u)
Definition: config.h:106
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:181
Definition: name.c:36
static char * dest
Definition: rtl.c:135
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by create_EnumSTATPROPSTG().

◆ prop_enum_stat()

static BOOL prop_enum_stat ( const void k,
const void v,
void extra,
void arg 
)
static

Definition at line 2524 of file stg_prop.c.

2525 {
2526  enumx_impl *enumx = arg;
2527  PROPID propid = PtrToUlong(k);
2528  const PROPVARIANT *prop = v;
2529  STATPROPSTG stat;
2530 
2531  stat.lpwstrName = NULL;
2532  stat.propid = propid;
2533  stat.vt = prop->vt;
2534 
2535  enumx_add_element(enumx, &stat);
2536 
2537  return TRUE;
2538 }
#define TRUE
Definition: types.h:120
void * enumx_add_element(enumx_impl *enumx, const void *data)
Definition: enumx.c:207
void * arg
Definition: msvc.h:12
static const CLSID IPropertyStorage UINT *static const PROPSPEC PROPVARIANT *static UINT const PROPSPEC PROPVARIANT PROPID
Definition: shellole.c:77
smooth NULL
Definition: ftsmooth.c:416
#define PtrToUlong(u)
Definition: config.h:107
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
const GLdouble * v
Definition: gl.h:2040
int k
Definition: mpi.c:3369

Referenced by create_EnumSTATPROPSTG().

◆ PropertStorage_WriteWStringToStream()

static HRESULT PropertStorage_WriteWStringToStream ( IStream stm,
LPCWSTR  str,
DWORD  len,
DWORD written 
)
inlinestatic

Definition at line 1574 of file stg_prop.c.

1576 {
1577 #ifdef WORDS_BIGENDIAN
1578  WCHAR *leStr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1579  HRESULT hr;
1580 
1581  if (!leStr)
1582  return E_OUTOFMEMORY;
1583  memcpy(leStr, str, len * sizeof(WCHAR));
1585  hr = IStream_Write(stm, leStr, len, written);
1586  HeapFree(GetProcessHeap(), 0, leStr);
1587  return hr;
1588 #else
1589  return IStream_Write(stm, str, len, written);
1590 #endif
1591 }
HRESULT hr
Definition: shlfolder.c:183
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define PropertyStorage_ByteSwapString(s, l)
Definition: stg_prop.c:993
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by PropertyStorage_DictionaryWriter().

◆ PropertyStorage_BaseConstruct()

static HRESULT PropertyStorage_BaseConstruct ( IStream stm,
REFFMTID  rfmtid,
DWORD  grfMode,
PropertyStorage_impl **  pps 
)
static

Definition at line 2075 of file stg_prop.c.

2077 {
2078  HRESULT hr = S_OK;
2079 
2080  assert(pps);
2081  assert(rfmtid);
2082  *pps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof **pps);
2083  if (!*pps)
2084  return E_OUTOFMEMORY;
2085 
2086  (*pps)->IPropertyStorage_iface.lpVtbl = &IPropertyStorage_Vtbl;
2087  (*pps)->ref = 1;
2088  InitializeCriticalSection(&(*pps)->cs);
2089  (*pps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PropertyStorage_impl.cs");
2090  (*pps)->stm = stm;
2091  (*pps)->fmtid = *rfmtid;
2092  (*pps)->grfMode = grfMode;
2093 
2095  if (FAILED(hr))
2096  {
2097  (*pps)->cs.DebugInfo->Spare[0] = 0;
2098  DeleteCriticalSection(&(*pps)->cs);
2099  HeapFree(GetProcessHeap(), 0, *pps);
2100  *pps = NULL;
2101  }
2102  else IStream_AddRef( stm );
2103 
2104  return hr;
2105 }
#define DWORD_PTR
Definition: treelist.c:76
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
static const IPropertyStorageVtbl IPropertyStorage_Vtbl
Definition: stg_prop.c:151
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
LONG HRESULT
Definition: typedefs.h:77
static HRESULT PropertyStorage_CreateDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2043
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by PropertyStorage_ConstructEmpty(), and PropertyStorage_ConstructFromStream().

◆ PropertyStorage_ConstructEmpty()

static HRESULT PropertyStorage_ConstructEmpty ( IStream stm,
REFFMTID  rfmtid,
DWORD  grfFlags,
DWORD  grfMode,
IPropertyStorage **  pps 
)
static

Definition at line 2129 of file stg_prop.c.

2131 {
2133  HRESULT hr;
2134 
2135  assert(pps);
2136  hr = PropertyStorage_BaseConstruct(stm, rfmtid, grfMode, &ps);
2137  if (SUCCEEDED(hr))
2138  {
2139  ps->format = 0;
2140  ps->grfFlags = grfFlags;
2141  if (ps->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
2142  ps->format = 1;
2143  /* default to Unicode unless told not to, as specified on msdn */
2144  if (ps->grfFlags & PROPSETFLAG_ANSI)
2145  ps->codePage = GetACP();
2146  else
2147  ps->codePage = CP_UNICODE;
2149  TRACE("Code page is %d, locale is %d\n", ps->codePage, ps->locale);
2150  *pps = &ps->IPropertyStorage_iface;
2151  TRACE("PropertyStorage %p constructed\n", ps);
2152  hr = S_OK;
2153  }
2154  return hr;
2155 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
IPropertyStorage IPropertyStorage_iface
Definition: stg_prop.c:162
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT PropertyStorage_BaseConstruct(IStream *stm, REFFMTID rfmtid, DWORD grfMode, PropertyStorage_impl **pps)
Definition: stg_prop.c:2075
#define LOCALE_SYSTEM_DEFAULT
#define S_OK
Definition: intsafe.h:59
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertySetStorage_fnCreate(), and StgCreatePropStg().

◆ PropertyStorage_ConstructFromStream()

static HRESULT PropertyStorage_ConstructFromStream ( IStream stm,
REFFMTID  rfmtid,
DWORD  grfMode,
IPropertyStorage **  pps 
)
static

Definition at line 2107 of file stg_prop.c.

2109 {
2111  HRESULT hr;
2112 
2113  assert(pps);
2114  hr = PropertyStorage_BaseConstruct(stm, rfmtid, grfMode, &ps);
2115  if (SUCCEEDED(hr))
2116  {
2118  if (SUCCEEDED(hr))
2119  {
2120  *pps = &ps->IPropertyStorage_iface;
2121  TRACE("PropertyStorage %p constructed\n", ps);
2122  hr = S_OK;
2123  }
2124  else IPropertyStorage_Release( &ps->IPropertyStorage_iface );
2125  }
2126  return hr;
2127 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *)
Definition: stg_prop.c:1345
IPropertyStorage IPropertyStorage_iface
Definition: stg_prop.c:162
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT PropertyStorage_BaseConstruct(IStream *stm, REFFMTID rfmtid, DWORD grfMode, PropertyStorage_impl **pps)
Definition: stg_prop.c:2075
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertySetStorage_fnOpen(), and StgOpenPropStg().

◆ PropertyStorage_CreateDictionaries()

static HRESULT PropertyStorage_CreateDictionaries ( PropertyStorage_impl This)
static

Definition at line 2043 of file stg_prop.c.

2044 {
2045  HRESULT hr = S_OK;
2046 
2047  This->name_to_propid = dictionary_create(
2049  This);
2050  if (!This->name_to_propid)
2051  {
2053  goto end;
2054  }
2056  NULL, This);
2057  if (!This->propid_to_name)
2058  {
2060  goto end;
2061  }
2064  if (!This->propid_to_prop)
2065  {
2067  goto end;
2068  }
2069 end:
2070  if (FAILED(hr))
2072  return hr;
2073 }
static void PropertyStorage_PropNameDestroy(void *k, void *d, void *extra)
Definition: stg_prop.c:960
HRESULT hr
Definition: shlfolder.c:183
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
GLuint GLuint end
Definition: gl.h:1545
struct dictionary * dictionary_create(comparefunc c, destroyfunc d, void *extra)
Definition: dictionary.c:45
smooth NULL
Definition: ftsmooth.c:416
static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2033
static int PropertyStorage_PropCompare(const void *a, const void *b, void *extra)
Definition: stg_prop.c:965
LONG HRESULT
Definition: typedefs.h:77
static void PropertyStorage_PropertyDestroy(void *k, void *d, void *extra)
Definition: stg_prop.c:972
#define S_OK
Definition: intsafe.h:59
static int PropertyStorage_PropNameCompare(const void *a, const void *b, void *extra)
Definition: stg_prop.c:937

Referenced by IPropertyStorage_fnRevert(), and PropertyStorage_BaseConstruct().

◆ PropertyStorage_DestroyDictionaries()

static void PropertyStorage_DestroyDictionaries ( PropertyStorage_impl This)
static

Definition at line 2033 of file stg_prop.c.

2034 {
2035  dictionary_destroy(This->name_to_propid);
2036  This->name_to_propid = NULL;
2037  dictionary_destroy(This->propid_to_name);
2038  This->propid_to_name = NULL;
2039  dictionary_destroy(This->propid_to_prop);
2040  This->propid_to_prop = NULL;
2041 }
smooth NULL
Definition: ftsmooth.c:416
void dictionary_destroy(struct dictionary *d)
Definition: dictionary.c:65

Referenced by IPropertyStorage_fnRelease(), IPropertyStorage_fnRevert(), and PropertyStorage_CreateDictionaries().

◆ PropertyStorage_DictionaryWriter()

static BOOL PropertyStorage_DictionaryWriter ( const void key,
const void value,
void extra,
void closure 
)
static

Definition at line 1599 of file stg_prop.c.

1601 {
1603  struct DictionaryClosure *c = closure;
1604  DWORD propid;
1605  ULONG count;
1606 
1607  assert(key);
1608  assert(closure);
1610  c->hr = IStream_Write(This->stm, &propid, sizeof(propid), &count);
1611  if (FAILED(c->hr))
1612  goto end;
1613  c->bytesWritten += sizeof(DWORD);
1614  if (This->codePage == CP_UNICODE)
1615  {
1616  DWORD keyLen, pad = 0;
1617 
1618  StorageUtl_WriteDWord((LPBYTE)&keyLen, 0,
1619  (lstrlenW((LPCWSTR)key) + 1) * sizeof(WCHAR));
1620  c->hr = IStream_Write(This->stm, &keyLen, sizeof(keyLen), &count);
1621  if (FAILED(c->hr))
1622  goto end;
1623  c->bytesWritten += sizeof(DWORD);
1624  c->hr = PropertStorage_WriteWStringToStream(This->stm, key, keyLen,
1625  &count);
1626  if (FAILED(c->hr))
1627  goto end;
1628  c->bytesWritten += keyLen * sizeof(WCHAR);
1629  if (keyLen % sizeof(DWORD))
1630  {
1631  c->hr = IStream_Write(This->stm, &pad,
1632  sizeof(DWORD) - keyLen % sizeof(DWORD), &count);
1633  if (FAILED(c->hr))
1634  goto end;
1635  c->bytesWritten += sizeof(DWORD) - keyLen % sizeof(DWORD);
1636  }
1637  }
1638  else
1639  {
1640  DWORD keyLen;
1641 
1642  StorageUtl_WriteDWord((LPBYTE)&keyLen, 0, strlen((LPCSTR)key) + 1);
1643  c->hr = IStream_Write(This->stm, &keyLen, sizeof(keyLen), &count);
1644  if (FAILED(c->hr))
1645  goto end;
1646  c->bytesWritten += sizeof(DWORD);
1647  c->hr = IStream_Write(This->stm, key, keyLen, &count);
1648  if (FAILED(c->hr))
1649  goto end;
1650  c->bytesWritten += keyLen;
1651  }
1652 end:
1653  return SUCCEEDED(c->hr);
1654 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
GLuint GLuint end
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
static HRESULT PropertStorage_WriteWStringToStream(IStream *stm, LPCWSTR str, DWORD len, DWORD *written)
Definition: stg_prop.c:1574
unsigned char * LPBYTE
Definition: typedefs.h:52
const char * LPCSTR
Definition: xmlstorage.h:183
#define PtrToUlong(u)
Definition: config.h:107
static void pad(Char *s)
Definition: bzip2.c:908
static FMTID *static DWORD
Definition: stg_prop.c:29
Definition: id3.c:18
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
unsigned long DWORD
Definition: ntddk_ex.h:95
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966
unsigned int ULONG
Definition: retypes.h:1
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:42

Referenced by PropertyStorage_WriteDictionaryToStream().

◆ PropertyStorage_FindProperty()

static PROPVARIANT* PropertyStorage_FindProperty ( PropertyStorage_impl This,
DWORD  propid 
)
static

Definition at line 248 of file stg_prop.c.

250 {
251  PROPVARIANT *ret = NULL;
252 
253  dictionary_find(This->propid_to_prop, UlongToPtr(propid), (void **)&ret);
254  TRACE("returning %p\n", ret);
255  return ret;
256 }
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
smooth NULL
Definition: ftsmooth.c:416
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
int ret

Referenced by IPropertyStorage_fnReadMultiple(), PropertyStorage_FindPropertyByName(), and PropertyStorage_StorePropWithId().

◆ PropertyStorage_FindPropertyByName()

static PROPVARIANT* PropertyStorage_FindPropertyByName ( PropertyStorage_impl This,
LPCWSTR  name 
)
static

Definition at line 259 of file stg_prop.c.

261 {
262  PROPVARIANT *ret = NULL;
263  void *propid;
264 
265  if (!name)
266  return NULL;
267  if (This->codePage == CP_UNICODE)
268  {
269  if (dictionary_find(This->name_to_propid, name, &propid))
271  }
272  else
273  {
274  LPSTR ansiName;
276  &ansiName, This->codePage);
277 
278  if (SUCCEEDED(hr))
279  {
280  if (dictionary_find(This->name_to_propid, ansiName, &propid))
282  CoTaskMemFree(ansiName);
283  }
284  }
285  TRACE("returning %p\n", ret);
286  return ret;
287 }
static PROPVARIANT * PropertyStorage_FindProperty(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:248
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define PtrToUlong(u)
Definition: config.h:107
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
Definition: name.c:36
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:361
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertyStorage_fnReadMultiple(), and IPropertyStorage_fnWriteMultiple().

◆ PropertyStorage_FindPropertyNameById()

static LPWSTR PropertyStorage_FindPropertyNameById ( PropertyStorage_impl This,
DWORD  propid 
)
static

Definition at line 289 of file stg_prop.c.

291 {
292  LPWSTR ret = NULL;
293 
294  dictionary_find(This->propid_to_name, UlongToPtr(propid), (void **)&ret);
295  TRACE("returning %p\n", ret);
296  return ret;
297 }
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
smooth NULL
Definition: ftsmooth.c:416
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
int ret
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by IPropertyStorage_fnReadPropertyNames().

◆ PropertyStorage_MakeFmtIdOffset()

static void PropertyStorage_MakeFmtIdOffset ( PropertyStorage_impl This,
FORMATIDOFFSET fmtOffset 
)
static

Definition at line 1547 of file stg_prop.c.

1549 {
1550  assert(fmtOffset);
1551  StorageUtl_WriteGUID((BYTE *)fmtOffset, 0, &This->fmtid);
1553  sizeof(PROPERTYSETHEADER) + sizeof(FORMATIDOFFSET));
1554 }
#define assert(x)
Definition: debug.h:53
void StorageUtl_WriteGUID(BYTE *buffer, ULONG offset, const GUID *value)
Definition: storage32.c:7009
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966

Referenced by PropertyStorage_WriteHeadersToStream().

◆ PropertyStorage_MakeHeader()

static void PropertyStorage_MakeHeader ( PropertyStorage_impl This,
PROPERTYSETHEADER hdr 
)
static

Definition at line 1535 of file stg_prop.c.

1537 {
1538  assert(hdr);
1539  StorageUtl_WriteWord((BYTE *)&hdr->wByteOrder, 0,
1541  StorageUtl_WriteWord((BYTE *)&hdr->wFormat, 0, This->format);
1542  StorageUtl_WriteDWord((BYTE *)&hdr->dwOSVer, 0, This->originatorOS);
1543  StorageUtl_WriteGUID((BYTE *)&hdr->clsid, 0, &This->clsid);
1544  StorageUtl_WriteDWord((BYTE *)&hdr->reserved, 0, 1);
1545 }
char hdr[14]
Definition: iptest.cpp:33
#define assert(x)
Definition: debug.h:53
#define PROPSETHDR_BYTEORDER_MAGIC
Definition: stg_prop.c:76
void StorageUtl_WriteGUID(BYTE *buffer, ULONG offset, const GUID *value)
Definition: storage32.c:7009
void StorageUtl_WriteWord(BYTE *buffer, ULONG offset, WORD value)
Definition: storage32.c:6952
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966

Referenced by PropertyStorage_WriteHeadersToStream().

◆ PropertyStorage_MakePropertyIdOffset()

static void PropertyStorage_MakePropertyIdOffset ( DWORD  propid,
DWORD  dwOffset,
PROPERTYIDOFFSET propIdOffset 
)
static

Definition at line 1565 of file stg_prop.c.

1567 {
1568  assert(propIdOffset);
1569  StorageUtl_WriteDWord((BYTE *)propIdOffset, 0, propid);
1570  StorageUtl_WriteDWord((BYTE *)propIdOffset,
1572 }
#define assert(x)
Definition: debug.h:53
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966

Referenced by PropertyStorage_WriteDictionaryToStream(), and PropertyStorage_WritePropertyToStream().

◆ PropertyStorage_MakeSectionHdr()

static void PropertyStorage_MakeSectionHdr ( DWORD  cbSection,
DWORD  numProps,
PROPERTYSECTIONHEADER hdr 
)
static

Definition at line 1556 of file stg_prop.c.

1558 {
1559  assert(hdr);
1560  StorageUtl_WriteDWord((BYTE *)hdr, 0, cbSection);
1562  offsetof(PROPERTYSECTIONHEADER, cProperties), numProps);
1563 }
char hdr[14]
Definition: iptest.cpp:33
#define assert(x)
Definition: debug.h:53
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966

Referenced by PropertyStorage_WriteToStream().

◆ PropertyStorage_PropCompare()

static int PropertyStorage_PropCompare ( const void a,
const void b,
void extra 
)
static

Definition at line 965 of file stg_prop.c.

967 {
968  TRACE("(%d, %d)\n", PtrToUlong(a), PtrToUlong(b));
969  return PtrToUlong(a) - PtrToUlong(b);
970 }
#define PtrToUlong(u)
Definition: config.h:107
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropertiesWriter()

static BOOL PropertyStorage_PropertiesWriter ( const void key,
const void value,
void extra,
void closure 
)
static

Definition at line 1875 of file stg_prop.c.

1877 {
1879  struct PropertyClosure *c = closure;
1880 
1881  assert(key);
1882  assert(value);
1883  assert(extra);
1884  assert(closure);
1885  c->hr = PropertyStorage_WritePropertyToStream(This, c->propNum++,
1886  PtrToUlong(key), value, c->sectionOffset);
1887  return SUCCEEDED(c->hr);
1888 }
#define assert(x)
Definition: debug.h:53
#define PtrToUlong(u)
Definition: config.h:107
Definition: id3.c:18
const GLubyte * c
Definition: glext.h:8905
static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This, DWORD propNum, DWORD propid, const PROPVARIANT *var, DWORD *sectionOffset)
Definition: stg_prop.c:1716
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:42

Referenced by PropertyStorage_WritePropertiesToStream().

◆ PropertyStorage_PropertyDestroy()

static void PropertyStorage_PropertyDestroy ( void k,
void d,
void extra 
)
static

Definition at line 972 of file stg_prop.c.

973 {
975  HeapFree(GetProcessHeap(), 0, d);
976 }
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
#define GetProcessHeap()
Definition: compat.h:395
#define d
Definition: ke_i.h:81
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropNameCompare()

static int PropertyStorage_PropNameCompare ( const void a,
const void b,
void extra 
)
static

Definition at line 937 of file stg_prop.c.

939 {
941 
942  if (This->codePage == CP_UNICODE)
943  {
944  TRACE("(%s, %s)\n", debugstr_w(a), debugstr_w(b));
945  if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
946  return lstrcmpW(a, b);
947  else
948  return lstrcmpiW(a, b);
949  }
950  else
951  {
952  TRACE("(%s, %s)\n", debugstr_a(a), debugstr_a(b));
953  if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
954  return lstrcmpA(a, b);
955  else
956  return lstrcmpiA(a, b);
957  }
958 }
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define debugstr_w
Definition: kernel32.h:32
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
Definition: id3.c:18
#define debugstr_a
Definition: kernel32.h:31
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define CP_UNICODE
Definition: stg_prop.c:81

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropNameDestroy()

static void PropertyStorage_PropNameDestroy ( void k,
void d,
void extra 
)
static

Definition at line 960 of file stg_prop.c.

961 {
962  CoTaskMemFree(k);
963 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
int k
Definition: mpi.c:3369

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropVariantCopy()

static HRESULT PropertyStorage_PropVariantCopy ( PROPVARIANT *  prop,
const PROPVARIANT *  propvar,
LCID  targetCP,
LCID  srcCP 
)
static

Definition at line 445 of file stg_prop.c.

447 {
448  HRESULT hr = S_OK;
449 
450  assert(prop);
451  assert(propvar);
452  if (propvar->vt == VT_LPSTR)
453  {
454  hr = PropertyStorage_StringCopy(propvar->u.pszVal, srcCP,
455  &prop->u.pszVal, targetCP);
456  if (SUCCEEDED(hr))
457  prop->vt = VT_LPSTR;
458  }
459  else
460  PropVariantCopy(prop, propvar);
461  return hr;
462 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3068
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:361
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertyStorage_fnReadMultiple(), and PropertyStorage_StorePropWithId().

◆ PropertyStorage_ReadDictionary()

static HRESULT PropertyStorage_ReadDictionary ( PropertyStorage_impl This,
BYTE ptr 
)
static

Definition at line 1001 of file stg_prop.c.

1003 {
1004  DWORD numEntries, i;
1005  HRESULT hr = S_OK;
1006 
1007  assert(This->name_to_propid);
1008  assert(This->propid_to_name);
1009 
1010  StorageUtl_ReadDWord(ptr, 0, &numEntries);
1011  TRACE("Reading %d entries:\n", numEntries);
1012  ptr += sizeof(DWORD);
1013  for (i = 0; SUCCEEDED(hr) && i < numEntries; i++)
1014  {
1015  PROPID propid;
1016  DWORD cbEntry;
1017 
1018  StorageUtl_ReadDWord(ptr, 0, &propid);
1019  ptr += sizeof(PROPID);
1020  StorageUtl_ReadDWord(ptr, 0, &cbEntry);
1021  ptr += sizeof(DWORD);
1022  TRACE("Reading entry with ID 0x%08x, %d bytes\n", propid, cbEntry);
1023  /* Make sure the source string is NULL-terminated */
1024  if (This->codePage != CP_UNICODE)
1025  ptr[cbEntry - 1] = '\0';
1026  else
1027  ((LPWSTR)ptr)[cbEntry - 1] = 0;
1028  hr = PropertyStorage_StoreNameWithId(This, (char*)ptr, This->codePage, propid);
1029  if (This->codePage == CP_UNICODE)
1030  {
1031  /* cbEntry is the number of characters */
1032  cbEntry *= 2;
1033 
1034  /* Unicode entries are padded to DWORD boundaries */
1035  if (cbEntry % sizeof(DWORD))
1036  ptr += sizeof(DWORD) - (cbEntry % sizeof(DWORD));
1037  }
1038  ptr += cbEntry;
1039  }
1040  return hr;
1041 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
static const CLSID IPropertyStorage UINT *static const PROPSPEC PROPVARIANT *static UINT const PROPSPEC PROPVARIANT PROPID
Definition: shellole.c:77
static HRESULT PropertyStorage_StoreNameWithId(PropertyStorage_impl *This, LPCSTR srcName, LCID cp, PROPID id)
Definition: stg_prop.c:526
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6958
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropertyStorage_ReadFromStream().

◆ PropertyStorage_ReadFmtIdOffsetFromStream()

static HRESULT PropertyStorage_ReadFmtIdOffsetFromStream ( IStream stm,
FORMATIDOFFSET fmt 
)
static

Definition at line 1287 of file stg_prop.c.

1289 {
1290  BYTE buf[sizeof(FORMATIDOFFSET)];
1291  ULONG count = 0;
1292  HRESULT hr;
1293 
1294  assert(stm);
1295  assert(fmt);
1296  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1297  if (SUCCEEDED(hr))
1298  {
1299  if (count != sizeof(buf))
1300  {
1301  WARN("read only %d\n", count);
1303  }
1304  else
1305  {
1307  &fmt->fmtid);
1309  &fmt->dwOffset);
1310  }
1311  }
1312  TRACE("returning 0x%08x\n", hr);
1313  return hr;
1314 }
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define assert(x)
Definition: debug.h:53
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define offsetof(TYPE, MEMBER)
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned char BYTE
Definition: mem.h:68
struct tagFORMATIDOFFSET FORMATIDOFFSET
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6958
void StorageUtl_ReadGUID(const BYTE *buffer, ULONG offset, GUID *value)
Definition: storage32.c:7000
unsigned int ULONG
Definition: retypes.h:1
Definition: dsound.c:943
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropertyStorage_ReadFromStream().

◆ PropertyStorage_ReadFromStream()

static HRESULT PropertyStorage_ReadFromStream ( PropertyStorage_impl This)
static

Definition at line 1345 of file stg_prop.c.

1346 {
1348  FORMATIDOFFSET fmtOffset;
1349  PROPERTYSECTIONHEADER sectionHdr;
1351  ULONG i;
1352  STATSTG stat;
1353  HRESULT hr;
1354  BYTE *buf = NULL;
1355  ULONG count = 0;
1356  DWORD dictOffset = 0;
1357 
1358  This->dirty = FALSE;
1359  This->highestProp = 0;
1360  hr = IStream_Stat(This->stm, &stat, STATFLAG_NONAME);
1361  if (FAILED(hr))
1362  goto end;
1363  if (stat.cbSize.u.HighPart)
1364  {
1365  WARN("stream too big\n");
1366  /* maximum size varies, but it can't be this big */
1368  goto end;
1369  }
1370  if (stat.cbSize.u.LowPart == 0)
1371  {
1372  /* empty stream is okay */
1373  hr = S_OK;
1374  goto end;
1375  }
1376  else if (stat.cbSize.u.LowPart < sizeof(PROPERTYSETHEADER) +
1377  sizeof(FORMATIDOFFSET))
1378  {
1379  WARN("stream too small\n");
1381  goto end;
1382  }
1383  seek.QuadPart = 0;
1384  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1385  if (FAILED(hr))
1386  goto end;
1388  /* I've only seen reserved == 1, but the article says I shouldn't disallow
1389  * higher values.
1390  */
1391  if (hdr.wByteOrder != PROPSETHDR_BYTEORDER_MAGIC || hdr.reserved < 1)
1392  {
1393  WARN("bad magic in prop set header\n");
1395  goto end;
1396  }
1397  if (hdr.wFormat != 0 && hdr.wFormat != 1)
1398  {
1399  WARN("bad format version %d\n", hdr.wFormat);
1401  goto end;
1402  }
1403  This->format = hdr.wFormat;
1404  This->clsid = hdr.clsid;
1405  This->originatorOS = hdr.dwOSVer;
1406  if (PROPSETHDR_OSVER_KIND(hdr.dwOSVer) == PROPSETHDR_OSVER_KIND_MAC)
1407  WARN("File comes from a Mac, strings will probably be screwed up\n");
1409  if (FAILED(hr))
1410  goto end;
1411  if (fmtOffset.dwOffset > stat.cbSize.u.LowPart)
1412  {
1413  WARN("invalid offset %d (stream length is %d)\n", fmtOffset.dwOffset,
1414  stat.cbSize.u.LowPart);
1416  goto end;
1417  }
1418  /* wackiness alert: if the format ID is FMTID_DocSummaryInformation, there
1419  * follows not one, but two sections. The first contains the standard properties
1420  * for the document summary information, and the second consists of user-defined
1421  * properties. This is the only case in which multiple sections are
1422  * allowed.
1423  * Reading the second stream isn't implemented yet.
1424  */
1426  if (FAILED(hr))
1427  goto end;
1428  /* The section size includes the section header, so check it */
1429  if (sectionHdr.cbSection < sizeof(PROPERTYSECTIONHEADER))
1430  {
1431  WARN("section header too small, got %d\n", sectionHdr.cbSection);
1433  goto end;
1434  }
1435  buf = HeapAlloc(GetProcessHeap(), 0, sectionHdr.cbSection -
1436  sizeof(PROPERTYSECTIONHEADER));
1437  if (!buf)
1438  {
1440  goto end;
1441  }
1442  hr = IStream_Read(This->stm, buf, sectionHdr.cbSection -
1443  sizeof(PROPERTYSECTIONHEADER), &count);
1444  if (FAILED(hr))
1445  goto end;
1446  TRACE("Reading %d properties:\n", sectionHdr.cProperties);
1447  for (i = 0; SUCCEEDED(hr) && i < sectionHdr.cProperties; i++)
1448  {
1449  PROPERTYIDOFFSET *idOffset = (PROPERTYIDOFFSET *)(buf +
1450  i * sizeof(PROPERTYIDOFFSET));
1451 
1452  if (idOffset->dwOffset < sizeof(PROPERTYSECTIONHEADER) ||
1453  idOffset->dwOffset > sectionHdr.cbSection - sizeof(DWORD))
1455  else
1456  {
1457  if (idOffset->propid >= PID_FIRST_USABLE &&
1458  idOffset->propid < PID_MIN_READONLY && idOffset->propid >
1459  This->highestProp)
1460  This->highestProp = idOffset->propid;
1461  if (idOffset->propid == PID_DICTIONARY)
1462  {
1463  /* Don't read the dictionary yet, its entries depend on the
1464  * code page. Just store the offset so we know to read it
1465  * later.
1466  */
1467  dictOffset = idOffset->dwOffset;
1468  TRACE("Dictionary offset is %d\n", dictOffset);
1469  }
1470  else
1471  {
1472  PROPVARIANT prop;
1473 
1474  PropVariantInit(&prop);
1476  buf + idOffset->dwOffset - sizeof(PROPERTYSECTIONHEADER),
1477  This->codePage, Allocate_CoTaskMemAlloc, NULL)))
1478  {
1479  TRACE("Read property with ID 0x%08x, type %d\n",
1480  idOffset->propid, prop.vt);
1481  switch(idOffset->propid)
1482  {
1483  case PID_CODEPAGE:
1484  if (prop.vt == VT_I2)
1485  This->codePage = (UINT)prop.u.iVal;
1486  break;
1487  case PID_LOCALE:
1488  if (prop.vt == VT_I4)
1489  This->locale = (LCID)prop.u.lVal;
1490  break;
1491  case PID_BEHAVIOR:
1492  if (prop.vt == VT_I4 && prop.u.lVal)
1493  This->grfFlags |= PROPSETFLAG_CASE_SENSITIVE;
1494  /* The format should already be 1, but just in case */
1495  This->format = 1;
1496  break;
1497  default:
1499  idOffset->propid, &prop, This->codePage);
1500  }
1501  }
1502  PropVariantClear(&prop);
1503  }
1504  }
1505  }
1506  if (!This->codePage)
1507  {
1508  /* default to Unicode unless told not to, as specified on msdn */
1509  if (This->grfFlags & PROPSETFLAG_ANSI)
1510  This->codePage = GetACP();
1511  else
1512  This->codePage = CP_UNICODE;
1513  }
1514  if (!This->locale)
1515  This->locale = LOCALE_SYSTEM_DEFAULT;
1516  TRACE("Code page is %d, locale is %d\n", This->codePage, This->locale);
1517  if (dictOffset)
1519  buf + dictOffset - sizeof(PROPERTYSECTIONHEADER));
1520 
1521 end:
1522  HeapFree(GetProcessHeap(), 0, buf);
1523  if (FAILED(hr))
1524  {
1525  dictionary_destroy(This->name_to_propid);
1526  This->name_to_propid = NULL;
1527  dictionary_destroy(This->propid_to_name);
1528  This->propid_to_name = NULL;
1529  dictionary_destroy(This->propid_to_prop);
1530  This->propid_to_prop = NULL;
1531  }
1532  return hr;
1533 }
char hdr[14]
Definition: iptest.cpp:33
#define PROPSETHDR_OSVER_KIND_MAC
Definition: stg_prop.c:78
Definition: compat.h:1939
HRESULT hr
Definition: shlfolder.c:183
#define STG_E_INVALIDPOINTER
Definition: winerror.h:2571
#define PID_BEHAVIOR
Definition: stg_prop.c:24
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT PropertyStorage_ReadSectionHeaderFromStream(IStream *stm, PROPERTYSECTIONHEADER *hdr)
Definition: stg_prop.c:1316
static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const BYTE *data, UINT codepage, void *(__thiscall_wrapper *allocate)(void *this, ULONG size), void *allocate_data)
Definition: stg_prop.c:1057
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
DWORD LCID
Definition: nls.h:13
GLuint GLuint end
Definition: gl.h:1545
#define PROPSETHDR_BYTEORDER_MAGIC
Definition: stg_prop.c:76
#define PID_CODEPAGE
Definition: suminfo.c:43
#define PID_FIRST_USABLE
Definition: propkeydef.h:20
static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This, PROPID propid, const PROPVARIANT *propvar, LCID lcid)
Definition: stg_prop.c:471
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HRESULT PropertyStorage_ReadFmtIdOffsetFromStream(IStream *stm, FORMATIDOFFSET *fmt)
Definition: stg_prop.c:1287
static void *__thiscall_wrapper Allocate_CoTaskMemAlloc(void *this, ULONG size)
Definition: stg_prop.c:1049
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
DWORD dwOffset
Definition: suminfo.c:56
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
#define LOCALE_SYSTEM_DEFAULT
unsigned long DWORD
Definition: ntddk_ex.h:95
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
Definition: stat.h:55
static HRESULT PropertyStorage_ReadHeaderFromStream(IStream *stm, PROPERTYSETHEADER *hdr)
Definition: stg_prop.c:1252
unsigned char BYTE
Definition: mem.h:68
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
void dictionary_destroy(struct dictionary *d)
Definition: dictionary.c:65
unsigned int UINT
Definition: ndis.h:50
DWORD dwOffset
Definition: suminfo.c:66
#define PID_DICTIONARY
Definition: suminfo.c:42
unsigned int ULONG
Definition: retypes.h:1
DWORD propid
Definition: suminfo.c:65
static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This, BYTE *ptr)
Definition: stg_prop.c:1001
#define CP_UNICODE
Definition: stg_prop.c:81
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: compat.h:1938
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertyStorage_fnRevert(), and PropertyStorage_ConstructFromStream().

◆ PropertyStorage_ReadHeaderFromStream()

static HRESULT PropertyStorage_ReadHeaderFromStream ( IStream stm,
PROPERTYSETHEADER hdr 
)
static

Definition at line 1252 of file stg_prop.c.

1254 {
1255  BYTE buf[sizeof(PROPERTYSETHEADER)];
1256  ULONG count = 0;
1257  HRESULT hr;
1258 
1259  assert(stm);
1260  assert(hdr);
1261  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1262  if (SUCCEEDED(hr))
1263  {
1264  if (count != sizeof(buf))
1265  {
1266  WARN("read only %d\n", count);
1268  }
1269  else
1270  {
1272  &hdr->wByteOrder);
1274  &hdr->wFormat);
1276  &hdr->dwOSVer);
1278  &hdr->clsid);
1280  &hdr->reserved);
1281  }
1282  }
1283  TRACE("returning 0x%08x\n", hr);
1284  return hr;
1285 }
void StorageUtl_ReadWord(const BYTE *buffer, ULONG offset, WORD *value)
Definition: storage32.c:6944
char hdr[14]
Definition: iptest.cpp:33
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define assert(x)
Definition: debug.h:53
r reserved
Definition: btrfs.c:2704
#define offsetof(TYPE, MEMBER)
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6958
void StorageUtl_ReadGUID(const BYTE *buffer, ULONG offset, GUID *value)
Definition: storage32.c:7000
unsigned int ULONG
Definition: retypes.h:1
struct tagPROPERTYSETHEADER PROPERTYSETHEADER
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropertyStorage_ReadFromStream().

◆ PropertyStorage_ReadProperty()

static HRESULT PropertyStorage_ReadProperty ( PROPVARIANT *  prop,
const BYTE data,
UINT  codepage,
void __thiscall_wrapper *allocate)(void *this, ULONG size,
void allocate_data 
)
static

Definition at line 1057 of file stg_prop.c.

1059 {
1060  HRESULT hr = S_OK;
1061  DWORD vt;
1062 
1063  assert(prop);
1064  assert(data);
1066  data += sizeof(DWORD);
1067  prop->vt = vt;
1068  switch (prop->vt)
1069  {
1070  case VT_EMPTY:
1071  case VT_NULL:
1072  break;
1073  case VT_I1:
1074  prop->u.cVal = *(const char *)data;
1075  TRACE("Read char 0x%x ('%c')\n", prop->u.cVal, prop->u.cVal);
1076  break;
1077  case VT_UI1:
1078  prop->u.bVal = *data;
1079  TRACE("Read byte 0x%x\n", prop->u.bVal);
1080  break;
1081  case VT_BOOL:
1082  StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.boolVal);
1083  TRACE("Read bool %d\n", prop->u.boolVal);
1084  break;
1085  case VT_I2:
1086  StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.iVal);
1087  TRACE("Read short %d\n", prop->u.iVal);
1088  break;
1089  case VT_UI2:
1090  StorageUtl_ReadWord(data, 0, &prop->u.uiVal);
1091  TRACE("Read ushort %d\n", prop->u.uiVal);
1092  break;
1093  case VT_INT:
1094  case VT_I4:
1095  StorageUtl_ReadDWord(data, 0, (DWORD*)&prop->u.lVal);
1096  TRACE("Read long %d\n", prop->u.lVal);
1097  break;
1098  case VT_UINT:
1099  case VT_UI4:
1100  StorageUtl_ReadDWord(data, 0, &prop->u.ulVal);
1101  TRACE("Read ulong %d\n", prop->u.ulVal);
1102  break;
1103  case VT_I8:
1104  StorageUtl_ReadULargeInteger(data, 0, (ULARGE_INTEGER *)&prop->u.hVal);
1105  TRACE("Read long long %s\n", wine_dbgstr_longlong(prop->u.hVal.QuadPart));
1106  break;
1107  case VT_UI8:
1108  StorageUtl_ReadULargeInteger(data, 0, &prop->u.uhVal);
1109  TRACE("Read ulong long %s\n", wine_dbgstr_longlong(prop->u.uhVal.QuadPart));
1110  break;
1111  case VT_R8:
1112  memcpy(&prop->u.dblVal, data, sizeof(double));
1113  TRACE("Read double %f\n", prop->u.dblVal);
1114  break;
1115  case VT_LPSTR:
1116  {
1117  DWORD count;
1118 
1120  if (codepage == CP_UNICODE && count % 2)
1121  {
1122  WARN("Unicode string has odd number of bytes\n");
1124  }
1125  else
1126  {
1127  prop->u.pszVal = allocate(allocate_data, count);
1128  if (prop->u.pszVal)
1129  {
1130  memcpy(prop->u.pszVal, data + sizeof(DWORD), count);
1131  /* This is stored in the code page specified in codepage.
1132  * Don't convert it, the caller will just store it as-is.
1133  */
1134  if (codepage == CP_UNICODE)
1135  {
1136  /* Make sure it's NULL-terminated */
1137  prop->u.pszVal[count / sizeof(WCHAR) - 1] = '\0';
1138  TRACE("Read string value %s\n",
1139  debugstr_w(prop->u.pwszVal));
1140  }
1141  else
1142  {
1143  /* Make sure it's NULL-terminated */
1144  prop->u.pszVal[count - 1] = '\0';
1145  TRACE("Read string value %s\n", debugstr_a(prop->u.pszVal));
1146  }
1147  }
1148  else
1150  }
1151  break;
1152  }
1153  case VT_BSTR:
1154  {
1155  DWORD count, wcount;
1156 
1158  if (codepage == CP_UNICODE && count % 2)
1159  {
1160  WARN("Unicode string has odd number of bytes\n");
1162  }
1163  else
1164  {
1165  if (codepage == CP_UNICODE)
1166  wcount = count / 2;
1167  else
1168  wcount = MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, NULL, 0);
1169 
1170  prop->u.bstrVal = SysAllocStringLen(NULL, wcount); /* FIXME: use allocator? */
1171 
1172  if (prop->u.bstrVal)
1173  {
1174  if (codepage == CP_UNICODE)
1175  memcpy(prop->u.bstrVal, data + sizeof(DWORD), count);
1176  else
1177  MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, prop->u.bstrVal, wcount);
1178 
1179  prop->u.bstrVal[wcount - 1] = '\0';
1180  TRACE("Read string value %s\n", debugstr_w(prop->u.bstrVal));
1181  }
1182  else
1184  }
1185  break;
1186  }
1187  case VT_BLOB:
1188  {
1189  DWORD count;
1190 
1192  prop->u.blob.cbSize = count;
1193  prop->u.blob.pBlobData = allocate(allocate_data, count);
1194  if (prop->u.blob.pBlobData)
1195  {
1196  memcpy(prop->u.blob.pBlobData, data + sizeof(DWORD), count);
1197  TRACE("Read blob value of size %d\n", count);
1198  }
1199  else
1201  break;
1202  }
1203  case VT_LPWSTR:
1204  {
1205  DWORD count;
1206 
1208  prop->u.pwszVal = allocate(allocate_data, count * sizeof(WCHAR));
1209  if (prop->u.pwszVal)
1210  {
1211  memcpy(prop->u.pwszVal, data + sizeof(DWORD),
1212  count * sizeof(WCHAR));
1213  /* make sure string is NULL-terminated */
1214  prop->u.pwszVal[count - 1] = '\0';
1215  PropertyStorage_ByteSwapString(prop->u.pwszVal, count);
1216  TRACE("Read string value %s\n", debugstr_w(prop->u.pwszVal));
1217  }
1218  else
1220  break;
1221  }
1222  case VT_FILETIME:
1224  (ULARGE_INTEGER *)&prop->u.filetime);
1225  break;
1226  case VT_CF:
1227  {
1228  DWORD len = 0, tag = 0;
1229 
1232  if (len > 8)
1233  {
1234  len -= 8;
1235  prop->u.pclipdata = allocate(allocate_data, sizeof (CLIPDATA));
1236  prop->u.pclipdata->cbSize = len;
1237  prop->u.pclipdata->ulClipFmt = tag;
1238  prop->u.pclipdata->pClipData = allocate(allocate_data, len - sizeof(prop->u.pclipdata->ulClipFmt));
1239  memcpy(prop->u.pclipdata->pClipData, data+8, len - sizeof(prop->u.pclipdata->ulClipFmt));
1240  }
1241  else
1243  }
1244  break;
1245  default:
1246  FIXME("unsupported type %d\n", prop->vt);
1248  }
1249  return hr;
1250 }
void StorageUtl_ReadWord(const BYTE *buffer, ULONG offset, WORD *value)
Definition: storage32.c:6944
Definition: compat.h:1939
Definition: compat.h:1955
HRESULT hr
Definition: shlfolder.c:183
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
Definition: compat.h:1951
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define assert(x)
Definition: debug.h:53
Definition: ecma_167.h:138
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
int codepage
Definition: win_iconv.c:156
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
Definition: compat.h:1977
#define PropertyStorage_ByteSwapString(s, l)
Definition: stg_prop.c:993
#define S_OK
Definition: intsafe.h:59
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6958
void StorageUtl_ReadULargeInteger(const BYTE *buffer, ULONG offset, ULARGE_INTEGER *value)
Definition: storage32.c:6972
#define MultiByteToWideChar
Definition: compat.h:100
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define CP_UNICODE
Definition: stg_prop.c:81
Definition: compat.h:1941
Definition: compat.h:1938
char * tag
Definition: main.c:59

Referenced by PropertyStorage_ReadFromStream(), and StgConvertPropertyToVariant().

◆ PropertyStorage_ReadSectionHeaderFromStream()

static HRESULT PropertyStorage_ReadSectionHeaderFromStream ( IStream stm,
PROPERTYSECTIONHEADER hdr 
)
static

Definition at line 1316 of file stg_prop.c.

1318 {
1319  BYTE buf[sizeof(PROPERTYSECTIONHEADER)];
1320  ULONG count = 0;
1321  HRESULT hr;
1322 
1323  assert(stm);
1324  assert(hdr);
1325  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1326  if (SUCCEEDED(hr))
1327  {
1328  if (count != sizeof(buf))
1329  {
1330  WARN("read only %d\n", count);
1332  }
1333  else
1334  {
1336  cbSection), &hdr->cbSection);
1338  cProperties), &hdr->cProperties);
1339  }
1340  }
1341  TRACE("returning 0x%08x\n", hr);
1342  return hr;
1343 }
char hdr[14]
Definition: iptest.cpp:33
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define assert(x)
Definition: debug.h:53
struct tagPROPERTYSECTIONHEADER PROPERTYSECTIONHEADER
#define offsetof(TYPE, MEMBER)
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned char BYTE
Definition: mem.h:68
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6958
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropertyStorage_ReadFromStream().

◆ PropertyStorage_StoreNameWithId()

static HRESULT PropertyStorage_StoreNameWithId ( PropertyStorage_impl This,
LPCSTR  srcName,
LCID  cp,
PROPID  id 
)
static

Definition at line 526 of file stg_prop.c.

528 {
529  LPSTR name;
530  HRESULT hr;
531 
532  assert(srcName);
533 
534  hr = PropertyStorage_StringCopy(srcName, cp, &name, This->codePage);
535  if (SUCCEEDED(hr))
536  {
537  if (This->codePage == CP_UNICODE)
538  {
540  This->format = 1;
541  }
542  else
543  {
545  This->format = 1;
546  }
547  TRACE("Adding prop name %s, propid %d\n",
548  This->codePage == CP_UNICODE ? debugstr_w((LPCWSTR)name) :
549  debugstr_a(name), id);
550  dictionary_insert(This->name_to_propid, name, UlongToPtr(id));
551  dictionary_insert(This->propid_to_name, UlongToPtr(id), name);
552  }
553  return hr;
554 }
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define assert(x)
Definition: debug.h:53
#define MAX_VERSION_0_PROP_NAME_LENGTH
Definition: stg_prop.c:83
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
void dictionary_insert(struct dictionary *d, const void *k, const void *v)
Definition: dictionary.c:113
POINT cp
Definition: magnifier.c:59
Definition: name.c:36
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:361
#define CP_UNICODE
Definition: stg_prop.c:81
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by IPropertyStorage_fnWriteMultiple(), IPropertyStorage_fnWritePropertyNames(), and PropertyStorage_ReadDictionary().

◆ PropertyStorage_StorePropWithId()

static HRESULT PropertyStorage_StorePropWithId ( PropertyStorage_impl This,
PROPID  propid,
const PROPVARIANT *  propvar,
LCID  lcid 
)
static

Definition at line 471 of file stg_prop.c.

473 {
474  HRESULT hr = S_OK;
475  PROPVARIANT *prop = PropertyStorage_FindProperty(This, propid);
476 
477  assert(propvar);
478  if (propvar->vt & VT_BYREF || propvar->vt & VT_ARRAY)
479  This->format = 1;
480  switch (propvar->vt)
481  {
482  case VT_DECIMAL:
483  case VT_I1:
484  case VT_INT:
485  case VT_UINT:
486  case VT_VECTOR|VT_I1:
487  This->format = 1;
488  }
489  TRACE("Setting 0x%08x to type %d\n", propid, propvar->vt);
490  if (prop)
491  {
492  PropVariantClear(prop);
493  hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
494  lcid);
495  }
496  else
497  {
499  sizeof(PROPVARIANT));
500  if (prop)
501  {
502  hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
503  lcid);
504  if (SUCCEEDED(hr))
505  {
506  dictionary_insert(This->propid_to_prop, UlongToPtr(propid), prop);
507  if (propid > This->highestProp)
508  This->highestProp = propid;
509  }
510  else
511  HeapFree(GetProcessHeap(), 0, prop);
512  }
513  else
515  }
516  return hr;
517 }
static PROPVARIANT * PropertyStorage_FindProperty(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:248
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1951
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
#define assert(x)
Definition: debug.h:53
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop, const PROPVARIANT *propvar, LCID targetCP, LCID srcCP)
Definition: stg_prop.c:445
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
void dictionary_insert(struct dictionary *d, const void *k, const void *v)
Definition: dictionary.c:113
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IPropertyStorage_fnWriteMultiple(), and PropertyStorage_ReadFromStream().

◆ PropertyStorage_StringCopy()

static HRESULT PropertyStorage_StringCopy ( LPCSTR  src,
LCID  srcCP,
LPSTR dst,
LCID  targetCP 
)
static

Definition at line 361 of file stg_prop.c.

363 {
364  HRESULT hr = S_OK;
365  int len;
366 
367  TRACE("%s, %p, %d, %d\n",
368  srcCP == CP_UNICODE ? debugstr_w((LPCWSTR)src) : debugstr_a(src), dst,
369  dstCP, srcCP);
370  assert(src);
371  assert(dst);
372  *dst = NULL;
373  if (dstCP == srcCP)
374  {
375  size_t len;
376 
377  if (dstCP == CP_UNICODE)
378  len = (strlenW((LPCWSTR)src) + 1) * sizeof(WCHAR);
379  else
380  len = strlen(src) + 1;
381  *dst = CoTaskMemAlloc(len * sizeof(WCHAR));
382  if (!*dst)
384  else
385  memcpy(*dst, src, len);
386  }
387  else
388  {
389  if (dstCP == CP_UNICODE)
390  {
391  len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
392  *dst = CoTaskMemAlloc(len * sizeof(WCHAR));
393  if (!*dst)
395  else
396  MultiByteToWideChar(srcCP, 0, src, -1, (LPWSTR)*dst, len);
397  }
398  else
399  {
400  LPCWSTR wideStr = NULL;
401  LPWSTR wideStr_tmp = NULL;
402 
403  if (srcCP == CP_UNICODE)
404  wideStr = (LPCWSTR)src;
405  else
406  {
407  len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
408  wideStr_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
409  if (wideStr_tmp)
410  {
411  MultiByteToWideChar(srcCP, 0, src, -1, wideStr_tmp, len);
412  wideStr = wideStr_tmp;
413  }
414  else
416  }
417  if (SUCCEEDED(hr))
418  {
419  len = WideCharToMultiByte(dstCP, 0, wideStr, -1, NULL, 0,
420  NULL, NULL);
421  *dst = CoTaskMemAlloc(len);
422  if (!*dst)
424  else
425  {
426  BOOL defCharUsed = FALSE;
427 
428  if (WideCharToMultiByte(dstCP, 0, wideStr, -1, *dst, len,
429  NULL, &defCharUsed) == 0 || defCharUsed)
430  {
431  CoTaskMemFree(*dst);
432  *dst = NULL;
434  }
435  }
436  }
437  HeapFree(GetProcessHeap(), 0, wideStr_tmp);
438  }
439  }
440  TRACE("returning 0x%08x (%s)\n", hr,
441  dstCP == CP_UNICODE ? debugstr_w((LPCWSTR)*dst) : debugstr_a(*dst));
442  return hr;
443 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define assert(x)
Definition: debug.h:53
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
#define ERROR_NO_UNICODE_TRANSLATION
Definition: winerror.h:649
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CP_UNICODE
Definition: stg_prop.c:81
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropertyStorage_FindPropertyByName(), PropertyStorage_PropVariantCopy(), and PropertyStorage_StoreNameWithId().

◆ PropertyStorage_WriteDictionaryToStream()

static HRESULT PropertyStorage_WriteDictionaryToStream ( PropertyStorage_impl This,
DWORD sectionOffset 
)
static

Definition at line 1661 of file stg_prop.c.

1663 {
1664  HRESULT hr;
1666  PROPERTYIDOFFSET propIdOffset;
1667  ULONG count;
1668  DWORD dwTemp;
1669  struct DictionaryClosure closure;
1670 
1671  assert(sectionOffset);
1672 
1673  /* The dictionary's always the first property written, so seek to its
1674  * spot.
1675  */
1676  seek.QuadPart = SECTIONHEADER_OFFSET + sizeof(PROPERTYSECTIONHEADER);
1677  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1678  if (FAILED(hr))
1679  goto end;
1681  &propIdOffset);
1682  hr = IStream_Write(This->stm, &propIdOffset, sizeof(propIdOffset), &count);
1683  if (FAILED(hr))
1684  goto end;
1685 
1686  seek.QuadPart = SECTIONHEADER_OFFSET + *sectionOffset;
1687  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1688  if (FAILED(hr))
1689  goto end;
1690  StorageUtl_WriteDWord((LPBYTE)&dwTemp, 0,
1691  dictionary_num_entries(This->name_to_propid));
1692  hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
1693  if (FAILED(hr))
1694  goto end;
1695  *sectionOffset += sizeof(dwTemp);
1696 
1697  closure.hr = S_OK;
1698  closure.bytesWritten = 0;
1700  &closure);
1701  hr = closure.hr;
1702  if (FAILED(hr))
1703  goto end;
1704  *sectionOffset += closure.bytesWritten;
1705  if (closure.bytesWritten % sizeof(DWORD))
1706  {
1707  DWORD padding = sizeof(DWORD) - closure.bytesWritten % sizeof(DWORD);
1708  TRACE("adding %d bytes of padding\n", padding);
1709  *sectionOffset += padding;
1710  }
1711 
1712 end:
1713  return hr;
1714 }
static BOOL PropertyStorage_DictionaryWriter(const void *key, const void *value, void *extra, void *closure)
Definition: stg_prop.c:1599
HRESULT hr
Definition: shlfolder.c:183
UINT dictionary_num_entries(struct dictionary *d)
Definition: dictionary.c:85
GLuint GLuint GLsizei count
Definition: gl.h:1545
void dictionary_enumerate(struct dictionary *d, enumeratefunc e, void *closure)
Definition: dictionary.c:179
#define assert(x)
Definition: debug.h:53
GLuint GLuint end
Definition: gl.h:1545
unsigned char * LPBYTE
Definition: typedefs.h:52
struct tagPROPERTYSECTIONHEADER PROPERTYSECTIONHEADER
smooth NULL
Definition: ftsmooth.c:416
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int padding
Definition: isohybrid.c:50
LONG HRESULT
Definition: typedefs.h:77
#define SECTIONHEADER_OFFSET
Definition: stg_prop.c:1656
unsigned long DWORD
Definition: ntddk_ex.h:95
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6966
static void PropertyStorage_MakePropertyIdOffset(DWORD propid, DWORD dwOffset, PROPERTYIDOFFSET *propIdOffset)
Definition: stg_prop.c:1565
#define S_OK
Definition: intsafe.h:59
#define PID_DICTIONARY
Definition: suminfo.c:42
unsigned int ULONG
Definition: retypes.h:1

Referenced by PropertyStorage_WriteToStream().

◆ PropertyStorage_WriteHeadersToStream()

static HRESULT PropertyStorage_WriteHeadersToStream ( PropertyStorage_impl This)
static

Definition at line 1904 of file stg_prop.c.

1905 {
1906  HRESULT hr;
1907  ULONG count = 0;
1908  LARGE_INTEGER seek = { {0} };
1910  FORMATIDOFFSET fmtOffset;
1911 
1912  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1913  if (FAILED(hr))
1914  goto end;
1916  hr = IStream_Write(This->stm, &hdr, sizeof(hdr), &count);
1917  if (FAILED(hr))
1918  goto end;
1919  if (count != sizeof(hdr))
1920  {
1921  hr = STG_E_WRITEFAULT;
1922  goto end;
1923  }
1924 
1926  hr = IStream_Write(This->stm, &fmtOffset, sizeof(fmtOffset), &count);
1927  if (FAILED(hr))
1928  goto end;
1929  if (count != sizeof(fmtOffset))
1930  {
1931  hr = STG_E_WRITEFAULT;
1932  goto end;
1933  }
1934  hr = S_OK;
1935 
1936 end:
1937  return hr;
1938 }
#define STG_E_WRITEFAULT
Definition: winerror.h:2575
char hdr[14]
Definition: iptest.cpp:33
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void PropertyStorage_MakeFmtIdOffset(PropertyStorage_impl *This, FORMATIDOFFSET *fmtOffset)
Definition: stg_prop.c:1547
static void PropertyStorage_MakeHeader(PropertyStorage_impl *This, PROPERTYSETHEADER *hdr)
Definition: stg_prop.c:1535
GLuint GLuint end
Definition: gl.h:1545