Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
452f0381
Commit
452f0381
authored
Feb 27, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.globalization: Stub Windows.Globalization.GeographicRegion factory.
parent
57873adf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
280 additions
and
30 deletions
+280
-30
Makefile.in
dlls/windows.globalization/Makefile.in
+1
-0
geographic_region.c
dlls/windows.globalization/geographic_region.c
+144
-0
main.c
dlls/windows.globalization/main.c
+6
-18
private.h
dlls/windows.globalization/private.h
+83
-0
globalization.c
dlls/windows.globalization/tests/globalization.c
+46
-12
No files found.
dlls/windows.globalization/Makefile.in
View file @
452f0381
...
...
@@ -3,4 +3,5 @@ IMPORTS = combase uuid
SOURCES
=
\
classes.idl
\
geographic_region.c
\
main.c
dlls/windows.globalization/geographic_region.c
0 → 100644
View file @
452f0381
/* WinRT Windows.Globalization implementation
*
* Copyright 2021 Rémi Bernon for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
locale
);
struct
geographic_region_factory
{
IActivationFactory
IActivationFactory_iface
;
IGeographicRegionFactory
IGeographicRegionFactory_iface
;
LONG
ref
;
};
static
inline
struct
geographic_region_factory
*
impl_from_IActivationFactory
(
IActivationFactory
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
geographic_region_factory
,
IActivationFactory_iface
);
}
static
HRESULT
WINAPI
activation_factory_QueryInterface
(
IActivationFactory
*
iface
,
REFIID
iid
,
void
**
out
)
{
struct
geographic_region_factory
*
factory
=
impl_from_IActivationFactory
(
iface
);
TRACE
(
"iface %p, iid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IInspectable
)
||
IsEqualGUID
(
iid
,
&
IID_IAgileObject
)
||
IsEqualGUID
(
iid
,
&
IID_IActivationFactory
))
{
IActivationFactory_AddRef
(
(
*
out
=
&
factory
->
IActivationFactory_iface
)
);
return
S_OK
;
}
if
(
IsEqualGUID
(
iid
,
&
IID_IGeographicRegionFactory
))
{
IGeographicRegionFactory_AddRef
(
(
*
out
=
&
factory
->
IGeographicRegionFactory_iface
)
);
return
S_OK
;
}
FIXME
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
)
);
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
activation_factory_AddRef
(
IActivationFactory
*
iface
)
{
struct
geographic_region_factory
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
activation_factory_Release
(
IActivationFactory
*
iface
)
{
struct
geographic_region_factory
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
HRESULT
WINAPI
activation_factory_GetIids
(
IActivationFactory
*
iface
,
ULONG
*
iid_count
,
IID
**
iids
)
{
FIXME
(
"iface %p, iid_count %p, iids %p stub!
\n
"
,
iface
,
iid_count
,
iids
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
activation_factory_GetRuntimeClassName
(
IActivationFactory
*
iface
,
HSTRING
*
class_name
)
{
FIXME
(
"iface %p, class_name %p stub!
\n
"
,
iface
,
class_name
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
activation_factory_GetTrustLevel
(
IActivationFactory
*
iface
,
TrustLevel
*
trust_level
)
{
FIXME
(
"iface %p, trust_level %p stub!
\n
"
,
iface
,
trust_level
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
activation_factory_ActivateInstance
(
IActivationFactory
*
iface
,
IInspectable
**
out
)
{
FIXME
(
"iface %p, out %p stub!
\n
"
,
iface
,
out
);
return
E_NOTIMPL
;
}
static
const
struct
IActivationFactoryVtbl
activation_factory_vtbl
=
{
activation_factory_QueryInterface
,
activation_factory_AddRef
,
activation_factory_Release
,
/* IInspectable methods */
activation_factory_GetIids
,
activation_factory_GetRuntimeClassName
,
activation_factory_GetTrustLevel
,
/* IActivationFactory methods */
activation_factory_ActivateInstance
,
};
DEFINE_IINSPECTABLE
(
geographic_region_factory
,
IGeographicRegionFactory
,
struct
geographic_region_factory
,
IActivationFactory_iface
)
static
HRESULT
WINAPI
geographic_region_factory_CreateGeographicRegion
(
IGeographicRegionFactory
*
iface
,
HSTRING
code
,
IGeographicRegion
**
value
)
{
FIXME
(
"iface %p, code %p, value %p stub!
\n
"
,
iface
,
code
,
value
);
return
E_NOTIMPL
;
}
static
const
struct
IGeographicRegionFactoryVtbl
geographic_region_factory_vtbl
=
{
geographic_region_factory_QueryInterface
,
geographic_region_factory_AddRef
,
geographic_region_factory_Release
,
/* IInspectable methods */
geographic_region_factory_GetIids
,
geographic_region_factory_GetRuntimeClassName
,
geographic_region_factory_GetTrustLevel
,
/* IGeographicRegionFactory methods */
geographic_region_factory_CreateGeographicRegion
,
};
static
struct
geographic_region_factory
factory
=
{
{
&
activation_factory_vtbl
},
{
&
geographic_region_factory_vtbl
},
1
,
};
IActivationFactory
*
geographic_region_factory
=
&
factory
.
IActivationFactory_iface
;
dlls/windows.globalization/main.c
View file @
452f0381
...
...
@@ -17,25 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winstring.h"
#include "wine/debug.h"
#include "objbase.h"
#include "initguid.h"
#include "activation.h"
#define WIDL_using_Windows_Foundation
#define WIDL_using_Windows_Foundation_Collections
#include "windows.foundation.h"
#define WIDL_using_Windows_Globalization
#include "windows.globalization.h"
#define WIDL_using_Windows_System_UserProfile
#include "windows.system.userprofile.h"
#include "private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
locale
);
...
...
@@ -756,6 +739,11 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac
*
factory
=
&
language_factory
.
IActivationFactory_iface
;
IUnknown_AddRef
(
*
factory
);
}
else
if
(
!
wcscmp
(
name
,
RuntimeClass_Windows_Globalization_GeographicRegion
))
{
*
factory
=
geographic_region_factory
;
IUnknown_AddRef
(
*
factory
);
}
if
(
*
factory
)
return
S_OK
;
return
CLASS_E_CLASSNOTAVAILABLE
;
...
...
dlls/windows.globalization/private.h
0 → 100644
View file @
452f0381
/* WinRT Windows.Globalization implementation
*
* Copyright 2021 Rémi Bernon for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#define COBJMACROS
#include "winstring.h"
#include "activation.h"
#define WIDL_using_Windows_Foundation
#define WIDL_using_Windows_Foundation_Collections
#define WIDL_using_Windows_Foundation_Numerics
#include "windows.foundation.h"
#define WIDL_using_Windows_Globalization
#define WIDL_using_Windows_System_UserProfile
#include "windows.globalization.h"
#include "windows.system.userprofile.h"
extern
IActivationFactory
*
geographic_region_factory
;
#include "wine/debug.h"
#include "wine/list.h"
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
static inline impl_type *impl_from( iface_type *iface ) \
{ \
return CONTAINING_RECORD( iface, impl_type, iface_mem ); \
} \
static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \
} \
static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_AddRef( (IInspectable *)(expr) ); \
} \
static ULONG WINAPI pfx##_Release( iface_type *iface ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_Release( (IInspectable *)(expr) ); \
} \
static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \
} \
static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \
} \
static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \
}
#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \
DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface )
#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \
DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface )
dlls/windows.globalization/tests/globalization.c
View file @
452f0381
...
...
@@ -36,10 +36,20 @@
#include "wine/test.h"
/* kernel32.dll */
static
INT
(
WINAPI
*
pGetUserDefaultGeoName
)(
LPWSTR
,
int
);
#define check_interface( obj, iid ) check_interface_( __LINE__, obj, iid )
static
void
check_interface_
(
unsigned
int
line
,
void
*
obj
,
const
IID
*
iid
)
{
IUnknown
*
iface
=
obj
;
IUnknown
*
unk
;
HRESULT
hr
;
hr
=
IUnknown_QueryInterface
(
iface
,
iid
,
(
void
**
)
&
unk
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
IUnknown_Release
(
unk
);
}
static
void
test_GlobalizationPreferences
(
void
)
{
...
...
@@ -60,9 +70,6 @@ static void test_GlobalizationPreferences(void)
GetUserDefaultLocaleName
(
locale
,
LOCALE_NAME_MAX_LENGTH
);
hr
=
RoInitialize
(
RO_INIT_MULTITHREADED
);
ok
(
hr
==
S_OK
,
"RoInitialize failed, hr %#lx
\n
"
,
hr
);
hr
=
WindowsCreateString
(
class_name
,
wcslen
(
class_name
),
&
str
);
ok
(
hr
==
S_OK
,
"WindowsCreateString failed, hr %#lx
\n
"
,
hr
);
...
...
@@ -72,7 +79,6 @@ static void test_GlobalizationPreferences(void)
{
win_skip
(
"%s runtimeclass not registered, skipping tests.
\n
"
,
wine_dbgstr_w
(
class_name
));
WindowsDeleteString
(
str
);
RoUninitialize
();
return
;
}
...
...
@@ -225,8 +231,6 @@ static void test_GlobalizationPreferences(void)
IActivationFactory_Release
(
factory
);
WindowsDeleteString
(
str
);
RoUninitialize
();
}
static
void
test_Language
(
void
)
...
...
@@ -243,9 +247,6 @@ static void test_Language(void)
const
WCHAR
*
buf
;
HRESULT
hr
;
hr
=
RoInitialize
(
RO_INIT_MULTITHREADED
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
WindowsCreateString
(
class_name
,
wcslen
(
class_name
),
&
str
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -255,7 +256,6 @@ static void test_Language(void)
if
(
hr
==
REGDB_E_CLASSNOTREG
)
{
win_skip
(
"%s runtimeclass not registered, skipping tests.
\n
"
,
wine_dbgstr_w
(
class_name
));
RoUninitialize
();
return
;
}
...
...
@@ -309,17 +309,51 @@ static void test_Language(void)
IAgileObject_Release
(
agile_object
);
IInspectable_Release
(
inspectable
);
IActivationFactory_Release
(
factory
);
}
RoUninitialize
();
static
void
test_GeographicRegion
(
void
)
{
static
const
WCHAR
*
class_name
=
RuntimeClass_Windows_Globalization_GeographicRegion
;
IActivationFactory
*
factory
;
HSTRING
str
;
HRESULT
hr
;
LONG
ref
;
hr
=
WindowsCreateString
(
class_name
,
wcslen
(
class_name
),
&
str
);
ok
(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
hr
=
RoGetActivationFactory
(
str
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
WindowsDeleteString
(
str
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
REGDB_E_CLASSNOTREG
),
"got hr %#lx.
\n
"
,
hr
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
{
win_skip
(
"%s runtimeclass not registered, skipping tests.
\n
"
,
wine_dbgstr_w
(
class_name
)
);
return
;
}
check_interface
(
factory
,
&
IID_IUnknown
);
check_interface
(
factory
,
&
IID_IInspectable
);
check_interface
(
factory
,
&
IID_IAgileObject
);
check_interface
(
factory
,
&
IID_IGeographicRegionFactory
);
ref
=
IActivationFactory_Release
(
factory
);
ok
(
ref
==
1
,
"got ref %ld.
\n
"
,
ref
);
}
START_TEST
(
globalization
)
{
HMODULE
kernel32
;
HRESULT
hr
;
kernel32
=
GetModuleHandleA
(
"kernel32"
);
pGetUserDefaultGeoName
=
(
void
*
)
GetProcAddress
(
kernel32
,
"GetUserDefaultGeoName"
);
hr
=
RoInitialize
(
RO_INIT_MULTITHREADED
);
ok
(
hr
==
S_OK
,
"RoInitialize failed, hr %#lx
\n
"
,
hr
);
test_GlobalizationPreferences
();
test_Language
();
test_GeographicRegion
();
RoUninitialize
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment