Support for shellfolder's CallForAttributes registry value.
This commit is contained in:
parent
389f9d55d9
commit
11cadc368a
|
@ -26,6 +26,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
|
@ -39,6 +42,7 @@
|
||||||
#include "shlguid.h"
|
#include "shlguid.h"
|
||||||
#include "shresdef.h"
|
#include "shresdef.h"
|
||||||
#include "shlwapi.h"
|
#include "shlwapi.h"
|
||||||
|
#include "pidl.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||||
|
@ -341,47 +345,81 @@ BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/******************************************************************************
|
||||||
* HCR_GetFolderAttributes [internal]
|
* HCR_GetFolderAttributes [Internal]
|
||||||
*
|
*
|
||||||
* gets the folder attributes of a class
|
* Query the registry for a shell folders' attributes
|
||||||
*
|
*
|
||||||
* FIXME
|
* PARAMS
|
||||||
* verify the defaultvalue for *szDest
|
* pidlFolder [I] A simple pidl of type PT_GUID.
|
||||||
|
* pdwAttributes [IO] In: Attributes to be queried, OUT: Resulting attributes.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* TRUE: Found information for the attributes in the registry
|
||||||
|
* FALSE: No attribute information found
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* If queried for an attribute, which is set in the CallForAttributes registry
|
||||||
|
* value, the function binds to the shellfolder objects and queries it.
|
||||||
*/
|
*/
|
||||||
BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
|
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
|
||||||
{ HKEY hkey;
|
|
||||||
char xriid[60];
|
|
||||||
DWORD attributes;
|
|
||||||
DWORD len = 4;
|
|
||||||
|
|
||||||
sprintf( xriid, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
|
||||||
riid->Data1, riid->Data2, riid->Data3,
|
|
||||||
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
|
|
||||||
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
|
|
||||||
TRACE("%s\n",xriid );
|
|
||||||
|
|
||||||
if (!szDest) return FALSE;
|
|
||||||
*szDest = SFGAO_FOLDER|SFGAO_FILESYSTEM;
|
|
||||||
|
|
||||||
strcat (xriid, "\\ShellFolder");
|
|
||||||
|
|
||||||
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
|
|
||||||
{
|
{
|
||||||
|
HKEY hSFKey;
|
||||||
|
LPOLESTR pwszCLSID;
|
||||||
|
LONG lResult;
|
||||||
|
DWORD dwTemp, dwLen;
|
||||||
|
static const WCHAR wszAttributes[] = { 'A','t','t','r','i','b','u','t','e','s',0 };
|
||||||
|
static const WCHAR wszCallForAttributes[] = {
|
||||||
|
'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0 };
|
||||||
|
WCHAR wszShellFolderKey[] = { 'C','L','S','I','D','\\','{','0','0','0','2','1','4','0','0','-',
|
||||||
|
'0','0','0','0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0','0',
|
||||||
|
'0','0','0','4','6','}','\\','S','h','e','l','l','F','o','l','d','e','r',0 };
|
||||||
|
|
||||||
|
TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes);
|
||||||
|
|
||||||
|
if (!_ILIsPidlSimple(pidlFolder)) {
|
||||||
|
ERR("HCR_GetFolderAttributes should be called for simple PIDL's only!\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegQueryValueExA(hkey,"Attributes",0,NULL,(LPBYTE)&attributes,&len))
|
if (!_ILIsDesktop(pidlFolder)) {
|
||||||
{
|
if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE;
|
||||||
RegCloseKey(hkey);
|
memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR));
|
||||||
return FALSE;
|
CoTaskMemFree(pwszCLSID);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey);
|
||||||
|
if (lResult != ERROR_SUCCESS) return FALSE;
|
||||||
|
|
||||||
TRACE("-- 0x%08lx\n", attributes);
|
dwLen = sizeof(DWORD);
|
||||||
|
lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
|
||||||
|
if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) {
|
||||||
|
LPSHELLFOLDER psfDesktop, psfFolder;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
*szDest = attributes;
|
RegCloseKey(hSFKey);
|
||||||
|
hr = SHGetDesktopFolder(&psfDesktop);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder,
|
||||||
|
(LPVOID*)&psfFolder);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IShellFolder_Release(psfFolder);
|
||||||
|
IShellFolder_Release(psfDesktop);
|
||||||
|
if (FAILED(hr)) return FALSE;
|
||||||
|
} else {
|
||||||
|
lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
|
||||||
|
RegCloseKey(hSFKey);
|
||||||
|
if (lResult == ERROR_SUCCESS) {
|
||||||
|
*pdwAttributes &= dwTemp;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("-- *pdwAttributes == 0x%08lx\n", *pdwAttributes);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL b
|
||||||
BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr);
|
BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr);
|
||||||
BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
|
BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
|
||||||
|
|
||||||
BOOL HCR_GetFolderAttributes(REFIID riid, LPDWORD szDest);
|
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
|
||||||
|
|
||||||
INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
|
INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
|
||||||
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
|
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
|
||||||
|
|
|
@ -372,7 +372,6 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
|
||||||
*/
|
*/
|
||||||
HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
|
HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
|
||||||
{
|
{
|
||||||
GUID const *clsid;
|
|
||||||
DWORD dwAttributes;
|
DWORD dwAttributes;
|
||||||
static const DWORD dwSupportedAttr=
|
static const DWORD dwSupportedAttr=
|
||||||
SFGAO_CANCOPY | /*0x00000001 */
|
SFGAO_CANCOPY | /*0x00000001 */
|
||||||
|
@ -399,12 +398,12 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ILIsDrive (pidl)) {
|
if (_ILIsDrive (pidl)) {
|
||||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
||||||
} else if ((clsid = _ILGetGUIDPointer (pidl))) {
|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
||||||
if (HCR_GetFolderAttributes (clsid, &dwAttributes)) {
|
} else if (_ILGetGUIDPointer (pidl)) {
|
||||||
*pdwAttributes &= dwAttributes;
|
if (!HCR_GetFolderAttributes (pidl, pdwAttributes)) {
|
||||||
} else {
|
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
||||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
|
||||||
}
|
}
|
||||||
} else if (_ILGetDataPointer (pidl)) {
|
} else if (_ILGetDataPointer (pidl)) {
|
||||||
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
|
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
|
||||||
|
|
Loading…
Reference in New Issue