From 1be8b9e7543653fe59cee4674a1bd7e8f1fbb1f7 Mon Sep 17 00:00:00 2001 From: Misha Koshelev Date: Sun, 25 Feb 2007 17:55:32 -0600 Subject: oleview: My private dispid patch. --- programs/oleview/typelib.c | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c index 4336cf1..d96117a 100644 --- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -372,6 +372,28 @@ #define VTADDTOSTR(x) case x:\ } } +void printw(WCHAR *w) +{ + int i=0; + while (w[i]) { printf("%c", (char)w[i]); i++; } +} + +void dispidhack(ITypeInfo *pTypeInfo, BSTR bstrName, MEMBERID memid, WCHAR *szOut) +{ + ITypeLib *pTLib; + UINT iTLib; + BSTR bstrTypeLibName; + WCHAR wformat[] = {'D','I','S','P','I','D','_','%','s','_','%','s',0}; + + ITypeInfo_GetContainingTypeLib(pTypeInfo, &pTLib, &iTLib); + ITypeLib_GetDocumentation(pTLib, iTLib, &bstrTypeLibName, NULL, NULL, NULL); + + wsprintfW(szOut, wformat, bstrTypeLibName, bstrName); + printf("#define "); + printw(struprW(szOut)); + printf(" %d\n", memid); +} + int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent) { int i; @@ -403,7 +425,9 @@ int EnumVars(ITypeInfo *pTypeInfo, int c AddToTLDataStrW(tld, wszOpenBrackets1); AddToTLDataStrW(tld, wszId); AddToTLDataStrW(tld, wszOpenBrackets2); - wsprintfW(wszText, wszFormat, pVarDesc->memid); + // wsprintfW(wszText, wszFormat, pVarDesc->memid); + dispidhack(pTypeInfo, bstrName, pVarDesc->memid, wszText); + AddToTLDataStrW(tld, wszText); memset(wszText, 0, sizeof(wszText)); AddToTLDataStrW(tld, wszCloseBrackets2); @@ -537,7 +561,9 @@ int EnumFuncs(ITypeInfo *pTypeInfo, int bFirst = FALSE; AddToTLDataStrW(tld, wszId); AddToTLDataStrW(tld, wszOpenBrackets2); - wsprintfW(wszText, wszFormat, pFuncDesc->memid); +// wsprintfW(wszText, wszFormat, pFuncDesc->memid); + dispidhack(pTypeInfo, bstrName, pFuncDesc->memid, wszText); + AddToTLDataStrW(tld, wszText); AddToTLDataStrW(tld, wszCloseBrackets2); memset(wszText, 0, sizeof(wszText)); -- 1.4.1