mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 11:04:52 +00:00
[SHELL32]
* Move shpolicy.cpp to the wine folder. * Rename shpolicy.cpp to shpolicy.c. * Sync shpolicy.c with Wine 1.7.27. CORE-8540 svn path=/branches/shell-experiments/; revision=65223
This commit is contained in:
parent
e24032eb8c
commit
fd9f0d8b86
2 changed files with 78 additions and 66 deletions
|
@ -63,7 +63,6 @@ list(APPEND SOURCE
|
|||
shlfsbind.cpp
|
||||
shlmenu.cpp
|
||||
shlview.cpp
|
||||
shpolicy.cpp
|
||||
stubs.cpp
|
||||
systray.cpp
|
||||
defcontextmenu.cpp
|
||||
|
@ -78,6 +77,7 @@ add_library(shell32 SHARED
|
|||
wine/shellole.c
|
||||
wine/shellpath.c
|
||||
wine/shellstring.c
|
||||
wine/shpolicy.c
|
||||
vista.c
|
||||
shell32.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/shell32_stubs.c
|
||||
|
|
|
@ -29,7 +29,19 @@
|
|||
* Up to date as of SHELL32 v5.00 (W2K)
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <shlobj.h>
|
||||
#include <wine/debug.h>
|
||||
|
||||
#include "shell32_main.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
|
||||
|
@ -37,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
|||
|
||||
typedef struct tagPOLICYDAT
|
||||
{
|
||||
RESTRICTIONS policy; /* policy value passed to SHRestricted */
|
||||
DWORD policy; /* policy value passed to SHRestricted */
|
||||
LPCSTR appstr; /* application str such as "Explorer" */
|
||||
LPCSTR keystr; /* name of the actual registry key / policy */
|
||||
DWORD cache; /* cached value or 0xffffffff for invalid */
|
||||
|
@ -776,13 +788,13 @@ static POLICYDATA sh32_policy_table[] =
|
|||
SHELL_NO_POLICY
|
||||
},
|
||||
{
|
||||
(RESTRICTIONS)0x50000024,
|
||||
0x50000024,
|
||||
strExplorer,
|
||||
strNoFileURL,
|
||||
SHELL_NO_POLICY
|
||||
},
|
||||
{
|
||||
(RESTRICTIONS)0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SHELL_NO_POLICY
|
||||
|
@ -790,7 +802,7 @@ static POLICYDATA sh32_policy_table[] =
|
|||
};
|
||||
|
||||
/*************************************************************************
|
||||
* SHRestricted [SHELL32.100]
|
||||
* SHRestricted [SHELL32.100]
|
||||
*
|
||||
* Get the value associated with a policy Id.
|
||||
*
|
||||
|
@ -812,51 +824,51 @@ static POLICYDATA sh32_policy_table[] =
|
|||
*/
|
||||
DWORD WINAPI SHRestricted (RESTRICTIONS policy)
|
||||
{
|
||||
char regstr[256];
|
||||
HKEY xhkey;
|
||||
DWORD retval, datsize = 4;
|
||||
LPPOLICYDATA p;
|
||||
char regstr[256];
|
||||
HKEY xhkey;
|
||||
DWORD retval, datsize = 4;
|
||||
LPPOLICYDATA p;
|
||||
|
||||
TRACE("(%08x)\n", policy);
|
||||
TRACE("(%08x)\n", policy);
|
||||
|
||||
/* scan to see if we know this policy ID */
|
||||
for (p = sh32_policy_table; p->policy; p++)
|
||||
{
|
||||
if (policy == p->policy)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* scan to see if we know this policy ID */
|
||||
for (p = sh32_policy_table; p->policy; p++)
|
||||
{
|
||||
if (policy == p->policy)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->policy == 0)
|
||||
{
|
||||
/* we don't know this policy, return 0 */
|
||||
TRACE("unknown policy: (%08x)\n", policy);
|
||||
return 0;
|
||||
}
|
||||
if (p->policy == 0)
|
||||
{
|
||||
/* we don't know this policy, return 0 */
|
||||
TRACE("unknown policy: (%08x)\n", policy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we have a known policy */
|
||||
/* we have a known policy */
|
||||
|
||||
/* first check if this policy has been cached, return it if so */
|
||||
if (p->cache != SHELL_NO_POLICY)
|
||||
{
|
||||
return p->cache;
|
||||
}
|
||||
/* first check if this policy has been cached, return it if so */
|
||||
if (p->cache != SHELL_NO_POLICY)
|
||||
{
|
||||
return p->cache;
|
||||
}
|
||||
|
||||
lstrcpyA(regstr, strRegistryPolicyA);
|
||||
lstrcatA(regstr, p->appstr);
|
||||
lstrcpyA(regstr, strRegistryPolicyA);
|
||||
lstrcatA(regstr, p->appstr);
|
||||
|
||||
/* return 0 and don't set the cache if any registry errors occur */
|
||||
retval = 0;
|
||||
if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
|
||||
{
|
||||
p->cache = retval;
|
||||
}
|
||||
RegCloseKey(xhkey);
|
||||
}
|
||||
return retval;
|
||||
/* return 0 and don't set the cache if any registry errors occur */
|
||||
retval = 0;
|
||||
if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
|
||||
{
|
||||
p->cache = retval;
|
||||
}
|
||||
RegCloseKey(xhkey);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -878,28 +890,28 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy)
|
|||
*/
|
||||
BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey)
|
||||
{
|
||||
TRACE("(%p, %p)\n", unused, inpRegKey);
|
||||
TRACE("(%p, %p)\n", unused, inpRegKey);
|
||||
|
||||
/* first check - if input is non-NULL and points to the secret
|
||||
key string, then pass. Otherwise return 0.
|
||||
*/
|
||||
if (inpRegKey != NULL)
|
||||
{
|
||||
if (SHELL_OsIsUnicode())
|
||||
{
|
||||
if (lstrcmpiW((LPCWSTR)inpRegKey, strRegistryPolicyW) &&
|
||||
lstrcmpiW((LPCWSTR)inpRegKey, strPolicyW))
|
||||
/* doesn't match, fail */
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lstrcmpiA((LPCSTR)inpRegKey, strRegistryPolicyA) &&
|
||||
lstrcmpiA((LPCSTR)inpRegKey, strPolicyA))
|
||||
/* doesn't match, fail */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* first check - if input is non-NULL and points to the secret
|
||||
key string, then pass. Otherwise return 0.
|
||||
*/
|
||||
if (inpRegKey != NULL)
|
||||
{
|
||||
if (SHELL_OsIsUnicode())
|
||||
{
|
||||
if (lstrcmpiW(inpRegKey, strRegistryPolicyW) &&
|
||||
lstrcmpiW(inpRegKey, strPolicyW))
|
||||
/* doesn't match, fail */
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lstrcmpiA(inpRegKey, strRegistryPolicyA) &&
|
||||
lstrcmpiA(inpRegKey, strPolicyA))
|
||||
/* doesn't match, fail */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
Loading…
Reference in a new issue