mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
- scan HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu key if a shellfolder should be hidden
- also add items which should should not be hidden - network location shell folder now appears but isnt working svn path=/trunk/; revision=31547
This commit is contained in:
parent
054c755d91
commit
562c812846
7 changed files with 1389 additions and 97 deletions
|
@ -98,6 +98,29 @@ BOOL AddToEnumList(
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
/**************************************************************************
|
||||
* HasItemWithCLSID()
|
||||
*/
|
||||
BOOL HasItemWithCLSID(IEnumIDList *iface, LPITEMIDLIST pidl)
|
||||
{
|
||||
IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
|
||||
LPENUMLIST pCur;
|
||||
REFIID refid = _ILGetGUIDPointer(pidl);
|
||||
|
||||
pCur = This->mpFirst;
|
||||
|
||||
while(pCur)
|
||||
{
|
||||
REFIID curid = _ILGetGUIDPointer(pCur->pidl);
|
||||
if (IsEqualIID(curid, refid))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
pCur = pCur->pNext;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* CreateFolderEnumList()
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
/* Creates an IEnumIDList; add LPITEMIDLISTs to it with AddToEnumList. */
|
||||
LPENUMIDLIST IEnumIDList_Constructor(void);
|
||||
BOOL AddToEnumList(IEnumIDList *list, LPITEMIDLIST pidl);
|
||||
BOOL HasItemWithCLSID(IEnumIDList *list, LPITEMIDLIST pidl);
|
||||
|
||||
/* Enumerates the folders and/or files (depending on dwFlags) in lpszPath and
|
||||
* adds them to the already-created list.
|
||||
|
|
|
@ -239,6 +239,34 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static const WCHAR ClassicStartMenuW[] = {'S','O','F','T','W','A','R','E','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
|
||||
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r',
|
||||
'\\','H','i','d','e','D','e','s','k','t','o','p','I','c','o','n','s','\\',
|
||||
'C','l','a','s','s','i','c','S','t','a','r','t','M','e','n','u','\0' };
|
||||
|
||||
INT
|
||||
HideNamespaceExtension(WCHAR *iid)
|
||||
{
|
||||
DWORD Result, dwResult;
|
||||
dwResult = sizeof(DWORD);
|
||||
|
||||
if (RegGetValueW(HKEY_CURRENT_USER, /* FIXME use NewStartPanel when activated */
|
||||
ClassicStartMenuW,
|
||||
iid,
|
||||
RRF_RT_DWORD,
|
||||
NULL,
|
||||
&Result,
|
||||
&dwResult) != ERROR_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* CreateDesktopEnumList()
|
||||
*/
|
||||
|
@ -252,6 +280,8 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
{
|
||||
BOOL ret = TRUE;
|
||||
WCHAR szPath[MAX_PATH];
|
||||
static WCHAR MyDocumentsClassString[] = L"{450D8FBA-AD25-11D0-98A8-0800361B1103}";
|
||||
|
||||
|
||||
TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
|
||||
|
||||
|
@ -260,14 +290,23 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
{
|
||||
HKEY hkey;
|
||||
UINT i;
|
||||
DWORD dwResult;
|
||||
|
||||
/* create the pidl for This item */
|
||||
ret = AddToEnumList(list, _ILCreateMyDocuments());
|
||||
if (HideNamespaceExtension(MyDocumentsClassString) < 1)
|
||||
{
|
||||
ret = AddToEnumList(list, _ILCreateMyDocuments());
|
||||
}
|
||||
ret = AddToEnumList(list, _ILCreateMyComputer());
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
|
||||
Desktop_NameSpaceW, 0, KEY_READ, &hkey))
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
dwResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW, 0, KEY_READ, &hkey);
|
||||
else
|
||||
dwResult = RegOpenKeyExW(HKEY_CURRENT_USER, Desktop_NameSpaceW, 0, KEY_READ, &hkey);
|
||||
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
{
|
||||
WCHAR iid[50];
|
||||
LPITEMIDLIST pidl;
|
||||
|
@ -282,24 +321,69 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
|
||||
if (ERROR_SUCCESS == r)
|
||||
{
|
||||
pidl = _ILCreateGuidFromStrW(iid);
|
||||
if (_ILIsMyDocuments(pidl))
|
||||
if (HideNamespaceExtension(iid) < 1)
|
||||
{
|
||||
SHFree(pidl);
|
||||
}
|
||||
else
|
||||
pidl = _ILCreateGuidFromStrW(iid);
|
||||
if (!HasItemWithCLSID(list, pidl))
|
||||
{
|
||||
ret = AddToEnumList(list, pidl);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHFree(pidl);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ERROR_NO_MORE_ITEMS == r)
|
||||
break;
|
||||
else
|
||||
ret = FALSE;
|
||||
i++;
|
||||
}
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
dwResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, ClassicStartMenuW, 0, KEY_READ, &hkey);
|
||||
else
|
||||
dwResult = RegOpenKeyExW(HKEY_CURRENT_USER, ClassicStartMenuW, 0, KEY_READ, &hkey);
|
||||
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD j = 0, dwVal, Val, dwType, dwIID;
|
||||
LONG r;
|
||||
WCHAR iid[50];
|
||||
|
||||
while(ret)
|
||||
{
|
||||
dwVal = sizeof(Val);
|
||||
dwIID = sizeof(iid) / sizeof(WCHAR);
|
||||
|
||||
r = RegEnumValueW(hkey, j++, iid, &dwIID, NULL, &dwType, (LPBYTE)&Val, &dwVal);
|
||||
if (r == ERROR_SUCCESS)
|
||||
{
|
||||
if (Val == 0 && dwType == REG_DWORD)
|
||||
{
|
||||
ret = AddToEnumList(list, pidl);
|
||||
LPITEMIDLIST pidl = _ILCreateGuidFromStrW(iid);
|
||||
if (!HasItemWithCLSID(list, pidl))
|
||||
{
|
||||
AddToEnumList(list, pidl);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHFree(pidl);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
else if (ERROR_NO_MORE_ITEMS == r)
|
||||
break;
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "debughlp.h"
|
||||
#include "shfldr.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL (mydocs);
|
||||
|
||||
/***********************************************************************
|
||||
* MyDocumentsfolder implementation
|
||||
|
@ -500,13 +500,14 @@ WINAPI ISF_MyDocuments_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
if (!pszPath)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (_ILIsMyDocuments (pidl) || _ILIsDesktop(pidl))
|
||||
if (_ILIsMyDocuments (pidl))
|
||||
{
|
||||
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
|
||||
(GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
|
||||
strcpyW(pszPath, This->sPathTarget);
|
||||
else
|
||||
HCR_GetClassNameW(&CLSID_MyDocuments, pszPath, MAX_PATH);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
else if (_ILIsPidlSimple (pidl))
|
||||
{
|
||||
|
@ -563,6 +564,7 @@ WINAPI ISF_MyDocuments_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
|
||||
pszPath,
|
||||
MAX_PATH);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -570,12 +572,14 @@ WINAPI ISF_MyDocuments_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
pszPath[0] = ':';
|
||||
pszPath[1] = ':';
|
||||
SHELL32_GUIDToStringW (clsid, &pszPath[2]);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* user friendly name */
|
||||
HCR_GetClassNameW (clsid, pszPath, MAX_PATH);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -587,14 +591,20 @@ WINAPI ISF_MyDocuments_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
|
||||
{
|
||||
lstrcpynW(pszPath, This->sPathTarget, MAX_PATH - 1);
|
||||
PathAddBackslashW(pszPath);
|
||||
cLen = lstrlenW(pszPath);
|
||||
TRACE("CP %s\n", debugstr_w(pszPath));
|
||||
}
|
||||
|
||||
_ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
|
||||
|
||||
if (!_ILIsFolder(pidl))
|
||||
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
||||
if (!_ILIsDesktop(pidl))
|
||||
{
|
||||
PathAddBackslashW(pszPath);
|
||||
cLen = lstrlenW(pszPath);
|
||||
_ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
|
||||
if (!_ILIsFolder(pidl))
|
||||
{
|
||||
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -602,31 +612,18 @@ WINAPI ISF_MyDocuments_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
/* a complex pidl, let the subfolder do the work */
|
||||
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
|
||||
pszPath, MAX_PATH);
|
||||
TRACE("CP\n");
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
/* Win9x always returns ANSI strings, NT always returns Unicode strings */
|
||||
if (GetVersion() & 0x80000000)
|
||||
{
|
||||
strRet->uType = STRRET_CSTR;
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, pszPath, -1, strRet->u.cStr, MAX_PATH,
|
||||
NULL, NULL))
|
||||
strRet->u.cStr[0] = '\0';
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
strRet->uType = STRRET_WSTR;
|
||||
strRet->u.pOleStr = pszPath;
|
||||
}
|
||||
strRet->uType = STRRET_WSTR;
|
||||
strRet->u.pOleStr = pszPath;
|
||||
}
|
||||
else
|
||||
CoTaskMemFree(pszPath);
|
||||
|
||||
TRACE ("-- (%p)->(%s,0x%08x)\n", This,
|
||||
strRet->uType == STRRET_CSTR ? strRet->u.cStr :
|
||||
debugstr_w(strRet->u.pOleStr), hr);
|
||||
TRACE ("-- (%p)->(%s,0x%08x)\n", This, debugstr_w(strRet->u.pOleStr), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
|
|||
|
||||
if (_ILIsDrive (pidl)) {
|
||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK|SFGAO_CANRENAME;
|
||||
} else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
|
||||
*pdwAttributes = dwAttributes;
|
||||
} else if (_ILGetDataPointer (pidl)) {
|
||||
|
|
1246
reactos/dll/win32/shell32/shv_default_context_menu.c
Normal file
1246
reactos/dll/win32/shell32/shv_default_context_menu.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1262,62 +1262,3 @@ SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *Th
|
|||
RegCloseKey(hKey);
|
||||
return index;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHCreateDefaultContextMenu [SHELL32.325] Vista API
|
||||
*
|
||||
*/
|
||||
|
||||
HRESULT WINAPI SHCreateDefaultContextMenu(
|
||||
const DEFCONTEXTMENU *pdcm,
|
||||
REFIID riid,
|
||||
void **ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
IContextMenu2 * pcm;
|
||||
|
||||
if (pdcm->cidl > 0)
|
||||
pcm = ISvItemCm_Constructor( pdcm->psf, pdcm->pidlFolder, pdcm->apidl, pdcm->cidl );
|
||||
else
|
||||
pcm = ISvBgCm_Constructor( pdcm->psf, TRUE );
|
||||
|
||||
hr = S_OK;
|
||||
*ppv = pcm;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* CDefFolderMenu_Create2 [SHELL32.701]
|
||||
*
|
||||
*/
|
||||
|
||||
INT
|
||||
WINAPI
|
||||
CDefFolderMenu_Create2(
|
||||
LPCITEMIDLIST pidlFolder,
|
||||
HWND hwnd,
|
||||
UINT cidl,
|
||||
LPCITEMIDLIST *apidl,
|
||||
IShellFolder *psf,
|
||||
LPFNDFMCALLBACK lpfn,
|
||||
UINT nKeys,
|
||||
HKEY *ahkeyClsKeys,
|
||||
IContextMenu **ppcm)
|
||||
{
|
||||
DEFCONTEXTMENU pdcm;
|
||||
HRESULT hr;
|
||||
|
||||
pdcm.hwnd = hwnd;
|
||||
pdcm.pcmcb = NULL; //FIXME
|
||||
pdcm.pidlFolder = pidlFolder;
|
||||
pdcm.psf = psf;
|
||||
pdcm.cidl = cidl;
|
||||
pdcm.apidl = apidl;
|
||||
pdcm.punkAssociationInfo = NULL;
|
||||
pdcm.cKeys = nKeys;
|
||||
pdcm.aKeys = ahkeyClsKeys;
|
||||
|
||||
hr = SHCreateDefaultContextMenu(&pdcm, &IID_IContextMenu, (void**)ppcm);
|
||||
return hr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue