[SHLWAPI][SDK] Implement SHPropertyBag_WriteDWORD etc. (#5467)

CORE-9283
This commit is contained in:
Katayama Hirofumi MZ 2023-07-24 07:12:05 +09:00 committed by GitHub
parent 02a19c314f
commit dad99e3bd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 144 additions and 25 deletions

View file

@ -5322,42 +5322,154 @@ HRESULT WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LP
}
#ifdef __REACTOS__
/**************************************************************************
* SHPropertyBag_WriteBOOL (SHLWAPI.499)
*/
HRESULT WINAPI SHPropertyBag_WriteBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bValue)
{
VARIANT vari;
TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), bValue);
if (!ppb || !pszPropName)
{
ERR("%p %s\n", ppb, debugstr_w(pszPropName));
return E_INVALIDARG;
}
V_VT(&vari) = VT_BOOL;
V_BOOL(&vari) = (bValue ? VARIANT_TRUE : VARIANT_FALSE); /* NOTE: VARIANT_TRUE is (SHORT)-1 */
return IPropertyBag_Write(ppb, pszPropName, &vari);
}
/**************************************************************************
* SHPropertyBag_WriteSHORT (SHLWAPI.528)
*/
HRESULT WINAPI SHPropertyBag_WriteSHORT(IPropertyBag *ppb, LPCWSTR pszPropName, SHORT sValue)
{
VARIANT vari;
TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), sValue);
if (!ppb || !pszPropName)
{
ERR("%p %s\n", ppb, debugstr_w(pszPropName));
return E_INVALIDARG;
}
V_VT(&vari) = VT_UI2;
V_UI2(&vari) = sValue;
return IPropertyBag_Write(ppb, pszPropName, &vari);
}
/**************************************************************************
* SHPropertyBag_WriteLONG (SHLWAPI.497)
*
* This function asks a property bag to write a named property as a LONG.
*
* PARAMS
* ppb: a IPropertyBag interface
* pszPropName: Unicode string that names the property
* lValue: address to receive the property value as a 32-bit signed integer
*
* RETURNS
* HRESULT codes
*/
HRESULT WINAPI SHPropertyBag_WriteLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LONG lValue)
{
UNIMPLEMENTED;
return E_NOTIMPL;
VARIANT vari;
TRACE("%p %s %ld\n", ppb, debugstr_w(pszPropName), lValue);
if (!ppb || !pszPropName)
{
ERR("%p %s\n", ppb, debugstr_w(pszPropName));
return E_INVALIDARG;
}
V_VT(&vari) = VT_I4;
V_I4(&vari) = lValue;
return IPropertyBag_Write(ppb, pszPropName, &vari);
}
/**************************************************************************
* SHPropertyBag_WriteDWORD (SHLWAPI.508)
*/
HRESULT WINAPI SHPropertyBag_WriteDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD dwValue)
{
VARIANT vari;
TRACE("%p %s %lu\n", ppb, debugstr_w(pszPropName), dwValue);
if (!ppb || !pszPropName)
{
ERR("%p %s\n", ppb, debugstr_w(pszPropName));
return E_INVALIDARG;
}
V_VT(&vari) = VT_UI4;
V_UI4(&vari) = dwValue;
return IPropertyBag_Write(ppb, pszPropName, &vari);
}
/**************************************************************************
* SHPropertyBag_WriteStr (SHLWAPI.495)
*
* This function asks a property bag to write a string as the value of a named property.
*
* PARAMS
* ppb: a IPropertyBag interface
* pszPropName: Unicode string that names the property
* pValue: address to write the property value
*
* RETURNS
* HRESULT codes
*/
HRESULT WINAPI SHPropertyBag_WriteStr(IPropertyBag *ppb, LPCWSTR pszPropName, LPCWSTR pszValue)
{
UNIMPLEMENTED;
return E_NOTIMPL;
HRESULT hr;
VARIANT vari;
TRACE("%p %s %s\n", ppb, debugstr_w(pszPropName), debugstr_w(pszValue));
if (!ppb || !pszPropName)
{
ERR("%p %s\n", ppb, debugstr_w(pszPropName));
return E_INVALIDARG;
}
V_BSTR(&vari) = SysAllocString(pszValue);
if (!V_BSTR(&vari))
return E_OUTOFMEMORY;
V_VT(&vari) = VT_BSTR;
hr = IPropertyBag_Write(ppb, pszPropName, &vari);
SysFreeString(V_BSTR(&vari));
return hr;
}
/**************************************************************************
* SHPropertyBag_WriteGUID (SHLWAPI.506)
*/
HRESULT WINAPI SHPropertyBag_WriteGUID(IPropertyBag *ppb, LPCWSTR pszPropName, const GUID *pguid)
{
WCHAR szBuff[64];
TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
if (!ppb || !pszPropName || !pguid)
{
ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
return E_INVALIDARG;
}
SHStringFromGUIDW(pguid, szBuff, _countof(szBuff));
return SHPropertyBag_WriteStr(ppb, pszPropName, szBuff);
}
/**************************************************************************
* SHPropertyBag_WriteStream (SHLWAPI.532)
*/
HRESULT WINAPI SHPropertyBag_WriteStream(IPropertyBag *ppb, LPCWSTR pszPropName, IStream *pStream)
{
VARIANT vari;
TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
if (!ppb || !pszPropName || !pStream)
{
ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
return E_INVALIDARG;
}
V_VT(&vari) = VT_UNKNOWN;
V_UNKNOWN(&vari) = (IUnknown*)pStream;
return IPropertyBag_Write(ppb, pszPropName, &vari);
}
#endif

View file

@ -496,16 +496,16 @@
496 stdcall -noname SHPropertyBag_ReadLONG(ptr wstr ptr)
497 stdcall -noname SHPropertyBag_WriteLONG(ptr wstr long)
498 stub -noname SHPropertyBag_ReadBOOLOld
499 stub -noname SHPropertyBag_WriteBOOL
499 stdcall -noname SHPropertyBag_WriteBOOL(ptr wstr long)
500 stdcall AssocGetPerceivedType(wstr ptr ptr ptr)
501 stdcall AssocIsDangerous(wstr)
502 stdcall AssocQueryKeyA(long long str str ptr)
503 stdcall AssocQueryKeyW(long long wstr wstr ptr)
504 stdcall AssocQueryStringA(long long str str ptr ptr)
505 stub -noname SHPropertyBag_ReadGUID
506 stub -noname SHPropertyBag_WriteGUID
506 stdcall -noname SHPropertyBag_WriteGUID(ptr wstr ptr)
507 stdcall -stub -noname SHPropertyBag_ReadDWORD(ptr ptr ptr)
508 stub -noname SHPropertyBag_WriteDWORD
508 stdcall -noname SHPropertyBag_WriteDWORD(ptr wstr long)
509 stdcall -noname IUnknown_OnFocusChangeIS(ptr ptr long)
510 stdcall -noname SHLockSharedEx(ptr long long)
511 stdcall -stub -noname PathFileExistsDefExtAndAttributesW(wstr long ptr)
@ -525,11 +525,11 @@
525 stub -noname SHPropertyBag_ReadPOINTS
526 stub -noname SHPropertyBag_WritePOINTS
527 stub -noname SHPropertyBag_ReadSHORT
528 stub -noname SHPropertyBag_WriteSHORT
528 stdcall -noname SHPropertyBag_WriteSHORT(ptr wstr long)
529 stub -noname SHPropertyBag_ReadInt
530 stub -noname SHPropertyBag_WriteInt
531 stub -noname SHPropertyBag_ReadStream
532 stub -noname SHPropertyBag_WriteStream
532 stdcall -noname SHPropertyBag_WriteStream(ptr wstr ptr)
533 stub -noname SHGetPerScreenResName
534 stub -noname SHPropertyBag_ReadBOOL
535 stub -noname SHPropertyBag_Delete

View file

@ -99,6 +99,13 @@ HRESULT WINAPI SHGetPerScreenResName(OUT LPWSTR lpResName,
IN DWORD dwReserved);
HRESULT WINAPI SHPropertyBag_ReadStream(IPropertyBag*,LPCWSTR,IStream**);
HRESULT WINAPI SHPropertyBag_WriteBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bValue);
HRESULT WINAPI SHPropertyBag_WriteSHORT(IPropertyBag *ppb, LPCWSTR pszPropName, SHORT sValue);
HRESULT WINAPI SHPropertyBag_WriteLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LONG lValue);
HRESULT WINAPI SHPropertyBag_WriteDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD dwValue);
HRESULT WINAPI SHPropertyBag_WriteStr(IPropertyBag *ppb, LPCWSTR pszPropName, LPCWSTR pszValue);
HRESULT WINAPI SHPropertyBag_WriteGUID(IPropertyBag *ppb, LPCWSTR pszPropName, const GUID *pguid);
HRESULT WINAPI SHPropertyBag_WriteStream(IPropertyBag *ppb, LPCWSTR pszPropName, IStream *pStream);
HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, DWORD dwExStyle,
DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra);