ReactOS 0.4.15-dev-8207-gd73a838
recinfo.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "oaidl.h"
#include "oleauto.h"
#include "variant.h"
#include "wine/debug.h"
Include dependency graph for recinfo.c:

Go to the source code of this file.

Classes

struct  fieldstr
 
struct  IRecordInfoImpl
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define CASE_COPY(x)
 
#define CASE_COPY(x)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static IRecordInfoImplimpl_from_IRecordInfo (IRecordInfo *iface)
 
static HRESULT copy_to_variant (void *src, VARIANT *pvar, enum VARENUM vt)
 
static HRESULT copy_from_variant (VARIANT *src, void *dest, enum VARENUM vt)
 
static HRESULT WINAPI IRecordInfoImpl_QueryInterface (IRecordInfo *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IRecordInfoImpl_AddRef (IRecordInfo *iface)
 
static ULONG WINAPI IRecordInfoImpl_Release (IRecordInfo *iface)
 
static HRESULT WINAPI IRecordInfoImpl_RecordInit (IRecordInfo *iface, PVOID pvNew)
 
static HRESULT WINAPI IRecordInfoImpl_RecordClear (IRecordInfo *iface, PVOID pvExisting)
 
static HRESULT WINAPI IRecordInfoImpl_RecordCopy (IRecordInfo *iface, void *src_rec, void *dest_rec)
 
static HRESULT WINAPI IRecordInfoImpl_GetGuid (IRecordInfo *iface, GUID *pguid)
 
static HRESULT WINAPI IRecordInfoImpl_GetName (IRecordInfo *iface, BSTR *pbstrName)
 
static HRESULT WINAPI IRecordInfoImpl_GetSize (IRecordInfo *iface, ULONG *pcbSize)
 
static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo (IRecordInfo *iface, ITypeInfo **ppTypeInfo)
 
static HRESULT WINAPI IRecordInfoImpl_GetField (IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy (IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray)
 
static HRESULT WINAPI IRecordInfoImpl_PutField (IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy (IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI IRecordInfoImpl_GetFieldNames (IRecordInfo *iface, ULONG *pcNames, BSTR *rgBstrNames)
 
static BOOL WINAPI IRecordInfoImpl_IsMatchingType (IRecordInfo *iface, IRecordInfo *info2)
 
static PVOID WINAPI IRecordInfoImpl_RecordCreate (IRecordInfo *iface)
 
static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy (IRecordInfo *iface, PVOID pvSource, PVOID *ppvDest)
 
static HRESULT WINAPI IRecordInfoImpl_RecordDestroy (IRecordInfo *iface, PVOID pvRecord)
 
HRESULT WINAPI GetRecordInfoFromGuids (REFGUID rGuidTypeLib, ULONG uVerMajor, ULONG uVerMinor, LCID lcid, REFGUID rGuidTypeInfo, IRecordInfo **ppRecInfo)
 
HRESULT WINAPI GetRecordInfoFromTypeInfo (ITypeInfo *pTI, IRecordInfo **ppRecInfo)
 

Variables

static const IRecordInfoVtbl IRecordInfoImplVtbl
 

Macro Definition Documentation

◆ CASE_COPY [1/2]

#define CASE_COPY (   x)
Value:
case VT_ ## x: \
memcpy(&V_ ## x(pvar), src, sizeof(V_ ## x(pvar))); \
break
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLenum src
Definition: glext.h:6340

◆ CASE_COPY [2/2]

#define CASE_COPY (   x)
Value:
case VT_ ## x: \
memcpy(dest, &V_ ## x(&var), sizeof(V_ ## x(&var))); \
break
const char * var
Definition: shader.c:5666
static char * dest
Definition: rtl.c:135

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file recinfo.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 22 of file recinfo.c.

Function Documentation

◆ copy_from_variant()

static HRESULT copy_from_variant ( VARIANT src,
void dest,
enum VARENUM  vt 
)
static

Definition at line 100 of file recinfo.c.

101{
102 VARIANT var;
104
105 TRACE("(%p(%d) %p %d)\n", src, V_VT(src), dest, vt);
106
108 if(FAILED(hres))
109 return hres;
110
111#define CASE_COPY(x) \
112 case VT_ ## x: \
113 memcpy(dest, &V_ ## x(&var), sizeof(V_ ## x(&var))); \
114 break
115
116 switch(vt) {
117 CASE_COPY(I2);
118 CASE_COPY(I4);
119 CASE_COPY(R4);
120 CASE_COPY(R8);
121 CASE_COPY(CY);
127 CASE_COPY(I1);
128 CASE_COPY(UI1);
129 CASE_COPY(UI2);
130 CASE_COPY(UI4);
131 CASE_COPY(I8);
132 CASE_COPY(UI8);
133 CASE_COPY(INT);
137 default:
138 FIXME("Not supported type: %d\n", V_VT(&var));
139 return E_NOTIMPL;
140 };
141#undef CASE_COPY
142 return S_OK;
143}
@ R8
Definition: amd64_sup.c:13
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99
double DATE
Definition: compat.h:2253
OLECHAR * BSTR
Definition: compat.h:2293
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
#define ERROR(name)
Definition: error_private.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define V_VT(A)
Definition: oleauto.h:211
#define CASE_COPY(x)
#define R4(v, w, x, y, z, i)
Definition: sha1.c:39
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
Definition: compat.h:2255
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962

Referenced by IRecordInfoImpl_PutField().

◆ copy_to_variant()

static HRESULT copy_to_variant ( void src,
VARIANT pvar,
enum VARENUM  vt 
)
static

Definition at line 60 of file recinfo.c.

61{
62 TRACE("%p %p %d\n", src, pvar, vt);
63
64#define CASE_COPY(x) \
65 case VT_ ## x: \
66 memcpy(&V_ ## x(pvar), src, sizeof(V_ ## x(pvar))); \
67 break
68
69 switch(vt) {
70 CASE_COPY(I2);
71 CASE_COPY(I4);
80 CASE_COPY(I1);
81 CASE_COPY(UI1);
82 CASE_COPY(UI2);
83 CASE_COPY(UI4);
84 CASE_COPY(I8);
85 CASE_COPY(UI8);
90 default:
91 FIXME("Not supported type: %d\n", vt);
92 return E_NOTIMPL;
93 };
94#undef CASE_COPY
95
96 V_VT(pvar) = vt;
97 return S_OK;
98}

Referenced by IRecordInfoImpl_GetField().

◆ GetRecordInfoFromGuids()

HRESULT WINAPI GetRecordInfoFromGuids ( REFGUID  rGuidTypeLib,
ULONG  uVerMajor,
ULONG  uVerMinor,
LCID  lcid,
REFGUID  rGuidTypeInfo,
IRecordInfo **  ppRecInfo 
)

Definition at line 594 of file recinfo.c.

596{
597 ITypeInfo *pTypeInfo;
598 ITypeLib *pTypeLib;
600
601 TRACE("(%p,%d,%d,%d,%s,%p)\n", rGuidTypeLib, uVerMajor, uVerMinor,
602 lcid, debugstr_guid(rGuidTypeInfo), ppRecInfo);
603
604 hres = LoadRegTypeLib(rGuidTypeLib, uVerMajor, uVerMinor, lcid, &pTypeLib);
605 if(FAILED(hres)) {
606 WARN("LoadRegTypeLib failed!\n");
607 return hres;
608 }
609
610 hres = ITypeLib_GetTypeInfoOfGuid(pTypeLib, rGuidTypeInfo, &pTypeInfo);
611 ITypeLib_Release(pTypeLib);
612 if(FAILED(hres)) {
613 WARN("GetTypeInfoOfGuid failed!\n");
614 return hres;
615 }
616
617 hres = GetRecordInfoFromTypeInfo(pTypeInfo, ppRecInfo);
618 ITypeInfo_Release(pTypeInfo);
619 return hres;
620}
#define WARN(fmt,...)
Definition: debug.h:115
HRESULT WINAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid, ITypeLib **ppTLib)
Definition: typelib.c:531
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo *pTI, IRecordInfo **ppRecInfo)
Definition: recinfo.c:625

◆ GetRecordInfoFromTypeInfo()

HRESULT WINAPI GetRecordInfoFromTypeInfo ( ITypeInfo pTI,
IRecordInfo **  ppRecInfo 
)

Definition at line 625 of file recinfo.c.

625 {
627 TYPEATTR *typeattr;
629 ITypeInfo *pTypeInfo;
630 int i;
631 GUID guid;
632
633 TRACE("(%p %p)\n", pTI, ppRecInfo);
634
635 if(!pTI || !ppRecInfo)
636 return E_INVALIDARG;
637
638 hres = ITypeInfo_GetTypeAttr(pTI, &typeattr);
639 if(FAILED(hres) || !typeattr) {
640 WARN("GetTypeAttr failed: %08x\n", hres);
641 return hres;
642 }
643
644 if(typeattr->typekind == TKIND_ALIAS) {
645 hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.u.hreftype, &pTypeInfo);
646 guid = typeattr->guid;
647 ITypeInfo_ReleaseTypeAttr(pTI, typeattr);
648 if(FAILED(hres)) {
649 WARN("GetRefTypeInfo failed: %08x\n", hres);
650 return hres;
651 }
652 hres = ITypeInfo_GetTypeAttr(pTypeInfo, &typeattr);
653 if(FAILED(hres)) {
654 ITypeInfo_Release(pTypeInfo);
655 WARN("GetTypeAttr failed for referenced type: %08x\n", hres);
656 return hres;
657 }
658 }else {
659 pTypeInfo = pTI;
660 ITypeInfo_AddRef(pTypeInfo);
661 guid = typeattr->guid;
662 }
663
664 if(typeattr->typekind != TKIND_RECORD) {
665 WARN("typekind != TKIND_RECORD\n");
666 ITypeInfo_ReleaseTypeAttr(pTypeInfo, typeattr);
667 ITypeInfo_Release(pTypeInfo);
668 return E_INVALIDARG;
669 }
670
671 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
672 ret->IRecordInfo_iface.lpVtbl = &IRecordInfoImplVtbl;
673 ret->ref = 1;
674 ret->pTypeInfo = pTypeInfo;
675 ret->n_vars = typeattr->cVars;
676 ret->size = typeattr->cbSizeInstance;
677 ITypeInfo_ReleaseTypeAttr(pTypeInfo, typeattr);
678
679 ret->guid = guid;
680
681 /* NOTE: Windows implementation calls ITypeInfo::GetCantainingTypeLib and
682 * ITypeLib::GetLibAttr, but we currently don't need this.
683 */
684
685 hres = ITypeInfo_GetDocumentation(pTypeInfo, MEMBERID_NIL, &ret->name, NULL, NULL, NULL);
686 if(FAILED(hres)) {
687 WARN("ITypeInfo::GetDocumentation failed\n");
688 ret->name = NULL;
689 }
690
691 ret->fields = HeapAlloc(GetProcessHeap(), 0, ret->n_vars*sizeof(fieldstr));
692 for(i = 0; i<ret->n_vars; i++) {
693 VARDESC *vardesc;
694 hres = ITypeInfo_GetVarDesc(pTypeInfo, i, &vardesc);
695 if(FAILED(hres)) {
696 WARN("GetVarDesc failed\n");
697 continue;
698 }
699 ret->fields[i].vt = vardesc->elemdescVar.tdesc.vt;
700 ret->fields[i].varkind = vardesc->varkind;
701 ret->fields[i].offset = vardesc->u.oInst;
702 hres = ITypeInfo_GetDocumentation(pTypeInfo, vardesc->memid, &ret->fields[i].name,
703 NULL, NULL, NULL);
704 if(FAILED(hres))
705 WARN("GetDocumentation failed: %08x\n", hres);
706 TRACE("field=%s, offset=%d\n", debugstr_w(ret->fields[i].name), ret->fields[i].offset);
707 ITypeInfo_ReleaseVarDesc(pTypeInfo, vardesc);
708 }
709
710 *ppRecInfo = &ret->IRecordInfo_iface;
711
712 return S_OK;
713}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
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
const GUID * guid
#define MEMBERID_NIL
Definition: oleauto.h:1003
static const IRecordInfoVtbl IRecordInfoImplVtbl
Definition: recinfo.c:565
int ret
@ TKIND_RECORD
Definition: widltypes.h:220
@ TKIND_ALIAS
Definition: widltypes.h:225

Referenced by GetRecordInfoFromGuids(), and test_recinfo().

◆ impl_from_IRecordInfo()

◆ IRecordInfoImpl_AddRef()

static ULONG WINAPI IRecordInfoImpl_AddRef ( IRecordInfo iface)
static

Definition at line 162 of file recinfo.c.

163{
166 TRACE("(%p) -> %d\n", This, ref);
167 return ref;
168}
#define InterlockedIncrement
Definition: armddk.h:53
static IRecordInfoImpl * impl_from_IRecordInfo(IRecordInfo *iface)
Definition: recinfo.c:55
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IRecordInfoImpl_GetField()

static HRESULT WINAPI IRecordInfoImpl_GetField ( IRecordInfo iface,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 392 of file recinfo.c.

394{
396 int i;
397
398 TRACE("(%p)->(%p %s %p)\n", This, pvData, debugstr_w(szFieldName), pvarField);
399
400 if(!pvData || !szFieldName || !pvarField)
401 return E_INVALIDARG;
402
403 for(i=0; i<This->n_vars; i++)
404 if(!wcscmp(This->fields[i].name, szFieldName))
405 break;
406 if(i == This->n_vars)
408
409 VariantClear(pvarField);
410 return copy_to_variant(((PBYTE)pvData)+This->fields[i].offset, pvarField,
411 This->fields[i].vt);
412}
BYTE * PBYTE
Definition: pedump.c:66
static HRESULT copy_to_variant(void *src, VARIANT *pvar, enum VARENUM vt)
Definition: recinfo.c:60
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
#define TYPE_E_FIELDNOTFOUND
Definition: winerror.h:2530

◆ IRecordInfoImpl_GetFieldNames()

static HRESULT WINAPI IRecordInfoImpl_GetFieldNames ( IRecordInfo iface,
ULONG pcNames,
BSTR rgBstrNames 
)
static

Definition at line 487 of file recinfo.c.

489{
491 ULONG n = This->n_vars, i;
492
493 TRACE("(%p)->(%p %p)\n", This, pcNames, rgBstrNames);
494
495 if(!pcNames)
496 return E_INVALIDARG;
497
498 if(*pcNames < n)
499 n = *pcNames;
500
501 if(rgBstrNames) {
502 for(i=0; i<n; i++)
503 rgBstrNames[i] = SysAllocString(This->fields[i].name);
504 }
505
506 *pcNames = n;
507 return S_OK;
508}
GLdouble n
Definition: glext.h:7729
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

◆ IRecordInfoImpl_GetFieldNoCopy()

static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy ( IRecordInfo iface,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField,
PVOID ppvDataCArray 
)
static

Definition at line 414 of file recinfo.c.

416{
418 int i;
419
420 TRACE("(%p)->(%p %s %p %p)\n", This, pvData, debugstr_w(szFieldName), pvarField, ppvDataCArray);
421
422 if(!pvData || !szFieldName || !pvarField)
423 return E_INVALIDARG;
424
425 for(i=0; i<This->n_vars; i++)
426 if(!wcscmp(This->fields[i].name, szFieldName))
427 break;
428 if(i == This->n_vars)
430
431 VariantClear(pvarField);
432 V_VT(pvarField) = VT_BYREF|This->fields[i].vt;
433 V_BYREF(pvarField) = ((PBYTE)pvData)+This->fields[i].offset;
434 *ppvDataCArray = NULL;
435 return S_OK;
436}
@ VT_BYREF
Definition: compat.h:2342
#define V_BYREF(A)
Definition: oleauto.h:228

◆ IRecordInfoImpl_GetGuid()

static HRESULT WINAPI IRecordInfoImpl_GetGuid ( IRecordInfo iface,
GUID pguid 
)
static

Definition at line 338 of file recinfo.c.

339{
341
342 TRACE("(%p)->(%p)\n", This, pguid);
343
344 if(!pguid)
345 return E_INVALIDARG;
346
347 *pguid = This->guid;
348 return S_OK;
349}

◆ IRecordInfoImpl_GetName()

static HRESULT WINAPI IRecordInfoImpl_GetName ( IRecordInfo iface,
BSTR pbstrName 
)
static

Definition at line 351 of file recinfo.c.

352{
354
355 TRACE("(%p)->(%p)\n", This, pbstrName);
356
357 if(!pbstrName)
358 return E_INVALIDARG;
359
360 *pbstrName = SysAllocString(This->name);
361 return S_OK;
362}

◆ IRecordInfoImpl_GetSize()

static HRESULT WINAPI IRecordInfoImpl_GetSize ( IRecordInfo iface,
ULONG pcbSize 
)
static

Definition at line 364 of file recinfo.c.

365{
367
368 TRACE("(%p)->(%p)\n", This, pcbSize);
369
370 if(!pcbSize)
371 return E_INVALIDARG;
372
373 *pcbSize = This->size;
374 return S_OK;
375}

◆ IRecordInfoImpl_GetTypeInfo()

static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo ( IRecordInfo iface,
ITypeInfo **  ppTypeInfo 
)
static

Definition at line 377 of file recinfo.c.

378{
380
381 TRACE("(%p)->(%p)\n", This, ppTypeInfo);
382
383 if(!ppTypeInfo)
384 return E_INVALIDARG;
385
386 ITypeInfo_AddRef(This->pTypeInfo);
387 *ppTypeInfo = This->pTypeInfo;
388
389 return S_OK;
390}

◆ IRecordInfoImpl_IsMatchingType()

static BOOL WINAPI IRecordInfoImpl_IsMatchingType ( IRecordInfo iface,
IRecordInfo info2 
)
static

Definition at line 510 of file recinfo.c.

511{
513 GUID guid2;
514
515 TRACE( "(%p)->(%p)\n", This, info2 );
516
517 IRecordInfo_GetGuid( info2, &guid2 );
518 return IsEqualGUID( &This->guid, &guid2 );
519}
static GUID guid2
Definition: devinst.c:42
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ IRecordInfoImpl_PutField()

static HRESULT WINAPI IRecordInfoImpl_PutField ( IRecordInfo iface,
ULONG  wFlags,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 438 of file recinfo.c.

440{
442 int i;
443
444 TRACE("(%p)->(%08x %p %s %p)\n", This, wFlags, pvData, debugstr_w(szFieldName),
445 pvarField);
446
447 if(!pvData || !szFieldName || !pvarField
448 || (wFlags != INVOKE_PROPERTYPUTREF && wFlags != INVOKE_PROPERTYPUT))
449 return E_INVALIDARG;
450
451 if(wFlags == INVOKE_PROPERTYPUTREF) {
452 FIXME("wFlag == INVOKE_PROPERTYPUTREF not supported\n");
453 return E_NOTIMPL;
454 }
455
456 for(i=0; i<This->n_vars; i++)
457 if(!wcscmp(This->fields[i].name, szFieldName))
458 break;
459 if(i == This->n_vars)
461
462 return copy_from_variant(pvarField, ((PBYTE)pvData)+This->fields[i].offset,
463 This->fields[i].vt);
464}
static HRESULT copy_from_variant(VARIANT *src, void *dest, enum VARENUM vt)
Definition: recinfo.c:100
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ IRecordInfoImpl_PutFieldNoCopy()

static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy ( IRecordInfo iface,
ULONG  wFlags,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 466 of file recinfo.c.

468{
470 int i;
471
472 FIXME("(%p)->(%08x %p %s %p) stub\n", This, wFlags, pvData, debugstr_w(szFieldName), pvarField);
473
474 if(!pvData || !szFieldName || !pvarField
475 || (wFlags != INVOKE_PROPERTYPUTREF && wFlags != INVOKE_PROPERTYPUT))
476 return E_INVALIDARG;
477
478 for(i=0; i<This->n_vars; i++)
479 if(!wcscmp(This->fields[i].name, szFieldName))
480 break;
481 if(i == This->n_vars)
483
484 return E_NOTIMPL;
485}

◆ IRecordInfoImpl_QueryInterface()

static HRESULT WINAPI IRecordInfoImpl_QueryInterface ( IRecordInfo iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 145 of file recinfo.c.

147{
148 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
149
150 *ppvObject = NULL;
151
152 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRecordInfo, riid)) {
153 *ppvObject = iface;
154 IRecordInfo_AddRef(iface);
155 return S_OK;
156 }
157
158 FIXME("Not supported interface: %s\n", debugstr_guid(riid));
159 return E_NOINTERFACE;
160}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IRecordInfoImpl_RecordClear()

static HRESULT WINAPI IRecordInfoImpl_RecordClear ( IRecordInfo iface,
PVOID  pvExisting 
)
static

Definition at line 201 of file recinfo.c.

202{
204 int i;
205 PVOID var;
206
207 TRACE("(%p)->(%p)\n", This, pvExisting);
208
209 if(!pvExisting)
210 return E_INVALIDARG;
211
212 for(i=0; i<This->n_vars; i++) {
213 if(This->fields[i].varkind != VAR_PERINSTANCE) {
214 ERR("varkind != VAR_PERINSTANCE\n");
215 continue;
216 }
217 var = ((PBYTE)pvExisting)+This->fields[i].offset;
218 switch(This->fields[i].vt) {
219 case VT_BSTR:
221 *(BSTR*)var = NULL;
222 break;
223 case VT_I2:
224 case VT_I4:
225 case VT_R4:
226 case VT_R8:
227 case VT_CY:
228 case VT_DATE:
229 case VT_ERROR:
230 case VT_BOOL:
231 case VT_DECIMAL:
232 case VT_I1:
233 case VT_UI1:
234 case VT_UI2:
235 case VT_UI4:
236 case VT_I8:
237 case VT_UI8:
238 case VT_INT:
239 case VT_UINT:
240 case VT_HRESULT:
241 break;
242 case VT_INT_PTR:
243 case VT_UINT_PTR:
244 *(void**)var = NULL;
245 break;
246 case VT_SAFEARRAY:
248 break;
249 case VT_UNKNOWN:
250 case VT_DISPATCH:
251 {
252 IUnknown *unk = *(IUnknown**)var;
253 if (unk)
254 IUnknown_Release(unk);
255 *(void**)var = NULL;
256 break;
257 }
258 default:
259 FIXME("Not supported vt = %d\n", This->fields[i].vt);
260 break;
261 }
262 }
263
264 return S_OK;
265}
#define ERR(fmt,...)
Definition: debug.h:113
@ VT_UI8
Definition: compat.h:2315
@ VT_BSTR
Definition: compat.h:2303
@ VT_INT
Definition: compat.h:2316
@ VT_R4
Definition: compat.h:2299
@ VT_UINT_PTR
Definition: compat.h:2328
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_UI2
Definition: compat.h:2312
@ VT_DECIMAL
Definition: compat.h:2309
@ VT_ERROR
Definition: compat.h:2305
@ VT_SAFEARRAY
Definition: compat.h:2321
@ VT_R8
Definition: compat.h:2300
@ VT_CY
Definition: compat.h:2301
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_HRESULT
Definition: compat.h:2319
@ VT_INT_PTR
Definition: compat.h:2327
@ VT_DATE
Definition: compat.h:2302
@ VT_BOOL
Definition: compat.h:2306
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UINT
Definition: compat.h:2317
@ VT_DISPATCH
Definition: compat.h:2304
@ VT_UI1
Definition: compat.h:2311
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

◆ IRecordInfoImpl_RecordCopy()

static HRESULT WINAPI IRecordInfoImpl_RecordCopy ( IRecordInfo iface,
void src_rec,
void dest_rec 
)
static

Definition at line 267 of file recinfo.c.

268{
270 HRESULT hr = S_OK;
271 int i;
272
273 TRACE("(%p)->(%p %p)\n", This, src_rec, dest_rec);
274
275 if(!src_rec || !dest_rec)
276 return E_INVALIDARG;
277
278 /* release already stored data */
279 IRecordInfo_RecordClear(iface, dest_rec);
280
281 for (i = 0; i < This->n_vars; i++)
282 {
283 void *src, *dest;
284
285 if (This->fields[i].varkind != VAR_PERINSTANCE) {
286 ERR("varkind != VAR_PERINSTANCE\n");
287 continue;
288 }
289
290 src = ((BYTE*)src_rec) + This->fields[i].offset;
291 dest = ((BYTE*)dest_rec) + This->fields[i].offset;
292 switch (This->fields[i].vt)
293 {
294 case VT_BSTR:
295 {
296 BSTR src_str = *(BSTR*)src;
297
298 if (src_str)
299 {
301 if (!str) hr = E_OUTOFMEMORY;
302
303 *(BSTR*)dest = str;
304 }
305 else
306 *(BSTR*)dest = NULL;
307 break;
308 }
309 case VT_UNKNOWN:
310 case VT_DISPATCH:
311 {
312 IUnknown *unk = *(IUnknown**)src;
313 *(IUnknown**)dest = unk;
314 if (unk) IUnknown_AddRef(unk);
315 break;
316 }
317 case VT_SAFEARRAY:
319 break;
320 default:
321 {
322 /* copy directly for types that don't need deep copy */
323 int len = get_type_size(NULL, This->fields[i].vt);
324 memcpy(dest, src, len);
325 break;
326 }
327 }
328
329 if (FAILED(hr)) break;
330 }
331
332 if (FAILED(hr))
333 IRecordInfo_RecordClear(iface, dest_rec);
334
335 return hr;
336}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
Definition: safearray.c:1379
unsigned int get_type_size(ULONG *pFlags, VARTYPE vt)
Definition: usrmarshal.c:209
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const WCHAR * str
HRESULT hr
Definition: shlfolder.c:183
unsigned char BYTE
Definition: xxhash.c:193

◆ IRecordInfoImpl_RecordCreate()

static PVOID WINAPI IRecordInfoImpl_RecordCreate ( IRecordInfo iface)
static

Definition at line 521 of file recinfo.c.

522{
524 void *record;
525
526 TRACE("(%p)\n", This);
527
528 record = HeapAlloc(GetProcessHeap(), 0, This->size);
529 IRecordInfo_RecordInit(iface, record);
530 TRACE("created record at %p\n", record);
531 return record;
532}

◆ IRecordInfoImpl_RecordCreateCopy()

static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy ( IRecordInfo iface,
PVOID  pvSource,
PVOID ppvDest 
)
static

Definition at line 534 of file recinfo.c.

536{
538
539 TRACE("(%p)->(%p %p)\n", This, pvSource, ppvDest);
540
541 if(!pvSource || !ppvDest)
542 return E_INVALIDARG;
543
544 *ppvDest = IRecordInfo_RecordCreate(iface);
545 return IRecordInfo_RecordCopy(iface, pvSource, *ppvDest);
546}

◆ IRecordInfoImpl_RecordDestroy()

static HRESULT WINAPI IRecordInfoImpl_RecordDestroy ( IRecordInfo iface,
PVOID  pvRecord 
)
static

Definition at line 548 of file recinfo.c.

549{
552
553 TRACE("(%p)->(%p)\n", This, pvRecord);
554
555 hres = IRecordInfo_RecordClear(iface, pvRecord);
556 if(FAILED(hres))
557 return hres;
558
559 if(!HeapFree(GetProcessHeap(), 0, pvRecord))
560 return E_INVALIDARG;
561
562 return S_OK;
563}
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ IRecordInfoImpl_RecordInit()

static HRESULT WINAPI IRecordInfoImpl_RecordInit ( IRecordInfo iface,
PVOID  pvNew 
)
static

Definition at line 189 of file recinfo.c.

190{
192 TRACE("(%p)->(%p)\n", This, pvNew);
193
194 if(!pvNew)
195 return E_INVALIDARG;
196
197 memset(pvNew, 0, This->size);
198 return S_OK;
199}
#define memset(x, y, z)
Definition: compat.h:39

◆ IRecordInfoImpl_Release()

static ULONG WINAPI IRecordInfoImpl_Release ( IRecordInfo iface)
static

Definition at line 170 of file recinfo.c.

171{
174
175 TRACE("(%p) -> %d\n", This, ref);
176
177 if(!ref) {
178 int i;
179 for(i=0; i<This->n_vars; i++)
180 SysFreeString(This->fields[i].name);
181 SysFreeString(This->name);
182 HeapFree(GetProcessHeap(), 0, This->fields);
183 ITypeInfo_Release(This->pTypeInfo);
185 }
186 return ref;
187}
#define InterlockedDecrement
Definition: armddk.h:52

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ IRecordInfoImplVtbl

const IRecordInfoVtbl IRecordInfoImplVtbl
static
Initial value:
= {
}
static HRESULT WINAPI IRecordInfoImpl_QueryInterface(IRecordInfo *iface, REFIID riid, void **ppvObject)
Definition: recinfo.c:145
static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrName)
Definition: recinfo.c:351
static HRESULT WINAPI IRecordInfoImpl_GetTypeInfo(IRecordInfo *iface, ITypeInfo **ppTypeInfo)
Definition: recinfo.c:377
static HRESULT WINAPI IRecordInfoImpl_GetFieldNoCopy(IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray)
Definition: recinfo.c:414
static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, void *src_rec, void *dest_rec)
Definition: recinfo.c:267
static HRESULT WINAPI IRecordInfoImpl_PutField(IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
Definition: recinfo.c:438
static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize)
Definition: recinfo.c:364
static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *pcNames, BSTR *rgBstrNames)
Definition: recinfo.c:487
static ULONG WINAPI IRecordInfoImpl_AddRef(IRecordInfo *iface)
Definition: recinfo.c:162
static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
Definition: recinfo.c:392
static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid)
Definition: recinfo.c:338
static ULONG WINAPI IRecordInfoImpl_Release(IRecordInfo *iface)
Definition: recinfo.c:170
static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvExisting)
Definition: recinfo.c:201
static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
Definition: recinfo.c:521
static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInfo *info2)
Definition: recinfo.c:510
static HRESULT WINAPI IRecordInfoImpl_PutFieldNoCopy(IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
Definition: recinfo.c:466
static HRESULT WINAPI IRecordInfoImpl_RecordInit(IRecordInfo *iface, PVOID pvNew)
Definition: recinfo.c:189
static HRESULT WINAPI IRecordInfoImpl_RecordDestroy(IRecordInfo *iface, PVOID pvRecord)
Definition: recinfo.c:548
static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID pvSource, PVOID *ppvDest)
Definition: recinfo.c:534

Definition at line 565 of file recinfo.c.

Referenced by GetRecordInfoFromTypeInfo().