Commit 40cfe48b authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Implemented SHLWAPI_266 and SHLWAPI_271.

parent 77357a3f
......@@ -46,6 +46,7 @@
#include "winuser.h"
#include "wine/debug.h"
#include "shlwapi.h"
#include "ordinal.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
......@@ -1068,7 +1069,6 @@ HRESULT WINAPI SHLWAPI_168(IUnknown* lpUnkSink, REFIID riid, BOOL bAdviseOnly,
/*************************************************************************
* @ [SHLWAPI.169]
*
*
* Release an interface.
*
* PARAMS
......@@ -1371,7 +1371,7 @@ DWORD WINAPI SHLWAPI_180(HMENU hMenu)
* bEnable [I] Whether to enable (TRUE) or disable (FALSE) the item.
*
* RETURNS
* The return code from CheckMenuItem.
* The return code from EnableMenuItem.
*/
UINT WINAPI SHLWAPI_181(HMENU hMenu, UINT wItemID, BOOL bEnable)
{
......@@ -1912,24 +1912,90 @@ DWORD WINAPI SHLWAPI_241 ()
return /* 0xabba1243 */ 0;
}
/* default shell policy registry key */
static WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
's','o','f','t','\\','W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','P','o','l','i','c','i','e','s',0};
/*************************************************************************
* @ [SHLWAPI.271]
*
* Retrieve a policy value from the registry.
*
* PARAMS
* lpSubKey [I] registry key name
* lpSubName [I] subname of registry key
* lpValue [I] value name of registry value
*
* RETURNS
* the value associated with the registry key or 0 if not found
*/
DWORD WINAPI SHLWAPI_271(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpValue)
{
DWORD retval, datsize = 4;
HKEY hKey;
if (!lpSubKey)
lpSubKey = (LPCWSTR)strRegistryPolicyW;
retval = RegOpenKeyW(HKEY_LOCAL_MACHINE, lpSubKey, &hKey);
if (retval != ERROR_SUCCESS)
retval = RegOpenKeyW(HKEY_CURRENT_USER, lpSubKey, &hKey);
if (retval != ERROR_SUCCESS)
return 0;
SHGetValueW(hKey, lpSubName, lpValue, NULL, (LPBYTE)&retval, &datsize);
RegCloseKey(hKey);
return retval;
}
/*************************************************************************
* @ [SHLWAPI.266]
* @ [SHLWAPI.266]
*
* Helper function to retrieve the possibly cached value for a specific policy
*
* PARAMS
* policy [I] The policy to look for
* initial [I] Main registry key to open, if NULL use default
* polTable [I] Table of known policies, 0 terminated
* polArr [I] Cache array of policy values
*
* native does at least approximately:
* strcpyW(newstr, x);
* strcatW(newstr, "\\Restrictions");
* if (RegOpenKeyExA(80000001, newstr, 00000000,00000001,40520b78))
* return 0;
* *unknown*
* RETURNS
* The retrieved policy value or 0 if not successful
*
* NOTES
* This function is used by the native SHRestricted function to search for the
* policy and cache it once retrieved. The current Wine implementation uses a
* different POLICYDATA structure and implements a similar algorithme adapted to
* that structure.
*/
DWORD WINAPI SHLWAPI_266 (
LPVOID w,
LPVOID x, /* [in] partial registry key */
LPVOID y,
LPVOID z)
DWORD policy,
LPCWSTR initial, /* [in] partial registry key */
LPPOLICYDATA polTable,
LPDWORD polArr)
{
FIXME("(%p %p %p %p)stub\n",w,x,y,z);
return /* 0xabba1248 */ 0;
TRACE("(0x%08lx %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr);
if (!polTable || !polArr)
return 0;
for (;polTable->policy; polTable++, polArr++)
{
if (policy == polTable->policy)
{
/* we have a known policy */
/* check if this policy has been cached */
if (*polArr == SHELL_NO_POLICY)
*polArr = SHLWAPI_271(initial, polTable->appstr, polTable->keystr);
return *polArr;
}
}
/* we don't know this policy, return 0 */
TRACE("unknown policy: (%08lx)\n", policy);
return 0;
}
/*************************************************************************
......
......@@ -52,6 +52,17 @@ DWORD WINAPI SHLWAPI_2(LPCWSTR x, UNKNOWN_SHLWAPI_2 *y);
} \
} while (0)
/* SHLWAPI_266 definitions and structures */
#define SHELL_NO_POLICY -1
typedef struct tagPOLICYDATA
{
DWORD policy; /* flags value passed to SHRestricted */
LPCWSTR appstr; /* application str such as "Explorer" */
LPCWSTR keystr; /* name of the actual registry key / policy */
} POLICYDATA, *LPPOLICYDATA;
extern HMODULE SHLWAPI_hshell32;
/* Shared internal functions */
......
......@@ -212,7 +212,7 @@
212 stdcall @(ptr ptr long) SHLWAPI_212
213 stdcall @(ptr) SHLWAPI_213
214 stdcall @(ptr ptr) SHLWAPI_214
215 stdcall @(long long long) SHLWAPI_215
215 stdcall @(str ptr long) SHLWAPI_215
216 stub @
217 stdcall @(wstr ptr ptr) SHLWAPI_217
218 stdcall @(long wstr ptr ptr) SHLWAPI_218
......@@ -263,12 +263,12 @@
263 stub @
264 stub @
265 stub @
266 stdcall @(long long long long) SHLWAPI_266
266 stdcall @(long wstr ptr ptr) SHLWAPI_266
267 stdcall @(long long long long) SHLWAPI_267
268 stdcall @(long long) SHLWAPI_268
269 stub @
270 stub @
271 stub @
271 stdcall @(wstr wstr wstr) SHLWAPI_271
272 stub @
273 stub @
274 stub @
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment