Misha Koshelev : oleview: Properly support enumerations.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Feb 26 12:19:29 CST 2007
Module: wine
Branch: master
Commit: 633e038b14792d6b592df49fd251c627935ef4de
URL: http://source.winehq.org/git/wine.git/?a=commit;h=633e038b14792d6b592df49fd251c627935ef4de
Author: Misha Koshelev <mk144210 at bcm.tmc.edu>
Date: Sun Feb 25 17:09:19 2007 -0600
oleview: Properly support enumerations.
---
programs/oleview/typelib.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c
index 98abc05..1a206a3 100644
--- a/programs/oleview/typelib.c
+++ b/programs/oleview/typelib.c
@@ -32,6 +32,7 @@ static const WCHAR wszFailed[] = { '<','f','a','i','l','e','d','>','\0' };
static const WCHAR wszSpace[] = { ' ','\0' };
static const WCHAR wszAsterix[] = { '*','\0' };
static const WCHAR wszComa[] = { ',','\0' };
+static const WCHAR wszEquals[] = { '=','\0' };
static const WCHAR wszSemicolon[] = { ';','\0' };
static const WCHAR wszNewLine[] = { '\n','\0' };
static const WCHAR wszOpenBrackets1[] = { '[','\0' };
@@ -428,6 +429,60 @@ int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
return 0;
}
+int EnumEnums(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
+{
+ int i;
+ TVINSERTSTRUCT tvis;
+ VARDESC *pVarDesc;
+ BSTR bstrName;
+ WCHAR wszText[MAX_LOAD_STRING];
+
+ U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
+ U(tvis).item.cchTextMax = MAX_LOAD_STRING;
+ U(tvis).item.pszText = wszText;
+ tvis.hInsertAfter = (HTREEITEM)TVI_LAST;
+ tvis.hParent = hParent;
+
+ for(i=0; i<cVars; i++)
+ {
+ TYPELIB_DATA *tld;
+
+ if(FAILED(ITypeInfo_GetVarDesc(pTypeInfo, i, &pVarDesc))) continue;
+ if(FAILED(ITypeInfo_GetDocumentation(pTypeInfo, pVarDesc->memid, &bstrName,
+ NULL, NULL, NULL))) continue;
+
+ tld = InitializeTLData();
+ U(tvis).item.lParam = (LPARAM) tld;
+
+ memset(wszText, 0, sizeof(wszText));
+ AddToStrW(wszText, bstrName);
+
+ if (pVarDesc->varkind == VAR_CONST)
+ {
+ VARIANT var;
+ VariantInit(&var);
+ if (VariantChangeType(&var, pVarDesc->lpvarValue, 0, VT_BSTR) == S_OK)
+ {
+ AddToStrW(wszText, wszSpace);
+ AddToStrW(wszText, wszEquals);
+ AddToStrW(wszText, wszSpace);
+ AddToStrW(wszText, V_BSTR(&var));
+ }
+ }
+
+ AddToTLDataStrW(tld, wszText);
+ if (i<cVars-1)
+ AddToTLDataStrW(tld, wszComa);
+ AddToTLDataStrW(tld, wszNewLine);
+
+ SendMessage(typelib.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
+ SysFreeString(bstrName);
+ ITypeInfo_ReleaseVarDesc(pTypeInfo, pVarDesc);
+ }
+
+ return 0;
+}
+
int EnumFuncs(ITypeInfo *pTypeInfo, int cFuncs, HTREEITEM hParent)
{
int i, j, tabSize;
@@ -1032,6 +1087,12 @@ int PopulateTree(void)
AddToStrW(tld->wszInsertAfter, bstrName);
AddToStrW(tld->wszInsertAfter, wszSemicolon);
AddToStrW(tld->wszInsertAfter, wszNewLine);
+
+ bInsert = FALSE;
+ hParent = TreeView_InsertItem(typelib.hTree, &tvis);
+ EnumEnums(pTypeInfo, pTypeAttr->cVars, hParent);
+ AddChildrenData(hParent, tld);
+ AddToTLDataStrW(tld, tld->wszInsertAfter);
break;
case TKIND_RECORD:
AddToTLDataStrW(tld, wszTKIND_RECORD);
More information about the wine-cvs
mailing list