* 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);
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 */
SHELL_NO_POLICY
},
{
- (RESTRICTIONS)0x50000024,
+ 0x50000024,
strExplorer,
strNoFileURL,
SHELL_NO_POLICY
},
{
- (RESTRICTIONS)0,
+ 0,
0,
0,
SHELL_NO_POLICY
};
/*************************************************************************
- * SHRestricted [SHELL32.100]
+ * SHRestricted [SHELL32.100]
*
* Get the value associated with a policy Id.
*
*/
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;
}
/*************************************************************************
*/
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;
}