Attached windows demo code and results run on windows as follows:
[main.cpp](/uploads/35cda6fb47c99ee464e6638653f052eb/main.cpp)
[ConsoleApplication1.exe](/uploads/8dd927ed1723a8483998ccdb990916fe/ConsoleApplication1.exe)

and after add implementation , the running results in Wine are consistent with those in Windows
Signed-off-by: chenjiangyi chenjiangyi@uniontech.com
From: chenjiangyi chenjiangyi@uniontech.com
Signed-off-by: chenjiangyi chenjiangyi@uniontech.com --- dlls/wintypes/main.c | 47 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index cb0a9b6fab0..8cd6227679f 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -25,10 +25,15 @@ static const struct { const WCHAR *name; unsigned int max_major; + unsigned int max_minor; } present_contracts[] = { - { L"Windows.Foundation.UniversalApiContract", 10, }, + { L"Windows.Foundation.UniversalApiContract", 10, 0, }, + { L"Windows.Foundation.FoundationContract", 4, 0, }, + { L"Windows.Networking.Connectivity.WwanContract", 2, 0, }, + { L"Windows.Services.Store.StoreContract", 4, 0, }, + { L"Windows.System.SystemManagementContract", 7, 0, }, };
static BOOLEAN is_api_contract_present( const HSTRING hname, unsigned int version ) @@ -243,13 +248,17 @@ static HRESULT STDMETHODCALLTYPE api_information_statics_IsEnumNamedValuePresent static HRESULT STDMETHODCALLTYPE api_information_statics_IsApiContractPresentByMajor( IApiInformationStatics *iface, HSTRING contract_name, UINT16 major_version, BOOLEAN *value) { - FIXME("iface %p, contract_name %s, major_version %u, value %p semi-stub.\n", iface, + const WCHAR *name; + FIXME("iface %p, contract_name %s, major_version %u, value %p.\n", iface, debugstr_hstring(contract_name), major_version, value);
- if (!contract_name) + if (!contract_name || !value) + return E_INVALIDARG; + + if (!WindowsGetStringLen(contract_name)) return E_INVALIDARG;
- *value = is_api_contract_present( contract_name, major_version ); + *value = is_api_contract_present(contract_name, major_version); return S_OK; }
@@ -257,13 +266,37 @@ static HRESULT STDMETHODCALLTYPE api_information_statics_IsApiContractPresentByM IApiInformationStatics *iface, HSTRING contract_name, UINT16 major_version, UINT16 minor_version, BOOLEAN *value) { - FIXME("iface %p, contract_name %s, major_version %u, minor_version %u, value %p stub!\n", iface, + const WCHAR *name; + unsigned int i; + + FIXME("iface %p, contract_name %s, major_version %u, minor_version %u, value %p.\n", iface, debugstr_hstring(contract_name), major_version, minor_version, value);
- if (!contract_name) + if (!contract_name || !value) return E_INVALIDARG;
- return E_NOTIMPL; + if (!WindowsGetStringLen(contract_name)) + return E_INVALIDARG; + + name = WindowsGetStringRawBuffer(contract_name, NULL); + if (!name) + return E_FAIL; + + *value = FALSE; + + for (i = 0; i < ARRAY_SIZE(present_contracts); ++i) + { + if (!wcsicmp(name, present_contracts[i].name)) + { + if (major_version < present_contracts[i].max_major) + *value = TRUE; + else if (major_version == present_contracts[i].max_major) + *value = minor_version <= present_contracts[i].max_minor; + break; + } + } + + return S_OK; }
static const struct IApiInformationStaticsVtbl api_information_statics_vtbl =
This merge request was closed by JiangYi Chen.