Author: janderwald
Date: Sun Nov 4 20:07:40 2007
New Revision: 30122
URL:
http://svn.reactos.org/svn/reactos?rev=30122&view=rev
Log:
- check if group policy is active
- in this case check if the shell extension has been registered as approved and only
accept it if it is listed
Modified:
trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original)
+++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Sun Nov 4 20:07:40 2007
@@ -80,7 +80,7 @@
} ItemCmImpl;
UINT
-SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject
* pDataObj);
+SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject
* pDataObj, DWORD bGroupPolicyActive);
WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls);
WCHAR *strdupW(LPWSTR str);
static const IContextMenu2Vtbl cmvt;
@@ -310,9 +310,22 @@
UINT idCmdFirst = 0x6000;
UINT idCmdLast = 0xFFF0;
PDynamicShellEntry curEntry;
+ DWORD bGroupPolicyActive = FALSE;
+ DWORD dwSize;
static WCHAR szAny[] = { '*',0};
- SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj);
+ dwSize = sizeof(DWORD);
+ RegGetValueW(HKEY_CURRENT_USER,
+
L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
+ L"EnforceShellExtensionSecurity",
+ RRF_RT_DWORD,
+ NULL,
+ &bGroupPolicyActive,
+ &dwSize);
+
+
+
+ SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj, bGroupPolicyActive);
for (i = 0; i < This->cidl; i++)
{
@@ -326,7 +339,7 @@
if (hr == S_OK)
{
memcpy(&buffer[6], pwszCLSID, 38 * sizeof(WCHAR));
- SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj);
+ SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj,
bGroupPolicyActive);
}
}
@@ -335,7 +348,7 @@
ebuf[0] = L'.';
buffer[0] = L'\0';
if (MultiByteToWideChar(CP_ACP, 0, ebuf, -1, buffer, 111))
- SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj);
+ SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj,
bGroupPolicyActive);
}
}
TRACE("-- done loading\n");
@@ -1159,7 +1172,7 @@
}
UINT
-SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This,
IDataObject * pDataObj)
+SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This,
IDataObject * pDataObj, DWORD bGroupPolicyActive)
{
HKEY hKey;
WCHAR szKey[MAX_PATH] = {0};
@@ -1191,18 +1204,53 @@
if (res == ERROR_SUCCESS)
{
hResult = CLSIDFromString(szName, &clsid);
- if (hResult != NOERROR)
+ if (hResult != S_OK)
{
dwName = MAX_PATH;
if (RegGetValueW(hKey, szName, NULL, RRF_RT_REG_SZ, NULL, szKey,
&dwName) == ERROR_SUCCESS)
{
- hResult = CLSIDFromString(szKey, &clsid);
+ if (CLSIDFromString(szKey, &clsid) == S_OK)
+ {
+ if (bGroupPolicyActive)
+ {
+ if (RegGetValueW(HKEY_LOCAL_MACHINE,
+
L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved",
+ szKey,
+ RRF_RT_REG_SZ,
+ NULL,
+ NULL,
+ &dwName) == ERROR_SUCCESS)
+ {
+ SH_LoadDynamicContextMenuHandler(hKey, &clsid, This,
pDataObj);
+ }
+
+ }
+ else
+ {
+ SH_LoadDynamicContextMenuHandler(hKey, &clsid, This,
pDataObj);
+ }
+ }
}
}
- TRACE("hResult %x szKey %s name %s\n",hResult, debugstr_w(szKey),
debugstr_w(szName));
if (hResult == S_OK)
{
- SH_LoadDynamicContextMenuHandler(hKey, &clsid, This, pDataObj);
+ if (bGroupPolicyActive)
+ {
+ if (RegGetValueW(HKEY_LOCAL_MACHINE,
+
L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved",
+ szKey,
+ RRF_RT_REG_SZ,
+ NULL,
+ NULL,
+ &dwName) == ERROR_SUCCESS)
+ {
+ SH_LoadDynamicContextMenuHandler(hKey, &clsid, This, pDataObj);
+ }
+ }
+ else
+ {
+ SH_LoadDynamicContextMenuHandler(hKey, &clsid, This, pDataObj);
+ }
}
}
dwIndex++;