2006-06-30 17:29:56 +02:00
|
|
|
/*
|
|
|
|
* OleView (typelib.c)
|
|
|
|
*
|
|
|
|
* Copyright 2006 Piotr Caban
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
2006-07-02 19:43:30 +02:00
|
|
|
#include "wine/debug.h"
|
2006-08-20 18:51:04 +02:00
|
|
|
#include "wine/unicode.h"
|
2006-07-02 19:43:30 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(oleview);
|
|
|
|
|
2006-06-30 17:29:56 +02:00
|
|
|
TYPELIB typelib;
|
|
|
|
static const WCHAR wszTypeLib[] = { 'T','Y','P','E','L','I','B','\0' };
|
|
|
|
|
2006-07-02 19:43:30 +02:00
|
|
|
static const WCHAR wszFailed[] = { '<','f','a','i','l','e','d','>','\0' };
|
|
|
|
static const WCHAR wszSpace[] = { ' ','\0' };
|
|
|
|
static const WCHAR wszAsterix[] = { '*','\0' };
|
2006-07-18 12:53:19 +02:00
|
|
|
static const WCHAR wszComa[] = { ',','\0' };
|
|
|
|
static const WCHAR wszSemicolon[] = { ';','\0' };
|
|
|
|
static const WCHAR wszNewLine[] = { '\n','\0' };
|
|
|
|
static const WCHAR wszOpenBrackets1[] = { '[','\0' };
|
|
|
|
static const WCHAR wszCloseBrackets1[] = { ']','\0' };
|
|
|
|
static const WCHAR wszOpenBrackets2[] = { '(','\0' };
|
|
|
|
static const WCHAR wszCloseBrackets2[] = { ')','\0' };
|
2006-07-18 12:54:30 +02:00
|
|
|
static const WCHAR wszOpenBrackets3[] = { '{','\0' };
|
|
|
|
static const WCHAR wszCloseBrackets3[] = { '}','\0' };
|
2006-07-21 21:11:27 +02:00
|
|
|
static const WCHAR wszInvertedComa[] = { '"','\0' };
|
|
|
|
static const WCHAR wszColon[] = { ':','\0' };
|
2006-07-18 12:53:19 +02:00
|
|
|
|
|
|
|
static const WCHAR wszUUID[] = { 'u','u','i','d','\0' };
|
2006-07-21 21:11:27 +02:00
|
|
|
static const WCHAR wszOdl[] = { 'o','d','l','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
|
|
|
|
static const WCHAR wszVT_BOOL[]
|
|
|
|
= { 'V','A','R','I','A','N','T','_','B','O','O','L','\0' };
|
|
|
|
static const WCHAR wszVT_UI1[]
|
|
|
|
= { 'u','n','s','i','g','n','e','d',' ','c','h','a','r','\0' };
|
2006-07-10 12:07:51 +02:00
|
|
|
static const WCHAR wszVT_UI2[]
|
|
|
|
= { 'u','n','s','i','g','n','e','d',' ','s','h','o','r','t','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
static const WCHAR wszVT_UI4[]
|
|
|
|
= { 'u','n','s','i','g','n','e','d',' ','l','o','n','g','\0' };
|
2006-07-10 12:07:51 +02:00
|
|
|
static const WCHAR wszVT_UI8[] = { 'u','i','n','t','6','4','\0' };
|
|
|
|
static const WCHAR wszVT_UINT[]
|
|
|
|
= { 'u','n','s','i','g','n','e','d',' ','i','n','t','\0' };
|
|
|
|
static const WCHAR wszVT_I1[] = { 'c','h','a','r','\0' };
|
|
|
|
static const WCHAR wszVT_I2[] = { 's','h','o','r','t','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
static const WCHAR wszVT_I4[] = { 'l','o','n','g','\0' };
|
2006-07-10 12:07:51 +02:00
|
|
|
static const WCHAR wszVT_I8[] = { 'i','n','t','6','4','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
static const WCHAR wszVT_R4[] = { 's','i','n','g','l','e','\0' };
|
|
|
|
static const WCHAR wszVT_INT[] = { 'i','n','t','\0' };
|
|
|
|
static const WCHAR wszVT_BSTR[] = { 'B','S','T','R','\0' };
|
|
|
|
static const WCHAR wszVT_CY[] = { 'C','U','R','R','E','N','C','Y','\0' };
|
2006-07-10 12:07:51 +02:00
|
|
|
static const WCHAR wszVT_VARIANT[] = { 'V','A','R','I','A','N','T','\0' };
|
|
|
|
static const WCHAR wszVT_VOID[] = { 'v','o','i','d','\0' };
|
|
|
|
static const WCHAR wszVT_ERROR[] = { 'S','C','O','D','E','\0' };
|
|
|
|
static const WCHAR wszVT_LPSTR[] = { 'L','P','S','T','R','\0' };
|
|
|
|
static const WCHAR wszVT_LPWSTR[] = { 'L','P','W','S','T','R','\0' };
|
2006-08-20 12:44:49 +02:00
|
|
|
static const WCHAR wszVT_HRESULT[] = { 'H','R','E','S','U','L','T','\0' };
|
|
|
|
static const WCHAR wszVT_UNKNOWN[] = { 'I','U','n','k','n','o','w','n','\0' };
|
|
|
|
static const WCHAR wszVT_DISPATCH[] = { 'I','D','i','s','p','a','t','c','h','\0' };
|
|
|
|
static const WCHAR wszVT_DATE[] = { 'D','A','T','E','\0' };
|
|
|
|
static const WCHAR wszVT_R8[] = { 'd','o','u','b','l','e','\0' };
|
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
const WCHAR wszFormat[] = { '0','x','%','.','8','l','x','\0' };
|
2006-08-20 12:44:49 +02:00
|
|
|
static const WCHAR wszStdCall[] = { '_','s','t','d','c','a','l','l','\0' };
|
2006-08-21 22:21:09 +02:00
|
|
|
static const WCHAR wszId[] = { 'i','d','\0' };
|
2006-08-20 12:44:49 +02:00
|
|
|
static const WCHAR wszPropPut[] = { 'p','r','o','p','p','u','t','\0' };
|
|
|
|
static const WCHAR wszPropGet[] = { 'p','r','o','p','g','e','t','\0' };
|
|
|
|
static const WCHAR wszPropPutRef[] = { 'p','r','o','p','p','u','t','r','e','f','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FIN[] = { 'i','n','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FOUT[] = { 'o','u','t','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FLCID[] = { 'c','i','d','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FRETVAL[] = { 'r','e','t','v','a','l','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FOPT[] = { 'o','p','t','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FHASDEFAULT[]
|
|
|
|
= { 'h','a','s','d','e','f','a','u','l','t','\0' };
|
|
|
|
static const WCHAR wszPARAMFLAG_FHASCUSTDATA[]
|
|
|
|
= { 'h','a','s','c','u','s','t','d','a','t','a','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
static const WCHAR wszReadOnly[] = { 'r','e','a','d','o','n','l','y','\0' };
|
|
|
|
|
2006-08-20 18:51:04 +02:00
|
|
|
void ShowLastError(void)
|
|
|
|
{
|
|
|
|
DWORD error = GetLastError();
|
|
|
|
LPWSTR lpMsgBuf;
|
|
|
|
WCHAR wszTitle[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
LoadString(globals.hMainInst, IDS_TYPELIBTITLE, wszTitle,
|
|
|
|
sizeof(WCHAR[MAX_LOAD_STRING]));
|
|
|
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
|
|
NULL, error, 0, (LPTSTR) &lpMsgBuf, 0, NULL);
|
|
|
|
MessageBox(NULL, lpMsgBuf, wszTitle, MB_OK | MB_ICONERROR);
|
|
|
|
LocalFree(lpMsgBuf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SaveIdl(WCHAR *wszFileName)
|
|
|
|
{
|
|
|
|
HTREEITEM hIDL;
|
|
|
|
TVITEM tvi;
|
|
|
|
HANDLE hFile;
|
|
|
|
DWORD dwNumWrite;
|
|
|
|
char *wszIdl;
|
|
|
|
|
|
|
|
hIDL = TreeView_GetChild(typelib.hTree, TVI_ROOT);
|
|
|
|
|
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.hItem = hIDL;
|
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
|
|
|
|
hFile = CreateFile(wszFileName, GENERIC_WRITE, FILE_SHARE_WRITE,
|
|
|
|
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if(hFile == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
ShowLastError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wszIdl = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
sizeof(WCHAR)*((TYPELIB_DATA *)(tvi.lParam))->idlLen);
|
|
|
|
wine_utf8_wcstombs(((TYPELIB_DATA *)(tvi.lParam))->idl,
|
|
|
|
((TYPELIB_DATA *)(tvi.lParam))->idlLen, wszIdl,
|
|
|
|
((TYPELIB_DATA *)(tvi.lParam))->idlLen);
|
|
|
|
|
|
|
|
if(!WriteFile(hFile, wszIdl, ((TYPELIB_DATA *)(tvi.lParam))->idlLen,
|
|
|
|
&dwNumWrite, NULL))
|
|
|
|
{
|
|
|
|
ShowLastError();
|
|
|
|
HeapFree(GetProcessHeap(), 0, wszIdl);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, wszIdl);
|
|
|
|
SetEndOfFile(hFile);
|
|
|
|
CloseHandle(hFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetSaveIdlAsPath(void)
|
|
|
|
{
|
|
|
|
OPENFILENAME saveidl;
|
|
|
|
WCHAR *pFileName;
|
|
|
|
WCHAR wszPath[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszDir[MAX_LOAD_STRING];
|
|
|
|
static const WCHAR wszDefaultExt[] = { 'i','d','l',0 };
|
|
|
|
static const WCHAR wszIdlFiles[] = { '*','.','i','d','l','\0','\0' };
|
|
|
|
|
|
|
|
memset(&saveidl, 0, sizeof(saveidl));
|
|
|
|
|
|
|
|
lstrcpyW(wszDir, typelib.wszFileName);
|
|
|
|
pFileName = wszDir + lstrlenW(wszDir);
|
|
|
|
while(*pFileName != '.' && *pFileName != '\\' && *pFileName != '/'
|
|
|
|
&& pFileName > wszDir) pFileName -= 1;
|
|
|
|
if(*pFileName == '.')
|
|
|
|
{
|
|
|
|
*pFileName = '\0';
|
|
|
|
while(*pFileName != '\\' && *pFileName != '/' && pFileName > wszDir)
|
|
|
|
pFileName -= 1;
|
|
|
|
}
|
|
|
|
if(*pFileName == '\\' || *pFileName == '/') pFileName += 1;
|
|
|
|
lstrcpyW(wszPath, pFileName);
|
|
|
|
|
|
|
|
GetCurrentDirectory(MAX_LOAD_STRING, wszDir);
|
|
|
|
|
|
|
|
saveidl.lStructSize = sizeof(OPENFILENAME);
|
|
|
|
saveidl.hwndOwner = globals.hTypeLibWnd;
|
|
|
|
saveidl.hInstance = globals.hMainInst;
|
|
|
|
saveidl.lpstrFilter = wszIdlFiles;
|
|
|
|
saveidl.lpstrFile = wszPath;
|
|
|
|
saveidl.nMaxFile = MAX_LOAD_STRING;
|
|
|
|
saveidl.lpstrInitialDir = wszDir;
|
|
|
|
saveidl.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
|
|
|
|
saveidl.lpstrDefExt = wszDefaultExt;
|
|
|
|
|
|
|
|
if (GetSaveFileName(&saveidl))
|
|
|
|
SaveIdl(wszPath);
|
|
|
|
}
|
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
void AddToStrW(WCHAR *wszDest, const WCHAR *wszSource)
|
|
|
|
{
|
|
|
|
lstrcpyW(&wszDest[lstrlenW(wszDest)], wszSource);
|
|
|
|
}
|
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
void AddToTLDataStrW(TYPELIB_DATA *pTLData, const WCHAR *wszSource)
|
|
|
|
{
|
|
|
|
int SourceLen = lstrlenW(wszSource);
|
|
|
|
|
|
|
|
pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
|
|
|
|
sizeof(WCHAR)*(pTLData->idlLen+SourceLen+1));
|
|
|
|
|
|
|
|
memcpy(&pTLData->idl[pTLData->idlLen], wszSource, sizeof(WCHAR)*(SourceLen+1));
|
|
|
|
pTLData->idlLen += SourceLen;
|
|
|
|
}
|
|
|
|
|
2006-08-20 18:48:29 +02:00
|
|
|
void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
|
|
|
int lineLen = lstrlenW(wszSource);
|
|
|
|
int newLinesNo = 0;
|
|
|
|
WCHAR *pSourcePos = (WCHAR *)wszSource;
|
|
|
|
WCHAR *pSourceBeg;
|
|
|
|
|
2006-08-20 18:48:29 +02:00
|
|
|
if(!lineLen) return;
|
2006-08-20 13:57:21 +02:00
|
|
|
while(*pSourcePos)
|
|
|
|
{
|
|
|
|
if(*pSourcePos == *wszNewLine) newLinesNo++;
|
|
|
|
pSourcePos += 1;
|
|
|
|
}
|
2006-08-20 18:48:29 +02:00
|
|
|
if(*(pSourcePos - 1) != *wszNewLine) newLinesNo++;
|
2006-08-20 13:57:21 +02:00
|
|
|
|
|
|
|
pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
|
|
|
|
sizeof(WCHAR)*(pTLData->idlLen+lineLen+4*newLinesNo+1));
|
|
|
|
|
|
|
|
pSourcePos = (WCHAR *)wszSource;
|
|
|
|
pSourceBeg = (WCHAR *)wszSource;
|
2006-08-20 18:48:29 +02:00
|
|
|
while(newLinesNo)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
2006-08-20 18:48:29 +02:00
|
|
|
if(*pSourcePos != *wszNewLine && *pSourcePos)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
|
|
|
pSourcePos += 1;
|
|
|
|
continue;
|
|
|
|
}
|
2006-08-20 18:48:29 +02:00
|
|
|
newLinesNo--;
|
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
if(*pSourcePos)
|
2006-08-20 18:48:29 +02:00
|
|
|
{
|
|
|
|
*pSourcePos = '\0';
|
|
|
|
lineLen = lstrlenW(pSourceBeg)+1;
|
|
|
|
*pSourcePos = '\n';
|
|
|
|
pSourcePos += 1;
|
|
|
|
}
|
2006-08-21 22:21:09 +02:00
|
|
|
else lineLen = lstrlenW(pSourceBeg);
|
2006-08-20 13:57:21 +02:00
|
|
|
|
|
|
|
pTLData->idl[pTLData->idlLen] = *wszSpace;
|
|
|
|
pTLData->idl[pTLData->idlLen+1] = *wszSpace;
|
|
|
|
pTLData->idl[pTLData->idlLen+2] = *wszSpace;
|
|
|
|
pTLData->idl[pTLData->idlLen+3] = *wszSpace;
|
|
|
|
memcpy(&pTLData->idl[pTLData->idlLen+4], pSourceBeg, sizeof(WCHAR)*lineLen);
|
|
|
|
pTLData->idlLen += lineLen + 4;
|
2006-08-21 22:21:09 +02:00
|
|
|
pTLData->idl[pTLData->idlLen] = '\0';
|
2006-08-20 13:57:21 +02:00
|
|
|
|
|
|
|
pSourceBeg = pSourcePos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
LPARAM InitializeTLData(void)
|
|
|
|
{
|
|
|
|
TYPELIB_DATA *pTLData;
|
|
|
|
|
|
|
|
pTLData = HeapAlloc(GetProcessHeap(), 0, sizeof(TYPELIB_DATA));
|
|
|
|
|
|
|
|
memset(pTLData, 0, sizeof(TYPELIB_DATA));
|
|
|
|
pTLData->idl = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR));
|
2006-07-21 21:11:27 +02:00
|
|
|
pTLData->idl[0] = '\0';
|
2006-07-18 12:53:19 +02:00
|
|
|
|
|
|
|
return (LPARAM)pTLData;
|
|
|
|
}
|
|
|
|
|
2006-08-20 12:44:49 +02:00
|
|
|
void AddSpaces(TYPELIB_DATA *pTLData, int tabSize)
|
|
|
|
{
|
|
|
|
for(; tabSize>0; tabSize--)
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
|
|
|
}
|
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
|
|
|
|
{
|
|
|
|
HTREEITEM hCur;
|
|
|
|
TVITEM tvi;
|
|
|
|
|
|
|
|
memset(&tvi, 0, sizeof(&tvi));
|
|
|
|
|
|
|
|
hCur = TreeView_GetChild(typelib.hTree, hParent);
|
2006-07-21 21:11:27 +02:00
|
|
|
if(!hCur) return;
|
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
if(tvi.lParam && ((TYPELIB_DATA *)(tvi.lParam))->idlLen)
|
2006-08-20 13:57:21 +02:00
|
|
|
AddToTLDataStrWithTabsW(pData, ((TYPELIB_DATA *)(tvi.lParam))->idl);
|
2006-07-18 12:54:30 +02:00
|
|
|
}while((hCur = TreeView_GetNextSibling(typelib.hTree, hCur)));
|
|
|
|
}
|
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc, ITypeInfo *pTypeInfo)
|
2006-07-02 19:43:30 +02:00
|
|
|
{
|
2006-07-10 12:07:51 +02:00
|
|
|
int i;
|
2006-07-02 19:43:30 +02:00
|
|
|
BSTR bstrData;
|
|
|
|
HRESULT hRes;
|
|
|
|
ITypeInfo *pRefTypeInfo;
|
2006-07-10 12:07:51 +02:00
|
|
|
WCHAR wszBuf[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszFormat[] = { '[','%','l','u',']','\0' };
|
2006-07-02 19:43:30 +02:00
|
|
|
|
|
|
|
switch(tdesc.vt&VT_TYPEMASK)
|
|
|
|
{
|
|
|
|
#define VTADDTOSTR(x) case x:\
|
|
|
|
AddToStrW(wszAddTo, wsz##x);\
|
|
|
|
break
|
|
|
|
VTADDTOSTR(VT_BOOL);
|
|
|
|
VTADDTOSTR(VT_UI1);
|
2006-07-10 12:07:51 +02:00
|
|
|
VTADDTOSTR(VT_UI2);
|
2006-07-02 19:43:30 +02:00
|
|
|
VTADDTOSTR(VT_UI4);
|
2006-07-10 12:07:51 +02:00
|
|
|
VTADDTOSTR(VT_UI8);
|
|
|
|
VTADDTOSTR(VT_UINT);
|
|
|
|
VTADDTOSTR(VT_I1);
|
|
|
|
VTADDTOSTR(VT_I2);
|
2006-07-02 19:43:30 +02:00
|
|
|
VTADDTOSTR(VT_I4);
|
2006-07-10 12:07:51 +02:00
|
|
|
VTADDTOSTR(VT_I8);
|
2006-07-02 19:43:30 +02:00
|
|
|
VTADDTOSTR(VT_R4);
|
|
|
|
VTADDTOSTR(VT_INT);
|
|
|
|
VTADDTOSTR(VT_BSTR);
|
|
|
|
VTADDTOSTR(VT_CY);
|
2006-07-10 12:07:51 +02:00
|
|
|
VTADDTOSTR(VT_VARIANT);
|
|
|
|
VTADDTOSTR(VT_VOID);
|
|
|
|
VTADDTOSTR(VT_ERROR);
|
|
|
|
VTADDTOSTR(VT_LPSTR);
|
|
|
|
VTADDTOSTR(VT_LPWSTR);
|
2006-08-20 12:44:49 +02:00
|
|
|
VTADDTOSTR(VT_HRESULT);
|
|
|
|
VTADDTOSTR(VT_UNKNOWN);
|
|
|
|
VTADDTOSTR(VT_DISPATCH);
|
|
|
|
VTADDTOSTR(VT_DATE);
|
|
|
|
VTADDTOSTR(VT_R8);
|
2006-07-10 12:07:51 +02:00
|
|
|
case VT_CARRAY:
|
|
|
|
for(i=0; i<U(tdesc).lpadesc->cDims; i++)
|
|
|
|
{
|
|
|
|
wsprintfW(wszBuf, wszFormat, U(tdesc).lpadesc->rgbounds[i].cElements);
|
|
|
|
AddToStrW(wszAddAfter, wszBuf);
|
|
|
|
}
|
|
|
|
CreateTypeInfo(wszAddTo, wszAddAfter, U(tdesc).lpadesc->tdescElem, pTypeInfo);
|
|
|
|
break;
|
2006-07-02 19:43:30 +02:00
|
|
|
case VT_PTR:
|
2006-07-10 12:07:51 +02:00
|
|
|
CreateTypeInfo(wszAddTo, wszAddAfter, *U(tdesc).lptdesc, pTypeInfo);
|
2006-07-02 19:43:30 +02:00
|
|
|
AddToStrW(wszAddTo, wszAsterix);
|
|
|
|
break;
|
|
|
|
case VT_USERDEFINED:
|
|
|
|
hRes = ITypeInfo_GetRefTypeInfo(pTypeInfo,
|
|
|
|
U(tdesc).hreftype, &pRefTypeInfo);
|
|
|
|
if(SUCCEEDED(hRes))
|
|
|
|
{
|
|
|
|
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL,
|
|
|
|
&bstrData, NULL, NULL, NULL);
|
|
|
|
AddToStrW(wszAddTo, bstrData);
|
|
|
|
SysFreeString(bstrData);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
else AddToStrW(wszAddTo, wszFailed);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WINE_FIXME("tdesc.vt&VT_TYPEMASK == %d not supported\n",
|
|
|
|
tdesc.vt&VT_TYPEMASK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
TVINSERTSTRUCT tvis;
|
|
|
|
VARDESC *pVarDesc;
|
|
|
|
BSTR bstrName;
|
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszAfter[MAX_LOAD_STRING];
|
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
|
2006-07-10 12:07:51 +02:00
|
|
|
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++)
|
|
|
|
{
|
|
|
|
if(FAILED(ITypeInfo_GetVarDesc(pTypeInfo, i, &pVarDesc))) continue;
|
|
|
|
if(FAILED(ITypeInfo_GetDocumentation(pTypeInfo, pVarDesc->memid, &bstrName,
|
|
|
|
NULL, NULL, NULL))) continue;
|
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
|
|
|
if(pVarDesc->memid < MIN_VAR_ID)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszId);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets2);
|
|
|
|
wsprintfW(wszText, wszFormat, pVarDesc->memid);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets2);
|
|
|
|
|
|
|
|
if(pVarDesc->wVarFlags & VARFLAG_FREADONLY)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszReadOnly);
|
|
|
|
}
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
}
|
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
|
|
|
CreateTypeInfo(wszText, wszAfter, pVarDesc->elemdescVar.tdesc, pTypeInfo);
|
|
|
|
AddToStrW(wszText, wszSpace);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
AddToStrW(wszText, wszAfter);
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSemicolon);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-10 12:07:51 +02:00
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseVarDesc(pTypeInfo, pVarDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EnumFuncs(ITypeInfo *pTypeInfo, int cFuncs, HTREEITEM hParent)
|
|
|
|
{
|
2006-08-20 12:44:49 +02:00
|
|
|
int i, j, tabSize;
|
|
|
|
unsigned namesNo;
|
2006-07-10 12:07:51 +02:00
|
|
|
TVINSERTSTRUCT tvis;
|
|
|
|
FUNCDESC *pFuncDesc;
|
2006-08-20 12:44:49 +02:00
|
|
|
BSTR bstrName, *bstrParamNames;
|
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszAfter[MAX_LOAD_STRING];
|
|
|
|
BOOL bFirst;
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2006-08-20 12:44:49 +02:00
|
|
|
U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
|
2006-07-10 12:07:51 +02:00
|
|
|
tvis.hInsertAfter = (HTREEITEM)TVI_LAST;
|
|
|
|
tvis.hParent = hParent;
|
|
|
|
|
|
|
|
for(i=0; i<cFuncs; i++)
|
|
|
|
{
|
|
|
|
if(FAILED(ITypeInfo_GetFuncDesc(pTypeInfo, i, &pFuncDesc))) continue;
|
|
|
|
if(FAILED(ITypeInfo_GetDocumentation(pTypeInfo, pFuncDesc->memid, &bstrName,
|
|
|
|
NULL, NULL, NULL))) continue;
|
|
|
|
|
2006-08-20 12:44:49 +02:00
|
|
|
bstrParamNames = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
sizeof(BSTR*)*(pFuncDesc->cParams+1));
|
|
|
|
if(FAILED(ITypeInfo_GetNames(pTypeInfo, pFuncDesc->memid, bstrParamNames,
|
2006-08-25 23:25:07 +02:00
|
|
|
pFuncDesc->cParams+1, &namesNo)))
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, bstrParamNames);
|
|
|
|
continue;
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
SysFreeString(bstrParamNames[0]);
|
|
|
|
|
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
2006-07-10 12:07:51 +02:00
|
|
|
U(tvis).item.cchTextMax = SysStringLen(bstrName);
|
|
|
|
U(tvis).item.pszText = bstrName;
|
2006-08-20 12:44:49 +02:00
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = TRUE;
|
|
|
|
if(pFuncDesc->memid < MIN_FUNC_ID)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets1);
|
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszId);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets2);
|
|
|
|
wsprintfW(wszText, wszFormat, pFuncDesc->memid);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets2);
|
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
CreateTypeInfo(wszText, wszAfter, pFuncDesc->elemdescFunc.tdesc, pTypeInfo);
|
|
|
|
switch(pFuncDesc->invkind)
|
|
|
|
{
|
|
|
|
case INVOKE_PROPERTYGET:
|
2006-08-21 22:21:09 +02:00
|
|
|
if(bFirst) AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
wszOpenBrackets1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
}
|
|
|
|
bFirst = FALSE;
|
2006-08-20 12:44:49 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszPropGet);
|
|
|
|
break;
|
|
|
|
case INVOKE_PROPERTYPUT:
|
2006-08-21 22:21:09 +02:00
|
|
|
if(bFirst) AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
wszOpenBrackets1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
}
|
|
|
|
bFirst = FALSE;
|
2006-08-20 12:44:49 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszPropPut);
|
|
|
|
break;
|
|
|
|
case INVOKE_PROPERTYPUTREF:
|
2006-08-21 22:21:09 +02:00
|
|
|
if(bFirst) AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
wszOpenBrackets1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
}
|
|
|
|
bFirst = FALSE;
|
2006-08-20 12:44:49 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszPropPutRef);
|
|
|
|
break;
|
|
|
|
default:;
|
|
|
|
}
|
2006-08-21 22:21:09 +02:00
|
|
|
if(!bFirst)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszAfter);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pFuncDesc->memid >= MIN_FUNC_ID)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszStdCall);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
tabSize = ((TYPELIB_DATA*)(U(tvis).item.lParam))->idlLen;
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets2);
|
|
|
|
|
|
|
|
for(j=0; j<pFuncDesc->cParams; j++)
|
|
|
|
{
|
|
|
|
if(j != 0) AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
2006-08-20 13:57:21 +02:00
|
|
|
if(pFuncDesc->cParams != 1)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
AddSpaces((TYPELIB_DATA*)(U(tvis).item.lParam), tabSize);
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
bFirst = TRUE;
|
|
|
|
#define ENUM_PARAM_FLAG(x)\
|
|
|
|
if(pFuncDesc->lprgelemdescParam[j].paramdesc.wParamFlags & x)\
|
|
|
|
{\
|
|
|
|
if(bFirst) AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),\
|
|
|
|
wszOpenBrackets1);\
|
|
|
|
else\
|
|
|
|
{\
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);\
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);\
|
|
|
|
}\
|
|
|
|
bFirst = FALSE;\
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wsz##x);\
|
|
|
|
}
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FIN);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FOUT);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FLCID);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FRETVAL);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FOPT);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FHASDEFAULT);
|
|
|
|
ENUM_PARAM_FLAG(PARAMFLAG_FHASCUSTDATA);
|
|
|
|
|
|
|
|
if(!bFirst)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
|
|
|
CreateTypeInfo(wszText, wszAfter, pFuncDesc->lprgelemdescParam[j].tdesc,
|
|
|
|
pTypeInfo);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszAfter);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrParamNames[j+1]);
|
|
|
|
SysFreeString(bstrParamNames[j+1]);
|
|
|
|
}
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets2);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSemicolon);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-10 12:07:51 +02:00
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
|
2006-08-20 12:44:49 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, bstrParamNames);
|
2006-07-10 12:07:51 +02:00
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseFuncDesc(pTypeInfo, pFuncDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EnumImplTypes(ITypeInfo *pTypeInfo, int cImplTypes, HTREEITEM hParent)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
TVINSERTSTRUCT tvis;
|
|
|
|
ITypeInfo *pRefTypeInfo;
|
|
|
|
HREFTYPE hRefType;
|
|
|
|
TYPEATTR *pTypeAttr;
|
|
|
|
BSTR bstrName;
|
|
|
|
WCHAR wszInheritedInterfaces[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
if(!cImplTypes) return 0;
|
|
|
|
|
|
|
|
LoadString(globals.hMainInst, IDS_INHERITINTERFACES, wszInheritedInterfaces,
|
|
|
|
sizeof(WCHAR[MAX_LOAD_STRING]));
|
|
|
|
|
|
|
|
U(tvis).item.mask = TVIF_TEXT;
|
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszInheritedInterfaces;
|
|
|
|
tvis.hInsertAfter = (HTREEITEM)TVI_LAST;
|
|
|
|
tvis.hParent = hParent;
|
|
|
|
|
|
|
|
tvis.hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
|
|
|
|
for(i=0; i<cImplTypes; i++)
|
|
|
|
{
|
|
|
|
if(FAILED(ITypeInfo_GetRefTypeOfImplType(pTypeInfo, i, &hRefType))) continue;
|
|
|
|
if(FAILED(ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo)))
|
|
|
|
continue;
|
|
|
|
if(FAILED(ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
|
|
|
|
NULL, NULL, NULL))) continue;
|
|
|
|
if(FAILED(ITypeInfo_GetTypeAttr(pRefTypeInfo, &pTypeAttr))) continue;
|
|
|
|
|
|
|
|
U(tvis).item.cchTextMax = SysStringLen(bstrName);
|
|
|
|
U(tvis).item.pszText = bstrName;
|
|
|
|
|
|
|
|
hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
EnumVars(pRefTypeInfo, pTypeAttr->cVars, hParent);
|
|
|
|
EnumFuncs(pRefTypeInfo, pTypeAttr->cFuncs, hParent);
|
|
|
|
EnumImplTypes(pRefTypeInfo, pTypeAttr->cImplTypes, hParent);
|
|
|
|
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseTypeAttr(pRefTypeInfo, pTypeAttr);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-20 18:48:29 +02:00
|
|
|
void AddIdlData(HTREEITEM hCur, TYPELIB_DATA *pTLData)
|
|
|
|
{
|
|
|
|
TVITEM tvi;
|
|
|
|
|
|
|
|
hCur = TreeView_GetChild(typelib.hTree, hCur);
|
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
|
|
|
|
while(hCur)
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
|
|
|
AddToTLDataStrWithTabsW(pTLData, ((TYPELIB_DATA*)(tvi.lParam))->idl);
|
|
|
|
hCur = TreeView_GetNextSibling(typelib.hTree, hCur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
|
|
|
|
{
|
|
|
|
HTREEITEM hCur;
|
|
|
|
TVITEM tvi;
|
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszPredefinition[] = { '/','/',' ','T','L','i','b',' ',':','\n',
|
|
|
|
'/','/',' ','F','o','r','w','a','r','d',' ','d','e','c','l','a','r','e',' ',
|
|
|
|
'a','l','l',' ','t','y','p','e','s',' ','d','e','f','i','n','e','d',' ',
|
|
|
|
'i','n',' ','t','h','i','s',' ','t','y','p','e','l','i','b','\0' };
|
|
|
|
|
|
|
|
hFirst = TreeView_GetChild(typelib.hTree, hFirst);
|
|
|
|
|
|
|
|
AddToTLDataStrWithTabsW(pTLData, wszPredefinition);
|
|
|
|
|
|
|
|
hCur = hFirst;
|
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.mask = TVIF_TEXT|TVIF_PARAM;
|
|
|
|
tvi.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
tvi.pszText = wszText;
|
|
|
|
while(hCur)
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
if(((TYPELIB_DATA*)(tvi.lParam))->bPredefine)
|
|
|
|
{
|
|
|
|
AddToStrW(wszText, wszSemicolon);
|
|
|
|
AddToTLDataStrWithTabsW(pTLData, wszText);
|
|
|
|
}
|
|
|
|
hCur = TreeView_GetNextSibling(typelib.hTree, hCur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-21 21:11:27 +02:00
|
|
|
void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wszName,
|
2006-08-12 19:44:02 +02:00
|
|
|
WCHAR *wszHelpString, unsigned long ulHelpContext, TYPEATTR *pTypeAttr,
|
|
|
|
TYPELIB_DATA *pTLData)
|
2006-07-21 21:11:27 +02:00
|
|
|
{
|
|
|
|
ITypeInfo *pRefTypeInfo;
|
|
|
|
HREFTYPE hRefType;
|
|
|
|
BSTR bstrName;
|
|
|
|
WCHAR wszGuid[MAX_LOAD_STRING];
|
2006-08-12 19:44:02 +02:00
|
|
|
WCHAR wszHelpContext[MAX_LOAD_STRING];
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-08-20 18:51:04 +02:00
|
|
|
const WCHAR wszInterface[] = { 'i','n','t','e','r','f','a','c','e',' ','\0' };
|
2006-08-21 22:21:09 +02:00
|
|
|
const WCHAR wszDispinterface[]
|
|
|
|
= { 'd','i','s','p','i','n','t','e','r','f','a','c','e',' ','\0' };
|
2006-07-21 21:11:27 +02:00
|
|
|
const WCHAR wszHelpstring[] = { 'h','e','l','p','s','t','r','i','n','g','\0' };
|
2006-08-12 19:44:02 +02:00
|
|
|
const WCHAR wszHelpcontext[] = { 'h','e','l','p','c','o','n','t','e','x','t','\0' };
|
2006-07-21 21:11:27 +02:00
|
|
|
const WCHAR wszTYPEFLAG_FAPPOBJECT[] = { 'a','p','p','o','b','j','e','c','t','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FCANCREATE[] = { 'c','a','n','c','r','e','a','t','e','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FLICENSED[] = { 'l','i','c','e','n','s','e','d','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FPREDECLID[] = { 'p','r','e','d','e','c','l','i','d','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FHIDDEN[] = { 'h','i','d','d','e','n','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FCONTROL[] = { 'c','o','n','t','r','o','l','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FDUAL[] = { 'd','u','a','l','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FNONEXTENSIBLE[]
|
|
|
|
= { 'n','o','n','e','x','t','e','n','s','i','b','l','e','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FOLEAUTOMATION[]
|
|
|
|
= { 'o','l','e','a','u','t','o','m','a','t','i','o','n','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FRESTRICTED[]
|
|
|
|
= { 'r','e','s','t','r','i','c','t','e','d','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FAGGREGATABLE[]
|
|
|
|
= { 'a','g','g','r','e','g','a','t','a','b','l','e','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FREPLACEABLE[]
|
|
|
|
= { 'r','e','p','l','a','c','a','b','l','e','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FREVERSEBIND[]
|
|
|
|
= { 'r','e','v','e','r','s','e','b','i','n','d','\0' };
|
|
|
|
const WCHAR wszTYPEFLAG_FPROXY[] = { 'p','r','o','x','y','\0' };
|
|
|
|
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets1);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pTypeAttr->typekind != TKIND_DISPATCH)
|
|
|
|
{
|
|
|
|
AddSpaces(pTLData, 4);
|
|
|
|
AddToTLDataStrW(pTLData, wszOdl);
|
|
|
|
AddToTLDataStrW(pTLData, wszComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
|
|
|
}
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces(pTLData, 4);
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszUUID);
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets2);
|
|
|
|
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
|
|
|
|
wszGuid[lstrlenW(wszGuid)-1] = '\0';
|
|
|
|
AddToTLDataStrW(pTLData, &wszGuid[1]);
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets2);
|
|
|
|
if(wszHelpString)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces(pTLData, 4);
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszHelpstring);
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets2);
|
|
|
|
AddToTLDataStrW(pTLData, wszInvertedComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszHelpString);
|
|
|
|
AddToTLDataStrW(pTLData, wszInvertedComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets2);
|
|
|
|
}
|
2006-08-12 19:44:02 +02:00
|
|
|
if(ulHelpContext)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces(pTLData, 4);
|
2006-08-12 19:44:02 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszHelpcontext);
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets2);
|
|
|
|
wsprintfW(wszHelpContext, wszFormat, ulHelpContext);
|
|
|
|
AddToTLDataStrW(pTLData, wszHelpContext);
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets2);
|
|
|
|
}
|
2006-07-21 21:11:27 +02:00
|
|
|
if(pTypeAttr->wTypeFlags)
|
|
|
|
{
|
2006-08-21 22:21:09 +02:00
|
|
|
#define ENUM_FLAGS(x) if(pTypeAttr->wTypeFlags & x &&\
|
|
|
|
(pTypeAttr->typekind != TKIND_DISPATCH || x != TYPEFLAG_FDISPATCHABLE))\
|
2006-07-21 21:11:27 +02:00
|
|
|
{\
|
2006-08-21 22:21:09 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszComa);\
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);\
|
|
|
|
AddSpaces(pTLData, 4);\
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wsz##x);\
|
|
|
|
}
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FAPPOBJECT);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FCANCREATE);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FLICENSED);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FPREDECLID);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FHIDDEN);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FCONTROL);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FDUAL);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FNONEXTENSIBLE);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FOLEAUTOMATION);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FRESTRICTED);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FAGGREGATABLE);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FREPLACEABLE);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FREVERSEBIND);
|
|
|
|
ENUM_FLAGS(TYPEFLAG_FPROXY);
|
|
|
|
}
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pTypeAttr->typekind != TKIND_DISPATCH) AddToTLDataStrW(pTLData, wszInterface);
|
|
|
|
else AddToTLDataStrW(pTLData, wszDispinterface);
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszName);
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
2006-08-21 22:21:09 +02:00
|
|
|
if(cImplTypes && pTypeAttr->typekind != TKIND_DISPATCH)
|
2006-07-21 21:11:27 +02:00
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszColon);
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
|
|
|
|
|
|
|
ITypeInfo_GetRefTypeOfImplType(pTypeInfo, 0, &hRefType);
|
|
|
|
ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo);
|
|
|
|
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
AddToTLDataStrW(pTLData, bstrName);
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
|
|
|
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets3);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
|
|
|
|
|
|
|
AddToStrW(pTLData->wszInsertAfter, wszCloseBrackets3);
|
|
|
|
AddToStrW(pTLData->wszInsertAfter, wszSemicolon);
|
|
|
|
AddToStrW(pTLData->wszInsertAfter, wszNewLine);
|
|
|
|
}
|
|
|
|
|
2006-08-21 11:36:35 +02:00
|
|
|
void CreateTypedefHeader(ITypeInfo *pTypeInfo,
|
|
|
|
TYPEATTR *pTypeAttr, TYPELIB_DATA *pTLData)
|
|
|
|
{
|
|
|
|
BOOL bFirst = TRUE;
|
|
|
|
WCHAR wszGuid[MAX_LOAD_STRING];
|
|
|
|
const WCHAR wszTypedef[] = { 't','y','p','e','d','e','f',' ','\0' };
|
|
|
|
const WCHAR wszPublic[] = { 'p','u','b','l','i','c','\0' };
|
|
|
|
|
|
|
|
AddToTLDataStrW(pTLData, wszTypedef);
|
|
|
|
if(memcmp(&pTypeAttr->guid, &GUID_NULL, sizeof(GUID)))
|
|
|
|
{
|
|
|
|
if(bFirst) AddToTLDataStrW(pTLData, wszOpenBrackets1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
|
|
|
}
|
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(pTLData, wszUUID);
|
|
|
|
AddToTLDataStrW(pTLData, wszOpenBrackets2);
|
|
|
|
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
|
|
|
|
wszGuid[lstrlenW(wszGuid)-1] = '\0';
|
|
|
|
AddToTLDataStrW(pTLData, &wszGuid[1]);
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets2);
|
|
|
|
}
|
|
|
|
if(pTypeAttr->typekind == TKIND_ALIAS)
|
|
|
|
{
|
|
|
|
if(bFirst) AddToTLDataStrW(pTLData, wszOpenBrackets1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszComa);
|
|
|
|
AddToTLDataStrW(pTLData, wszSpace);
|
|
|
|
}
|
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(pTLData, wszPublic);
|
|
|
|
}
|
|
|
|
if(!bFirst)
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(pTLData, wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW(pTLData, wszNewLine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
int PopulateTree(void)
|
2006-06-30 17:29:56 +02:00
|
|
|
{
|
|
|
|
TVINSERTSTRUCT tvis;
|
2006-08-20 18:48:29 +02:00
|
|
|
TVITEM tvi;
|
2006-06-30 17:29:56 +02:00
|
|
|
ITypeLib *pTypeLib;
|
2006-07-18 12:53:19 +02:00
|
|
|
TLIBATTR *pTLibAttr;
|
2006-07-02 19:44:39 +02:00
|
|
|
ITypeInfo *pTypeInfo, *pRefTypeInfo;
|
|
|
|
HREFTYPE hRefType;
|
2006-07-02 13:03:09 +02:00
|
|
|
TYPEATTR *pTypeAttr;
|
2006-06-30 17:29:56 +02:00
|
|
|
INT count, i;
|
2006-10-02 23:22:01 +02:00
|
|
|
ULONG ulHelpContext;
|
2006-06-30 17:29:56 +02:00
|
|
|
BSTR bstrName;
|
2006-07-02 13:03:09 +02:00
|
|
|
BSTR bstrData;
|
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
2006-07-10 12:07:51 +02:00
|
|
|
WCHAR wszAfter[MAX_LOAD_STRING];
|
2006-07-02 13:03:09 +02:00
|
|
|
HRESULT hRes;
|
2006-07-10 12:07:51 +02:00
|
|
|
HTREEITEM hParent;
|
2006-08-21 22:21:09 +02:00
|
|
|
HTREEITEM hMain;
|
|
|
|
BOOL bInsert;
|
|
|
|
TYPELIB_DATA *tldDispatch;
|
2006-07-02 13:03:09 +02:00
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
const WCHAR wszGeneratedInfo[] = { '/','/',' ','G','e','n','e','r','a','t','e','d',
|
|
|
|
' ','.','I','D','L',' ','f','i','l','e',' ','(','b','y',' ','t','h','e',' ',
|
|
|
|
'O','L','E','/','C','O','M',' ','O','b','j','e','c','t',' ',
|
|
|
|
'V','i','e','w','e','r',')','\n','/','/','\n','/','/',' ',
|
|
|
|
't','y','p','e','l','i','b',' ','f','i','l','e','n','a','m','e',':',' ','\0'};
|
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
const WCHAR wszFormat[] = { '%','s',' ','(','%','s',')','\0' };
|
2006-07-18 12:53:19 +02:00
|
|
|
const WCHAR wszFormat2[] = { 'v','e','r','s','i','o','n',
|
|
|
|
'(','%','l','d','.','%','l','d',')','\0' };
|
2006-07-02 13:03:09 +02:00
|
|
|
|
|
|
|
const WCHAR wszTKIND_ENUM[] = { 't','y','p','e','d','e','f',' ','e','n','u','m',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_RECORD[]
|
|
|
|
= { 't','y','p','e','d','e','f',' ','s','t','r','u','c','t',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_MODULE[] = { 'm','o','d','u','l','e',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_INTERFACE[] = { 'i','n','t','e','r','f','a','c','e',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_DISPATCH[]
|
|
|
|
= { 'd','i','s','p','i','n','t','e','r','f','a','c','e',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_COCLASS[] = { 'c','o','c','l','a','s','s',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_ALIAS[] = { 't','y','p','e','d','e','f',' ','\0' };
|
|
|
|
const WCHAR wszTKIND_UNION[]
|
|
|
|
= { 't','y','p','e','d','e','f',' ','u','n','i','o','n',' ','\0' };
|
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
const WCHAR wszHelpString[] = { 'h','e','l','p','s','t','r','i','n','g','\0' };
|
|
|
|
const WCHAR wszLibrary[] = { 'l','i','b','r','a','r','y',' ','\0' };
|
2006-07-18 12:54:30 +02:00
|
|
|
const WCHAR wszTag[] = { 't','a','g','\0' };
|
2006-07-18 12:53:19 +02:00
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
WCHAR wszProperties[] = { 'p','r','o','p','e','r','t','i','e','s','\0' };
|
|
|
|
WCHAR wszMethods[] = { 'm','e','t','h','o','d','s','\0' };
|
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
|
2006-07-02 13:03:09 +02:00
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszText;
|
2006-06-30 17:29:56 +02:00
|
|
|
tvis.hInsertAfter = (HTREEITEM)TVI_LAST;
|
|
|
|
tvis.hParent = TVI_ROOT;
|
|
|
|
|
2006-07-02 13:04:26 +02:00
|
|
|
if(FAILED((hRes = LoadTypeLib(typelib.wszFileName, &pTypeLib))))
|
2006-07-02 13:03:09 +02:00
|
|
|
{
|
|
|
|
WCHAR wszMessage[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszError[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
LoadString(globals.hMainInst, IDS_ERROR_LOADTYPELIB,
|
|
|
|
wszError, sizeof(WCHAR[MAX_LOAD_STRING]));
|
2006-07-02 13:04:26 +02:00
|
|
|
wsprintfW(wszMessage, wszError, typelib.wszFileName, hRes);
|
2006-07-02 13:03:09 +02:00
|
|
|
MessageBox(globals.hMainWnd, wszMessage, NULL, MB_OK|MB_ICONEXCLAMATION);
|
|
|
|
return 1;
|
|
|
|
}
|
2006-06-30 17:29:56 +02:00
|
|
|
count = ITypeLib_GetTypeInfoCount(pTypeLib);
|
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
ITypeLib_GetDocumentation(pTypeLib, -1, &bstrName, &bstrData, NULL, NULL);
|
2006-07-18 12:53:19 +02:00
|
|
|
ITypeLib_GetLibAttr(pTypeLib, &pTLibAttr);
|
|
|
|
|
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszGeneratedInfo);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), typelib.wszFileName);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces((TYPELIB_DATA*)(U(tvis).item.lParam), 4);
|
2006-07-18 12:53:19 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszUUID);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets2);
|
|
|
|
StringFromGUID2(&(pTLibAttr->guid), wszText, MAX_LOAD_STRING);
|
|
|
|
wszText[lstrlenW(wszText)-1] = '\0';
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), &wszText[1]);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets2);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces((TYPELIB_DATA*)(U(tvis).item.lParam), 4);
|
2006-07-18 12:53:19 +02:00
|
|
|
wsprintfW(wszText, wszFormat2, pTLibAttr->wMajorVerNum, pTLibAttr->wMinorVerNum);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszComa);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-08-20 13:57:21 +02:00
|
|
|
AddSpaces((TYPELIB_DATA*)(U(tvis).item.lParam), 4);
|
2006-07-18 12:53:19 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszHelpString);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets2);
|
2006-08-20 18:51:04 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszInvertedComa);
|
2006-07-18 12:53:19 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrData);
|
2006-08-20 18:51:04 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszInvertedComa);
|
2006-07-18 12:53:19 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets2);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszCloseBrackets1);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszLibrary);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets3);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter, wszCloseBrackets3);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter, wszSemicolon);
|
2006-07-18 12:53:19 +02:00
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
wsprintfW(wszText, wszFormat, bstrName, bstrData);
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
SysFreeString(bstrData);
|
|
|
|
tvis.hParent = (HTREEITEM)SendMessage(typelib.hTree,
|
|
|
|
TVM_INSERTITEM, 0, (LPARAM)&tvis);
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
for(i=0; i<count; i++)
|
|
|
|
{
|
2006-08-21 22:21:09 +02:00
|
|
|
bInsert = TRUE;
|
2006-07-02 13:03:09 +02:00
|
|
|
ITypeLib_GetTypeInfo(pTypeLib, i, &pTypeInfo);
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2006-07-21 21:11:27 +02:00
|
|
|
ITypeInfo_GetDocumentation(pTypeInfo, MEMBERID_NIL, &bstrName, &bstrData,
|
2006-08-12 19:44:02 +02:00
|
|
|
&ulHelpContext, NULL);
|
2006-07-02 13:03:09 +02:00
|
|
|
ITypeInfo_GetTypeAttr(pTypeInfo, &pTypeAttr);
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
2006-07-10 12:07:51 +02:00
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
2006-07-18 12:54:30 +02:00
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
2006-07-02 13:03:09 +02:00
|
|
|
switch(pTypeAttr->typekind)
|
|
|
|
{
|
2006-07-18 12:54:30 +02:00
|
|
|
case TKIND_ENUM:
|
|
|
|
AddToStrW(wszText, wszTKIND_ENUM);
|
|
|
|
AddToStrW(wszText, bstrName);
|
2006-08-21 11:36:35 +02:00
|
|
|
|
|
|
|
CreateTypedefHeader(pTypeInfo, pTypeAttr,
|
|
|
|
(TYPELIB_DATA*)(U(tvis).item.lParam));
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
&wszTKIND_ENUM[lstrlenW(wszTKIND_ALIAS)]);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets3);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),wszNewLine);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszCloseBrackets3);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszSpace);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
bstrName);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszSemicolon);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszNewLine);
|
2006-07-18 12:54:30 +02:00
|
|
|
break;
|
|
|
|
case TKIND_RECORD:
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszTKIND_RECORD);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszTag);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets3);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszCloseBrackets3);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszSpace);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
bstrName);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszSemicolon);
|
|
|
|
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
|
|
|
|
wszNewLine);
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToStrW(wszText, wszTKIND_RECORD);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
break;
|
|
|
|
case TKIND_MODULE:
|
|
|
|
AddToStrW(wszText, wszTKIND_MODULE);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
break;
|
|
|
|
case TKIND_INTERFACE:
|
2006-07-21 21:11:27 +02:00
|
|
|
CreateInterfaceInfo(pTypeInfo, pTypeAttr->cImplTypes, bstrName,
|
2006-08-12 19:44:02 +02:00
|
|
|
bstrData, ulHelpContext, pTypeAttr,
|
|
|
|
(TYPELIB_DATA*)(U(tvis).item.lParam));
|
2006-08-20 18:48:29 +02:00
|
|
|
((TYPELIB_DATA*)(U(tvis).item.lParam))->bPredefine = TRUE;
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
AddToStrW(wszText, wszTKIND_INTERFACE);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
break;
|
|
|
|
case TKIND_COCLASS:
|
|
|
|
AddToStrW(wszText, wszTKIND_COCLASS);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
break;
|
|
|
|
case TKIND_UNION:
|
|
|
|
AddToStrW(wszText, wszTKIND_UNION);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
break;
|
2006-07-02 19:44:39 +02:00
|
|
|
case TKIND_DISPATCH:
|
2006-08-21 22:21:09 +02:00
|
|
|
CreateInterfaceInfo(pTypeInfo, pTypeAttr->cImplTypes, bstrName,
|
|
|
|
bstrData, ulHelpContext, pTypeAttr,
|
|
|
|
(TYPELIB_DATA*)(U(tvis).item.lParam));
|
2006-08-20 18:48:29 +02:00
|
|
|
((TYPELIB_DATA*)(U(tvis).item.lParam))->bPredefine = TRUE;
|
2006-07-02 19:44:39 +02:00
|
|
|
AddToStrW(wszText, wszTKIND_DISPATCH);
|
|
|
|
AddToStrW(wszText, bstrName);
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
hMain = tvis.hParent;
|
|
|
|
tldDispatch = (TYPELIB_DATA*)(U(tvis).item.lParam);
|
|
|
|
|
|
|
|
lstrcpyW(wszText, wszProperties);
|
|
|
|
tvis.hParent = hParent;
|
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszProperties);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszColon);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
tvis.hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
EnumVars(pTypeInfo, pTypeAttr->cVars, tvis.hParent);
|
|
|
|
AddChildrenData(tvis.hParent, (TYPELIB_DATA*)(U(tvis).item.lParam));
|
|
|
|
|
|
|
|
lstrcpyW(wszText, wszMethods);
|
|
|
|
tvis.hParent = hParent;
|
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszMethods);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszColon);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
|
|
|
tvis.hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
EnumFuncs(pTypeInfo, pTypeAttr->cFuncs, tvis.hParent);
|
|
|
|
AddChildrenData(tvis.hParent, (TYPELIB_DATA*)(U(tvis).item.lParam));
|
|
|
|
|
|
|
|
EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent);
|
|
|
|
AddChildrenData(hParent, tldDispatch);
|
|
|
|
AddToTLDataStrW(tldDispatch, tldDispatch->wszInsertAfter);
|
|
|
|
|
|
|
|
bInsert = FALSE;
|
|
|
|
tvis.hParent = hMain;
|
|
|
|
|
2006-07-02 19:44:39 +02:00
|
|
|
if(SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(pTypeInfo, -1, &hRefType)))
|
|
|
|
{
|
2006-08-21 22:21:09 +02:00
|
|
|
bInsert = TRUE;
|
2006-07-02 19:44:39 +02:00
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
ITypeInfo_ReleaseTypeAttr(pTypeInfo, pTypeAttr);
|
2006-08-12 19:44:02 +02:00
|
|
|
SysFreeString(bstrName);
|
|
|
|
SysFreeString(bstrData);
|
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
U(tvis).item.lParam = InitializeTLData();
|
|
|
|
|
2006-07-02 19:44:39 +02:00
|
|
|
ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo);
|
|
|
|
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
|
2006-08-12 19:44:02 +02:00
|
|
|
&bstrData, &ulHelpContext, NULL);
|
2006-08-21 22:21:09 +02:00
|
|
|
ITypeInfo_GetTypeAttr(pRefTypeInfo, &pTypeAttr);
|
2006-07-21 21:11:27 +02:00
|
|
|
|
|
|
|
CreateInterfaceInfo(pTypeInfo, pTypeAttr->cImplTypes, bstrName,
|
2006-08-12 19:44:02 +02:00
|
|
|
bstrData, ulHelpContext, pTypeAttr,
|
|
|
|
(TYPELIB_DATA*)(U(tvis).item.lParam));
|
2006-08-20 18:48:29 +02:00
|
|
|
((TYPELIB_DATA*)(U(tvis).item.lParam))->bPredefine = TRUE;
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2006-07-02 19:44:39 +02:00
|
|
|
AddToStrW(wszText, wszTKIND_INTERFACE);
|
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
break;
|
2006-07-02 13:03:09 +02:00
|
|
|
case TKIND_ALIAS:
|
|
|
|
AddToStrW(wszText, wszTKIND_ALIAS);
|
2006-07-10 12:07:51 +02:00
|
|
|
CreateTypeInfo(wszText, wszAfter, pTypeAttr->tdescAlias, pTypeInfo);
|
2006-07-02 19:43:30 +02:00
|
|
|
AddToStrW(wszText, wszSpace);
|
2006-07-02 13:03:09 +02:00
|
|
|
AddToStrW(wszText, bstrName);
|
2006-07-10 12:07:51 +02:00
|
|
|
AddToStrW(wszText, wszAfter);
|
2006-08-21 11:36:35 +02:00
|
|
|
|
|
|
|
CreateTypedefHeader(pTypeInfo, pTypeAttr,
|
|
|
|
(TYPELIB_DATA*)(U(tvis).item.lParam));
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
&wszText[lstrlenW(wszTKIND_ALIAS)]);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSemicolon);
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
|
2006-07-02 13:03:09 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lstrcpyW(wszText, bstrName);
|
2006-10-05 11:06:12 +02:00
|
|
|
WINE_FIXME("pTypeAttr->typekind == %d not supported\n",
|
2006-07-02 19:43:30 +02:00
|
|
|
pTypeAttr->typekind);
|
2006-07-02 13:03:09 +02:00
|
|
|
}
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
if(bInsert)
|
|
|
|
{
|
|
|
|
hParent = TreeView_InsertItem(typelib.hTree, &tvis);
|
|
|
|
|
|
|
|
EnumVars(pTypeInfo, pTypeAttr->cVars, hParent);
|
|
|
|
EnumFuncs(pTypeInfo, pTypeAttr->cFuncs, hParent);
|
|
|
|
EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent);
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2006-08-21 22:21:09 +02:00
|
|
|
if(memcmp(bstrName, wszVT_UNKNOWN, sizeof(wszVT_UNKNOWN)))
|
|
|
|
AddChildrenData(hParent, (TYPELIB_DATA*)(U(tvis).item.lParam));
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam),
|
|
|
|
((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter);
|
|
|
|
}
|
2006-07-18 12:54:30 +02:00
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
ITypeInfo_ReleaseTypeAttr(pTypeInfo, pTypeAttr);
|
|
|
|
ITypeInfo_Release(pTypeInfo);
|
2006-06-30 17:29:56 +02:00
|
|
|
SysFreeString(bstrName);
|
2006-07-21 21:11:27 +02:00
|
|
|
SysFreeString(bstrData);
|
2006-06-30 17:29:56 +02:00
|
|
|
}
|
|
|
|
SendMessage(typelib.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)tvis.hParent);
|
|
|
|
|
2006-08-20 18:48:29 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
tvi.hItem = tvis.hParent;
|
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
AddPredefinitions(tvi.hItem, (TYPELIB_DATA*)(tvi.lParam));
|
|
|
|
AddIdlData(tvi.hItem, (TYPELIB_DATA*)(tvi.lParam));
|
|
|
|
AddToTLDataStrW((TYPELIB_DATA*)(tvi.lParam),
|
|
|
|
((TYPELIB_DATA*)(tvi.lParam))->wszInsertAfter);
|
|
|
|
|
2006-06-30 17:29:56 +02:00
|
|
|
ITypeLib_Release(pTypeLib);
|
2006-07-02 13:03:09 +02:00
|
|
|
return 0;
|
2006-06-30 17:29:56 +02:00
|
|
|
}
|
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
void UpdateData(HTREEITEM item)
|
|
|
|
{
|
|
|
|
TVITEM tvi;
|
|
|
|
|
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
tvi.hItem = item;
|
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
2006-07-18 12:54:30 +02:00
|
|
|
if(!tvi.lParam)
|
|
|
|
{
|
|
|
|
SetWindowText(typelib.hEdit, wszSpace);
|
|
|
|
return;
|
|
|
|
}
|
2006-07-18 12:53:19 +02:00
|
|
|
|
|
|
|
SetWindowText(typelib.hEdit, ((TYPELIB_DATA*)tvi.lParam)->idl);
|
|
|
|
}
|
|
|
|
|
2006-06-30 18:42:14 +02:00
|
|
|
void TypeLibResizeChild(void)
|
|
|
|
{
|
|
|
|
RECT client, stat;
|
|
|
|
|
|
|
|
MoveWindow(typelib.hStatusBar, 0, 0, 0, 0, TRUE);
|
|
|
|
|
|
|
|
if(IsWindowVisible(typelib.hStatusBar))
|
|
|
|
GetClientRect(typelib.hStatusBar, &stat);
|
|
|
|
else stat.bottom = 0;
|
|
|
|
|
|
|
|
GetClientRect(globals.hTypeLibWnd, &client);
|
|
|
|
MoveWindow(typelib.hPaneWnd, 0, 0,
|
|
|
|
client.right, client.bottom-stat.bottom, TRUE);
|
|
|
|
}
|
|
|
|
|
2006-06-30 18:43:40 +02:00
|
|
|
void TypeLibMenuCommand(WPARAM wParam, HWND hWnd)
|
|
|
|
{
|
|
|
|
BOOL vis;
|
|
|
|
|
|
|
|
switch(wParam)
|
|
|
|
{
|
2006-08-20 18:51:04 +02:00
|
|
|
case IDM_SAVEAS:
|
|
|
|
GetSaveIdlAsPath();
|
|
|
|
break;
|
2006-06-30 18:43:40 +02:00
|
|
|
case IDM_STATUSBAR:
|
|
|
|
vis = IsWindowVisible(typelib.hStatusBar);
|
|
|
|
ShowWindow(typelib.hStatusBar, vis ? SW_HIDE : SW_SHOW);
|
|
|
|
CheckMenuItem(GetMenu(hWnd), LOWORD(wParam),
|
|
|
|
vis ? MF_UNCHECKED : MF_CHECKED);
|
|
|
|
TypeLibResizeChild();
|
|
|
|
break;
|
|
|
|
case IDM_CLOSE:
|
|
|
|
DestroyWindow(hWnd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-30 18:42:14 +02:00
|
|
|
void UpdateTypeLibStatusBar(int itemID)
|
|
|
|
{
|
|
|
|
WCHAR info[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
if(!LoadString(globals.hMainInst, itemID, info, sizeof(WCHAR[MAX_LOAD_STRING])))
|
|
|
|
LoadString(globals.hMainInst, IDS_READY, info, sizeof(WCHAR[MAX_LOAD_STRING]));
|
|
|
|
|
|
|
|
SendMessage(typelib.hStatusBar, SB_SETTEXT, 0, (LPARAM)info);
|
|
|
|
}
|
|
|
|
|
2006-07-18 12:55:31 +02:00
|
|
|
void EmptyTLTree(void)
|
|
|
|
{
|
|
|
|
HTREEITEM cur, del;
|
|
|
|
TVITEM tvi;
|
|
|
|
|
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
cur = TreeView_GetChild(typelib.hTree, TVI_ROOT);
|
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
{
|
|
|
|
del = cur;
|
|
|
|
cur = TreeView_GetChild(typelib.hTree, del);
|
|
|
|
|
|
|
|
if(!cur) cur = TreeView_GetNextSibling(typelib.hTree, del);
|
|
|
|
if(!cur) cur = TreeView_GetParent(typelib.hTree, del);
|
|
|
|
|
|
|
|
tvi.hItem = del;
|
|
|
|
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
if(tvi.lParam)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, ((TYPELIB_DATA *)tvi.lParam)->idl);
|
|
|
|
HeapFree(GetProcessHeap(), 0, (TYPELIB_DATA *)tvi.lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
SendMessage(typelib.hTree, TVM_DELETEITEM, 0, (LPARAM)del);
|
|
|
|
|
|
|
|
if(!cur) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-30 17:29:56 +02:00
|
|
|
LRESULT CALLBACK TypeLibProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
|
|
|
{
|
|
|
|
if(!CreatePanedWindow(hWnd, &typelib.hPaneWnd, globals.hMainInst))
|
|
|
|
DestroyWindow(hWnd);
|
|
|
|
typelib.hTree = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, NULL,
|
|
|
|
WS_CHILD|WS_VISIBLE|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,
|
2006-07-18 12:53:19 +02:00
|
|
|
0, 0, 0, 0, typelib.hPaneWnd, (HMENU)TYPELIB_TREE,
|
|
|
|
globals.hMainInst, NULL);
|
2006-06-30 17:29:56 +02:00
|
|
|
typelib.hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, NULL,
|
|
|
|
WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_READONLY|WS_HSCROLL|WS_VSCROLL,
|
|
|
|
0, 0, 0, 0, typelib.hPaneWnd, NULL, globals.hMainInst, NULL);
|
|
|
|
|
|
|
|
SetLeft(typelib.hPaneWnd, typelib.hTree);
|
|
|
|
SetRight(typelib.hPaneWnd, typelib.hEdit);
|
|
|
|
|
2006-07-02 13:03:09 +02:00
|
|
|
if(PopulateTree()) DestroyWindow(hWnd);
|
|
|
|
else SetFocus(typelib.hTree);
|
2006-06-30 17:29:56 +02:00
|
|
|
break;
|
|
|
|
}
|
2006-06-30 18:43:40 +02:00
|
|
|
case WM_COMMAND:
|
|
|
|
TypeLibMenuCommand(LOWORD(wParam), hWnd);
|
2006-06-30 18:42:14 +02:00
|
|
|
case WM_MENUSELECT:
|
|
|
|
UpdateTypeLibStatusBar(LOWORD(wParam));
|
|
|
|
break;
|
|
|
|
case WM_SETFOCUS:
|
|
|
|
SetFocus(typelib.hTree);
|
|
|
|
break;
|
2006-06-30 17:29:56 +02:00
|
|
|
case WM_SIZE:
|
2006-06-30 18:42:14 +02:00
|
|
|
if(wParam == SIZE_MINIMIZED) break;
|
|
|
|
TypeLibResizeChild();
|
2006-06-30 17:29:56 +02:00
|
|
|
break;
|
|
|
|
case WM_DESTROY:
|
2006-07-18 12:55:31 +02:00
|
|
|
EmptyTLTree();
|
2006-06-30 17:29:56 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL TypeLibRegisterClass(void)
|
|
|
|
{
|
|
|
|
WNDCLASS wcc;
|
|
|
|
|
|
|
|
memset(&wcc, 0, sizeof(WNDCLASS));
|
|
|
|
wcc.lpfnWndProc = TypeLibProc;
|
|
|
|
wcc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
|
|
|
wcc.lpszMenuName = MAKEINTRESOURCE(IDM_TYPELIB);
|
|
|
|
wcc.lpszClassName = wszTypeLib;
|
|
|
|
|
|
|
|
if(!RegisterClass(&wcc))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-07-02 13:04:26 +02:00
|
|
|
BOOL CreateTypeLibWindow(HINSTANCE hInst, WCHAR *wszFileName)
|
2006-06-30 17:29:56 +02:00
|
|
|
{
|
|
|
|
WCHAR wszTitle[MAX_LOAD_STRING];
|
|
|
|
LoadString(hInst, IDS_TYPELIBTITLE, wszTitle, sizeof(WCHAR[MAX_LOAD_STRING]));
|
|
|
|
|
2006-07-02 13:04:26 +02:00
|
|
|
if(wszFileName) lstrcpyW(typelib.wszFileName, wszFileName);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TVITEM tvi;
|
|
|
|
|
|
|
|
memset(&tvi, 0, sizeof(TVITEM));
|
|
|
|
tvi.hItem = TreeView_GetSelection(globals.hTree);
|
|
|
|
|
|
|
|
SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
|
|
|
|
lstrcpyW(typelib.wszFileName, ((ITEM_INFO*)tvi.lParam)->path);
|
|
|
|
}
|
|
|
|
|
2006-06-30 17:29:56 +02:00
|
|
|
globals.hTypeLibWnd = CreateWindow(wszTypeLib, wszTitle,
|
|
|
|
WS_OVERLAPPEDWINDOW|WS_VISIBLE,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInst, NULL);
|
|
|
|
if(!globals.hTypeLibWnd) return FALSE;
|
2006-06-30 18:42:14 +02:00
|
|
|
|
|
|
|
typelib.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD,
|
|
|
|
(LPWSTR)wszTitle, globals.hTypeLibWnd, 0);
|
|
|
|
|
|
|
|
TypeLibResizeChild();
|
2006-06-30 17:29:56 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|