2006-06-14 19:55:46 +02:00
|
|
|
/*
|
|
|
|
* OleView (details.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
|
2007-05-04 12:08:15 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-06-14 19:55:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
DETAILS details;
|
2006-06-14 19:58:35 +02:00
|
|
|
static const WCHAR wszAppID[] = { 'A','p','p','I','D','\0' };
|
|
|
|
static const WCHAR wszCLSID[] = { 'C','L','S','I','D','\0' };
|
|
|
|
static const WCHAR wszProgID[] = { 'P','r','o','g','I','D','\0' };
|
|
|
|
static const WCHAR wszProxyStubClsid32[] =
|
|
|
|
{ 'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2','\0' };
|
|
|
|
static const WCHAR wszTypeLib[] = { 'T','y','p','e','L','i','b','\0' };
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void CreateRegRec(HKEY hKey, HTREEITEM parent, WCHAR *wszKeyName, BOOL addings)
|
2006-06-14 19:58:35 +02:00
|
|
|
{
|
|
|
|
int i=0, j, retEnum;
|
|
|
|
HKEY hCurKey;
|
|
|
|
DWORD lenName, lenData, valType;
|
|
|
|
WCHAR wszName[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszData[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszTree[MAX_LOAD_STRING];
|
|
|
|
const WCHAR wszBinary[] = { '%','0','2','X',' ','\0' };
|
|
|
|
const WCHAR wszDots[] = { '.','.','.','\0' };
|
|
|
|
const WCHAR wszFormat1[] = { '%','s',' ','[','%','s',']',' ','=',' ','%','s','\0' };
|
|
|
|
const WCHAR wszFormat2[] = { '%','s',' ','=',' ','%','s','\0' };
|
2010-05-07 10:46:25 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2006-06-14 19:58:35 +02:00
|
|
|
HTREEITEM addPlace = parent;
|
|
|
|
|
2006-06-24 13:19:12 +02:00
|
|
|
U(tvis).item.mask = TVIF_TEXT;
|
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszTree;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-06-14 19:58:35 +02:00
|
|
|
tvis.hParent = parent;
|
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
{
|
2016-03-07 21:02:24 +01:00
|
|
|
lenName = sizeof(wszName)/sizeof(WCHAR);
|
|
|
|
lenData = sizeof(wszData);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
retEnum = RegEnumValueW(hKey, i, wszName, &lenName,
|
2006-06-14 19:58:35 +02:00
|
|
|
NULL, &valType, (LPBYTE)wszData, &lenData);
|
|
|
|
|
|
|
|
if(retEnum != ERROR_SUCCESS)
|
|
|
|
{
|
2006-06-22 11:43:02 +02:00
|
|
|
if(!i && lstrlenW(wszKeyName) > 1)
|
2006-06-14 19:58:35 +02:00
|
|
|
{
|
2009-01-20 11:21:34 +01:00
|
|
|
U(tvis).item.pszText = wszKeyName;
|
2010-05-07 10:46:25 +02:00
|
|
|
addPlace = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-24 13:19:12 +02:00
|
|
|
U(tvis).item.pszText = wszTree;
|
2006-06-14 19:58:35 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(valType == REG_BINARY)
|
|
|
|
{
|
|
|
|
WCHAR wszBuf[MAX_LOAD_STRING];
|
|
|
|
|
|
|
|
for(j=0; j<MAX_LOAD_STRING/3-1; j++)
|
|
|
|
wsprintfW(&wszBuf[3*j], wszBinary, (int)((unsigned char)wszData[j]));
|
|
|
|
wszBuf[(lenData*3>=MAX_LOAD_STRING ? MAX_LOAD_STRING-1 : lenData*3)] = '\0';
|
2006-06-22 11:43:02 +02:00
|
|
|
lstrcpyW(wszData, wszBuf);
|
|
|
|
lstrcpyW(&wszData[MAX_LOAD_STRING-5], wszDots);
|
2006-06-14 19:58:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(lenName) wsprintfW(wszTree, wszFormat1, wszKeyName, wszName, wszData);
|
|
|
|
else wsprintfW(wszTree, wszFormat2, wszKeyName, wszData);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
addPlace = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
if(addings && !memcmp(wszName, wszAppID, sizeof(WCHAR[6])))
|
|
|
|
{
|
2006-06-22 11:43:02 +02:00
|
|
|
lstrcpyW(wszTree, wszName);
|
2006-06-14 19:58:35 +02:00
|
|
|
memmove(&wszData[6], wszData, sizeof(WCHAR[MAX_LOAD_STRING-6]));
|
2006-06-22 11:43:02 +02:00
|
|
|
lstrcpyW(wszData, wszCLSID);
|
2006-06-14 19:58:35 +02:00
|
|
|
wszData[5] = '\\';
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey) != ERROR_SUCCESS)
|
2006-06-14 19:58:35 +02:00
|
|
|
{
|
|
|
|
i++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
tvis.hParent = TVI_ROOT;
|
2010-05-07 10:46:25 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2016-03-07 21:02:24 +01:00
|
|
|
lenName = sizeof(wszName);
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszName, (LONG *)&lenName);
|
2006-06-14 19:58:35 +02:00
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
|
|
|
wsprintfW(wszTree, wszFormat2, &wszData[6], wszName);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_INSERTITEMW, 0, (LPARAM)&tvis);
|
|
|
|
SendMessageW(details.hReg, TVM_EXPAND, TVE_EXPAND, (LPARAM)tvis.hParent);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
tvis.hParent = parent;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
i=-1;
|
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
|
2016-03-07 21:02:24 +01:00
|
|
|
if(RegEnumKeyW(hKey, i, wszName, sizeof(wszName)/sizeof(WCHAR)) != ERROR_SUCCESS) break;
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegOpenKeyW(hKey, wszName, &hCurKey) != ERROR_SUCCESS) continue;
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
CreateRegRec(hCurKey, addPlace, wszName, addings);
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_EXPAND, TVE_EXPAND, (LPARAM)addPlace);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
if(addings && !memcmp(wszName, wszProgID, sizeof(WCHAR[7])))
|
|
|
|
{
|
2016-03-07 21:02:24 +01:00
|
|
|
lenData = sizeof(wszData);
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszData, (LONG *)&lenData);
|
2006-06-14 19:58:35 +02:00
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey) != ERROR_SUCCESS)
|
2006-06-14 19:58:35 +02:00
|
|
|
continue;
|
|
|
|
CreateRegRec(hCurKey, TVI_ROOT, wszData, FALSE);
|
|
|
|
}
|
|
|
|
else if(addings && !memcmp(wszName, wszProxyStubClsid32, sizeof(WCHAR[17])))
|
|
|
|
{
|
2017-01-30 23:11:08 +01:00
|
|
|
lenData = sizeof(wszData);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszData, (LONG *)&lenData);
|
2006-06-14 19:58:35 +02:00
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
RegOpenKeyW(HKEY_CLASSES_ROOT, wszCLSID, &hCurKey);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2016-03-07 21:02:24 +01:00
|
|
|
lenName = sizeof(wszName);
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszName, (LONG *)&lenName);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
tvis.hParent = TVI_ROOT;
|
|
|
|
wsprintfW(wszTree, wszFormat2, wszCLSID, wszName);
|
2010-05-07 10:46:25 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
2017-01-30 23:11:08 +01:00
|
|
|
memmove(&wszData[6], wszData, lenData);
|
2006-06-14 19:58:35 +02:00
|
|
|
memcpy(wszData, wszCLSID, sizeof(WCHAR[6]));
|
|
|
|
wszData[5] = '\\';
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
CreateRegRec(hCurKey, tvis.hParent, &wszData[6], FALSE);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_EXPAND, TVE_EXPAND, (LPARAM)tvis.hParent);
|
2006-06-14 19:58:35 +02:00
|
|
|
tvis.hParent = parent;
|
|
|
|
}
|
|
|
|
else if(addings && !memcmp(wszName, wszTypeLib, sizeof(WCHAR[8])))
|
|
|
|
{
|
2016-03-07 21:02:24 +01:00
|
|
|
lenData = sizeof(wszData);
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszData, (LONG *)&lenData);
|
2006-06-14 19:58:35 +02:00
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
RegOpenKeyW(HKEY_CLASSES_ROOT, wszTypeLib, &hCurKey);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2016-03-07 21:02:24 +01:00
|
|
|
lenName = sizeof(wszName);
|
2010-05-07 10:46:25 +02:00
|
|
|
RegQueryValueW(hCurKey, NULL, wszName, (LONG *)&lenName);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
tvis.hParent = TVI_ROOT;
|
|
|
|
wsprintfW(wszTree, wszFormat2, wszTypeLib, wszName);
|
2010-05-07 10:46:25 +02:00
|
|
|
tvis.hParent = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
|
2017-01-30 23:11:08 +01:00
|
|
|
memmove(&wszData[8], wszData, lenData);
|
2006-06-14 19:58:35 +02:00
|
|
|
memcpy(wszData, wszTypeLib, sizeof(WCHAR[8]));
|
|
|
|
wszData[7] = '\\';
|
2010-05-07 10:46:25 +02:00
|
|
|
RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
CreateRegRec(hCurKey, tvis.hParent, &wszData[8], FALSE);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_EXPAND, TVE_EXPAND, (LPARAM)tvis.hParent);
|
2006-06-14 19:58:35 +02:00
|
|
|
tvis.hParent = parent;
|
|
|
|
}
|
|
|
|
RegCloseKey(hCurKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void CreateReg(WCHAR *buffer)
|
2006-06-14 19:58:35 +02:00
|
|
|
{
|
|
|
|
HKEY hKey;
|
|
|
|
DWORD lenBuffer=-1, lastLenBuffer, lenTree;
|
|
|
|
WCHAR *path;
|
|
|
|
WCHAR wszTree[MAX_LOAD_STRING];
|
2010-05-07 10:46:25 +02:00
|
|
|
TVINSERTSTRUCTW tvis;
|
2006-06-14 19:58:35 +02:00
|
|
|
HTREEITEM addPlace = TVI_ROOT;
|
|
|
|
|
2006-06-24 13:19:12 +02:00
|
|
|
U(tvis).item.mask = TVIF_TEXT;
|
|
|
|
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
|
|
|
|
U(tvis).item.pszText = wszTree;
|
2009-01-20 11:21:34 +01:00
|
|
|
tvis.hInsertAfter = TVI_LAST;
|
2006-06-14 19:58:35 +02:00
|
|
|
tvis.hParent = TVI_ROOT;
|
|
|
|
|
|
|
|
path = buffer;
|
|
|
|
while(TRUE)
|
|
|
|
{
|
|
|
|
while(*path != '\\' && *path != '\0') path += 1;
|
|
|
|
|
|
|
|
if(*path == '\\')
|
|
|
|
{
|
|
|
|
*path = '\0';
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegOpenKeyW(HKEY_CLASSES_ROOT, buffer, &hKey) != ERROR_SUCCESS)
|
2006-06-14 19:58:35 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
lastLenBuffer = lenBuffer+1;
|
2006-06-22 11:43:02 +02:00
|
|
|
lenBuffer = lstrlenW(buffer);
|
2006-06-14 19:58:35 +02:00
|
|
|
*path = '\\';
|
|
|
|
path += 1;
|
|
|
|
|
2017-01-30 23:11:08 +01:00
|
|
|
lenTree = sizeof(wszTree);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegQueryValueW(hKey, NULL, wszTree, (LONG *)&lenTree) == ERROR_SUCCESS)
|
2006-06-14 19:58:35 +02:00
|
|
|
{
|
2017-01-30 23:11:08 +01:00
|
|
|
memmove(&wszTree[lenBuffer-lastLenBuffer+3], wszTree, lenTree);
|
2006-06-14 19:58:35 +02:00
|
|
|
memcpy(wszTree, &buffer[lastLenBuffer],
|
2014-03-25 11:27:12 +01:00
|
|
|
(lenBuffer - lastLenBuffer) * sizeof(WCHAR));
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
if(lenTree == 1) wszTree[lenBuffer-lastLenBuffer] = '\0';
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wszTree[lenBuffer-lastLenBuffer] = ' ';
|
|
|
|
wszTree[lenBuffer-lastLenBuffer+1] = '=';
|
|
|
|
wszTree[lenBuffer-lastLenBuffer+2] = ' ';
|
|
|
|
}
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
addPlace = TreeView_InsertItemW(details.hReg, &tvis);
|
2006-06-14 19:58:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
tvis.hParent = addPlace;
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(RegOpenKeyW(HKEY_CLASSES_ROOT, buffer, &hKey) != ERROR_SUCCESS) return;
|
2006-06-14 19:58:35 +02:00
|
|
|
|
2009-01-20 11:21:34 +01:00
|
|
|
CreateRegRec(hKey, addPlace, &buffer[lenBuffer+1], TRUE);
|
2006-06-14 19:58:35 +02:00
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_EXPAND, TVE_EXPAND, (LPARAM)addPlace);
|
|
|
|
SendMessageW(details.hReg, TVM_ENSUREVISIBLE, 0, (LPARAM)addPlace);
|
2006-06-14 19:58:35 +02:00
|
|
|
}
|
2006-06-14 19:55:46 +02:00
|
|
|
|
|
|
|
void RefreshDetails(HTREEITEM item)
|
|
|
|
{
|
2010-05-07 10:46:25 +02:00
|
|
|
TVITEMW tvi;
|
2006-06-14 19:55:46 +02:00
|
|
|
WCHAR wszBuf[MAX_LOAD_STRING];
|
|
|
|
WCHAR wszStaticText[MAX_LOAD_STRING];
|
|
|
|
const WCHAR wszFormat[] = { '%','s','\n','%','s','\0' };
|
|
|
|
BOOL show;
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
memset(&tvi, 0, sizeof(TVITEMW));
|
2006-06-14 19:55:46 +02:00
|
|
|
memset(&wszStaticText, 0, sizeof(WCHAR[MAX_LOAD_STRING]));
|
|
|
|
tvi.mask = TVIF_TEXT;
|
|
|
|
tvi.hItem = item;
|
|
|
|
tvi.pszText = wszBuf;
|
|
|
|
tvi.cchTextMax = MAX_LOAD_STRING;
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(globals.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
|
|
|
if(tvi.lParam)
|
|
|
|
wsprintfW(wszStaticText, wszFormat, tvi.pszText, ((ITEM_INFO *)tvi.lParam)->clsid);
|
2006-06-22 11:43:02 +02:00
|
|
|
else lstrcpyW(wszStaticText, tvi.pszText);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SetWindowTextW(details.hStatic, wszStaticText);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hTab, TCM_SETCURSEL, 0, 0);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
|
|
|
if(tvi.lParam && ((ITEM_INFO *)tvi.lParam)->cFlag & SHOWALL)
|
|
|
|
{
|
2010-05-07 10:45:29 +02:00
|
|
|
if(SendMessageW(details.hTab, TCM_GETITEMCOUNT, 0, 0) == 1)
|
2006-06-14 19:55:46 +02:00
|
|
|
{
|
2010-05-07 10:46:25 +02:00
|
|
|
TCITEMW tci;
|
|
|
|
memset(&tci, 0, sizeof(TCITEMW));
|
2006-06-14 19:55:46 +02:00
|
|
|
tci.mask = TCIF_TEXT;
|
|
|
|
tci.pszText = wszBuf;
|
2008-09-13 22:19:20 +02:00
|
|
|
tci.cchTextMax = sizeof(wszBuf)/sizeof(wszBuf[0]);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_TAB_IMPL,
|
2008-09-13 22:19:20 +02:00
|
|
|
wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hTab, TCM_INSERTITEMW, 1, (LPARAM)&tci);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_TAB_ACTIV,
|
2008-09-13 22:19:20 +02:00
|
|
|
wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hTab, TCM_INSERTITEMW, 2, (LPARAM)&tci);
|
2006-06-14 19:55:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hTab, TCM_DELETEITEM, 2, 0);
|
|
|
|
SendMessageW(details.hTab, TCM_DELETEITEM, 1, 0);
|
2006-06-14 19:55:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
show = CreateRegPath(item, wszBuf, MAX_LOAD_STRING);
|
|
|
|
ShowWindow(details.hTab, show ? SW_SHOW : SW_HIDE);
|
|
|
|
|
|
|
|
/* FIXME Next line deals with TreeView_EnsureVisible bug */
|
2010-05-07 10:46:25 +02:00
|
|
|
SendMessageW(details.hReg, TVM_ENSUREVISIBLE, 0,
|
|
|
|
SendMessageW(details.hReg, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)TVI_ROOT));
|
|
|
|
SendMessageW(details.hReg, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);
|
2006-06-14 19:58:35 +02:00
|
|
|
if(show) CreateReg(wszBuf);
|
2006-06-14 19:55:46 +02:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void CreateTabCtrl(HWND hWnd)
|
2006-06-14 19:55:46 +02:00
|
|
|
{
|
2010-05-07 10:46:25 +02:00
|
|
|
TCITEMW tci;
|
2006-06-14 19:55:46 +02:00
|
|
|
WCHAR buffer[MAX_LOAD_STRING];
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
memset(&tci, 0, sizeof(TCITEMW));
|
2006-06-14 19:55:46 +02:00
|
|
|
tci.mask = TCIF_TEXT;
|
|
|
|
tci.pszText = buffer;
|
2008-09-13 22:19:20 +02:00
|
|
|
tci.cchTextMax = sizeof(buffer)/sizeof(buffer[0]);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
details.hTab = CreateWindowW(WC_TABCONTROLW, NULL, WS_CHILD|WS_VISIBLE,
|
2006-06-14 19:55:46 +02:00
|
|
|
0, 0, 0, 0, hWnd, (HMENU)TAB_WINDOW, globals.hMainInst, NULL);
|
|
|
|
ShowWindow(details.hTab, SW_HIDE);
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
LoadStringW(globals.hMainInst, IDS_TAB_REG, buffer, sizeof(buffer)/sizeof(buffer[0]));
|
|
|
|
SendMessageW(details.hTab, TCM_INSERTITEMW, 0, (LPARAM)&tci);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
details.hReg = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, NULL,
|
2006-06-14 19:55:46 +02:00
|
|
|
WS_CHILD|WS_VISIBLE|TVS_HASLINES,
|
|
|
|
0, 0, 0, 0, details.hTab, NULL, globals.hMainInst, NULL);
|
|
|
|
}
|
|
|
|
|
2009-01-07 12:23:42 +01:00
|
|
|
static LRESULT CALLBACK DetailsProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2006-06-14 19:55:46 +02:00
|
|
|
{
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
|
|
|
{
|
|
|
|
const WCHAR wszStatic[] = { 'S','t','a','t','i','c','\0' };
|
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
details.hStatic = CreateWindowW(wszStatic, NULL, WS_CHILD|WS_VISIBLE,
|
2006-06-14 19:55:46 +02:00
|
|
|
0, 0, 0, 0, hWnd, NULL, globals.hMainInst, NULL);
|
|
|
|
CreateTabCtrl(hWnd);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_SIZE:
|
|
|
|
MoveWindow(details.hStatic, 0, 0, LOWORD(lParam), 40, TRUE);
|
|
|
|
MoveWindow(details.hTab, 3, 40, LOWORD(lParam)-6, HIWORD(lParam)-43, TRUE);
|
|
|
|
MoveWindow(details.hReg, 10, 34, LOWORD(lParam)-26,
|
|
|
|
HIWORD(lParam)-87, TRUE);
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
|
|
|
if((int)wParam != TAB_WINDOW) break;
|
|
|
|
switch(((LPNMHDR)lParam)->code)
|
|
|
|
{
|
|
|
|
case TCN_SELCHANGE:
|
|
|
|
ShowWindow(details.hReg, SW_HIDE);
|
2010-05-07 10:45:29 +02:00
|
|
|
sel = SendMessageW(details.hTab, TCM_GETCURSEL, 0, 0);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
|
|
|
if(sel==0) ShowWindow(details.hReg, SW_SHOW);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2010-05-07 10:46:25 +02:00
|
|
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
2006-06-14 19:55:46 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
HWND CreateDetailsWindow(HINSTANCE hInst)
|
|
|
|
{
|
2010-05-07 10:46:25 +02:00
|
|
|
WNDCLASSW wcd;
|
2006-06-14 19:55:46 +02:00
|
|
|
const WCHAR wszDetailsClass[] = { 'D','E','T','A','I','L','S','\0' };
|
2010-05-07 10:46:25 +02:00
|
|
|
|
|
|
|
memset(&wcd, 0, sizeof(WNDCLASSW));
|
2006-06-14 19:55:46 +02:00
|
|
|
wcd.lpfnWndProc = DetailsProc;
|
|
|
|
wcd.lpszClassName = wszDetailsClass;
|
2015-10-07 12:27:30 +02:00
|
|
|
wcd.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
|
|
|
wcd.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
if(!RegisterClassW(&wcd)) return NULL;
|
2006-06-14 19:55:46 +02:00
|
|
|
|
2010-05-07 10:46:25 +02:00
|
|
|
globals.hDetails = CreateWindowExW(WS_EX_CLIENTEDGE, wszDetailsClass, NULL,
|
2006-06-14 19:55:46 +02:00
|
|
|
WS_CHILD|WS_VISIBLE, 0, 0, 0, 0, globals.hPaneWnd, NULL, hInst, NULL);
|
|
|
|
|
|
|
|
return globals.hDetails;
|
|
|
|
}
|