wintypes: Report some API contracts as present in api_information_statics_IsApiContractPresentByMajor().
This commit is contained in:
parent
ce2ae79f9d
commit
2799c95dd2
2 changed files with 49 additions and 2 deletions
|
@ -34,6 +34,27 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wintypes);
|
||||
|
||||
static const struct
|
||||
{
|
||||
const WCHAR *name;
|
||||
unsigned int max_major;
|
||||
}
|
||||
present_contracts[] =
|
||||
{
|
||||
{ L"Windows.Foundation.UniversalApiContract", 10, },
|
||||
};
|
||||
|
||||
static BOOLEAN is_api_contract_present( const HSTRING hname, unsigned int version )
|
||||
{
|
||||
const WCHAR *name = WindowsGetStringRawBuffer( hname, NULL );
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(present_contracts); ++i)
|
||||
if (!wcsicmp( name, present_contracts[i].name )) return version <= present_contracts[i].max_major;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct wintypes
|
||||
{
|
||||
IActivationFactory IActivationFactory_iface;
|
||||
|
@ -280,13 +301,13 @@ 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 stub!\n", iface,
|
||||
FIXME("iface %p, contract_name %s, major_version %u, value %p semi-stub.\n", iface,
|
||||
debugstr_hstring(contract_name), major_version, value);
|
||||
|
||||
if (!contract_name)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*value = FALSE;
|
||||
*value = is_api_contract_present( contract_name, major_version );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,23 @@
|
|||
|
||||
static void test_IApiInformationStatics(void)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
const WCHAR *name;
|
||||
unsigned int max_major;
|
||||
}
|
||||
present_contracts[] =
|
||||
{
|
||||
{ L"Windows.Foundation.UniversalApiContract", 10, },
|
||||
};
|
||||
|
||||
static const WCHAR *class_name = L"Windows.Foundation.Metadata.ApiInformation";
|
||||
IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
|
||||
IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
|
||||
IApiInformationStatics *statics = NULL;
|
||||
IActivationFactory *factory = NULL;
|
||||
HSTRING str, str2;
|
||||
unsigned int i, j;
|
||||
BOOLEAN ret;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -424,6 +435,21 @@ static void test_IApiInformationStatics(void)
|
|||
|
||||
WindowsDeleteString(str);
|
||||
|
||||
/* Test API contracts presence. */
|
||||
for (i = 0; i < ARRAY_SIZE(present_contracts); ++i)
|
||||
{
|
||||
hr = WindowsCreateString(present_contracts[i].name, wcslen(present_contracts[i].name), &str);
|
||||
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr);
|
||||
for (j = 0; j <= present_contracts[i].max_major; ++j)
|
||||
{
|
||||
ret = FALSE;
|
||||
hr = IApiInformationStatics_IsApiContractPresentByMajor(statics, str, i, &ret);
|
||||
ok(hr == S_OK, "IsApiContractPresentByMajor failed, hr %#lx, i %u, major %u.\n", hr, i, j);
|
||||
ok(ret == TRUE, "IsApiContractPresentByMajor returned FALSE, i %u, major %u.\n", i, j);
|
||||
}
|
||||
WindowsDeleteString(str);
|
||||
}
|
||||
|
||||
IApiInformationStatics_Release(statics);
|
||||
IAgileObject_Release(agile_object);
|
||||
IInspectable_Release(inspectable);
|
||||
|
|
Loading…
Add table
Reference in a new issue