twinapi.appcore: Implement Windows.System.Profile.AnalyticsInfo_get_DeviceFamilyVersion.
This commit is contained in:
parent
377aac9c6a
commit
2b22cf580e
4 changed files with 44 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
EXTRADEFS = -D_CONTRACT_GEN
|
||||
MODULE = twinapi.appcore.dll
|
||||
IMPORTS = combase
|
||||
IMPORTS = combase advapi32
|
||||
|
||||
SOURCES = \
|
||||
analytics_info.c \
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "private.h"
|
||||
|
||||
#include "winternl.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(twinapi);
|
||||
|
||||
struct analytics_version_info
|
||||
|
@ -95,8 +97,23 @@ static HRESULT WINAPI analytics_version_info_get_DeviceFamily( IAnalyticsVersion
|
|||
|
||||
static HRESULT WINAPI analytics_version_info_get_DeviceFamilyVersion( IAnalyticsVersionInfo *iface, HSTRING *value )
|
||||
{
|
||||
FIXME( "iface %p, value %p stub!\n", iface, value );
|
||||
return E_NOTIMPL;
|
||||
DWORD revision, size;
|
||||
WCHAR buffer[32];
|
||||
UINT64 version;
|
||||
UINT len;
|
||||
|
||||
TRACE( "iface %p, value %p\n", iface, value );
|
||||
|
||||
if (RegGetValueW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"UBR",
|
||||
RRF_RT_REG_DWORD, NULL, &revision, &size ))
|
||||
revision = 0;
|
||||
version = NtCurrentTeb()->Peb->OSMajorVersion & 0xffff;
|
||||
version = (version << 16) | (NtCurrentTeb()->Peb->OSMinorVersion & 0xffff);
|
||||
version = (version << 16) | (NtCurrentTeb()->Peb->OSBuildNumber & 0xffff);
|
||||
version = (version << 16) | revision;
|
||||
|
||||
len = swprintf( buffer, ARRAY_SIZE(buffer), L"%I64u", version );
|
||||
return WindowsCreateString( buffer, len, value );
|
||||
}
|
||||
|
||||
static IAnalyticsVersionInfoVtbl analytics_version_info_vtbl =
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TESTDLL = twinapi.appcore.dll
|
||||
IMPORTS = combase
|
||||
IMPORTS = combase advapi32
|
||||
|
||||
SOURCES = \
|
||||
twinapi.c
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define COBJMACROS
|
||||
#include "initguid.h"
|
||||
#include "winstring.h"
|
||||
#include "winternl.h"
|
||||
#include "roapi.h"
|
||||
|
||||
#define WIDL_using_Windows_Foundation
|
||||
|
@ -118,6 +119,9 @@ static void test_AnalyticsVersionInfo(void)
|
|||
IAnalyticsVersionInfo *analytics_version_info;
|
||||
IActivationFactory *factory;
|
||||
HSTRING str, expect_str;
|
||||
DWORD revision, size;
|
||||
WCHAR buffer[32];
|
||||
UINT64 version;
|
||||
HRESULT hr;
|
||||
INT32 res;
|
||||
LONG ref;
|
||||
|
@ -158,6 +162,25 @@ static void test_AnalyticsVersionInfo(void)
|
|||
WindowsDeleteString( str );
|
||||
WindowsDeleteString( expect_str );
|
||||
|
||||
if (RegGetValueW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"UBR",
|
||||
RRF_RT_REG_DWORD, NULL, &revision, &size ))
|
||||
revision = 0;
|
||||
version = NtCurrentTeb()->Peb->OSMajorVersion & 0xffff;
|
||||
version = (version << 16) | (NtCurrentTeb()->Peb->OSMinorVersion & 0xffff);
|
||||
version = (version << 16) | (NtCurrentTeb()->Peb->OSBuildNumber & 0xffff);
|
||||
version = (version << 16) | revision;
|
||||
|
||||
res = swprintf( buffer, ARRAY_SIZE(buffer), L"%I64u", version );
|
||||
hr = WindowsCreateString( buffer, res, &expect_str );
|
||||
ok( hr == S_OK, "got hr %#lx.\n", hr );
|
||||
hr = IAnalyticsVersionInfo_get_DeviceFamilyVersion( analytics_version_info, &str );
|
||||
ok( hr == S_OK, "got hr %#lx.\n", hr );
|
||||
hr = WindowsCompareStringOrdinal( str, expect_str, &res );
|
||||
ok( hr == S_OK, "got hr %#lx.\n", hr );
|
||||
ok( !res || broken(revision == 0) /* Win11 */, "got unexpected string %s.\n", debugstr_hstring(str) );
|
||||
WindowsDeleteString( str );
|
||||
WindowsDeleteString( expect_str );
|
||||
|
||||
ref = IAnalyticsVersionInfo_Release( analytics_version_info );
|
||||
ok( ref == 0, "got ref %ld.\n", ref );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue