Rebase against 9781b5433cd4b708c0f537aa0b5608ff4157f04c

This commit is contained in:
Alistair Leslie-Hughes 2019-02-13 10:07:39 +11:00
parent 697fe8b5da
commit b8de62375f
19 changed files with 167 additions and 6373 deletions

View File

@ -1,4 +1,4 @@
From d67d7293a17592b580d284fa68881a613e61f591 Mon Sep 17 00:00:00 2001
From b40b0c90a309b73a06ff71ee8a5e99d52a1fbde3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 01:45:29 +0200
Subject: [PATCH] ntdll: Add function to create new tokens for elevation
@ -7,17 +7,17 @@ Subject: [PATCH] ntdll: Add function to create new tokens for elevation
---
dlls/ntdll/ntdll.spec | 3 ++
dlls/ntdll/ntdll_misc.h | 3 ++
dlls/ntdll/process.c | 18 +++++++++++
server/protocol.def | 8 +++++
dlls/ntdll/process.c | 18 +++++++++
server/protocol.def | 8 ++++
server/security.h | 1 +
server/token.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++
server/token.c | 84 +++++++++++++++++++++++++++++++++++++++++
6 files changed, 117 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index dbead5e..586b504 100644
index 969cee72eb4..008abb744a0 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1482,6 +1482,9 @@
@@ -1508,6 +1508,9 @@
# Virtual memory
@ cdecl __wine_locked_recvmsg(long ptr long)
@ -28,12 +28,12 @@ index dbead5e..586b504 100644
@ cdecl wine_get_version() NTDLL_wine_get_version
@ cdecl wine_get_patches() NTDLL_wine_get_patches
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 8a64338..137a22d 100644
index bad7d96d9da..6b71ded85b1 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -80,6 +80,9 @@ extern void virtual_init_threading(void) DECLSPEC_HIDDEN;
extern void fill_cpu_info(void) DECLSPEC_HIDDEN;
@@ -82,6 +82,9 @@ extern void fill_cpu_info(void) DECLSPEC_HIDDEN;
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
+/* token */
+extern HANDLE CDECL __wine_create_default_token(BOOL admin);
@ -42,10 +42,10 @@ index 8a64338..137a22d 100644
extern timeout_t server_start_time DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 40034b4..1ebbb79 100644
index 2ff8610ccee..bb4a1719c3c 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -99,6 +99,24 @@ HANDLE CDECL __wine_make_process_system(void)
@@ -118,6 +118,24 @@ HANDLE CDECL __wine_make_process_system(void)
return ret;
}
@ -71,10 +71,10 @@ index 40034b4..1ebbb79 100644
#define UNIMPLEMENTED_INFO_CLASS(c) \
diff --git a/server/protocol.def b/server/protocol.def
index 0bb04cd..f2deca6 100644
index 493100b8922..071f7404087 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3641,6 +3641,14 @@ struct handle_info
@@ -3666,6 +3666,14 @@ struct handle_info
@END
@ -90,7 +90,7 @@ index 0bb04cd..f2deca6 100644
@REQ(create_completion)
unsigned int access; /* desired access to a port */
diff --git a/server/security.h b/server/security.h
index 6c33714..21e90cc 100644
index 6c337143c3d..21e90ccf23f 100644
--- a/server/security.h
+++ b/server/security.h
@@ -49,6 +49,7 @@ extern const PSID security_builtin_users_sid;
@ -102,7 +102,7 @@ index 6c33714..21e90cc 100644
/* token functions */
diff --git a/server/token.c b/server/token.c
index 7776cbe..64ab565 100644
index 4c37c674abd..e449e61a4db 100644
--- a/server/token.c
+++ b/server/token.c
@@ -79,6 +79,7 @@ static const SID anonymous_logon_sid = { SID_REVISION, 1, { SECURITY_NT_AUTHORIT
@ -121,7 +121,7 @@ index 7776cbe..64ab565 100644
static luid_t prev_luid_value = { 1000, 0 };
@@ -901,6 +903,64 @@ struct token *token_create_admin( void )
@@ -908,6 +910,64 @@ struct token *token_create_admin( void )
return token;
}
@ -186,7 +186,7 @@ index 7776cbe..64ab565 100644
static struct privilege *token_find_privilege( struct token *token, const LUID *luid, int enabled_only )
{
struct privilege *privilege;
@@ -1718,3 +1778,27 @@ DECL_HANDLER(set_token_default_dacl)
@@ -1713,3 +1773,27 @@ DECL_HANDLER(set_token_default_dacl)
release_object( token );
}
}
@ -215,5 +215,5 @@ index 7776cbe..64ab565 100644
+ }
+}
--
1.9.1
2.20.1

View File

@ -1,7 +1,7 @@
From 2af2d1c51ec73862a156850d702dcb4608d73558 Mon Sep 17 00:00:00 2001
From 30d0aa2712dbdfe8f532118f9829c7999c0326a7 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 00:38:06 -0700
Subject: d2d1: Use ID2D1Factory1 in d2d_geometry
Subject: [PATCH] d2d1: Use ID2D1Factory1 in d2d_geometry
https://bugs.winehq.org/show_bug.cgi?id=44052
@ -13,10 +13,10 @@ Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
3 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 21e2b88..0bb0112 100644
index 70b841df8cb..85c56524de4 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -406,7 +406,7 @@ struct d2d_geometry
@@ -424,7 +424,7 @@ struct d2d_geometry
ID2D1Geometry ID2D1Geometry_iface;
LONG refcount;
@ -25,7 +25,7 @@ index 21e2b88..0bb0112 100644
D2D_MATRIX_3X2_F transform;
@@ -470,10 +470,10 @@ struct d2d_geometry
@@ -494,10 +494,10 @@ struct d2d_geometry
} u;
};
@ -37,13 +37,13 @@ index 21e2b88..0bb0112 100644
+ ID2D1Factory1 *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
+void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory,
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
D2D1_FILL_MODE fill_mode, ID2D1Geometry **src_geometries, unsigned int geometry_count) DECLSPEC_HIDDEN;
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index 7810e95..2a1a536 100644
index c2a0405abdd..33c2d173596 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -140,7 +140,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
@@ -141,7 +141,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -52,7 +52,7 @@ index 7810e95..2a1a536 100644
{
WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
heap_free(object);
@@ -190,7 +190,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
@@ -207,7 +207,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -61,7 +61,7 @@ index 7810e95..2a1a536 100644
TRACE("Created transformed geometry %p.\n", object);
*transformed_geometry = (ID2D1TransformedGeometry *)&object->ID2D1Geometry_iface;
@@ -207,7 +207,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory1 *i
@@ -224,7 +224,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory2 *i
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -71,7 +71,7 @@ index 7810e95..2a1a536 100644
TRACE("Created path geometry %p.\n", object);
*geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface;
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index d716fb1..5bf63f6 100644
index 250ff0c5535..7b67e247f7a 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2343,15 +2343,15 @@ static void d2d_geometry_cleanup(struct d2d_geometry *geometry)
@ -134,7 +134,7 @@ index d716fb1..5bf63f6 100644
}
static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_GetBounds(ID2D1RectangleGeometry *iface,
@@ -3780,7 +3788,7 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
@@ -3779,7 +3787,7 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
d2d_rectangle_geometry_GetRect,
};
@ -143,7 +143,7 @@ index d716fb1..5bf63f6 100644
{
struct d2d_face *f;
D2D1_POINT_2F *v;
@@ -3901,10 +3909,14 @@ static void STDMETHODCALLTYPE d2d_transformed_geometry_GetFactory(ID2D1Transform
@@ -3900,10 +3908,14 @@ static void STDMETHODCALLTYPE d2d_transformed_geometry_GetFactory(ID2D1Transform
ID2D1Factory **factory)
{
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
@ -159,7 +159,7 @@ index d716fb1..5bf63f6 100644
}
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_GetBounds(ID2D1TransformedGeometry *iface,
@@ -4098,7 +4110,7 @@ static const struct ID2D1TransformedGeometryVtbl d2d_transformed_geometry_vtbl =
@@ -4096,7 +4108,7 @@ static const struct ID2D1TransformedGeometryVtbl d2d_transformed_geometry_vtbl =
d2d_transformed_geometry_GetTransform,
};
@ -169,5 +169,5 @@ index d716fb1..5bf63f6 100644
{
struct d2d_geometry *src_impl;
--
2.7.4
2.20.1

View File

@ -1,488 +0,0 @@
From c19686947741c4035d22337e3004ce7c0ee51039 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergio=20G=C3=B3mez=20Del=20Real?=
<sdelreal@codeweavers.com>
Date: Wed, 4 Apr 2018 10:49:39 -0500
Subject: [PATCH 1/4] tools/make_unicode: Implement full Unicode character
decomposition.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sergio Gómez Del Real <sdelreal@codeweavers.com>
---
libs/port/mbtowc.c | 14 +--
tools/make_unicode | 333 +++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 279 insertions(+), 68 deletions(-)
diff --git a/libs/port/mbtowc.c b/libs/port/mbtowc.c
index 4977c82..6976f89 100644
--- a/libs/port/mbtowc.c
+++ b/libs/port/mbtowc.c
@@ -22,7 +22,7 @@
#include "wine/unicode.h"
-extern unsigned int wine_decompose( WCHAR ch, WCHAR *dst, unsigned int dstlen ) DECLSPEC_HIDDEN;
+extern int wine_unicode_decompose_string( int compat, const WCHAR *src, int srclen, WCHAR *dst, int dstlen );
/* check the code whether it is in Unicode Private Use Area (PUA). */
/* MB_ERR_INVALID_CHARS raises an error converting from 1-byte character to PUA. */
@@ -101,19 +101,19 @@ static int mbstowcs_sbcs_decompose( const struct sbcs_table *table, int flags,
WCHAR *dst, unsigned int dstlen )
{
const WCHAR * const cp2uni = (flags & MB_USEGLYPHCHARS) ? table->cp2uni_glyphs : table->cp2uni;
- unsigned int len;
+ int len;
if (!dstlen) /* compute length */
{
WCHAR dummy[4]; /* no decomposition is larger than 4 chars */
for (len = 0; srclen; srclen--, src++)
- len += wine_decompose( cp2uni[*src], dummy, 4 );
+ len += wine_unicode_decompose_string( 0, &cp2uni[*src], 1, dummy, 4 );
return len;
}
for (len = dstlen; srclen && len; srclen--, src++)
{
- unsigned int res = wine_decompose( cp2uni[*src], dst, len );
+ int res = wine_unicode_decompose_string( 0, &cp2uni[*src], 1, dst, len );
if (!res) break;
len -= res;
dst += res;
@@ -203,7 +203,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table,
{
const WCHAR * const cp2uni = table->cp2uni;
const unsigned char * const cp2uni_lb = table->cp2uni_leadbytes;
- unsigned int len, res;
+ int len, res;
WCHAR ch;
if (!dstlen) /* compute length */
@@ -219,7 +219,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table,
ch = cp2uni[(off << 8) + *src];
}
else ch = cp2uni[*src];
- len += wine_decompose( ch, dummy, 4 );
+ len += wine_unicode_decompose_string( 0, &ch, 1, dummy, 4 );
}
return len;
}
@@ -234,7 +234,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table,
ch = cp2uni[(off << 8) + *src];
}
else ch = cp2uni[*src];
- if (!(res = wine_decompose( ch, dst, len ))) break;
+ if (!(res = wine_unicode_decompose_string( 0, &ch, 1, dst, len ))) break;
dst += res;
len -= res;
}
diff --git a/tools/make_unicode b/tools/make_unicode
index 56d1905..2aa063b 100755
--- a/tools/make_unicode
+++ b/tools/make_unicode
@@ -472,6 +472,28 @@ sub READ_DEFAULTS($)
next if $decomp eq ""; # no decomposition, skip it
+ # store decomposition table
+ if ($decomp =~ /^<([a-zA-Z]+)>(\s+[0-9a-fA-F]+)+$/)
+ {
+ my @seq = ();
+ for my $ch (split /\s+/, (split /\s+/, $decomp, 2)[1])
+ {
+ push @seq, (hex $ch);
+ }
+ $decomp_table[$src] = [1, \@seq];
+ }
+ elsif ($decomp =~ /^([0-9a-fA-F]+)(\s+([0-9a-fA-F]+))*$/)
+ {
+ my @seq = ();
+ for my $ch (split /\s+/, $decomp)
+ {
+ # we don't support surrogates at the moment
+ next if hex $ch > 0xffff;
+ push @seq, (hex $ch);
+ }
+ $decomp_table[$src] = [0, \@seq];
+ }
+
if ($decomp =~ /^<([a-zA-Z]+)>\s+([0-9a-fA-F]+)$/)
{
# decomposition of the form "<foo> 1234" -> use char if type is known
@@ -506,16 +528,13 @@ sub READ_DEFAULTS($)
# decomposition contains only char values without prefix -> use first char
$dst = hex $1;
$category_table[$src] |= $category_table[$dst] if defined $category_table[$dst];
- # store decomposition if it contains two chars
if ($decomp =~ /^([0-9a-fA-F]+)\s+([0-9a-fA-F]+)$/)
{
- $decomp_table[$src] = [ hex $1, hex $2 ];
push @compose_table, [ hex $1, hex $2, $src ];
}
elsif ($decomp =~ /^(<[a-z]+>\s)*([0-9a-fA-F]+)$/ &&
(($src >= 0xf900 && $src < 0xfb00) || ($src >= 0xfe30 && $src < 0xfffd)))
{
- # Single char decomposition in the compatibility range
$compatmap_table[$src] = hex $2;
}
}
@@ -2264,6 +2283,51 @@ EOF
save_file($filename);
}
+sub do_decomp
+{
+ my ($char, $table_ref, $compat) = @_;
+
+ return ($char) unless defined $table_ref->[$char];
+ my $data = $table_ref->[$char];
+ return ($char) if $data->[0] && !$compat;
+ my @mapping = ();
+ for my $ch (@{$data->[1]})
+ {
+ push @mapping, $ch;
+ }
+ return @mapping;
+}
+
+sub expand_pairs
+{
+ my @data = @_;
+ my @result = ();
+
+ for my $ch (@data)
+ {
+ if ($ch <= 0xFFFF)
+ {
+ push @result, $ch;
+ }
+ elsif ($ch >= 2097152) # 2**21
+ {
+ die sprintf "Invalid Unicode character %04x\n", $ch;
+ }
+ else
+ {
+ my $hx = $ch & 0xFFFF;
+ my $hu = ($ch >> 16) & ((1 << 5) - 1);
+ my $hw = ($hu - 1) & 0xFFFF;
+ my $hi = 0xD800 | ($hw << 6) | ($hx >> 10);
+ my $lx = $ch & 0xFFFF;
+ my $lo = (0xDC00 | ($lx & ((1 << 10) - 1))) & 0xFFFF;
+ push @result, $hi;
+ push @result, $lo;
+ }
+ }
+ return @result;
+}
+
################################################################
# dump the char decomposition table
sub dump_decompose_table($)
@@ -2272,98 +2336,245 @@ sub dump_decompose_table($)
open OUTPUT,">$filename.new" or die "Cannot create $filename";
print "Building $filename\n";
- print OUTPUT "/* Unicode char composition */\n";
+ print OUTPUT "/* Unicode char decomposition */\n";
print OUTPUT "/* generated from $UNIDATA/UnicodeData.txt */\n";
print OUTPUT "/* DO NOT EDIT!! */\n\n";
print OUTPUT "#include \"wine/unicode.h\"\n\n";
- # first determine all the 16-char subsets that contain something
+ # limit code points to BMP
+ my $utflim = 65536;
+ my %nfd_lookup = ();
+ my %nfkd_lookup = ();
+ my %decomp_lookup = ();
+ my @decomp_data = (0);
+ my $pos = 1;
+ my $lastchar_decomp;
- my @filled = (0) x 4096;
- my $pos = 16*2; # for the null subset
- for (my $i = 0; $i < 65536; $i++)
+ for (my $i = 0; $i < $utflim; $i++)
{
next unless defined $decomp_table[$i];
- $filled[$i >> 4] = $pos;
- $pos += 16*2;
- $i |= 15;
+
+ if (defined $decomp_table[$i])
+ {
+ $lastchar_decomp = $i;
+ # fully expand input and mappings
+
+ my @char;
+ push @char, $i;
+ push @char, 0;
+ my $char = pack "n*", @char;
+
+ my @nfd = do_decomp( $i, \@decomp_table, 0 );
+ push @nfd, 0;
+ my $nfd = pack "n*", @nfd;
+
+ my @nfkd = do_decomp( $i, \@decomp_table, 1 );
+ push @nfkd, 0;
+ my $nfkd = pack "n*", @nfkd;
+
+ # lookup or add mappings
+
+ if ($nfd eq $char)
+ {
+ $nfd = undef;
+ }
+ elsif (exists $decomp_lookup{$nfd})
+ {
+ $nfd_lookup{$i} = $decomp_lookup{$nfd};
+ }
+ else
+ {
+ push @decomp_data, @nfd;
+ $decomp_lookup{$nfd} = $pos;
+ $nfd_lookup{$i} = $pos;
+ $pos += @nfd;
+ }
+
+ if ($nfkd eq $char)
+ {
+ $nfkd = undef;
+ }
+ elsif (exists $decomp_lookup{$nfkd})
+ {
+ $nfkd_lookup{$i} = $decomp_lookup{$nfkd};
+ }
+ else
+ {
+ push @decomp_data, @nfkd;
+ $decomp_lookup{$nfkd} = $pos;
+ $nfkd_lookup{$i} = $pos;
+ $pos += @nfkd;
+ }
+ }
}
- my $total = $pos;
- # now count the 256-char subsets that contain something
+ printf OUTPUT "static const UINT last_decomposable = 0x%x;\n\n", $lastchar_decomp;
- my @filled_idx = (256) x 256;
- $pos = 256 + 16;
- for (my $i = 0; $i < 4096; $i++)
+ # dump decomposition data
+
+ printf OUTPUT "static const WCHAR data_decomp[%d] =\n", $pos;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @decomp_data );
+ print OUTPUT "\n};\n\n";
+
+ # find 256-char subsets that contain something
+
+ my $filled_pos = 1;
+ my $filled_lim = ($lastchar_decomp >> 8) + 1;
+ my @filled = (0) x $filled_lim;
+ for (my $i = 0; $i < $utflim; $i++)
+ {
+ last if $i > $lastchar_decomp;
+ next unless exists $nfd_lookup{$i} || exists $nfkd_lookup{$i};
+ $filled[$i >> 8] = $filled_pos++;
+ $i |= 255;
+ }
+
+ # dump index of 256-char subsets
+
+ printf OUTPUT "static const BYTE idx1_decomp[%d] =\n", $filled_lim;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%02x", 0, @filled );
+ print OUTPUT "\n};\n\n";
+
+ # for 256-char subsets, find non-empty 16-char subsets
+
+ my $sub_filled_pos = 1;
+ my %sub_filled = ();
+ for (my $i = 0; $i < $filled_lim; $i++)
{
next unless $filled[$i];
- $filled_idx[$i >> 4] = $pos;
- $pos += 16;
- $i |= 15;
+ for (my $j = 0; $j < 256; $j++)
+ {
+ my $idx = ($i << 8) | $j;
+ next unless exists $nfd_lookup{$idx} || exists $nfkd_lookup{$idx};
+ $sub_filled{$idx >> 4} = $sub_filled_pos++;
+ $j |= 15;
+ }
}
- my $null_offset = $pos; # null mapping
- $total += $pos;
- # add the index offsets to the subsets positions
+ # dump index of 16-char subsets
- for (my $i = 0; $i < 4096; $i++)
+ printf OUTPUT "static const USHORT idx2_decomp[%d] =\n", $filled_pos * 16;
+ print OUTPUT "{\n";
+ my @null_idx = (0) x 16;
+ print OUTPUT " /* null sub-index */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_idx );
+ for (my $i = 0; $i < $filled_lim; $i++)
{
next unless $filled[$i];
- $filled[$i] += $null_offset;
+ printf OUTPUT ",\n /* sub-index 0x%02x */\n", $filled[$i];
+
+ my @sub_idx;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($i << 4) | $j;
+ $sub_idx[$j] = $sub_filled{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_idx );
}
+ print OUTPUT "\n};\n\n";
- # dump the main index
+ # dump the 16-char subsets
- printf OUTPUT "static const WCHAR table[%d] =\n", $total;
- printf OUTPUT "{\n /* index */\n";
- printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @filled_idx );
- printf OUTPUT ",\n /* null sub-index */\n%s", DUMP_ARRAY( "0x%04x", 0, ($null_offset) x 16 );
+ printf OUTPUT "static const USHORT offsets_decomp[%d] =\n", 32 * $sub_filled_pos;
+ print OUTPUT "{\n";
+ print OUTPUT " /* (nfd, nfkd) x 16 */\n";
+ my @null_table = (0) x 32;
+ print OUTPUT " /* no decomposition */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_table );
+ for my $key (sort {$a <=> $b} keys %sub_filled)
+ {
+ printf OUTPUT ",\n /* 0x%03x0 .. 0x%03xf */\n", $key, $key;
+ my @sub_table;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($key << 4) | $j;
+ $sub_table[2 * $j] = $nfd_lookup{$idx} || 0;
+ $sub_table[2 * $j + 1] = $nfkd_lookup{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_table );
+ }
+ print OUTPUT "\n};\n\n";
- # dump the second-level indexes
+ print OUTPUT <<"EOF";
+static const WCHAR *unicode_table_lookup( UINT cp, int compat, const BYTE *idx1, UINT scale_idx1,
+ const USHORT *idx2, UINT scale_idx2, const USHORT *offsets,
+ UINT scale_off, const WCHAR *data, UINT scale_data )
+{
+ USHORT a, b, c, d;
- for (my $i = 0; $i < 256; $i++)
+ a = idx1[cp >> scale_idx1];
+ b = idx2[(a << scale_idx2) + ((cp >> scale_idx2) & 0xf)];
+ c = (b << scale_off) + ((cp & 0xf) << scale_data);
+ if (compat) ++c;
+ d = offsets[c];
+
+ return &data[d];
+}
+
+static int decompose_char_recursive( int compat, UINT ch, WCHAR *dst, int dstlen )
+{
+ int total_decomp = 0;
+ int size_decomp;
+ const WCHAR *map;
+
+ if (ch < 0xa0) /* fast path */
{
- next unless ($filled_idx[$i] > 256);
- my @table = @filled[($i<<4)..($i<<4)+15];
- for (my $j = 0; $j < 16; $j++) { $table[$j] ||= $null_offset; }
- printf OUTPUT ",\n /* sub-index %02x */\n", $i;
- printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @table );
+ if (dstlen) *dst = (WCHAR)ch;
+ return 1;
+ }
+ else if (ch > last_decomposable ||
+ !*(map = unicode_table_lookup( ch, compat, idx1_decomp, 8,
+ idx2_decomp, 4, offsets_decomp, 5, data_decomp, 1 )))
+ {
+ if (dstlen) *dst = (WCHAR)ch;
+ return 1;
}
+ else {
+ while (*map)
+ {
+ size_decomp = decompose_char_recursive( compat, *map, dst, dstlen );
+ dstlen -= size_decomp;
+ if (dstlen < 0) dstlen = 0;
+ dst += size_decomp;
+ map++;
+ total_decomp += size_decomp;
+ }
+ return total_decomp;
+ }
+}
- # dump the 16-char subsets
+int wine_unicode_decompose_string( int compat, const WCHAR *src,
+ int srclen, WCHAR *dst, int dstlen )
+{
+ UINT ch;
+ int srcpos = 0, dstpos = 0;
+ int decomp_len;
- printf OUTPUT ",\n /* null mapping */\n";
- printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, (0) x 32 );
+ if (dstlen < 0) dstlen = 0;
- for (my $i = 0; $i < 4096; $i++)
+ while (srcpos < srclen)
{
- next unless $filled[$i];
- my @table = (0) x 32;
- for (my $j = 0; $j < 16; $j++)
+ ch = src[srcpos];
+
+ decomp_len = decompose_char_recursive( compat, ch, dst+dstpos, dstlen );
+ dstpos += decomp_len;
+
+ if (dstlen > 0)
{
- if (defined $decomp_table[($i<<4) + $j])
+ dstlen -= decomp_len;
+ while (dstlen < 0)
{
- $table[2 * $j] = ${$decomp_table[($i << 4) + $j]}[0];
- $table[2 * $j + 1] = ${$decomp_table[($i << 4) + $j]}[1];
+ dstpos--;
+ dstlen++;
}
}
- printf OUTPUT ",\n /* 0x%03x0 .. 0x%03xf */\n", $i, $i;
- printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @table );
+
+ ++srcpos;
}
- printf OUTPUT "\n};\n\n";
- print OUTPUT <<"EOF";
-unsigned int DECLSPEC_HIDDEN wine_decompose( WCHAR ch, WCHAR *dst, unsigned int dstlen )
-{
- const WCHAR *ptr = table + table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + 2 * (ch & 0xf);
- unsigned int res;
-
- *dst = ch;
- if (!*ptr) return 1;
- if (dstlen <= 1) return 0;
- /* apply the decomposition recursively to the first char */
- if ((res = wine_decompose( *ptr, dst, dstlen-1 ))) dst[res++] = ptr[1];
- return res;
+ return dstpos;
}
EOF
close OUTPUT;
--
1.9.1

View File

@ -1,400 +0,0 @@
From 1f362267f8196f6017e4e08a9dd4dca589c494d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergio=20G=C3=B3mez=20Del=20Real?=
<sdelreal@codeweavers.com>
Date: Tue, 27 Mar 2018 07:28:02 -0500
Subject: [PATCH 2/4] tools/make_unicode: Implement canonical composition for
use in normalization.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sergio Gómez Del Real <sdelreal@codeweavers.com>
---
tools/make_unicode | 302 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 301 insertions(+), 1 deletion(-)
diff --git a/tools/make_unicode b/tools/make_unicode
index 2aa063b..4b1c46f 100755
--- a/tools/make_unicode
+++ b/tools/make_unicode
@@ -360,6 +360,8 @@ my @joining_table = ();
my @direction_table = ();
my @decomp_table = ();
my @compose_table = ();
+my @comb_class_table = ();
+my @full_comp_table = ();
my $default_char;
my $default_wchar;
@@ -470,6 +472,11 @@ sub READ_DEFAULTS($)
}
}
+ if ($comb != 0)
+ {
+ $comb_class_table[$src] = (hex $comb);
+ }
+
next if $decomp eq ""; # no decomposition, skip it
# store decomposition table
@@ -562,6 +569,25 @@ sub READ_DEFAULTS($)
my $flag = $ctype{$cat};
foreach my $i (@{$special_categories{$cat}}) { $category_table[$i] |= $flag; }
}
+
+ my $UNICODE_DERIVED = open_data_file( $UNIDATA, "DerivedNormalizationProps.txt" );
+ while (<$UNICODE_DERIVED>)
+ {
+ next unless (/^([0-9a-fA-F.]+)\s+;\s+Full_Composition_Exclusion/);
+ my ($first, $last) = split /\.\./,$1;
+ $first = hex $first;
+ if (defined $last)
+ {
+ $last = hex $last;
+ while ($last gt $first)
+ {
+ $full_comp_table[$last] = 1;
+ $last--;
+ }
+ }
+ $full_comp_table[$first] = 1;
+ }
+ close $UNICODE_DERIVED;
}
@@ -2255,6 +2281,8 @@ sub dump_compose_table($)
}
print OUTPUT "\n};\n\n";
print OUTPUT <<"EOF";
+#include "decompose.c"
+
static inline int binary_search( WCHAR ch, int low, int high )
{
while (low <= high)
@@ -2278,6 +2306,59 @@ WCHAR DECLSPEC_HIDDEN wine_compose( const WCHAR *str )
count = table[2 * pos + 3];
}
}
+
+static inline int is_blocked(WCHAR *ptr1, WCHAR *ptr2)
+{
+ if (ptr1 >= ptr2) return -1;
+
+ while (++ptr1 < ptr2)
+ {
+ const WCHAR *map1, *map2;
+ map1 = unicode_table_lookup( *ptr1, 0, idx1_comb, 8, idx2_comb, 4,
+ offsets_comb, 4, data_comb, 0 );
+ map2 = unicode_table_lookup( *ptr2, 0, idx1_comb, 8, idx2_comb, 4,
+ offsets_comb, 4, data_comb, 0 );
+ if (*map1 == 0 || *map2 <= *map1) return 1;
+ }
+ return 0;
+}
+
+static inline int is_fullexcl(WCHAR ch)
+{
+ const WCHAR *map = unicode_table_lookup( ch, 0, idx1_fullcomp, 8, idx2_fullcomp,
+ 4, offsets_fullcomp, 4, data_fullcomp, 0 );
+ return (int)*map;
+}
+
+int unicode_canonical_composition( WCHAR *str, int strlen )
+{
+ int i, j;
+ WCHAR dum[3] = {0};
+
+ if (strlen == 0) strlen = strlenW( str );
+
+ for (i = 1; i < strlen; i++)
+ {
+ WCHAR *ptr_comp = str+i-1, comp;
+ if (str[i] == 0) break;
+ while (ptr_comp - str > 0)
+ {
+ if (is_starter( *ptr_comp )) break;
+ --ptr_comp;
+ }
+ if (!is_starter( *ptr_comp ) || is_blocked( ptr_comp, str+i )) continue;
+ dum[0] = *ptr_comp;
+ dum[1] = str[i];
+ comp = wine_compose( dum );
+ if (!comp || is_fullexcl( comp )) continue;
+ *ptr_comp = comp;
+ for (j = i; j < strlen-1; j++) str[j] = str[j+1];
+ strlen--;
+ i--;
+ }
+
+ return strlen;
+}
EOF
close OUTPUT;
save_file($filename);
@@ -2346,13 +2427,21 @@ sub dump_decompose_table($)
my %nfd_lookup = ();
my %nfkd_lookup = ();
my %decomp_lookup = ();
+ my %comb_lookup = ();
+ my %fullcomp_lookup = ();
my @decomp_data = (0);
+ my @comb_data = (0);
+ my @full_comp_data = (0);
my $pos = 1;
+ my $pos_comb = 1;
+ my $pos_fullcomp = 1;
my $lastchar_decomp;
+ my $lastchar_comb;
+ my $lastchar_fullcomp;
for (my $i = 0; $i < $utflim; $i++)
{
- next unless defined $decomp_table[$i];
+ next unless defined $decomp_table[$i] || defined $comb_class_table[$i] || defined $full_comp_table[$i];
if (defined $decomp_table[$i])
{
@@ -2406,6 +2495,20 @@ sub dump_decompose_table($)
$pos += @nfkd;
}
}
+ if (defined $comb_class_table[$i])
+ {
+ push @comb_data, $comb_class_table[$i];
+ $lastchar_comb = $i;
+ $comb_lookup{$i} = $pos_comb;
+ $pos_comb++;
+ }
+ if (defined $full_comp_table[$i])
+ {
+ push @full_comp_data, $full_comp_table[$i];
+ $lastchar_fullcomp = $i;
+ $fullcomp_lookup{$i} = $pos_fullcomp;
+ $pos_fullcomp++;
+ }
}
printf OUTPUT "static const UINT last_decomposable = 0x%x;\n\n", $lastchar_decomp;
@@ -2497,6 +2600,154 @@ sub dump_decompose_table($)
}
print OUTPUT "\n};\n\n";
+ # now for Compatibility Class
+
+ printf OUTPUT "static const WCHAR data_comb[%d] =\n", $pos_comb;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @comb_data );
+ print OUTPUT "\n};\n\n";
+
+ my $comb_pos = 1;
+ my $comb_lim = ($lastchar_comb >> 8) + 1;
+ my @comb_filled = (0) x $comb_lim;
+ for (my $i = 0; $i < $utflim; $i++)
+ {
+ last if $i > $lastchar_comb;
+ next unless defined $comb_class_table[$i];
+ $comb_filled[$i >> 8] = $comb_pos++;
+ $i |= 255;
+ }
+ printf OUTPUT "static const BYTE idx1_comb[%d] =\n", $comb_lim;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%02x", 0, @comb_filled );
+ print OUTPUT "\n};\n\n";
+
+ my $sub_comb_filled_pos = 1;
+ my %sub_comb_filled = ();
+ for (my $i = 0; $i < $comb_lim; $i++)
+ {
+ next unless $comb_filled[$i];
+ for (my $j = 0; $j < 256; $j++)
+ {
+ my $idx = ($i << 8) | $j;
+ next unless defined $comb_class_table[$idx];
+ $sub_comb_filled{$idx >> 4} = $sub_comb_filled_pos++;
+ $j |= 15;
+ }
+ }
+
+ printf OUTPUT "static const USHORT idx2_comb[%d] =\n", $comb_pos * 16;
+ print OUTPUT "{\n";
+ @null_idx = (0) x 16;
+ print OUTPUT " /* all-zero 256-char blocks get mapped to here */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_idx );
+ for (my $i = 0; $i < $comb_lim; $i++)
+ {
+ next unless $comb_filled[$i];
+ printf OUTPUT ",\n /* sub-index 0x%02x */\n", $comb_filled[$i];
+
+ my @sub_idx;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($i << 4) | $j;
+ $sub_idx[$j] = $sub_comb_filled{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_idx );
+ }
+ print OUTPUT "\n};\n\n";
+
+ printf OUTPUT "static const USHORT offsets_comb[%d] =\n", 16 * $sub_comb_filled_pos;
+ print OUTPUT "{\n";
+ @null_table = (0) x 16;
+ print OUTPUT " /* all-zero 16-char blocks get mapped to here */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_table );
+ for my $key (sort {$a <=> $b} keys %sub_comb_filled)
+ {
+ printf OUTPUT ",\n /* 0x%03x0 .. 0x%03xf */\n", $key, $key;
+ my @sub_table;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($key << 4) | $j;
+ $sub_table[$j] = $comb_lookup{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_table );
+ }
+ print OUTPUT "\n};\n\n";
+
+ # now for Full Composition Exclusion
+
+ printf OUTPUT "const WCHAR data_fullcomp[%d] =\n", $pos_fullcomp;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @full_comp_data );
+ print OUTPUT "\n};\n\n";
+
+ my $fullcomp_pos = 1;
+ my $fullcomp_lim = ($lastchar_fullcomp >> 8) + 1;
+ my @fullcomp_filled = (0) x $fullcomp_lim;
+ for (my $i = 0; $i < $utflim; $i++)
+ {
+ last if $i > $lastchar_fullcomp;
+ next unless defined $full_comp_table[$i];
+ $fullcomp_filled[$i >> 8] = $fullcomp_pos++;
+ $i |= 255;
+ }
+ printf OUTPUT "const BYTE idx1_fullcomp[%d] =\n", $fullcomp_lim;
+ print OUTPUT "{\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%02x", 0, @fullcomp_filled );
+ print OUTPUT "\n};\n\n";
+
+ my $sub_fullcomp_filled_pos = 1;
+ my %sub_fullcomp_filled = ();
+ for (my $i = 0; $i < $fullcomp_lim; $i++)
+ {
+ next unless $fullcomp_filled[$i];
+ for (my $j = 0; $j < 256; $j++)
+ {
+ my $idx = ($i << 8) | $j;
+ next unless defined $full_comp_table[$idx];
+ $sub_fullcomp_filled{$idx >> 4} = $sub_fullcomp_filled_pos++;
+ $j |= 15;
+ }
+ }
+
+ printf OUTPUT "const USHORT idx2_fullcomp[%d] =\n", $fullcomp_pos * 16;
+ print OUTPUT "{\n";
+ @null_idx = (0) x 16;
+ print OUTPUT " /* all-zero 256-char blocks get mapped to here */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_idx );
+ for (my $i = 0; $i < $fullcomp_lim; $i++)
+ {
+ next unless $fullcomp_filled[$i];
+ printf OUTPUT ",\n /* sub-index 0x%02x */\n", $fullcomp_filled[$i];
+
+ my @sub_idx;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($i << 4) | $j;
+ $sub_idx[$j] = $sub_fullcomp_filled{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_idx );
+ }
+ print OUTPUT "\n};\n\n";
+
+ printf OUTPUT "const USHORT offsets_fullcomp[%d] =\n", 16 * $sub_fullcomp_filled_pos;
+ print OUTPUT "{\n";
+ @null_table = (0) x 16;
+ print OUTPUT " /* all-zero 16-char blocks get mapped to here */\n";
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @null_table );
+ for my $key (sort {$a <=> $b} keys %sub_fullcomp_filled)
+ {
+ printf OUTPUT ",\n /* 0x%03x0 .. 0x%03xf */\n", $key, $key;
+ my @sub_table;
+ for (my $j = 0; $j < 16; $j++)
+ {
+ my $idx = ($key << 4) | $j;
+ $sub_table[$j] = $fullcomp_lookup{$idx} || 0;
+ }
+ printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @sub_table );
+ }
+ print OUTPUT "\n};\n\n";
+
print OUTPUT <<"EOF";
static const WCHAR *unicode_table_lookup( UINT cp, int compat, const BYTE *idx1, UINT scale_idx1,
const USHORT *idx2, UINT scale_idx2, const USHORT *offsets,
@@ -2513,6 +2764,20 @@ static const WCHAR *unicode_table_lookup( UINT cp, int compat, const BYTE *idx1,
return &data[d];
}
+static inline int reorderable_pair( WCHAR ch1, WCHAR ch2 )
+{
+ const WCHAR *cc1, *cc2;
+
+ if (ch1 == 0 || ch2 == 0) return 0;
+
+ cc1 = unicode_table_lookup( ch1, 0, idx1_comb, 8, idx2_comb, 4,
+ offsets_comb, 4, data_comb, 0 );
+ cc2 = unicode_table_lookup( ch2, 0, idx1_comb, 8, idx2_comb, 4,
+ offsets_comb, 4, data_comb, 0 );
+ if (*cc2 < *cc1) return 1;
+ else return 0;
+}
+
static int decompose_char_recursive( int compat, UINT ch, WCHAR *dst, int dstlen )
{
int total_decomp = 0;
@@ -2576,6 +2841,41 @@ int wine_unicode_decompose_string( int compat, const WCHAR *src,
return dstpos;
}
+
+int is_starter( WCHAR ch )
+{
+ const WCHAR *map = unicode_table_lookup( ch, 0, idx1_comb, 8, idx2_comb, 4,
+ offsets_comb, 4, data_comb, 0 );
+ return (*map == 0) ? 1 : 0;
+}
+
+void unicode_canon_order( WCHAR *str, int strlen )
+{
+ int i, j, m;
+ int sublen = 0, tot_sublen = 0;
+ WCHAR *substr = str;
+
+ for (m = 1; m <= strlen; m++)
+ {
+ if (m == strlen || is_starter( str[m] )) sublen = m - tot_sublen;
+ else continue;
+
+ for (i = 0; i < sublen; i++)
+ {
+ for (j = 1; j < sublen; j++)
+ {
+ if (reorderable_pair( substr[j-1], substr[j] ))
+ {
+ WCHAR swp = substr[j-1];
+ substr[j-1] = substr[j];
+ substr[j] = swp;
+ }
+ }
+ }
+ tot_sublen += m;
+ substr = str+m;
+ }
+}
EOF
close OUTPUT;
save_file($filename);
--
1.9.1

View File

@ -1,183 +0,0 @@
From 91113cf4d4b65f961d9209d9508226094acad3ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergio=20G=C3=B3mez=20Del=20Real?=
<sdelreal@codeweavers.com>
Date: Fri, 6 Apr 2018 10:29:39 -0500
Subject: [PATCH 3/4] kernel32: Implement NormalizeString API function.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sergio Gómez Del Real <sdelreal@codeweavers.com>
---
dlls/kernel32/locale.c | 88 +++++++++++++++++++++++++++++++++++++++++---
dlls/kernel32/tests/locale.c | 44 ++++++++++------------
2 files changed, 103 insertions(+), 29 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 4d1eac6..607008f 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -5358,15 +5358,93 @@ INT WINAPI GetUserDefaultLocaleName(LPWSTR localename, int buffersize)
return LCIDToLocaleName(userlcid, localename, buffersize, 0);
}
+static inline int is_valid_norm(NORM_FORM norm)
+{
+ if (norm == NormalizationC || norm == NormalizationD ||
+ norm == NormalizationKC || norm == NormalizationKD)
+ return 1;
+ else
+ return 0;
+}
+
/******************************************************************************
* NormalizeString (KERNEL32.@)
+ *
+ * Normalizes a string according to a Unicode Normalization Form.
+ *
+ * PARAMS
+ * norm [I] Normalization Form
+ * src [I] Source string to normalize
+ * srclen [I] Length of source string (if -1, source string is null-terminated)
+ * dst [O] Buffer to write normalized source string (can be NULL)
+ * dstlen [I] Length of dst string (can be 0)
+ *
+ * RETURNS
+ * Success: If dstlen is 0, return size needed, else return size of normalized string.
+ * Failure: ret <= 0. Use GetLastError to determine error.
*/
-INT WINAPI NormalizeString(NORM_FORM NormForm, LPCWSTR lpSrcString, INT cwSrcLength,
- LPWSTR lpDstString, INT cwDstLength)
+INT WINAPI NormalizeString(NORM_FORM norm, LPCWSTR src, INT srclen,
+ LPWSTR dst, INT dstlen)
{
- FIXME("%x %p %d %p %d\n", NormForm, lpSrcString, cwSrcLength, lpDstString, cwDstLength);
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ extern int wine_unicode_decompose_string( int compat, const WCHAR *src,
+ int srclen, WCHAR *dst, int dstlen );
+ extern int unicode_canonical_composition( WCHAR *str, UINT strlen );
+ extern void unicode_canon_order( WCHAR *str, int strlen );
+
+ WCHAR *decomp = NULL;
+ INT compat = 0;
+ INT needed_len;
+
+ if (src == NULL || !is_valid_norm( norm ))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ if (norm == NormalizationKC || norm == NormalizationKD) compat++;
+
+ if (srclen == -1) srclen = strlenW( src ) + 1;
+
+ needed_len = wine_unicode_decompose_string( compat, src, srclen, NULL, 0 );
+
+ if (needed_len < 0)
+ {
+ SetLastError(ERROR_NO_UNICODE_TRANSLATION);
+ return needed_len;
+ }
+
+ if (norm == NormalizationC || norm == NormalizationKC)
+ {
+ decomp = HeapAlloc( GetProcessHeap(), 0, needed_len * sizeof( WCHAR ) );
+ wine_unicode_decompose_string( compat, src, srclen, decomp, needed_len );
+ unicode_canon_order( decomp, needed_len );
+ needed_len = unicode_canonical_composition( decomp, needed_len );
+ }
+
+ if (dstlen < needed_len && dstlen > 0)
+ {
+ if (decomp) HeapFree(GetProcessHeap(), 0, decomp);
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ return -1;
+ }
+ else if (dstlen <= 0)
+ {
+ if (decomp) HeapFree(GetProcessHeap(), 0, decomp);
+ return needed_len;
+ }
+
+ if (norm == NormalizationC || norm == NormalizationKC)
+ {
+ memcpy( dst, decomp, sizeof(WCHAR) * needed_len );
+ HeapFree(GetProcessHeap(), 0, decomp);
+ return needed_len;
+ }
+ else
+ {
+ int decomp_len = wine_unicode_decompose_string( compat, src, srclen, dst, needed_len );
+ unicode_canon_order( dst, needed_len );
+ return decomp_len;
+ }
}
/******************************************************************************
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index d3eb2ec..50c3f07 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -5656,10 +5656,8 @@ static void test_NormalizeString(void)
return;
}
- todo_wine {
- dstlen = pNormalizeString( NormalizationD, ptest->str, -1, dst, 1 );
- ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Should have failed with ERROR_INSUFFICIENT_BUFFER\n");
- }
+ dstlen = pNormalizeString( NormalizationD, ptest->str, -1, dst, 1 );
+ ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Should have failed with ERROR_INSUFFICIENT_BUFFER");
/*
* For each string, first test passing -1 as srclen to NormalizeString,
@@ -5673,26 +5671,24 @@ static void test_NormalizeString(void)
for (i = 0; i < 4; i++)
{
- todo_wine {
- dstlen = pNormalizeString( norm_forms[i], ptest->str, -1, NULL, 0 );
- if (dstlen)
- {
- dstlen = pNormalizeString( norm_forms[i], ptest->str, -1, dst, dstlen );
- ok(dstlen == strlenW( ptest->expected[i] )+1, "Copied length differed: was %d, should be %d\n",
- dstlen, strlenW( ptest->expected[i] )+1);
- str_cmp = strncmpW( ptest->expected[i], dst, dstlen+1 );
- ok( str_cmp == 0, "test failed: returned value was %d\n", str_cmp );
- }
-
- dstlen = pNormalizeString( norm_forms[i], ptest->str, strlenW(ptest->str), NULL, 0 );
- if (dstlen)
- {
- dstlen = pNormalizeString( norm_forms[i], ptest->str, strlenW(ptest->str), dst, dstlen );
- ok(dstlen == strlenW( ptest->expected[i] ), "Copied length differed: was %d, should be %d\n",
- dstlen, strlenW( ptest->expected[i] ));
- str_cmp = strncmpW( ptest->expected[i], dst, dstlen );
- ok( str_cmp == 0, "test failed: returned value was %d\n", str_cmp );
- }
+ dstlen = pNormalizeString( norm_forms[i], ptest->str, -1, NULL, 0 );
+ if (dstlen)
+ {
+ dstlen = pNormalizeString( norm_forms[i], ptest->str, -1, dst, dstlen );
+ ok(dstlen == strlenW( ptest->expected[i] )+1, "Copied length differed: was %d, should be %d\n",
+ dstlen, strlenW( ptest->expected[i] )+1);
+ str_cmp = strncmpW( ptest->expected[i], dst, dstlen+1 );
+ ok( str_cmp == 0, "test failed: returned value was %d\n", str_cmp );
+ }
+
+ dstlen = pNormalizeString( norm_forms[i], ptest->str, strlenW(ptest->str), NULL, 0 );
+ if (dstlen)
+ {
+ dstlen = pNormalizeString( norm_forms[i], ptest->str, strlenW(ptest->str), dst, dstlen );
+ ok(dstlen == strlenW( ptest->expected[i] ), "Copied length differed: was %d, should be %d\n",
+ dstlen, strlenW( ptest->expected[i] ));
+ str_cmp = strncmpW( ptest->expected[i], dst, dstlen );
+ ok( str_cmp == 0, "test failed: returned value was %d\n", str_cmp );
}
}
ptest++;
--
1.9.1

View File

@ -1,2 +0,0 @@
Fixes: [42734] Implement NormalizeString
Disabled: true

View File

@ -1,3 +1,2 @@
Fixes: [10767] Fix comparison of punctuation characters in lstrcmp
Fixes: [32490] Graphical issues in Inquisitor
#Depends: kernel32-NormalizeString

View File

@ -1,229 +0,0 @@
From 79f6535315f6c60b302025b53ca6a66dd4f36603 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 18 Jul 2015 04:52:55 +0200
Subject: [PATCH] ntdll: Check architecture before loading module.
---
dlls/ntdll/loader.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 154 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1a3dd80..c7b3761 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2198,6 +2198,131 @@ done:
return status;
}
+#if defined(__i386__)
+#define CURRENT_ARCH IMAGE_FILE_MACHINE_I386
+#elif defined(__x86_64__)
+#define CURRENT_ARCH IMAGE_FILE_MACHINE_AMD64
+#elif defined(__arm__)
+#define CURRENT_ARCH IMAGE_FILE_MACHINE_ARM
+#elif defined(__aarch64__)
+#define CURRENT_ARCH IMAGE_FILE_MACHINE_ARM64
+#endif
+
+/***********************************************************************
+ * get_machine_type (internal)
+ *
+ * Determines the machine type of a module. Based on the code in
+ * dlls/kernel32/module.c.
+ */
+static WORD get_machine_type( HANDLE hfile )
+{
+ union
+ {
+ struct
+ {
+ unsigned char magic[4];
+ unsigned char class;
+ unsigned char data;
+ unsigned char version;
+ unsigned char ignored[9];
+ unsigned short type;
+ unsigned short machine;
+ } elf;
+ struct
+ {
+ unsigned int magic;
+ unsigned int cputype;
+ unsigned int cpusubtype;
+ unsigned int filetype;
+ } macho;
+ IMAGE_DOS_HEADER mz;
+ } header;
+
+ IO_STATUS_BLOCK io;
+ LARGE_INTEGER offset;
+
+ /* Seek to the start of the file and read the header information. */
+ offset.QuadPart = 0;
+ if (NtReadFile( hfile, 0, NULL, 0, &io, &header, sizeof(header), &offset, NULL )) return 0;
+ if (io.Information < sizeof(header)) return 0;
+
+ if (!memcmp( header.elf.magic, "\177ELF", 4 ))
+ {
+#ifdef WORDS_BIGENDIAN
+ if (header.elf.data == 1)
+#else
+ if (header.elf.data == 2)
+#endif
+ {
+ header.elf.machine = RtlUshortByteSwap( header.elf.machine );
+ }
+
+ switch(header.elf.machine)
+ {
+ case 3: return IMAGE_FILE_MACHINE_I386;
+ case 20: return IMAGE_FILE_MACHINE_POWERPC;
+ case 40: return IMAGE_FILE_MACHINE_ARMNT;
+ case 50: return IMAGE_FILE_MACHINE_IA64;
+ case 62: return IMAGE_FILE_MACHINE_AMD64;
+ case 183: return IMAGE_FILE_MACHINE_ARM64;
+ default: return 0;
+ }
+ }
+ /* Mach-o File with Endian set to Big Endian or Little Endian */
+ else if (header.macho.magic == 0xfeedface || header.macho.magic == 0xcefaedfe ||
+ header.macho.magic == 0xfeedfacf || header.macho.magic == 0xcffaedfe)
+ {
+ if (header.macho.magic == 0xcefaedfe || header.macho.magic == 0xcffaedfe)
+ header.macho.cputype = RtlUlongByteSwap( header.macho.cputype );
+
+ switch(header.macho.cputype)
+ {
+ case 0x00000007: return IMAGE_FILE_MACHINE_I386;
+ case 0x01000007: return IMAGE_FILE_MACHINE_AMD64;
+ case 0x0000000c: return IMAGE_FILE_MACHINE_ARMNT;
+ case 0x0100000c: return IMAGE_FILE_MACHINE_ARM64;
+ case 0x00000012: return IMAGE_FILE_MACHINE_POWERPC;
+ default: return 0;
+ }
+ }
+ /* Not ELF, try DOS */
+ else if (header.mz.e_magic == IMAGE_DOS_SIGNATURE)
+ {
+ IMAGE_NT_HEADERS32 ext_header;
+
+ offset.QuadPart = header.mz.e_lfanew;
+ if (NtReadFile( hfile, 0, NULL, 0, &io, &ext_header, sizeof(ext_header), &offset, NULL )) return 0;
+ if (io.Information < sizeof(ext_header)) return 0;
+
+ if (!memcmp( &ext_header.Signature, "PE\0\0", 4 ))
+ return ext_header.FileHeader.Machine;
+ }
+
+ return 0;
+}
+
+static BOOL is_resource_dll( HANDLE hfile )
+{
+ SECTION_IMAGE_INFORMATION info;
+ SIZE_T ret;
+ HANDLE mapping;
+ LARGE_INTEGER size;
+ NTSTATUS status;
+
+ size.QuadPart = 0;
+ status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY |
+ SECTION_MAP_READ | SECTION_MAP_EXECUTE,
+ NULL, &size, PAGE_EXECUTE_READ, SEC_IMAGE, hfile );
+
+ status = NtQuerySection(mapping, SectionImageInformation, &info, sizeof(info), &ret);
+ NtClose( mapping );
+ if(status == STATUS_SUCCESS)
+ {
+ return !info.ImageContainsCode;
+ }
+
+ return FALSE;
+}
/***********************************************************************
* open_dll_file
@@ -2244,7 +2369,7 @@ static HANDLE open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm, struct
*/
static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
WCHAR *filename, ULONG *size, WINE_MODREF **pwm,
- HANDLE *handle, struct stat *st )
+ HANDLE *handle, struct stat *st, BOOL check_arch )
{
UNICODE_STRING nt_name;
WCHAR *file_part, *ext, *dllname;
@@ -2289,20 +2414,41 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH)
{
- /* we need to search for it */
- len = RtlDosSearchPath_U( load_path, libname, NULL, *size, filename, &file_part );
- if (len)
+ while (load_path)
{
+ /* we need to search for it */
+ len = RtlDosSearchPath_U( load_path, libname, NULL, *size, filename, &file_part );
+ if (!len) break;
+
if (len >= *size) goto overflow;
if ((*pwm = find_fullname_module( filename ))) goto found;
+ if (!handle) goto next;
if (!RtlDosPathNameToNtPathName_U( filename, &nt_name, NULL, NULL ))
{
RtlFreeHeap( GetProcessHeap(), 0, dllname );
return STATUS_NO_MEMORY;
}
+
*handle = open_dll_file( &nt_name, pwm, st );
- goto found;
+
+ #ifdef CURRENT_ARCH
+ if (*handle && check_arch && !is_resource_dll( *handle ))
+ {
+ WORD machine_type = get_machine_type( *handle );
+ if (machine_type && machine_type != CURRENT_ARCH)
+ {
+ FIXME( "skipping %s because of wrong architecture\n", debugstr_w(filename) );
+ NtClose( *handle );
+ *handle = 0;
+ }
+ }
+ #endif
+ if (*handle) goto found;
+
+ next:
+ load_path = strchrW(load_path, ';');
+ if (load_path) load_path++;
}
/* not found */
@@ -2352,6 +2498,7 @@ overflow:
*/
static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_MODREF** pwm )
{
+ BOOL data = flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
enum loadorder loadorder;
WCHAR buffer[64];
WCHAR *filename;
@@ -2368,7 +2515,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
size = sizeof(buffer);
for (;;)
{
- nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle, &st );
+ nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle, &st, !data );
if (nts == STATUS_SUCCESS) break;
if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename );
if (nts != STATUS_BUFFER_TOO_SMALL) return nts;
@@ -2507,7 +2654,7 @@ NTSTATUS WINAPI LdrGetDllHandle( LPCWSTR load_path, ULONG flags, const UNICODE_S
size = sizeof(buffer);
for (;;)
{
- status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, &handle, &st );
+ status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, &handle, &st, TRUE );
if (handle) NtClose( handle );
if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename );
if (status != STATUS_BUFFER_TOO_SMALL) break;
--
1.9.1

View File

@ -1,2 +0,0 @@
Fixes: [38021] Check architecture before trying to load libraries
Disabled: true

View File

@ -1,19 +1,19 @@
From 3868624c41bc318ee89c5c5183d3ca9ef483f6ba Mon Sep 17 00:00:00 2001
From 507f3b20311ceae6a42bde2937d82031594d0b32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Mar 2017 16:27:23 +0100
Subject: ntdll: Fill process kernel and user time.
Subject: [PATCH] ntdll: Fill process kernel and user time.
---
dlls/ntdll/nt.c | 6 +++-
dlls/ntdll/nt.c | 6 ++-
dlls/ntdll/ntdll_misc.h | 3 ++
dlls/ntdll/thread.c | 84 ++++++++++++++++++++++++++++---------------------
dlls/ntdll/thread.c | 84 +++++++++++++++++++++++------------------
3 files changed, 56 insertions(+), 37 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index fbd0fdf51a9..cac95325541 100644
index fcc5c635a68..2b5cf5d0ae3 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1927,6 +1927,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2452,6 +2452,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
SYSTEM_PROCESS_INFORMATION* spi = SystemInformation;
SYSTEM_PROCESS_INFORMATION* last = NULL;
@ -21,7 +21,7 @@ index fbd0fdf51a9..cac95325541 100644
HANDLE hSnap = 0;
WCHAR procname[1024];
WCHAR* exename;
@@ -1964,7 +1965,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2489,7 +2490,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
if (Length >= len + procstructlen)
{
@ -30,7 +30,7 @@ index fbd0fdf51a9..cac95325541 100644
* vmCounters, ioCounters
*/
@@ -1982,6 +1983,9 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2507,6 +2508,9 @@ NTSTATUS WINAPI NtQuerySystemInformation(
/* spi->ti will be set later on */
@ -41,10 +41,10 @@ index fbd0fdf51a9..cac95325541 100644
len += procstructlen;
}
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index c97b1e1f73f..260e7030dae 100644
index 6b71ded85b1..4a411292cdc 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -245,4 +245,7 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
@@ -258,4 +258,7 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
@ -53,12 +53,12 @@ index c97b1e1f73f..260e7030dae 100644
+ LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN;
#endif
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 00d03f103ce..1c6cab3aa28 100644
index fe99a804c15..fea1244620c 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -80,6 +80,53 @@ static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
};
static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
@@ -151,6 +151,53 @@ static ULONG_PTR get_image_addr(void)
}
#endif
+
+BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
@ -108,9 +108,9 @@ index 00d03f103ce..1c6cab3aa28 100644
+
+
/***********************************************************************
* get_unicode_string
* thread_init
*
@@ -989,42 +1036,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
@@ -929,42 +976,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
#ifdef __linux__
/* only /proc provides exact values for a specific thread */
if (unix_pid != -1 && unix_tid != -1)
@ -155,5 +155,5 @@ index 00d03f103ce..1c6cab3aa28 100644
/* get values for current process instead */
--
2.14.1
2.20.1

View File

@ -1,7 +1,7 @@
From 92de09926e79c3d91819e946519c19c2138eeeb1 Mon Sep 17 00:00:00 2001
From e72a63216155c21784be784940782e995022a319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Mar 2017 22:56:45 +0100
Subject: ntdll: Fill process virtual memory counters in
Subject: [PATCH] ntdll: Fill process virtual memory counters in
NtQuerySystemInformation.
FIXME: fill_VM_COUNTERS now uses a different method ... which one is better?
@ -13,10 +13,10 @@ FIXME: fill_VM_COUNTERS now uses a different method ... which one is better?
4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 8b84cd865b..86d13b88f1 100644
index 86695f7d23e..7736adca5b1 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1981,8 +1981,11 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2511,8 +2511,11 @@ NTSTATUS WINAPI NtQuerySystemInformation(
/* spi->ti will be set later on */
if (reply->unix_pid != -1)
@ -29,20 +29,20 @@ index 8b84cd865b..86d13b88f1 100644
}
len += procstructlen;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 443c86000d..6549a71fc0 100644
index 4a411292cdc..467d66373dd 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -269,4 +269,5 @@ NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
@@ -261,4 +261,5 @@ NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
/* process / thread time */
extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN;
+extern BOOL read_process_memory_stats(int unix_pid, VM_COUNTERS *pvmi) DECLSPEC_HIDDEN;
#endif
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 952225688c..691848fcd9 100644
index bb4a1719c3c..709daf19faf 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -163,7 +163,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
@@ -203,7 +203,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
{
@ -52,10 +52,10 @@ index 952225688c..691848fcd9 100644
#endif
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 29b6513f38..6a56ebafd9 100644
index fea1244620c..e56c02faec6 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -117,6 +117,42 @@ BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
@@ -197,6 +197,42 @@ BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
return FALSE;
}
@ -97,7 +97,7 @@ index 29b6513f38..6a56ebafd9 100644
+}
/***********************************************************************
* get_unicode_string
* thread_init
--
2.11.0
2.20.1

View File

@ -1,4 +1,4 @@
From 49c61feeae4cc2c5a0a4c6a6e0aa8bd5b6ef3f46 Mon Sep 17 00:00:00 2001
From 33502f50d05cbb558a0589af8c08125ed7a988dc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 26 Nov 2014 10:46:09 +0100
Subject: [PATCH] ntdll: Move code to update user shared data into a separate
@ -6,14 +6,14 @@ Subject: [PATCH] ntdll: Move code to update user shared data into a separate
---
dlls/ntdll/ntdll.spec | 3 +++
dlls/ntdll/thread.c | 32 ++++++++++++++++++++++----------
2 files changed, 25 insertions(+), 10 deletions(-)
dlls/ntdll/thread.c | 24 ++++++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 5e7c463..a339562 100644
index 008abb744a0..87a6c70081b 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1509,3 +1509,6 @@
@@ -1526,3 +1526,6 @@
# Filesystem
@ cdecl wine_nt_to_unix_file_name(ptr ptr long long)
@ cdecl wine_unix_to_nt_file_name(ptr ptr)
@ -21,13 +21,30 @@ index 5e7c463..a339562 100644
+# User shared data
+@ cdecl __wine_user_shared_data()
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index f1fff59..45bfb14 100644
index 6718f38c7e1..974519cca48 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -350,6 +350,26 @@ static ULONG_PTR get_image_addr(void)
}
#endif
@@ -248,7 +248,6 @@ void thread_init(void)
void *addr;
BOOL suspend;
SIZE_T size, info_size;
- LARGE_INTEGER now;
NTSTATUS status;
struct ntdll_thread_data *thread_data;
static struct debug_info debug_info; /* debug info for initial thread */
@@ -361,7 +360,23 @@ void thread_init(void)
wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params.hStdError );
}
- /* initialize time values in user_shared_data */
+ /* initialize user_shared_data */
+ __wine_user_shared_data();
+ fill_cpu_info();
+
+ NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
+}
+
+
+
+/**************************************************************************
+ * __wine_user_shared_data (NTDLL.@)
@ -37,46 +54,21 @@ index f1fff59..45bfb14 100644
+BYTE* CDECL __wine_user_shared_data(void)
+{
+ LARGE_INTEGER now;
+ NtQuerySystemTime( &now );
+ user_shared_data->SystemTime.LowPart = now.u.LowPart;
+ user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart;
+ user_shared_data->u.TickCountQuad = (now.QuadPart - server_start_time) / 10000;
+ user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
+ user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
+ user_shared_data->TickCountMultiplier = 1 << 24;
+ return (BYTE *)user_shared_data;
+}
+
+
/***********************************************************************
* thread_init
*
@@ -363,7 +383,6 @@ void thread_init(void)
void *addr;
BOOL suspend;
SIZE_T size, info_size;
- LARGE_INTEGER now;
NTSTATUS status;
struct ntdll_thread_data *thread_data;
static struct debug_info debug_info; /* debug info for initial thread */
@@ -475,15 +494,8 @@ void thread_init(void)
wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params.hStdError );
}
- /* initialize time values in user_shared_data */
- NtQuerySystemTime( &now );
- user_shared_data->SystemTime.LowPart = now.u.LowPart;
- user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart;
- user_shared_data->u.TickCountQuad = (now.QuadPart - server_start_time) / 10000;
- user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
- user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
- user_shared_data->TickCountMultiplier = 1 << 24;
NtQuerySystemTime( &now );
user_shared_data->SystemTime.LowPart = now.u.LowPart;
user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.u.HighPart;
@@ -369,10 +384,7 @@ void thread_init(void)
user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
user_shared_data->TickCountMultiplier = 1 << 24;
-
+ /* initialize user_shared_data */
+ __wine_user_shared_data();
fill_cpu_info();
- fill_cpu_info();
-
- NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
+ return (BYTE *)user_shared_data;
}
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
--
2.7.4
2.20.1

View File

@ -1,4 +1,4 @@
From 84aadc0cb7a6929906fc2d4a4d1591ef9e6b10ac Mon Sep 17 00:00:00 2001
From 986dd43219c45f75fe172cd2a17197fc373641f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 5 May 2017 05:40:50 +0200
Subject: [PATCH] ntdll: Create thread to update user_shared_data time values
@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Create thread to update user_shared_data time values
4 files changed, 114 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index ace3676f..003ef60e 100644
index 1e609a08610..70976855e12 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3465,6 +3465,36 @@ static void load_global_options(void)
@@ -3493,6 +3493,36 @@ static void load_global_options(void)
}
@ -52,7 +52,7 @@ index ace3676f..003ef60e 100644
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
@@ -3493,6 +3523,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
@@ -3522,6 +3552,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
if (!peb->ProcessParameters->WindowTitle.Buffer)
peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName;
version_init( wm->ldr.FullDllName.Buffer );
@ -61,10 +61,10 @@ index ace3676f..003ef60e 100644
virtual_set_large_address_space();
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index f7f7e8ec..910d1031 100644
index ec2e74a891b..1e2f2fdeb6e 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -190,6 +190,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
@@ -194,6 +194,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
@ -75,7 +75,7 @@ index f7f7e8ec..910d1031 100644
/* completion */
extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 0b405818..243175f9 100644
index 974519cca48..63778f6b840 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -44,6 +44,7 @@
@ -97,7 +97,16 @@ index 0b405818..243175f9 100644
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
@@ -357,18 +360,71 @@ static ULONG_PTR get_image_addr(void)
@@ -265,7 +268,7 @@ void thread_init(void)
MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
exit(1);
}
- user_shared_data = addr;
+ user_shared_data_external = addr;
memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) );
/* allocate and initialize the PEB */
@@ -376,18 +379,71 @@ void thread_init(void)
*/
BYTE* CDECL __wine_user_shared_data(void)
{
@ -172,22 +181,13 @@ index 0b405818..243175f9 100644
+
+
/***********************************************************************
* thread_init
*
@@ -399,7 +455,7 @@ void thread_init(void)
MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
exit(1);
}
- user_shared_data = addr;
+ user_shared_data_external = addr;
memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) );
/* allocate and initialize the PEB */
* free_thread_data
*/
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 030c6588..24b42f91 100644
index da40aabb6c7..de63460e741 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2009,6 +2009,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2013,6 +2013,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
{
NTSTATUS ret = STATUS_ACCESS_VIOLATION;
void *page = ROUND_ADDR( addr, page_mask );
@ -195,7 +195,7 @@ index 030c6588..24b42f91 100644
sigset_t sigset;
BYTE vprot;
@@ -2034,7 +2035,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2038,7 +2039,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
ret = STATUS_SUCCESS;
}
}

View File

@ -1,286 +0,0 @@
From a2db3d4e01b9194ae0f79ebb416134a7c8d6bb42 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 24 Jul 2018 11:26:39 -0600
Subject: [PATCH] ntdll: Add a futex-based condition variable implementation.
With significant contributions from Andrew Wesie.
---
dlls/ntdll/sync.c | 213 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 185 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index a00a159d24..cef0035850 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -26,6 +26,7 @@
#include <assert.h>
#include <errno.h>
+#include <limits.h>
#include <signal.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
@@ -36,6 +37,9 @@
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
+#ifdef HAVE_SYS_SYSCALL_H
+# include <sys/syscall.h>
+#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -61,7 +65,140 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
HANDLE keyed_event = NULL;
+
static const LARGE_INTEGER zero_timeout;
+#define TICKSPERSEC 10000000
+
+#ifdef __linux__
+
+static int wait_op = 128; /*FUTEX_WAIT|FUTEX_PRIVATE_FLAG*/
+static int wake_op = 129; /*FUTEX_WAKE|FUTEX_PRIVATE_FLAG*/
+
+static inline int futex_wait( int *addr, int val, struct timespec *timeout )
+{
+ return syscall( __NR_futex, addr, wait_op, val, timeout, 0, 0 );
+}
+
+static inline int futex_wake( int *addr, int val )
+{
+ return syscall( __NR_futex, addr, wake_op, val, NULL, 0, 0 );
+}
+
+static inline int use_futexes(void)
+{
+ static int supported = -1;
+
+ if (supported == -1)
+ {
+ futex_wait( &supported, 10, NULL );
+ if (errno == ENOSYS)
+ {
+ wait_op = 0; /*FUTEX_WAIT*/
+ wake_op = 1; /*FUTEX_WAKE*/
+ futex_wait( &supported, 10, NULL );
+ }
+ supported = (errno != ENOSYS);
+ }
+ return supported;
+}
+
+static inline NTSTATUS fast_wait( RTL_CONDITION_VARIABLE *variable, int val,
+ const LARGE_INTEGER *timeout)
+{
+ struct timespec timespec;
+ LONGLONG timeleft;
+ LARGE_INTEGER now;
+ int ret;
+
+ if (!use_futexes()) return STATUS_NOT_IMPLEMENTED;
+
+ if (timeout && timeout->QuadPart != TIMEOUT_INFINITE)
+ {
+ if (timeout->QuadPart >= 0)
+ {
+ NtQuerySystemTime( &now );
+ timeleft = timeout->QuadPart - now.QuadPart;
+ if (timeleft < 0) timeleft = 0;
+ }
+ else
+ timeleft = -timeout->QuadPart;
+
+ timespec.tv_sec = timeleft / TICKSPERSEC;
+ timespec.tv_nsec = (timeleft % TICKSPERSEC) * 100;
+
+ ret = futex_wait( (int *)&variable->Ptr, val, &timespec );
+ }
+ else
+ ret = futex_wait( (int *)&variable->Ptr, val, NULL );
+
+ if (ret == -1 && errno == ETIMEDOUT) return STATUS_TIMEOUT;
+ return STATUS_WAIT_0;
+}
+
+static inline NTSTATUS fast_sleep_cs( RTL_CONDITION_VARIABLE *variable,
+ RTL_CRITICAL_SECTION *crit, const LARGE_INTEGER *timeout )
+{
+ int val = *(int *)&variable->Ptr;
+ NTSTATUS ret;
+
+ RtlLeaveCriticalSection( crit );
+
+ ret = fast_wait( variable, val, timeout );
+
+ RtlEnterCriticalSection( crit );
+
+ return ret;
+}
+
+static inline NTSTATUS fast_sleep_srw( RTL_CONDITION_VARIABLE *variable,
+ RTL_SRWLOCK *lock, const LARGE_INTEGER *timeout, ULONG flags )
+{
+ int val = *(int *)&variable->Ptr;
+ NTSTATUS ret;
+
+ if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
+ RtlReleaseSRWLockShared( lock );
+ else
+ RtlReleaseSRWLockExclusive( lock );
+
+ ret = fast_wait( variable, val, timeout );
+
+ if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
+ RtlAcquireSRWLockShared( lock );
+ else
+ RtlAcquireSRWLockExclusive( lock );
+
+ return ret;
+}
+
+static inline NTSTATUS fast_wake( RTL_CONDITION_VARIABLE *variable, int val )
+{
+ if (!use_futexes()) return STATUS_NOT_IMPLEMENTED;
+
+ interlocked_xchg_add( (int *)&variable->Ptr, 1 );
+ futex_wake( (int *)&variable->Ptr, val );
+ return STATUS_SUCCESS;
+}
+
+#else
+static inline NTSTATUS fast_sleep_cs( RTL_CONDITION_VARIABLE *variable,
+ RTL_CRITICAL_SECTION *crit, const LARGE_INTEGER *timeout )
+{
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static inline NTSTATUS fast_sleep_srw( RTL_CONDITION_VARIABLE *variable,
+ RTL_SRWLOCK *lock, const LARGE_INTEGER *timeout, ULONG flags )
+{
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static inline NTSTATUS fast_wake( RTL_CONDITION_VARIABLE *variable, int val )
+{
+ return STATUS_NOT_IMPLEMENTED;
+}
+#endif
+
static inline int interlocked_dec_if_nonzero( int *dest )
{
@@ -1867,8 +2004,11 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable )
*/
void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
{
- if (interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
- NtReleaseKeyedEvent( 0, &variable->Ptr, FALSE, NULL );
+ if (fast_wake( variable, 1 ) == STATUS_NOT_IMPLEMENTED)
+ {
+ if (interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
+ NtReleaseKeyedEvent( keyed_event, &variable->Ptr, FALSE, NULL );
+ }
}
/***********************************************************************
@@ -1878,9 +2018,12 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
*/
void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
{
- int val = interlocked_xchg( (int *)&variable->Ptr, 0 );
- while (val-- > 0)
- NtReleaseKeyedEvent( 0, &variable->Ptr, FALSE, NULL );
+ if (fast_wake( variable, INT_MAX ) == STATUS_NOT_IMPLEMENTED)
+ {
+ int val = interlocked_xchg( (int *)&variable->Ptr, 0 );
+ while (val-- > 0)
+ NtReleaseKeyedEvent( keyed_event, &variable->Ptr, FALSE, NULL );
+ }
}
/***********************************************************************
@@ -1902,17 +2045,24 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R
const LARGE_INTEGER *timeout )
{
NTSTATUS status;
- interlocked_xchg_add( (int *)&variable->Ptr, 1 );
- RtlLeaveCriticalSection( crit );
- status = NtWaitForKeyedEvent( 0, &variable->Ptr, FALSE, timeout );
- if (status != STATUS_SUCCESS)
+ if ((status = fast_sleep_cs( variable, crit, timeout )) == STATUS_NOT_IMPLEMENTED)
{
- if (!interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
- status = NtWaitForKeyedEvent( 0, &variable->Ptr, FALSE, NULL );
- }
+ interlocked_xchg_add( (int *)&variable->Ptr, 1 );
+ RtlLeaveCriticalSection( crit );
- RtlEnterCriticalSection( crit );
+ status = NtWaitForKeyedEvent( keyed_event, &variable->Ptr, FALSE, timeout );
+ if (status != STATUS_SUCCESS)
+ {
+ if (!interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
+ status = NtWaitForKeyedEvent( keyed_event, &variable->Ptr, FALSE, NULL );
+ }
+
+ else if (status != STATUS_SUCCESS)
+ interlocked_dec_if_nonzero( (int *)&variable->Ptr );
+
+ RtlEnterCriticalSection( crit );
+ }
return status;
}
@@ -1939,24 +2089,31 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
const LARGE_INTEGER *timeout, ULONG flags )
{
NTSTATUS status;
- interlocked_xchg_add( (int *)&variable->Ptr, 1 );
-
- if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
- RtlReleaseSRWLockShared( lock );
- else
- RtlReleaseSRWLockExclusive( lock );
- status = NtWaitForKeyedEvent( 0, &variable->Ptr, FALSE, timeout );
- if (status != STATUS_SUCCESS)
+ if ((status = fast_sleep_srw( variable, lock, timeout, flags )) == STATUS_NOT_IMPLEMENTED)
{
- if (!interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
- status = NtWaitForKeyedEvent( 0, &variable->Ptr, FALSE, NULL );
- }
+ interlocked_xchg_add( (int *)&variable->Ptr, 1 );
- if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
- RtlAcquireSRWLockShared( lock );
- else
- RtlAcquireSRWLockExclusive( lock );
+ if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
+ RtlReleaseSRWLockShared( lock );
+ else
+ RtlReleaseSRWLockExclusive( lock );
+
+ status = NtWaitForKeyedEvent( keyed_event, &variable->Ptr, FALSE, timeout );
+ if (status != STATUS_SUCCESS)
+ {
+ if (!interlocked_dec_if_nonzero( (int *)&variable->Ptr ))
+ status = NtWaitForKeyedEvent( keyed_event, &variable->Ptr, FALSE, NULL );
+ }
+
+ else if (status != STATUS_SUCCESS)
+ interlocked_dec_if_nonzero( (int *)&variable->Ptr );
+
+ if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
+ RtlAcquireSRWLockShared( lock );
+ else
+ RtlAcquireSRWLockExclusive( lock );
+ }
return status;
}
--
2.19.1

View File

@ -1,2 +0,0 @@
Fixes: [45524] Add a futex-based implementation of condition variables
Disabled: true

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "d0727decdedb5aba250038458e0a28dec5687e50"
echo "9781b5433cd4b708c0f537aa0b5608ff4157f04c"
}
# Show version information

View File

@ -1,4 +1,4 @@
From c101440f7e4066a3727b46a0b4b08bacef0e8bc2 Mon Sep 17 00:00:00 2001
From 41b39da1e8fe850985da5f90bee3df26742bf2fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 7 Sep 2017 00:38:09 +0200
Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit.
@ -6,17 +6,17 @@ Subject: [PATCH] tools/winebuild: Add syscall thunks for 64 bit.
---
dlls/kernel32/tests/loader.c | 7 +-
dlls/ntdll/signal_x86_64.c | 3 +
dlls/ntdll/thread.c | 7 +-
dlls/ntdll/thread.c | 6 +
libs/wine/loader.c | 4 +
tools/winebuild/parser.c | 2 +-
tools/winebuild/spec32.c | 209 +++++++++++++++++++++++++++++++++++++++++--
6 files changed, 223 insertions(+), 9 deletions(-)
tools/winebuild/spec32.c | 209 ++++++++++++++++++++++++++++++++++-
6 files changed, 223 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 26214c4..8c3521c 100644
index 3908fc75a0a..5154db69dcc 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1415,7 +1415,7 @@ static void test_filenames(void)
@@ -1563,7 +1563,7 @@ static void test_filenames(void)
static void test_FakeDLL(void)
{
@ -25,7 +25,7 @@ index 26214c4..8c3521c 100644
NTSTATUS (WINAPI *pNtSetEvent)(HANDLE, ULONG *) = NULL;
IMAGE_EXPORT_DIRECTORY *dir;
HMODULE module = GetModuleHandleA("ntdll.dll");
@@ -1457,8 +1457,13 @@ static void test_FakeDLL(void)
@@ -1605,8 +1605,13 @@ static void test_FakeDLL(void)
dll_func = (BYTE *)GetProcAddress(module, func_name);
ok(dll_func != NULL, "%s: GetProcAddress returned NULL\n", func_name);
@ -40,7 +40,7 @@ index 26214c4..8c3521c 100644
todo_wine ok(0, "%s: Export is a stub-function, skipping\n", func_name);
continue;
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 9f0fbc2..ef89180 100644
index ea55388f4b2..a5d4364dfa5 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -328,6 +328,8 @@ static inline struct amd64_thread_data *amd64_thread_data(void)
@ -52,7 +52,7 @@ index 9f0fbc2..ef89180 100644
/***********************************************************************
* Dynamic unwind table
*/
@@ -3278,6 +3280,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
@@ -3281,6 +3283,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
{
(*teb)->Tib.Self = &(*teb)->Tib;
(*teb)->Tib.ExceptionList = (void *)~0UL;
@ -61,7 +61,7 @@ index 9f0fbc2..ef89180 100644
return status;
}
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index abea82b..17252d4 100644
index 56c68e5e891..85c4cf52721 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -60,6 +60,8 @@ struct _KUSER_SHARED_DATA *user_shared_data_external;
@ -73,15 +73,7 @@ index abea82b..17252d4 100644
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
/* info passed to a starting thread */
@@ -89,7 +91,6 @@ static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
};
static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
-
BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
LARGE_INTEGER *kernel, LARGE_INTEGER *user)
{
@@ -496,6 +497,10 @@ void thread_init(void)
@@ -494,6 +496,10 @@ void thread_init(void)
InitializeListHead( &ldr.InInitializationOrderModuleList );
*(ULONG_PTR *)peb->Reserved = get_image_addr();
@ -93,7 +85,7 @@ index abea82b..17252d4 100644
* Starting with Vista, the first user to log on has session id 1.
* Session id 0 is for processes that don't interact with the user (like services).
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 162c94d..87eb5a8 100644
index 162c94d2921..87eb5a85ad4 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -468,7 +468,11 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
@ -109,7 +101,7 @@ index 162c94d..87eb5a8 100644
sec++;
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index c4b9abf..064019c 100644
index c4b9abfc9fc..064019c4404 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -521,7 +521,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp )
@ -122,7 +114,7 @@ index c4b9abf..064019c 100644
if (odp->flags & (FLAG_FORWARD | FLAG_REGISTER))
return 0;
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index d2fd6a6..403aad5 100644
index d2fd6a6bfa7..403aad5560d 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -342,11 +342,11 @@ static void output_relay_debug( DLLSPEC *spec )
@ -139,10 +131,11 @@ index d2fd6a6..403aad5 100644
{
const unsigned int page_size = get_page_size();
int i;
@@ -445,6 +445,90 @@ static void output_syscall_thunks( DLLSPEC *spec )
@@ -444,6 +444,90 @@ static void output_syscall_thunks( DLLSPEC *spec )
output_function_size( "__wine_syscall_dispatcher" );
}
/*******************************************************************
+/*******************************************************************
+ * output_syscall_thunks_x64
+ *
+ * Output entry points for system call functions
@ -226,10 +219,9 @@ index d2fd6a6..403aad5 100644
+ output_function_size( "__wine_syscall_dispatcher" );
+}
+
+/*******************************************************************
/*******************************************************************
* output_exports
*
* Output the export table for a Win32 module.
@@ -801,7 +885,10 @@ void BuildSpec32File( DLLSPEC *spec )
resolve_imports( spec );
output_standard_file_header();
@ -387,5 +379,5 @@ index d2fd6a6..403aad5 100644
}
else
--
1.9.1
2.20.1

View File

@ -1,24 +1,24 @@
From e1402515ec1008c3393d434a1016a717c791bd62 Mon Sep 17 00:00:00 2001
From 51d0b968215a8fc788994e85ad4837a406aafc61 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Fri, 30 Mar 2018 08:25:44 +0000
Subject: [PATCH] wined3d: add DXTn support
---
dlls/wined3d/Makefile.in | 1 +
dlls/wined3d/dxtn.c | 435 ++++++++++++++++++++
dlls/wined3d/dxtn.h | 987 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 153 +++++++
dlls/wined3d/wined3d.spec | 7 +
dlls/wined3d/dxtn.c | 435 +++++++++++++++++
dlls/wined3d/dxtn.h | 987 ++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 153 ++++++
dlls/wined3d/wined3d.spec | 8 +
include/wine/wined3d.h | 13 +
6 files changed, 1596 insertions(+)
6 files changed, 1597 insertions(+)
create mode 100644 dlls/wined3d/dxtn.c
create mode 100644 dlls/wined3d/dxtn.h
diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in
index 58fc2d5..b850ba6 100644
index 39fed381d97..abc0ec6adba 100644
--- a/dlls/wined3d/Makefile.in
+++ b/dlls/wined3d/Makefile.in
@@ -10,6 +10,7 @@ C_SRCS = \
@@ -11,6 +11,7 @@ C_SRCS = \
cs.c \
device.c \
directx.c \
@ -28,7 +28,7 @@ index 58fc2d5..b850ba6 100644
nvidia_texture_shader.c \
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
new file mode 100644
index 0000000..4e24fb5
index 00000000000..4e24fb56419
--- /dev/null
+++ b/dlls/wined3d/dxtn.c
@@ -0,0 +1,435 @@
@ -469,7 +469,7 @@ index 0000000..4e24fb5
+}
diff --git a/dlls/wined3d/dxtn.h b/dlls/wined3d/dxtn.h
new file mode 100644
index 0000000..23536c0
index 00000000000..23536c091cc
--- /dev/null
+++ b/dlls/wined3d/dxtn.h
@@ -0,0 +1,987 @@
@ -1461,10 +1461,10 @@ index 0000000..23536c0
+ }
+}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ba0b647..30421b9 100644
index b048b6ef852..5db449863d4 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -820,6 +820,126 @@ static void convert_x8r8g8b8_l8(const BYTE *src, BYTE *dst,
@@ -593,6 +593,126 @@ static void convert_x8r8g8b8_l8(const BYTE *src, BYTE *dst,
}
}
@ -1591,7 +1591,7 @@ index ba0b647..30421b9 100644
struct d3dfmt_converter_desc
{
enum wined3d_format_id from, to;
@@ -837,6 +957,33 @@ static const struct d3dfmt_converter_desc converters[] =
@@ -610,6 +730,33 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_L8_UNORM, convert_x8r8g8b8_l8},
};
@ -1625,7 +1625,7 @@ index ba0b647..30421b9 100644
static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_format_id from,
enum wined3d_format_id to)
{
@@ -848,6 +995,12 @@ static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_fo
@@ -621,6 +768,12 @@ static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_fo
return &converters[i];
}
@ -1639,13 +1639,13 @@ index ba0b647..30421b9 100644
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 93cecf0..78cf50d 100644
index e0777b8e209..d75beb88511 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -314,3 +314,10 @@
@ cdecl wined3d_vertex_declaration_decref(ptr)
@ cdecl wined3d_vertex_declaration_get_parent(ptr)
@@ -319,3 +319,11 @@
@ cdecl wined3d_vertex_declaration_incref(ptr)
@ cdecl wined3d_extract_shader_input_signature_from_dxbc(ptr ptr long)
+
+@ cdecl wined3d_dxt1_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt1_encode(ptr ptr long long long long long)
@ -1653,11 +1653,12 @@ index 93cecf0..78cf50d 100644
+@ cdecl wined3d_dxt3_encode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_encode(ptr ptr long long long long long)
+
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 239ccd8..614805a 100644
index 37b093fa94d..29889b86f53 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2793,4 +2793,17 @@ static inline void wined3d_box_set(struct wined3d_box *box, unsigned int left, u
@@ -2815,4 +2815,17 @@ static inline void wined3d_box_set(struct wined3d_box *box, unsigned int left, u
box->back = back;
}
@ -1676,5 +1677,5 @@ index 239ccd8..614805a 100644
+
#endif /* __WINE_WINED3D_H */
--
2.7.4
2.20.1