ReactOS  0.4.15-dev-509-g96a357b
stg_prop.c File Reference
#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/asm.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 1039 of file stg_prop.c.

◆ BITS_IN_CHARMASK

#define BITS_IN_CHARMASK   5

Definition at line 2619 of file stg_prop.c.

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   8

Definition at line 2617 of file stg_prop.c.

◆ CFTAG_FMTID

#define CFTAG_FMTID   (-3L)

Definition at line 80 of file stg_prop.c.

◆ CFTAG_MACINTOSH

#define CFTAG_MACINTOSH   (-2L)

Definition at line 79 of file stg_prop.c.

◆ CFTAG_NODATA

#define CFTAG_NODATA   0L

Definition at line 81 of file stg_prop.c.

◆ CFTAG_WINDOWS

#define CFTAG_WINDOWS   (-1L)

Definition at line 78 of file stg_prop.c.

◆ CHARMASK

#define CHARMASK   0x1f

Definition at line 2618 of file stg_prop.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 45 of file stg_prop.c.

◆ CP_UNICODE

#define CP_UNICODE   1200

Definition at line 74 of file stg_prop.c.

◆ MAX_VERSION_0_PROP_NAME_LENGTH

#define MAX_VERSION_0_PROP_NAME_LENGTH   256

Definition at line 76 of file stg_prop.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 46 of file stg_prop.c.

◆ NUM_ALPHA_CHARS

#define NUM_ALPHA_CHARS   26

Definition at line 2620 of file stg_prop.c.

◆ PropertyStorage_ByteSwapString

#define PropertyStorage_ByteSwapString (   s,
  l 
)

Definition at line 986 of file stg_prop.c.

◆ PROPSETHDR_BYTEORDER_MAGIC

#define PROPSETHDR_BYTEORDER_MAGIC   0xfffe

Definition at line 69 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_MAC

#define PROPSETHDR_OSVER_KIND_MAC   1

Definition at line 71 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_WIN16

#define PROPSETHDR_OSVER_KIND_WIN16   0

Definition at line 70 of file stg_prop.c.

◆ PROPSETHDR_OSVER_KIND_WIN32

#define PROPSETHDR_OSVER_KIND_WIN32   2

Definition at line 72 of file stg_prop.c.

◆ SECTIONHEADER_OFFSET

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

Definition at line 1649 of file stg_prop.c.

Typedef Documentation

◆ FORMATIDOFFSET

◆ PROPERTYIDOFFSET

◆ PROPERTYSECTIONHEADER

◆ PROPERTYSETHEADER

◆ PropertyStorage_impl

Definition at line 110 of file stg_prop.c.

Function Documentation

◆ Allocate_CoTaskMemAlloc()

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

Definition at line 1042 of file stg_prop.c.

1043 {
1044  return CoTaskMemAlloc(size);
1045 }
GLsizeiptr size
Definition: glext.h:5919
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by PropertyStorage_ReadFromStream().

◆ Allocate_PMemoryAllocator()

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

Definition at line 2787 of file stg_prop.c.

2788 {
2789  void* (__cdecl *fn)(void*,ULONG) = **(void***)this;
2790  return fn(this, cbSize);
2791 }
#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 2385 of file stg_prop.c.

2388 {
2389  IStorage *stg = &This->base.IStorage_iface;
2390  IEnumSTATSTG *penum = NULL;
2391  STATSTG stat;
2392  ULONG count;
2393  HRESULT r;
2394  STATPROPSETSTG statpss;
2395  enumx_impl *enumx;
2396 
2397  TRACE("%p %p\n", This, ppenum);
2398 
2399  enumx = enumx_allocate(&IID_IEnumSTATPROPSETSTG,
2401  sizeof (STATPROPSETSTG),
2402  (IUnknown*)&This->base.IStorage_iface,
2403  NULL);
2404 
2405  /* add all the property set elements into a list */
2406  r = IStorage_EnumElements(stg, 0, NULL, 0, &penum);
2407  if (FAILED(r))
2408  {
2409  enumx_Release(enumx);
2410  return E_OUTOFMEMORY;
2411  }
2412 
2413  while (1)
2414  {
2415  count = 0;
2416  r = IEnumSTATSTG_Next(penum, 1, &stat, &count);
2417  if (FAILED(r))
2418  break;
2419  if (!count)
2420  break;
2421  if (!stat.pwcsName)
2422  continue;
2423  if (stat.pwcsName[0] == 5 && stat.type == STGTY_STREAM)
2424  {
2425  PropStgNameToFmtId(stat.pwcsName, &statpss.fmtid);
2426  TRACE("adding %s (%s)\n", debugstr_w(stat.pwcsName),
2427  debugstr_guid(&statpss.fmtid));
2428  statpss.mtime = stat.mtime;
2429  statpss.atime = stat.atime;
2430  statpss.ctime = stat.ctime;
2431  statpss.grfFlags = stat.grfMode;
2432  statpss.clsid = stat.clsid;
2433  enumx_add_element(enumx, &statpss);
2434  }
2435  CoTaskMemFree(stat.pwcsName);
2436  }
2437  IEnumSTATSTG_Release(penum);
2438 
2439  *ppenum = (IEnumSTATPROPSETSTG*) enumx;
2440 
2441  return S_OK;
2442 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
void * enumx_add_element(enumx_impl *enumx, const void *data)
Definition: enumx.c:207
static const IEnumSTATPROPSETSTGVtbl IEnumSTATPROPSETSTG_Vtbl
Definition: stg_prop.c:145
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:2700
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
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 2533 of file stg_prop.c.

2536 {
2537  enumx_impl *enumx;
2538 
2539  TRACE("%p %p\n", This, ppenum);
2540 
2541  enumx = enumx_allocate(&IID_IEnumSTATPROPSTG,
2543  sizeof (STATPROPSTG),
2544  (IUnknown*)&This->IPropertyStorage_iface,
2546 
2547  dictionary_enumerate(This->propid_to_prop, prop_enum_stat, enumx);
2548 
2549  *ppenum = (IEnumSTATPROPSTG*) enumx;
2550 
2551  return S_OK;
2552 }
void dictionary_enumerate(struct dictionary *d, enumeratefunc e, void *closure)
Definition: dictionary.c:179
static const IEnumSTATPROPSTGVtbl IEnumSTATPROPSTG_Vtbl
Definition: stg_prop.c:146
#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:2496
static BOOL prop_enum_stat(const void *k, const void *v, void *extra, void *arg)
Definition: stg_prop.c:2517

Referenced by IPropertyStorage_fnEnum().

◆ FmtIdToPropStgName()

HRESULT WINAPI FmtIdToPropStgName ( const FMTID rfmtid,
LPOLESTR  str 
)

Definition at line 2635 of file stg_prop.c.

2636 {
2637  static const char fmtMap[] = "abcdefghijklmnopqrstuvwxyz012345";
2638 
2639  TRACE("%s, %p\n", debugstr_guid(rfmtid), str);
2640 
2641  if (!rfmtid) return E_INVALIDARG;
2642  if (!str) return E_INVALIDARG;
2643 
2644  if (IsEqualGUID(&FMTID_SummaryInformation, rfmtid))
2646  else if (IsEqualGUID(&FMTID_DocSummaryInformation, rfmtid))
2648  else if (IsEqualGUID(&FMTID_UserDefinedProperties, rfmtid))
2650  else
2651  {
2652  const BYTE *fmtptr;
2653  WCHAR *pstr = str;
2654  ULONG bitsRemaining = BITS_PER_BYTE;
2655 
2656  *pstr++ = 5;
2657  for (fmtptr = (const BYTE *)rfmtid; fmtptr < (const BYTE *)rfmtid + sizeof(FMTID); )
2658  {
2659  ULONG i = *fmtptr >> (BITS_PER_BYTE - bitsRemaining);
2660 
2661  if (bitsRemaining >= BITS_IN_CHARMASK)
2662  {
2663  *pstr = (WCHAR)(fmtMap[i & CHARMASK]);
2664  if (bitsRemaining == BITS_PER_BYTE && *pstr >= 'a' &&
2665  *pstr <= 'z')
2666  *pstr += 'A' - 'a';
2667  pstr++;
2668  bitsRemaining -= BITS_IN_CHARMASK;
2669  if (bitsRemaining == 0)
2670  {
2671  fmtptr++;
2672  bitsRemaining = BITS_PER_BYTE;
2673  }
2674  }
2675  else
2676  {
2677  if (++fmtptr < (const BYTE *)rfmtid + sizeof(FMTID))
2678  i |= *fmtptr << bitsRemaining;
2679  *pstr++ = (WCHAR)(fmtMap[i & CHARMASK]);
2680  bitsRemaining += BITS_PER_BYTE - BITS_IN_CHARMASK;
2681  }
2682  }
2683  *pstr = 0;
2684  }
2685  TRACE("returning %s\n", debugstr_w(str));
2686  return S_OK;
2687 }
GUID FMTID
Definition: guiddef.h:94
#define CHARMASK
Definition: stg_prop.c:2618
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:2619
const FMTID FMTID_DocSummaryInformation
static const WCHAR szSummaryInfo[]
Definition: stg_prop.c:2612
unsigned char BYTE
Definition: xxhash.c:193
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:415
#define BITS_PER_BYTE
Definition: stg_prop.c:2617
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static const WCHAR szDocSummaryInfo[]
Definition: stg_prop.c:2614
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 2344 of file stg_prop.c.

2346 {
2347  return enumx_AddRef((enumx_impl*)iface);
2348 }
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 2378 of file stg_prop.c.

2381 {
2382  return enumx_Clone((enumx_impl*)iface, (enumx_impl**)ppenum);
2383 }
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 2356 of file stg_prop.c.

2361 {
2362  return enumx_Next((enumx_impl*)iface, celt, rgelt, pceltFetched);
2363 }
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 2336 of file stg_prop.c.

2340 {
2341  return enumx_QueryInterface((enumx_impl*)iface, riid, ppvObject);
2342 }
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 2350 of file stg_prop.c.

2352 {
2353  return enumx_Release((enumx_impl*)iface);
2354 }
ULONG WINAPI enumx_Release(enumx_impl *This)
Definition: enumx.c:83

◆ IEnumSTATPROPSETSTG_fnReset()

static HRESULT WINAPI IEnumSTATPROPSETSTG_fnReset ( IEnumSTATPROPSETSTG *  iface)
static

Definition at line 2372 of file stg_prop.c.

2374 {
2375  return enumx_Reset((enumx_impl*)iface);
2376 }
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 2365 of file stg_prop.c.

2368 {
2369  return enumx_Skip((enumx_impl*)iface, celt);
2370 }
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 2455 of file stg_prop.c.

2457 {
2458  return enumx_AddRef((enumx_impl*)iface);
2459 }
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 2489 of file stg_prop.c.

2492 {
2493  return enumx_Clone((enumx_impl*)iface, (enumx_impl**)ppenum);
2494 }
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 2467 of file stg_prop.c.

2472 {
2473  return enumx_Next((enumx_impl*)iface, celt, rgelt, pceltFetched);
2474 }
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 2447 of file stg_prop.c.

2451 {
2452  return enumx_QueryInterface((enumx_impl*)iface, riid, ppvObject);
2453 }
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 2461 of file stg_prop.c.

2463 {
2464  return enumx_Release((enumx_impl*)iface);
2465 }
ULONG WINAPI enumx_Release(enumx_impl *This)
Definition: enumx.c:83

◆ IEnumSTATPROPSTG_fnReset()

static HRESULT WINAPI IEnumSTATPROPSTG_fnReset ( IEnumSTATPROPSTG iface)
static

Definition at line 2483 of file stg_prop.c.

2485 {
2486  return enumx_Reset((enumx_impl*)iface);
2487 }
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 2476 of file stg_prop.c.

2479 {
2480  return enumx_Skip((enumx_impl*)iface, celt);
2481 }
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 61 of file stg_prop.c.

62 {
63  return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface);
64 }
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 2174 of file stg_prop.c.

2176 {
2178  return IStorage_AddRef( &This->base.IStorage_iface );
2179 }
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61

◆ IPropertySetStorage_fnCreate()

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

Definition at line 2196 of file stg_prop.c.

2203 {
2205  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2206  IStream *stm = NULL;
2207  HRESULT r;
2208 
2209  TRACE("%p %s %08x %08x %p\n", This, debugstr_guid(rfmtid), grfFlags,
2210  grfMode, ppprstg);
2211 
2212  /* be picky */
2214  {
2215  r = STG_E_INVALIDFLAG;
2216  goto end;
2217  }
2218 
2219  if (!rfmtid)
2220  {
2221  r = E_INVALIDARG;
2222  goto end;
2223  }
2224 
2225  /* FIXME: if (grfFlags & PROPSETFLAG_NONSIMPLE), we need to create a
2226  * storage, not a stream. For now, disallow it.
2227  */
2228  if (grfFlags & PROPSETFLAG_NONSIMPLE)
2229  {
2230  FIXME("PROPSETFLAG_NONSIMPLE not supported\n");
2231  r = STG_E_INVALIDFLAG;
2232  goto end;
2233  }
2234 
2235  r = FmtIdToPropStgName(rfmtid, name);
2236  if (FAILED(r))
2237  goto end;
2238 
2239  r = IStorage_CreateStream( &This->base.IStorage_iface, name, grfMode, 0, 0, &stm );
2240  if (FAILED(r))
2241  goto end;
2242 
2243  r = PropertyStorage_ConstructEmpty(stm, rfmtid, grfFlags, grfMode, ppprstg);
2244 
2245  IStream_Release( stm );
2246 
2247 end:
2248  TRACE("returning 0x%08x\n", r);
2249  return r;
2250 }
#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:111
#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:2635
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define STG_E_INVALIDFLAG
Definition: winerror.h:2587
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61
#define STGM_READWRITE
Definition: objbase.h:918
Definition: name.c:38
static HRESULT PropertyStorage_ConstructEmpty(IStream *stm, REFFMTID rfmtid, DWORD grfFlags, DWORD grfMode, IPropertyStorage **pps)
Definition: stg_prop.c:2122

◆ IPropertySetStorage_fnDelete()

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

Definition at line 2302 of file stg_prop.c.

2305 {
2307  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2308  HRESULT r;
2309 
2310  TRACE("%p %s\n", This, debugstr_guid(rfmtid));
2311 
2312  if (!rfmtid)
2313  return E_INVALIDARG;
2314 
2315  r = FmtIdToPropStgName(rfmtid, name);
2316  if (FAILED(r))
2317  return r;
2318 
2319  return IStorage_DestroyElement(&This->base.IStorage_iface, name);
2320 }
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:2635
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61
Definition: name.c:38

◆ IPropertySetStorage_fnEnum()

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

Definition at line 2325 of file stg_prop.c.

2328 {
2330  return create_EnumSTATPROPSETSTG(This, ppenum);
2331 }
static HRESULT create_EnumSTATPROPSETSTG(StorageImpl *, IEnumSTATPROPSETSTG **)
Definition: stg_prop.c:2385
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61

◆ IPropertySetStorage_fnOpen()

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

Definition at line 2255 of file stg_prop.c.

2260 {
2262  IStream *stm = NULL;
2263  WCHAR name[CCH_MAX_PROPSTG_NAME + 1];
2264  HRESULT r;
2265 
2266  TRACE("%p %s %08x %p\n", This, debugstr_guid(rfmtid), grfMode, ppprstg);
2267 
2268  /* be picky */
2269  if (grfMode != (STGM_READWRITE|STGM_SHARE_EXCLUSIVE) &&
2270  grfMode != (STGM_READ|STGM_SHARE_EXCLUSIVE))
2271  {
2272  r = STG_E_INVALIDFLAG;
2273  goto end;
2274  }
2275 
2276  if (!rfmtid)
2277  {
2278  r = E_INVALIDARG;
2279  goto end;
2280  }
2281 
2282  r = FmtIdToPropStgName(rfmtid, name);
2283  if (FAILED(r))
2284  goto end;
2285 
2286  r = IStorage_OpenStream( &This->base.IStorage_iface, name, 0, grfMode, 0, &stm );
2287  if (FAILED(r))
2288  goto end;
2289 
2290  r = PropertyStorage_ConstructFromStream(stm, rfmtid, grfMode, ppprstg);
2291 
2292  IStream_Release( stm );
2293 
2294 end:
2295  TRACE("returning 0x%08x\n", r);
2296  return r;
2297 }
#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:2635
#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:78
#define STG_E_INVALIDFLAG
Definition: winerror.h:2587
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61
#define STGM_READWRITE
Definition: objbase.h:918
static HRESULT PropertyStorage_ConstructFromStream(IStream *stm, REFFMTID rfmtid, DWORD grfMode, IPropertyStorage **pps)
Definition: stg_prop.c:2100
Definition: name.c:38

◆ IPropertySetStorage_fnQueryInterface()

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

Definition at line 2160 of file stg_prop.c.

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

◆ IPropertySetStorage_fnRelease()

static ULONG WINAPI IPropertySetStorage_fnRelease ( IPropertySetStorage ppstg)
static

Definition at line 2186 of file stg_prop.c.

2188 {
2190  return IStorage_Release( &This->base.IStorage_iface );
2191 }
static StorageImpl * impl_from_IPropertySetStorage(IPropertySetStorage *iface)
Definition: stg_prop.c:61

◆ IPropertyStorage_fnAddRef()

static ULONG WINAPI IPropertyStorage_fnAddRef ( IPropertyStorage iface)
static

Definition at line 210 of file stg_prop.c.

212 {
214  return InterlockedIncrement(&This->ref);
215 }
#define InterlockedIncrement
Definition: armddk.h:53
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174

◆ IPropertyStorage_fnCommit()

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

Definition at line 809 of file stg_prop.c.

812 {
814  HRESULT hr;
815 
816  TRACE("(%p, 0x%08x)\n", iface, grfCommitFlags);
817 
818  if (!(This->grfMode & STGM_READWRITE))
819  return STG_E_ACCESSDENIED;
821  if (This->dirty)
823  else
824  hr = S_OK;
826  return hr;
827 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *)
Definition: stg_prop.c:1933
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:78
#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:174
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ IPropertyStorage_fnDeleteMultiple()

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

Definition at line 653 of file stg_prop.c.

657 {
659  ULONG i;
660  HRESULT hr;
661 
662  TRACE("(%p, %d, %p)\n", iface, cpspec, rgpspec);
663 
664  if (cpspec && !rgpspec)
665  return E_INVALIDARG;
666  if (!(This->grfMode & STGM_READWRITE))
667  return STG_E_ACCESSDENIED;
668  hr = S_OK;
670  This->dirty = TRUE;
671  for (i = 0; i < cpspec; i++)
672  {
673  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
674  {
675  void *propid;
676 
677  if (dictionary_find(This->name_to_propid, rgpspec[i].u.lpwstr, &propid))
678  dictionary_remove(This->propid_to_prop, propid);
679  }
680  else
681  {
682  if (rgpspec[i].u.propid >= PID_FIRST_USABLE &&
683  rgpspec[i].u.propid < PID_MIN_READONLY)
684  dictionary_remove(This->propid_to_prop, UlongToPtr(rgpspec[i].u.propid));
685  else
687  }
688  }
689  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
690  IPropertyStorage_Commit(iface, STGC_DEFAULT);
692  return hr;
693 }
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:78
#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:174
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 772 of file stg_prop.c.

776 {
778  ULONG i;
779  HRESULT hr;
780 
781  TRACE("(%p, %d, %p)\n", iface, cpropid, rgpropid);
782 
783  if (cpropid && !rgpropid)
784  return E_INVALIDARG;
785  if (!(This->grfMode & STGM_READWRITE))
786  return STG_E_ACCESSDENIED;
787  hr = S_OK;
789  This->dirty = TRUE;
790  for (i = 0; i < cpropid; i++)
791  {
792  LPWSTR name = NULL;
793 
794  if (dictionary_find(This->propid_to_name, UlongToPtr(rgpropid[i]), (void **)&name))
795  {
796  dictionary_remove(This->propid_to_name, UlongToPtr(rgpropid[i]));
797  dictionary_remove(This->name_to_propid, name);
798  }
799  }
800  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
801  IPropertyStorage_Commit(iface, STGC_DEFAULT);
803  return hr;
804 }
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:78
#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:174
Definition: name.c:38
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 857 of file stg_prop.c.

860 {
862  return create_EnumSTATPROPSTG(This, ppenum);
863 }
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174
static HRESULT create_EnumSTATPROPSTG(PropertyStorage_impl *, IEnumSTATPROPSTG **)
Definition: stg_prop.c:2533

◆ IPropertyStorage_fnQueryInterface()

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

Definition at line 182 of file stg_prop.c.

186 {
188 
189  TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
190 
191  if (!ppvObject)
192  return E_INVALIDARG;
193 
194  *ppvObject = 0;
195 
196  if (IsEqualGUID(&IID_IUnknown, riid) ||
197  IsEqualGUID(&IID_IPropertyStorage, riid))
198  {
199  IPropertyStorage_AddRef(iface);
200  *ppvObject = iface;
201  return S_OK;
202  }
203 
204  return E_NOINTERFACE;
205 }
#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:4112
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174

◆ IPropertyStorage_fnReadMultiple()

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

Definition at line 295 of file stg_prop.c.

300 {
302  HRESULT hr = S_OK;
303  ULONG i;
304 
305  TRACE("(%p, %d, %p, %p)\n", iface, cpspec, rgpspec, rgpropvar);
306 
307  if (!cpspec)
308  return S_FALSE;
309  if (!rgpspec || !rgpropvar)
310  return E_INVALIDARG;
312  for (i = 0; i < cpspec; i++)
313  {
314  PropVariantInit(&rgpropvar[i]);
315  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
316  {
317  PROPVARIANT *prop = PropertyStorage_FindPropertyByName(This,
318  rgpspec[i].u.lpwstr);
319 
320  if (prop)
321  PropertyStorage_PropVariantCopy(&rgpropvar[i], prop, GetACP(),
322  This->codePage);
323  }
324  else
325  {
326  switch (rgpspec[i].u.propid)
327  {
328  case PID_CODEPAGE:
329  rgpropvar[i].vt = VT_I2;
330  rgpropvar[i].u.iVal = This->codePage;
331  break;
332  case PID_LOCALE:
333  rgpropvar[i].vt = VT_I4;
334  rgpropvar[i].u.lVal = This->locale;
335  break;
336  default:
337  {
338  PROPVARIANT *prop = PropertyStorage_FindProperty(This,
339  rgpspec[i].u.propid);
340 
341  if (prop)
342  PropertyStorage_PropVariantCopy(&rgpropvar[i], prop,
343  GetACP(), This->codePage);
344  else
345  hr = S_FALSE;
346  }
347  }
348  }
349  }
351  return hr;
352 }
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:241
Definition: compat.h:1948
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:2180
static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop, const PROPVARIANT *propvar, LCID targetCP, LCID srcCP)
Definition: stg_prop.c:438
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
static PROPVARIANT * PropertyStorage_FindPropertyByName(PropertyStorage_impl *This, LPCWSTR name)
Definition: stg_prop.c:252
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
Definition: compat.h:1947

◆ IPropertyStorage_fnReadPropertyNames()

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

Definition at line 698 of file stg_prop.c.

703 {
705  ULONG i;
706  HRESULT hr = S_FALSE;
707 
708  TRACE("(%p, %d, %p, %p)\n", iface, cpropid, rgpropid, rglpwstrName);
709 
710  if (cpropid && (!rgpropid || !rglpwstrName))
711  return E_INVALIDARG;
713  for (i = 0; i < cpropid && SUCCEEDED(hr); i++)
714  {
716 
717  if (name)
718  {
719  size_t len = lstrlenW(name);
720 
721  hr = S_OK;
722  rglpwstrName[i] = CoTaskMemAlloc((len + 1) * sizeof(WCHAR));
723  if (rglpwstrName[i])
724  memcpy(rglpwstrName[i], name, (len + 1) * sizeof(WCHAR));
725  else
727  }
728  else
729  rglpwstrName[i] = NULL;
730  }
732  return hr;
733 }
HRESULT hr
Definition: shlfolder.c:183
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:416
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:282
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#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:174
Definition: name.c:38
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:426
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IPropertyStorage_fnRelease()

static ULONG WINAPI IPropertyStorage_fnRelease ( IPropertyStorage iface)
static

Definition at line 220 of file stg_prop.c.

222 {
224  ULONG ref;
225 
226  ref = InterlockedDecrement(&This->ref);
227  if (ref == 0)
228  {
229  TRACE("Destroying %p\n", This);
230  if (This->dirty)
231  IPropertyStorage_Commit(iface, STGC_DEFAULT);
232  IStream_Release(This->stm);
233  This->cs.DebugInfo->Spare[0] = 0;
237  }
238  return ref;
239 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2026
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define InterlockedDecrement
Definition: armddk.h:52
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:403

◆ IPropertyStorage_fnRevert()

static HRESULT WINAPI IPropertyStorage_fnRevert ( IPropertyStorage iface)
static

Definition at line 832 of file stg_prop.c.

834 {
835  HRESULT hr;
837 
838  TRACE("%p\n", iface);
839 
841  if (This->dirty)
842  {
845  if (SUCCEEDED(hr))
847  }
848  else
849  hr = S_OK;
851  return hr;
852 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2026
static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *)
Definition: stg_prop.c:1338
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
static HRESULT PropertyStorage_CreateDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2036
#define S_OK
Definition: intsafe.h:59
static PropertyStorage_impl * impl_from_IPropertyStorage(IPropertyStorage *iface)
Definition: stg_prop.c:174
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 881 of file stg_prop.c.

884 {
886 
887  TRACE("%p, %s\n", iface, debugstr_guid(clsid));
888 
889  if (!clsid)
890  return E_INVALIDARG;
891  if (!(This->grfMode & STGM_READWRITE))
892  return STG_E_ACCESSDENIED;
893  This->clsid = *clsid;
894  This->dirty = TRUE;
895  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
896  IPropertyStorage_Commit(iface, STGC_DEFAULT);
897  return S_OK;
898 }
#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:82
#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:174

◆ IPropertyStorage_fnSetTimes()

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

Definition at line 868 of file stg_prop.c.

873 {
874  FIXME("\n");
875  return E_NOTIMPL;
876 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IPropertyStorage_fnStat()

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

Definition at line 903 of file stg_prop.c.

906 {
908  STATSTG stat;
909  HRESULT hr;
910 
911  TRACE("%p, %p\n", iface, statpsstg);
912 
913  if (!statpsstg)
914  return E_INVALIDARG;
915 
916  hr = IStream_Stat(This->stm, &stat, STATFLAG_NONAME);
917  if (SUCCEEDED(hr))
918  {
919  statpsstg->fmtid = This->fmtid;
920  statpsstg->clsid = This->clsid;
921  statpsstg->grfFlags = This->grfFlags;
922  statpsstg->mtime = stat.mtime;
923  statpsstg->ctime = stat.ctime;
924  statpsstg->atime = stat.atime;
925  statpsstg->dwOSVersion = This->originatorOS;
926  }
927  return hr;
928 }
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:78
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:174
#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 552 of file stg_prop.c.

558 {
560  HRESULT hr = S_OK;
561  ULONG i;
562 
563  TRACE("(%p, %d, %p, %p)\n", iface, cpspec, rgpspec, rgpropvar);
564 
565  if (cpspec && (!rgpspec || !rgpropvar))
566  return E_INVALIDARG;
567  if (!(This->grfMode & STGM_READWRITE))
568  return STG_E_ACCESSDENIED;
570  This->dirty = TRUE;
571  This->originatorOS = (DWORD)MAKELONG(LOWORD(GetVersion()),
573  for (i = 0; i < cpspec; i++)
574  {
575  if (rgpspec[i].ulKind == PRSPEC_LPWSTR)
576  {
577  PROPVARIANT *prop = PropertyStorage_FindPropertyByName(This,
578  rgpspec[i].u.lpwstr);
579 
580  if (prop)
581  PropVariantCopy(prop, &rgpropvar[i]);
582  else
583  {
584  /* Note that I don't do the special cases here that I do below,
585  * because naming the special PIDs isn't supported.
586  */
587  if (propidNameFirst < PID_FIRST_USABLE ||
588  propidNameFirst >= PID_MIN_READONLY)
590  else
591  {
592  PROPID nextId = max(propidNameFirst, This->highestProp + 1);
593 
595  (LPCSTR)rgpspec[i].u.lpwstr, CP_UNICODE, nextId);
596  if (SUCCEEDED(hr))
598  &rgpropvar[i], GetACP());
599  }
600  }
601  }
602  else
603  {
604  switch (rgpspec[i].u.propid)
605  {
606  case PID_DICTIONARY:
607  /* Can't set the dictionary */
609  break;
610  case PID_CODEPAGE:
611  /* Can only set the code page if nothing else has been set */
612  if (dictionary_num_entries(This->propid_to_prop) == 0 &&
613  rgpropvar[i].vt == VT_I2)
614  {
615  This->codePage = rgpropvar[i].u.iVal;
616  if (This->codePage == CP_UNICODE)
617  This->grfFlags &= ~PROPSETFLAG_ANSI;
618  else
619  This->grfFlags |= PROPSETFLAG_ANSI;
620  }
621  else
623  break;
624  case PID_LOCALE:
625  /* Can only set the locale if nothing else has been set */
626  if (dictionary_num_entries(This->propid_to_prop) == 0 &&
627  rgpropvar[i].vt == VT_I4)
628  This->locale = rgpropvar[i].u.lVal;
629  else
631  break;
632  case PID_ILLEGAL:
633  /* silently ignore like MSDN says */
634  break;
635  default:
636  if (rgpspec[i].u.propid >= PID_MIN_READONLY)
638  else
640  rgpspec[i].u.propid, &rgpropvar[i], GetACP());
641  }
642  }
643  }
644  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
645  IPropertyStorage_Commit(iface, STGC_DEFAULT);
647  return hr;
648 }
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:1948
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:72
#define PID_CODEPAGE
Definition: suminfo.c:43
static HRESULT PropertyStorage_StoreNameWithId(PropertyStorage_impl *This, LPCSTR srcName, LCID cp, PROPID id)
Definition: stg_prop.c:519
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:464
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:2180
const char * LPCSTR
Definition: xmlstorage.h:183
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3086
static FMTID *static DWORD
Definition: stg_prop.c:29
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
static PROPVARIANT * PropertyStorage_FindPropertyByName(PropertyStorage_impl *This, LPCWSTR name)
Definition: stg_prop.c:252
#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:174
#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:74
#define LOWORD(l)
Definition: pedump.c:82
Definition: compat.h:1947
#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 738 of file stg_prop.c.

743 {
745  ULONG i;
746  HRESULT hr;
747 
748  TRACE("(%p, %d, %p, %p)\n", iface, cpropid, rgpropid, rglpwstrName);
749 
750  if (cpropid && (!rgpropid || !rglpwstrName))
751  return E_INVALIDARG;
752  if (!(This->grfMode & STGM_READWRITE))
753  return STG_E_ACCESSDENIED;
754  hr = S_OK;
756  This->dirty = TRUE;
757  for (i = 0; SUCCEEDED(hr) && i < cpropid; i++)
758  {
759  if (rgpropid[i] != PID_ILLEGAL)
760  hr = PropertyStorage_StoreNameWithId(This, (LPCSTR)rglpwstrName[i],
761  CP_UNICODE, rgpropid[i]);
762  }
763  if (This->grfFlags & PROPSETFLAG_UNBUFFERED)
764  IPropertyStorage_Commit(iface, STGC_DEFAULT);
766  return hr;
767 }
#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:519
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:78
#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:174
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define CP_UNICODE
Definition: stg_prop.c:74
#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 2496 of file stg_prop.c.

2497 {
2499  STATPROPSTG *src_prop = orig;
2500  STATPROPSTG *dest_prop = dest;
2501  LPWSTR name;
2502 
2503  dest_prop->propid = src_prop->propid;
2504  dest_prop->vt = src_prop->vt;
2505  dest_prop->lpwstrName = NULL;
2506 
2507  if (dictionary_find(storage->propid_to_name, UlongToPtr(src_prop->propid), (void**)&name))
2508  {
2509  DWORD size = (lstrlenW(name) + 1) * sizeof(WCHAR);
2510 
2511  dest_prop->lpwstrName = CoTaskMemAlloc(size);
2512  if (!dest_prop->lpwstrName) return;
2513  memcpy(dest_prop->lpwstrName, name, size);
2514  }
2515 }
BOOL dictionary_find(struct dictionary *d, const void *k, void **value)
Definition: dictionary.c:142
#define lstrlenW
Definition: compat.h:416
smooth NULL
Definition: ftsmooth.c:416
struct dictionary * propid_to_name
Definition: stg_prop.c:170
#define UlongToPtr(u)
Definition: config.h:106
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2944
__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:174
Definition: name.c:38
static char * dest
Definition: rtl.c:135
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
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 2517 of file stg_prop.c.

2518 {
2519  enumx_impl *enumx = arg;
2520  PROPID propid = PtrToUlong(k);
2521  const PROPVARIANT *prop = v;
2522  STATPROPSTG stat;
2523 
2524  stat.lpwstrName = NULL;
2525  stat.propid = propid;
2526  stat.vt = prop->vt;
2527 
2528  enumx_add_element(enumx, &stat);
2529 
2530  return TRUE;
2531 }
#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:10
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 1567 of file stg_prop.c.

1569 {
1570 #ifdef WORDS_BIGENDIAN
1571  WCHAR *leStr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1572  HRESULT hr;
1573 
1574  if (!leStr)
1575  return E_OUTOFMEMORY;
1576  memcpy(leStr, str, len * sizeof(WCHAR));
1578  hr = IStream_Write(stm, leStr, len, written);
1579  HeapFree(GetProcessHeap(), 0, leStr);
1580  return hr;
1581 #else
1582  return IStream_Write(stm, str, len, written);
1583 #endif
1584 }
HRESULT hr
Definition: shlfolder.c:183
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#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:986
#define HeapFree(x, y, z)
Definition: compat.h:403

Referenced by PropertyStorage_DictionaryWriter().

◆ PropertyStorage_BaseConstruct()

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

Definition at line 2068 of file stg_prop.c.

2070 {
2071  HRESULT hr = S_OK;
2072 
2073  assert(pps);
2074  assert(rfmtid);
2075  *pps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof **pps);
2076  if (!*pps)
2077  return E_OUTOFMEMORY;
2078 
2079  (*pps)->IPropertyStorage_iface.lpVtbl = &IPropertyStorage_Vtbl;
2080  (*pps)->ref = 1;
2081  InitializeCriticalSection(&(*pps)->cs);
2082  (*pps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PropertyStorage_impl.cs");
2083  (*pps)->stm = stm;
2084  (*pps)->fmtid = *rfmtid;
2085  (*pps)->grfMode = grfMode;
2086 
2088  if (FAILED(hr))
2089  {
2090  (*pps)->cs.DebugInfo->Spare[0] = 0;
2091  DeleteCriticalSection(&(*pps)->cs);
2092  HeapFree(GetProcessHeap(), 0, *pps);
2093  *pps = NULL;
2094  }
2095  else IStream_AddRef( stm );
2096 
2097  return hr;
2098 }
#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:144
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
LONG HRESULT
Definition: typedefs.h:78
static HRESULT PropertyStorage_CreateDictionaries(PropertyStorage_impl *)
Definition: stg_prop.c:2036
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:403

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 2122 of file stg_prop.c.

2124 {
2126  HRESULT hr;
2127 
2128  assert(pps);
2129  hr = PropertyStorage_BaseConstruct(stm, rfmtid, grfMode, &ps);
2130  if (SUCCEEDED(hr))
2131  {
2132  ps->format = 0;
2133  ps->grfFlags = grfFlags;
2134  if (ps->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
2135  ps->format = 1;
2136  /* default to Unicode unless told not to, as specified on msdn */
2137  if (ps->grfFlags & PROPSETFLAG_ANSI)
2138  ps->codePage = GetACP();
2139  else
2140  ps->codePage = CP_UNICODE;
2142  TRACE("Code page is %d, locale is %d\n", ps->codePage, ps->locale);
2143  *pps = &ps->IPropertyStorage_iface;
2144  TRACE("PropertyStorage %p constructed\n", ps);
2145  hr = S_OK;
2146  }
2147  return hr;
2148 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
UINT WINAPI GetACP(VOID)
Definition: nls.c:2180
IPropertyStorage IPropertyStorage_iface
Definition: stg_prop.c:155
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
static HRESULT PropertyStorage_BaseConstruct(IStream *stm, REFFMTID rfmtid, DWORD grfMode, PropertyStorage_impl **pps)
Definition: stg_prop.c:2068
#define LOCALE_SYSTEM_DEFAULT
#define S_OK
Definition: intsafe.h:59
#define CP_UNICODE
Definition: stg_prop.c:74
#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 2100 of file stg_prop.c.

2102 {
2104  HRESULT hr;
2105 
2106  assert(pps);
2107  hr = PropertyStorage_BaseConstruct(stm, rfmtid, grfMode, &ps);
2108  if (SUCCEEDED(hr))
2109  {
2111  if (SUCCEEDED(hr))
2112  {
2113  *pps = &ps->IPropertyStorage_iface;
2114  TRACE("PropertyStorage %p constructed\n", ps);
2115  hr = S_OK;
2116  }
2117  else IPropertyStorage_Release( &ps->IPropertyStorage_iface );
2118  }
2119  return hr;
2120 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *)
Definition: stg_prop.c:1338
IPropertyStorage IPropertyStorage_iface
Definition: stg_prop.c:155
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
static HRESULT PropertyStorage_BaseConstruct(IStream *stm, REFFMTID rfmtid, DWORD grfMode, PropertyStorage_impl **pps)
Definition: stg_prop.c:2068
#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 2036 of file stg_prop.c.

2037 {
2038  HRESULT hr = S_OK;
2039 
2040  This->name_to_propid = dictionary_create(
2042  This);
2043  if (!This->name_to_propid)
2044  {
2046  goto end;
2047  }
2049  NULL, This);
2050  if (!This->propid_to_name)
2051  {
2053  goto end;
2054  }
2057  if (!This->propid_to_prop)
2058  {
2060  goto end;
2061  }
2062 end:
2063  if (FAILED(hr))
2065  return hr;
2066 }
static void PropertyStorage_PropNameDestroy(void *k, void *d, void *extra)
Definition: stg_prop.c:953
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:2026
static int PropertyStorage_PropCompare(const void *a, const void *b, void *extra)
Definition: stg_prop.c:958
LONG HRESULT
Definition: typedefs.h:78
static void PropertyStorage_PropertyDestroy(void *k, void *d, void *extra)
Definition: stg_prop.c:965
#define S_OK
Definition: intsafe.h:59
static int PropertyStorage_PropNameCompare(const void *a, const void *b, void *extra)
Definition: stg_prop.c:930

Referenced by IPropertyStorage_fnRevert(), and PropertyStorage_BaseConstruct().

◆ PropertyStorage_DestroyDictionaries()

static void PropertyStorage_DestroyDictionaries ( PropertyStorage_impl This)
static

Definition at line 2026 of file stg_prop.c.

2027 {
2028  dictionary_destroy(This->name_to_propid);
2029  This->name_to_propid = NULL;
2030  dictionary_destroy(This->propid_to_name);
2031  This->propid_to_name = NULL;
2032  dictionary_destroy(This->propid_to_prop);
2033  This->propid_to_prop = NULL;
2034 }
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 1592 of file stg_prop.c.

1594 {
1596  struct DictionaryClosure *c = closure;
1597  DWORD propid;
1598  ULONG count;
1599 
1600  assert(key);
1601  assert(closure);
1603  c->hr = IStream_Write(This->stm, &propid, sizeof(propid), &count);
1604  if (FAILED(c->hr))
1605  goto end;
1606  c->bytesWritten += sizeof(DWORD);
1607  if (This->codePage == CP_UNICODE)
1608  {
1609  DWORD keyLen, pad = 0;
1610 
1611  StorageUtl_WriteDWord((LPBYTE)&keyLen, 0,
1612  (lstrlenW((LPCWSTR)key) + 1) * sizeof(WCHAR));
1613  c->hr = IStream_Write(This->stm, &keyLen, sizeof(keyLen), &count);
1614  if (FAILED(c->hr))
1615  goto end;
1616  c->bytesWritten += sizeof(DWORD);
1617  c->hr = PropertStorage_WriteWStringToStream(This->stm, key, keyLen,
1618  &count);
1619  if (FAILED(c->hr))
1620  goto end;
1621  c->bytesWritten += keyLen * sizeof(WCHAR);
1622  if (keyLen % sizeof(DWORD))
1623  {
1624  c->hr = IStream_Write(This->stm, &pad,
1625  sizeof(DWORD) - keyLen % sizeof(DWORD), &count);
1626  if (FAILED(c->hr))
1627  goto end;
1628  c->bytesWritten += sizeof(DWORD) - keyLen % sizeof(DWORD);
1629  }
1630  }
1631  else
1632  {
1633  DWORD keyLen;
1634 
1635  StorageUtl_WriteDWord((LPBYTE)&keyLen, 0, strlen((LPCSTR)key) + 1);
1636  c->hr = IStream_Write(This->stm, &keyLen, sizeof(keyLen), &count);
1637  if (FAILED(c->hr))
1638  goto end;
1639  c->bytesWritten += sizeof(DWORD);
1640  c->hr = IStream_Write(This->stm, key, keyLen, &count);
1641  if (FAILED(c->hr))
1642  goto end;
1643  c->bytesWritten += keyLen;
1644  }
1645 end:
1646  return SUCCEEDED(c->hr);
1647 }
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:416
static HRESULT PropertStorage_WriteWStringToStream(IStream *stm, LPCWSTR str, DWORD len, DWORD *written)
Definition: stg_prop.c:1567
unsigned char * LPBYTE
Definition: typedefs.h:53
const char * LPCSTR
Definition: xmlstorage.h:183
#define PtrToUlong(u)
Definition: config.h:107
static FMTID *static DWORD
Definition: stg_prop.c:29
Definition: id3.c:95
__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:6965
unsigned int ULONG
Definition: retypes.h:1
#define CP_UNICODE
Definition: stg_prop.c:74
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:41

Referenced by PropertyStorage_WriteDictionaryToStream().

◆ PropertyStorage_FindProperty()

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

Definition at line 241 of file stg_prop.c.

243 {
244  PROPVARIANT *ret = NULL;
245 
246  dictionary_find(This->propid_to_prop, UlongToPtr(propid), (void **)&ret);
247  TRACE("returning %p\n", ret);
248  return ret;
249 }
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 252 of file stg_prop.c.

254 {
255  PROPVARIANT *ret = NULL;
256  void *propid;
257 
258  if (!name)
259  return NULL;
260  if (This->codePage == CP_UNICODE)
261  {
262  if (dictionary_find(This->name_to_propid, name, &propid))
264  }
265  else
266  {
267  LPSTR ansiName;
269  &ansiName, This->codePage);
270 
271  if (SUCCEEDED(hr))
272  {
273  if (dictionary_find(This->name_to_propid, ansiName, &propid))
275  CoTaskMemFree(ansiName);
276  }
277  }
278  TRACE("returning %p\n", ret);
279  return ret;
280 }
static PROPVARIANT * PropertyStorage_FindProperty(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:241
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
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:78
int ret
Definition: name.c:38
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:354
#define CP_UNICODE
Definition: stg_prop.c:74
#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 282 of file stg_prop.c.

284 {
285  LPWSTR ret = NULL;
286 
287  dictionary_find(This->propid_to_name, UlongToPtr(propid), (void **)&ret);
288  TRACE("returning %p\n", ret);
289  return ret;
290 }
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 1540 of file stg_prop.c.

1542 {
1543  assert(fmtOffset);
1544  StorageUtl_WriteGUID((BYTE *)fmtOffset, 0, &This->fmtid);
1546  sizeof(PROPERTYSETHEADER) + sizeof(FORMATIDOFFSET));
1547 }
#define assert(x)
Definition: debug.h:53
void StorageUtl_WriteGUID(BYTE *buffer, ULONG offset, const GUID *value)
Definition: storage32.c:7008
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6965

Referenced by PropertyStorage_WriteHeadersToStream().

◆ PropertyStorage_MakeHeader()

static void PropertyStorage_MakeHeader ( PropertyStorage_impl This,
PROPERTYSETHEADER hdr 
)
static

Definition at line 1528 of file stg_prop.c.

1530 {
1531  assert(hdr);
1532  StorageUtl_WriteWord((BYTE *)&hdr->wByteOrder, 0,
1534  StorageUtl_WriteWord((BYTE *)&hdr->wFormat, 0, This->format);
1535  StorageUtl_WriteDWord((BYTE *)&hdr->dwOSVer, 0, This->originatorOS);
1536  StorageUtl_WriteGUID((BYTE *)&hdr->clsid, 0, &This->clsid);
1537  StorageUtl_WriteDWord((BYTE *)&hdr->reserved, 0, 1);
1538 }
char hdr[14]
Definition: iptest.cpp:33
#define assert(x)
Definition: debug.h:53
#define PROPSETHDR_BYTEORDER_MAGIC
Definition: stg_prop.c:69
void StorageUtl_WriteGUID(BYTE *buffer, ULONG offset, const GUID *value)
Definition: storage32.c:7008
void StorageUtl_WriteWord(BYTE *buffer, ULONG offset, WORD value)
Definition: storage32.c:6951
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6965

Referenced by PropertyStorage_WriteHeadersToStream().

◆ PropertyStorage_MakePropertyIdOffset()

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

Definition at line 1558 of file stg_prop.c.

1560 {
1561  assert(propIdOffset);
1562  StorageUtl_WriteDWord((BYTE *)propIdOffset, 0, propid);
1563  StorageUtl_WriteDWord((BYTE *)propIdOffset,
1565 }
#define assert(x)
Definition: debug.h:53
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6965

Referenced by PropertyStorage_WriteDictionaryToStream(), and PropertyStorage_WritePropertyToStream().

◆ PropertyStorage_MakeSectionHdr()

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

Definition at line 1549 of file stg_prop.c.

1551 {
1552  assert(hdr);
1553  StorageUtl_WriteDWord((BYTE *)hdr, 0, cbSection);
1555  offsetof(PROPERTYSECTIONHEADER, cProperties), numProps);
1556 }
char hdr[14]
Definition: iptest.cpp:33
#define assert(x)
Definition: debug.h:53
#define offsetof(TYPE, MEMBER)
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_WriteDWord(BYTE *buffer, ULONG offset, DWORD value)
Definition: storage32.c:6965

Referenced by PropertyStorage_WriteToStream().

◆ PropertyStorage_PropCompare()

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

Definition at line 958 of file stg_prop.c.

960 {
961  TRACE("(%d, %d)\n", PtrToUlong(a), PtrToUlong(b));
962  return PtrToUlong(a) - PtrToUlong(b);
963 }
#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 1868 of file stg_prop.c.

1870 {
1872  struct PropertyClosure *c = closure;
1873 
1874  assert(key);
1875  assert(value);
1876  assert(extra);
1877  assert(closure);
1878  c->hr = PropertyStorage_WritePropertyToStream(This, c->propNum++,
1879  PtrToUlong(key), value, c->sectionOffset);
1880  return SUCCEEDED(c->hr);
1881 }
#define assert(x)
Definition: debug.h:53
#define PtrToUlong(u)
Definition: config.h:107
Definition: id3.c:95
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:1709
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:41

Referenced by PropertyStorage_WritePropertiesToStream().

◆ PropertyStorage_PropertyDestroy()

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

Definition at line 965 of file stg_prop.c.

966 {
968  HeapFree(GetProcessHeap(), 0, d);
969 }
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
#define GetProcessHeap()
Definition: compat.h:404
#define d
Definition: ke_i.h:81
#define HeapFree(x, y, z)
Definition: compat.h:403

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropNameCompare()

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

Definition at line 930 of file stg_prop.c.

932 {
934 
935  if (This->codePage == CP_UNICODE)
936  {
937  TRACE("(%s, %s)\n", debugstr_w(a), debugstr_w(b));
938  if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
939  return wcscmp(a, b);
940  else
941  return lstrcmpiW(a, b);
942  }
943  else
944  {
945  TRACE("(%s, %s)\n", debugstr_a(a), debugstr_a(b));
946  if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
947  return lstrcmpA(a, b);
948  else
949  return lstrcmpiA(a, b);
950  }
951 }
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
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:95
#define debugstr_a
Definition: kernel32.h:31
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define CP_UNICODE
Definition: stg_prop.c:74

Referenced by PropertyStorage_CreateDictionaries().

◆ PropertyStorage_PropNameDestroy()

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

Definition at line 953 of file stg_prop.c.

954 {
955  CoTaskMemFree(k);
956 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
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 438 of file stg_prop.c.

440 {
441  HRESULT hr = S_OK;
442 
443  assert(prop);
444  assert(propvar);
445  if (propvar->vt == VT_LPSTR)
446  {
447  hr = PropertyStorage_StringCopy(propvar->u.pszVal, srcCP,
448  &prop->u.pszVal, targetCP);
449  if (SUCCEEDED(hr))
450  prop->vt = VT_LPSTR;
451  }
452  else
453  PropVariantCopy(prop, propvar);
454  return hr;
455 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3086
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:354
#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 994 of file stg_prop.c.

996 {
997  DWORD numEntries, i;
998  HRESULT hr = S_OK;
999 
1000  assert(This->name_to_propid);
1001  assert(This->propid_to_name);
1002 
1003  StorageUtl_ReadDWord(ptr, 0, &numEntries);
1004  TRACE("Reading %d entries:\n", numEntries);
1005  ptr += sizeof(DWORD);
1006  for (i = 0; SUCCEEDED(hr) && i < numEntries; i++)
1007  {
1008  PROPID propid;
1009  DWORD cbEntry;
1010 
1011  StorageUtl_ReadDWord(ptr, 0, &propid);
1012  ptr += sizeof(PROPID);
1013  StorageUtl_ReadDWord(ptr, 0, &cbEntry);
1014  ptr += sizeof(DWORD);
1015  TRACE("Reading entry with ID 0x%08x, %d bytes\n", propid, cbEntry);
1016  /* Make sure the source string is NULL-terminated */
1017  if (This->codePage != CP_UNICODE)
1018  ptr[cbEntry - 1] = '\0';
1019  else
1020  ((LPWSTR)ptr)[cbEntry - 1] = 0;
1021  hr = PropertyStorage_StoreNameWithId(This, (char*)ptr, This->codePage, propid);
1022  if (This->codePage == CP_UNICODE)
1023  {
1024  /* cbEntry is the number of characters */
1025  cbEntry *= 2;
1026 
1027  /* Unicode entries are padded to DWORD boundaries */
1028  if (cbEntry % sizeof(DWORD))
1029  ptr += sizeof(DWORD) - (cbEntry % sizeof(DWORD));
1030  }
1031  ptr += cbEntry;
1032  }
1033  return hr;
1034 }
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:519
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:78
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:6957
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CP_UNICODE
Definition: stg_prop.c:74
#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 1280 of file stg_prop.c.

1282 {
1283  BYTE buf[sizeof(FORMATIDOFFSET)];
1284  ULONG count = 0;
1285  HRESULT hr;
1286 
1287  assert(stm);
1288  assert(fmt);
1289  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1290  if (SUCCEEDED(hr))
1291  {
1292  if (count != sizeof(buf))
1293  {
1294  WARN("read only %d\n", count);
1296  }
1297  else
1298  {
1300  &fmt->fmtid);
1302  &fmt->dwOffset);
1303  }
1304  }
1305  TRACE("returning 0x%08x\n", hr);
1306  return hr;
1307 }
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:112
#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:78
unsigned char BYTE
Definition: xxhash.c:193
struct tagFORMATIDOFFSET FORMATIDOFFSET
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6957
void StorageUtl_ReadGUID(const BYTE *buffer, ULONG offset, GUID *value)
Definition: storage32.c:6999
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 1338 of file stg_prop.c.

1339 {
1341  FORMATIDOFFSET fmtOffset;
1342  PROPERTYSECTIONHEADER sectionHdr;
1344  ULONG i;
1345  STATSTG stat;
1346  HRESULT hr;
1347  BYTE *buf = NULL;
1348  ULONG count = 0;
1349  DWORD dictOffset = 0;
1350 
1351  This->dirty = FALSE;
1352  This->highestProp = 0;
1353  hr = IStream_Stat(This->stm, &stat, STATFLAG_NONAME);
1354  if (FAILED(hr))
1355  goto end;
1356  if (stat.cbSize.u.HighPart)
1357  {
1358  WARN("stream too big\n");
1359  /* maximum size varies, but it can't be this big */
1361  goto end;
1362  }
1363  if (stat.cbSize.u.LowPart == 0)
1364  {
1365  /* empty stream is okay */
1366  hr = S_OK;
1367  goto end;
1368  }
1369  else if (stat.cbSize.u.LowPart < sizeof(PROPERTYSETHEADER) +
1370  sizeof(FORMATIDOFFSET))
1371  {
1372  WARN("stream too small\n");
1374  goto end;
1375  }
1376  seek.QuadPart = 0;
1377  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1378  if (FAILED(hr))
1379  goto end;
1381  /* I've only seen reserved == 1, but the article says I shouldn't disallow
1382  * higher values.
1383  */
1384  if (hdr.wByteOrder != PROPSETHDR_BYTEORDER_MAGIC || hdr.reserved < 1)
1385  {
1386  WARN("bad magic in prop set header\n");
1388  goto end;
1389  }
1390  if (hdr.wFormat != 0 && hdr.wFormat != 1)
1391  {
1392  WARN("bad format version %d\n", hdr.wFormat);
1394  goto end;
1395  }
1396  This->format = hdr.wFormat;
1397  This->clsid = hdr.clsid;
1398  This->originatorOS = hdr.dwOSVer;
1399  if (PROPSETHDR_OSVER_KIND(hdr.dwOSVer) == PROPSETHDR_OSVER_KIND_MAC)
1400  WARN("File comes from a Mac, strings will probably be screwed up\n");
1402  if (FAILED(hr))
1403  goto end;
1404  if (fmtOffset.dwOffset > stat.cbSize.u.LowPart)
1405  {
1406  WARN("invalid offset %d (stream length is %d)\n", fmtOffset.dwOffset,
1407  stat.cbSize.u.LowPart);
1409  goto end;
1410  }
1411  /* wackiness alert: if the format ID is FMTID_DocSummaryInformation, there
1412  * follows not one, but two sections. The first contains the standard properties
1413  * for the document summary information, and the second consists of user-defined
1414  * properties. This is the only case in which multiple sections are
1415  * allowed.
1416  * Reading the second stream isn't implemented yet.
1417  */
1419  if (FAILED(hr))
1420  goto end;
1421  /* The section size includes the section header, so check it */
1422  if (sectionHdr.cbSection < sizeof(PROPERTYSECTIONHEADER))
1423  {
1424  WARN("section header too small, got %d\n", sectionHdr.cbSection);
1426  goto end;
1427  }
1428  buf = HeapAlloc(GetProcessHeap(), 0, sectionHdr.cbSection -
1429  sizeof(PROPERTYSECTIONHEADER));
1430  if (!buf)
1431  {
1433  goto end;
1434  }
1435  hr = IStream_Read(This->stm, buf, sectionHdr.cbSection -
1436  sizeof(PROPERTYSECTIONHEADER), &count);
1437  if (FAILED(hr))
1438  goto end;
1439  TRACE("Reading %d properties:\n", sectionHdr.cProperties);
1440  for (i = 0; SUCCEEDED(hr) && i < sectionHdr.cProperties; i++)
1441  {
1442  PROPERTYIDOFFSET *idOffset = (PROPERTYIDOFFSET *)(buf +
1443  i * sizeof(PROPERTYIDOFFSET));
1444 
1445  if (idOffset->dwOffset < sizeof(PROPERTYSECTIONHEADER) ||
1446  idOffset->dwOffset > sectionHdr.cbSection - sizeof(DWORD))
1448  else
1449  {
1450  if (idOffset->propid >= PID_FIRST_USABLE &&
1451  idOffset->propid < PID_MIN_READONLY && idOffset->propid >
1452  This->highestProp)
1453  This->highestProp = idOffset->propid;
1454  if (idOffset->propid == PID_DICTIONARY)
1455  {
1456  /* Don't read the dictionary yet, its entries depend on the
1457  * code page. Just store the offset so we know to read it
1458  * later.
1459  */
1460  dictOffset = idOffset->dwOffset;
1461  TRACE("Dictionary offset is %d\n", dictOffset);
1462  }
1463  else
1464  {
1465  PROPVARIANT prop;
1466 
1467  PropVariantInit(&prop);
1469  buf + idOffset->dwOffset - sizeof(PROPERTYSECTIONHEADER),
1470  This->codePage, Allocate_CoTaskMemAlloc, NULL)))
1471  {
1472  TRACE("Read property with ID 0x%08x, type %d\n",
1473  idOffset->propid, prop.vt);
1474  switch(idOffset->propid)
1475  {
1476  case PID_CODEPAGE:
1477  if (prop.vt == VT_I2)
1478  This->codePage = (UINT)prop.u.iVal;
1479  break;
1480  case PID_LOCALE:
1481  if (prop.vt == VT_I4)
1482  This->locale = (LCID)prop.u.lVal;
1483  break;
1484  case PID_BEHAVIOR:
1485  if (prop.vt == VT_I4 && prop.u.lVal)
1486  This->grfFlags |= PROPSETFLAG_CASE_SENSITIVE;
1487  /* The format should already be 1, but just in case */
1488  This->format = 1;
1489  break;
1490  default:
1492  idOffset->propid, &prop, This->codePage);
1493  }
1494  }
1495  PropVariantClear(&prop);
1496  }
1497  }
1498  }
1499  if (!This->codePage)
1500  {
1501  /* default to Unicode unless told not to, as specified on msdn */
1502  if (This->grfFlags & PROPSETFLAG_ANSI)
1503  This->codePage = GetACP();
1504  else
1505  This->codePage = CP_UNICODE;
1506  }
1507  if (!This->locale)
1508  This->locale = LOCALE_SYSTEM_DEFAULT;
1509  TRACE("Code page is %d, locale is %d\n", This->codePage, This->locale);
1510  if (dictOffset)
1512  buf + dictOffset - sizeof(PROPERTYSECTIONHEADER));
1513 
1514 end:
1515  HeapFree(GetProcessHeap(), 0, buf);
1516  if (FAILED(hr))
1517  {
1518  dictionary_destroy(This->name_to_propid);
1519  This->name_to_propid = NULL;
1520  dictionary_destroy(This->propid_to_name);
1521  This->propid_to_name = NULL;
1522  dictionary_destroy(This->propid_to_prop);
1523  This->propid_to_prop = NULL;
1524  }
1525  return hr;
1526 }
char hdr[14]
Definition: iptest.cpp:33
#define PROPSETHDR_OSVER_KIND_MAC
Definition: stg_prop.c:71
Definition: compat.h:1948
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:2968
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:112
static HRESULT PropertyStorage_ReadSectionHeaderFromStream(IStream *stm, PROPERTYSECTIONHEADER *hdr)
Definition: stg_prop.c:1309
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:1050
#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:69
#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:464
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:1280
static void *__thiscall_wrapper Allocate_CoTaskMemAlloc(void *this, ULONG size)
Definition: stg_prop.c:1042
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetACP(VOID)
Definition: nls.c:2180
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:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:78
#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:1245
unsigned char BYTE
Definition: xxhash.c:193
_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:994
#define CP_UNICODE
Definition: stg_prop.c:74
#define HeapFree(x, y, z)
Definition: compat.h:403
Definition: compat.h:1947
#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 1245 of file stg_prop.c.

1247 {
1248  BYTE buf[sizeof(PROPERTYSETHEADER)];
1249  ULONG count = 0;
1250  HRESULT hr;
1251 
1252  assert(stm);
1253  assert(hdr);
1254  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1255  if (SUCCEEDED(hr))
1256  {
1257  if (count != sizeof(buf))
1258  {
1259  WARN("read only %d\n", count);
1261  }
1262  else
1263  {
1265  &hdr->wByteOrder);
1267  &hdr->wFormat);
1269  &hdr->dwOSVer);
1271  &hdr->clsid);
1273  &hdr->reserved);
1274  }
1275  }
1276  TRACE("returning 0x%08x\n", hr);
1277  return hr;
1278 }
void StorageUtl_ReadWord(const BYTE *buffer, ULONG offset, WORD *value)
Definition: storage32.c:6943
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:112
#define assert(x)
Definition: debug.h:53
r reserved
Definition: btrfs.c:2940
#define offsetof(TYPE, MEMBER)
#define STG_E_INVALIDHEADER
Definition: winerror.h:2583
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
REFCLSID clsid
Definition: msctf.c:82
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6957
void StorageUtl_ReadGUID(const BYTE *buffer, ULONG offset, GUID *value)
Definition: storage32.c:6999
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 1050 of file stg_prop.c.

1052 {
1053  HRESULT hr = S_OK;
1054  DWORD vt;
1055 
1056  assert(prop);
1057  assert(data);
1059  data += sizeof(DWORD);
1060  prop->vt = vt;
1061  switch (prop->vt)
1062  {
1063  case VT_EMPTY:
1064  case VT_NULL:
1065  break;
1066  case VT_I1:
1067  prop->u.cVal = *(const char *)data;
1068  TRACE("Read char 0x%x ('%c')\n", prop->u.cVal, prop->u.cVal);
1069  break;
1070  case VT_UI1:
1071  prop->u.bVal = *data;
1072  TRACE("Read byte 0x%x\n", prop->u.bVal);
1073  break;
1074  case VT_BOOL:
1075  StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.boolVal);
1076  TRACE("Read bool %d\n", prop->u.boolVal);
1077  break;
1078  case VT_I2:
1079  StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.iVal);
1080  TRACE("Read short %d\n", prop->u.iVal);
1081  break;
1082  case VT_UI2:
1083  StorageUtl_ReadWord(data, 0, &prop->u.uiVal);
1084  TRACE("Read ushort %d\n", prop->u.uiVal);
1085  break;
1086  case VT_INT:
1087  case VT_I4:
1088  StorageUtl_ReadDWord(data, 0, (DWORD*)&prop->u.lVal);
1089  TRACE("Read long %d\n", prop->u.lVal);
1090  break;
1091  case VT_UINT:
1092  case VT_UI4:
1093  StorageUtl_ReadDWord(data, 0, &prop->u.ulVal);
1094  TRACE("Read ulong %d\n", prop->u.ulVal);
1095  break;
1096  case VT_I8:
1097  StorageUtl_ReadULargeInteger(data, 0, (ULARGE_INTEGER *)&prop->u.hVal);
1098  TRACE("Read long long %s\n", wine_dbgstr_longlong(prop->u.hVal.QuadPart));
1099  break;
1100  case VT_UI8:
1101  StorageUtl_ReadULargeInteger(data, 0, &prop->u.uhVal);
1102  TRACE("Read ulong long %s\n", wine_dbgstr_longlong(prop->u.uhVal.QuadPart));
1103  break;
1104  case VT_R8:
1105  memcpy(&prop->u.dblVal, data, sizeof(double));
1106  TRACE("Read double %f\n", prop->u.dblVal);
1107  break;
1108  case VT_LPSTR:
1109  {
1110  DWORD count;
1111 
1113  if (codepage == CP_UNICODE && count % 2)
1114  {
1115  WARN("Unicode string has odd number of bytes\n");
1117  }
1118  else
1119  {
1120  prop->u.pszVal = allocate(allocate_data, count);
1121  if (prop->u.pszVal)
1122  {
1123  memcpy(prop->u.pszVal, data + sizeof(DWORD), count);
1124  /* This is stored in the code page specified in codepage.
1125  * Don't convert it, the caller will just store it as-is.
1126  */
1127  if (codepage == CP_UNICODE)
1128  {
1129  /* Make sure it's NULL-terminated */
1130  prop->u.pszVal[count / sizeof(WCHAR) - 1] = '\0';
1131  TRACE("Read string value %s\n",
1132  debugstr_w(prop->u.pwszVal));
1133  }
1134  else
1135  {
1136  /* Make sure it's NULL-terminated */
1137  prop->u.pszVal[count - 1] = '\0';
1138  TRACE("Read string value %s\n", debugstr_a(prop->u.pszVal));
1139  }
1140  }
1141  else
1143  }
1144  break;
1145  }
1146  case VT_BSTR:
1147  {
1148  DWORD count, wcount;
1149 
1151  if (codepage == CP_UNICODE && count % 2)
1152  {
1153  WARN("Unicode string has odd number of bytes\n");
1155  }
1156  else
1157  {
1158  if (codepage == CP_UNICODE)
1159  wcount = count / 2;
1160  else
1161  wcount = MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, NULL, 0);
1162 
1163  prop->u.bstrVal = SysAllocStringLen(NULL, wcount); /* FIXME: use allocator? */
1164 
1165  if (prop->u.bstrVal)
1166  {
1167  if (codepage == CP_UNICODE)
1168  memcpy(prop->u.bstrVal, data + sizeof(DWORD), count);
1169  else
1170  MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, prop->u.bstrVal, wcount);
1171 
1172  prop->u.bstrVal[wcount - 1] = '\0';
1173  TRACE("Read string value %s\n", debugstr_w(prop->u.bstrVal));
1174  }
1175  else
1177  }
1178  break;
1179  }
1180  case VT_BLOB:
1181  {
1182  DWORD count;
1183 
1185  prop->u.blob.cbSize = count;
1186  prop->u.blob.pBlobData = allocate(allocate_data, count);
1187  if (prop->u.blob.pBlobData)
1188  {
1189  memcpy(prop->u.blob.pBlobData, data + sizeof(DWORD), count);
1190  TRACE("Read blob value of size %d\n", count);
1191  }
1192  else
1194  break;
1195  }
1196  case VT_LPWSTR:
1197  {
1198  DWORD count;
1199 
1201  prop->u.pwszVal = allocate(allocate_data, count * sizeof(WCHAR));
1202  if (prop->u.pwszVal)
1203  {
1204  memcpy(prop->u.pwszVal, data + sizeof(DWORD),
1205  count * sizeof(WCHAR));
1206  /* make sure string is NULL-terminated */
1207  prop->u.pwszVal[count - 1] = '\0';
1208  PropertyStorage_ByteSwapString(prop->u.pwszVal, count);
1209  TRACE("Read string value %s\n", debugstr_w(prop->u.pwszVal));
1210  }
1211  else
1213  break;
1214  }
1215  case VT_FILETIME:
1217  (ULARGE_INTEGER *)&prop->u.filetime);
1218  break;
1219  case VT_CF:
1220  {
1221  DWORD len = 0, tag = 0;
1222 
1225  if (len > 8)
1226  {
1227  len -= 8;
1228  prop->u.pclipdata = allocate(allocate_data, sizeof (CLIPDATA));
1229  prop->u.pclipdata->cbSize = len;
1230  prop->u.pclipdata->ulClipFmt = tag;
1231  prop->u.pclipdata->pClipData = allocate(allocate_data, len - sizeof(prop->u.pclipdata->ulClipFmt));
1232  memcpy(prop->u.pclipdata->pClipData, data+8, len - sizeof(prop->u.pclipdata->ulClipFmt));
1233  }
1234  else
1236  }
1237  break;
1238  default:
1239  FIXME("unsupported type %d\n", prop->vt);
1241  }
1242  return hr;
1243 }
void StorageUtl_ReadWord(const BYTE *buffer, ULONG offset, WORD *value)
Definition: storage32.c:6943
Definition: compat.h:1948
Definition: compat.h:1964
HRESULT hr
Definition: shlfolder.c:183
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
Definition: compat.h:1960
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:112
#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:111
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:78
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:1986
#define PropertyStorage_ByteSwapString(s, l)
Definition: stg_prop.c:986
#define S_OK
Definition: intsafe.h:59
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6957
void StorageUtl_ReadULargeInteger(const BYTE *buffer, ULONG offset, ULARGE_INTEGER *value)
Definition: storage32.c:6971
#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:74
Definition: compat.h:1950
Definition: compat.h:1947
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 1309 of file stg_prop.c.

1311 {
1312  BYTE buf[sizeof(PROPERTYSECTIONHEADER)];
1313  ULONG count = 0;
1314  HRESULT hr;
1315 
1316  assert(stm);
1317  assert(hdr);
1318  hr = IStream_Read(stm, buf, sizeof(buf), &count);
1319  if (SUCCEEDED(hr))
1320  {
1321  if (count != sizeof(buf))
1322  {
1323  WARN("read only %d\n", count);
1325  }
1326  else
1327  {
1329  cbSection), &hdr->cbSection);
1331  cProperties), &hdr->cProperties);
1332  }
1333  }
1334  TRACE("returning 0x%08x\n", hr);
1335  return hr;
1336 }
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:112
#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:78
unsigned char BYTE
Definition: xxhash.c:193
void StorageUtl_ReadDWord(const BYTE *buffer, ULONG offset, DWORD *value)
Definition: storage32.c:6957
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 519 of file stg_prop.c.

521 {
522  LPSTR name;
523  HRESULT hr;
524 
525  assert(srcName);
526 
527  hr = PropertyStorage_StringCopy(srcName, cp, &name, This->codePage);
528  if (SUCCEEDED(hr))
529  {
530  if (This->codePage == CP_UNICODE)
531  {
533  This->format = 1;
534  }
535  else
536  {
538  This->format = 1;
539  }
540  TRACE("Adding prop name %s, propid %d\n",
541  This->codePage == CP_UNICODE ? debugstr_w((LPCWSTR)name) :
542  debugstr_a(name), id);
543  dictionary_insert(This->name_to_propid, name, UlongToPtr(id));
544  dictionary_insert(This->propid_to_name, UlongToPtr(id), name);
545  }
546  return hr;
547 }
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:76
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:416
#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:78
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:38
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, LCID targetCP)
Definition: stg_prop.c:354
#define CP_UNICODE
Definition: stg_prop.c:74
#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 464 of file stg_prop.c.

466 {
467  HRESULT hr = S_OK;
468  PROPVARIANT *prop = PropertyStorage_FindProperty(This, propid);
469 
470  assert(propvar);
471  if (propvar->vt & VT_BYREF || propvar->vt & VT_ARRAY)
472  This->format = 1;
473  switch (propvar->vt)
474  {
475  case VT_DECIMAL:
476  case VT_I1:
477  case VT_INT:
478  case VT_UINT:
479  case VT_VECTOR|VT_I1:
480  This->format = 1;
481  }
482  TRACE("Setting 0x%08x to type %d\n", propid, propvar->vt);
483  if (prop)
484  {
485  PropVariantClear(prop);
486  hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
487  lcid);
488  }
489  else
490  {
492  sizeof(PROPVARIANT));
493  if (prop)
494  {
495  hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
496  lcid);
497  if (SUCCEEDED(hr))
498  {
499  dictionary_insert(This->propid_to_prop, UlongToPtr(propid), prop);
500  if (propid > This->highestProp)
501  This->highestProp = propid;
502  }
503  else
504  HeapFree(GetProcessHeap(), 0, prop);
505  }
506  else
508  }
509  return hr;
510 }
static PROPVARIANT * PropertyStorage_FindProperty(PropertyStorage_impl *This, DWORD propid)
Definition: stg_prop.c:241
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1960
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
#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:438
#define UlongToPtr(u)
Definition: config.h:106
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:78
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:403
#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 354 of file stg_prop.c.

356 {
357  HRESULT hr = S_OK;
358  int len;
359 
360  TRACE("%s, %p, %d, %d\n",
361  srcCP == CP_UNICODE ? debugstr_w((LPCWSTR)src) : debugstr_a(src), dst,
362  dstCP, srcCP);
363  assert(src);
364  assert(dst);
365  *dst = NULL;
366  if (dstCP == srcCP)
367  {
368  size_t len;
369 
370  if (dstCP == CP_UNICODE)
371  len = (lstrlenW((LPCWSTR)src) + 1) * sizeof(WCHAR);
372  else
373  len = strlen(src) + 1;
374  *dst = CoTaskMemAlloc(len * sizeof(WCHAR));
375  if (!*dst)
377  else
378  memcpy(*dst, src, len);
379  }
380  else
381  {
382  if (dstCP == CP_UNICODE)
383  {
384  len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
385  *dst = CoTaskMemAlloc(len * sizeof(WCHAR));
386  if (!*dst)
388  else
389  MultiByteToWideChar(srcCP, 0, src, -1, (LPWSTR)*dst, len);
390  }
391  else
392  {
393  LPCWSTR wideStr = NULL;
394  LPWSTR wideStr_tmp = NULL;
395 
396  if (srcCP == CP_UNICODE)
397  wideStr = (LPCWSTR)src;
398  else
399  {
400  len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
401  wideStr_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
402  if (wideStr_tmp)
403  {
404  MultiByteToWideChar(srcCP, 0, src, -1, wideStr_tmp, len);
405  wideStr = wideStr_tmp;
406  }
407  else
409  }
410  if (SUCCEEDED(hr))
411  {
412  len = WideCharToMultiByte(dstCP, 0, wideStr, -1, NULL, 0,
413  NULL, NULL);
414  *dst = CoTaskMemAlloc(len);
415  if (!*dst)
417  else
418  {
419  BOOL defCharUsed = FALSE;
420 
421  if (WideCharToMultiByte(dstCP, 0, wideStr, -1, *dst, len,
422  NULL, &defCharUsed) == 0 || defCharUsed)
423  {
424  CoTaskMemFree(*dst);
425  *dst = NULL;
427  }
428  }
429  }
430  HeapFree(GetProcessHeap(), 0, wideStr_tmp);
431  }
432  }
433  TRACE("returning 0x%08x (%s)\n", hr,
434  dstCP == CP_UNICODE ? debugstr_w((LPCWSTR)*dst) : debugstr_a(*dst));
435  return hr;
436 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#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
#define lstrlenW
Definition: compat.h:416
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:404
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:78
#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:74
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define HeapFree(x, y, z)
Definition: compat.h:403
#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 1654 of file stg_prop.c.

1656 {
1657  HRESULT hr;
1659  PROPERTYIDOFFSET propIdOffset;
1660  ULONG count;
1661  DWORD dwTemp;
1662  struct DictionaryClosure closure;
1663 
1664  assert(sectionOffset);
1665 
1666  /* The dictionary's always the first property written, so seek to its
1667  * spot.
1668  */
1669  seek.QuadPart = SECTIONHEADER_OFFSET + sizeof(PROPERTYSECTIONHEADER);
1670  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1671  if (FAILED(hr))
1672  goto end;
1674  &propIdOffset);
1675  hr = IStream_Write(This->stm, &propIdOffset, sizeof(propIdOffset), &count);
1676  if (FAILED(hr))
1677  goto end;
1678 
1679  seek.QuadPart = SECTIONHEADER_OFFSET + *sectionOffset;
1680  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1681  if (FAILED(hr))
1682  goto end;
1683  StorageUtl_WriteDWord((LPBYTE)&dwTemp, 0,
1684  dictionary_num_entries(This->name_to_propid));
1685  hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
1686  if (FAILED(hr))
1687  goto end;
1688  *sectionOffset += sizeof(dwTemp);
1689 
1690  closure.hr = S_OK;
1691  closure.bytesWritten = 0;
1693  &closure);
1694  hr = closure.hr;
1695  if (FAILED(hr))
1696  goto end;
1697  *sectionOffset += closure.bytesWritten;
1698  if (closure.bytesWritten % sizeof(DWORD))
1699  {
1700  DWORD padding = sizeof(DWORD) - closure.bytesWritten % sizeof(DWORD);
1701  TRACE("adding %d bytes of padding\n", padding);
1702  *sectionOffset += padding;
1703  }
1704 
1705 end:
1706  return hr;
1707 }
static BOOL PropertyStorage_DictionaryWriter(const void *key, const void *value, void *extra, void *closure)
Definition: stg_prop.c:1592
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:53
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:78
#define SECTIONHEADER_OFFSET
Definition: stg_prop.c:1649
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:6965
static void PropertyStorage_MakePropertyIdOffset(DWORD propid, DWORD dwOffset, PROPERTYIDOFFSET *propIdOffset)
Definition: stg_prop.c:1558
#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 1897 of file stg_prop.c.

1898 {
1899  HRESULT hr;
1900  ULONG count = 0;
1901  LARGE_INTEGER seek = { {0} };
1903  FORMATIDOFFSET fmtOffset;
1904 
1905  hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL);
1906  if (FAILED(hr))
1907  goto end;
1909  hr = IStream_Write(This->stm, &hdr, sizeof(hdr), &count);
1910  if (FAILED(hr))
1911  goto end;
1912  if (count != sizeof(hdr))
1913  {
1914  hr = STG_E_WRITEFAULT;
1915  goto end;
1916  }
1917 
1919  hr = IStream_Write(This->stm, &fmtOffset, sizeof(fmtOffset), &count);
1920  if (FAILED(hr))
1921  goto end;
1922  if (count != sizeof(fmtOffset))
1923  {
1924  hr = STG_E_WRITEFAULT;
1925  goto end;
1926  }
1927  hr = S_OK;
1928 
1929 end:
1930  return hr;
1931 }
#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:1540
static void PropertyStorage_MakeHeader(PropertyStorage_impl *This, PROPERTYSETHEADER *hdr)
Definition: stg_prop.c:1528
GLuint GLuint end
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
#define S_OK<