mirror of
https://github.com/reactos/reactos.git
synced 2024-06-27 00:11:35 +00:00
[SHELL32] shlexec: Initial support of App Paths (#4850)
- Fix SHELL_TryAppPathW helper function by using SHRegQueryValueExW function. - Fix SHRegQueryValueExA/W functions. CORE-11335
This commit is contained in:
parent
05d2935eed
commit
140aa11c36
|
@ -593,7 +593,6 @@ static LPWSTR SHELL_BuildEnvW( const WCHAR *path )
|
||||||
return new_env;
|
return new_env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SHELL_TryAppPathW [Internal]
|
* SHELL_TryAppPathW [Internal]
|
||||||
*
|
*
|
||||||
|
@ -604,9 +603,9 @@ static LPWSTR SHELL_BuildEnvW( const WCHAR *path )
|
||||||
*/
|
*/
|
||||||
static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env)
|
static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env)
|
||||||
{
|
{
|
||||||
HKEY hkApp = 0;
|
HKEY hkApp = NULL;
|
||||||
WCHAR buffer[1024];
|
WCHAR buffer[1024];
|
||||||
LONG len;
|
DWORD len, dwType;
|
||||||
LONG res;
|
LONG res;
|
||||||
BOOL found = FALSE;
|
BOOL found = FALSE;
|
||||||
|
|
||||||
|
@ -625,14 +624,17 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env)
|
||||||
}
|
}
|
||||||
|
|
||||||
len = MAX_PATH * sizeof(WCHAR);
|
len = MAX_PATH * sizeof(WCHAR);
|
||||||
res = RegQueryValueW(hkApp, NULL, lpResult, &len);
|
res = SHRegQueryValueExW(hkApp, NULL, NULL, &dwType, (LPBYTE)lpResult, &len);
|
||||||
if (res) goto end;
|
if (res != ERROR_SUCCESS || dwType != REG_SZ)
|
||||||
|
goto end;
|
||||||
|
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
|
|
||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
DWORD count = sizeof(buffer);
|
len = sizeof(buffer);
|
||||||
if (!RegQueryValueExW(hkApp, L"Path", NULL, NULL, (LPBYTE)buffer, &count) && buffer[0])
|
res = SHRegQueryValueExW(hkApp, L"Path", NULL, &dwType, (LPBYTE)buffer, &len);
|
||||||
|
if (res == ERROR_SUCCESS && dwType == REG_SZ && buffer[0])
|
||||||
*env = SHELL_BuildEnvW(buffer);
|
*env = SHELL_BuildEnvW(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
#include <wine/debug.h>
|
#include <wine/debug.h>
|
||||||
|
|
||||||
|
@ -73,16 +74,16 @@ HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWOR
|
||||||
* SHRegQueryValueExA [SHELL32.509]
|
* SHRegQueryValueExA [SHELL32.509]
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI SHRegQueryValueExA(
|
LONG WINAPI SHRegQueryValueExA(
|
||||||
HKEY hkey,
|
HKEY hkey,
|
||||||
LPSTR lpValueName,
|
LPCSTR lpValueName,
|
||||||
LPDWORD lpReserved,
|
LPDWORD lpReserved,
|
||||||
LPDWORD lpType,
|
LPDWORD lpType,
|
||||||
LPBYTE lpData,
|
LPBYTE lpData,
|
||||||
LPDWORD lpcbData)
|
LPDWORD lpcbData)
|
||||||
{
|
{
|
||||||
TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||||
return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
return SHQueryValueExA(hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -102,24 +103,18 @@ HRESULT WINAPI SHRegQueryValueW(
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* SHRegQueryValueExW [SHELL32.511] NT4.0
|
* SHRegQueryValueExW [SHELL32.511] NT4.0
|
||||||
*
|
|
||||||
* FIXME
|
|
||||||
* if the datatype REG_EXPAND_SZ then expand the string and change
|
|
||||||
* *pdwType to REG_SZ.
|
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI SHRegQueryValueExW (
|
LONG WINAPI SHRegQueryValueExW(
|
||||||
HKEY hkey,
|
HKEY hkey,
|
||||||
LPWSTR pszValue,
|
LPCWSTR pszValue,
|
||||||
LPDWORD pdwReserved,
|
LPDWORD pdwReserved,
|
||||||
LPDWORD pdwType,
|
LPDWORD pdwType,
|
||||||
LPVOID pvData,
|
LPVOID pvData,
|
||||||
LPDWORD pcbData)
|
LPDWORD pcbData)
|
||||||
{
|
{
|
||||||
DWORD ret;
|
TRACE("%p %s %p %p %p %p\n",
|
||||||
WARN("%p %s %p %p %p %p semi-stub\n",
|
|
||||||
hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
|
hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
|
||||||
ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
|
return SHQueryValueExW(hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -721,6 +721,26 @@ IStream* WINAPI SHGetViewStream(LPCITEMIDLIST, DWORD, LPCTSTR, LPCTSTR, LPCTSTR)
|
||||||
|
|
||||||
EXTERN_C HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey);
|
EXTERN_C HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey);
|
||||||
|
|
||||||
|
LONG WINAPI SHRegQueryValueExA(
|
||||||
|
HKEY hkey,
|
||||||
|
LPCSTR lpValueName,
|
||||||
|
LPDWORD lpReserved,
|
||||||
|
LPDWORD lpType,
|
||||||
|
LPBYTE lpData,
|
||||||
|
LPDWORD lpcbData);
|
||||||
|
LONG WINAPI SHRegQueryValueExW(
|
||||||
|
HKEY hkey,
|
||||||
|
LPCWSTR pszValue,
|
||||||
|
LPDWORD pdwReserved,
|
||||||
|
LPDWORD pdwType,
|
||||||
|
LPVOID pvData,
|
||||||
|
LPDWORD pcbData);
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define SHRegQueryValueEx SHRegQueryValueExW
|
||||||
|
#else
|
||||||
|
#define SHRegQueryValueEx SHRegQueryValueExA
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* INVALID_FILETITLE_CHARACTERS
|
* INVALID_FILETITLE_CHARACTERS
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue