Move control panel applet enumeration to cpanelfolder.c.
This commit is contained in:
parent
db4517010b
commit
c00fbafbbf
|
@ -20,6 +20,8 @@
|
||||||
#ifndef __WINE_SHELL_CPANEL_H
|
#ifndef __WINE_SHELL_CPANEL_H
|
||||||
#define __WINE_SHELL_CPANEL_H
|
#define __WINE_SHELL_CPANEL_H
|
||||||
|
|
||||||
|
#include "cpl.h"
|
||||||
|
|
||||||
typedef struct CPlApplet {
|
typedef struct CPlApplet {
|
||||||
struct CPlApplet* next; /* linked list */
|
struct CPlApplet* next; /* linked list */
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
|
|
||||||
|
#include "cpanel.h"
|
||||||
|
#include "enumidlist.h"
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "undocshell.h"
|
#include "undocshell.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
|
@ -227,6 +229,219 @@ ISF_ControlPanel_fnParseDisplayName(IShellFolder2 * iface,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LPITEMIDLIST _ILCreateCPanelApplet(LPCSTR name, LPCSTR displayName,
|
||||||
|
LPCSTR comment, int iconIdx)
|
||||||
|
{
|
||||||
|
PIDLCPanelStruct *p;
|
||||||
|
LPITEMIDLIST pidl;
|
||||||
|
PIDLDATA tmp;
|
||||||
|
int size0 = (char*)&tmp.u.cpanel.szName-(char*)&tmp.u.cpanel;
|
||||||
|
int size = size0;
|
||||||
|
int l;
|
||||||
|
|
||||||
|
tmp.type = 0;
|
||||||
|
tmp.u.cpanel.dummy = 0;
|
||||||
|
tmp.u.cpanel.iconIdx = iconIdx;
|
||||||
|
|
||||||
|
l = strlen(name);
|
||||||
|
size += l+1;
|
||||||
|
|
||||||
|
tmp.u.cpanel.offsDispName = l+1;
|
||||||
|
l = strlen(displayName);
|
||||||
|
size += l+1;
|
||||||
|
|
||||||
|
tmp.u.cpanel.offsComment = tmp.u.cpanel.offsDispName+1+l;
|
||||||
|
l = strlen(comment);
|
||||||
|
size += l+1;
|
||||||
|
|
||||||
|
pidl = SHAlloc(size+4);
|
||||||
|
if (!pidl)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pidl->mkid.cb = size+2;
|
||||||
|
memcpy(pidl->mkid.abID, &tmp, 2+size0);
|
||||||
|
|
||||||
|
p = &((PIDLDATA*)pidl->mkid.abID)->u.cpanel;
|
||||||
|
strcpy(p->szName, name);
|
||||||
|
strcpy(p->szName+tmp.u.cpanel.offsDispName, displayName);
|
||||||
|
strcpy(p->szName+tmp.u.cpanel.offsComment, comment);
|
||||||
|
|
||||||
|
*(WORD*)((char*)pidl+(size+2)) = 0;
|
||||||
|
|
||||||
|
pcheck(pidl);
|
||||||
|
|
||||||
|
return pidl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* _ILGetCPanelPointer()
|
||||||
|
* gets a pointer to the control panel struct stored in the pidl
|
||||||
|
*/
|
||||||
|
static PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl)
|
||||||
|
{
|
||||||
|
LPPIDLDATA pdata = _ILGetDataPointer(pidl);
|
||||||
|
|
||||||
|
if (pdata && pdata->type==0)
|
||||||
|
return (PIDLCPanelStruct*)&(pdata->u.cpanel);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* ISF_ControlPanel_fnEnumObjects
|
||||||
|
*/
|
||||||
|
static BOOL SHELL_RegisterCPanelApp(IEnumIDList* list, LPCSTR path)
|
||||||
|
{
|
||||||
|
LPITEMIDLIST pidl;
|
||||||
|
CPlApplet* applet;
|
||||||
|
CPanel panel;
|
||||||
|
CPLINFO info;
|
||||||
|
unsigned i;
|
||||||
|
int iconIdx;
|
||||||
|
|
||||||
|
char displayName[MAX_PATH];
|
||||||
|
char comment[MAX_PATH];
|
||||||
|
|
||||||
|
WCHAR wpath[MAX_PATH];
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
|
||||||
|
|
||||||
|
panel.first = NULL;
|
||||||
|
applet = Control_LoadApplet(0, wpath, &panel);
|
||||||
|
|
||||||
|
if (applet)
|
||||||
|
{
|
||||||
|
for(i=0; i<applet->count; ++i)
|
||||||
|
{
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, applet->info[i].szName, -1, displayName, MAX_PATH, 0, 0);
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, applet->info[i].szInfo, -1, comment, MAX_PATH, 0, 0);
|
||||||
|
|
||||||
|
applet->proc(0, CPL_INQUIRE, i, (LPARAM)&info);
|
||||||
|
|
||||||
|
if (info.idIcon > 0)
|
||||||
|
iconIdx = -info.idIcon; /* negative icon index instead of icon number */
|
||||||
|
else
|
||||||
|
iconIdx = 0;
|
||||||
|
|
||||||
|
pidl = _ILCreateCPanelApplet(path, displayName, comment, iconIdx);
|
||||||
|
|
||||||
|
if (pidl)
|
||||||
|
AddToEnumList(list, pidl);
|
||||||
|
}
|
||||||
|
Control_UnloadApplet(applet);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SHELL_RegisterRegistryCPanelApps(IEnumIDList* list, HKEY hkey_root, LPCSTR szRepPath)
|
||||||
|
{
|
||||||
|
char name[MAX_PATH];
|
||||||
|
char value[MAX_PATH];
|
||||||
|
HKEY hkey;
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
for(;; ++idx)
|
||||||
|
{
|
||||||
|
DWORD nameLen = MAX_PATH;
|
||||||
|
DWORD valueLen = MAX_PATH;
|
||||||
|
|
||||||
|
if (RegEnumValueA(hkey, idx, name, &nameLen, NULL, NULL, (LPBYTE)&value, &valueLen) != ERROR_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (SHELL_RegisterCPanelApp(list, value))
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SHELL_RegisterCPanelFolders(IEnumIDList* list, HKEY hkey_root, LPCSTR szRepPath)
|
||||||
|
{
|
||||||
|
char name[MAX_PATH];
|
||||||
|
HKEY hkey;
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
for(;; ++idx)
|
||||||
|
{
|
||||||
|
if (RegEnumKeyA(hkey, idx, name, MAX_PATH) != ERROR_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*name == '{')
|
||||||
|
{
|
||||||
|
LPITEMIDLIST pidl = _ILCreateGuidFromStrA(name);
|
||||||
|
|
||||||
|
if (pidl && AddToEnumList(list, pidl))
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* CreateCPanelEnumList()
|
||||||
|
*/
|
||||||
|
static BOOL CreateCPanelEnumList(
|
||||||
|
IEnumIDList * iface,
|
||||||
|
DWORD dwFlags)
|
||||||
|
{
|
||||||
|
CHAR szPath[MAX_PATH];
|
||||||
|
WIN32_FIND_DATAA wfd;
|
||||||
|
HANDLE hFile;
|
||||||
|
|
||||||
|
TRACE("(%p)->(flags=0x%08lx) \n",iface,dwFlags);
|
||||||
|
|
||||||
|
/* enumerate control panel folders folders */
|
||||||
|
if (dwFlags & SHCONTF_FOLDERS)
|
||||||
|
SHELL_RegisterCPanelFolders(iface, HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
|
||||||
|
|
||||||
|
/* enumerate the control panel applets */
|
||||||
|
if (dwFlags & SHCONTF_NONFOLDERS)
|
||||||
|
{
|
||||||
|
LPSTR p;
|
||||||
|
|
||||||
|
GetSystemDirectoryA(szPath, MAX_PATH);
|
||||||
|
p = PathAddBackslashA(szPath);
|
||||||
|
strcpy(p, "*.cpl");
|
||||||
|
|
||||||
|
TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",iface,debugstr_a(szPath));
|
||||||
|
hFile = FindFirstFileA(szPath, &wfd);
|
||||||
|
|
||||||
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!(dwFlags & SHCONTF_INCLUDEHIDDEN) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||||
|
strcpy(p, wfd.cFileName);
|
||||||
|
SHELL_RegisterCPanelApp((IEnumIDList*)iface, szPath);
|
||||||
|
}
|
||||||
|
} while(FindNextFileA(hFile, &wfd));
|
||||||
|
FindClose(hFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL_RegisterRegistryCPanelApps((IEnumIDList*)iface, HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
|
||||||
|
SHELL_RegisterRegistryCPanelApps((IEnumIDList*)iface, HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* ISF_ControlPanel_fnEnumObjects
|
* ISF_ControlPanel_fnEnumObjects
|
||||||
*/
|
*/
|
||||||
|
@ -237,7 +452,9 @@ ISF_ControlPanel_fnEnumObjects(IShellFolder2 * iface, HWND hwndOwner, DWORD dwFl
|
||||||
|
|
||||||
TRACE("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
TRACE("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
||||||
|
|
||||||
*ppEnumIDList = IEnumIDList_Constructor(NULL, dwFlags, EIDL_CPANEL);
|
*ppEnumIDList = IEnumIDList_Constructor();
|
||||||
|
if (*ppEnumIDList)
|
||||||
|
CreateCPanelEnumList(*ppEnumIDList, dwFlags);
|
||||||
|
|
||||||
TRACE("--(%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
TRACE("--(%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,10 @@
|
||||||
#include "shlwapi.h"
|
#include "shlwapi.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "objbase.h"
|
#include "objbase.h"
|
||||||
#include <cpl.h>
|
|
||||||
|
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
#include "shell32_main.h"
|
#include "enumidlist.h"
|
||||||
#include "cpanel.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ static struct ICOM_VTABLE(IEnumIDList) eidlvt;
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* AddToEnumList()
|
* AddToEnumList()
|
||||||
*/
|
*/
|
||||||
static BOOL AddToEnumList(
|
BOOL AddToEnumList(
|
||||||
IEnumIDList * iface,
|
IEnumIDList * iface,
|
||||||
LPITEMIDLIST pidl)
|
LPITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +67,10 @@ static BOOL AddToEnumList(
|
||||||
LPENUMLIST pNew;
|
LPENUMLIST pNew;
|
||||||
|
|
||||||
TRACE("(%p)->(pidl=%p)\n",This,pidl);
|
TRACE("(%p)->(pidl=%p)\n",This,pidl);
|
||||||
|
|
||||||
|
if (!iface || !pidl)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
|
pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
|
||||||
if(pNew)
|
if(pNew)
|
||||||
{
|
{
|
||||||
|
@ -170,161 +172,6 @@ static BOOL CreateFolderEnumList(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SHELL_RegisterCPanelApp(IEnumIDList* list, LPCSTR path)
|
|
||||||
{
|
|
||||||
LPITEMIDLIST pidl;
|
|
||||||
CPlApplet* applet;
|
|
||||||
CPanel panel;
|
|
||||||
CPLINFO info;
|
|
||||||
unsigned i;
|
|
||||||
int iconIdx;
|
|
||||||
|
|
||||||
char displayName[MAX_PATH];
|
|
||||||
char comment[MAX_PATH];
|
|
||||||
|
|
||||||
WCHAR wpath[MAX_PATH];
|
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
|
|
||||||
|
|
||||||
panel.first = NULL;
|
|
||||||
applet = Control_LoadApplet(0, wpath, &panel);
|
|
||||||
|
|
||||||
if (applet) {
|
|
||||||
for(i=0; i<applet->count; ++i) {
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, applet->info[i].szName, -1, displayName, MAX_PATH, 0, 0);
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, applet->info[i].szInfo, -1, comment, MAX_PATH, 0, 0);
|
|
||||||
|
|
||||||
applet->proc(0, CPL_INQUIRE, i, (LPARAM)&info);
|
|
||||||
|
|
||||||
if (info.idIcon > 0)
|
|
||||||
iconIdx = -info.idIcon; /* negative icon index instead of icon number */
|
|
||||||
else
|
|
||||||
iconIdx = 0;
|
|
||||||
|
|
||||||
pidl = _ILCreateCPanel(path, displayName, comment, iconIdx);
|
|
||||||
|
|
||||||
if (pidl)
|
|
||||||
AddToEnumList(list, pidl);
|
|
||||||
}
|
|
||||||
|
|
||||||
Control_UnloadApplet(applet);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SHELL_RegisterRegistryCPanelApps(IEnumIDList* list, HKEY hkey_root, LPCSTR szRepPath)
|
|
||||||
{
|
|
||||||
char name[MAX_PATH];
|
|
||||||
char value[MAX_PATH];
|
|
||||||
HKEY hkey;
|
|
||||||
|
|
||||||
int cnt = 0;
|
|
||||||
|
|
||||||
if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
int idx = 0;
|
|
||||||
for(;; ++idx)
|
|
||||||
{
|
|
||||||
DWORD nameLen = MAX_PATH;
|
|
||||||
DWORD valueLen = MAX_PATH;
|
|
||||||
|
|
||||||
if (RegEnumValueA(hkey, idx, name, &nameLen, NULL, NULL, (LPBYTE)&value, &valueLen) != ERROR_SUCCESS)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (SHELL_RegisterCPanelApp(list, value))
|
|
||||||
++cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SHELL_RegisterCPanelFolders(IEnumIDList* list, HKEY hkey_root, LPCSTR szRepPath)
|
|
||||||
{
|
|
||||||
char name[MAX_PATH];
|
|
||||||
HKEY hkey;
|
|
||||||
|
|
||||||
int cnt = 0;
|
|
||||||
|
|
||||||
if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
int idx = 0;
|
|
||||||
for(;; ++idx)
|
|
||||||
{
|
|
||||||
if (RegEnumKeyA(hkey, idx, name, MAX_PATH) != ERROR_SUCCESS)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (*name == '{') {
|
|
||||||
LPITEMIDLIST pidl = _ILCreateGuidFromStrA(name);
|
|
||||||
|
|
||||||
if (pidl && AddToEnumList(list, pidl))
|
|
||||||
++cnt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* CreateCPanelEnumList()
|
|
||||||
*/
|
|
||||||
static BOOL CreateCPanelEnumList(
|
|
||||||
IEnumIDList * iface,
|
|
||||||
DWORD dwFlags)
|
|
||||||
{
|
|
||||||
ICOM_THIS(IEnumIDListImpl,iface);
|
|
||||||
|
|
||||||
CHAR szPath[MAX_PATH];
|
|
||||||
WIN32_FIND_DATAA wfd;
|
|
||||||
HANDLE hFile;
|
|
||||||
|
|
||||||
TRACE("(%p)->(flags=0x%08lx) \n",This,dwFlags);
|
|
||||||
|
|
||||||
/* enumerate control panel folders folders */
|
|
||||||
if (dwFlags & SHCONTF_FOLDERS)
|
|
||||||
SHELL_RegisterCPanelFolders((IEnumIDList*)This, HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
|
|
||||||
|
|
||||||
/* enumerate the control panel applets */
|
|
||||||
if (dwFlags & SHCONTF_NONFOLDERS)
|
|
||||||
{
|
|
||||||
LPSTR p;
|
|
||||||
|
|
||||||
GetSystemDirectoryA(szPath, MAX_PATH);
|
|
||||||
p = PathAddBackslashA(szPath);
|
|
||||||
strcpy(p, "*.cpl");
|
|
||||||
|
|
||||||
TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",This,debugstr_a(szPath));
|
|
||||||
hFile = FindFirstFileA(szPath, &wfd);
|
|
||||||
|
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (!(dwFlags & SHCONTF_INCLUDEHIDDEN) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
|
||||||
strcpy(p, wfd.cFileName);
|
|
||||||
SHELL_RegisterCPanelApp((IEnumIDList*)This, szPath);
|
|
||||||
}
|
|
||||||
} while(FindNextFileA(hFile, &wfd));
|
|
||||||
|
|
||||||
FindClose(hFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
SHELL_RegisterRegistryCPanelApps((IEnumIDList*)This, HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
|
|
||||||
SHELL_RegisterRegistryCPanelApps((IEnumIDList*)This, HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* CreateDesktopEnumList()
|
* CreateDesktopEnumList()
|
||||||
*/
|
*/
|
||||||
|
@ -470,7 +317,22 @@ static BOOL DeleteList(
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IEnumIDList * IEnumIDList_Constructor(
|
IEnumIDList * IEnumIDList_Constructor(void)
|
||||||
|
{
|
||||||
|
IEnumIDListImpl *lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
|
||||||
|
|
||||||
|
if (lpeidl)
|
||||||
|
{
|
||||||
|
lpeidl->ref = 1;
|
||||||
|
lpeidl->lpVtbl = &eidlvt;
|
||||||
|
}
|
||||||
|
TRACE("-- (%p)->()\n",lpeidl);
|
||||||
|
|
||||||
|
return (IEnumIDList*)lpeidl;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumIDList * IEnumIDList_BadConstructor(
|
||||||
LPCSTR lpszPath,
|
LPCSTR lpszPath,
|
||||||
DWORD dwFlags,
|
DWORD dwFlags,
|
||||||
DWORD dwKind)
|
DWORD dwKind)
|
||||||
|
@ -480,13 +342,10 @@ IEnumIDList * IEnumIDList_Constructor(
|
||||||
|
|
||||||
TRACE("()->(%s flags=0x%08lx kind=0x%08lx)\n",debugstr_a(lpszPath),dwFlags, dwKind);
|
TRACE("()->(%s flags=0x%08lx kind=0x%08lx)\n",debugstr_a(lpszPath),dwFlags, dwKind);
|
||||||
|
|
||||||
lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
|
lpeidl = (IEnumIDListImpl *)IEnumIDList_Constructor();
|
||||||
|
|
||||||
if (lpeidl)
|
if (lpeidl)
|
||||||
{
|
{
|
||||||
lpeidl->ref = 1;
|
|
||||||
lpeidl->lpVtbl = &eidlvt;
|
|
||||||
|
|
||||||
switch (dwKind)
|
switch (dwKind)
|
||||||
{
|
{
|
||||||
case EIDL_DESK:
|
case EIDL_DESK:
|
||||||
|
@ -500,10 +359,6 @@ IEnumIDList * IEnumIDList_Constructor(
|
||||||
case EIDL_FILE:
|
case EIDL_FILE:
|
||||||
ret = CreateFolderEnumList((IEnumIDList*)lpeidl, lpszPath, dwFlags);
|
ret = CreateFolderEnumList((IEnumIDList*)lpeidl, lpszPath, dwFlags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EIDL_CPANEL:
|
|
||||||
ret = CreateCPanelEnumList((IEnumIDList*)lpeidl, dwFlags);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#ifndef __ENUMIDLIST_H__
|
||||||
|
#define __ENUMIDLIST_H__
|
||||||
|
|
||||||
|
#include "shlobj.h"
|
||||||
|
|
||||||
|
LPENUMIDLIST IEnumIDList_Constructor(void);
|
||||||
|
BOOL AddToEnumList(IEnumIDList * iface, LPITEMIDLIST pidl);
|
||||||
|
|
||||||
|
/* old interface that's going away soon: */
|
||||||
|
/* kind of enumidlist */
|
||||||
|
#define EIDL_DESK 0
|
||||||
|
#define EIDL_MYCOMP 1
|
||||||
|
#define EIDL_FILE 2
|
||||||
|
|
||||||
|
IEnumIDList * IEnumIDList_BadConstructor(LPCSTR lpszPath, DWORD dwFlags,
|
||||||
|
DWORD dwKind);
|
||||||
|
|
||||||
|
#endif /* ndef __ENUMIDLIST_H__ */
|
|
@ -1644,49 +1644,6 @@ LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew)
|
||||||
return pidlOut;
|
return pidlOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPITEMIDLIST _ILCreateCPanel(LPCSTR name, LPCSTR displayName, LPCSTR comment, int iconIdx)
|
|
||||||
{
|
|
||||||
PIDLCPanelStruct *p;
|
|
||||||
LPITEMIDLIST pidl;
|
|
||||||
PIDLDATA tmp;
|
|
||||||
int size0 = (char*)&tmp.u.cpanel.szName-(char*)&tmp.u.cpanel;
|
|
||||||
int size = size0;
|
|
||||||
int l;
|
|
||||||
|
|
||||||
tmp.type = 0;
|
|
||||||
tmp.u.cpanel.dummy = 0;
|
|
||||||
tmp.u.cpanel.iconIdx = iconIdx;
|
|
||||||
|
|
||||||
l = strlen(name);
|
|
||||||
size += l+1;
|
|
||||||
|
|
||||||
tmp.u.cpanel.offsDispName = l+1;
|
|
||||||
l = strlen(displayName);
|
|
||||||
size += l+1;
|
|
||||||
|
|
||||||
tmp.u.cpanel.offsComment = tmp.u.cpanel.offsDispName+1+l;
|
|
||||||
l = strlen(comment);
|
|
||||||
size += l+1;
|
|
||||||
|
|
||||||
pidl = SHAlloc(size+4);
|
|
||||||
if (!pidl)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
pidl->mkid.cb = size+2;
|
|
||||||
memcpy(pidl->mkid.abID, &tmp, 2+size0);
|
|
||||||
|
|
||||||
p = &((PIDLDATA*)pidl->mkid.abID)->u.cpanel;
|
|
||||||
strcpy(p->szName, name);
|
|
||||||
strcpy(p->szName+tmp.u.cpanel.offsDispName, displayName);
|
|
||||||
strcpy(p->szName+tmp.u.cpanel.offsComment, comment);
|
|
||||||
|
|
||||||
*(WORD*)((char*)pidl+(size+2)) = 0;
|
|
||||||
|
|
||||||
pcheck(pidl);
|
|
||||||
|
|
||||||
return pidl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* _ILGetDrive()
|
* _ILGetDrive()
|
||||||
*
|
*
|
||||||
|
@ -1990,20 +1947,6 @@ REFIID _ILGetGUIDPointer(LPCITEMIDLIST pidl)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* _ILGetCPanelPointer()
|
|
||||||
* gets a pointer to the control panel struct stored in the pidl
|
|
||||||
*/
|
|
||||||
PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl)
|
|
||||||
{
|
|
||||||
LPPIDLDATA pdata = _ILGetDataPointer(pidl);
|
|
||||||
|
|
||||||
if (pdata && pdata->type==0)
|
|
||||||
return (PIDLCPanelStruct*)&(pdata->u.cpanel);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* _ILGetFileDateTime
|
* _ILGetFileDateTime
|
||||||
*
|
*
|
||||||
|
|
|
@ -209,7 +209,6 @@ LPITEMIDLIST _ILCreatePrinters (void);
|
||||||
LPITEMIDLIST _ILCreateNetwork (void);
|
LPITEMIDLIST _ILCreateNetwork (void);
|
||||||
LPITEMIDLIST _ILCreateBitBucket (void);
|
LPITEMIDLIST _ILCreateBitBucket (void);
|
||||||
LPITEMIDLIST _ILCreateDrive (LPCSTR);
|
LPITEMIDLIST _ILCreateDrive (LPCSTR);
|
||||||
LPITEMIDLIST _ILCreateCPanel (LPCSTR name, LPCSTR displayName, LPCSTR comment, int iconIdx);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* helper functions (getting struct-pointer)
|
* helper functions (getting struct-pointer)
|
||||||
|
@ -218,7 +217,6 @@ LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
|
||||||
LPSTR _ILGetTextPointer (LPCITEMIDLIST);
|
LPSTR _ILGetTextPointer (LPCITEMIDLIST);
|
||||||
LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
|
LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
|
||||||
REFIID _ILGetGUIDPointer (LPCITEMIDLIST pidl);
|
REFIID _ILGetGUIDPointer (LPCITEMIDLIST pidl);
|
||||||
PIDLCPanelStruct* _ILGetCPanelPointer (LPCITEMIDLIST pidl);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* debug helper
|
* debug helper
|
||||||
|
|
|
@ -97,14 +97,6 @@ HRESULT WINAPI CPanel_GetIconLocationW(LPITEMIDLIST pidl, LPWSTR szIconFile, UIN
|
||||||
HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
||||||
HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
|
||||||
|
|
||||||
/* kind of enumidlist */
|
|
||||||
#define EIDL_DESK 0
|
|
||||||
#define EIDL_MYCOMP 1
|
|
||||||
#define EIDL_FILE 2
|
|
||||||
#define EIDL_CPANEL 3
|
|
||||||
|
|
||||||
LPENUMIDLIST IEnumIDList_Constructor(LPCSTR,DWORD,DWORD);
|
|
||||||
|
|
||||||
LPEXTRACTICONA IExtractIconA_Constructor(LPCITEMIDLIST);
|
LPEXTRACTICONA IExtractIconA_Constructor(LPCITEMIDLIST);
|
||||||
LPEXTRACTICONW IExtractIconW_Constructor(LPCITEMIDLIST);
|
LPEXTRACTICONW IExtractIconW_Constructor(LPCITEMIDLIST);
|
||||||
HRESULT CreateStreamOnFile (LPCWSTR pszFilename, DWORD grfMode, IStream ** ppstm);
|
HRESULT CreateStreamOnFile (LPCWSTR pszFilename, DWORD grfMode, IStream ** ppstm);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
|
|
||||||
|
#include "enumidlist.h"
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "undocshell.h"
|
#include "undocshell.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
|
@ -269,15 +270,11 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
|
||||||
|
|
||||||
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
||||||
|
|
||||||
*ppEnumIDList = NULL;
|
*ppEnumIDList = IEnumIDList_BadConstructor (NULL, dwFlags, EIDL_DESK);
|
||||||
*ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
|
|
||||||
|
|
||||||
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
||||||
|
|
||||||
if (!*ppEnumIDList)
|
return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
|
|
||||||
|
#include "enumidlist.h"
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "undocshell.h"
|
#include "undocshell.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
|
@ -391,7 +392,7 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags
|
||||||
|
|
||||||
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
||||||
|
|
||||||
*ppEnumIDList = IEnumIDList_Constructor (This->sPathTarget, dwFlags, EIDL_FILE);
|
*ppEnumIDList = IEnumIDList_BadConstructor (This->sPathTarget, dwFlags, EIDL_FILE);
|
||||||
|
|
||||||
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "pidl.h"
|
#include "pidl.h"
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
|
#include "enumidlist.h"
|
||||||
#include "undocshell.h"
|
#include "undocshell.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
#include "shresdef.h"
|
#include "shresdef.h"
|
||||||
|
@ -247,7 +247,7 @@ ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFla
|
||||||
|
|
||||||
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
|
||||||
|
|
||||||
*ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);
|
*ppEnumIDList = IEnumIDList_BadConstructor (NULL, dwFlags, EIDL_MYCOMP);
|
||||||
|
|
||||||
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue