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"
|
|
|
|
|
|
|
|
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' };
|
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' };
|
2007-02-25 19:40:42 +01:00
|
|
|
static const WCHAR wszVT_SAFEARRAY[] = { 'S','A','F','E','A','R','R','A','Y','\0' };
|
2006-08-20 12:44:49 +02:00
|
|
|
|
2008-04-09 21:50:16 +02:00
|
|
|
static 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' };
|
2008-04-09 21:50:16 +02:00
|
|
|
static const WCHAR wszHelpstring[] = { 'h','e','l','p','s','t','r','i','n','g','\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' };
|
2007-02-25 08:36:36 +01:00
|
|
|
static const WCHAR wszPARAMFLAG_FOPT[] = { 'o','p','t','i','o','n','a','l','\0' };
|
2006-08-20 12:44:49 +02:00
|
|
|
static const WCHAR wszPARAMFLAG_FHASCUSTDATA[]
|
|
|
|
= { 'h','a','s','c','u','s','t','d','a','t','a','\0' };
|
2007-02-25 08:35:10 +01:00
|
|
|
static const WCHAR wszDefaultValue[]
|
|
|
|
= { 'd','e','f','a','u','l','t','v','a','l','u','e','\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' };
|
2007-02-28 02:37:39 +01:00
|
|
|
static const WCHAR wszConst[] = { 'c','o','n','s','t','\0' };
|
2006-08-21 22:21:09 +02:00
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void ShowLastError(void)
|
2006-08-20 18:51:04 +02:00
|
|
|
{
|
|
|
|
DWORD error = GetLastError();
|
|
|
|
LPWSTR lpMsgBuf;
|
|
|
|
WCHAR wszTitle[MAX_LOAD_STRING];
|
|
|
|
|
2018-07-09 20:59:15 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_TYPELIBTITLE, wszTitle, ARRAY_SIZE(wszTitle));
|
2010-05-07 10:46:02 +02:00
|
|
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
|
|
NULL, error, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
|
|
|
|
MessageBoxW(NULL, lpMsgBuf, wszTitle, MB_OK | MB_ICONERROR);
|
2006-08-20 18:51:04 +02:00
|
|
|
LocalFree(lpMsgBuf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void SaveIdl(WCHAR *wszFileName)
|
2006-08-20 18:51:04 +02:00
|
|
|
{
|
|
|
|
HTREEITEM hIDL;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-08-20 18:51:04 +02:00
|
|
|
HANDLE hFile;
|
2007-03-13 21:17:03 +01:00
|
|
|
DWORD len, dwNumWrite;
|
2006-08-20 18:51:04 +02:00
|
|
|
char *wszIdl;
|
2007-03-13 21:17:03 +01:00
|
|
|
TYPELIB_DATA *data;
|
2006-08-20 18:51:04 +02:00
|
|
|
|
2010-05-07 10:45:29 +02:00
|
|
|
hIDL = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)TVI_ROOT);
|
2006-08-20 18:51:04 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-08-20 18:51:04 +02:00
|
|
|
tvi.hItem = hIDL;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2007-03-13 21:17:03 +01:00
|
|
|
data = (TYPELIB_DATA *)tvi.lParam;
|
2006-08-20 18:51:04 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
hFile = CreateFileW(wszFileName, GENERIC_WRITE, FILE_SHARE_WRITE,
|
2007-03-13 21:17:03 +01:00
|
|
|
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
2006-08-20 18:51:04 +02:00
|
|
|
if(hFile == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
ShowLastError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-13 21:17:03 +01:00
|
|
|
len = WideCharToMultiByte( CP_UTF8, 0, data->idl, data->idlLen, NULL, 0, NULL, NULL );
|
|
|
|
wszIdl = HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
WideCharToMultiByte( CP_UTF8, 0, data->idl, data->idlLen, wszIdl, len, NULL, NULL );
|
2006-08-20 18:51:04 +02:00
|
|
|
|
2007-03-13 21:17:03 +01:00
|
|
|
if(!WriteFile(hFile, wszIdl, len, &dwNumWrite, NULL))
|
|
|
|
ShowLastError();
|
2006-08-20 18:51:04 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, wszIdl);
|
|
|
|
CloseHandle(hFile);
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void GetSaveIdlAsPath(void)
|
2006-08-20 18:51:04 +02:00
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
OPENFILENAMEW saveidl;
|
2006-08-20 18:51:04 +02:00
|
|
|
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);
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
GetCurrentDirectoryW(MAX_LOAD_STRING, wszDir);
|
2006-08-20 18:51:04 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
saveidl.lStructSize = sizeof(OPENFILENAMEW);
|
2006-08-20 18:51:04 +02:00
|
|
|
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;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
if (GetSaveFileNameW(&saveidl))
|
2006-08-20 18:51:04 +02:00
|
|
|
SaveIdl(wszPath);
|
|
|
|
}
|
|
|
|
|
2009-01-07 12:23:42 +01:00
|
|
|
static void AddToStrW(WCHAR *wszDest, const WCHAR *wszSource)
|
2006-07-02 13:03:09 +02:00
|
|
|
{
|
|
|
|
lstrcpyW(&wszDest[lstrlenW(wszDest)], wszSource);
|
|
|
|
}
|
|
|
|
|
2009-01-07 12:23:42 +01:00
|
|
|
static void AddToTLDataStrW(TYPELIB_DATA *pTLData, const WCHAR *wszSource)
|
2006-07-18 12:53:19 +02:00
|
|
|
{
|
|
|
|
int SourceLen = lstrlenW(wszSource);
|
|
|
|
|
|
|
|
pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
|
|
|
|
sizeof(WCHAR)*(pTLData->idlLen+SourceLen+1));
|
2007-01-26 15:48:42 +01:00
|
|
|
|
2006-07-18 12:53:19 +02:00
|
|
|
memcpy(&pTLData->idl[pTLData->idlLen], wszSource, sizeof(WCHAR)*(SourceLen+1));
|
|
|
|
pTLData->idlLen += SourceLen;
|
|
|
|
}
|
|
|
|
|
2009-01-07 12:23:42 +01:00
|
|
|
static void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
|
|
|
int lineLen = lstrlenW(wszSource);
|
|
|
|
int newLinesNo = 0;
|
2009-01-20 11:21:34 +01:00
|
|
|
WCHAR *pSourcePos = wszSource;
|
2006-08-20 13:57:21 +02:00
|
|
|
WCHAR *pSourceBeg;
|
|
|
|
|
2006-08-20 18:48:29 +02:00
|
|
|
if(!lineLen) return;
|
2006-08-20 13:57:21 +02:00
|
|
|
while(*pSourcePos)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
if(*pSourcePos == L'\n') newLinesNo++;
|
2006-08-20 13:57:21 +02:00
|
|
|
pSourcePos += 1;
|
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
if(*(pSourcePos - 1) != L'\n') newLinesNo++;
|
2006-08-20 13:57:21 +02:00
|
|
|
|
|
|
|
pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
|
|
|
|
sizeof(WCHAR)*(pTLData->idlLen+lineLen+4*newLinesNo+1));
|
|
|
|
|
2009-01-20 11:21:34 +01:00
|
|
|
pSourcePos = wszSource;
|
|
|
|
pSourceBeg = wszSource;
|
2006-08-20 18:48:29 +02:00
|
|
|
while(newLinesNo)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
if(*pSourcePos != L'\n' && *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
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
pTLData->idl[pTLData->idlLen] = L' ';
|
|
|
|
pTLData->idl[pTLData->idlLen+1] = L' ';
|
|
|
|
pTLData->idl[pTLData->idlLen+2] = L' ';
|
|
|
|
pTLData->idl[pTLData->idlLen+3] = L' ';
|
2006-08-20 13:57:21 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-26 15:48:42 +01:00
|
|
|
static TYPELIB_DATA *InitializeTLData(void)
|
2006-07-18 12:53:19 +02:00
|
|
|
{
|
|
|
|
TYPELIB_DATA *pTLData;
|
|
|
|
|
2007-04-25 00:57:55 +02:00
|
|
|
pTLData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYPELIB_DATA));
|
2006-07-18 12:53:19 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
2007-01-26 15:48:42 +01:00
|
|
|
return pTLData;
|
2006-07-18 12:53:19 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void AddSpaces(TYPELIB_DATA *pTLData, int tabSize)
|
2006-08-20 12:44:49 +02:00
|
|
|
{
|
|
|
|
for(; tabSize>0; tabSize--)
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L" ");
|
2006-08-20 12:44:49 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
|
2006-07-18 12:54:30 +02:00
|
|
|
{
|
|
|
|
HTREEITEM hCur;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-07-18 12:54:30 +02:00
|
|
|
|
2010-01-11 08:57:18 +01:00
|
|
|
memset(&tvi, 0, sizeof(tvi));
|
2006-07-18 12:54:30 +02:00
|
|
|
|
2010-05-07 10:45:29 +02:00
|
|
|
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)hParent);
|
2006-07-21 21:11:27 +02:00
|
|
|
if(!hCur) return;
|
|
|
|
|
2006-07-18 12:54:30 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-07-18 12:54:30 +02:00
|
|
|
if(tvi.lParam && ((TYPELIB_DATA *)(tvi.lParam))->idlLen)
|
2006-08-20 13:57:21 +02:00
|
|
|
AddToTLDataStrWithTabsW(pData, ((TYPELIB_DATA *)(tvi.lParam))->idl);
|
2010-05-07 10:45:29 +02:00
|
|
|
} while((hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_NEXT, (LPARAM)hCur)));
|
2006-07-18 12:54:30 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static 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;
|
2007-02-25 19:40:42 +01:00
|
|
|
case VT_SAFEARRAY:
|
|
|
|
AddToStrW(wszAddTo, wszVT_SAFEARRAY);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszAddTo, L"(");
|
2007-02-25 19:40:42 +01:00
|
|
|
CreateTypeInfo(wszAddTo, wszAddAfter, *U(tdesc).lptdesc, pTypeInfo);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszAddTo, L")");
|
2007-02-25 19:40:42 +01:00
|
|
|
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);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszAddTo, L"*");
|
2006-07-02 19:43:30 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
|
2006-07-10 12:07:51 +02:00
|
|
|
{
|
|
|
|
int i;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2006-07-10 12:07:51 +02:00
|
|
|
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;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-07-10 12:07:51 +02:00
|
|
|
tvis.hParent = hParent;
|
|
|
|
|
|
|
|
for(i=0; i<cVars; i++)
|
|
|
|
{
|
2007-01-26 15:48:42 +01:00
|
|
|
TYPELIB_DATA *tld;
|
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
if(FAILED(ITypeInfo_GetVarDesc(pTypeInfo, i, &pVarDesc))) continue;
|
|
|
|
if(FAILED(ITypeInfo_GetDocumentation(pTypeInfo, pVarDesc->memid, &bstrName,
|
|
|
|
NULL, NULL, NULL))) continue;
|
|
|
|
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pVarDesc->memid < MIN_VAR_ID)
|
|
|
|
{
|
2007-01-26 15:48:42 +01:00
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"[");
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszId);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(");
|
2006-08-21 22:21:09 +02:00
|
|
|
wsprintfW(wszText, wszFormat, pVarDesc->memid);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszText);
|
2006-08-21 22:21:09 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L")");
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
if(pVarDesc->wVarFlags & VARFLAG_FREADONLY)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L", ");
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszReadOnly);
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"]\n");
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszText, L" ");
|
2010-12-31 21:36:08 +01:00
|
|
|
if (bstrName) AddToStrW(wszText, bstrName);
|
2006-07-10 12:07:51 +02:00
|
|
|
AddToStrW(wszText, wszAfter);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszText);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L";\n");
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
|
2006-07-10 12:07:51 +02:00
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseVarDesc(pTypeInfo, pVarDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static int EnumEnums(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
|
2007-02-26 00:09:19 +01:00
|
|
|
{
|
|
|
|
int i;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2007-02-26 00:09:19 +01:00
|
|
|
VARDESC *pVarDesc;
|
|
|
|
BSTR bstrName;
|
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
2007-02-28 02:37:39 +01:00
|
|
|
WCHAR wszAfter[MAX_LOAD_STRING];
|
2007-02-26 00:09:19 +01:00
|
|
|
|
|
|
|
U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
|
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszText;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2007-02-26 00:09:19 +01:00
|
|
|
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));
|
2007-02-28 02:37:39 +01:00
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
2007-02-26 00:09:19 +01:00
|
|
|
|
|
|
|
if (pVarDesc->varkind == VAR_CONST)
|
|
|
|
{
|
|
|
|
VARIANT var;
|
|
|
|
VariantInit(&var);
|
2007-03-04 02:00:13 +01:00
|
|
|
if (VariantChangeType(&var, U(*pVarDesc).lpvarValue, 0, VT_BSTR) == S_OK)
|
2007-02-26 00:09:19 +01:00
|
|
|
{
|
2007-02-28 02:37:39 +01:00
|
|
|
AddToStrW(wszText, wszConst);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszText, L" ");
|
|
|
|
AddToStrW(wszAfter, L" = ");
|
2007-02-28 02:37:39 +01:00
|
|
|
AddToStrW(wszAfter, V_BSTR(&var));
|
2007-02-26 00:09:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-28 02:37:39 +01:00
|
|
|
CreateTypeInfo(wszText, wszAfter, pVarDesc->elemdescVar.tdesc, pTypeInfo);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszText, L" ");
|
2007-02-28 02:37:39 +01:00
|
|
|
AddToStrW(wszText, bstrName);
|
|
|
|
AddToStrW(wszText, wszAfter);
|
2011-06-14 13:41:45 +02:00
|
|
|
AddToTLDataStrW(tld, bstrName);
|
2007-02-28 02:37:39 +01:00
|
|
|
AddToTLDataStrW(tld, wszAfter);
|
2007-02-26 00:09:19 +01:00
|
|
|
if (i<cVars-1)
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L",");
|
|
|
|
AddToTLDataStrW(tld, L"\n");
|
2007-02-26 00:09:19 +01:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
|
2007-02-26 00:09:19 +01:00
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseVarDesc(pTypeInfo, pVarDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-09 21:25:49 +02:00
|
|
|
static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParent)
|
2006-07-10 12:07:51 +02:00
|
|
|
{
|
2008-04-09 21:50:16 +02:00
|
|
|
int i, j;
|
2008-04-09 21:25:49 +02:00
|
|
|
int cFuncs;
|
2006-08-20 12:44:49 +02:00
|
|
|
unsigned namesNo;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2006-07-10 12:07:51 +02:00
|
|
|
FUNCDESC *pFuncDesc;
|
2008-04-09 21:50:16 +02:00
|
|
|
BSTR bstrName, bstrHelpString, *bstrParamNames;
|
2006-08-20 12:44:49 +02:00
|
|
|
WCHAR wszText[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszAfter[MAX_LOAD_STRING];
|
2007-02-22 07:39:52 +01:00
|
|
|
WCHAR szRhs[] = {'r','h','s',0}; /* Right-hand side of a propput */
|
2006-08-20 12:44:49 +02:00
|
|
|
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;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-07-10 12:07:51 +02:00
|
|
|
tvis.hParent = hParent;
|
|
|
|
|
2008-04-09 21:25:49 +02:00
|
|
|
cFuncs = pTypeAttr->cFuncs;
|
|
|
|
|
2008-04-11 01:10:07 +02:00
|
|
|
i = 0;
|
|
|
|
if(pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL) { /* skip 7 members of IDispatch */
|
|
|
|
cFuncs += 7;
|
|
|
|
i += 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(; i<cFuncs; i++)
|
2006-07-10 12:07:51 +02:00
|
|
|
{
|
2007-01-26 15:48:42 +01:00
|
|
|
TYPELIB_DATA *tld;
|
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
if(FAILED(ITypeInfo_GetFuncDesc(pTypeInfo, i, &pFuncDesc))) continue;
|
2008-04-09 21:25:57 +02:00
|
|
|
|
2006-07-10 12:07:51 +02:00
|
|
|
if(FAILED(ITypeInfo_GetDocumentation(pTypeInfo, pFuncDesc->memid, &bstrName,
|
2008-04-09 21:50:16 +02:00
|
|
|
&bstrHelpString, NULL, NULL))) continue;
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2006-08-20 12:44:49 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
2006-07-10 12:07:51 +02:00
|
|
|
U(tvis).item.cchTextMax = SysStringLen(bstrName);
|
|
|
|
U(tvis).item.pszText = bstrName;
|
2007-01-26 15:48:42 +01:00
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = TRUE;
|
2008-04-11 01:10:07 +02:00
|
|
|
if(pFuncDesc->memid < MIN_FUNC_ID || pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL)
|
2006-08-21 22:21:09 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"[");
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = FALSE;
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszId);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(");
|
2006-08-21 22:21:09 +02:00
|
|
|
wsprintfW(wszText, wszFormat, pFuncDesc->memid);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszText);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L")");
|
2006-08-21 22:21:09 +02:00
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
}
|
2008-04-11 22:58:26 +02:00
|
|
|
|
2006-08-20 12:44:49 +02:00
|
|
|
CreateTypeInfo(wszText, wszAfter, pFuncDesc->elemdescFunc.tdesc, pTypeInfo);
|
|
|
|
switch(pFuncDesc->invkind)
|
|
|
|
{
|
|
|
|
case INVOKE_PROPERTYGET:
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(tld, L"[");
|
|
|
|
else AddToTLDataStrW(tld, L", ");
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = FALSE;
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszPropGet);
|
2006-08-20 12:44:49 +02:00
|
|
|
break;
|
|
|
|
case INVOKE_PROPERTYPUT:
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(tld, L"[");
|
|
|
|
else AddToTLDataStrW(tld, L", ");
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = FALSE;
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszPropPut);
|
2006-08-20 12:44:49 +02:00
|
|
|
break;
|
|
|
|
case INVOKE_PROPERTYPUTREF:
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(tld, L"[");
|
|
|
|
else AddToTLDataStrW(tld, L", ");
|
2006-08-21 22:21:09 +02:00
|
|
|
bFirst = FALSE;
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszPropPutRef);
|
2006-08-20 12:44:49 +02:00
|
|
|
break;
|
|
|
|
default:;
|
|
|
|
}
|
2008-04-11 22:58:26 +02:00
|
|
|
if(SysStringLen(bstrHelpString))
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(tld, L"[");
|
|
|
|
else AddToTLDataStrW(tld, L", ");
|
2008-04-11 22:58:26 +02:00
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(tld, wszHelpstring);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(\"");
|
2008-04-11 22:58:26 +02:00
|
|
|
AddToTLDataStrW(tld, bstrHelpString);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\")");
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
if(!bFirst) AddToTLDataStrW(tld, L"]\n");
|
2008-04-09 21:50:16 +02:00
|
|
|
|
2008-04-09 23:38:13 +02:00
|
|
|
if(pTypeAttr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION) {
|
2008-04-09 21:25:49 +02:00
|
|
|
AddToTLDataStrW(tld, wszVT_HRESULT);
|
2019-04-29 10:50:41 +02:00
|
|
|
if(lstrcmpW(wszText, wszVT_VOID)) pFuncDesc->cParams++;
|
2008-04-09 23:38:13 +02:00
|
|
|
}
|
2008-04-09 21:25:49 +02:00
|
|
|
else {
|
|
|
|
AddToTLDataStrW(tld, wszText);
|
|
|
|
AddToTLDataStrW(tld, wszAfter);
|
|
|
|
}
|
2008-04-09 23:38:13 +02:00
|
|
|
|
|
|
|
bstrParamNames = HeapAlloc(GetProcessHeap(), 0,
|
2015-12-29 18:36:55 +01:00
|
|
|
sizeof(BSTR)*(pFuncDesc->cParams+1));
|
2008-04-09 23:38:13 +02:00
|
|
|
if(FAILED(ITypeInfo_GetNames(pTypeInfo, pFuncDesc->memid, bstrParamNames,
|
|
|
|
pFuncDesc->cParams+1, &namesNo)))
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, bstrParamNames);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
SysFreeString(bstrParamNames[0]);
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L" ");
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pFuncDesc->memid >= MIN_FUNC_ID)
|
|
|
|
{
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszStdCall);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L" ");
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
2011-01-02 14:05:10 +01:00
|
|
|
if (bstrName) AddToTLDataStrW(tld, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(");
|
2006-08-20 12:44:49 +02:00
|
|
|
|
2007-02-22 07:39:52 +01:00
|
|
|
for(j=0; j<pFuncDesc->cParams; j++)
|
2006-08-20 12:44:49 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
if(j != 0) AddToTLDataStrW(tld, L",");
|
2007-02-22 07:39:52 +01:00
|
|
|
if(pFuncDesc->cParams != 1)
|
2006-08-20 13:57:21 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(tld, TAB_SIZE);
|
2006-08-20 13:57:21 +02:00
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
bFirst = TRUE;
|
|
|
|
#define ENUM_PARAM_FLAG(x)\
|
2006-10-23 13:55:49 +02:00
|
|
|
if(U(pFuncDesc->lprgelemdescParam[j]).paramdesc.wParamFlags & x) \
|
2006-08-20 12:44:49 +02:00
|
|
|
{\
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst)\
|
|
|
|
AddToTLDataStrW(tld, L"[");\
|
2006-08-20 12:44:49 +02:00
|
|
|
else\
|
|
|
|
{\
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L", ");\
|
2006-08-20 12:44:49 +02:00
|
|
|
}\
|
|
|
|
bFirst = FALSE;\
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wsz##x);\
|
2006-08-20 12:44:49 +02:00
|
|
|
}
|
|
|
|
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_FHASCUSTDATA);
|
|
|
|
|
2007-02-25 08:35:10 +01:00
|
|
|
if(U(pFuncDesc->lprgelemdescParam[j]).paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
|
|
|
|
{
|
|
|
|
VARIANT var, *param=&U(pFuncDesc->lprgelemdescParam[j]).paramdesc.pparamdescex->varDefaultValue;
|
|
|
|
VariantInit(&var);
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(tld, L"[");
|
|
|
|
else AddToTLDataStrW(tld, L", ");
|
2007-02-25 08:35:10 +01:00
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(tld, wszDefaultValue);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(");
|
2007-02-25 08:35:10 +01:00
|
|
|
if (V_VT(param) == VT_BSTR)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\"");
|
2008-07-08 09:52:43 +02:00
|
|
|
AddToTLDataStrW(tld, V_BSTR(param));
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\"");
|
2007-02-25 08:35:10 +01:00
|
|
|
} else if (VariantChangeType(&var, param, 0, VT_BSTR) == S_OK)
|
|
|
|
AddToTLDataStrW(tld, V_BSTR(&var));
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L")");
|
2007-02-25 08:35:10 +01:00
|
|
|
}
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
if(!bFirst) AddToTLDataStrW(tld, L"] ");
|
2006-08-20 12:44:49 +02:00
|
|
|
|
|
|
|
memset(wszText, 0, sizeof(wszText));
|
|
|
|
memset(wszAfter, 0, sizeof(wszAfter));
|
|
|
|
CreateTypeInfo(wszText, wszAfter, pFuncDesc->lprgelemdescParam[j].tdesc,
|
|
|
|
pTypeInfo);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszText);
|
|
|
|
AddToTLDataStrW(tld, wszAfter);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L" ");
|
2007-02-22 07:39:52 +01:00
|
|
|
if (j+1 < namesNo) {
|
2011-01-02 14:05:10 +01:00
|
|
|
if (bstrParamNames[j+1])
|
|
|
|
{
|
|
|
|
AddToTLDataStrW(tld, bstrParamNames[j+1]);
|
|
|
|
SysFreeString(bstrParamNames[j+1]);
|
|
|
|
}
|
2007-02-22 07:39:52 +01:00
|
|
|
} else {
|
|
|
|
AddToTLDataStrW(tld, szRhs);
|
|
|
|
}
|
2006-08-20 12:44:49 +02:00
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L");\n");
|
2006-07-10 12:07:51 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_INSERTITEMW, 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);
|
2008-04-09 21:50:16 +02:00
|
|
|
SysFreeString(bstrHelpString);
|
2006-07-10 12:07:51 +02:00
|
|
|
ITypeInfo_ReleaseFuncDesc(pTypeInfo, pFuncDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static int EnumImplTypes(ITypeInfo *pTypeInfo, int cImplTypes, HTREEITEM hParent)
|
2006-07-10 12:07:51 +02:00
|
|
|
{
|
|
|
|
int i;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2006-07-10 12:07:51 +02:00
|
|
|
ITypeInfo *pRefTypeInfo;
|
|
|
|
HREFTYPE hRefType;
|
|
|
|
TYPEATTR *pTypeAttr;
|
|
|
|
BSTR bstrName;
|
|
|
|
WCHAR wszInheritedInterfaces[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
if(!cImplTypes) return 0;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_INHERITINTERFACES, wszInheritedInterfaces,
|
2018-07-09 20:59:15 +02:00
|
|
|
ARRAY_SIZE(wszInheritedInterfaces));
|
2006-07-10 12:07:51 +02:00
|
|
|
|
|
|
|
U(tvis).item.mask = TVIF_TEXT;
|
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszInheritedInterfaces;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-07-10 12:07:51 +02:00
|
|
|
tvis.hParent = hParent;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2006-07-10 12:07:51 +02:00
|
|
|
|
|
|
|
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,
|
2008-04-11 01:11:03 +02:00
|
|
|
NULL, NULL, NULL)))
|
|
|
|
{
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(FAILED(ITypeInfo_GetTypeAttr(pRefTypeInfo, &pTypeAttr)))
|
|
|
|
{
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
continue;
|
|
|
|
}
|
2006-07-10 12:07:51 +02:00
|
|
|
|
|
|
|
U(tvis).item.cchTextMax = SysStringLen(bstrName);
|
|
|
|
U(tvis).item.pszText = bstrName;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2006-07-10 12:07:51 +02:00
|
|
|
EnumVars(pRefTypeInfo, pTypeAttr->cVars, hParent);
|
2008-04-09 21:25:49 +02:00
|
|
|
EnumFuncs(pRefTypeInfo, pTypeAttr, hParent);
|
2006-07-10 12:07:51 +02:00
|
|
|
EnumImplTypes(pRefTypeInfo, pTypeAttr->cImplTypes, hParent);
|
|
|
|
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseTypeAttr(pRefTypeInfo, pTypeAttr);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-11 01:10:27 +02:00
|
|
|
static void EnumCoclassImplTypes(ITypeInfo *pTypeInfo,
|
|
|
|
int cImplTypes, TYPELIB_DATA *pTLData)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
ITypeInfo *pRefTypeInfo;
|
|
|
|
HREFTYPE hRefType;
|
|
|
|
TYPEATTR *pTypeAttr;
|
|
|
|
BSTR bstrName;
|
|
|
|
BOOL bFirst;
|
|
|
|
INT flags;
|
|
|
|
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 wszIMPLTYPEFLAG_FDEFAULT[]
|
|
|
|
= { 'd','e','f','a','u','l','t','\0' };
|
|
|
|
const WCHAR wszIMPLTYPEFLAG_FSOURCE[]
|
|
|
|
= { 's','o','u','r','c','e','\0' };
|
|
|
|
const WCHAR wszIMPLTYPEFLAG_FRESTRICTED[]
|
|
|
|
= { 'r','e','s','t','r','i','c','t','e','d','\0' };
|
|
|
|
|
|
|
|
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)))
|
|
|
|
{
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(FAILED(ITypeInfo_GetTypeAttr(pRefTypeInfo, &pTypeAttr)))
|
|
|
|
{
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
2008-04-11 01:10:27 +02:00
|
|
|
ITypeInfo_GetImplTypeFlags(pTypeInfo, i, &flags);
|
|
|
|
bFirst = TRUE;
|
|
|
|
#define ENUM_IMPLTYPEFLAG(x)\
|
|
|
|
if(flags & x) \
|
|
|
|
{\
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst)\
|
|
|
|
AddToTLDataStrW(pTLData, L"[");\
|
2008-04-11 01:10:27 +02:00
|
|
|
else\
|
|
|
|
{\
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L", ");\
|
2008-04-11 01:10:27 +02:00
|
|
|
}\
|
|
|
|
bFirst = FALSE;\
|
|
|
|
AddToTLDataStrW(pTLData, wsz##x);\
|
|
|
|
}
|
|
|
|
ENUM_IMPLTYPEFLAG(IMPLTYPEFLAG_FDEFAULT);
|
|
|
|
ENUM_IMPLTYPEFLAG(IMPLTYPEFLAG_FSOURCE);
|
|
|
|
ENUM_IMPLTYPEFLAG(IMPLTYPEFLAG_FRESTRICTED);
|
|
|
|
if(!bFirst)
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"] ");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
2008-04-11 22:57:17 +02:00
|
|
|
if(pTypeAttr->typekind == TKIND_INTERFACE ||
|
|
|
|
(pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL))
|
2008-04-11 01:10:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszTKIND_INTERFACE);
|
|
|
|
else if(pTypeAttr->typekind == TKIND_DISPATCH)
|
|
|
|
AddToTLDataStrW(pTLData, wszTKIND_DISPATCH);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L" ");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
|
|
|
AddToTLDataStrW(pTLData, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L";\n");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_ReleaseTypeAttr(pRefTypeInfo, pTypeAttr);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void AddIdlData(HTREEITEM hCur, TYPELIB_DATA *pTLData)
|
2006-08-20 18:48:29 +02:00
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-08-20 18:48:29 +02:00
|
|
|
|
2010-05-07 10:45:29 +02:00
|
|
|
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)hCur);
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-08-20 18:48:29 +02:00
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
|
|
|
|
while(hCur)
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2008-04-09 21:25:36 +02:00
|
|
|
if(!((TYPELIB_DATA*)(tvi.lParam))->bHide) {
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\n");
|
2008-04-09 21:25:36 +02:00
|
|
|
AddToTLDataStrWithTabsW(pTLData, ((TYPELIB_DATA*)(tvi.lParam))->idl);
|
|
|
|
}
|
2010-05-07 10:45:29 +02:00
|
|
|
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_NEXT, (LPARAM)hCur);
|
2006-08-20 18:48:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void AddPredefinitions(HTREEITEM hFirst, TYPELIB_DATA *pTLData)
|
2006-08-20 18:48:29 +02:00
|
|
|
{
|
|
|
|
HTREEITEM hCur;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-08-20 18:48:29 +02:00
|
|
|
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' };
|
|
|
|
|
2010-05-07 10:45:29 +02:00
|
|
|
hFirst = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)hFirst);
|
2006-08-20 18:48:29 +02:00
|
|
|
|
|
|
|
AddToTLDataStrWithTabsW(pTLData, wszPredefinition);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\n");
|
2006-08-20 18:48:29 +02:00
|
|
|
|
|
|
|
hCur = hFirst;
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-08-20 18:48:29 +02:00
|
|
|
tvi.mask = TVIF_TEXT|TVIF_PARAM;
|
|
|
|
tvi.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
tvi.pszText = wszText;
|
|
|
|
while(hCur)
|
|
|
|
{
|
|
|
|
tvi.hItem = hCur;
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2008-04-09 21:25:36 +02:00
|
|
|
if(((TYPELIB_DATA*)(tvi.lParam))->bPredefine &&
|
|
|
|
!((TYPELIB_DATA*)(tvi.lParam))->bHide)
|
2006-08-20 18:48:29 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszText, L";");
|
2006-08-20 18:48:29 +02:00
|
|
|
AddToTLDataStrWithTabsW(pTLData, wszText);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\n");
|
2006-08-20 18:48:29 +02:00
|
|
|
}
|
2010-05-07 10:45:29 +02:00
|
|
|
hCur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_NEXT, (LPARAM)hCur);
|
2006-08-20 18:48:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void CreateInterfaceInfo(ITypeInfo *pTypeInfo, int cImplTypes, WCHAR *wszName,
|
2010-05-11 21:28:07 +02:00
|
|
|
WCHAR *wszHelpString, ULONG ulHelpContext, TYPEATTR *pTypeAttr,
|
2006-08-12 19:44:02 +02:00
|
|
|
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-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' };
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"[\n");
|
2006-08-21 22:21:09 +02:00
|
|
|
if(pTypeAttr->typekind != TKIND_DISPATCH)
|
|
|
|
{
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
2006-08-21 22:21:09 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszOdl);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszUUID);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(");
|
2006-07-21 21:11:27 +02:00
|
|
|
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
|
|
|
|
wszGuid[lstrlenW(wszGuid)-1] = '\0';
|
|
|
|
AddToTLDataStrW(pTLData, &wszGuid[1]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L")");
|
2006-07-21 21:11:27 +02:00
|
|
|
if(wszHelpString)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszHelpstring);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(\"");
|
2006-07-21 21:11:27 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszHelpString);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\")");
|
2006-07-21 21:11:27 +02:00
|
|
|
}
|
2006-08-12 19:44:02 +02:00
|
|
|
if(ulHelpContext)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
2006-08-12 19:44:02 +02:00
|
|
|
AddToTLDataStrW(pTLData, wszHelpcontext);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(");
|
2006-08-12 19:44:02 +02:00
|
|
|
wsprintfW(wszHelpContext, wszFormat, ulHelpContext);
|
|
|
|
AddToTLDataStrW(pTLData, wszHelpContext);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L")");
|
2006-08-12 19:44:02 +02:00
|
|
|
}
|
2006-07-21 21:11:27 +02:00
|
|
|
if(pTypeAttr->wTypeFlags)
|
|
|
|
{
|
2009-09-15 22:37:32 +02:00
|
|
|
#define ENUM_FLAGS(x) if(pTypeAttr->wTypeFlags & x)\
|
2006-07-21 21:11:27 +02:00
|
|
|
{\
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");\
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);\
|
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);
|
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\n]\n");
|
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);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L" ");
|
2006-08-21 22:21:09 +02:00
|
|
|
if(cImplTypes && pTypeAttr->typekind != TKIND_DISPATCH)
|
2006-07-21 21:11:27 +02:00
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L": ");
|
2006-07-21 21:11:27 +02:00
|
|
|
|
|
|
|
ITypeInfo_GetRefTypeOfImplType(pTypeInfo, 0, &hRefType);
|
2007-10-05 01:17:48 +02:00
|
|
|
if (SUCCEEDED(ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo)))
|
|
|
|
{
|
|
|
|
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
|
2006-07-21 21:11:27 +02:00
|
|
|
NULL, NULL, NULL);
|
2007-10-05 01:17:48 +02:00
|
|
|
AddToTLDataStrW(pTLData, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L" ");
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2007-10-05 01:17:48 +02:00
|
|
|
SysFreeString(bstrName);
|
|
|
|
ITypeInfo_Release(pRefTypeInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
AddToTLDataStrW(pTLData, wszFailed);
|
2006-07-21 21:11:27 +02:00
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"{\n");
|
2006-07-21 21:11:27 +02:00
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(pTLData->wszInsertAfter, L"};\n");
|
2006-07-21 21:11:27 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void CreateTypedefHeader(ITypeInfo *pTypeInfo,
|
2006-08-21 11:36:35 +02:00
|
|
|
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)))
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"[");
|
2006-08-21 11:36:35 +02:00
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(pTLData, wszUUID);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(");
|
2006-08-21 11:36:35 +02:00
|
|
|
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
|
|
|
|
wszGuid[lstrlenW(wszGuid)-1] = '\0';
|
|
|
|
AddToTLDataStrW(pTLData, &wszGuid[1]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L")");
|
2006-08-21 11:36:35 +02:00
|
|
|
}
|
|
|
|
if(pTypeAttr->typekind == TKIND_ALIAS)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
if(bFirst) AddToTLDataStrW(pTLData, L"[");
|
|
|
|
else AddToTLDataStrW(pTLData, L", ");
|
2006-08-21 11:36:35 +02:00
|
|
|
bFirst = FALSE;
|
|
|
|
AddToTLDataStrW(pTLData, wszPublic);
|
|
|
|
}
|
2020-11-17 00:55:19 +01:00
|
|
|
if(!bFirst) AddToTLDataStrW(pTLData, L"]\n");
|
2006-08-21 11:36:35 +02:00
|
|
|
}
|
|
|
|
|
2008-04-11 01:10:27 +02:00
|
|
|
static void CreateCoclassHeader(ITypeInfo *pTypeInfo,
|
|
|
|
TYPEATTR *pTypeAttr, TYPELIB_DATA *pTLData)
|
|
|
|
{
|
2008-04-11 01:11:45 +02:00
|
|
|
WCHAR wszGuid[MAX_LOAD_STRING];
|
|
|
|
BSTR bstrHelpString;
|
|
|
|
const WCHAR wszNoncreatable[]
|
|
|
|
= { 'n','o','n','c','r','e','a','t','a','b','l','e','\0' };
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"[\n");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
|
|
|
AddToTLDataStrW(pTLData, wszUUID);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(");
|
2008-04-11 01:11:45 +02:00
|
|
|
StringFromGUID2(&(pTypeAttr->guid), wszGuid, MAX_LOAD_STRING);
|
|
|
|
wszGuid[lstrlenW(wszGuid)-1] = '\0';
|
|
|
|
AddToTLDataStrW(pTLData, &wszGuid[1]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L")");
|
2008-04-11 01:11:45 +02:00
|
|
|
|
|
|
|
if(SUCCEEDED(ITypeInfo_GetDocumentation(pTypeInfo, MEMBERID_NIL, NULL,
|
|
|
|
&bstrHelpString, NULL, NULL)))
|
|
|
|
{
|
|
|
|
if(SysStringLen(bstrHelpString))
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
|
|
|
AddToTLDataStrW(pTLData, wszHelpstring);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"(\"");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddToTLDataStrW(pTLData, bstrHelpString);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\")");
|
2008-04-11 01:11:45 +02:00
|
|
|
}
|
|
|
|
SysFreeString(bstrHelpString);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(pTypeAttr->wTypeFlags & TYPEFLAG_FCANCREATE))
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L",\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(pTLData, TAB_SIZE);
|
|
|
|
AddToTLDataStrW(pTLData, wszNoncreatable);
|
|
|
|
}
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(pTLData, L"\n]\n");
|
2008-04-11 01:10:27 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static int PopulateTree(void)
|
2006-06-30 17:29:56 +02:00
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
|
|
|
TVITEMW 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;
|
2007-01-26 15:48:42 +01:00
|
|
|
TYPELIB_DATA *tld;
|
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 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;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-06-30 17:29:56 +02:00
|
|
|
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];
|
2011-11-19 15:11:54 +01:00
|
|
|
DWORD_PTR args[2];
|
2006-07-02 13:03:09 +02:00
|
|
|
|
2018-07-09 20:59:15 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_ERROR_LOADTYPELIB, wszError, ARRAY_SIZE(wszError));
|
2011-11-19 15:11:54 +01:00
|
|
|
args[0] = (DWORD_PTR)typelib.wszFileName;
|
|
|
|
args[1] = hRes;
|
|
|
|
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
2018-07-09 20:59:15 +02:00
|
|
|
wszError, 0, 0, wszMessage, ARRAY_SIZE(wszMessage), (__ms_va_list*)args);
|
2010-05-07 10:46:02 +02:00
|
|
|
MessageBoxW(globals.hMainWnd, wszMessage, NULL, MB_OK|MB_ICONEXCLAMATION);
|
2006-07-02 13:03:09 +02:00
|
|
|
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);
|
2007-01-26 15:48:42 +01:00
|
|
|
|
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
|
|
|
AddToTLDataStrW(tld, wszGeneratedInfo);
|
|
|
|
AddToTLDataStrW(tld, typelib.wszFileName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\n\n[\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(tld, TAB_SIZE);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszUUID);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(");
|
2006-07-18 12:53:19 +02:00
|
|
|
StringFromGUID2(&(pTLibAttr->guid), wszText, MAX_LOAD_STRING);
|
|
|
|
wszText[lstrlenW(wszText)-1] = '\0';
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, &wszText[1]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"),\n");
|
2008-04-11 01:11:45 +02:00
|
|
|
AddSpaces(tld, TAB_SIZE);
|
2006-07-18 12:53:19 +02:00
|
|
|
wsprintfW(wszText, wszFormat2, pTLibAttr->wMajorVerNum, pTLibAttr->wMinorVerNum);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszText);
|
2010-12-31 13:46:50 +01:00
|
|
|
|
|
|
|
if (bstrData)
|
|
|
|
{
|
|
|
|
/* helpstring is optional */
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L",\n");
|
2010-12-31 13:46:50 +01:00
|
|
|
AddSpaces(tld, TAB_SIZE);
|
|
|
|
AddToTLDataStrW(tld, wszHelpstring);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"(\"");
|
2010-12-31 13:46:50 +01:00
|
|
|
AddToTLDataStrW(tld, bstrData);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\")");
|
2010-12-31 13:46:50 +01:00
|
|
|
}
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\n]\n");
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszLibrary);
|
2010-12-31 13:46:50 +01:00
|
|
|
if (bstrName) AddToTLDataStrW(tld, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"\n{\n");
|
2007-01-26 15:48:42 +01:00
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, L"};");
|
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);
|
2010-05-07 10:46:02 +02:00
|
|
|
tvis.hParent = (HTREEITEM)SendMessageW(typelib.hTree,
|
|
|
|
TVM_INSERTITEMW, 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));
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM)tld;
|
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
|
|
|
|
2007-01-26 15:48:42 +01:00
|
|
|
CreateTypedefHeader(pTypeInfo, pTypeAttr, tld);
|
|
|
|
AddToTLDataStrW(tld, &wszTKIND_ENUM[lstrlenW(wszTKIND_ALIAS)]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L"{\n");
|
|
|
|
AddToStrW(tld->wszInsertAfter, L"} ");
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, L";\n");
|
2007-02-26 00:09:19 +01:00
|
|
|
|
|
|
|
bInsert = FALSE;
|
2010-05-07 10:46:02 +02:00
|
|
|
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2007-02-26 00:09:19 +01:00
|
|
|
EnumEnums(pTypeInfo, pTypeAttr->cVars, hParent);
|
|
|
|
AddChildrenData(hParent, tld);
|
|
|
|
AddToTLDataStrW(tld, tld->wszInsertAfter);
|
2006-07-18 12:54:30 +02:00
|
|
|
break;
|
|
|
|
case TKIND_RECORD:
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToTLDataStrW(tld, wszTKIND_RECORD);
|
|
|
|
AddToTLDataStrW(tld, wszTag);
|
|
|
|
AddToTLDataStrW(tld, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L" {\n");
|
2007-01-26 15:48:42 +01:00
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, L"} ");
|
2007-01-26 15:48:42 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, L";\n");
|
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,
|
2007-01-26 15:48:42 +01:00
|
|
|
bstrData, ulHelpContext, pTypeAttr, tld);
|
|
|
|
tld->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);
|
2008-04-11 01:10:27 +02:00
|
|
|
|
|
|
|
CreateCoclassHeader(pTypeInfo, pTypeAttr, tld);
|
|
|
|
AddToTLDataStrW(tld, wszTKIND_COCLASS);
|
|
|
|
AddToTLDataStrW(tld, bstrName);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L" {\n");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
|
|
|
EnumCoclassImplTypes(pTypeInfo, pTypeAttr->cImplTypes, tld);
|
|
|
|
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(tld->wszInsertAfter, L"};\n");
|
2008-04-11 01:10:27 +02:00
|
|
|
|
|
|
|
bInsert = FALSE;
|
2010-05-07 10:46:02 +02:00
|
|
|
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2008-04-11 01:10:27 +02:00
|
|
|
AddToTLDataStrW(tld, tld->wszInsertAfter);
|
2006-07-18 12:54:30 +02:00
|
|
|
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,
|
2007-01-26 15:48:42 +01:00
|
|
|
bstrData, ulHelpContext, pTypeAttr, tld);
|
|
|
|
tld->bPredefine = TRUE;
|
2008-04-09 21:25:36 +02:00
|
|
|
if(pTypeAttr->wTypeFlags & TYPEFLAG_FDUAL)
|
|
|
|
tld->bHide = TRUE;
|
2006-07-02 19:44:39 +02:00
|
|
|
AddToStrW(wszText, wszTKIND_DISPATCH);
|
|
|
|
AddToStrW(wszText, bstrName);
|
2006-08-21 22:21:09 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2006-08-21 22:21:09 +02:00
|
|
|
hMain = tvis.hParent;
|
2007-01-26 15:48:42 +01:00
|
|
|
tldDispatch = tld;
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
lstrcpyW(wszText, wszProperties);
|
|
|
|
tvis.hParent = hParent;
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
|
|
|
AddToTLDataStrW(tld, wszProperties);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L":\n");
|
2010-05-07 10:46:02 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2006-08-21 22:21:09 +02:00
|
|
|
EnumVars(pTypeInfo, pTypeAttr->cVars, tvis.hParent);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddChildrenData(tvis.hParent, tld);
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
lstrcpyW(wszText, wszMethods);
|
|
|
|
tvis.hParent = hParent;
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
|
|
|
AddToTLDataStrW(tld, wszMethods);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L":\n");
|
2010-05-07 10:46:02 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2008-04-09 21:25:49 +02:00
|
|
|
EnumFuncs(pTypeInfo, pTypeAttr, tvis.hParent);
|
2007-01-26 15:48:42 +01:00
|
|
|
AddChildrenData(tvis.hParent, tld);
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
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));
|
2007-01-26 15:48:42 +01:00
|
|
|
tld = InitializeTLData();
|
|
|
|
U(tvis).item.lParam = (LPARAM) tld;
|
2006-08-21 22:21:09 +02:00
|
|
|
|
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,
|
2007-01-26 15:48:42 +01:00
|
|
|
bstrData, ulHelpContext, pTypeAttr, tld);
|
|
|
|
tld->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);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToStrW(wszText, L" ");
|
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
|
|
|
|
2007-01-26 15:48:42 +01:00
|
|
|
CreateTypedefHeader(pTypeInfo, pTypeAttr, tld);
|
|
|
|
AddToTLDataStrW(tld, &wszText[lstrlenW(wszTKIND_ALIAS)]);
|
2020-11-17 00:55:19 +01:00
|
|
|
AddToTLDataStrW(tld, L";\n");
|
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)
|
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
hParent = TreeView_InsertItemW(typelib.hTree, &tvis);
|
2006-08-21 22:21:09 +02:00
|
|
|
|
|
|
|
EnumVars(pTypeInfo, pTypeAttr->cVars, hParent);
|
2008-04-09 21:25:49 +02:00
|
|
|
EnumFuncs(pTypeInfo, pTypeAttr, hParent);
|
2006-08-21 22:21:09 +02:00
|
|
|
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)))
|
2007-01-26 15:48:42 +01:00
|
|
|
AddChildrenData(hParent, tld);
|
|
|
|
AddToTLDataStrW(tld, tld->wszInsertAfter);
|
2006-08-21 22:21:09 +02:00
|
|
|
}
|
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
|
|
|
}
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)tvis.hParent);
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-08-20 18:48:29 +02:00
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
tvi.hItem = tvis.hParent;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-08-20 18:48:29 +02:00
|
|
|
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)
|
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-07-18 12:53:19 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-07-18 12:53:19 +02:00
|
|
|
tvi.mask = TVIF_PARAM;
|
|
|
|
tvi.hItem = item;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-07-18 12:54:30 +02:00
|
|
|
if(!tvi.lParam)
|
|
|
|
{
|
2020-11-17 00:55:19 +01:00
|
|
|
SetWindowTextW(typelib.hEdit, L" ");
|
2006-07-18 12:54:30 +02:00
|
|
|
return;
|
|
|
|
}
|
2006-07-18 12:53:19 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SetWindowTextW(typelib.hEdit, ((TYPELIB_DATA*)tvi.lParam)->idl);
|
2006-07-18 12:53:19 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void TypeLibResizeChild(void)
|
2006-06-30 18:42:14 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void TypeLibMenuCommand(WPARAM wParam, HWND hWnd)
|
2006-06-30 18:43:40 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void UpdateTypeLibStatusBar(int itemID)
|
2006-06-30 18:42:14 +02:00
|
|
|
{
|
|
|
|
WCHAR info[MAX_LOAD_STRING];
|
|
|
|
|
2018-07-09 20:59:15 +02:00
|
|
|
if(!LoadStringW(globals.hMainInst, itemID, info, ARRAY_SIZE(info)))
|
|
|
|
LoadStringW(globals.hMainInst, IDS_READY, info, ARRAY_SIZE(info));
|
2006-06-30 18:42:14 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hStatusBar, SB_SETTEXTW, 0, (LPARAM)info);
|
2006-06-30 18:42:14 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void EmptyTLTree(void)
|
2006-07-18 12:55:31 +02:00
|
|
|
{
|
|
|
|
HTREEITEM cur, del;
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-07-18 12:55:31 +02:00
|
|
|
|
|
|
|
tvi.mask = TVIF_PARAM;
|
2010-05-07 10:45:29 +02:00
|
|
|
cur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)TVI_ROOT);
|
2006-07-18 12:55:31 +02:00
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
{
|
|
|
|
del = cur;
|
2010-05-07 10:45:29 +02:00
|
|
|
cur = (HTREEITEM)SendMessageW(typelib.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CHILD, (LPARAM)del);
|
2006-07-18 12:55:31 +02:00
|
|
|
|
2010-05-07 10:45:29 +02:00
|
|
|
if(!cur) cur = (HTREEITEM)SendMessageW(typelib.hTree,
|
|
|
|
TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)del);
|
|
|
|
if(!cur) cur = (HTREEITEM)SendMessageW(typelib.hTree,
|
|
|
|
TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)del);
|
2006-07-18 12:55:31 +02:00
|
|
|
|
|
|
|
tvi.hItem = del;
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-07-18 12:55:31 +02:00
|
|
|
if(tvi.lParam)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, ((TYPELIB_DATA *)tvi.lParam)->idl);
|
|
|
|
HeapFree(GetProcessHeap(), 0, (TYPELIB_DATA *)tvi.lParam);
|
|
|
|
}
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(typelib.hTree, TVM_DELETEITEM, 0, (LPARAM)del);
|
2006-07-18 12:55:31 +02:00
|
|
|
|
|
|
|
if(!cur) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-07 12:23:42 +01:00
|
|
|
static LRESULT CALLBACK TypeLibProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2006-06-30 17:29:56 +02:00
|
|
|
{
|
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
|
|
|
{
|
|
|
|
if(!CreatePanedWindow(hWnd, &typelib.hPaneWnd, globals.hMainInst))
|
|
|
|
DestroyWindow(hWnd);
|
2010-05-07 10:46:02 +02:00
|
|
|
typelib.hTree = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, NULL,
|
2006-06-30 17:29:56 +02:00
|
|
|
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);
|
2010-05-07 10:46:02 +02:00
|
|
|
typelib.hEdit = CreateWindowExW(WS_EX_CLIENTEDGE, WC_EDITW, NULL,
|
2006-06-30 17:29:56 +02:00
|
|
|
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);
|
2018-09-16 14:44:44 +02:00
|
|
|
break;
|
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:
|
2010-05-07 10:46:02 +02:00
|
|
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
2006-06-30 17:29:56 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
BOOL TypeLibRegisterClassW(void)
|
2006-06-30 17:29:56 +02:00
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
WNDCLASSW wcc;
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&wcc, 0, sizeof(WNDCLASSW));
|
2006-06-30 17:29:56 +02:00
|
|
|
wcc.lpfnWndProc = TypeLibProc;
|
|
|
|
wcc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
2015-10-07 12:27:30 +02:00
|
|
|
wcc.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
2010-05-07 10:46:02 +02:00
|
|
|
wcc.lpszMenuName = MAKEINTRESOURCEW(IDM_TYPELIB);
|
2006-06-30 17:29:56 +02:00
|
|
|
wcc.lpszClassName = wszTypeLib;
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
if(!RegisterClassW(&wcc))
|
2006-06-30 17:29:56 +02:00
|
|
|
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];
|
2018-07-09 20:59:15 +02:00
|
|
|
LoadStringW(hInst, IDS_TYPELIBTITLE, wszTitle, ARRAY_SIZE(wszTitle));
|
2006-06-30 17:29:56 +02:00
|
|
|
|
2006-07-02 13:04:26 +02:00
|
|
|
if(wszFileName) lstrcpyW(typelib.wszFileName, wszFileName);
|
|
|
|
else
|
|
|
|
{
|
2010-05-07 10:46:02 +02:00
|
|
|
TVITEMW tvi;
|
2006-07-02 13:04:26 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2010-05-07 10:45:29 +02:00
|
|
|
tvi.hItem = (HTREEITEM)SendMessageW(globals.hTree, TVM_GETNEXTITEM,
|
|
|
|
TVGN_CARET, 0);
|
2006-07-02 13:04:26 +02:00
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
SendMessageW(globals.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-07-02 13:04:26 +02:00
|
|
|
lstrcpyW(typelib.wszFileName, ((ITEM_INFO*)tvi.lParam)->path);
|
|
|
|
}
|
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
globals.hTypeLibWnd = CreateWindowW(wszTypeLib, wszTitle,
|
2006-06-30 17:29:56 +02:00
|
|
|
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
|
|
|
|
2010-05-07 10:46:02 +02:00
|
|
|
typelib.hStatusBar = CreateStatusWindowW(WS_VISIBLE|WS_CHILD,
|
2009-01-20 11:21:34 +01:00
|
|
|
wszTitle, globals.hTypeLibWnd, 0);
|
2006-06-30 18:42:14 +02:00
|
|
|
|
|
|
|
TypeLibResizeChild();
|
2006-06-30 17:29:56 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|