[SHPOLICY] Fix the missing backslash in SHRestricted. CORE-15666 (#1267)
[reactos.git] / dll / win32 / shell32 / wine / shpolicy.c
index 1e1c919..97f938a 100644 (file)
@@ -815,7 +815,7 @@ static POLICYDATA sh32_policy_table[] =
  * NOTES
  *     Exported by ordinal.
  *     This function caches the retrieved values to prevent unnecessary registry access,
- *     if SHInitRestricted() was previously called.
+ *     if SHSettingsChanged() was previously called.
  *
  * REFERENCES
  *     a: MS System Policy Editor.
@@ -856,11 +856,23 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy)
        }
 
        lstrcpyA(regstr, strRegistryPolicyA);
+       lstrcatA(regstr, "\\");
        lstrcatA(regstr, p->appstr);
 
        /* return 0 and don't set the cache if any registry errors occur */
+#ifndef __REACTOS__
        retval = 0;
        if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
+#else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup()
+      // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm
+    retval = RegOpenKeyA(HKEY_LOCAL_MACHINE, regstr, &xhkey);
+    if (retval != ERROR_SUCCESS)
+    {
+        retval = RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey);
+        if (retval != ERROR_SUCCESS)
+            return 0;
+    }
+#endif
        {
          if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
          {
@@ -872,7 +884,7 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy)
 }
 
 /*************************************************************************
- * SHInitRestricted          [SHELL32.244]
+ * SHSettingsChanged          [SHELL32.244]
  *
  * Initialise the policy cache to speed up calls to SHRestricted().
  *
@@ -888,7 +900,7 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy)
  * NOTES
  *  Exported by ordinal. Introduced in Win98.
  */
-BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey)
+BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey)
 {
        TRACE("(%p, %p)\n", unused, inpRegKey);