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
April 2021
- 70 participants
- 697 discussions
19 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/value.c | 174 ++++++++++++---------------------
dlls/wldap32/winldap_private.h | 10 ++
2 files changed, 72 insertions(+), 112 deletions(-)
diff --git a/dlls/wldap32/value.c b/dlls/wldap32/value.c
index a7d7d44244f..249a2fae605 100644
--- a/dlls/wldap32/value.c
+++ b/dlls/wldap32/value.c
@@ -18,21 +18,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "wine/heap.h"
+#include "winldap_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
@@ -42,7 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
* Count the number of values in an array of berval structures.
*
* PARAMS
- * vals [I] Pointer to an array of berval structures.
+ * values [I] Pointer to an array of berval structures.
*
* RETURNS
* Success: The number of values counted.
@@ -52,15 +45,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
* Call ldap_count_values_len with the result of a call to
* ldap_get_values_len.
*/
-ULONG CDECL WLDAP32_ldap_count_values_len( struct WLDAP32_berval **vals )
+ULONG CDECL WLDAP32_ldap_count_values_len( struct WLDAP32_berval **values )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = 0;
+ struct WLDAP32_berval **ptr = values;
- TRACE( "(%p)\n", vals );
- ret = ldap_count_values_len( (struct berval **)vals );
+ TRACE( "(%p)\n", values );
-#endif
+ if (!values) return 0;
+ while (*ptr++) ret++;
return ret;
}
@@ -69,23 +62,15 @@ ULONG CDECL WLDAP32_ldap_count_values_len( struct WLDAP32_berval **vals )
*
* See ldap_count_valuesW.
*/
-ULONG CDECL ldap_count_valuesA( PCHAR *vals )
+ULONG CDECL ldap_count_valuesA( char **values )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- WCHAR **valsW = NULL;
-
- TRACE( "(%p)\n", vals );
-
- if (!vals) return 0;
-
- valsW = strarrayAtoW( vals );
- if (!valsW) return WLDAP32_LDAP_NO_MEMORY;
+ ULONG ret = 0;
+ char **ptr = values;
- ret = ldap_count_valuesW( valsW );
- strarrayfreeW( valsW );
+ TRACE( "(%p)\n", values );
-#endif
+ if (!values) return 0;
+ while (*ptr++) ret++;
return ret;
}
@@ -95,7 +80,7 @@ ULONG CDECL ldap_count_valuesA( PCHAR *vals )
* Count the number of values in a string array.
*
* PARAMS
- * vals [I] Pointer to an array of strings.
+ * values [I] Pointer to an array of strings.
*
* RETURNS
* Success: The number of values counted.
@@ -105,20 +90,15 @@ ULONG CDECL ldap_count_valuesA( PCHAR *vals )
* Call ldap_count_valuesW with the result of a call to
* ldap_get_valuesW.
*/
-ULONG CDECL ldap_count_valuesW( PWCHAR *vals )
+ULONG CDECL ldap_count_valuesW( WCHAR **values )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- WCHAR **p = vals;
+ ULONG ret = 0;
+ WCHAR **p = values;
- TRACE( "(%p)\n", vals );
+ TRACE( "(%p)\n", values );
- if (!vals) return 0;
-
- ret = 0;
+ if (!values) return 0;
while (*p++) ret++;
-
-#endif
return ret;
}
@@ -127,31 +107,24 @@ ULONG CDECL ldap_count_valuesW( PWCHAR *vals )
*
* See ldap_get_valuesW.
*/
-PCHAR * CDECL ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PCHAR attr )
+char ** CDECL ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, char *attr )
{
- PCHAR *ret = NULL;
-#ifdef HAVE_LDAP
+ char **ret;
WCHAR *attrW = NULL, **retW;
TRACE( "(%p, %p, %s)\n", ld, entry, debugstr_a(attr) );
- if (!ld || !entry || !attr) return NULL;
-
- attrW = strAtoW( attr );
- if (!attrW) return NULL;
+ if (!ld || !entry || !attr || !(attrW = strAtoW( attr ))) return NULL;
retW = ldap_get_valuesW( ld, entry, attrW );
-
ret = strarrayWtoA( retW );
+
ldap_value_freeW( retW );
strfreeW( attrW );
-
-#endif
return ret;
}
-#ifdef HAVE_LDAP
-static char *bv2str( struct berval *bv )
+static char *bv2str( struct bervalU *bv )
{
char *str = NULL;
unsigned int len = bv->bv_len;
@@ -164,10 +137,10 @@ static char *bv2str( struct berval *bv )
return str;
}
-static char **bv2str_array( struct berval **bv )
+static char **bv2str_array( struct bervalU **bv )
{
unsigned int len = 0, i = 0;
- struct berval **p = bv;
+ struct bervalU **p = bv;
char **str;
while (*p)
@@ -186,14 +159,13 @@ static char **bv2str_array( struct berval **bv )
while (i > 0) heap_free( str[--i] );
heap_free( str );
return NULL;
- }
+ }
i++;
- p++;
+ p++;
}
str[i] = NULL;
return str;
}
-#endif
/***********************************************************************
* ldap_get_valuesW (WLDAP32.@)
@@ -214,32 +186,26 @@ static char **bv2str_array( struct berval **bv )
* ldap_first_entry or ldap_next_entry. Free the returned
* array with a call to ldap_value_freeW.
*/
-PWCHAR * CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PWCHAR attr )
+WCHAR ** CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, WCHAR *attr )
{
- PWCHAR *ret = NULL;
-#ifdef HAVE_LDAP
- char *attrU = NULL, **retU;
- struct berval **bv;
+ WCHAR **ret = NULL;
+ char *attrU, **retU;
+ struct bervalU **bv;
TRACE( "(%p, %p, %s)\n", ld, entry, debugstr_w(attr) );
- if (!ld || !entry || !attr) return NULL;
-
- attrU = strWtoU( attr );
- if (!attrU) return NULL;
+ if (!ld || !entry || !attr || !(attrU = strWtoU( attr ))) return NULL;
- bv = ldap_get_values_len( ld->ld, entry->Request, attrU );
- if (bv)
+ if ((bv = ldap_funcs->ldap_get_values_len( ld->ld, entry->Request, attrU )))
{
retU = bv2str_array( bv );
ret = strarrayUtoW( retU );
- ldap_value_free_len( bv );
+ ldap_funcs->ldap_value_free_len( bv );
strarrayfreeU( retU );
}
- strfreeU( attrU );
-#endif
+ strfreeU( attrU );
return ret;
}
@@ -248,28 +214,19 @@ PWCHAR * CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, P
*
* See ldap_get_values_lenW.
*/
-struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld,
- WLDAP32_LDAPMessage *message, PCHAR attr )
+struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, char *attr )
{
-#ifdef HAVE_LDAP
- WCHAR *attrW = NULL;
+ WCHAR *attrW;
struct WLDAP32_berval **ret;
TRACE( "(%p, %p, %s)\n", ld, message, debugstr_a(attr) );
- if (!ld || !message || !attr) return NULL;
-
- attrW = strAtoW( attr );
- if (!attrW) return NULL;
+ if (!ld || !message || !attr || !(attrW = strAtoW( attr ))) return NULL;
ret = ldap_get_values_lenW( ld, message, attrW );
strfreeW( attrW );
return ret;
-
-#else
- return NULL;
-#endif
}
/***********************************************************************
@@ -291,28 +248,24 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld,
* ldap_first_entry or ldap_next_entry. Free the returned
* array with a call to ldap_value_free_len.
*/
-struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld,
- WLDAP32_LDAPMessage *message, PWCHAR attr )
+struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, WCHAR *attr )
{
-#ifdef HAVE_LDAP
char *attrU = NULL;
- struct berval **ret;
+ struct bervalU **retU;
+ struct WLDAP32_berval **ret = NULL;
TRACE( "(%p, %p, %s)\n", ld, message, debugstr_w(attr) );
- if (!ld || !message || !attr) return NULL;
+ if (!ld || !message || !attr || !(attrU = strWtoU( attr ))) return NULL;
- attrU = strWtoU( attr );
- if (!attrU) return NULL;
-
- ret = ldap_get_values_len( ld->ld, message->Request, attrU );
+ if ((retU = ldap_funcs->ldap_get_values_len( ld->ld, message->Request, attrU )))
+ {
+ ret = bvarrayUtoW( retU );
+ bvarrayfreeU( retU );
+ }
strfreeU( attrU );
- return (struct WLDAP32_berval **)ret;
-
-#else
- return NULL;
-#endif
+ return ret;
}
/***********************************************************************
@@ -321,20 +274,17 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld,
* Free an array of berval structures.
*
* PARAMS
- * vals [I] Array of berval structures.
+ * values [I] Array of berval structures.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
-ULONG CDECL WLDAP32_ldap_value_free_len( struct WLDAP32_berval **vals )
+ULONG CDECL WLDAP32_ldap_value_free_len( struct WLDAP32_berval **values )
{
-#ifdef HAVE_LDAP
-
- TRACE( "(%p)\n", vals );
- ldap_value_free_len( (struct berval **)vals );
+ TRACE( "(%p)\n", values );
-#endif
+ bvarrayfreeW( values );
return WLDAP32_LDAP_SUCCESS;
}
@@ -343,11 +293,11 @@ ULONG CDECL WLDAP32_ldap_value_free_len( struct WLDAP32_berval **vals )
*
* See ldap_value_freeW.
*/
-ULONG CDECL ldap_value_freeA( PCHAR *vals )
+ULONG CDECL ldap_value_freeA( char **values )
{
- TRACE( "(%p)\n", vals );
+ TRACE( "(%p)\n", values );
- strarrayfreeA( vals );
+ strarrayfreeA( values );
return WLDAP32_LDAP_SUCCESS;
}
@@ -357,16 +307,16 @@ ULONG CDECL ldap_value_freeA( PCHAR *vals )
* Free an array of string values.
*
* PARAMS
- * vals [I] Array of string values.
+ * values [I] Array of string values.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
-ULONG CDECL ldap_value_freeW( PWCHAR *vals )
+ULONG CDECL ldap_value_freeW( WCHAR **values )
{
- TRACE( "(%p)\n", vals );
+ TRACE( "(%p)\n", values );
- strarrayfreeW( vals );
+ strarrayfreeW( values );
return WLDAP32_LDAP_SUCCESS;
}
diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index c8040149290..a59071d50dc 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -1098,6 +1098,16 @@ static inline void strfreeA( char *str )
RtlFreeHeap( GetProcessHeap(), 0, str );
}
+static inline void strarrayfreeA( char **strarray )
+{
+ if (strarray)
+ {
+ char **p = strarray;
+ while (*p) strfreeA( *p++ );
+ RtlFreeHeap( GetProcessHeap(), 0, strarray );
+ }
+}
+
static inline void controlfreeA( LDAPControlA *control )
{
if (control)
--
2.30.2
1
0
[PATCH 2/8] wldap32: Move support for rename functions to the Unix library.
by Hans Leidekker 19 Apr '21
by Hans Leidekker 19 Apr '21
19 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/rename.c | 202 +++++++++++-------------------------------
1 file changed, 50 insertions(+), 152 deletions(-)
diff --git a/dlls/wldap32/rename.c b/dlls/wldap32/rename.c
index b978daa8ab2..cba4cdd7b66 100644
--- a/dlls/wldap32/rename.c
+++ b/dlls/wldap32/rename.c
@@ -18,71 +18,40 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "winldap_private.h"
-#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#endif
/***********************************************************************
* ldap_rename_extA (WLDAP32.@)
*
* See ldap_rename_extW.
*/
-ULONG CDECL ldap_rename_extA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
- PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
- PLDAPControlA *clientctrls, ULONG *message )
+ULONG CDECL ldap_rename_extA( WLDAP32_LDAP *ld, char *dn, char *newrdn, char *newparent, int delete,
+ LDAPControlA **serverctrls, LDAPControlA **clientctrls, ULONG *message )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn),
- debugstr_a(newrdn), debugstr_a(newparent), delete,
- serverctrls, clientctrls, message );
+ TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(newrdn), debugstr_a(newparent),
+ delete, serverctrls, clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (newrdn) {
- newrdnW = strAtoW( newrdn );
- if (!newrdnW) goto exit;
- }
- if (newparent) {
- newparentW = strAtoW( newparent );
- if (!newparentW) goto exit;
- }
- if (serverctrls) {
- serverctrlsW = controlarrayAtoW( serverctrls );
- if (!serverctrlsW) goto exit;
- }
- if (clientctrls) {
- clientctrlsW = controlarrayAtoW( clientctrls );
- if (!clientctrlsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (newrdn && !(newrdnW = strAtoW( newrdn ))) goto exit;
+ if (newparent && !(newparentW = strAtoW( newparent ))) goto exit;
+ if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
- ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete,
- serverctrlsW, clientctrlsW, message );
+ ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
@@ -90,8 +59,6 @@ exit:
strfreeW( newparentW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
-
-#endif
return ret;
}
@@ -119,55 +86,32 @@ exit:
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
-ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
- PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
- PLDAPControlW *clientctrls, ULONG *message )
+ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newparent, int delete,
+ LDAPControlW **serverctrls, LDAPControlW **clientctrls, ULONG *message )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
- LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
+ LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn),
- debugstr_w(newrdn), debugstr_w(newparent), delete,
- serverctrls, clientctrls, message );
+ TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(newrdn), debugstr_w(newparent),
+ delete, serverctrls, clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (newrdn) {
- newrdnU = strWtoU( newrdn );
- if (!newrdnU) goto exit;
- }
- if (newparent) {
- newparentU = strWtoU( newparent );
- if (!newparentU) goto exit;
- }
- if (serverctrls) {
- serverctrlsU = controlarrayWtoU( serverctrls );
- if (!serverctrlsU) goto exit;
- }
- if (clientctrls) {
- clientctrlsU = controlarrayWtoU( clientctrls );
- if (!clientctrlsU) goto exit;
- }
-
- ret = map_error( ldap_rename( ld->ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
- delete, serverctrlsU, clientctrlsU, (int *)message ));
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (newrdn && !(newrdnU = strWtoU( newrdn ))) goto exit;
+ if (newparent && !(newparentU = strWtoU( newparent ))) goto exit;
+ if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
+ ret = map_error( ldap_funcs->ldap_rename( ld->ld, dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU,
+ message ) );
exit:
strfreeU( dnU );
strfreeU( newrdnU );
strfreeU( newparentU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
-
-#endif
return ret;
}
@@ -176,46 +120,25 @@ exit:
*
* See ldap_rename_ext_sW.
*/
-ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
- PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
- PLDAPControlA *clientctrls )
+ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, char *dn, char *newrdn, char *newparent, int delete,
+ LDAPControlA **serverctrls, LDAPControlA **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_NO_MEMORY;
WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn),
- debugstr_a(newrdn), debugstr_a(newparent), delete,
- serverctrls, clientctrls );
+ TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(newrdn), debugstr_a(newparent),
+ delete, serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnW = strAtoW( dn );
- if (!dnW) goto exit;
- }
- if (newrdn) {
- newrdnW = strAtoW( newrdn );
- if (!newrdnW) goto exit;
- }
- if (newparent) {
- newparentW = strAtoW( newparent );
- if (!newparentW) goto exit;
- }
- if (serverctrls) {
- serverctrlsW = controlarrayAtoW( serverctrls );
- if (!serverctrlsW) goto exit;
- }
- if (clientctrls) {
- clientctrlsW = controlarrayAtoW( clientctrls );
- if (!clientctrlsW) goto exit;
- }
+ if (dn && !(dnW = strAtoW( dn ))) goto exit;
+ if (newrdn && !(newrdnW = strAtoW( newrdn ))) goto exit;
+ if (newparent && !(newparentW = strAtoW( newparent ))) goto exit;
+ if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
- ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete,
- serverctrlsW, clientctrlsW );
+ ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW );
exit:
strfreeW( dnW );
@@ -223,8 +146,6 @@ exit:
strfreeW( newparentW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
-
-#endif
return ret;
}
/***********************************************************************
@@ -244,55 +165,32 @@ exit:
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
- */
-ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
- PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
- PLDAPControlW *clientctrls )
+ */
+ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newparent, int delete,
+ LDAPControlW **serverctrls, LDAPControlW **clientctrls )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret = WLDAP32_LDAP_PARAM_ERROR;
char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
- LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
+ LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
- ret = WLDAP32_LDAP_NO_MEMORY;
-
- TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn),
- debugstr_w(newrdn), debugstr_w(newparent), delete,
- serverctrls, clientctrls );
+ TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(newrdn), debugstr_w(newparent),
+ delete, serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- if (dn) {
- dnU = strWtoU( dn );
- if (!dnU) goto exit;
- }
- if (newrdn) {
- newrdnU = strWtoU( newrdn );
- if (!newrdnU) goto exit;
- }
- if (newparent) {
- newparentU = strWtoU( newparent );
- if (!newparentU) goto exit;
- }
- if (serverctrls) {
- serverctrlsU = controlarrayWtoU( serverctrls );
- if (!serverctrlsU) goto exit;
- }
- if (clientctrls) {
- clientctrlsU = controlarrayWtoU( clientctrls );
- if (!clientctrlsU) goto exit;
- }
-
- ret = map_error( ldap_rename_s( ld->ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
- delete, serverctrlsU, clientctrlsU ));
+ if (dn && !(dnU = strWtoU( dn ))) goto exit;
+ if (newrdn && !(newrdnU = strWtoU( newrdn ))) goto exit;
+ if (newparent && !(newparentU = strWtoU( newparent ))) goto exit;
+ if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
+ if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
+ ret = map_error( ldap_funcs->ldap_rename_s( ld->ld, dnU, newrdnU, newparentU, delete, serverctrlsU,
+ clientctrlsU ) );
exit:
strfreeU( dnU );
strfreeU( newrdnU );
strfreeU( newparentU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
-
-#endif
return ret;
}
--
2.30.2
1
0
[PATCH 1/8] wldap32: Move support for parse functions to the Unix library.
by Hans Leidekker 19 Apr '21
by Hans Leidekker 19 Apr '21
19 Apr '21
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wldap32/libldap.c | 32 ++++
dlls/wldap32/libldap.h | 11 ++
dlls/wldap32/parse.c | 286 +++++++++++++--------------------
dlls/wldap32/winldap_private.h | 40 +++++
4 files changed, 199 insertions(+), 170 deletions(-)
diff --git a/dlls/wldap32/libldap.c b/dlls/wldap32/libldap.c
index 662edb4d365..f71970e2a59 100644
--- a/dlls/wldap32/libldap.c
+++ b/dlls/wldap32/libldap.c
@@ -338,6 +338,11 @@ void CDECL wrap_ldap_control_free( LDAPControlU *control )
ldap_control_free( (LDAPControl *)control );
}
+void CDECL wrap_ldap_controls_free( LDAPControlU **control )
+{
+ ldap_controls_free( (LDAPControl **)control );
+}
+
int CDECL wrap_ldap_count_entries( void *ld, void *chain )
{
return ldap_count_entries( ld, chain );
@@ -481,12 +486,34 @@ void * CDECL wrap_ldap_next_reference( void *ld, void *entry )
return ldap_next_reference( ld, entry );
}
+int CDECL wrap_ldap_parse_extended_result( void *ld, void *result, char **retoid, struct bervalU **retdata, int free )
+{
+ return ldap_parse_extended_result( ld, result, retoid, (struct berval **)retdata, free );
+}
+
+int CDECL wrap_ldap_parse_reference( void *ld, void *ref, char ***referrals, LDAPControlU ***serverctrls, int free )
+{
+ return ldap_parse_reference( ld, ref, referrals, (LDAPControl ***)serverctrls, free );
+}
+
int CDECL wrap_ldap_parse_result( void *ld, void *res, int *errcode, char **matcheddn, char **errmsg,
char ***referrals, LDAPControlU ***serverctrls, int free )
{
return ldap_parse_result( ld, res, errcode, matcheddn, errmsg, referrals, (LDAPControl ***)serverctrls, free );
}
+int CDECL wrap_ldap_parse_sortresponse_control( void *ld, LDAPControlU *ctrl, int *result, char **attr )
+{
+ return ldap_parse_sortresponse_control( ld, (LDAPControl *)ctrl, result, attr );
+}
+
+int CDECL wrap_ldap_parse_vlvresponse_control( void *ld, LDAPControlU *ctrls, int *target_pos, int *list_count,
+ struct bervalU **ctx, int *errcode )
+{
+ return ldap_parse_vlvresponse_control( ld, (LDAPControl *)ctrls, target_pos, list_count, (struct berval **)ctx,
+ errcode );
+}
+
int CDECL wrap_ldap_rename( void *ld, const char *dn, const char *newrdn, const char *newparent, int delete,
LDAPControlU **clientctrls, LDAPControlU **serverctrls, ULONG *msg )
{
@@ -598,6 +625,7 @@ static const struct ldap_funcs funcs =
wrap_ldap_compare_ext,
wrap_ldap_compare_ext_s,
wrap_ldap_control_free,
+ wrap_ldap_controls_free,
wrap_ldap_count_entries,
wrap_ldap_count_references,
wrap_ldap_count_values_len,
@@ -624,7 +652,11 @@ static const struct ldap_funcs funcs =
wrap_ldap_next_attribute,
wrap_ldap_next_entry,
wrap_ldap_next_reference,
+ wrap_ldap_parse_extended_result,
+ wrap_ldap_parse_reference,
wrap_ldap_parse_result,
+ wrap_ldap_parse_sortresponse_control,
+ wrap_ldap_parse_vlvresponse_control,
wrap_ldap_rename,
wrap_ldap_rename_s,
wrap_ldap_result,
diff --git a/dlls/wldap32/libldap.h b/dlls/wldap32/libldap.h
index 8745eac3abc..1dfadf7e3bc 100644
--- a/dlls/wldap32/libldap.h
+++ b/dlls/wldap32/libldap.h
@@ -123,6 +123,7 @@ extern int CDECL wrap_ldap_compare_ext(void *, const char *, const char *, struc
extern int CDECL wrap_ldap_compare_ext_s(void *, const char *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **) DECLSPEC_HIDDEN;
extern void CDECL wrap_ldap_control_free(LDAPControlU *) DECLSPEC_HIDDEN;
+extern void CDECL wrap_ldap_controls_free(LDAPControlU **) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_count_entries(void *, void *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_count_references(void *, void *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_count_values_len(struct bervalU **) DECLSPEC_HIDDEN;
@@ -153,8 +154,13 @@ extern int CDECL wrap_ldap_msgfree(void *) DECLSPEC_HIDDEN;
extern char * CDECL wrap_ldap_next_attribute(void *, void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_next_entry(void *, void *) DECLSPEC_HIDDEN;
extern void * CDECL wrap_ldap_next_reference(void *, void *) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_parse_extended_result(void *, void *, char **, struct bervalU **, int) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_parse_reference(void *, void *, char ***, LDAPControlU ***, int) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_parse_result(void *, void *, int *, char **, char **, char ***, LDAPControlU ***,
int) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_parse_sortresponse_control(void *, LDAPControlU *, int *, char **) DECLSPEC_HIDDEN;
+extern int CDECL wrap_ldap_parse_vlvresponse_control(void *, LDAPControlU *, int *, int *, struct bervalU **,
+ int *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_rename(void *, const char *, const char *, const char *, int, LDAPControlU **,
LDAPControlU **, ULONG *) DECLSPEC_HIDDEN;
extern int CDECL wrap_ldap_rename_s(void *, const char *, const char *, const char *, int, LDAPControlU **,
@@ -199,6 +205,7 @@ struct ldap_funcs
int (CDECL *ldap_compare_ext_s)(void *, const char *, const char *, struct bervalU *, LDAPControlU **,
LDAPControlU **);
void (CDECL *ldap_control_free)(LDAPControlU *);
+ void (CDECL *ldap_controls_free)(LDAPControlU **);
int (CDECL *ldap_count_entries)(void *, void *);
int (CDECL *ldap_count_references)(void *, void *);
int (CDECL *ldap_count_values_len)(struct bervalU **);
@@ -227,7 +234,11 @@ struct ldap_funcs
char * (CDECL *ldap_next_attribute)(void *, void *, void *);
void * (CDECL *ldap_next_entry)(void *, void *);
void * (CDECL *ldap_next_reference)(void *, void *);
+ int (CDECL *ldap_parse_extended_result)(void *, void *, char **, struct bervalU **, int);
+ int (CDECL *ldap_parse_reference)(void *, void *, char ***, LDAPControlU ***, int);
int (CDECL *ldap_parse_result)(void *, void *, int *, char **, char **, char ***, LDAPControlU ***, int);
+ int (CDECL *ldap_parse_sortresponse_control)(void *, LDAPControlU *, int *, char **);
+ int (CDECL *ldap_parse_vlvresponse_control)(void *, LDAPControlU *, int *, int *, struct bervalU **, int *);
int (CDECL *ldap_rename)(void *, const char *, const char *, const char *, int, LDAPControlU **, LDAPControlU **,
ULONG *);
int (CDECL *ldap_rename_s)(void *, const char *, const char *, const char *, int, LDAPControlU **, LDAPControlU **);
diff --git a/dlls/wldap32/parse.c b/dlls/wldap32/parse.c
index bbaa7b1f842..1b699435223 100644
--- a/dlls/wldap32/parse.c
+++ b/dlls/wldap32/parse.c
@@ -18,36 +18,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
-#ifdef HAVE_LDAP_H
-#include <ldap.h>
-#endif
-
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winldap_private.h"
-#include "wldap32.h"
#include "wine/debug.h"
+#include "winldap_private.h"
-#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
-#endif
/***********************************************************************
* ldap_parse_extended_resultA (WLDAP32.@)
*
* See ldap_parse_extended_resultW.
*/
-ULONG CDECL ldap_parse_extended_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
- PCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free )
+ULONG CDECL ldap_parse_extended_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, char **oid,
+ struct WLDAP32_berval **data, BOOLEAN free )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
WCHAR *oidW = NULL;
TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
@@ -56,21 +45,20 @@ ULONG CDECL ldap_parse_extended_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = ldap_parse_extended_resultW( ld, result, &oidW, data, free );
-
- if (oid) {
- *oid = strWtoA( oidW );
- if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
+ if (oid && oidW)
+ {
+ char *str;
+ if ((str = strWtoA( oidW ))) *oid = str;
+ else ret = WLDAP32_LDAP_NO_MEMORY;
ldap_memfreeW( oidW );
}
-
-#endif
return ret;
}
/***********************************************************************
* ldap_parse_extended_resultW (WLDAP32.@)
*
- * Parse the result of an extended operation.
+ * Parse the result of an extended operation.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
@@ -88,26 +76,33 @@ ULONG CDECL ldap_parse_extended_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *
* value for 'free' or call ldap_msgfree to free the result message.
*/
ULONG CDECL ldap_parse_extended_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
- PWCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free )
+ WCHAR **oid, struct WLDAP32_berval **data, BOOLEAN free )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
char *oidU = NULL;
+ struct bervalU *dataU = NULL;
TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
- ret = map_error( ldap_parse_extended_result( ld->ld, result->Request, &oidU, (struct berval **)data, free ) );
-
- if (oid) {
- *oid = strUtoW( oidU );
- if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
- ldap_memfree( oidU );
+ ret = map_error( ldap_funcs->ldap_parse_extended_result( ld->ld, result, &oidU, &dataU, free ) );
+ if (oid && oidU)
+ {
+ WCHAR *str;
+ if ((str = strUtoW( oidU ))) *oid = str;
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_funcs->ldap_memfree( oidU );
+ }
+ if (data && dataU)
+ {
+ struct WLDAP32_berval *bv;
+ if ((bv = bervalUtoW( dataU ))) *data = bv;
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_funcs->ber_bvfree( dataU );
}
-#endif
return ret;
}
@@ -116,11 +111,9 @@ ULONG CDECL ldap_parse_extended_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *
*
* See ldap_parse_referenceW.
*/
-ULONG CDECL ldap_parse_referenceA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message,
- PCHAR **referrals )
+ULONG CDECL ldap_parse_referenceA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, char ***referrals )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
WCHAR **referralsW = NULL;
TRACE( "(%p, %p, %p)\n", ld, message, referrals );
@@ -128,11 +121,13 @@ ULONG CDECL ldap_parse_referenceA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *messag
if (!ld) return ~0u;
ret = ldap_parse_referenceW( ld, message, &referralsW );
-
- *referrals = strarrayWtoA( referralsW );
- ldap_value_freeW( referralsW );
-
-#endif
+ if (referralsW)
+ {
+ char **ref;
+ if ((ref = strarrayWtoA( referralsW ))) *referrals = ref;
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_value_freeW( referralsW );
+ }
return ret;
}
@@ -153,23 +148,23 @@ ULONG CDECL ldap_parse_referenceA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *messag
* NOTES
* Free the referrals with ldap_value_free.
*/
-ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
- PWCHAR **referrals )
+ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, WCHAR ***referrals )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP_PARSE_REFERENCE
+ ULONG ret;
char **referralsU = NULL;
- TRACE( "(%p, %p, %p)\n", ld, result, referrals );
+ TRACE( "(%p, %p, %p)\n", ld, message, referrals );
if (!ld) return ~0u;
- ret = map_error( ldap_parse_reference( ld->ld, result->Request, &referralsU, NULL, 0 ));
-
- *referrals = strarrayUtoW( referralsU );
- ldap_memfree( referralsU );
-
-#endif
+ ret = map_error( ldap_funcs->ldap_parse_reference( ld->ld, message, &referralsU, NULL, 0 ) );
+ if (referralsU)
+ {
+ WCHAR **ref;
+ if ((ref = strarrayUtoW( referralsU ))) *referrals = ref;
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_funcs->ldap_memfree( referralsU );
+ }
return ret;
}
@@ -178,26 +173,22 @@ ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result
*
* See ldap_parse_resultW.
*/
-ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
- ULONG *retcode, PCHAR *matched, PCHAR *error, PCHAR **referrals,
- PLDAPControlA **serverctrls, BOOLEAN free )
+ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, char **matched,
+ char **error, char ***referrals, LDAPControlA ***serverctrls, BOOLEAN free )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
WCHAR *matchedW = NULL, *errorW = NULL, **referralsW = NULL;
LDAPControlW **serverctrlsW = NULL;
- TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
- matched, error, referrals, serverctrls, free );
+ TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode, matched, error, referrals, serverctrls,
+ free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- ret = ldap_parse_resultW( ld, result, retcode, &matchedW, &errorW,
- &referralsW, &serverctrlsW, free );
+ ret = ldap_parse_resultW( ld, result, retcode, &matchedW, &errorW, &referralsW, &serverctrlsW, free );
if (matched) *matched = strWtoA( matchedW );
if (error) *error = strWtoA( errorW );
-
if (referrals) *referrals = strarrayWtoA( referralsW );
if (serverctrls) *serverctrls = controlarrayWtoA( serverctrlsW );
@@ -205,15 +196,13 @@ ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
ldap_memfreeW( errorW );
ldap_value_freeW( referralsW );
ldap_controls_freeW( serverctrlsW );
-
-#endif
return ret;
}
/***********************************************************************
* ldap_parse_resultW (WLDAP32.@)
*
- * Parse a result message.
+ * Parse a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
@@ -235,35 +224,30 @@ ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
* ldap_controls_free. Pass a nonzero value for 'free' or call
* ldap_msgfree to free the result message.
*/
-ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
- ULONG *retcode, PWCHAR *matched, PWCHAR *error, PWCHAR **referrals,
- PLDAPControlW **serverctrls, BOOLEAN free )
+ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, WCHAR **matched,
+ WCHAR **error, WCHAR ***referrals, LDAPControlW ***serverctrls, BOOLEAN free )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
char *matchedU = NULL, *errorU = NULL, **referralsU = NULL;
- LDAPControl **serverctrlsU = NULL;
+ LDAPControlU **serverctrlsU = NULL;
- TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
- matched, error, referrals, serverctrls, free );
+ TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode, matched, error, referrals, serverctrls,
+ free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
- ret = map_error( ldap_parse_result( ld->ld, result->Request, (int *)retcode, &matchedU, &errorU,
- &referralsU, &serverctrlsU, free ));
+ ret = map_error( ldap_funcs->ldap_parse_result( ld->ld, result->Request, (int *)retcode, &matchedU, &errorU,
+ &referralsU, &serverctrlsU, free ) );
if (matched) *matched = strUtoW( matchedU );
if (error) *error = strUtoW( errorU );
-
if (referrals) *referrals = strarrayUtoW( referralsU );
if (serverctrls) *serverctrls = controlarrayUtoW( serverctrlsU );
- ldap_memfree( matchedU );
- ldap_memfree( errorU );
- ldap_memvfree( (void **)referralsU );
- ldap_controls_free( serverctrlsU );
-
-#endif
+ ldap_funcs->ldap_memfree( matchedU );
+ ldap_funcs->ldap_memfree( errorU );
+ ldap_funcs->ldap_memvfree( (void **)referralsU );
+ ldap_funcs->ldap_controls_free( serverctrlsU );
return ret;
}
@@ -272,11 +256,9 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
*
* See ldap_parse_sort_controlW.
*/
-ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
- ULONG *result, PCHAR *attr )
+ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, LDAPControlA **control, ULONG *result, char **attr )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
WCHAR *attrW = NULL;
LDAPControlW **controlW = NULL;
@@ -284,16 +266,12 @@ ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!control) return WLDAP32_LDAP_CONTROL_NOT_FOUND;
-
- controlW = controlarrayAtoW( control );
- if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
+ if (!(controlW = controlarrayAtoW( control ))) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_parse_sort_controlW( ld, controlW, result, &attrW );
*attr = strWtoA( attrW );
controlarrayfreeW( controlW );
-
-#endif
return ret;
}
@@ -315,36 +293,20 @@ ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
* NOTES
* If the function fails, free the failing attribute with ldap_memfree.
*/
-ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
- ULONG *result, PWCHAR *attr )
+ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, LDAPControlW **control, ULONG *result, WCHAR **attr )
{
- ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ ULONG ret;
char *attrU = NULL;
- LDAPControl **controlU = NULL;
-#ifdef HAVE_LDAP_PARSE_SORT_CONTROL
- unsigned long res;
-#elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL)
- ber_int_t res;
- LDAPControl *sortcontrol = NULL;
+ LDAPControlU **controlU, *sortcontrol = NULL;
+ int res;
unsigned int i;
-#endif
TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!control) return WLDAP32_LDAP_CONTROL_NOT_FOUND;
+ if (!(controlU = controlarrayWtoU( control ))) return WLDAP32_LDAP_NO_MEMORY;
- controlU = controlarrayWtoU( control );
- if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
-
-#ifdef HAVE_LDAP_PARSE_SORT_CONTROL
- if (!(ret = ldap_parse_sort_control( ld->ld, controlU, &res, &attrU )))
- {
- *result = res;
- *attr = strUtoW( attrU );
- }
-#elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL)
for (i = 0; controlU[i]; i++)
{
if (!strcmp( LDAP_SERVER_RESP_SORT_OID, controlU[i]->ldctl_oid ))
@@ -355,16 +317,22 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
controlarrayfreeU( controlU );
return WLDAP32_LDAP_CONTROL_NOT_FOUND;
}
- if (!(ret = ldap_parse_sortresponse_control( ld->ld, sortcontrol, &res, &attrU )))
+
+ ret = map_error( ldap_funcs->ldap_parse_sortresponse_control( ld->ld, sortcontrol, &res, &attrU ) );
+ if (ret == WLDAP32_LDAP_SUCCESS)
{
- *result = res;
- *attr = strUtoW( attrU );
+ WCHAR *str;
+ if ((str = strUtoW( attrU )))
+ {
+ *attr = str;
+ *result = res;
+ }
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_funcs->ldap_memfree( attrU );
}
-#endif
- controlarrayfreeU( controlU );
-#endif
- return map_error( ret );
+ controlarrayfreeU( controlU );
+ return ret;
}
/***********************************************************************
@@ -372,30 +340,19 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
*
* See ldap_parse_vlv_controlW.
*/
-INT CDECL ldap_parse_vlv_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
- PULONG targetpos, PULONG listcount,
- struct WLDAP32_berval **context, PINT errcode )
+int CDECL ldap_parse_vlv_controlA( WLDAP32_LDAP *ld, LDAPControlA **control, ULONG *targetpos, ULONG *listcount,
+ struct WLDAP32_berval **context, int *errcode )
{
- int ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
+ int ret;
LDAPControlW **controlW = NULL;
- TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
- listcount, context, errcode );
+ TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos, listcount, context, errcode );
if (!ld) return ~0u;
- if (control) {
- controlW = controlarrayAtoW( control );
- if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
- }
-
- ret = ldap_parse_vlv_controlW( ld, controlW, targetpos, listcount,
- context, errcode );
-
+ if (control && !(controlW = controlarrayAtoW( control ))) return WLDAP32_LDAP_NO_MEMORY;
+ ret = ldap_parse_vlv_controlW( ld, controlW, targetpos, listcount, context, errcode );
controlarrayfreeW( controlW );
-
-#endif
return ret;
}
@@ -419,56 +376,45 @@ INT CDECL ldap_parse_vlv_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
* NOTES
* Free the server context with ber_bvfree.
*/
-INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
- PULONG targetpos, PULONG listcount,
- struct WLDAP32_berval **context, PINT errcode )
+int CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, LDAPControlW **control, ULONG *targetpos, ULONG *listcount,
+ struct WLDAP32_berval **context, int *errcode )
{
- int ret = WLDAP32_LDAP_NOT_SUPPORTED;
-#ifdef HAVE_LDAP
- LDAPControl **controlU = NULL;
-#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
- unsigned long pos, count;
-#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
- ber_int_t pos, count;
- LDAPControl *vlvcontrol = NULL;
+ int ret, pos, count;
+ LDAPControlU **controlU, *vlvcontrolU = NULL;
+ struct bervalU *ctxU;
unsigned int i;
-#endif
- TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
- listcount, context, errcode );
+ TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos, listcount, context, errcode );
if (!ld || !control) return ~0u;
- controlU = controlarrayWtoU( control );
- if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
+ if (!(controlU = controlarrayWtoU( control ))) return WLDAP32_LDAP_NO_MEMORY;
-#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
- if (!(ret = ldap_parse_vlv_control( ld->ld, controlU, &pos, &count,
- (struct berval **)context, errcode )))
- {
- *targetpos = pos;
- *listcount = count;
- }
-#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
for (i = 0; controlU[i]; i++)
{
if (!strcmp( LDAP_CONTROL_VLVRESPONSE, controlU[i]->ldctl_oid ))
- vlvcontrol = controlU[i];
+ vlvcontrolU = controlU[i];
}
- if (!vlvcontrol)
+ if (!vlvcontrolU)
{
controlarrayfreeU( controlU );
return WLDAP32_LDAP_CONTROL_NOT_FOUND;
}
- if (!(ret = ldap_parse_vlvresponse_control( ld->ld, vlvcontrol, &pos, &count,
- (struct berval **)context, errcode )))
+
+ ret = map_error( ldap_funcs->ldap_parse_vlvresponse_control( ld->ld, vlvcontrolU, &pos, &count, &ctxU, errcode ) );
+ if (ret == WLDAP32_LDAP_SUCCESS)
{
- *targetpos = pos;
- *listcount = count;
+ struct WLDAP32_berval *bv;
+ if ((bv = bervalUtoW( ctxU )))
+ {
+ *context = bv;
+ *targetpos = pos;
+ *listcount = count;
+ }
+ else ret = WLDAP32_LDAP_NO_MEMORY;
+ ldap_funcs->ber_bvfree( ctxU );
}
-#endif
- controlarrayfreeU( controlU );
-#endif
- return map_error( ret );
+ controlarrayfreeU( controlU );
+ return ret;
}
diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h
index e488db954c8..c8040149290 100644
--- a/dlls/wldap32/winldap_private.h
+++ b/dlls/wldap32/winldap_private.h
@@ -1237,6 +1237,26 @@ static inline LDAPControlW **controlarraydupW( LDAPControlW **controlarray )
return controlarrayW;
}
+static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray )
+{
+ LDAPControlA **controlarrayA = NULL;
+ DWORD size;
+
+ if (controlarray)
+ {
+ size = sizeof(LDAPControlA *) * (controlarraylenW( controlarray ) + 1);
+ if ((controlarrayA = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+ {
+ LDAPControlW **p = controlarray;
+ LDAPControlA **q = controlarrayA;
+
+ while (*p) *q++ = controlWtoA( *p++ );
+ *q = NULL;
+ }
+ }
+ return controlarrayA;
+}
+
static inline WCHAR *strUtoW( const char *str )
{
WCHAR *ret = NULL;
@@ -1322,6 +1342,26 @@ static inline LDAPControlW *controlUtoW( const LDAPControlU *control )
return controlW;
}
+static inline LDAPControlW **controlarrayUtoW( LDAPControlU **controlarray )
+{
+ LDAPControlW **controlarrayW = NULL;
+ DWORD size;
+
+ if (controlarray)
+ {
+ size = sizeof(LDAPControlW *) * (controlarraylenU( controlarray ) + 1);
+ if ((controlarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+ {
+ LDAPControlU **p = controlarray;
+ LDAPControlW **q = controlarrayW;
+
+ while (*p) *q++ = controlUtoW( *p++ );
+ *q = NULL;
+ }
+ }
+ return controlarrayW;
+}
+
static inline DWORD sortkeyarraylenA( LDAPSortKeyA **sortkeyarray )
{
LDAPSortKeyA **p = sortkeyarray;
--
2.30.2
1
0
19 Apr '21
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/gdi32/tests/metafile.c | 51 +++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 9340e20444a..545cdef69b6 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -5023,6 +5023,56 @@ static void test_emf_AlphaBlend(void)
ReleaseDC(0, hdc);
}
+static void test_emf_text_extents(void)
+{
+ static const XFORM xform = {0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f};
+ HFONT font, old_font, old_font2;
+ LOGFONTW logfont = {0};
+ HENHMETAFILE emf;
+ SIZE size, size2;
+ HDC dc, emf_dc;
+ BOOL ret;
+
+ dc = GetDC(0);
+ emf_dc = CreateEnhMetaFileW(dc, NULL, NULL, NULL);
+ ok(!!emf_dc, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+
+ logfont.lfWeight = FW_NORMAL;
+ logfont.lfHeight = 20;
+ lstrcpyW(logfont.lfFaceName, L"Tahoma");
+ font = CreateFontIndirectW(&logfont);
+ ok(!!font, "CreateFontIndirectW failed, error %d\n", GetLastError());
+
+ old_font = SelectObject(dc, font);
+ old_font2 = SelectObject(emf_dc, font);
+
+ ret = SetGraphicsMode(dc, GM_ADVANCED);
+ ok(ret, "SetGraphicsMode failed, error %d\n", GetLastError());
+ ret = SetGraphicsMode(emf_dc, GM_ADVANCED);
+ ok(ret, "SetGraphicsMode failed, error %d\n", GetLastError());
+
+ ret = ModifyWorldTransform(dc, &xform, MWT_RIGHTMULTIPLY);
+ ok(ret, "ModifyWorldTransform failed, error %d\n", GetLastError());
+ ret = ModifyWorldTransform(emf_dc, &xform, MWT_RIGHTMULTIPLY);
+ ok(ret, "ModifyWorldTransform failed, error %d\n", GetLastError());
+
+ ret = GetTextExtentPoint32W(dc, L"W", 1, &size);
+ ok(ret, "GetTextExtentPoint32W failed, error %d\n", GetLastError());
+ ret = GetTextExtentPoint32W(emf_dc, L"W", 1, &size2);
+ ok(ret, "GetTextExtentPoint32W failed, error %d\n", GetLastError());
+todo_wine
+ ok(size2.cx == size.cx && size2.cy == size.cy, "Expected size %dx%d, got %dx%d\n",
+ size.cx, size.cy, size2.cx, size2.cy);
+
+ SelectObject(emf_dc, old_font2);
+ SelectObject(dc, old_font);
+ DeleteObject(font);
+ emf = CloseEnhMetaFile(emf_dc);
+ ok(!!emf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+ DeleteEnhMetaFile(emf);
+ ReleaseDC(0, dc);
+}
+
START_TEST(metafile)
{
init_function_pointers();
@@ -5041,6 +5091,7 @@ START_TEST(metafile)
test_emf_PolyPolyline();
test_emf_GradientFill();
test_emf_WorldTransform();
+ test_emf_text_extents();
/* For win-format metafiles (mfdrv) */
test_mf_SaveDC();
--
2.27.0
1
0
Fix a bug that Tally produces a blank print preview when images have to be scaled.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/gdi32/enhmfdrv/bitblt.c | 85 ++++++++++++++++++++++++++++
dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 2 +
dlls/gdi32/enhmfdrv/init.c | 2 +-
dlls/gdi32/tests/metafile.c | 4 +-
4 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/bitblt.c b/dlls/gdi32/enhmfdrv/bitblt.c
index 1fc5c0b1040..f0be2b52fc0 100644
--- a/dlls/gdi32/enhmfdrv/bitblt.c
+++ b/dlls/gdi32/enhmfdrv/bitblt.c
@@ -27,6 +27,91 @@
#include "enhmetafiledrv.h"
#include "wine/debug.h"
+BOOL CDECL EMFDRV_AlphaBlend( PHYSDEV dev_dst, struct bitblt_coords *dst, PHYSDEV dev_src,
+ struct bitblt_coords *src, BLENDFUNCTION func )
+{
+ UINT bits_size, bmi_size, emr_size, size, bpp;
+ BITMAPINFOHEADER *bmih;
+ EMRALPHABLEND *emr;
+ HBITMAP hbitmap;
+ BITMAP bitmap;
+ BOOL ret;
+
+ /* can't use a metafile DC as source */
+ if (dev_src->funcs == dev_dst->funcs)
+ return FALSE;
+
+ hbitmap = GetCurrentObject(dev_src->hdc, OBJ_BITMAP);
+ if (GetObjectW(hbitmap, sizeof(BITMAP), &bitmap) != sizeof(BITMAP))
+ return FALSE;
+
+ bpp = bitmap.bmPlanes * bitmap.bmBitsPixel;
+ bits_size = get_dib_stride(bitmap.bmWidth, bpp) * bitmap.bmHeight;
+ if (bpp <= 8)
+ bmi_size = sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD);
+ else if (bpp == 16 || bpp == 32)
+ bmi_size = sizeof(BITMAPINFOHEADER) + 3 * sizeof(RGBQUAD);
+ else
+ bmi_size = sizeof(BITMAPINFOHEADER);
+ emr_size = sizeof(EMRALPHABLEND);
+ size = emr_size + bmi_size + bits_size;
+
+ emr = HeapAlloc(GetProcessHeap(), 0, size);
+ if (!emr)
+ return FALSE;
+
+ emr->emr.iType = EMR_ALPHABLEND;
+ emr->emr.nSize = size;
+ emr->rclBounds.left = dst->log_x;
+ emr->rclBounds.top = dst->log_y;
+ emr->rclBounds.right = dst->log_x + dst->log_width - 1;
+ emr->rclBounds.bottom = dst->log_y + dst->log_height - 1;
+ emr->xDest = dst->log_x;
+ emr->yDest = dst->log_y;
+ emr->cxDest = dst->log_width;
+ emr->cyDest = dst->log_height;
+ emr->xSrc = src->log_x;
+ emr->ySrc = src->log_y;
+ emr->cxSrc = src->log_width;
+ emr->cySrc = src->log_height;
+ emr->dwRop = *(DWORD *)&func;
+ GetTransform(dev_src->hdc, 0x204, &emr->xformSrc);
+ emr->crBkColorSrc = GetBkColor(dev_src->hdc);
+ emr->iUsageSrc = DIB_RGB_COLORS;
+ emr->offBmiSrc = emr_size;
+ emr->cbBmiSrc = bmi_size;
+ emr->offBitsSrc = emr_size + bmi_size;
+ emr->cbBitsSrc = bits_size;
+
+ bmih = (BITMAPINFOHEADER *)((BYTE *)emr + emr->offBmiSrc);
+ bmih->biSize = sizeof(BITMAPINFOHEADER);
+ bmih->biWidth = bitmap.bmWidth;
+ bmih->biHeight = bitmap.bmHeight;
+ bmih->biPlanes = bitmap.bmPlanes;
+ bmih->biBitCount = bpp;
+ bmih->biCompression = (bpp == 16 || bpp == 32) ? BI_BITFIELDS : BI_RGB;
+ bmih->biSizeImage = bits_size;
+ bmih->biYPelsPerMeter = 0;
+ bmih->biXPelsPerMeter = 0;
+ bmih->biClrUsed = bpp <= 8 ? 1 << bpp : 0;
+ bmih->biClrImportant = 0;
+
+ if (GetDIBits(dev_src->hdc, hbitmap, 0, (UINT)bmih->biHeight, (BYTE *)emr + emr->offBitsSrc,
+ (BITMAPINFO *)bmih, DIB_RGB_COLORS))
+ {
+ ret = EMFDRV_WriteRecord(dev_dst, (EMR *)emr);
+ if (ret)
+ EMFDRV_UpdateBBox(dev_dst, &emr->rclBounds);
+ }
+ else
+ {
+ ret = FALSE;
+ }
+
+ HeapFree(GetProcessHeap(), 0, emr);
+ return ret;
+}
+
BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
{
EMRBITBLT emr;
diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
index ec83d29c735..253f96cd8ec 100644
--- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
@@ -58,6 +58,8 @@ extern DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_H
/* Metafile driver functions */
extern BOOL CDECL EMFDRV_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
+extern BOOL CDECL EMFDRV_AlphaBlend( PHYSDEV dev_dst, struct bitblt_coords *dst,
+ PHYSDEV dev_src, struct bitblt_coords *src, BLENDFUNCTION func ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index cf9fb923633..07416db265e 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -38,7 +38,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
{
NULL, /* pAbortDoc */
EMFDRV_AbortPath, /* pAbortPath */
- NULL, /* pAlphaBlend */
+ EMFDRV_AlphaBlend, /* pAlphaBlend */
EMFDRV_AngleArc, /* pAngleArc */
EMFDRV_Arc, /* pArc */
EMFDRV_ArcTo, /* pArcTo */
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index ec9c7894574..9340e20444a 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -5001,15 +5001,13 @@ static void test_emf_AlphaBlend(void)
ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
ok(ret, "Test %d: BitBlt failed, error %d\n", test_idx, GetLastError());
ret = GdiAlphaBlend(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, 400, 400, blend);
- todo_wine
ok(ret, "Test %d: GdiAlphaBlend failed, error %d\n", test_idx, GetLastError());
hemf = CloseEnhMetaFile(hdc_emf);
ok(!!hemf, "Test %d: CloseEnhMetaFile failed, %d\n", test_idx, GetLastError());
sprintf(comment, "test_emf_AlphaBlend() test %d", test_idx);
- if (ret)
- ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count, comment, FALSE);
+ ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count, comment, FALSE);
if (ret)
{
dump_emf_bits(hemf, comment);
--
2.27.0
1
0
19 Apr '21
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
v2: Supersede 203796~203800. Added SetLayout tests for Windows Metafiles to show that
world transform changes shouldn't generate META_SELECTOBJECT records. So in patch 6/6,
only the condition check for emf is removed. For wmf, if we need to remove the same
limit, we need to avoid generating META_SELECTOBJECT records when changing world
transform similar to emf. However, wmf can only change world transform via SetLayout
and MFDRV_SetLayout is not implemented at the moment.
dlls/gdi32/tests/metafile.c | 713 +++++++++++++++++++++++++++++++++++-
1 file changed, 712 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 648e9369803..ec9c7894574 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -991,7 +991,7 @@ static void test_mf_SaveDC(void)
/* with the nominal results. */
/* Maximum size of sample metafiles in bytes. */
-#define MF_BUFSIZE 1024
+#define MF_BUFSIZE 2048
/* 8x8 bitmap data for a pattern brush */
static const unsigned char SAMPLE_PATTERN_BRUSH[] = {
@@ -4315,6 +4315,716 @@ static void test_emf_WorldTransform(void)
}
}
+static const unsigned char EMF_ALPHABLEND_1BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_4BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xc8, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x68, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_8BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0x88, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xa4, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x28, 0x04, 0x00, 0x00, 0x94, 0x04, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_16BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xa4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xc0, 0x03, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x30, 0xe0, 0x03, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
+ 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_16BIT_555[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xa4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_24BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xa8, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_32BIT_888[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xc4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
+ 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00
+};
+
+static const unsigned char EMF_ALPHABLEND_32BIT[] =
+{
+ 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+ 0xc4, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x07, 0x00, 0x00, 0xd0, 0x03, 0x00, 0x00,
+ 0xfc, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+ 0xb9, 0xf0, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+ 0x34, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00,
+ 0x90, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
+ 0xe0, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00
+};
+
+static void test_emf_AlphaBlend(void)
+{
+ static const XFORM xform = {0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
+ static const BLENDFUNCTION blend = {AC_SRC_OVER, 0, 128, 0};
+ static const int bitmap_width = 4, bitmap_height = 4;
+ unsigned char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
+ BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
+ HDC hdc, hdc_emf, hdc_emf2, hdc_bitmap;
+ HBITMAP hbitmap, old_hbitmap;
+ HENHMETAFILE hemf, hemf2;
+ int ret, test_idx;
+ char comment[64];
+ void *bits;
+
+ static const struct
+ {
+ WORD bpp;
+ WORD compression;
+ const void *bits;
+ size_t bits_count;
+ DWORD used_color_count;
+ DWORD color_count;
+ RGBQUAD colors[3];
+ }
+ tests[] =
+ {
+ {1, BI_RGB, EMF_ALPHABLEND_1BIT, sizeof(EMF_ALPHABLEND_1BIT), 1, 1, {{0xff, 0xff, 0xff}}},
+ {4, BI_RGB, EMF_ALPHABLEND_4BIT, sizeof(EMF_ALPHABLEND_4BIT), 1, 1, {{0xff, 0xff, 0xff}}},
+ {8, BI_RGB, EMF_ALPHABLEND_8BIT, sizeof(EMF_ALPHABLEND_8BIT), 1, 1, {{0xff, 0xff, 0xff}}},
+ {16, BI_RGB, EMF_ALPHABLEND_16BIT_555, sizeof(EMF_ALPHABLEND_16BIT_555)},
+ {24, BI_RGB, EMF_ALPHABLEND_24BIT, sizeof(EMF_ALPHABLEND_24BIT)},
+ {32, BI_RGB, EMF_ALPHABLEND_32BIT_888, sizeof(EMF_ALPHABLEND_32BIT_888)},
+ {16, BI_BITFIELDS, EMF_ALPHABLEND_16BIT, sizeof(EMF_ALPHABLEND_16BIT), 0, 3, {{0x00, 0xf8, 0x00}, {0xe0, 0x07, 0x00}, {0x1f, 0x00, 0x00}}},
+ {32, BI_BITFIELDS, EMF_ALPHABLEND_32BIT, sizeof(EMF_ALPHABLEND_32BIT), 0, 3, {{0x00, 0x00, 0xff}, {0xe0, 0xff, 0x00}, {0xff, 0x00, 0x00}}},
+ };
+
+ hdc = GetDC(0);
+
+ /* Test that source DC cannot be an enhanced metafile */
+ hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
+ ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+ hdc_emf2 = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
+ ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+
+ ret = GdiAlphaBlend(hdc_emf, 0, 0, 1, 1, hdc_emf2, 0, 0, 1, 1, blend);
+ ok(!ret, "GdiAlphaBlend succeeded\n");
+
+ hemf2 = CloseEnhMetaFile(hdc_emf2);
+ ok(!!hemf2, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+ hemf = CloseEnhMetaFile(hdc_emf);
+ ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+ DeleteEnhMetaFile(hemf2);
+ DeleteEnhMetaFile(hemf);
+
+ /* Test AlphaBlend with different format of bitmaps */
+ for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
+ {
+ memset(bmi_buffer, 0, sizeof(bmi_buffer));
+ bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
+ bmi->bmiHeader.biHeight = bitmap_width;
+ bmi->bmiHeader.biWidth = bitmap_height;
+ bmi->bmiHeader.biBitCount = tests[test_idx].bpp;
+ bmi->bmiHeader.biPlanes = 1;
+ bmi->bmiHeader.biCompression = tests[test_idx].compression;
+ bmi->bmiHeader.biClrUsed = tests[test_idx].used_color_count;
+ memcpy(bmi->bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
+
+ hbitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, NULL, 0);
+ ok(!!hbitmap, "Test %d: CreateDIBSection failed, error %d\n", test_idx, GetLastError());
+ hdc_bitmap = CreateCompatibleDC(hdc);
+ ok(!!hdc_bitmap, "Test %d: CreateCompatibleDC failed, error %d\n", test_idx, GetLastError());
+ old_hbitmap = SelectObject(hdc_bitmap, hbitmap);
+
+ SetBkColor(hdc_bitmap, RGB(0xff, 0xff, 0xff));
+ ret = SetGraphicsMode(hdc_bitmap, GM_ADVANCED);
+ ok(ret, "Test %d: SetGraphicsMode failed, error %d\n", test_idx, GetLastError());
+ ret = SetWorldTransform(hdc_bitmap, &xform);
+ ok(ret, "Test %d: SetWorldTransform failed, error %d\n", test_idx, GetLastError());
+ ret = SetMapMode(hdc_bitmap, MM_ANISOTROPIC);
+ ok(ret, "Test %d: SetMapMode failed, error %d\n", test_idx, GetLastError());
+ ret = SetWindowOrgEx(hdc_bitmap, 0, 0, NULL);
+ ok(ret, "Test %d: SetWindowOrgEx failed, error %d\n", test_idx, GetLastError());
+ ret = SetWindowExtEx(hdc_bitmap, 400, 400, NULL);
+ ok(ret, "Test %d: SetWindowExtEx failed, error %d\n", test_idx, GetLastError());
+ ret = SetViewportOrgEx(hdc_bitmap, 0, 0, NULL);
+ ok(ret, "Test %d: SetViewportOrgEx failed, error %d\n", test_idx, GetLastError());
+ ret = SetViewportExtEx(hdc_bitmap, bitmap_width, bitmap_height, NULL);
+ ok(ret, "Test %d: SetViewportExtEx failed, error %d\n", test_idx, GetLastError());
+
+ hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
+ ok(!!hdc_emf, "Test %d: CreateEnhMetaFileW failed, error %d\n", test_idx, GetLastError());
+
+ ret = BitBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, WHITENESS);
+ ok(ret, "Test %d: BitBlt failed, error %d\n", test_idx, GetLastError());
+ ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
+ ok(ret, "Test %d: BitBlt failed, error %d\n", test_idx, GetLastError());
+ ret = GdiAlphaBlend(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, 400, 400, blend);
+ todo_wine
+ ok(ret, "Test %d: GdiAlphaBlend failed, error %d\n", test_idx, GetLastError());
+
+ hemf = CloseEnhMetaFile(hdc_emf);
+ ok(!!hemf, "Test %d: CloseEnhMetaFile failed, %d\n", test_idx, GetLastError());
+
+ sprintf(comment, "test_emf_AlphaBlend() test %d", test_idx);
+ if (ret)
+ ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count, comment, FALSE);
+ if (ret)
+ {
+ dump_emf_bits(hemf, comment);
+ dump_emf_records(hemf, comment);
+ }
+
+ DeleteEnhMetaFile(hemf);
+ SelectObject(hdc_bitmap, old_hbitmap);
+ DeleteDC(hdc_bitmap);
+ DeleteObject(hbitmap);
+ }
+
+ ReleaseDC(0, hdc);
+}
+
START_TEST(metafile)
{
init_function_pointers();
@@ -4323,6 +5033,7 @@ START_TEST(metafile)
test_ExtTextOut();
test_ExtTextOutScale();
test_SaveDC();
+ test_emf_AlphaBlend();
test_emf_BitBlt();
test_emf_DCBrush();
test_emf_ExtTextOut_on_path();
--
2.27.0
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
tools/winedump/Makefile.in | 1 +
tools/winedump/dump.c | 1 +
tools/winedump/mf.c | 219 +++++++++++++++++++++++++++++++++++++
tools/winedump/winedump.h | 4 +-
4 files changed, 224 insertions(+), 1 deletion(-)
create mode 100644 tools/winedump/mf.c
diff --git a/tools/winedump/Makefile.in b/tools/winedump/Makefile.in
index 43e200ab6ed..54028024b0d 100644
--- a/tools/winedump/Makefile.in
+++ b/tools/winedump/Makefile.in
@@ -12,6 +12,7 @@ C_SRCS = \
lib.c \
lnk.c \
main.c \
+ mf.c \
minidump.c \
misc.c \
msc.c \
diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c
index 412880c4bd6..d2e920ef6cb 100644
--- a/tools/winedump/dump.c
+++ b/tools/winedump/dump.c
@@ -265,6 +265,7 @@ dumpers[] =
{SIG_MDMP, get_kind_mdmp, mdmp_dump},
{SIG_LNK, get_kind_lnk, lnk_dump},
{SIG_EMF, get_kind_emf, emf_dump},
+ {SIG_MF, get_kind_mf, mf_dump},
{SIG_FNT, get_kind_fnt, fnt_dump},
{SIG_TLB, get_kind_tlb, tlb_dump},
{SIG_NLS, get_kind_nls, nls_dump},
diff --git a/tools/winedump/mf.c b/tools/winedump/mf.c
new file mode 100644
index 00000000000..37869d3bb8a
--- /dev/null
+++ b/tools/winedump/mf.c
@@ -0,0 +1,219 @@
+/*
+ * Dump a Windows Metafile
+ *
+ * Copyright 2021 Zhiyi Zhang for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include "winedump.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+
+#define META_EOF 0
+#define METAFILE_MEMORY 1
+#define METAFILE_DISK 2
+
+static unsigned offset = 0;
+
+static unsigned short read_word(const unsigned char *buffer)
+{
+ return buffer[0] + (buffer[1] << 8);
+}
+
+static unsigned int read_int(const unsigned char *buffer)
+{
+ return buffer[0] + (buffer[1] << 8) + (buffer[2] << 16) + (buffer[3] << 24);
+}
+
+static int dump_mfrecord(void)
+{
+ unsigned int type, size, i;
+ const unsigned char *ptr;
+
+ ptr = PRD(offset, 6);
+ if (!ptr)
+ return -1;
+
+ /* METAHEADER */
+ if (offset == 0)
+ {
+ type = read_word(ptr);
+ /* mtHeaderSize is in words */
+ size = read_word(ptr + 2) * 2;
+ }
+ /* METARECORD */
+ else
+ {
+ /* rdSize is in words */
+ size = read_int(ptr) * 2;
+ type = read_word(ptr + 4);
+ }
+
+#define MRCASE(x) \
+ case x: \
+ printf("%-20s %08x\n", #x, size); \
+ break
+
+ switch (type)
+ {
+ case METAFILE_MEMORY:
+ case METAFILE_DISK:
+ {
+ const METAHEADER *header = PRD(offset, sizeof(*header));
+
+ printf("%-20s %08x\n", "METAHEADER", size);
+ printf("type %d header_size %#x version %#x size %#x object_count %d max_record_size %#x "
+ "parameter_count %d\n",
+ header->mtType, header->mtHeaderSize * 2, header->mtVersion, header->mtSize * 2,
+ header->mtNoObjects, header->mtMaxRecord * 2, header->mtNoParameters);
+ break;
+ }
+ MRCASE(META_SETBKCOLOR);
+ MRCASE(META_SETBKMODE);
+ MRCASE(META_SETMAPMODE);
+ MRCASE(META_SETROP2);
+ MRCASE(META_SETRELABS);
+ MRCASE(META_SETPOLYFILLMODE);
+ MRCASE(META_SETSTRETCHBLTMODE);
+ MRCASE(META_SETTEXTCHAREXTRA);
+ MRCASE(META_SETTEXTCOLOR);
+ MRCASE(META_SETTEXTJUSTIFICATION);
+ MRCASE(META_SETWINDOWORG);
+ MRCASE(META_SETWINDOWEXT);
+ MRCASE(META_SETVIEWPORTORG);
+ MRCASE(META_SETVIEWPORTEXT);
+ MRCASE(META_OFFSETWINDOWORG);
+ MRCASE(META_SCALEWINDOWEXT);
+ MRCASE(META_OFFSETVIEWPORTORG);
+ MRCASE(META_SCALEVIEWPORTEXT);
+ MRCASE(META_LINETO);
+ MRCASE(META_MOVETO);
+ MRCASE(META_EXCLUDECLIPRECT);
+ MRCASE(META_INTERSECTCLIPRECT);
+ MRCASE(META_ARC);
+ MRCASE(META_ELLIPSE);
+ MRCASE(META_FLOODFILL);
+ MRCASE(META_PIE);
+ MRCASE(META_RECTANGLE);
+ MRCASE(META_ROUNDRECT);
+ MRCASE(META_PATBLT);
+ MRCASE(META_SAVEDC);
+ MRCASE(META_SETPIXEL);
+ MRCASE(META_OFFSETCLIPRGN);
+ MRCASE(META_TEXTOUT);
+ MRCASE(META_BITBLT);
+ MRCASE(META_STRETCHBLT);
+ MRCASE(META_POLYGON);
+ MRCASE(META_POLYLINE);
+ MRCASE(META_ESCAPE);
+ MRCASE(META_RESTOREDC);
+ MRCASE(META_FILLREGION);
+ MRCASE(META_FRAMEREGION);
+ MRCASE(META_INVERTREGION);
+ MRCASE(META_PAINTREGION);
+ MRCASE(META_SELECTCLIPREGION);
+ MRCASE(META_SELECTOBJECT);
+ MRCASE(META_SETTEXTALIGN);
+ MRCASE(META_DRAWTEXT);
+ MRCASE(META_CHORD);
+ MRCASE(META_SETMAPPERFLAGS);
+ MRCASE(META_EXTTEXTOUT);
+ MRCASE(META_SETDIBTODEV);
+ MRCASE(META_SELECTPALETTE);
+ MRCASE(META_REALIZEPALETTE);
+ MRCASE(META_ANIMATEPALETTE);
+ MRCASE(META_SETPALENTRIES);
+ MRCASE(META_POLYPOLYGON);
+ MRCASE(META_RESIZEPALETTE);
+ MRCASE(META_DIBBITBLT);
+ MRCASE(META_DIBSTRETCHBLT);
+ MRCASE(META_DIBCREATEPATTERNBRUSH);
+ MRCASE(META_STRETCHDIB);
+ MRCASE(META_EXTFLOODFILL);
+ MRCASE(META_RESETDC);
+ MRCASE(META_STARTDOC);
+ MRCASE(META_STARTPAGE);
+ MRCASE(META_ENDPAGE);
+ MRCASE(META_ABORTDOC);
+ MRCASE(META_ENDDOC);
+ MRCASE(META_SETLAYOUT);
+ MRCASE(META_DELETEOBJECT);
+ MRCASE(META_CREATEPALETTE);
+ MRCASE(META_CREATEBRUSH);
+ MRCASE(META_CREATEPATTERNBRUSH);
+ MRCASE(META_CREATEPENINDIRECT);
+ MRCASE(META_CREATEFONTINDIRECT);
+ MRCASE(META_CREATEBRUSHINDIRECT);
+ MRCASE(META_CREATEBITMAPINDIRECT);
+ MRCASE(META_CREATEBITMAP);
+ MRCASE(META_CREATEREGION);
+ MRCASE(META_UNKNOWN);
+ MRCASE(META_EOF);
+
+ default:
+ printf("%u %08x\n", type, size);
+ break;
+ }
+
+#undef MRCASE
+
+ if ((size < 6) || (size % 2))
+ return -1;
+
+ /* METARECORD */
+ if (offset)
+ {
+ size -= 6;
+ offset += 6;
+ }
+
+ for (i = 0; i < size; i += 2)
+ {
+ if (i % 16 == 0)
+ printf(" ");
+ if (!(ptr = PRD(offset, 2)))
+ return -1;
+ offset += 2;
+ printf("%04x ", read_word(ptr));
+ if ((i % 16 == 14) || (i + 2 == size))
+ printf("\n");
+ }
+
+ return 0;
+}
+
+enum FileSig get_kind_mf(void)
+{
+ const METAHEADER *hdr;
+
+ hdr = PRD(0, sizeof(*hdr));
+ if (hdr && (hdr->mtType == METAFILE_MEMORY || hdr->mtType == METAFILE_DISK)
+ && hdr->mtHeaderSize == sizeof(METAHEADER) / sizeof(WORD)
+ && (hdr->mtVersion == 0x0100 || hdr->mtVersion == 0x0300))
+ return SIG_MF;
+ return SIG_UNKNOWN;
+}
+
+void mf_dump(void)
+{
+ offset = 0;
+ while (!dump_mfrecord())
+ ;
+}
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index 240f31d2f2d..16b9cdc7cf8 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -216,7 +216,7 @@ const char *get_machine_str(int mach);
/* file dumping functions */
enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG, SIG_PDB, SIG_NE, SIG_LE, SIG_MDMP, SIG_COFFLIB, SIG_LNK,
- SIG_EMF, SIG_FNT, SIG_TLB, SIG_NLS};
+ SIG_EMF, SIG_MF, SIG_FNT, SIG_TLB, SIG_NLS};
const void* PRD(unsigned long prd, unsigned long len);
unsigned long Offset(const void* ptr);
@@ -251,6 +251,8 @@ enum FileSig get_kind_lnk(void);
void lnk_dump( void );
enum FileSig get_kind_emf(void);
void emf_dump( void );
+enum FileSig get_kind_mf(void);
+void mf_dump(void);
enum FileSig get_kind_pdb(void);
void pdb_dump(void);
enum FileSig get_kind_fnt(void);
--
2.27.0
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
include/wingdi.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/wingdi.h b/include/wingdi.h
index d989fb6f71b..c10d7518337 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -2125,6 +2125,7 @@ typedef struct
#define META_ENDPAGE 0x0050
#define META_ABORTDOC 0x0052
#define META_ENDDOC 0x005E
+#define META_SETLAYOUT 0x0149
#define META_DELETEOBJECT 0x01F0
#define META_CREATEPALETTE 0x00F7
#define META_CREATEBRUSH 0x00F8
--
2.27.0
1
0
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/devinst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 27be356556b..2524f830871 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -700,7 +700,7 @@ static void remove_all_device_ifaces(struct device *device)
if ((ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, DeviceClasses, 0, KEY_READ, &classes_key)))
{
- ERR("Failed to open classes key, error %u.\n", ret);
+ WARN("Failed to open classes key, error %u.\n", ret);
return;
}
--
2.30.2
1
0
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com>
---
dlls/gdi32/freetype.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index b29d9fcc88e..456eb245700 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1701,8 +1701,6 @@ static void fontconfig_add_fonts_from_dir_list( FcConfig *config, FcStrList *dir
}
done:
- if (font_set) pFcFontSetDestroy( font_set );
- if (subdir_list) pFcStrListDone( subdir_list );
if (subdir_set) pFcStrSetDestroy( subdir_set );
if (cache) pFcDirCacheUnload( cache );
}
--
2.30.0.335.ge6362826a0
1
3