Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
January 2018
- 62 participants
- 503 discussions
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/writer.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index b7dab3a930..75cf7b4e64 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -648,10 +648,8 @@ static HRESULT write_string( struct writer *writer, const BYTE *bytes, ULONG len
static HRESULT write_dict_string( struct writer *writer, ULONG id )
{
- HRESULT hr;
if (id > 0x7fffffff) return E_INVALIDARG;
- if ((hr = write_int31( writer, id )) != S_OK) return hr;
- return S_OK;
+ return write_int31( writer, id );
}
static enum record_type get_attr_text_record_type( const WS_XML_TEXT *text, BOOL use_dict )
--
2.11.0
1
0
[PATCH 3/6] webservices: Don't write a colon for namespace attributes with empty prefix.
by Hans Leidekker 24 Jan '18
by Hans Leidekker 24 Jan '18
24 Jan '18
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/writer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index 08b341034e..b7dab3a930 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -1482,11 +1482,11 @@ static HRESULT write_namespace_attribute_text( struct writer *writer, const WS_X
/* ' xmlns:prefix="namespace"' */
size = attr->ns->length + 9 /* ' xmlns=""' */;
- if (attr->prefix) size += attr->prefix->length + 1 /* ':' */;
+ if (attr->prefix && attr->prefix->length) size += attr->prefix->length + 1 /* ':' */;
if ((hr = write_grow_buffer( writer, size )) != S_OK) return hr;
write_bytes( writer, (const BYTE *)" xmlns", 6 );
- if (attr->prefix)
+ if (attr->prefix && attr->prefix->length)
{
write_char( writer, ':' );
write_bytes( writer, attr->prefix->bytes, attr->prefix->length );
--
2.11.0
1
0
[PATCH 2/6] webservices: Take the output encoding into account in WsCopyNode.
by Hans Leidekker 24 Jan '18
by Hans Leidekker 24 Jan '18
24 Jan '18
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/reader.c | 95 +++++++++++++++++++++-------------
dlls/webservices/webservices_private.h | 5 +-
dlls/webservices/writer.c | 8 +--
3 files changed, 65 insertions(+), 43 deletions(-)
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 3e5434cf64..bdf950ec29 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -143,29 +143,36 @@ void destroy_nodes( struct node *node )
free_node( node );
}
-static WS_XML_ATTRIBUTE *dup_attribute( const WS_XML_ATTRIBUTE *src )
+static WS_XML_ATTRIBUTE *dup_attribute( const WS_XML_ATTRIBUTE *src, WS_XML_WRITER_ENCODING_TYPE enc )
{
WS_XML_ATTRIBUTE *dst;
- const WS_XML_STRING *prefix = src->prefix;
- const WS_XML_STRING *localname = src->localName;
- const WS_XML_STRING *ns = src->localName;
- const WS_XML_TEXT *text = src->value;
+ HRESULT hr;
- if (!(dst = heap_alloc( sizeof(*dst) ))) return NULL;
+ if (!(dst = heap_alloc_zero( sizeof(*dst) ))) return NULL;
dst->singleQuote = src->singleQuote;
dst->isXmlNs = src->isXmlNs;
- if (!prefix) dst->prefix = NULL;
- else if (!(dst->prefix = dup_xml_string( prefix, FALSE ))) goto error;
- if (!(dst->localName = dup_xml_string( localname, FALSE ))) goto error;
- if (!(dst->ns = dup_xml_string( ns, FALSE ))) goto error;
+ if (src->prefix && !(dst->prefix = dup_xml_string( src->prefix, FALSE ))) goto error;
+ if (src->localName && !(dst->localName = dup_xml_string( src->localName, FALSE ))) goto error;
+ if (src->ns && !(dst->ns = dup_xml_string( src->ns, FALSE ))) goto error;
- if (text)
+ if (src->value)
{
- WS_XML_UTF8_TEXT *utf8;
- const WS_XML_UTF8_TEXT *utf8_src = (const WS_XML_UTF8_TEXT *)text;
- if (!(utf8 = alloc_utf8_text( utf8_src->value.bytes, utf8_src->value.length ))) goto error;
- dst->value = &utf8->text;
+ switch (enc)
+ {
+ case WS_XML_WRITER_ENCODING_TYPE_BINARY:
+ if ((hr = text_to_text( src->value, NULL, NULL, &dst->value )) != S_OK) goto error;
+ break;
+
+ case WS_XML_WRITER_ENCODING_TYPE_TEXT:
+ if ((hr = text_to_utf8text( src->value, NULL, NULL, (WS_XML_UTF8_TEXT **)&dst->value )) != S_OK)
+ goto error;
+ break;
+
+ default:
+ ERR( "unhandled encoding %u\n", enc );
+ goto error;
+ }
}
return dst;
@@ -175,7 +182,8 @@ error:
return NULL;
}
-static WS_XML_ATTRIBUTE **dup_attributes( WS_XML_ATTRIBUTE * const *src, ULONG count )
+static WS_XML_ATTRIBUTE **dup_attributes( WS_XML_ATTRIBUTE * const *src, ULONG count,
+ WS_XML_WRITER_ENCODING_TYPE enc )
{
WS_XML_ATTRIBUTE **dst;
ULONG i;
@@ -183,7 +191,7 @@ static WS_XML_ATTRIBUTE **dup_attributes( WS_XML_ATTRIBUTE * const *src, ULONG c
if (!(dst = heap_alloc( sizeof(*dst) * count ))) return NULL;
for (i = 0; i < count; i++)
{
- if (!(dst[i] = dup_attribute( src[i] )))
+ if (!(dst[i] = dup_attribute( src[i], enc )))
{
for (; i > 0; i--) free_attribute( dst[i - 1] );
heap_free( dst );
@@ -193,7 +201,7 @@ static WS_XML_ATTRIBUTE **dup_attributes( WS_XML_ATTRIBUTE * const *src, ULONG c
return dst;
}
-static struct node *dup_element_node( const WS_XML_ELEMENT_NODE *src )
+static struct node *dup_element_node( const WS_XML_ELEMENT_NODE *src, WS_XML_WRITER_ENCODING_TYPE enc )
{
struct node *node;
WS_XML_ELEMENT_NODE *dst;
@@ -206,7 +214,7 @@ static struct node *dup_element_node( const WS_XML_ELEMENT_NODE *src )
if (!(node = alloc_node( WS_XML_NODE_TYPE_ELEMENT ))) return NULL;
dst = &node->hdr;
- if (count && !(dst->attributes = dup_attributes( attrs, count ))) goto error;
+ if (count && !(dst->attributes = dup_attributes( attrs, count, enc ))) goto error;
dst->attributeCount = count;
if (prefix && !(dst->prefix = dup_xml_string( prefix, FALSE ))) goto error;
@@ -219,25 +227,38 @@ error:
return NULL;
}
-static struct node *dup_text_node( const WS_XML_TEXT_NODE *src )
+static struct node *dup_text_node( const WS_XML_TEXT_NODE *src, WS_XML_WRITER_ENCODING_TYPE enc )
{
struct node *node;
WS_XML_TEXT_NODE *dst;
+ HRESULT hr;
if (!(node = alloc_node( WS_XML_NODE_TYPE_TEXT ))) return NULL;
dst = (WS_XML_TEXT_NODE *)node;
+ if (!src->text) return node;
- if (src->text)
+ switch (enc)
{
- WS_XML_UTF8_TEXT *utf8;
- const WS_XML_UTF8_TEXT *utf8_src = (const WS_XML_UTF8_TEXT *)src->text;
- if (!(utf8 = alloc_utf8_text( utf8_src->value.bytes, utf8_src->value.length )))
- {
- free_node( node );
- return NULL;
- }
- dst->text = &utf8->text;
+ case WS_XML_WRITER_ENCODING_TYPE_BINARY:
+ hr = text_to_text( src->text, NULL, NULL, &dst->text );
+ break;
+
+ case WS_XML_WRITER_ENCODING_TYPE_TEXT:
+ hr = text_to_utf8text( src->text, NULL, NULL, (WS_XML_UTF8_TEXT **)&dst->text );
+ break;
+
+ default:
+ ERR( "unhandled encoding %u\n", enc );
+ free_node( node );
+ return NULL;
}
+
+ if (hr != S_OK)
+ {
+ free_node( node );
+ return NULL;
+ }
+
return node;
}
@@ -259,15 +280,15 @@ static struct node *dup_comment_node( const WS_XML_COMMENT_NODE *src )
return node;
}
-static struct node *dup_node( const struct node *src )
+static struct node *dup_node( const struct node *src, WS_XML_WRITER_ENCODING_TYPE enc )
{
switch (node_type( src ))
{
case WS_XML_NODE_TYPE_ELEMENT:
- return dup_element_node( &src->hdr );
+ return dup_element_node( &src->hdr, enc );
case WS_XML_NODE_TYPE_TEXT:
- return dup_text_node( (const WS_XML_TEXT_NODE *)src );
+ return dup_text_node( (const WS_XML_TEXT_NODE *)src, enc );
case WS_XML_NODE_TYPE_COMMENT:
return dup_comment_node( (const WS_XML_COMMENT_NODE *)src );
@@ -286,12 +307,12 @@ static struct node *dup_node( const struct node *src )
return NULL;
}
-static HRESULT dup_tree( struct node **dst, const struct node *src )
+static HRESULT dup_tree( const struct node *src, WS_XML_WRITER_ENCODING_TYPE enc, struct node **dst )
{
struct node *parent;
const struct node *child;
- if (!*dst && !(*dst = dup_node( src ))) return E_OUTOFMEMORY;
+ if (!*dst && !(*dst = dup_node( src, enc ))) return E_OUTOFMEMORY;
parent = *dst;
LIST_FOR_EACH_ENTRY( child, &src->children, struct node, entry )
@@ -299,7 +320,7 @@ static HRESULT dup_tree( struct node **dst, const struct node *src )
HRESULT hr = E_OUTOFMEMORY;
struct node *new_child;
- if (!(new_child = dup_node( child )) || (hr = dup_tree( &new_child, child )) != S_OK)
+ if (!(new_child = dup_node( child, enc )) || (hr = dup_tree( child, enc, &new_child )) != S_OK)
{
destroy_nodes( *dst );
return hr;
@@ -2970,7 +2991,7 @@ static HRESULT read_node( struct reader *reader )
}
}
-HRESULT copy_node( WS_XML_READER *handle, struct node **node )
+HRESULT copy_node( WS_XML_READER *handle, WS_XML_WRITER_ENCODING_TYPE enc, struct node **node )
{
struct reader *reader = (struct reader *)handle;
const struct list *ptr;
@@ -3001,7 +3022,7 @@ HRESULT copy_node( WS_XML_READER *handle, struct node **node )
start = LIST_ENTRY( ptr, struct node, entry );
if (node_type( start ) == WS_XML_NODE_TYPE_EOF) hr = WS_E_INVALID_OPERATION;
- else hr = dup_tree( node, start );
+ else hr = dup_tree( start, enc, node );
done:
LeaveCriticalSection( &reader->cs );
diff --git a/dlls/webservices/webservices_private.h b/dlls/webservices/webservices_private.h
index e477e0fc3f..3f6d2f4492 100644
--- a/dlls/webservices/webservices_private.h
+++ b/dlls/webservices/webservices_private.h
@@ -66,7 +66,8 @@ ULONG get_type_size( WS_TYPE, const void * ) DECLSPEC_HIDDEN;
HRESULT read_header( WS_XML_READER *, const WS_XML_STRING *, const WS_XML_STRING *, WS_TYPE,
const void *, WS_READ_OPTION, WS_HEAP *, void *, ULONG ) DECLSPEC_HIDDEN;
HRESULT create_header_buffer( WS_XML_READER *, WS_HEAP *, WS_XML_BUFFER ** ) DECLSPEC_HIDDEN;
-
+HRESULT text_to_text( const WS_XML_TEXT *, const WS_XML_TEXT *, ULONG *, WS_XML_TEXT ** ) DECLSPEC_HIDDEN;
+HRESULT text_to_utf8text( const WS_XML_TEXT *, const WS_XML_UTF8_TEXT *, ULONG *, WS_XML_UTF8_TEXT ** ) DECLSPEC_HIDDEN;
WS_XML_UTF8_TEXT *alloc_utf8_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_UTF16_TEXT *alloc_utf16_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_BASE64_TEXT *alloc_base64_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
@@ -105,7 +106,7 @@ struct node
struct node *alloc_node( WS_XML_NODE_TYPE ) DECLSPEC_HIDDEN;
void free_node( struct node * ) DECLSPEC_HIDDEN;
void destroy_nodes( struct node * ) DECLSPEC_HIDDEN;
-HRESULT copy_node( WS_XML_READER *, struct node ** ) DECLSPEC_HIDDEN;
+HRESULT copy_node( WS_XML_READER *, WS_XML_WRITER_ENCODING_TYPE, struct node ** ) DECLSPEC_HIDDEN;
static inline WS_XML_NODE_TYPE node_type( const struct node *node )
{
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index be2994af83..08b341034e 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -1034,8 +1034,8 @@ static ULONG encode_base64( const unsigned char *bin, ULONG len, unsigned char *
return i;
}
-static HRESULT text_to_utf8text( const WS_XML_TEXT *text, const WS_XML_UTF8_TEXT *old, ULONG *offset,
- WS_XML_UTF8_TEXT **ret )
+HRESULT text_to_utf8text( const WS_XML_TEXT *text, const WS_XML_UTF8_TEXT *old, ULONG *offset,
+ WS_XML_UTF8_TEXT **ret )
{
ULONG len_old = old ? old->value.length : 0;
if (offset) *offset = len_old;
@@ -2254,7 +2254,7 @@ HRESULT WINAPI WsWriteStartElement( WS_XML_WRITER *handle, const WS_XML_STRING *
return hr;
}
-static HRESULT text_to_text( const WS_XML_TEXT *text, const WS_XML_TEXT *old, ULONG *offset, WS_XML_TEXT **ret )
+HRESULT text_to_text( const WS_XML_TEXT *text, const WS_XML_TEXT *old, ULONG *offset, WS_XML_TEXT **ret )
{
if (offset) *offset = 0;
switch (text->textType)
@@ -4758,7 +4758,7 @@ HRESULT WINAPI WsCopyNode( WS_XML_WRITER *handle, WS_XML_READER *reader, WS_ERRO
return WS_E_INVALID_FORMAT;
}
- if ((hr = copy_node( reader, &node )) != S_OK) goto done;
+ if ((hr = copy_node( reader, writer->output_enc, &node )) != S_OK) goto done;
current = writer->current;
write_insert_node( writer, parent, node );
--
2.11.0
1
0
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/reader.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index a05b1edb33..3e5434cf64 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -6458,6 +6458,27 @@ static HRESULT end_mapping( struct reader *reader, WS_TYPE_MAPPING mapping )
}
}
+static BOOL is_true_text( const WS_XML_TEXT *text )
+{
+ switch (text->textType)
+ {
+ case WS_XML_TEXT_TYPE_UTF8:
+ {
+ const WS_XML_UTF8_TEXT *text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+ if (text_utf8->value.length == 4 && !memcmp( text_utf8->value.bytes, "true", 4 )) return TRUE;
+ return FALSE;
+ }
+ case WS_XML_TEXT_TYPE_BOOL:
+ {
+ const WS_XML_BOOL_TEXT *text_bool = (const WS_XML_BOOL_TEXT *)text;
+ return text_bool->value;
+ }
+ default:
+ ERR( "unhandled text type %u\n", text->textType );
+ return FALSE;
+ }
+}
+
static HRESULT is_nil_element( const WS_XML_ELEMENT_NODE *elem )
{
static const WS_XML_STRING localname = {3, (BYTE *)"nil"};
@@ -6466,12 +6487,10 @@ static HRESULT is_nil_element( const WS_XML_ELEMENT_NODE *elem )
for (i = 0; i < elem->attributeCount; i++)
{
- const WS_XML_UTF8_TEXT *text = (WS_XML_UTF8_TEXT *)elem->attributes[i]->value;
-
if (elem->attributes[i]->isXmlNs) continue;
if (WsXmlStringEquals( elem->attributes[i]->localName, &localname, NULL ) == S_OK &&
WsXmlStringEquals( elem->attributes[i]->ns, &ns, NULL ) == S_OK &&
- text->value.length == 4 && !memcmp( text->value.bytes, "true", 4 )) return TRUE;
+ is_true_text( elem->attributes[i]->value )) return TRUE;
}
return FALSE;
}
--
2.11.0
1
0
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
v2: fixed test failures on WinXP
dlls/comctl32/tests/Makefile.in | 2 +-
dlls/comctl32/tests/animate.c | 22 +----------
dlls/comctl32/tests/combo.c | 29 +++++++-------
dlls/comctl32/tests/datetime.c | 22 ++++++-----
dlls/comctl32/tests/dpa.c | 67 +++++++++++++-------------------
dlls/comctl32/tests/header.c | 38 +++++++++---------
dlls/comctl32/tests/imagelist.c | 36 ++++++++---------
dlls/comctl32/tests/ipaddress.c | 25 ------------
dlls/comctl32/tests/listview.c | 74 +++++++++++++++++++----------------
dlls/comctl32/tests/monthcal.c | 25 ++++++------
dlls/comctl32/tests/mru.c | 30 +++++++-------
dlls/comctl32/tests/pager.c | 1 -
dlls/comctl32/tests/progress.c | 34 +++++++++-------
dlls/comctl32/tests/propsheet.c | 86 +++++++++++++++++++++++++----------------
dlls/comctl32/tests/rebar.c | 35 ++++++++---------
dlls/comctl32/tests/status.c | 21 +++++++++-
dlls/comctl32/tests/subclass.c | 2 +-
dlls/comctl32/tests/tab.c | 42 ++++++++++++++------
dlls/comctl32/tests/toolbar.c | 63 +++++++++++++++++++-----------
dlls/comctl32/tests/tooltips.c | 2 +-
dlls/comctl32/tests/trackbar.c | 3 +-
dlls/comctl32/tests/treeview.c | 34 ++++++++--------
dlls/comctl32/tests/updown.c | 21 +++++++---
23 files changed, 378 insertions(+), 336 deletions(-)
diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in
index f93ff2585d..4669efcf2b 100644
--- a/dlls/comctl32/tests/Makefile.in
+++ b/dlls/comctl32/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = comctl32.dll
-IMPORTS = comctl32 ole32 user32 gdi32 advapi32
+IMPORTS = ole32 user32 gdi32 advapi32
C_SRCS = \
animate.c \
diff --git a/dlls/comctl32/tests/animate.c b/dlls/comctl32/tests/animate.c
index fab345bb47..400de55b5e 100644
--- a/dlls/comctl32/tests/animate.c
+++ b/dlls/comctl32/tests/animate.c
@@ -108,26 +108,6 @@ static void create_animate(DWORD parent_style, DWORD animate_style)
update_window(hAnimateParentWnd);
}
-static void init(void)
-{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_ANIMATE_CLASS;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
-
- shell32 = LoadLibraryA("Shell32.dll");
-}
-
static void destroy_animate(void)
{
MSG msg;
@@ -175,7 +155,7 @@ static void test_play(void)
START_TEST(animate)
{
- init();
+ shell32 = LoadLibraryA("Shell32.dll");
test_play();
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c
index ef7c3f796b..895d9429b4 100644
--- a/dlls/comctl32/tests/combo.c
+++ b/dlls/comctl32/tests/combo.c
@@ -480,25 +480,20 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
return 0L;
}
-static BOOL init(void)
+static void init_functions(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- WNDCLASSA wc;
- INITCOMMONCONTROLSEX iccex;
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return FALSE;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_USEREX_CLASSES;
- pInitCommonControlsEx(&iccex);
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ X2(SetWindowSubclass, 410);
+#undef X
+#undef X2
+}
- pSetWindowSubclass = (void*)GetProcAddress(hComctl32, (LPSTR)410);
+static BOOL init(void)
+{
+ WNDCLASSA wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@@ -1161,6 +1156,8 @@ START_TEST(combo)
ULONG_PTR ctx_cookie;
HANDLE hCtx;
+ init_functions();
+
if (!init())
return;
diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c
index c9407bef61..4036e9defd 100644
--- a/dlls/comctl32/tests/datetime.c
+++ b/dlls/comctl32/tests/datetime.c
@@ -30,6 +30,8 @@
#define NUM_MSG_SEQUENCES 1
#define DATETIME_SEQ_INDEX 0
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static const struct message test_dtm_set_format_seq[] = {
@@ -777,19 +779,21 @@ static void test_dts_shownone(void)
DestroyWindow(hwnd);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(InitCommonControlsEx);
+#undef X
+}
+
START_TEST(datetime)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
+ init_functions();
+
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c
index 4eb32a4187..c795c14f4e 100644
--- a/dlls/comctl32/tests/dpa.c
+++ b/dlls/comctl32/tests/dpa.c
@@ -59,38 +59,33 @@ static INT (WINAPI *pDPA_Search)(HDPA,PVOID,INT,PFNDPACOMPARE,LPARAM,UINT);
static BOOL (WINAPI *pDPA_SetPtr)(HDPA,INT,PVOID);
static BOOL (WINAPI *pDPA_Sort)(HDPA,PFNDPACOMPARE,LPARAM);
-#define COMCTL32_GET_PROC(func, ord) \
- ((p ## func = (PVOID)GetProcAddress(hcomctl32,(LPCSTR)ord)) ? 1 \
- : (trace( #func " not exported\n"), 0))
-
-static BOOL InitFunctionPtrs(HMODULE hcomctl32)
+static void init_functions(void)
{
- /* 4.00+ */
- if(COMCTL32_GET_PROC(DPA_Clone, 331) &&
- COMCTL32_GET_PROC(DPA_Create, 328) &&
- COMCTL32_GET_PROC(DPA_CreateEx, 340) &&
- COMCTL32_GET_PROC(DPA_DeleteAllPtrs, 337) &&
- COMCTL32_GET_PROC(DPA_DeletePtr, 336) &&
- COMCTL32_GET_PROC(DPA_Destroy, 329) &&
- COMCTL32_GET_PROC(DPA_GetPtr, 332) &&
- COMCTL32_GET_PROC(DPA_GetPtrIndex, 333) &&
- COMCTL32_GET_PROC(DPA_Grow, 330) &&
- COMCTL32_GET_PROC(DPA_InsertPtr, 334) &&
- COMCTL32_GET_PROC(DPA_Search, 339) &&
- COMCTL32_GET_PROC(DPA_SetPtr, 335) &&
- COMCTL32_GET_PROC(DPA_Sort, 338))
- {
- /* 4.71+ */
- COMCTL32_GET_PROC(DPA_DestroyCallback, 386) &&
- COMCTL32_GET_PROC(DPA_EnumCallback, 385) &&
- COMCTL32_GET_PROC(DPA_LoadStream, 9) &&
- COMCTL32_GET_PROC(DPA_Merge, 11) &&
- COMCTL32_GET_PROC(DPA_SaveStream, 10);
-
- return TRUE;
- }
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
- return FALSE;
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ /* 4.00+ */
+ X2(DPA_Clone, 331);
+ X2(DPA_Create, 328);
+ X2(DPA_CreateEx, 340);
+ X2(DPA_DeleteAllPtrs, 337);
+ X2(DPA_DeletePtr, 336);
+ X2(DPA_Destroy, 329);
+ X2(DPA_GetPtr, 332);
+ X2(DPA_GetPtrIndex, 333);
+ X2(DPA_Grow, 330);
+ X2(DPA_InsertPtr, 334);
+ X2(DPA_Search, 339);
+ X2(DPA_SetPtr, 335);
+ X2(DPA_Sort, 338);
+
+ /* 4.71+ */
+ X2(DPA_DestroyCallback, 386);
+ X2(DPA_EnumCallback, 385);
+ X2(DPA_LoadStream, 9);
+ X2(DPA_Merge, 11);
+ X2(DPA_SaveStream, 10);
+#undef X2
}
/* Callbacks */
@@ -628,7 +623,7 @@ static void test_DPA_LoadStream(void)
dpa = NULL;
hRes = pDPA_LoadStream(&dpa, CB_Load, pStm, NULL);
expect(S_OK, hRes);
- DPA_Destroy(dpa);
+ pDPA_Destroy(dpa);
/* try with altered dwData2 field */
header.dwSize = sizeof(header);
@@ -742,15 +737,7 @@ if (0) {
START_TEST(dpa)
{
- HMODULE hcomctl32;
-
- hcomctl32 = GetModuleHandleA("comctl32.dll");
-
- if(!InitFunctionPtrs(hcomctl32))
- {
- win_skip("Needed functions are not available\n");
- return;
- }
+ init_functions();
test_dpa();
test_DPA_Merge();
diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c
index ae75199be2..31610f0c9a 100644
--- a/dlls/comctl32/tests/header.c
+++ b/dlls/comctl32/tests/header.c
@@ -26,6 +26,9 @@
#include "v6util.h"
#include "msg.h"
+static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+
typedef struct tagEXPECTEDNOTIFY
{
INT iCode;
@@ -953,7 +956,7 @@ static void test_hdm_sethotdivider(HWND hParent)
static void test_hdm_imageMessages(HWND hParent)
{
- HIMAGELIST hImageList = ImageList_Create (4, 4, 0, 1, 0);
+ HIMAGELIST hImageList = pImageList_Create (4, 4, 0, 1, 0);
HIMAGELIST hIml;
BOOL wasValid;
HWND hChild;
@@ -973,13 +976,13 @@ static void test_hdm_imageMessages(HWND hParent)
hIml = (HIMAGELIST) SendMessageA(hChild, HDM_CREATEDRAGIMAGE, 0, 0);
ok(hIml != NULL, "Expected non-NULL handle, got %p\n", hIml);
- ImageList_Destroy(hIml);
+ pImageList_Destroy(hIml);
ok_sequence(sequences, HEADER_SEQ_INDEX, imageMessages_seq, "imageMessages sequence testing", FALSE);
DestroyWindow(hChild);
- wasValid = ImageList_Destroy(hImageList);
+ wasValid = pImageList_Destroy(hImageList);
ok(wasValid, "Header must not free image list at destruction!\n");
}
@@ -1644,28 +1647,23 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return 0L;
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+#undef X
+}
+
static BOOL init(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
- INITCOMMONCONTROLSEX iccex;
TEXTMETRICA tm;
HFONT hOldFont;
HDC hdc;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return FALSE;
- }
-
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_USEREX_CLASSES;
- pInitCommonControlsEx(&iccex);
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
@@ -1821,6 +1819,8 @@ START_TEST(header)
ULONG_PTR ctx_cookie;
HANDLE hCtx;
+ init_functions();
+
if (!init())
return;
@@ -1852,6 +1852,8 @@ START_TEST(header)
return;
}
+ init_functions();
+
/* comctl32 version 6 tests start here */
test_hdf_fixedwidth(parent_hwnd);
test_hds_nosizing(parent_hwnd);
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 653467c999..3838563c38 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -85,6 +85,7 @@ static BOOL (WINAPI *pImageList_Write)(HIMAGELIST, IStream *);
static HIMAGELIST (WINAPI *pImageList_Read)(IStream *);
static BOOL (WINAPI *pImageList_Copy)(HIMAGELIST, int, HIMAGELIST, int, UINT);
static HIMAGELIST (WINAPI *pImageList_LoadImageW)(HINSTANCE, LPCWSTR, int, int, COLORREF, UINT, UINT);
+static BOOL (WINAPI *pImageList_Draw)(HIMAGELIST,INT,HDC,INT,INT,UINT);
static HINSTANCE hinst;
@@ -205,7 +206,7 @@ static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size,
SetWindowTextA(hwnd, loc);
hdc = GetDC(hwnd);
- ImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
+ pImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
force_redraw(hwnd);
@@ -504,8 +505,8 @@ static void test_DrawIndirect(void)
ok(hbm3 != 0, "no bitmap 3\n");
/* add three */
- ok(0 == ImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
- ok(1 == ImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
+ ok(0 == pImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
+ ok(1 == pImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
if (pImageList_SetImageCount)
{
@@ -1576,7 +1577,7 @@ cleanup:
if(himl)
{
- ret = ImageList_Destroy(himl);
+ ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
}
}
@@ -1599,21 +1600,21 @@ static void test_iimagelist(void)
imgl = (IImageList*)createImageList(32, 32);
ret = IImageList_AddRef(imgl);
ok(ret == 2, "Expected 2, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
imgl = (IImageList*)createImageList(32, 32);
ret = IImageList_AddRef(imgl);
ok(ret == 2, "Expected 2, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ret = IImageList_Release(imgl);
ok(ret == 0, "Expected 0, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
/* ref counting, HIMAGELIST_QueryInterface adds a reference */
@@ -1674,7 +1675,7 @@ static void test_IImageList_Add_Remove(void)
int ret;
/* create an imagelist to play with */
- himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
ok(himl != 0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1728,7 +1729,7 @@ static void test_IImageList_Get_SetImageCount(void)
INT ret;
/* create an imagelist to play with */
- himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
ok(himl != 0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1773,7 +1774,7 @@ static void test_IImageList_Draw(void)
ok(hdc!=NULL, "couldn't get DC\n");
/* create an imagelist to play with */
- himl = ImageList_Create(48, 48, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
ok(himl!=0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1850,10 +1851,10 @@ static void test_IImageList_Merge(void)
HRESULT hr;
int ret;
- himl1 = ImageList_Create(32,32,0,0,3);
+ himl1 = pImageList_Create(32,32,0,0,3);
ok(himl1 != NULL,"failed to create himl1\n");
- himl2 = ImageList_Create(32,32,0,0,3);
+ himl2 = pImageList_Create(32,32,0,0,3);
ok(himl2 != NULL,"failed to create himl2\n");
hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
@@ -1887,7 +1888,7 @@ if (0)
/* Same happens if himl2 is empty */
IImageList_Release(imgl2);
- himl2 = ImageList_Create(32,32,0,0,3);
+ himl2 = pImageList_Create(32,32,0,0,3);
ok(himl2 != NULL,"failed to recreate himl2\n");
imgl2 = (IImageList *) himl2;
@@ -2385,7 +2386,7 @@ static void test_IImageList_GetIconSize(void)
static void init_functions(void)
{
- HMODULE hComCtl32 = GetModuleHandleA("comctl32.dll");
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
@@ -2414,6 +2415,7 @@ static void init_functions(void)
X(ImageList_LoadImageW);
X(ImageList_CoCreateInstance);
X(HIMAGELIST_QueryInterface);
+ X(ImageList_Draw);
#undef X
#undef X2
}
@@ -2427,8 +2429,6 @@ START_TEST(imagelist)
hinst = GetModuleHandleA(NULL);
- InitCommonControls();
-
test_create_destroy();
test_begindrag();
test_hotspot();
diff --git a/dlls/comctl32/tests/ipaddress.c b/dlls/comctl32/tests/ipaddress.c
index 093f649c9e..6d8e9ccf4b 100644
--- a/dlls/comctl32/tests/ipaddress.c
+++ b/dlls/comctl32/tests/ipaddress.c
@@ -61,32 +61,7 @@ static void test_get_set_text(void)
DestroyWindow(hwnd);
}
-static BOOL init(void)
-{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing.\n");
- return FALSE;
- }
-
- iccex.dwSize = sizeof(iccex);
- /* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
- iccex.dwICC = ICC_INTERNET_CLASSES;
- pInitCommonControlsEx(&iccex);
-
- return TRUE;
-}
-
START_TEST(ipaddress)
{
- if (!init())
- return;
-
test_get_set_text();
}
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 18e874a00f..72367c67b3 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -28,6 +28,11 @@
#include "v6util.h"
#include "msg.h"
+static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP);
+static BOOL (WINAPI *p_TrackMouseEvent)(TRACKMOUSEEVENT *);
+
enum seq_index {
PARENT_SEQ_INDEX,
PARENT_FULL_SEQ_INDEX,
@@ -73,6 +78,18 @@ static BOOL g_focus_test_LVN_DELETEITEM;
static HWND subclass_editbox(HWND hwndListview);
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+ X(ImageList_Add);
+ X(_TrackMouseEvent);
+#undef X
+}
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static const struct message create_ownerdrawfixed_parent_seq[] = {
@@ -848,13 +865,13 @@ static void test_images(void)
RECT r1, r2;
static CHAR hello[] = "hello";
- himl = ImageList_Create(40, 40, 0, 4, 4);
+ himl = pImageList_Create(40, 40, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 0, "should be zero\n");
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_OWNERDRAWFIXED,
@@ -1539,7 +1556,7 @@ static void test_create(void)
cls.lpszClassName = "MyListView32";
ok(RegisterClassExA(&cls), "RegisterClassEx failed\n");
- test_create_imagelist = ImageList_Create(16, 16, 0, 5, 10);
+ test_create_imagelist = pImageList_Create(16, 16, 0, 5, 10);
hList = CreateWindowA("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
ok((HIMAGELIST)SendMessageA(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
@@ -3732,15 +3749,15 @@ static void test_hittest(void)
test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, 0, FALSE, TRUE);
test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
/* try with icons, state icons index is 1 based so at least 2 bitmaps needed */
- himl = ImageList_Create(16, 16, 0, 4, 4);
+ himl = pImageList_Create(16, 16, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 0, "should be zero\n");
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 1, "should be one\n");
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
@@ -4022,15 +4039,15 @@ todo_wine
expect(TRUE, r);
/* state icons */
- himl = ImageList_Create(16, 16, 0, 2, 2);
+ himl = pImageList_Create(16, 16, 0, 2, 2);
ok(himl != NULL, "failed to create imagelist\n");
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbm, 0);
+ r = pImageList_Add(himl, hbm, 0);
expect(0, r);
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbm, 0);
+ r = pImageList_Add(himl, hbm, 0);
expect(1, r);
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
@@ -4702,9 +4719,9 @@ static void test_getitemspacing(void)
expect(cy, HIWORD(ret));
/* now try with icons */
- himl40 = ImageList_Create(40, 40, 0, 4, 4);
+ himl40 = pImageList_Create(40, 40, 0, 4, 4);
ok(himl40 != NULL, "failed to create imagelist\n");
- himl80 = ImageList_Create(80, 80, 0, 4, 4);
+ himl80 = pImageList_Create(80, 80, 0, 4, 4);
ok(himl80 != NULL, "failed to create imagelist\n");
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40);
expect(0, ret);
@@ -4772,7 +4789,7 @@ static void test_getitemspacing(void)
expect(cy + 40, HIWORD(ret));
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
- ImageList_Destroy(himl80);
+ pImageList_Destroy(himl80);
DestroyWindow(hwnd);
/* LVS_SMALLICON */
hwnd = create_listview_control(LVS_SMALLICON);
@@ -4790,7 +4807,7 @@ static void test_getitemspacing(void)
expect(cy + 40, HIWORD(ret));
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
- ImageList_Destroy(himl40);
+ pImageList_Destroy(himl40);
DestroyWindow(hwnd);
/* LVS_REPORT */
hwnd = create_listview_control(LVS_REPORT);
@@ -4973,11 +4990,11 @@ static void test_approximate_viewrect(void)
/* LVS_ICON */
hwnd = create_listview_control(LVS_ICON);
- himl = ImageList_Create(40, 40, 0, 4, 4);
+ himl = pImageList_Create(40, 40, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- ret = ImageList_Add(himl, hbmp, 0);
+ ret = pImageList_Add(himl, hbmp, 0);
expect(0, ret);
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)himl);
expect(0, ret);
@@ -5594,7 +5611,7 @@ static void test_createdragimage(void)
himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, (LPARAM)&pt);
ok(himl != NULL, "got %p\n", himl);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
DestroyWindow(list);
}
@@ -5709,9 +5726,9 @@ static void test_imagelists(void)
HIMAGELIST himl1, himl2, himl3;
LRESULT ret;
- himl1 = ImageList_Create(40, 40, 0, 4, 4);
- himl2 = ImageList_Create(40, 40, 0, 4, 4);
- himl3 = ImageList_Create(40, 40, 0, 4, 4);
+ himl1 = pImageList_Create(40, 40, 0, 4, 4);
+ himl2 = pImageList_Create(40, 40, 0, 4, 4);
+ himl3 = pImageList_Create(40, 40, 0, 4, 4);
ok(himl1 != NULL, "Failed to create imagelist\n");
ok(himl2 != NULL, "Failed to create imagelist\n");
ok(himl3 != NULL, "Failed to create imagelist\n");
@@ -5977,7 +5994,7 @@ static void test_oneclickactivate(void)
track.cbSize = sizeof(track);
track.dwFlags = TME_QUERY;
- _TrackMouseEvent(&track);
+ p_TrackMouseEvent(&track);
ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
@@ -6241,23 +6258,10 @@ static void test_state_image(void)
START_TEST(listview)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
-
ULONG_PTR ctx_cookie;
HANDLE hCtx;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_LISTVIEW_CLASSES;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
+ init_functions();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
@@ -6319,6 +6323,8 @@ START_TEST(listview)
return;
}
+ init_functions();
+
/* comctl32 version 6 tests start here */
test_get_set_view();
test_canceleditlabel();
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index 4216fd5e67..85822a320c 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -42,6 +42,8 @@
#define SEL_NOTIFY_TEST_ID 100
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static HWND parent_wnd;
@@ -598,8 +600,6 @@ static HWND create_parent_window(void)
{
HWND hwnd;
- InitCommonControls();
-
/* flush message sequences, so we can check the new sequence by the end of function */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@@ -2039,22 +2039,23 @@ static void test_sel_notify(void)
}
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(InitCommonControlsEx);
+#undef X
+}
+
START_TEST(monthcal)
{
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
- HMODULE hComctl32;
-
ULONG_PTR ctx_cookie;
HANDLE hCtx;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
+ init_functions();
+
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
diff --git a/dlls/comctl32/tests/mru.c b/dlls/comctl32/tests/mru.c
index af49aba213..664f7a54f4 100644
--- a/dlls/comctl32/tests/mru.c
+++ b/dlls/comctl32/tests/mru.c
@@ -76,18 +76,22 @@ static INT (WINAPI *pFindMRUData)(HANDLE, LPCVOID, DWORD, LPINT);
static INT (WINAPI *pAddMRUData)(HANDLE, LPCVOID, DWORD);
static HANDLE (WINAPI *pCreateMRUListW)(MRUINFOW*);
-static void InitPointers(void)
+static void init_functions(void)
{
- pCreateMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)151);
- pFreeMRUList = (void*)GetProcAddress(hComctl32,(LPCSTR)152);
- pAddMRUStringA = (void*)GetProcAddress(hComctl32,(LPCSTR)153);
- pEnumMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)154);
- pCreateMRUListLazyA = (void*)GetProcAddress(hComctl32,(LPCSTR)157);
- pAddMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)167);
- pFindMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)169);
- pCreateMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)400);
- pEnumMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)403);
- pCreateMRUListLazyW = (void*)GetProcAddress(hComctl32,(LPCSTR)404);
+ hComctl32 = LoadLibraryA("comctl32.dll");
+
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComctl32, (const char *)ord);
+ X2(CreateMRUListA, 151);
+ X2(FreeMRUList, 152);
+ X2(AddMRUStringA, 153);
+ X2(EnumMRUListA, 154);
+ X2(CreateMRUListLazyA, 157);
+ X2(AddMRUData, 167);
+ X2(FindMRUData, 169);
+ X2(CreateMRUListW, 400);
+ X2(EnumMRUListW, 403);
+ X2(CreateMRUListLazyW, 404);
+#undef X2
}
/* Based on RegDeleteTreeW from dlls/advapi32/registry.c */
@@ -705,13 +709,11 @@ static void test_CreateMRUListLazyW(void)
START_TEST(mru)
{
- hComctl32 = GetModuleHandleA("comctl32.dll");
-
delete_reg_entries();
if (!create_reg_entries())
return;
- InitPointers();
+ init_functions();
test_MRUListA();
test_CreateMRUListLazyA();
diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c
index a9409eac08..0da396cdd1 100644
--- a/dlls/comctl32/tests/pager.c
+++ b/dlls/comctl32/tests/pager.c
@@ -339,7 +339,6 @@ START_TEST(pager)
pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
- InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
parent_wnd = create_parent_window();
diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c
index 7f69c35232..9dd4b55202 100644
--- a/dlls/comctl32/tests/progress.c
+++ b/dlls/comctl32/tests/progress.c
@@ -30,6 +30,7 @@
static HWND hProgressParentWnd, hProgressWnd;
static const char progressTestClass[] = "ProgressBarTestClass";
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
static HWND create_progress(DWORD style)
{
@@ -94,24 +95,10 @@ static void update_window(HWND hWnd)
static void init(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
RECT rect;
BOOL ret;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_PROGRESS_CLASS;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
@@ -135,7 +122,7 @@ static void init(void)
GetClientRect(hProgressParentWnd, &rect);
hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
- ok(hProgressWnd != NULL, "failed to create parent wnd\n");
+ ok(hProgressWnd != NULL, "Failed to create progress bar.\n");
progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);
ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
@@ -250,8 +237,25 @@ static void test_setcolors(void)
DestroyWindow(progress);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(InitCommonControlsEx);
+#undef X
+}
+
START_TEST(progress)
{
+ INITCOMMONCONTROLSEX iccex;
+
+ init_functions();
+
+ iccex.dwSize = sizeof(iccex);
+ iccex.dwICC = ICC_PROGRESS_CLASS;
+ pInitCommonControlsEx(&iccex);
+
init();
test_redraw();
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index ec53e6bc7c..2a4afaa51e 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -34,6 +34,10 @@ static LONG active_page = -1;
#define IDC_APPLY_BUTTON 12321
+static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageA)(const PROPSHEETPAGEA *desc);
+static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageW)(const PROPSHEETPAGEW *desc);
+static BOOL (WINAPI *pDestroyPropertySheetPage)(HPROPSHEETPAGE proppage);
+static INT_PTR (WINAPI *pPropertySheetA)(const PROPSHEETHEADERA *header);
static void detect_locale(void)
{
@@ -141,7 +145,7 @@ static void test_title(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -152,7 +156,7 @@ static void test_title(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
style = GetWindowLongA(hdlg, GWL_STYLE);
@@ -180,7 +184,7 @@ static void test_nopage(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -191,7 +195,7 @@ static void test_nopage(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
ShowWindow(hdlg,SW_NORMAL);
@@ -260,7 +264,7 @@ static void test_disableowner(void)
psp.pfnDlgProc = NULL;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -271,7 +275,7 @@ static void test_disableowner(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = disableowner_callback;
- p = PropertySheetA(&psh);
+ p = pPropertySheetA(&psh);
todo_wine
ok(p == 0, "Expected 0, got %ld\n", p);
ok(IsWindowEnabled(parenthwnd) != 0, "parent window should be enabled\n");
@@ -357,25 +361,25 @@ static void test_wiznavigation(void)
psp[0].hInstance = GetModuleHandleA(NULL);
U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
psp[0].pfnDlgProc = nav_page_proc;
- hpsp[0] = CreatePropertySheetPageA(&psp[0]);
+ hpsp[0] = pCreatePropertySheetPageA(&psp[0]);
psp[1].dwSize = sizeof(PROPSHEETPAGEA);
psp[1].hInstance = GetModuleHandleA(NULL);
U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
psp[1].pfnDlgProc = nav_page_proc;
- hpsp[1] = CreatePropertySheetPageA(&psp[1]);
+ hpsp[1] = pCreatePropertySheetPageA(&psp[1]);
psp[2].dwSize = sizeof(PROPSHEETPAGEA);
psp[2].hInstance = GetModuleHandleA(NULL);
U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
psp[2].pfnDlgProc = nav_page_proc;
- hpsp[2] = CreatePropertySheetPageA(&psp[2]);
+ hpsp[2] = pCreatePropertySheetPageA(&psp[2]);
psp[3].dwSize = sizeof(PROPSHEETPAGEA);
psp[3].hInstance = GetModuleHandleA(NULL);
U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
psp[3].pfnDlgProc = nav_page_proc;
- hpsp[3] = CreatePropertySheetPageA(&psp[3]);
+ hpsp[3] = pCreatePropertySheetPageA(&psp[3]);
/* set up the property sheet dialog */
memset(&psh, 0, sizeof(psh));
@@ -385,7 +389,7 @@ static void test_wiznavigation(void)
psh.nPages = 4;
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);
@@ -480,7 +484,7 @@ static void test_buttons(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -491,7 +495,7 @@ static void test_buttons(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got null handle\n");
/* OK button */
@@ -587,7 +591,7 @@ static void test_custom_default_button(void)
add_button_has_been_pressed = FALSE;
/* Create the modeless property sheet. */
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
/* Set the Add button as the default button. */
@@ -798,7 +802,7 @@ static void test_messages(void)
psp.pfnDlgProc = page_dlg_proc_messages;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -810,7 +814,7 @@ static void test_messages(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback_messages;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
ShowWindow(hdlg,SW_NORMAL);
@@ -839,15 +843,15 @@ static void test_PSM_ADDPAGE(void)
psp.lParam = 0;
/* multiple pages with the same data */
- hpsp[0] = CreatePropertySheetPageA(&psp);
- hpsp[1] = CreatePropertySheetPageA(&psp);
- hpsp[2] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
+ hpsp[1] = pCreatePropertySheetPageA(&psp);
+ hpsp[2] = pCreatePropertySheetPageA(&psp);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
- hpsp[3] = CreatePropertySheetPageA(&psp);
+ hpsp[3] = pCreatePropertySheetPageA(&psp);
psp.dwFlags = PSP_PREMATURE;
- hpsp[4] = CreatePropertySheetPageA(&psp);
+ hpsp[4] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -857,7 +861,7 @@ static void test_PSM_ADDPAGE(void)
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
/* add pages one by one */
@@ -906,7 +910,7 @@ if (0)
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
- DestroyPropertySheetPage(hpsp[4]);
+ pDestroyPropertySheetPage(hpsp[4]);
DestroyWindow(hdlg);
}
@@ -929,15 +933,15 @@ static void test_PSM_INSERTPAGE(void)
psp.lParam = 0;
/* multiple pages with the same data */
- hpsp[0] = CreatePropertySheetPageA(&psp);
- hpsp[1] = CreatePropertySheetPageA(&psp);
- hpsp[2] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
+ hpsp[1] = pCreatePropertySheetPageA(&psp);
+ hpsp[2] = pCreatePropertySheetPageA(&psp);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
- hpsp[3] = CreatePropertySheetPageA(&psp);
+ hpsp[3] = pCreatePropertySheetPageA(&psp);
psp.dwFlags = PSP_PREMATURE;
- hpsp[4] = CreatePropertySheetPageA(&psp);
+ hpsp[4] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -947,7 +951,7 @@ static void test_PSM_INSERTPAGE(void)
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
/* add pages one by one */
@@ -1000,7 +1004,7 @@ if (0)
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
- DestroyPropertySheetPage(hpsp[4]);
+ pDestroyPropertySheetPage(hpsp[4]);
DestroyWindow(hdlg);
}
@@ -1090,7 +1094,7 @@ static void test_CreatePropertySheetPage(void)
for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++)
{
page.addref_called = 0;
- hpsp = CreatePropertySheetPageA(&page.u.pageA);
+ hpsp = pCreatePropertySheetPageA(&page.u.pageA);
if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
@@ -1103,7 +1107,7 @@ static void test_CreatePropertySheetPage(void)
if (hpsp)
{
page.release_called = 0;
- ret = DestroyPropertySheetPage(hpsp);
+ ret = pDestroyPropertySheetPage(hpsp);
ok(ret, "Failed to destroy a page\n");
ok(page.release_called == 1, "Expected RELEASE callback message\n");
}
@@ -1119,7 +1123,7 @@ static void test_CreatePropertySheetPage(void)
for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++)
{
page.addref_called = 0;
- hpsp = CreatePropertySheetPageW(&page.u.pageW);
+ hpsp = pCreatePropertySheetPageW(&page.u.pageW);
if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
@@ -1132,13 +1136,25 @@ static void test_CreatePropertySheetPage(void)
if (hpsp)
{
page.release_called = 0;
- ret = DestroyPropertySheetPage(hpsp);
+ ret = pDestroyPropertySheetPage(hpsp);
ok(ret, "Failed to destroy a page\n");
ok(page.release_called == 1, "Expected RELEASE callback message\n");
}
}
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(CreatePropertySheetPageA);
+ X(CreatePropertySheetPageW);
+ X(DestroyPropertySheetPage);
+ X(PropertySheetA);
+#undef X
+}
+
START_TEST(propsheet)
{
detect_locale();
@@ -1150,6 +1166,8 @@ START_TEST(propsheet)
SetProcessDefaultLayout(LAYOUT_RTL);
}
+ init_functions();
+
test_title();
test_nopage();
test_disableowner();
diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index 6430ba2b61..2ff4cebdf9 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -30,6 +30,9 @@
#include "wine/test.h"
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
+
static RECT height_change_notify_rect;
static HWND hMainWnd;
static int system_font_height;
@@ -577,7 +580,7 @@ static void test_layout(void)
check_sizes();
/* an image will increase the band height */
- himl = ImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
+ himl = pImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ri.cbSize = sizeof(ri);
ri.fMask = RBIM_IMAGELIST;
@@ -658,7 +661,7 @@ static void test_layout(void)
rbsize_results_free();
DestroyWindow(hRebar);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
}
#if 0 /* use this to generate more tests */
@@ -1125,26 +1128,22 @@ static void test_notification(void)
DestroyWindow(rebar);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Destroy);
+ X(ImageList_LoadImageA);
+#undef X
+}
+
START_TEST(rebar)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
MSG msg;
init_system_font_height();
-
- /* LoadLibrary is needed. This file has no reference to functions in comctl32 */
- hComctl32 = LoadLibraryA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_COOL_CLASSES;
- pInitCommonControlsEx(&iccex);
+ init_functions();
hMainWnd = create_parent_window();
@@ -1169,6 +1168,4 @@ out:
DispatchMessageA(&msg);
}
DestroyWindow(hMainWnd);
-
- FreeLibrary(hComctl32);
}
diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index a394beb42a..f2fe1abf98 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -43,6 +43,8 @@ static INT g_dpisize;
static int g_wmdrawitm_ctr;
static WNDPROC g_wndproc_saved;
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
+
static HWND create_status_control(DWORD style, DWORD exstyle)
{
HWND hWndStatus;
@@ -584,17 +586,32 @@ static void test_notify(void)
ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n");
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(InitCommonControlsEx);
+#undef X
+}
+
START_TEST(status)
{
+ INITCOMMONCONTROLSEX iccex;
+
+ init_functions();
+
hinst = GetModuleHandleA(NULL);
+ iccex.dwSize = sizeof(iccex);
+ iccex.dwICC = ICC_BAR_CLASSES;
+ pInitCommonControlsEx(&iccex);
+
g_hMainWnd = CreateWindowExA(0, "static", "", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
NULL, NULL, GetModuleHandleA(NULL), 0);
- InitCommonControls();
-
register_subclass();
test_status_control();
diff --git a/dlls/comctl32/tests/subclass.c b/dlls/comctl32/tests/subclass.c
index 720c68e28d..abe63a1547 100644
--- a/dlls/comctl32/tests/subclass.c
+++ b/dlls/comctl32/tests/subclass.c
@@ -286,7 +286,7 @@ static BOOL init_function_pointers(void)
HMODULE hmod;
void *ptr;
- hmod = GetModuleHandleA("comctl32.dll");
+ hmod = LoadLibraryA("comctl32.dll");
ok(hmod != NULL, "got %p\n", hmod);
/* Functions have to be loaded by ordinal. Only XP and W2K3 export
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 72165c8100..0bfbb38a58 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -40,6 +40,11 @@
#define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
+static HIMAGELIST (WINAPI *pImageList_Create)(INT,INT,UINT,INT,INT);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
+static INT (WINAPI *pImageList_ReplaceIcon)(HIMAGELIST,INT,HICON);
+
static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
{
RECT r;
@@ -470,7 +475,7 @@ static void test_tab(INT nMinTabWidth)
{
HWND hwTab;
RECT rTab;
- HIMAGELIST himl = ImageList_Create(21, 21, ILC_COLOR, 3, 4);
+ HIMAGELIST himl = pImageList_Create(21, 21, ILC_COLOR, 3, 4);
SIZE size;
HDC hdc;
HFONT hOldFont;
@@ -608,7 +613,7 @@ static void test_tab(INT nMinTabWidth)
DestroyWindow (hwTab);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
}
static void test_width(void)
@@ -1165,12 +1170,12 @@ static void test_removeimage(void)
INT i;
TCITEMA item;
HICON hicon;
- HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR, 3, 4);
+ HIMAGELIST himl = pImageList_Create(16, 16, ILC_COLOR, 3, 4);
hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
- ImageList_AddIcon(himl, hicon);
- ImageList_AddIcon(himl, hicon);
- ImageList_AddIcon(himl, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
SendMessageA(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
@@ -1185,7 +1190,8 @@ static void test_removeimage(void)
/* remove image middle image */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 1, 0);
- expect(2, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 2, "Unexpected image count %d.\n", i);
item.iImage = -1;
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
expect(0, item.iImage);
@@ -1197,7 +1203,8 @@ static void test_removeimage(void)
expect(1, item.iImage);
/* remove first image */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
- expect(1, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 1, "Unexpected image count %d.\n", i);
item.iImage = 0;
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
expect(-1, item.iImage);
@@ -1209,7 +1216,8 @@ static void test_removeimage(void)
expect(0, item.iImage);
/* remove the last one */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
- expect(0, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 0, "Unexpected image count %d.\n", i);
for(i = 0; i < 3; i++) {
item.iImage = 0;
SendMessageA(hwTab, TCM_GETITEMA, i, (LPARAM)&item);
@@ -1217,7 +1225,7 @@ static void test_removeimage(void)
}
DestroyWindow(hwTab);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
DestroyIcon(hicon);
}
@@ -1423,6 +1431,18 @@ static void test_create(void)
}
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+ X(ImageList_GetImageCount);
+ X(ImageList_ReplaceIcon);
+#undef X
+}
+
START_TEST(tab)
{
LOGFONTA logfont;
@@ -1434,7 +1454,7 @@ START_TEST(tab)
logfont.lfCharSet = ANSI_CHARSET;
hFont = CreateFontIndirectA(&logfont);
- InitCommonControls();
+ init_functions();
test_width();
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 2c1b789484..38b8339378 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -37,6 +37,13 @@
#define PARENT_SEQ_INDEX 0
#define NUM_MSG_SEQUENCES 1
+static HWND (WINAPI *pCreateToolbarEx)(HWND, DWORD, UINT, INT, HINSTANCE, UINT_PTR, const TBBUTTON *,
+ INT, INT, INT, INT, INT, UINT);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
+static BOOL (WINAPI *pImageList_GetIconSize)(HIMAGELIST, int *, int *);
+static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static HWND hMainWnd;
@@ -376,7 +383,7 @@ static void basic_test(void)
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
WS_CHILD | TBSTYLE_LIST,
100,
@@ -482,8 +489,8 @@ static void add_128x15_bitmap(HWND hToolbar, int nCmds)
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
ok(himl != NULL, "No image list\n"); \
if (himl != NULL) {\
- ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
- ImageList_GetIconSize(himl, &cx, &cy); \
+ ok(pImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, pImageList_GetImageCount(himl)); \
+ pImageList_GetIconSize(himl, &cx, &cy); \
ok(cx == dx && cy == dy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
@@ -515,11 +522,11 @@ static void test_add_bitmap(void)
himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0);
ok(himl != NULL, "Got %p\n", himl);
- ret = ImageList_GetIconSize(himl, &cx, &cy);
+ ret = pImageList_GetIconSize(himl, &cx, &cy);
ok(ret, "Got %d\n", ret);
ok(cx == cy, "Got %d x %d\n", cx, cy);
- count = ImageList_GetImageCount(himl);
+ count = pImageList_GetImageCount(himl);
/* Image count */
switch (id)
@@ -688,7 +695,7 @@ static void test_add_bitmap(void)
/* the control can add bitmaps to an existing image list */
rebuild_toolbar(&hToolbar);
- himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
+ himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(himl != NULL, "failed to create imagelist\n");
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
@@ -709,7 +716,7 @@ static void test_add_bitmap(void)
addbmp.hInst = HINST_COMMCTRL;
addbmp.nID = IDB_STD_SMALL_COLOR;
rebuild_toolbar(&hToolbar);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
CHECK_IMAGELIST(15, 16, 16);
@@ -1506,14 +1513,14 @@ static void test_sizes(void)
/* TB_SETIMAGELIST always changes the height but the width only if necessary */
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
- himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
+ himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
check_button_size(hToolbar, 100, 21);
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
check_button_size(hToolbar, 100, 100);
/* But there are no update when we change imagelist, and image sizes are the same */
- himl2 = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
+ himl2 = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LRESULT)himl2) == (LRESULT)himl, "TB_SETIMAGELIST failed\n");
check_button_size(hToolbar, 100, 100);
@@ -1538,8 +1545,8 @@ static void test_sizes(void)
check_sizes_todo(0x30); /* some small problems with BTNS_AUTOSIZE button sizes */
rebuild_toolbar(&hToolbar);
- ImageList_Destroy(himl);
- ImageList_Destroy(himl2);
+ pImageList_Destroy(himl);
+ pImageList_Destroy(himl2);
SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons3[3]);
check_button_size(hToolbar, 7 + string_width(STRING2), 23 + fontheight);
@@ -1823,43 +1830,43 @@ static void test_createtoolbarex(void)
TBBUTTON btns[3];
ZeroMemory(&btns, sizeof(btns));
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 20, 20, 16, 16, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 20, 20);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x1a001b, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 4, 4, 16, 16, sizeof(TBBUTTON));
CHECK_IMAGELIST(32, 4, 4);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xa000b, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 8, 12, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 12);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x120013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, -1, 8, 12, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 8);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, -1, 8, -1, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 16, 8);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0017, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 0, 12, -1, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 16);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 0, 0, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 16, 16);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160017, "%x");
@@ -1928,7 +1935,7 @@ static void test_setrows(void)
MakeButton(buttons+i, 1000+i, TBSTYLE_FLAT | TBSTYLE_CHECKGROUP, 0);
/* Test 1 - 9 buttons */
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD | CCS_NORESIZE | CCS_NOPARENTALIGN
| CCS_NOMOVEY | CCS_TOP,
0,
@@ -2047,7 +2054,7 @@ static void test_get_set_style(void)
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
WS_CHILD | TBSTYLE_LIST,
100,
@@ -2507,6 +2514,19 @@ static void test_imagelist(void)
DestroyWindow(hwnd);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(CreateToolbarEx);
+ X(ImageList_GetIconSize);
+ X(ImageList_GetImageCount);
+ X(ImageList_LoadImageA);
+ X(ImageList_Destroy);
+#undef X
+}
+
START_TEST(toolbar)
{
WNDCLASSA wc;
@@ -2514,9 +2534,8 @@ START_TEST(toolbar)
RECT rc;
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
+ init_functions();
- InitCommonControls();
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c
index be6ab400a0..7e82604376 100644
--- a/dlls/comctl32/tests/tooltips.c
+++ b/dlls/comctl32/tests/tooltips.c
@@ -1057,7 +1057,7 @@ static void test_margin(void)
START_TEST(tooltips)
{
- InitCommonControls();
+ LoadLibraryA("comctl32.dll");
test_create_tooltip();
test_customdraw();
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index 9cc8b277ee..31845d10e0 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -1296,8 +1296,9 @@ static void test_create(void)
START_TEST(trackbar)
{
+ LoadLibraryA("comctl32.dll");
+
init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
- InitCommonControls();
/* create parent window */
hWndParent = create_parent_window();
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index a014625a0a..51404af089 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -33,6 +33,7 @@
#include "v6util.h"
#include "msg.h"
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
static const char *TEST_CALLBACK_TEXT = "callback_text";
static TVITEMA g_item_expanding, g_item_expanded;
@@ -2666,27 +2667,28 @@ static void test_right_click(void)
DestroyWindow(hTree);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(InitCommonControlsEx);
+#undef X
+}
+
START_TEST(treeview)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
+ INITCOMMONCONTROLSEX iccex;
+ ULONG_PTR ctx_cookie;
+ HANDLE hCtx;
WNDCLASSA wc;
MSG msg;
- ULONG_PTR ctx_cookie;
- HANDLE hCtx;
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_TREEVIEW_CLASSES;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
+ init_functions();
+
+ iccex.dwSize = sizeof(iccex);
+ iccex.dwICC = ICC_TREEVIEW_CLASSES;
+ pInitCommonControlsEx(&iccex);
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
init_msg_sequences(item_sequence, 1);
diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c
index 639e7802a9..f549c41583 100644
--- a/dlls/comctl32/tests/updown.c
+++ b/dlls/comctl32/tests/updown.c
@@ -63,6 +63,8 @@
static HWND parent_wnd, g_edit;
+static HWND (WINAPI *pCreateUpDownControl)(DWORD, INT, INT, INT, INT,
+ HWND, INT, HINSTANCE, HWND, INT, INT, INT);
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
@@ -882,7 +884,7 @@ static void test_CreateUpDownControl(void)
RECT rect;
GetClientRect(parent_wnd, &rect);
- updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
+ updown = pCreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), g_edit, 100, 10, 50);
ok(updown != NULL, "Failed to create control.\n");
@@ -898,13 +900,22 @@ static void test_CreateUpDownControl(void)
DestroyWindow(updown);
}
-START_TEST(updown)
+static void init_functions(void)
{
- HMODULE mod = GetModuleHandleA("comctl32.dll");
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ X(CreateUpDownControl);
+ X2(SetWindowSubclass, 410);
+#undef X
+#undef X2
+}
- pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
+START_TEST(updown)
+{
+ init_functions();
- InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
parent_wnd = create_parent_window();
--
2.15.1
1
0
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/comctl32/tests/Makefile.in | 2 +-
dlls/comctl32/tests/animate.c | 22 +----------
dlls/comctl32/tests/combo.c | 29 +++++++-------
dlls/comctl32/tests/datetime.c | 15 -------
dlls/comctl32/tests/dpa.c | 67 +++++++++++++-------------------
dlls/comctl32/tests/header.c | 38 +++++++++---------
dlls/comctl32/tests/imagelist.c | 36 ++++++++---------
dlls/comctl32/tests/ipaddress.c | 25 ------------
dlls/comctl32/tests/listview.c | 74 +++++++++++++++++++----------------
dlls/comctl32/tests/monthcal.c | 17 --------
dlls/comctl32/tests/mru.c | 30 +++++++-------
dlls/comctl32/tests/pager.c | 1 -
dlls/comctl32/tests/progress.c | 14 -------
dlls/comctl32/tests/propsheet.c | 86 +++++++++++++++++++++++++----------------
dlls/comctl32/tests/rebar.c | 35 ++++++++---------
dlls/comctl32/tests/status.c | 2 -
dlls/comctl32/tests/subclass.c | 2 +-
dlls/comctl32/tests/tab.c | 42 ++++++++++++++------
dlls/comctl32/tests/toolbar.c | 63 +++++++++++++++++++-----------
dlls/comctl32/tests/tooltips.c | 2 +-
dlls/comctl32/tests/trackbar.c | 3 +-
dlls/comctl32/tests/treeview.c | 14 -------
dlls/comctl32/tests/updown.c | 21 +++++++---
23 files changed, 296 insertions(+), 344 deletions(-)
diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in
index f93ff2585d..4669efcf2b 100644
--- a/dlls/comctl32/tests/Makefile.in
+++ b/dlls/comctl32/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = comctl32.dll
-IMPORTS = comctl32 ole32 user32 gdi32 advapi32
+IMPORTS = ole32 user32 gdi32 advapi32
C_SRCS = \
animate.c \
diff --git a/dlls/comctl32/tests/animate.c b/dlls/comctl32/tests/animate.c
index fab345bb47..400de55b5e 100644
--- a/dlls/comctl32/tests/animate.c
+++ b/dlls/comctl32/tests/animate.c
@@ -108,26 +108,6 @@ static void create_animate(DWORD parent_style, DWORD animate_style)
update_window(hAnimateParentWnd);
}
-static void init(void)
-{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_ANIMATE_CLASS;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
-
- shell32 = LoadLibraryA("Shell32.dll");
-}
-
static void destroy_animate(void)
{
MSG msg;
@@ -175,7 +155,7 @@ static void test_play(void)
START_TEST(animate)
{
- init();
+ shell32 = LoadLibraryA("Shell32.dll");
test_play();
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c
index ef7c3f796b..895d9429b4 100644
--- a/dlls/comctl32/tests/combo.c
+++ b/dlls/comctl32/tests/combo.c
@@ -480,25 +480,20 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
return 0L;
}
-static BOOL init(void)
+static void init_functions(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- WNDCLASSA wc;
- INITCOMMONCONTROLSEX iccex;
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return FALSE;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_USEREX_CLASSES;
- pInitCommonControlsEx(&iccex);
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ X2(SetWindowSubclass, 410);
+#undef X
+#undef X2
+}
- pSetWindowSubclass = (void*)GetProcAddress(hComctl32, (LPSTR)410);
+static BOOL init(void)
+{
+ WNDCLASSA wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@@ -1161,6 +1156,8 @@ START_TEST(combo)
ULONG_PTR ctx_cookie;
HANDLE hCtx;
+ init_functions();
+
if (!init())
return;
diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c
index c9407bef61..691eac9813 100644
--- a/dlls/comctl32/tests/datetime.c
+++ b/dlls/comctl32/tests/datetime.c
@@ -779,21 +779,6 @@ static void test_dts_shownone(void)
START_TEST(datetime)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_DATE_CLASSES;
- pInitCommonControlsEx(&iccex);
-
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_dtm_set_format();
diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c
index 4eb32a4187..c795c14f4e 100644
--- a/dlls/comctl32/tests/dpa.c
+++ b/dlls/comctl32/tests/dpa.c
@@ -59,38 +59,33 @@ static INT (WINAPI *pDPA_Search)(HDPA,PVOID,INT,PFNDPACOMPARE,LPARAM,UINT);
static BOOL (WINAPI *pDPA_SetPtr)(HDPA,INT,PVOID);
static BOOL (WINAPI *pDPA_Sort)(HDPA,PFNDPACOMPARE,LPARAM);
-#define COMCTL32_GET_PROC(func, ord) \
- ((p ## func = (PVOID)GetProcAddress(hcomctl32,(LPCSTR)ord)) ? 1 \
- : (trace( #func " not exported\n"), 0))
-
-static BOOL InitFunctionPtrs(HMODULE hcomctl32)
+static void init_functions(void)
{
- /* 4.00+ */
- if(COMCTL32_GET_PROC(DPA_Clone, 331) &&
- COMCTL32_GET_PROC(DPA_Create, 328) &&
- COMCTL32_GET_PROC(DPA_CreateEx, 340) &&
- COMCTL32_GET_PROC(DPA_DeleteAllPtrs, 337) &&
- COMCTL32_GET_PROC(DPA_DeletePtr, 336) &&
- COMCTL32_GET_PROC(DPA_Destroy, 329) &&
- COMCTL32_GET_PROC(DPA_GetPtr, 332) &&
- COMCTL32_GET_PROC(DPA_GetPtrIndex, 333) &&
- COMCTL32_GET_PROC(DPA_Grow, 330) &&
- COMCTL32_GET_PROC(DPA_InsertPtr, 334) &&
- COMCTL32_GET_PROC(DPA_Search, 339) &&
- COMCTL32_GET_PROC(DPA_SetPtr, 335) &&
- COMCTL32_GET_PROC(DPA_Sort, 338))
- {
- /* 4.71+ */
- COMCTL32_GET_PROC(DPA_DestroyCallback, 386) &&
- COMCTL32_GET_PROC(DPA_EnumCallback, 385) &&
- COMCTL32_GET_PROC(DPA_LoadStream, 9) &&
- COMCTL32_GET_PROC(DPA_Merge, 11) &&
- COMCTL32_GET_PROC(DPA_SaveStream, 10);
-
- return TRUE;
- }
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
- return FALSE;
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ /* 4.00+ */
+ X2(DPA_Clone, 331);
+ X2(DPA_Create, 328);
+ X2(DPA_CreateEx, 340);
+ X2(DPA_DeleteAllPtrs, 337);
+ X2(DPA_DeletePtr, 336);
+ X2(DPA_Destroy, 329);
+ X2(DPA_GetPtr, 332);
+ X2(DPA_GetPtrIndex, 333);
+ X2(DPA_Grow, 330);
+ X2(DPA_InsertPtr, 334);
+ X2(DPA_Search, 339);
+ X2(DPA_SetPtr, 335);
+ X2(DPA_Sort, 338);
+
+ /* 4.71+ */
+ X2(DPA_DestroyCallback, 386);
+ X2(DPA_EnumCallback, 385);
+ X2(DPA_LoadStream, 9);
+ X2(DPA_Merge, 11);
+ X2(DPA_SaveStream, 10);
+#undef X2
}
/* Callbacks */
@@ -628,7 +623,7 @@ static void test_DPA_LoadStream(void)
dpa = NULL;
hRes = pDPA_LoadStream(&dpa, CB_Load, pStm, NULL);
expect(S_OK, hRes);
- DPA_Destroy(dpa);
+ pDPA_Destroy(dpa);
/* try with altered dwData2 field */
header.dwSize = sizeof(header);
@@ -742,15 +737,7 @@ if (0) {
START_TEST(dpa)
{
- HMODULE hcomctl32;
-
- hcomctl32 = GetModuleHandleA("comctl32.dll");
-
- if(!InitFunctionPtrs(hcomctl32))
- {
- win_skip("Needed functions are not available\n");
- return;
- }
+ init_functions();
test_dpa();
test_DPA_Merge();
diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c
index ae75199be2..31610f0c9a 100644
--- a/dlls/comctl32/tests/header.c
+++ b/dlls/comctl32/tests/header.c
@@ -26,6 +26,9 @@
#include "v6util.h"
#include "msg.h"
+static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+
typedef struct tagEXPECTEDNOTIFY
{
INT iCode;
@@ -953,7 +956,7 @@ static void test_hdm_sethotdivider(HWND hParent)
static void test_hdm_imageMessages(HWND hParent)
{
- HIMAGELIST hImageList = ImageList_Create (4, 4, 0, 1, 0);
+ HIMAGELIST hImageList = pImageList_Create (4, 4, 0, 1, 0);
HIMAGELIST hIml;
BOOL wasValid;
HWND hChild;
@@ -973,13 +976,13 @@ static void test_hdm_imageMessages(HWND hParent)
hIml = (HIMAGELIST) SendMessageA(hChild, HDM_CREATEDRAGIMAGE, 0, 0);
ok(hIml != NULL, "Expected non-NULL handle, got %p\n", hIml);
- ImageList_Destroy(hIml);
+ pImageList_Destroy(hIml);
ok_sequence(sequences, HEADER_SEQ_INDEX, imageMessages_seq, "imageMessages sequence testing", FALSE);
DestroyWindow(hChild);
- wasValid = ImageList_Destroy(hImageList);
+ wasValid = pImageList_Destroy(hImageList);
ok(wasValid, "Header must not free image list at destruction!\n");
}
@@ -1644,28 +1647,23 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return 0L;
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+#undef X
+}
+
static BOOL init(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
- INITCOMMONCONTROLSEX iccex;
TEXTMETRICA tm;
HFONT hOldFont;
HDC hdc;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return FALSE;
- }
-
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_USEREX_CLASSES;
- pInitCommonControlsEx(&iccex);
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
@@ -1821,6 +1819,8 @@ START_TEST(header)
ULONG_PTR ctx_cookie;
HANDLE hCtx;
+ init_functions();
+
if (!init())
return;
@@ -1852,6 +1852,8 @@ START_TEST(header)
return;
}
+ init_functions();
+
/* comctl32 version 6 tests start here */
test_hdf_fixedwidth(parent_hwnd);
test_hds_nosizing(parent_hwnd);
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 653467c999..3838563c38 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -85,6 +85,7 @@ static BOOL (WINAPI *pImageList_Write)(HIMAGELIST, IStream *);
static HIMAGELIST (WINAPI *pImageList_Read)(IStream *);
static BOOL (WINAPI *pImageList_Copy)(HIMAGELIST, int, HIMAGELIST, int, UINT);
static HIMAGELIST (WINAPI *pImageList_LoadImageW)(HINSTANCE, LPCWSTR, int, int, COLORREF, UINT, UINT);
+static BOOL (WINAPI *pImageList_Draw)(HIMAGELIST,INT,HDC,INT,INT,UINT);
static HINSTANCE hinst;
@@ -205,7 +206,7 @@ static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size,
SetWindowTextA(hwnd, loc);
hdc = GetDC(hwnd);
- ImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
+ pImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
force_redraw(hwnd);
@@ -504,8 +505,8 @@ static void test_DrawIndirect(void)
ok(hbm3 != 0, "no bitmap 3\n");
/* add three */
- ok(0 == ImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
- ok(1 == ImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
+ ok(0 == pImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
+ ok(1 == pImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
if (pImageList_SetImageCount)
{
@@ -1576,7 +1577,7 @@ cleanup:
if(himl)
{
- ret = ImageList_Destroy(himl);
+ ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
}
}
@@ -1599,21 +1600,21 @@ static void test_iimagelist(void)
imgl = (IImageList*)createImageList(32, 32);
ret = IImageList_AddRef(imgl);
ok(ret == 2, "Expected 2, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
imgl = (IImageList*)createImageList(32, 32);
ret = IImageList_AddRef(imgl);
ok(ret == 2, "Expected 2, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ret = IImageList_Release(imgl);
ok(ret == 0, "Expected 0, got %d\n", ret);
- ret = ImageList_Destroy((HIMAGELIST)imgl);
+ ret = pImageList_Destroy((HIMAGELIST)imgl);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
/* ref counting, HIMAGELIST_QueryInterface adds a reference */
@@ -1674,7 +1675,7 @@ static void test_IImageList_Add_Remove(void)
int ret;
/* create an imagelist to play with */
- himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
ok(himl != 0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1728,7 +1729,7 @@ static void test_IImageList_Get_SetImageCount(void)
INT ret;
/* create an imagelist to play with */
- himl = ImageList_Create(84, 84, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
ok(himl != 0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1773,7 +1774,7 @@ static void test_IImageList_Draw(void)
ok(hdc!=NULL, "couldn't get DC\n");
/* create an imagelist to play with */
- himl = ImageList_Create(48, 48, ILC_COLOR16, 0, 3);
+ himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
ok(himl!=0,"failed to create imagelist\n");
imgl = (IImageList *) himl;
@@ -1850,10 +1851,10 @@ static void test_IImageList_Merge(void)
HRESULT hr;
int ret;
- himl1 = ImageList_Create(32,32,0,0,3);
+ himl1 = pImageList_Create(32,32,0,0,3);
ok(himl1 != NULL,"failed to create himl1\n");
- himl2 = ImageList_Create(32,32,0,0,3);
+ himl2 = pImageList_Create(32,32,0,0,3);
ok(himl2 != NULL,"failed to create himl2\n");
hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
@@ -1887,7 +1888,7 @@ if (0)
/* Same happens if himl2 is empty */
IImageList_Release(imgl2);
- himl2 = ImageList_Create(32,32,0,0,3);
+ himl2 = pImageList_Create(32,32,0,0,3);
ok(himl2 != NULL,"failed to recreate himl2\n");
imgl2 = (IImageList *) himl2;
@@ -2385,7 +2386,7 @@ static void test_IImageList_GetIconSize(void)
static void init_functions(void)
{
- HMODULE hComCtl32 = GetModuleHandleA("comctl32.dll");
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
@@ -2414,6 +2415,7 @@ static void init_functions(void)
X(ImageList_LoadImageW);
X(ImageList_CoCreateInstance);
X(HIMAGELIST_QueryInterface);
+ X(ImageList_Draw);
#undef X
#undef X2
}
@@ -2427,8 +2429,6 @@ START_TEST(imagelist)
hinst = GetModuleHandleA(NULL);
- InitCommonControls();
-
test_create_destroy();
test_begindrag();
test_hotspot();
diff --git a/dlls/comctl32/tests/ipaddress.c b/dlls/comctl32/tests/ipaddress.c
index 093f649c9e..6d8e9ccf4b 100644
--- a/dlls/comctl32/tests/ipaddress.c
+++ b/dlls/comctl32/tests/ipaddress.c
@@ -61,32 +61,7 @@ static void test_get_set_text(void)
DestroyWindow(hwnd);
}
-static BOOL init(void)
-{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing.\n");
- return FALSE;
- }
-
- iccex.dwSize = sizeof(iccex);
- /* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
- iccex.dwICC = ICC_INTERNET_CLASSES;
- pInitCommonControlsEx(&iccex);
-
- return TRUE;
-}
-
START_TEST(ipaddress)
{
- if (!init())
- return;
-
test_get_set_text();
}
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 18e874a00f..72367c67b3 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -28,6 +28,11 @@
#include "v6util.h"
#include "msg.h"
+static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP);
+static BOOL (WINAPI *p_TrackMouseEvent)(TRACKMOUSEEVENT *);
+
enum seq_index {
PARENT_SEQ_INDEX,
PARENT_FULL_SEQ_INDEX,
@@ -73,6 +78,18 @@ static BOOL g_focus_test_LVN_DELETEITEM;
static HWND subclass_editbox(HWND hwndListview);
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+ X(ImageList_Add);
+ X(_TrackMouseEvent);
+#undef X
+}
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static const struct message create_ownerdrawfixed_parent_seq[] = {
@@ -848,13 +865,13 @@ static void test_images(void)
RECT r1, r2;
static CHAR hello[] = "hello";
- himl = ImageList_Create(40, 40, 0, 4, 4);
+ himl = pImageList_Create(40, 40, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 0, "should be zero\n");
hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_OWNERDRAWFIXED,
@@ -1539,7 +1556,7 @@ static void test_create(void)
cls.lpszClassName = "MyListView32";
ok(RegisterClassExA(&cls), "RegisterClassEx failed\n");
- test_create_imagelist = ImageList_Create(16, 16, 0, 5, 10);
+ test_create_imagelist = pImageList_Create(16, 16, 0, 5, 10);
hList = CreateWindowA("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
ok((HIMAGELIST)SendMessageA(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
@@ -3732,15 +3749,15 @@ static void test_hittest(void)
test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, 0, FALSE, TRUE);
test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
/* try with icons, state icons index is 1 based so at least 2 bitmaps needed */
- himl = ImageList_Create(16, 16, 0, 4, 4);
+ himl = pImageList_Create(16, 16, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 0, "should be zero\n");
hbmp = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbmp, 0);
+ r = pImageList_Add(himl, hbmp, 0);
ok(r == 1, "should be one\n");
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
@@ -4022,15 +4039,15 @@ todo_wine
expect(TRUE, r);
/* state icons */
- himl = ImageList_Create(16, 16, 0, 2, 2);
+ himl = pImageList_Create(16, 16, 0, 2, 2);
ok(himl != NULL, "failed to create imagelist\n");
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbm, 0);
+ r = pImageList_Add(himl, hbm, 0);
expect(0, r);
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
- r = ImageList_Add(himl, hbm, 0);
+ r = pImageList_Add(himl, hbm, 0);
expect(1, r);
r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
@@ -4702,9 +4719,9 @@ static void test_getitemspacing(void)
expect(cy, HIWORD(ret));
/* now try with icons */
- himl40 = ImageList_Create(40, 40, 0, 4, 4);
+ himl40 = pImageList_Create(40, 40, 0, 4, 4);
ok(himl40 != NULL, "failed to create imagelist\n");
- himl80 = ImageList_Create(80, 80, 0, 4, 4);
+ himl80 = pImageList_Create(80, 80, 0, 4, 4);
ok(himl80 != NULL, "failed to create imagelist\n");
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40);
expect(0, ret);
@@ -4772,7 +4789,7 @@ static void test_getitemspacing(void)
expect(cy + 40, HIWORD(ret));
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
- ImageList_Destroy(himl80);
+ pImageList_Destroy(himl80);
DestroyWindow(hwnd);
/* LVS_SMALLICON */
hwnd = create_listview_control(LVS_SMALLICON);
@@ -4790,7 +4807,7 @@ static void test_getitemspacing(void)
expect(cy + 40, HIWORD(ret));
SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0);
- ImageList_Destroy(himl40);
+ pImageList_Destroy(himl40);
DestroyWindow(hwnd);
/* LVS_REPORT */
hwnd = create_listview_control(LVS_REPORT);
@@ -4973,11 +4990,11 @@ static void test_approximate_viewrect(void)
/* LVS_ICON */
hwnd = create_listview_control(LVS_ICON);
- himl = ImageList_Create(40, 40, 0, 4, 4);
+ himl = pImageList_Create(40, 40, 0, 4, 4);
ok(himl != NULL, "failed to create imagelist\n");
hbmp = CreateBitmap(40, 40, 1, 1, NULL);
ok(hbmp != NULL, "failed to create bitmap\n");
- ret = ImageList_Add(himl, hbmp, 0);
+ ret = pImageList_Add(himl, hbmp, 0);
expect(0, ret);
ret = SendMessageA(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)himl);
expect(0, ret);
@@ -5594,7 +5611,7 @@ static void test_createdragimage(void)
himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, (LPARAM)&pt);
ok(himl != NULL, "got %p\n", himl);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
DestroyWindow(list);
}
@@ -5709,9 +5726,9 @@ static void test_imagelists(void)
HIMAGELIST himl1, himl2, himl3;
LRESULT ret;
- himl1 = ImageList_Create(40, 40, 0, 4, 4);
- himl2 = ImageList_Create(40, 40, 0, 4, 4);
- himl3 = ImageList_Create(40, 40, 0, 4, 4);
+ himl1 = pImageList_Create(40, 40, 0, 4, 4);
+ himl2 = pImageList_Create(40, 40, 0, 4, 4);
+ himl3 = pImageList_Create(40, 40, 0, 4, 4);
ok(himl1 != NULL, "Failed to create imagelist\n");
ok(himl2 != NULL, "Failed to create imagelist\n");
ok(himl3 != NULL, "Failed to create imagelist\n");
@@ -5977,7 +5994,7 @@ static void test_oneclickactivate(void)
track.cbSize = sizeof(track);
track.dwFlags = TME_QUERY;
- _TrackMouseEvent(&track);
+ p_TrackMouseEvent(&track);
ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
@@ -6241,23 +6258,10 @@ static void test_state_image(void)
START_TEST(listview)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
-
ULONG_PTR ctx_cookie;
HANDLE hCtx;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_LISTVIEW_CLASSES;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
+ init_functions();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
@@ -6319,6 +6323,8 @@ START_TEST(listview)
return;
}
+ init_functions();
+
/* comctl32 version 6 tests start here */
test_get_set_view();
test_canceleditlabel();
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index 4216fd5e67..10bad66da6 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -598,8 +598,6 @@ static HWND create_parent_window(void)
{
HWND hwnd;
- InitCommonControls();
-
/* flush message sequences, so we can check the new sequence by the end of function */
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@@ -2041,24 +2039,9 @@ static void test_sel_notify(void)
START_TEST(monthcal)
{
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
- HMODULE hComctl32;
-
ULONG_PTR ctx_cookie;
HANDLE hCtx;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_DATE_CLASSES;
- pInitCommonControlsEx(&iccex);
-
test_monthcal();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
diff --git a/dlls/comctl32/tests/mru.c b/dlls/comctl32/tests/mru.c
index af49aba213..664f7a54f4 100644
--- a/dlls/comctl32/tests/mru.c
+++ b/dlls/comctl32/tests/mru.c
@@ -76,18 +76,22 @@ static INT (WINAPI *pFindMRUData)(HANDLE, LPCVOID, DWORD, LPINT);
static INT (WINAPI *pAddMRUData)(HANDLE, LPCVOID, DWORD);
static HANDLE (WINAPI *pCreateMRUListW)(MRUINFOW*);
-static void InitPointers(void)
+static void init_functions(void)
{
- pCreateMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)151);
- pFreeMRUList = (void*)GetProcAddress(hComctl32,(LPCSTR)152);
- pAddMRUStringA = (void*)GetProcAddress(hComctl32,(LPCSTR)153);
- pEnumMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)154);
- pCreateMRUListLazyA = (void*)GetProcAddress(hComctl32,(LPCSTR)157);
- pAddMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)167);
- pFindMRUData = (void*)GetProcAddress(hComctl32,(LPCSTR)169);
- pCreateMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)400);
- pEnumMRUListW = (void*)GetProcAddress(hComctl32,(LPCSTR)403);
- pCreateMRUListLazyW = (void*)GetProcAddress(hComctl32,(LPCSTR)404);
+ hComctl32 = LoadLibraryA("comctl32.dll");
+
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComctl32, (const char *)ord);
+ X2(CreateMRUListA, 151);
+ X2(FreeMRUList, 152);
+ X2(AddMRUStringA, 153);
+ X2(EnumMRUListA, 154);
+ X2(CreateMRUListLazyA, 157);
+ X2(AddMRUData, 167);
+ X2(FindMRUData, 169);
+ X2(CreateMRUListW, 400);
+ X2(EnumMRUListW, 403);
+ X2(CreateMRUListLazyW, 404);
+#undef X2
}
/* Based on RegDeleteTreeW from dlls/advapi32/registry.c */
@@ -705,13 +709,11 @@ static void test_CreateMRUListLazyW(void)
START_TEST(mru)
{
- hComctl32 = GetModuleHandleA("comctl32.dll");
-
delete_reg_entries();
if (!create_reg_entries())
return;
- InitPointers();
+ init_functions();
test_MRUListA();
test_CreateMRUListLazyA();
diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c
index a9409eac08..0da396cdd1 100644
--- a/dlls/comctl32/tests/pager.c
+++ b/dlls/comctl32/tests/pager.c
@@ -339,7 +339,6 @@ START_TEST(pager)
pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
- InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
parent_wnd = create_parent_window();
diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c
index 7f69c35232..bc7284b78d 100644
--- a/dlls/comctl32/tests/progress.c
+++ b/dlls/comctl32/tests/progress.c
@@ -94,24 +94,10 @@ static void update_window(HWND hWnd)
static void init(void)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
RECT rect;
BOOL ret;
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_PROGRESS_CLASS;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index ec53e6bc7c..2a4afaa51e 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -34,6 +34,10 @@ static LONG active_page = -1;
#define IDC_APPLY_BUTTON 12321
+static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageA)(const PROPSHEETPAGEA *desc);
+static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageW)(const PROPSHEETPAGEW *desc);
+static BOOL (WINAPI *pDestroyPropertySheetPage)(HPROPSHEETPAGE proppage);
+static INT_PTR (WINAPI *pPropertySheetA)(const PROPSHEETHEADERA *header);
static void detect_locale(void)
{
@@ -141,7 +145,7 @@ static void test_title(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -152,7 +156,7 @@ static void test_title(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
style = GetWindowLongA(hdlg, GWL_STYLE);
@@ -180,7 +184,7 @@ static void test_nopage(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -191,7 +195,7 @@ static void test_nopage(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
ShowWindow(hdlg,SW_NORMAL);
@@ -260,7 +264,7 @@ static void test_disableowner(void)
psp.pfnDlgProc = NULL;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -271,7 +275,7 @@ static void test_disableowner(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = disableowner_callback;
- p = PropertySheetA(&psh);
+ p = pPropertySheetA(&psh);
todo_wine
ok(p == 0, "Expected 0, got %ld\n", p);
ok(IsWindowEnabled(parenthwnd) != 0, "parent window should be enabled\n");
@@ -357,25 +361,25 @@ static void test_wiznavigation(void)
psp[0].hInstance = GetModuleHandleA(NULL);
U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
psp[0].pfnDlgProc = nav_page_proc;
- hpsp[0] = CreatePropertySheetPageA(&psp[0]);
+ hpsp[0] = pCreatePropertySheetPageA(&psp[0]);
psp[1].dwSize = sizeof(PROPSHEETPAGEA);
psp[1].hInstance = GetModuleHandleA(NULL);
U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
psp[1].pfnDlgProc = nav_page_proc;
- hpsp[1] = CreatePropertySheetPageA(&psp[1]);
+ hpsp[1] = pCreatePropertySheetPageA(&psp[1]);
psp[2].dwSize = sizeof(PROPSHEETPAGEA);
psp[2].hInstance = GetModuleHandleA(NULL);
U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
psp[2].pfnDlgProc = nav_page_proc;
- hpsp[2] = CreatePropertySheetPageA(&psp[2]);
+ hpsp[2] = pCreatePropertySheetPageA(&psp[2]);
psp[3].dwSize = sizeof(PROPSHEETPAGEA);
psp[3].hInstance = GetModuleHandleA(NULL);
U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
psp[3].pfnDlgProc = nav_page_proc;
- hpsp[3] = CreatePropertySheetPageA(&psp[3]);
+ hpsp[3] = pCreatePropertySheetPageA(&psp[3]);
/* set up the property sheet dialog */
memset(&psh, 0, sizeof(psh));
@@ -385,7 +389,7 @@ static void test_wiznavigation(void)
psh.nPages = 4;
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);
@@ -480,7 +484,7 @@ static void test_buttons(void)
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -491,7 +495,7 @@ static void test_buttons(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got null handle\n");
/* OK button */
@@ -587,7 +591,7 @@ static void test_custom_default_button(void)
add_button_has_been_pressed = FALSE;
/* Create the modeless property sheet. */
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
/* Set the Add button as the default button. */
@@ -798,7 +802,7 @@ static void test_messages(void)
psp.pfnDlgProc = page_dlg_proc_messages;
psp.lParam = 0;
- hpsp[0] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -810,7 +814,7 @@ static void test_messages(void)
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback_messages;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
ShowWindow(hdlg,SW_NORMAL);
@@ -839,15 +843,15 @@ static void test_PSM_ADDPAGE(void)
psp.lParam = 0;
/* multiple pages with the same data */
- hpsp[0] = CreatePropertySheetPageA(&psp);
- hpsp[1] = CreatePropertySheetPageA(&psp);
- hpsp[2] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
+ hpsp[1] = pCreatePropertySheetPageA(&psp);
+ hpsp[2] = pCreatePropertySheetPageA(&psp);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
- hpsp[3] = CreatePropertySheetPageA(&psp);
+ hpsp[3] = pCreatePropertySheetPageA(&psp);
psp.dwFlags = PSP_PREMATURE;
- hpsp[4] = CreatePropertySheetPageA(&psp);
+ hpsp[4] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -857,7 +861,7 @@ static void test_PSM_ADDPAGE(void)
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
/* add pages one by one */
@@ -906,7 +910,7 @@ if (0)
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
- DestroyPropertySheetPage(hpsp[4]);
+ pDestroyPropertySheetPage(hpsp[4]);
DestroyWindow(hdlg);
}
@@ -929,15 +933,15 @@ static void test_PSM_INSERTPAGE(void)
psp.lParam = 0;
/* multiple pages with the same data */
- hpsp[0] = CreatePropertySheetPageA(&psp);
- hpsp[1] = CreatePropertySheetPageA(&psp);
- hpsp[2] = CreatePropertySheetPageA(&psp);
+ hpsp[0] = pCreatePropertySheetPageA(&psp);
+ hpsp[1] = pCreatePropertySheetPageA(&psp);
+ hpsp[2] = pCreatePropertySheetPageA(&psp);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
- hpsp[3] = CreatePropertySheetPageA(&psp);
+ hpsp[3] = pCreatePropertySheetPageA(&psp);
psp.dwFlags = PSP_PREMATURE;
- hpsp[4] = CreatePropertySheetPageA(&psp);
+ hpsp[4] = pCreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
@@ -947,7 +951,7 @@ static void test_PSM_INSERTPAGE(void)
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
- hdlg = (HWND)PropertySheetA(&psh);
+ hdlg = (HWND)pPropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
/* add pages one by one */
@@ -1000,7 +1004,7 @@ if (0)
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
- DestroyPropertySheetPage(hpsp[4]);
+ pDestroyPropertySheetPage(hpsp[4]);
DestroyWindow(hdlg);
}
@@ -1090,7 +1094,7 @@ static void test_CreatePropertySheetPage(void)
for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++)
{
page.addref_called = 0;
- hpsp = CreatePropertySheetPageA(&page.u.pageA);
+ hpsp = pCreatePropertySheetPageA(&page.u.pageA);
if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
@@ -1103,7 +1107,7 @@ static void test_CreatePropertySheetPage(void)
if (hpsp)
{
page.release_called = 0;
- ret = DestroyPropertySheetPage(hpsp);
+ ret = pDestroyPropertySheetPage(hpsp);
ok(ret, "Failed to destroy a page\n");
ok(page.release_called == 1, "Expected RELEASE callback message\n");
}
@@ -1119,7 +1123,7 @@ static void test_CreatePropertySheetPage(void)
for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++)
{
page.addref_called = 0;
- hpsp = CreatePropertySheetPageW(&page.u.pageW);
+ hpsp = pCreatePropertySheetPageW(&page.u.pageW);
if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
@@ -1132,13 +1136,25 @@ static void test_CreatePropertySheetPage(void)
if (hpsp)
{
page.release_called = 0;
- ret = DestroyPropertySheetPage(hpsp);
+ ret = pDestroyPropertySheetPage(hpsp);
ok(ret, "Failed to destroy a page\n");
ok(page.release_called == 1, "Expected RELEASE callback message\n");
}
}
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(CreatePropertySheetPageA);
+ X(CreatePropertySheetPageW);
+ X(DestroyPropertySheetPage);
+ X(PropertySheetA);
+#undef X
+}
+
START_TEST(propsheet)
{
detect_locale();
@@ -1150,6 +1166,8 @@ START_TEST(propsheet)
SetProcessDefaultLayout(LAYOUT_RTL);
}
+ init_functions();
+
test_title();
test_nopage();
test_disableowner();
diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index 6430ba2b61..2ff4cebdf9 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -30,6 +30,9 @@
#include "wine/test.h"
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
+
static RECT height_change_notify_rect;
static HWND hMainWnd;
static int system_font_height;
@@ -577,7 +580,7 @@ static void test_layout(void)
check_sizes();
/* an image will increase the band height */
- himl = ImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
+ himl = pImageList_LoadImageA(GetModuleHandleA("comctl32"), MAKEINTRESOURCEA(121), 24, 2,
CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ri.cbSize = sizeof(ri);
ri.fMask = RBIM_IMAGELIST;
@@ -658,7 +661,7 @@ static void test_layout(void)
rbsize_results_free();
DestroyWindow(hRebar);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
}
#if 0 /* use this to generate more tests */
@@ -1125,26 +1128,22 @@ static void test_notification(void)
DestroyWindow(rebar);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Destroy);
+ X(ImageList_LoadImageA);
+#undef X
+}
+
START_TEST(rebar)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
- INITCOMMONCONTROLSEX iccex;
MSG msg;
init_system_font_height();
-
- /* LoadLibrary is needed. This file has no reference to functions in comctl32 */
- hComctl32 = LoadLibraryA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (!pInitCommonControlsEx)
- {
- win_skip("InitCommonControlsEx() is missing. Skipping the tests\n");
- return;
- }
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_COOL_CLASSES;
- pInitCommonControlsEx(&iccex);
+ init_functions();
hMainWnd = create_parent_window();
@@ -1169,6 +1168,4 @@ out:
DispatchMessageA(&msg);
}
DestroyWindow(hMainWnd);
-
- FreeLibrary(hComctl32);
}
diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index a394beb42a..78cbbb37ba 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -593,8 +593,6 @@ START_TEST(status)
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
NULL, NULL, GetModuleHandleA(NULL), 0);
- InitCommonControls();
-
register_subclass();
test_status_control();
diff --git a/dlls/comctl32/tests/subclass.c b/dlls/comctl32/tests/subclass.c
index 720c68e28d..abe63a1547 100644
--- a/dlls/comctl32/tests/subclass.c
+++ b/dlls/comctl32/tests/subclass.c
@@ -286,7 +286,7 @@ static BOOL init_function_pointers(void)
HMODULE hmod;
void *ptr;
- hmod = GetModuleHandleA("comctl32.dll");
+ hmod = LoadLibraryA("comctl32.dll");
ok(hmod != NULL, "got %p\n", hmod);
/* Functions have to be loaded by ordinal. Only XP and W2K3 export
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 72165c8100..0bfbb38a58 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -40,6 +40,11 @@
#define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
+static HIMAGELIST (WINAPI *pImageList_Create)(INT,INT,UINT,INT,INT);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
+static INT (WINAPI *pImageList_ReplaceIcon)(HIMAGELIST,INT,HICON);
+
static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
{
RECT r;
@@ -470,7 +475,7 @@ static void test_tab(INT nMinTabWidth)
{
HWND hwTab;
RECT rTab;
- HIMAGELIST himl = ImageList_Create(21, 21, ILC_COLOR, 3, 4);
+ HIMAGELIST himl = pImageList_Create(21, 21, ILC_COLOR, 3, 4);
SIZE size;
HDC hdc;
HFONT hOldFont;
@@ -608,7 +613,7 @@ static void test_tab(INT nMinTabWidth)
DestroyWindow (hwTab);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
}
static void test_width(void)
@@ -1165,12 +1170,12 @@ static void test_removeimage(void)
INT i;
TCITEMA item;
HICON hicon;
- HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR, 3, 4);
+ HIMAGELIST himl = pImageList_Create(16, 16, ILC_COLOR, 3, 4);
hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
- ImageList_AddIcon(himl, hicon);
- ImageList_AddIcon(himl, hicon);
- ImageList_AddIcon(himl, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
+ pImageList_ReplaceIcon(himl, -1, hicon);
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
SendMessageA(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
@@ -1185,7 +1190,8 @@ static void test_removeimage(void)
/* remove image middle image */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 1, 0);
- expect(2, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 2, "Unexpected image count %d.\n", i);
item.iImage = -1;
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
expect(0, item.iImage);
@@ -1197,7 +1203,8 @@ static void test_removeimage(void)
expect(1, item.iImage);
/* remove first image */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
- expect(1, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 1, "Unexpected image count %d.\n", i);
item.iImage = 0;
SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
expect(-1, item.iImage);
@@ -1209,7 +1216,8 @@ static void test_removeimage(void)
expect(0, item.iImage);
/* remove the last one */
SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
- expect(0, ImageList_GetImageCount(himl));
+ i = pImageList_GetImageCount(himl);
+ ok(i == 0, "Unexpected image count %d.\n", i);
for(i = 0; i < 3; i++) {
item.iImage = 0;
SendMessageA(hwTab, TCM_GETITEMA, i, (LPARAM)&item);
@@ -1217,7 +1225,7 @@ static void test_removeimage(void)
}
DestroyWindow(hwTab);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
DestroyIcon(hicon);
}
@@ -1423,6 +1431,18 @@ static void test_create(void)
}
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(ImageList_Create);
+ X(ImageList_Destroy);
+ X(ImageList_GetImageCount);
+ X(ImageList_ReplaceIcon);
+#undef X
+}
+
START_TEST(tab)
{
LOGFONTA logfont;
@@ -1434,7 +1454,7 @@ START_TEST(tab)
logfont.lfCharSet = ANSI_CHARSET;
hFont = CreateFontIndirectA(&logfont);
- InitCommonControls();
+ init_functions();
test_width();
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 2c1b789484..38b8339378 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -37,6 +37,13 @@
#define PARENT_SEQ_INDEX 0
#define NUM_MSG_SEQUENCES 1
+static HWND (WINAPI *pCreateToolbarEx)(HWND, DWORD, UINT, INT, HINSTANCE, UINT_PTR, const TBBUTTON *,
+ INT, INT, INT, INT, INT, UINT);
+static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
+static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
+static BOOL (WINAPI *pImageList_GetIconSize)(HIMAGELIST, int *, int *);
+static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE, LPCSTR, int, int, COLORREF, UINT, UINT);
+
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static HWND hMainWnd;
@@ -376,7 +383,7 @@ static void basic_test(void)
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
WS_CHILD | TBSTYLE_LIST,
100,
@@ -482,8 +489,8 @@ static void add_128x15_bitmap(HWND hToolbar, int nCmds)
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
ok(himl != NULL, "No image list\n"); \
if (himl != NULL) {\
- ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
- ImageList_GetIconSize(himl, &cx, &cy); \
+ ok(pImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, pImageList_GetImageCount(himl)); \
+ pImageList_GetIconSize(himl, &cx, &cy); \
ok(cx == dx && cy == dy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
@@ -515,11 +522,11 @@ static void test_add_bitmap(void)
himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0);
ok(himl != NULL, "Got %p\n", himl);
- ret = ImageList_GetIconSize(himl, &cx, &cy);
+ ret = pImageList_GetIconSize(himl, &cx, &cy);
ok(ret, "Got %d\n", ret);
ok(cx == cy, "Got %d x %d\n", cx, cy);
- count = ImageList_GetImageCount(himl);
+ count = pImageList_GetImageCount(himl);
/* Image count */
switch (id)
@@ -688,7 +695,7 @@ static void test_add_bitmap(void)
/* the control can add bitmaps to an existing image list */
rebuild_toolbar(&hToolbar);
- himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
+ himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(himl != NULL, "failed to create imagelist\n");
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
@@ -709,7 +716,7 @@ static void test_add_bitmap(void)
addbmp.hInst = HINST_COMMCTRL;
addbmp.nID = IDB_STD_SMALL_COLOR;
rebuild_toolbar(&hToolbar);
- ImageList_Destroy(himl);
+ pImageList_Destroy(himl);
ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
CHECK_IMAGELIST(15, 16, 16);
@@ -1506,14 +1513,14 @@ static void test_sizes(void)
/* TB_SETIMAGELIST always changes the height but the width only if necessary */
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
- himl = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
+ himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
check_button_size(hToolbar, 100, 21);
SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100));
check_button_size(hToolbar, 100, 100);
/* But there are no update when we change imagelist, and image sizes are the same */
- himl2 = ImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
+ himl2 = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_128x15),
20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LRESULT)himl2) == (LRESULT)himl, "TB_SETIMAGELIST failed\n");
check_button_size(hToolbar, 100, 100);
@@ -1538,8 +1545,8 @@ static void test_sizes(void)
check_sizes_todo(0x30); /* some small problems with BTNS_AUTOSIZE button sizes */
rebuild_toolbar(&hToolbar);
- ImageList_Destroy(himl);
- ImageList_Destroy(himl2);
+ pImageList_Destroy(himl);
+ pImageList_Destroy(himl2);
SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons3[3]);
check_button_size(hToolbar, 7 + string_width(STRING2), 23 + fontheight);
@@ -1823,43 +1830,43 @@ static void test_createtoolbarex(void)
TBBUTTON btns[3];
ZeroMemory(&btns, sizeof(btns));
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 20, 20, 16, 16, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 20, 20);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x1a001b, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 4, 4, 16, 16, sizeof(TBBUTTON));
CHECK_IMAGELIST(32, 4, 4);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xa000b, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 8, 12, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 12);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x120013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, -1, 8, 12, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 8);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, -1, 8, -1, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 16, 8);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0017, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 0, 12, -1, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 12, 16);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160013, "%x");
DestroyWindow(hToolbar);
- hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
+ hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
3, 0, 0, 0, 12, sizeof(TBBUTTON));
CHECK_IMAGELIST(16, 16, 16);
compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160017, "%x");
@@ -1928,7 +1935,7 @@ static void test_setrows(void)
MakeButton(buttons+i, 1000+i, TBSTYLE_FLAT | TBSTYLE_CHECKGROUP, 0);
/* Test 1 - 9 buttons */
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD | CCS_NORESIZE | CCS_NOPARENTALIGN
| CCS_NOMOVEY | CCS_TOP,
0,
@@ -2047,7 +2054,7 @@ static void test_get_set_style(void)
MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
- hToolbar = CreateToolbarEx(hMainWnd,
+ hToolbar = pCreateToolbarEx(hMainWnd,
WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
WS_CHILD | TBSTYLE_LIST,
100,
@@ -2507,6 +2514,19 @@ static void test_imagelist(void)
DestroyWindow(hwnd);
}
+static void init_functions(void)
+{
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+ X(CreateToolbarEx);
+ X(ImageList_GetIconSize);
+ X(ImageList_GetImageCount);
+ X(ImageList_LoadImageA);
+ X(ImageList_Destroy);
+#undef X
+}
+
START_TEST(toolbar)
{
WNDCLASSA wc;
@@ -2514,9 +2534,8 @@ START_TEST(toolbar)
RECT rc;
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
+ init_functions();
- InitCommonControls();
-
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c
index be6ab400a0..7e82604376 100644
--- a/dlls/comctl32/tests/tooltips.c
+++ b/dlls/comctl32/tests/tooltips.c
@@ -1057,7 +1057,7 @@ static void test_margin(void)
START_TEST(tooltips)
{
- InitCommonControls();
+ LoadLibraryA("comctl32.dll");
test_create_tooltip();
test_customdraw();
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index 9cc8b277ee..31845d10e0 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -1296,8 +1296,9 @@ static void test_create(void)
START_TEST(trackbar)
{
+ LoadLibraryA("comctl32.dll");
+
init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
- InitCommonControls();
/* create parent window */
hWndParent = create_parent_window();
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index a014625a0a..e7568d05de 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -2668,25 +2668,11 @@ static void test_right_click(void)
START_TEST(treeview)
{
- HMODULE hComctl32;
- BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
MSG msg;
ULONG_PTR ctx_cookie;
HANDLE hCtx;
-
- hComctl32 = GetModuleHandleA("comctl32.dll");
- pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
- if (pInitCommonControlsEx)
- {
- INITCOMMONCONTROLSEX iccex;
- iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_TREEVIEW_CLASSES;
- pInitCommonControlsEx(&iccex);
- }
- else
- InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
init_msg_sequences(item_sequence, 1);
diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c
index 639e7802a9..f549c41583 100644
--- a/dlls/comctl32/tests/updown.c
+++ b/dlls/comctl32/tests/updown.c
@@ -63,6 +63,8 @@
static HWND parent_wnd, g_edit;
+static HWND (WINAPI *pCreateUpDownControl)(DWORD, INT, INT, INT, INT,
+ HWND, INT, HINSTANCE, HWND, INT, INT, INT);
static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
@@ -882,7 +884,7 @@ static void test_CreateUpDownControl(void)
RECT rect;
GetClientRect(parent_wnd, &rect);
- updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
+ updown = pCreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE,
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), g_edit, 100, 10, 50);
ok(updown != NULL, "Failed to create control.\n");
@@ -898,13 +900,22 @@ static void test_CreateUpDownControl(void)
DestroyWindow(updown);
}
-START_TEST(updown)
+static void init_functions(void)
{
- HMODULE mod = GetModuleHandleA("comctl32.dll");
+ HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
+#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
+ X(CreateUpDownControl);
+ X2(SetWindowSubclass, 410);
+#undef X
+#undef X2
+}
- pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
+START_TEST(updown)
+{
+ init_functions();
- InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
parent_wnd = create_parent_window();
--
2.15.1
2
1
[PATCH 2/2] ole32: There's no need to recreate the static entry when parsing the CONTENTS stream.
by Huw Davies 24 Jan '18
by Huw Davies 24 Jan '18
24 Jan '18
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/ole32/datacache.c | 47 ++++++++++++++++++++++++++++++-----------------
dlls/ole32/tests/ole2.c | 4 ++--
2 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index ba253d9330..c07633d960 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -312,6 +312,29 @@ static DataCacheEntry *DataCache_GetEntryForFormatEtc(DataCache *This, const FOR
return NULL;
}
+/* Returns the cache entry associated with a static CLSID.
+ This will be first in the list with connection id == 1 */
+static HRESULT get_static_entry( DataCache *cache, DataCacheEntry **cache_entry )
+{
+ DataCacheEntry *entry;
+ struct list *head = list_head( &cache->cache_list );
+ HRESULT hr = E_FAIL;
+
+ *cache_entry = NULL;
+
+ if (head)
+ {
+ entry = LIST_ENTRY( head, DataCacheEntry, entry );
+ if (entry->id == 1)
+ {
+ *cache_entry = entry;
+ hr = S_OK;
+ }
+ }
+
+ return hr;
+}
+
/* checks that the clipformat and tymed are valid and returns an error if they
* aren't and CACHE_S_NOTSUPPORTED if they are valid, but can't be rendered by
* DataCache_Draw */
@@ -1698,33 +1721,23 @@ static HRESULT parse_pres_streams( DataCache *cache, IStorage *stg )
return S_OK;
}
-static const FORMATETC static_dib_fmt = { CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
-
-static HRESULT parse_contents_stream( DataCache *This, IStorage *stg )
+static HRESULT parse_contents_stream( DataCache *cache, IStorage *stg )
{
HRESULT hr;
- STATSTG stat;
- const FORMATETC *fmt;
IStream *stm;
+ DataCacheEntry *cache_entry;
hr = open_pres_stream( stg, STREAM_NUMBER_CONTENTS, &stm );
if (FAILED( hr )) return hr;
- hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
- if (FAILED( hr )) goto done;
-
- if (IsEqualCLSID( &stat.clsid, &CLSID_Picture_Dib ))
- fmt = &static_dib_fmt;
- else
+ hr = get_static_entry( cache, &cache_entry );
+ if (hr == S_OK)
{
- FIXME("unsupported format %s\n", debugstr_guid( &stat.clsid ));
- hr = E_FAIL;
- goto done;
+ cache_entry->load_stream_num = STREAM_NUMBER_CONTENTS;
+ cache_entry->save_stream_num = STREAM_NUMBER_CONTENTS;
+ cache_entry->dirty = FALSE;
}
- hr = add_cache_entry( This, fmt, 0, STREAM_NUMBER_CONTENTS );
-
-done:
IStream_Release( stm );
return hr;
}
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index d83ca00a66..1a4fce5b06 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -4450,7 +4450,6 @@ static void test_data_cache_contents(void)
ok(hr == S_OK, "unexpected %#x\n", hr);
hr = IPersistStorage_IsDirty(stg);
-todo_wine_if(test_data[i].in == &stg_def_4 || test_data[i].in == &stg_def_8 || test_data[i].in == &stg_def_9)
ok(hr == S_FALSE, "%d: unexpected %#x\n", i, hr);
hr = IPersistStorage_Save(stg, doc2, FALSE);
@@ -4463,7 +4462,8 @@ todo_wine_if(test_data[i].in == &stg_def_4 || test_data[i].in == &stg_def_8 || t
todo_wine_if(!(test_data[i].in == &stg_def_0 || test_data[i].in == &stg_def_1 || test_data[i].in == &stg_def_2))
ok(enumerated_streams == matched_streams, "%d out: enumerated %d != matched %d\n", i,
enumerated_streams, matched_streams);
-todo_wine_if(!(test_data[i].in == &stg_def_0 || test_data[i].in == &stg_def_5))
+todo_wine_if(!(test_data[i].in == &stg_def_0 || test_data[i].in == &stg_def_4 || test_data[i].in == &stg_def_5
+ || test_data[i].in == &stg_def_6))
ok(enumerated_streams == test_data[i].out->stream_count, "%d: saved streams %d != def streams %d\n", i,
enumerated_streams, test_data[i].out->stream_count);
--
2.12.0
1
0
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/ole32/datacache.c | 156 ++++++++++++++-----------------------------------
1 file changed, 44 insertions(+), 112 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 60ddd386ba..ba253d9330 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -90,12 +90,8 @@ typedef struct PresentationDataHeader
DWORD dwSize;
} PresentationDataHeader;
-enum stream_type
-{
- no_stream,
- pres_stream,
- contents_stream
-};
+#define STREAM_NUMBER_NOT_SET -2
+#define STREAM_NUMBER_CONTENTS -1 /* CONTENTS stream */
typedef struct DataCacheEntry
{
@@ -104,19 +100,16 @@ typedef struct DataCacheEntry
FORMATETC fmtetc;
/* cached data */
STGMEDIUM stgmedium;
- /*
- * This stream pointer is set through a call to
- * IPersistStorage_Load. This is where the visual
- * representation of the object is stored.
- */
- IStream *stream;
- enum stream_type stream_type;
/* connection ID */
DWORD id;
/* dirty flag */
BOOL dirty;
- /* stream number (-1 if not set ) */
- unsigned short stream_number;
+ /* stream number that the entry was loaded from.
+ This is used to defer loading until the data is actually needed. */
+ int load_stream_num;
+ /* stream number that the entry will be saved to.
+ This may differ from above if cache entries have been Uncache()d for example. */
+ int save_stream_num;
/* sink id set when object is running */
DWORD sink_id;
/* Advise sink flags */
@@ -260,8 +253,6 @@ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
static void DataCacheEntry_Destroy(DataCache *cache, DataCacheEntry *cache_entry)
{
list_remove(&cache_entry->entry);
- if (cache_entry->stream)
- IStream_Release(cache_entry->stream);
CoTaskMemFree(cache_entry->fmtetc.ptd);
ReleaseStgMedium(&cache_entry->stgmedium);
if(cache_entry->sink_id)
@@ -355,11 +346,10 @@ static BOOL init_cache_entry(DataCacheEntry *entry, const FORMATETC *fmt, DWORD
entry->stgmedium.tymed = TYMED_NULL;
entry->stgmedium.pUnkForRelease = NULL;
- entry->stream = NULL;
- entry->stream_type = no_stream;
entry->id = id;
entry->dirty = TRUE;
- entry->stream_number = -1;
+ entry->load_stream_num = STREAM_NUMBER_NOT_SET;
+ entry->save_stream_num = STREAM_NUMBER_NOT_SET;
entry->sink_id = 0;
entry->advise_flags = advf;
@@ -518,60 +508,18 @@ static HRESULT write_clipformat(IStream *stream, CLIPFORMAT clipformat)
return hr;
}
-/************************************************************************
- * DataCacheEntry_OpenPresStream
- *
- * This method will find the stream for the given presentation. It makes
- * no attempt at fallback.
- *
- * Param:
- * this - Pointer to the DataCache object
- * drawAspect - The aspect of the object that we wish to draw.
- * pStm - A returned stream. It points to the beginning of the
- * - presentation data, including the header.
- *
- * Errors:
- * S_OK The requested stream has been opened.
- * OLE_E_BLANK The requested stream could not be found.
- * Quite a few others I'm too lazy to map correctly.
- *
- * Notes:
- * Algorithm: Scan the elements of the presentation storage, looking
- * for presentation streams. For each presentation stream,
- * load the header and check to see if the aspect matches.
- *
- * If a fallback is desired, just opening the first presentation stream
- * is a possibility.
- */
-static HRESULT DataCacheEntry_OpenPresStream(DataCacheEntry *cache_entry, IStream **ppStm)
-{
- HRESULT hr;
- LARGE_INTEGER offset;
-
- if (cache_entry->stream)
- {
- /* Rewind the stream before returning it. */
- offset.QuadPart = 0;
-
- hr = IStream_Seek( cache_entry->stream, offset, STREAM_SEEK_SET, NULL );
- if (SUCCEEDED( hr ))
- {
- *ppStm = cache_entry->stream;
- IStream_AddRef( cache_entry->stream );
- }
- }
- else
- hr = OLE_E_BLANK;
-
- return hr;
-}
+static const WCHAR CONTENTS[] = {'C','O','N','T','E','N','T','S',0};
static HRESULT open_pres_stream( IStorage *stg, int stream_number, IStream **stm )
{
- WCHAR name[] = {2,'O','l','e','P','r','e','s',
+ WCHAR pres[] = {2,'O','l','e','P','r','e','s',
'0' + (stream_number / 100) % 10,
'0' + (stream_number / 10) % 10,
'0' + stream_number % 10, 0};
+ const WCHAR *name = pres;
+
+ if (stream_number == STREAM_NUMBER_NOT_SET) return E_FAIL;
+ if (stream_number == STREAM_NUMBER_CONTENTS) name = CONTENTS;
return IStorage_OpenStream( stg, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, stm );
}
@@ -589,9 +537,9 @@ static HRESULT load_mf_pict( DataCacheEntry *cache_entry, IStream *stm )
static const LARGE_INTEGER offset_zero;
ULONG read;
- if (cache_entry->stream_type != pres_stream)
+ if (cache_entry->load_stream_num == STREAM_NUMBER_CONTENTS)
{
- FIXME( "Unimplemented for stream type %d\n", cache_entry->stream_type );
+ FIXME( "Unimplemented for CONTENTS stream\n" );
return E_FAIL;
}
@@ -658,9 +606,9 @@ static HRESULT load_dib( DataCacheEntry *cache_entry, IStream *stm )
BITMAPFILEHEADER file;
BITMAPINFOHEADER *info;
- if (cache_entry->stream_type != contents_stream)
+ if (cache_entry->load_stream_num != STREAM_NUMBER_CONTENTS)
{
- FIXME( "Unimplemented for stream type %d\n", cache_entry->stream_type );
+ FIXME( "Unimplemented for presentation stream\n" );
return E_FAIL;
}
@@ -746,12 +694,13 @@ fail:
* This method returns a metafile handle if it is successful.
* it will return 0 if not.
*/
-static HRESULT DataCacheEntry_LoadData(DataCacheEntry *cache_entry)
+static HRESULT DataCacheEntry_LoadData(DataCacheEntry *cache_entry, IStorage *stg)
{
HRESULT hr;
IStream *stm;
- hr = DataCacheEntry_OpenPresStream( cache_entry, &stm );
+ if (!stg) return OLE_E_BLANK;
+ hr = open_pres_stream( stg, cache_entry->load_stream_num, &stm );
if (FAILED(hr)) return hr;
switch (cache_entry->fmtetc.cfFormat)
@@ -1004,14 +953,13 @@ static HRESULT save_view_cache(DataCacheEntry *entry, IStream *stream)
return hr;
}
-static const WCHAR CONTENTS[] = {'C','O','N','T','E','N','T','S',0};
static HRESULT create_stream(DataCacheEntry *cache_entry, IStorage *storage,
BOOL contents, IStream **stream)
{
WCHAR pres[] = {2,'O','l','e','P','r','e','s',
- '0' + (cache_entry->stream_number / 100) % 10,
- '0' + (cache_entry->stream_number / 10) % 10,
- '0' + cache_entry->stream_number % 10, 0};
+ '0' + (cache_entry->save_stream_num / 100) % 10,
+ '0' + (cache_entry->save_stream_num / 10) % 10,
+ '0' + cache_entry->save_stream_num % 10, 0};
const WCHAR *name;
if (contents)
@@ -1031,7 +979,7 @@ static HRESULT DataCacheEntry_Save(DataCacheEntry *cache_entry, IStorage *storag
IStream *stream;
BOOL contents = (cache_entry->id == 1);
- TRACE("stream_number = %d, fmtetc = %s\n", cache_entry->stream_number, debugstr_formatetc(&cache_entry->fmtetc));
+ TRACE("stream_number = %d, fmtetc = %s\n", cache_entry->save_stream_num, debugstr_formatetc(&cache_entry->fmtetc));
hr = create_stream(cache_entry, storage, contents, &stream);
if (FAILED(hr))
@@ -1216,11 +1164,11 @@ static HRESULT DataCacheEntry_SetData(DataCacheEntry *cache_entry,
return copy_stg_medium(cache_entry->fmtetc.cfFormat, &cache_entry->stgmedium, stgmedium);
}
-static HRESULT DataCacheEntry_GetData(DataCacheEntry *cache_entry, FORMATETC *fmt, STGMEDIUM *stgmedium)
+static HRESULT DataCacheEntry_GetData(DataCacheEntry *cache_entry, IStorage *stg, FORMATETC *fmt, STGMEDIUM *stgmedium)
{
- if (cache_entry->stgmedium.tymed == TYMED_NULL && cache_entry->stream)
+ if (cache_entry->stgmedium.tymed == TYMED_NULL && cache_entry->load_stream_num != STREAM_NUMBER_NOT_SET)
{
- HRESULT hr = DataCacheEntry_LoadData(cache_entry);
+ HRESULT hr = DataCacheEntry_LoadData(cache_entry, stg);
if (FAILED(hr))
return hr;
}
@@ -1239,15 +1187,6 @@ static inline HRESULT DataCacheEntry_DiscardData(DataCacheEntry *cache_entry)
return S_OK;
}
-static inline void DataCacheEntry_HandsOffStorage(DataCacheEntry *cache_entry)
-{
- if (cache_entry->stream)
- {
- IStream_Release(cache_entry->stream);
- cache_entry->stream = NULL;
- }
-}
-
static inline DWORD tymed_from_cf( DWORD cf )
{
switch( cf )
@@ -1470,7 +1409,7 @@ static HRESULT WINAPI DataCache_GetData(
if (!cache_entry)
return OLE_E_BLANK;
- return DataCacheEntry_GetData(cache_entry, pformatetcIn, pmedium);
+ return DataCacheEntry_GetData(cache_entry, This->presentationStorage, pformatetcIn, pmedium);
}
static HRESULT WINAPI DataCache_GetDataHere(
@@ -1703,8 +1642,7 @@ static HRESULT WINAPI DataCache_InitNew(
}
-static HRESULT add_cache_entry( DataCache *This, const FORMATETC *fmt, DWORD advf, IStream *stm,
- enum stream_type type )
+static HRESULT add_cache_entry( DataCache *This, const FORMATETC *fmt, DWORD advf, int stream_number )
{
DataCacheEntry *cache_entry;
HRESULT hr = S_OK;
@@ -1717,10 +1655,8 @@ static HRESULT add_cache_entry( DataCache *This, const FORMATETC *fmt, DWORD adv
if (SUCCEEDED( hr ))
{
DataCacheEntry_DiscardData( cache_entry );
- if (cache_entry->stream) IStream_Release( cache_entry->stream );
- cache_entry->stream = stm;
- IStream_AddRef( stm );
- cache_entry->stream_type = type;
+ cache_entry->load_stream_num = stream_number;
+ cache_entry->save_stream_num = stream_number;
cache_entry->dirty = FALSE;
}
return hr;
@@ -1753,7 +1689,7 @@ static HRESULT parse_pres_streams( DataCache *cache, IStorage *stg )
fmtetc.lindex = header.lindex;
fmtetc.tymed = tymed_from_cf( clipformat );
- add_cache_entry( cache, &fmtetc, header.advf, stm, pres_stream );
+ add_cache_entry( cache, &fmtetc, header.advf, stream_number );
}
IStream_Release( stm );
stream_number++;
@@ -1771,7 +1707,7 @@ static HRESULT parse_contents_stream( DataCache *This, IStorage *stg )
const FORMATETC *fmt;
IStream *stm;
- hr = IStorage_OpenStream( stg, CONTENTS, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm );
+ hr = open_pres_stream( stg, STREAM_NUMBER_CONTENTS, &stm );
if (FAILED( hr )) return hr;
hr = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
@@ -1786,7 +1722,7 @@ static HRESULT parse_contents_stream( DataCache *This, IStorage *stg )
goto done;
}
- hr = add_cache_entry( This, fmt, 0, stm, contents_stream );
+ hr = add_cache_entry( This, fmt, 0, STREAM_NUMBER_CONTENTS );
done:
IStream_Release( stm );
@@ -1852,17 +1788,17 @@ static HRESULT WINAPI DataCache_Save(IPersistStorage* iface, IStorage *stg, BOOL
DataCache *This = impl_from_IPersistStorage(iface);
DataCacheEntry *cache_entry;
HRESULT hr = S_OK;
- unsigned short stream_number = 0;
+ int stream_number = 0;
TRACE("(%p, %p, %d)\n", iface, stg, same_as_load);
/* assign stream numbers to the cache entries */
LIST_FOR_EACH_ENTRY(cache_entry, &This->cache_list, DataCacheEntry, entry)
{
- if (cache_entry->stream_number != stream_number)
+ if (cache_entry->save_stream_num != stream_number)
{
cache_entry->dirty = TRUE; /* needs to be written out again */
- cache_entry->stream_number = stream_number;
+ cache_entry->save_stream_num = stream_number;
}
stream_number++;
}
@@ -1916,7 +1852,6 @@ static HRESULT WINAPI DataCache_HandsOffStorage(
IPersistStorage* iface)
{
DataCache *this = impl_from_IPersistStorage(iface);
- DataCacheEntry *cache_entry;
TRACE("(%p)\n", iface);
@@ -1926,9 +1861,6 @@ static HRESULT WINAPI DataCache_HandsOffStorage(
this->presentationStorage = NULL;
}
- LIST_FOR_EACH_ENTRY(cache_entry, &this->cache_list, DataCacheEntry, entry)
- DataCacheEntry_HandsOffStorage(cache_entry);
-
return S_OK;
}
@@ -2018,9 +1950,9 @@ static HRESULT WINAPI DataCache_Draw(
continue;
/* if the data hasn't been loaded yet, do it now */
- if ((cache_entry->stgmedium.tymed == TYMED_NULL) && cache_entry->stream)
+ if ((cache_entry->stgmedium.tymed == TYMED_NULL) && (cache_entry->load_stream_num != STREAM_NUMBER_NOT_SET))
{
- hres = DataCacheEntry_LoadData(cache_entry);
+ hres = DataCacheEntry_LoadData(cache_entry, This->presentationStorage);
if (FAILED(hres))
continue;
}
@@ -2278,9 +2210,9 @@ static HRESULT WINAPI DataCache_GetExtent(
continue;
/* if the data hasn't been loaded yet, do it now */
- if ((cache_entry->stgmedium.tymed == TYMED_NULL) && cache_entry->stream)
+ if ((cache_entry->stgmedium.tymed == TYMED_NULL) && (cache_entry->load_stream_num != STREAM_NUMBER_NOT_SET))
{
- hres = DataCacheEntry_LoadData(cache_entry);
+ hres = DataCacheEntry_LoadData(cache_entry, This->presentationStorage);
if (FAILED(hres))
continue;
}
--
2.12.0
1
0
I don't know why $ git commit -s does not work well.
3
2
[PATCH] user32: Always process sent messages when sending inter-thread messages.
by Zebediah Figura 24 Jan '18
by Zebediah Figura 24 Jan '18
24 Jan '18
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
Sometimes the sent message will be processed before the loop has had time to
execute once, and sent messages will remain in the queue unprocessed. This
never happens on Windows, although it is not quite clear whether this is
guaranteed or whether it is simply due to consistency in thread scheduling.
MSDN states:
However, the sending thread will process incoming nonqueued messages while
waiting for its message to be processed.
which is somewhat ambiguous.
We have tests in Wine (namely in ole32:clipboard) which were failing
intermittently because sent messages were sometimes not being processed while
executing SendMessageTimeout(). This test has never failed on Windows, in any
configuration tracked on test.winehq.org, and so I am inclined to conclude
that this logic matches Windows' behaviour.
dlls/user32/message.c | 2 +-
dlls/user32/tests/msg.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 172d659..81844e3 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3015,13 +3015,13 @@ static void wait_message_reply( UINT flags )
thread_info->wake_mask = thread_info->changed_mask = 0;
- if (wake_bits & QS_SMRESULT) return; /* got a result */
if (wake_bits & QS_SENDMESSAGE)
{
/* Process the sent message immediately */
process_sent_messages();
continue;
}
+ if (wake_bits & QS_SMRESULT) return; /* got a result */
wow_handlers.wait_message( 1, &server_queue, INFINITE, wake_mask, 0 );
}
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f391ab9..082b560 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -16633,6 +16633,37 @@ static void test_DoubleSetCapture(void)
DestroyWindow(hwnd);
}
+static DWORD WINAPI send_notify_message_thread(void *param)
+{
+ SendNotifyMessageA((HWND) param, WM_USER, 0, 0);
+ return 0;
+}
+
+static void test_SendMessage_pump(void)
+{
+ /* Sending a message to another thread's window should process sent messages
+ * currently in the queue. On Windows this always happens, i.e. we never
+ * fail to do so if we've already received a reply. */
+
+ HWND hwnd;
+ HANDLE thread;
+
+ hwnd = CreateWindowA("TestWindowClass", "test_SendMessage_pump", 0,
+ 100, 100, 200, 200, 0, 0, 0, 0);
+ ok(hwnd != NULL, "Failed to create window\n");
+ flush_sequence();
+
+ thread = CreateThread(0, 0, send_notify_message_thread, hwnd, 0, 0);
+ ok(WaitForSingleObject(thread, 1000) == WAIT_OBJECT_0, "wait failed\n");
+ ok_sequence(WmEmptySeq, "no messages", FALSE);
+
+ SendMessageA(GetDesktopWindow(), WM_NULL, 0, 0);
+ ok_sequence(WmUser, "SendMessage() pump", FALSE);
+
+ CloseHandle(thread);
+ DestroyWindow(hwnd);
+}
+
static void init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
@@ -16777,6 +16808,7 @@ START_TEST(msg)
test_TrackPopupMenu();
test_TrackPopupMenuEmpty();
test_DoubleSetCapture();
+ test_SendMessage_pump();
/* keep it the last test, under Windows it tends to break the tests
* which rely on active/foreground windows being correct.
*/
--
2.7.4
1
0