mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 20:33:22 +00:00
[SHELL32][SHELL32_APITEST][SDK] Implement SHSetUnreadMailCountW (#7620)
Implementing missing features... JIRA issue: CORE-19278 - Move function definition from stubs.cpp into utils.cpp. - Add prototype to <shellapi.h>.
This commit is contained in:
parent
dc25409cbf
commit
2da2fba042
6 changed files with 125 additions and 13 deletions
|
@ -796,6 +796,64 @@ SHCreatePropertyBag(_In_ REFIID riid, _Out_ void **ppvObj)
|
|||
return SHCreatePropertyBagOnMemory(STGM_READWRITE, riid, ppvObj);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHSetUnreadMailCountW [SHELL32.336]
|
||||
*
|
||||
* @see https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shsetunreadmailcountw
|
||||
*/
|
||||
EXTERN_C
|
||||
HRESULT WINAPI
|
||||
SHSetUnreadMailCountW(
|
||||
_In_ PCWSTR pszMailAddress,
|
||||
_In_ DWORD dwCount,
|
||||
_In_ PCWSTR pszShellExecuteCommand)
|
||||
{
|
||||
CString strKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail";
|
||||
strKey += L'\\';
|
||||
strKey += pszMailAddress;
|
||||
|
||||
HKEY hKey;
|
||||
DWORD dwDisposition;
|
||||
LSTATUS error = RegCreateKeyExW(HKEY_CURRENT_USER, strKey, 0, NULL, 0, KEY_SET_VALUE, NULL,
|
||||
&hKey, &dwDisposition);
|
||||
if (error)
|
||||
return HRESULT_FROM_WIN32(error);
|
||||
|
||||
error = RegSetValueExW(hKey, L"MessageCount", 0, REG_DWORD, (PBYTE)&dwCount, sizeof(dwCount));
|
||||
if (error)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return HRESULT_FROM_WIN32(error);
|
||||
}
|
||||
|
||||
FILETIME FileTime;
|
||||
GetSystemTimeAsFileTime(&FileTime);
|
||||
|
||||
error = RegSetValueExW(hKey, L"TimeStamp", 0, REG_BINARY, (PBYTE)&FileTime, sizeof(FileTime));
|
||||
if (error)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return HRESULT_FROM_WIN32(error);
|
||||
}
|
||||
|
||||
WCHAR szBuff[2 * MAX_PATH];
|
||||
if (!PathUnExpandEnvStringsW(pszShellExecuteCommand, szBuff, _countof(szBuff)))
|
||||
{
|
||||
HRESULT hr = StringCchCopyW(szBuff, _countof(szBuff), pszShellExecuteCommand);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD cbValue = (lstrlenW(szBuff) + 1) * sizeof(WCHAR);
|
||||
error = RegSetValueExW(hKey, L"Application", 0, REG_SZ, (PBYTE)szBuff, cbValue);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return (error ? HRESULT_FROM_WIN32(error) : S_OK);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SheRemoveQuotesA (SHELL32.@)
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue