[SHLWAPI][SHLWAPI_APITEST][SDK] Implement SHGetPerScreenResName (#5616)

CORE-9283
This commit is contained in:
Katayama Hirofumi MZ 2023-08-26 16:46:51 +09:00 committed by GitHub
parent 33e6490532
commit 32669f6caa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 5 deletions

View file

@ -13,6 +13,7 @@
#include <atlsimpcoll.h> // for CSimpleMap
#include <atlcomcli.h> // for CComVariant
#include <atlconv.h> // for CA2W and CW2A
#include <strsafe.h> // for StringC... functions
WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -1806,3 +1807,24 @@ EXTERN_C VOID FreeViewStatePropertyBagCache(VOID)
g_pCachedBag.Release();
::LeaveCriticalSection(&g_csBagCacheLock);
}
/**************************************************************************
* SHGetPerScreenResName (SHLWAPI.533)
*
* @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/getperscreenresname.htm
*/
INT WINAPI
SHGetPerScreenResName(
_Out_writes_(cchBuffer) LPWSTR pszBuffer,
_In_ INT cchBuffer,
_In_ DWORD dwReserved)
{
if (dwReserved)
return 0;
INT cxWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
INT cyHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
INT cMonitors = ::GetSystemMetrics(SM_CMONITORS);
StringCchPrintfW(pszBuffer, cchBuffer, L"%dx%d(%d)", cxWidth, cyHeight, cMonitors);
return lstrlenW(pszBuffer);
}

View file

@ -530,7 +530,7 @@
530 stdcall -noname SHPropertyBag_WriteInt(ptr wstr long) SHPropertyBag_WriteLONG
531 stdcall -noname SHPropertyBag_ReadStream(ptr wstr ptr)
532 stdcall -noname SHPropertyBag_WriteStream(ptr wstr ptr)
533 stub -noname SHGetPerScreenResName
533 stdcall -noname SHGetPerScreenResName(ptr long long)
534 stdcall -noname SHPropertyBag_ReadBOOL(ptr wstr ptr)
535 stdcall -noname SHPropertyBag_Delete(ptr wstr)
536 stdcall -stub -noname IUnknown_QueryServicePropertyBag(ptr long ptr ptr)

View file

@ -11,6 +11,7 @@
#include <stdio.h>
#include <shlwapi_undoc.h>
#include <versionhelpers.h>
#include <strsafe.h>
#include <pseh/pseh2.h>
@ -688,7 +689,7 @@ static void SHPropertyBag_SHSetIniStringW(void)
DeleteFileW(szIniFile);
}
void SHPropertyBag_OnIniFile(void)
static void SHPropertyBag_OnIniFile(void)
{
WCHAR szIniFile[MAX_PATH], szValue[MAX_PATH];
HRESULT hr;
@ -823,6 +824,18 @@ void SHPropertyBag_OnIniFile(void)
DeleteFileW(szIniFile);
}
static void SHPropertyBag_PerScreenRes(void)
{
WCHAR szBuff1[64], szBuff2[64];
StringCchPrintfW(szBuff1, _countof(szBuff1), L"%dx%d(%d)",
GetSystemMetrics(SM_CXFULLSCREEN), GetSystemMetrics(SM_CYFULLSCREEN),
GetSystemMetrics(SM_CMONITORS));
szBuff2[0] = UNICODE_NULL;
SHGetPerScreenResName(szBuff2, _countof(szBuff2), 0);
ok_wstr(szBuff1, szBuff2);
}
START_TEST(SHPropertyBag)
{
SHPropertyBag_ReadTest();
@ -831,4 +844,5 @@ START_TEST(SHPropertyBag)
SHPropertyBag_OnRegKey();
SHPropertyBag_SHSetIniStringW();
SHPropertyBag_OnIniFile();
SHPropertyBag_PerScreenRes();
}

View file

@ -108,9 +108,11 @@ HRESULT WINAPI SHPropertyBag_ReadRECTL(IPropertyBag *ppb, LPCWSTR pszPropName, R
HRESULT WINAPI SHPropertyBag_ReadGUID(IPropertyBag *ppb, LPCWSTR pszPropName, GUID *pguid);
HRESULT WINAPI SHPropertyBag_ReadStream(IPropertyBag *ppb, LPCWSTR pszPropName, IStream **ppStream);
HRESULT WINAPI SHGetPerScreenResName(OUT LPWSTR lpResName,
IN INT cchResName,
IN DWORD dwReserved);
INT WINAPI
SHGetPerScreenResName(
_Out_writes_(cchBuffer) LPWSTR pszBuffer,
_In_ INT cchBuffer,
_In_ DWORD dwReserved);
HRESULT WINAPI SHPropertyBag_Delete(IPropertyBag *ppb, LPCWSTR pszPropName);
HRESULT WINAPI SHPropertyBag_WriteBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bValue);