mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[SHLWAPI] Switch Vista checks from preprocessor to dynamic
Check the OS version in the PEB to decide how to handle certain nthings. This allows to keep NT5 backwards compatibility, even if the the code is compiled for Vista, which is needed for Wine code.
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include "mshtmhst.h"
|
||||
#ifdef __REACTOS__
|
||||
#include <shlwapi_undoc.h>
|
||||
ULONG WINAPI GetProcessOsVersion(void);
|
||||
#endif
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
@@ -2325,11 +2326,10 @@ IsQSForward(_In_opt_ REFGUID pguidCmdGroup, _In_ ULONG cCmds, _In_ OLECMD *prgCm
|
||||
{
|
||||
if (!IsEqualGUID(&CGID_Explorer, pguidCmdGroup))
|
||||
{
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
return OLECMDERR_E_UNKNOWNGROUP;
|
||||
#else
|
||||
return OLECMDERR_E_NOTSUPPORTED;
|
||||
#endif
|
||||
if (GetProcessOsVersion() >= _WIN32_WINNT_VISTA)
|
||||
return OLECMDERR_E_UNKNOWNGROUP;
|
||||
else
|
||||
return OLECMDERR_E_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
for (iCmd = 0; iCmd < cCmds; ++iCmd)
|
||||
@@ -6097,12 +6097,10 @@ HRESULT WINAPI SHPropertyBag_ReadGUID(IPropertyBag *ppb, LPCWSTR pszPropName, GU
|
||||
bRet = VariantArrayToBuffer(&vari, pguid, sizeof(*pguid));
|
||||
else if (V_VT(&vari) == VT_BSTR)
|
||||
bRet = GUIDFromStringW(V_BSTR(&vari), pguid);
|
||||
else
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
else if (GetProcessOsVersion() >= _WIN32_WINNT_VISTA)
|
||||
bRet = FALSE;
|
||||
#else
|
||||
else
|
||||
bRet = TRUE; /* This is by design in WinXP/Win2k3. */
|
||||
#endif
|
||||
|
||||
if (!bRet)
|
||||
ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#ifdef __REACTOS__
|
||||
EXTERN_C HRESULT VariantChangeTypeForRead(_Inout_ VARIANTARG *pvarg, _In_ VARTYPE vt);
|
||||
EXTERN_C ULONG WINAPI GetProcessOsVersion(void);
|
||||
#endif
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
@@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
|
||||
class CBasePropertyBag
|
||||
: public IPropertyBag
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA) || defined(__REACTOS__)
|
||||
, public IPropertyBag2
|
||||
#endif
|
||||
{
|
||||
@@ -50,15 +50,17 @@ public:
|
||||
{
|
||||
if (!ppvObject)
|
||||
return E_POINTER;
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
if (::IsEqualGUID(riid, IID_IPropertyBag2))
|
||||
|
||||
if (GetProcessOsVersion() < _WIN32_WINNT_VISTA)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = static_cast<IPropertyBag2*>(this);
|
||||
return S_OK;
|
||||
if (::IsEqualGUID(riid, IID_IPropertyBag2))
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = static_cast<IPropertyBag2*>(this);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (::IsEqualGUID(riid, IID_IUnknown) || ::IsEqualGUID(riid, IID_IPropertyBag))
|
||||
{
|
||||
AddRef();
|
||||
@@ -83,7 +85,7 @@ public:
|
||||
return m_cRefs;
|
||||
}
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA) || defined(__REACTOS__)
|
||||
// IPropertyBag2 interface (stubs)
|
||||
STDMETHODIMP Read(
|
||||
_In_ ULONG cProperties,
|
||||
@@ -164,13 +166,14 @@ CMemPropertyBag::Read(
|
||||
|
||||
::VariantInit(pvari);
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
if (!MODE_CAN_READ(m_dwMode))
|
||||
if (GetProcessOsVersion() < _WIN32_WINNT_VISTA)
|
||||
{
|
||||
ERR("%p: 0x%X\n", this, m_dwMode);
|
||||
return E_ACCESSDENIED;
|
||||
if (!MODE_CAN_READ(m_dwMode))
|
||||
{
|
||||
ERR("%p: 0x%X\n", this, m_dwMode);
|
||||
return E_ACCESSDENIED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pszPropName || !pvari)
|
||||
{
|
||||
@@ -209,13 +212,14 @@ CMemPropertyBag::Write(
|
||||
{
|
||||
TRACE("%p: %s %p\n", this, debugstr_w(pszPropName), pvari);
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
|
||||
if (!MODE_CAN_WRITE(m_dwMode))
|
||||
if (GetProcessOsVersion() < _WIN32_WINNT_VISTA)
|
||||
{
|
||||
ERR("%p: 0x%X\n", this, m_dwMode);
|
||||
return E_ACCESSDENIED;
|
||||
if (!MODE_CAN_WRITE(m_dwMode))
|
||||
{
|
||||
ERR("%p: 0x%X\n", this, m_dwMode);
|
||||
return E_ACCESSDENIED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pszPropName || !pvari)
|
||||
{
|
||||
|
||||
@@ -1240,3 +1240,9 @@ BOOL WINAPI SHGetFileDescriptionA(
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXTERN_C ULONG WINAPI GetProcessOsVersion(void)
|
||||
{
|
||||
PPEB Peb = NtCurrentTeb()->Peb;
|
||||
return (Peb->OSMajorVersion << 8) | Peb->OSMinorVersion;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user