ReactOS 0.4.16-dev-927-g467dec4
SHSetUnreadMailCountW.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Test for SHSetUnreadMailCountW
5 * COPYRIGHT: Copyright 2025 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include "shelltest.h"
9
11{
12 HKEY hKey;
14 DWORD dwDisposition;
16 L"Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\example.com",
17 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dwDisposition);
20
21 HRESULT hr = SHSetUnreadMailCountW(L"example.com", 1, L"MyMailerApp");
22 ok_hex(hr, S_OK);
23
25 L"Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\example.com",
26 0,
28 &hKey);
30
31 DWORD dwValue, cbValue = sizeof(dwValue);
32 error = RegQueryValueExW(hKey, L"MessageCount", NULL, NULL, (PBYTE)&dwValue, &cbValue);
34 ok_long(dwValue, 1);
35
36 FILETIME FileTime;
37 cbValue = sizeof(FileTime);
38 error = RegQueryValueExW(hKey, L"TimeStamp", NULL, NULL, (PBYTE)&FileTime, &cbValue);
40 ok(FileTime.dwHighDateTime != 0, "FileTime.dwHighDateTime was zero\n");
41
42 WCHAR szValue[MAX_PATH];
43 cbValue = sizeof(szValue);
44 error = RegQueryValueExW(hKey, L"Application", NULL, NULL, (PBYTE)szValue, &cbValue);
46 ok_wstr(szValue, L"MyMailerApp");
47
49
50 hr = SHSetUnreadMailCountW(L"example.com", 0, L"MyMailerApp");
51 ok_hex(hr, S_OK);
52
53 if (dwDisposition == REG_CREATED_NEW_KEY)
54 {
56 L"Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\example.com");
57 }
58}
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok_long(expression, result)
Definition: atltest.h:133
#define ok(value,...)
Definition: atltest.h:57
#define ok_wstr(x, y)
Definition: atltest.h:130
#define START_TEST(x)
Definition: atltest.h:75
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define MAX_PATH
Definition: compat.h:34
EXTERN_C HRESULT WINAPI SHSetUnreadMailCountW(_In_ PCWSTR pszMailAddress, _In_ DWORD dwCount, _In_ PCWSTR pszShellExecuteCommand)
Definition: utils.cpp:1006
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define S_OK
Definition: intsafe.h:52
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_READ
Definition: nt_native.h:1023
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
#define KEY_WRITE
Definition: nt_native.h:1031
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
HRESULT hr
Definition: shlfolder.c:183
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180