Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 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
June 2022
- 68 participants
- 3274 messages
[PATCH vkd3d v3 2/7] vkd3d-shader/hlsl: Allocate enough space for temporary matrices.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
If this is reverted on top of "Lower numeric casts", then the shader
runner crashes with:
shader_runner: ../vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h:1165: vkd3d_write_mask_component_count: Assertion `1 <= count && count <= VKD3D_VEC4_SIZE' failed.
While the HLSL copiler is expected to output correct programs, the DXBC
parser should not crash on malformed inputs anyway, so there is a bug
to be fixed there too.
v2:
* Use hlsl_type_component_count()
---
libs/vkd3d-shader/hlsl_codegen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 78b22910..e38660af 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -1348,7 +1348,7 @@ static void allocate_variable_temp_register(struct hlsl_ctx *ctx, struct hlsl_ir
var->last_read, var->data_type->reg_size);
else
var->reg = allocate_register(ctx, liveness, var->first_write,
- var->last_read, var->data_type->dimx);
+ var->last_read, hlsl_type_component_count(var->data_type));
TRACE("Allocated %s to %s (liveness %u-%u).\n", var->name,
debug_register('r', var->reg, var->data_type), var->first_write, var->last_read);
}
--
2.36.1
June 2, 2022
[PATCH vkd3d v3 1/7] tests: Test how matrix types interact with semantics.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
v2:
* Use the new single component syntax
---
Makefile.am | 1 +
tests/matrix-semantics.shader_test | 71 ++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+)
create mode 100644 tests/matrix-semantics.shader_test
diff --git a/Makefile.am b/Makefile.am
index dd3ce1ff..74c23b2b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -108,6 +108,7 @@ vkd3d_shader_tests = \
tests/hlsl-vector-indexing-uniform.shader_test \
tests/logic-operations.shader_test \
tests/math.shader_test \
+ tests/matrix-semantics.shader_test \
tests/nointerpolation.shader_test \
tests/pow.shader_test \
tests/preproc-if.shader_test \
diff --git a/tests/matrix-semantics.shader_test b/tests/matrix-semantics.shader_test
new file mode 100644
index 00000000..6a089683
--- /dev/null
+++ b/tests/matrix-semantics.shader_test
@@ -0,0 +1,71 @@
+[pixel shader]
+float4x1 main() : sv_target
+{
+ return float4(1.0, 2.0, 3.0, 4.0);
+}
+
+[test]
+todo draw quad
+probe all rgba (1.0, 2.0, 3.0, 4.0)
+
+[pixel shader]
+row_major float1x4 main() : sv_target
+{
+ return float4(1.0, 2.0, 3.0, 4.0);
+}
+
+[test]
+todo draw quad
+probe all rgba (1.0, 2.0, 3.0, 4.0)
+
+[require]
+shader model >= 4.0
+
+[pixel shader]
+row_major float4x1 main() : sv_target
+{
+ return float4(1.0, 2.0, 3.0, 4.0);
+}
+
+[test]
+todo draw quad
+probe all r (1.0)
+
+[pixel shader]
+float1x4 main() : sv_target
+{
+ return float4(1.0, 2.0, 3.0, 4.0);
+}
+
+[test]
+todo draw quad
+probe all r (1.0)
+
+[pixel shader]
+void main(out row_major float1x4 x : sv_target0, out float1x4 y : sv_target1)
+{
+ x = float4(1.0, 2.0, 3.0, 4.0);
+ y = float4(5.0, 6.0, 7.0, 8.0);
+}
+
+[test]
+todo draw quad
+probe all rgba (1.0, 2.0, 3.0, 4.0)
+
+[pixel shader fail todo]
+void main(out float1x4 x : sv_target0, out float1x4 y : sv_target1)
+{
+ x = float4(1.0, 2.0, 3.0, 4.0);
+ y = float4(5.0, 6.0, 7.0, 8.0);
+}
+
+[pixel shader]
+void main(out float1x4 x : sv_target0, out float1x4 y : sv_target4)
+{
+ x = float4(1.0, 2.0, 3.0, 4.0);
+ y = float4(5.0, 6.0, 7.0, 8.0);
+}
+
+[test]
+todo draw quad
+probe all r (1.0)
--
2.36.1
June 2, 2022
Re: [PATCH 1/1] d3d11: Do not return uninitialized values on Map() failure.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=116052
Your paranoid android.
=== build (build log) ===
WineRunBuild.pl:error: The build timed out
June 2, 2022
[PATCH 1/1] d3d11: Do not return uninitialized values on Map() failure.
by Nikolay Sivov
From: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d11/device.c | 15 +++++++++------
dlls/d3d11/tests/d3d11.c | 18 ++++++++++++++++++
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 3f08ae5f4f0..e93cdf74518 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -799,18 +799,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_Map(ID3D11DeviceContext1 *
if (map_flags)
FIXME("Ignoring map_flags %#x.\n", map_flags);
+ mapped_subresource->pData = NULL;
+
if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE
&& map_type != D3D11_MAP_WRITE_DISCARD && map_type != D3D11_MAP_WRITE_NO_OVERWRITE)
return E_INVALIDARG;
wined3d_resource = wined3d_resource_from_d3d11_resource(resource);
- hr = wined3d_device_context_map(context->wined3d_context, wined3d_resource, subresource_idx,
- &map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type));
-
- mapped_subresource->pData = map_desc.data;
- mapped_subresource->RowPitch = map_desc.row_pitch;
- mapped_subresource->DepthPitch = map_desc.slice_pitch;
+ if (SUCCEEDED(hr = wined3d_device_context_map(context->wined3d_context, wined3d_resource, subresource_idx,
+ &map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type))))
+ {
+ mapped_subresource->pData = map_desc.data;
+ mapped_subresource->RowPitch = map_desc.row_pitch;
+ mapped_subresource->DepthPitch = map_desc.slice_pitch;
+ }
return hr;
}
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 9a1bd88dc8b..a43e2bb0cc5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -14934,8 +14934,14 @@ static void test_resource_map(void)
hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, &buffer);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ mapped_subresource.pData = (void *)0xdeadbeef;
+ mapped_subresource.RowPitch = 0xabab;
+ mapped_subresource.DepthPitch = 0xcdcd;
hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)buffer, 1, D3D11_MAP_READ, 0, &mapped_subresource);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ ok(!mapped_subresource.pData, "Unexpected pointer %p.\n", mapped_subresource.pData);
+ ok(mapped_subresource.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", mapped_subresource.RowPitch);
+ ok(mapped_subresource.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", mapped_subresource.DepthPitch);
memset(&mapped_subresource, 0, sizeof(mapped_subresource));
hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &mapped_subresource);
@@ -14972,8 +14978,14 @@ static void test_resource_map(void)
hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, NULL, &texture2d);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ mapped_subresource.pData = (void *)0xdeadbeef;
+ mapped_subresource.RowPitch = 0xabab;
+ mapped_subresource.DepthPitch = 0xcdcd;
hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)texture2d, 1, D3D11_MAP_READ, 0, &mapped_subresource);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ ok(!mapped_subresource.pData, "Unexpected pointer %p.\n", mapped_subresource.pData);
+ ok(mapped_subresource.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", mapped_subresource.RowPitch);
+ ok(mapped_subresource.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", mapped_subresource.DepthPitch);
memset(&mapped_subresource, 0, sizeof(mapped_subresource));
hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)texture2d, 0, D3D11_MAP_WRITE, 0, &mapped_subresource);
@@ -33285,8 +33297,14 @@ static void test_deferred_context_map(void)
hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer2);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ map_desc.pData = (void *)0xdeadbeef;
+ map_desc.RowPitch = 0xabab;
+ map_desc.DepthPitch = 0xcdcd;
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ, 0, &map_desc);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
+ ok(!map_desc.pData, "Unexpected pointer %p.\n", map_desc.pData);
+ ok(map_desc.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", map_desc.RowPitch);
+ ok(map_desc.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", map_desc.DepthPitch);
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ_WRITE, 0, &map_desc);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/175
June 2, 2022
[PATCH 0/1] MR175: d3d11: Do not return uninitialized values on Map() failure.
by Nikolay Sivov (@nsivov)
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/175
June 2, 2022
Re: [PATCH 1/1] ddraw: Limit max texture size to fit a 16bit signed integer
by Henri Verbeet
On Wed, 25 May 2022 at 02:02, Fabian Maurer <wine(a)gitlab.winehq.org> wrote:
> Since ddraw propably never allowed sizes that big anyways,
> this should not cause any issues.
This seems like something it would be easy to write tests for.
June 2, 2022
[PATCH 1/1] include: Provide iswspace, wcstol and wcstoul in unixlib.h.
by Jacek Caban
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/win32u/win32u_private.h | 95 --------------------------------
dlls/winex11.drv/x11drv.h | 50 -----------------
include/wine/unixlib.h | 101 +++++++++++++++++++++++++++++++++++
3 files changed, 101 insertions(+), 145 deletions(-)
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 2d69cbef78e..053fb25fe36 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -525,99 +525,6 @@ static inline WCHAR win32u_towupper( WCHAR ch )
return RtlUpcaseUnicodeChar( ch );
}
-static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base )
-{
- BOOL negative = FALSE, empty = TRUE;
- LONG ret = 0;
-
- if (base < 0 || base == 1 || base > 36) return 0;
- if (end) *end = (WCHAR *)s;
- while (*s == ' ' || *s == '\t') s++;
-
- if (*s == '-')
- {
- negative = TRUE;
- s++;
- }
- else if (*s == '+') s++;
-
- if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
- {
- base = 16;
- s += 2;
- }
- if (base == 0) base = s[0] != '0' ? 10 : 8;
-
- while (*s)
- {
- int v;
-
- if ('0' <= *s && *s <= '9') v = *s - '0';
- else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
- else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
- else break;
- if (v >= base) break;
- if (negative) v = -v;
- s++;
- empty = FALSE;
-
- if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v))
- ret = MAXLONG;
- else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v)))
- ret = MINLONG;
- else
- ret = ret * base + v;
- }
-
- if (end && !empty) *end = (WCHAR *)s;
- return ret;
-}
-
-static inline ULONG win32u_wcstoul( const WCHAR *s, WCHAR **end, int base )
-{
- BOOL negative = FALSE, empty = TRUE;
- ULONG ret = 0;
-
- if (base < 0 || base == 1 || base > 36) return 0;
- if (end) *end = (WCHAR *)s;
- while (*s == ' ' || *s == '\t') s++;
-
- if (*s == '-')
- {
- negative = TRUE;
- s++;
- }
- else if (*s == '+') s++;
-
- if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
- {
- base = 16;
- s += 2;
- }
- if (base == 0) base = s[0] != '0' ? 10 : 8;
-
- while (*s)
- {
- int v;
-
- if ('0' <= *s && *s <= '9') v = *s - '0';
- else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
- else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
- else break;
- if (v >= base) break;
- s++;
- empty = FALSE;
-
- if (ret > MAXDWORD / base || ret * base > MAXDWORD - v)
- ret = MAXDWORD;
- else
- ret = ret * base + v;
- }
-
- if (end && !empty) *end = (WCHAR *)s;
- return negative ? -ret : ret;
-}
-
extern CPTABLEINFO ansi_cp DECLSPEC_HIDDEN;
DWORD win32u_mbtowc( CPTABLEINFO *info, WCHAR *dst, DWORD dstlen, const char *src,
@@ -643,8 +550,6 @@ static inline WCHAR *towstr( const char *str )
#define towupper(c) win32u_towupper(c)
#define wcsdup(s) win32u_wcsdup(s)
-#define wcstol(s,e,b) win32u_wcstol(s,e,b)
-#define wcstoul(s,e,b) win32u_wcstoul(s,e,b)
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
{
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 307932b0bf0..003604cd97d 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -928,54 +928,4 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src )
return (p - dst) * sizeof(WCHAR);
}
-static inline LONG x11drv_wcstol( LPCWSTR s, LPWSTR *end, INT base )
-{
- BOOL negative = FALSE, empty = TRUE;
- LONG ret = 0;
-
- if (base < 0 || base == 1 || base > 36) return 0;
- if (end) *end = (WCHAR *)s;
- while (*s == ' ' || *s == '\t') s++;
-
- if (*s == '-')
- {
- negative = TRUE;
- s++;
- }
- else if (*s == '+') s++;
-
- if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
- {
- base = 16;
- s += 2;
- }
- if (base == 0) base = s[0] != '0' ? 10 : 8;
-
- while (*s)
- {
- int v;
-
- if ('0' <= *s && *s <= '9') v = *s - '0';
- else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
- else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
- else break;
- if (v >= base) break;
- if (negative) v = -v;
- s++;
- empty = FALSE;
-
- if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v))
- ret = MAXLONG;
- else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v)))
- ret = MINLONG;
- else
- ret = ret * base + v;
- }
-
- if (end && !empty) *end = (WCHAR *)s;
- return ret;
-}
-
-#define wcstol x11drv_wcstol
-
#endif /* __WINE_X11DRV_H */
diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h
index a7cfb8f6cab..ef60b32184c 100644
--- a/include/wine/unixlib.h
+++ b/include/wine/unixlib.h
@@ -84,6 +84,11 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
/* wide char string functions */
+static inline int ntdll_iswspace( WCHAR wc )
+{
+ return ('\t' <= wc && wc <= '\r') || wc == ' ' || wc == 0xa0;
+}
+
static inline size_t ntdll_wcslen( const WCHAR *str )
{
const WCHAR *s = str;
@@ -150,6 +155,100 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject )
return ptr - str;
}
+static inline LONG ntdll_wcstol( const WCHAR *s, WCHAR **end, int base )
+{
+ BOOL negative = FALSE, empty = TRUE;
+ LONG ret = 0;
+
+ if (base < 0 || base == 1 || base > 36) return 0;
+ if (end) *end = (WCHAR *)s;
+ while (ntdll_iswspace(*s)) s++;
+
+ if (*s == '-')
+ {
+ negative = TRUE;
+ s++;
+ }
+ else if (*s == '+') s++;
+
+ if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
+ {
+ base = 16;
+ s += 2;
+ }
+ if (base == 0) base = s[0] != '0' ? 10 : 8;
+
+ while (*s)
+ {
+ int v;
+
+ if ('0' <= *s && *s <= '9') v = *s - '0';
+ else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
+ else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
+ else break;
+ if (v >= base) break;
+ if (negative) v = -v;
+ s++;
+ empty = FALSE;
+
+ if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v))
+ ret = MAXLONG;
+ else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v)))
+ ret = MINLONG;
+ else
+ ret = ret * base + v;
+ }
+
+ if (end && !empty) *end = (WCHAR *)s;
+ return ret;
+}
+
+static inline ULONG ntdll_wcstoul( const WCHAR *s, WCHAR **end, int base )
+{
+ BOOL negative = FALSE, empty = TRUE;
+ ULONG ret = 0;
+
+ if (base < 0 || base == 1 || base > 36) return 0;
+ if (end) *end = (WCHAR *)s;
+ while (ntdll_iswspace(*s)) s++;
+
+ if (*s == '-')
+ {
+ negative = TRUE;
+ s++;
+ }
+ else if (*s == '+') s++;
+
+ if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
+ {
+ base = 16;
+ s += 2;
+ }
+ if (base == 0) base = s[0] != '0' ? 10 : 8;
+
+ while (*s)
+ {
+ int v;
+
+ if ('0' <= *s && *s <= '9') v = *s - '0';
+ else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
+ else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
+ else break;
+ if (v >= base) break;
+ s++;
+ empty = FALSE;
+
+ if (ret > MAXDWORD / base || ret * base > MAXDWORD - v)
+ ret = MAXDWORD;
+ else
+ ret = ret * base + v;
+ }
+
+ if (end && !empty) *end = (WCHAR *)s;
+ return negative ? -ret : ret;
+}
+
+#define iswspace(ch) ntdll_iswspace(ch)
#define wcslen(str) ntdll_wcslen(str)
#define wcscpy(dst,src) ntdll_wcscpy(dst,src)
#define wcscat(dst,src) ntdll_wcscat(dst,src)
@@ -162,6 +261,8 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject )
#define wcscspn(str,rej) ntdll_wcscspn(str,rej)
#define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2)
#define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n)
+#define wcstol(str,e,b) ntdll_wcstol(str,e,b)
+#define wcstoul(str,e,b) ntdll_wcstoul(str,e,b)
#endif /* WINE_UNIX_LIB */
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/174
June 2, 2022
[PATCH 0/1] MR174: include: Provide iswspace, wcstol and wcstoul in unixlib.h.
by Jacek Caban (@jacek)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/174
June 2, 2022
[PATCH v2 12/12] secur32: Add wow64 support to the unixlib.
by Nikolay Sivov
From: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/secur32/schannel_gnutls.c | 314 +++++++++++++++++++++++++++++++++
1 file changed, 314 insertions(+)
diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c
index 08801cef509..ad319518a7a 100644
--- a/dlls/secur32/schannel_gnutls.c
+++ b/dlls/secur32/schannel_gnutls.c
@@ -25,6 +25,7 @@
#include "config.h"
+#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1286,4 +1287,317 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
schan_set_dtls_timeouts,
};
+#ifdef _WIN64
+
+typedef ULONG PTR32;
+
+typedef struct SecBufferDesc32
+{
+ ULONG ulVersion;
+ ULONG cBuffers;
+ PTR32 pBuffers;
+} SecBufferDesc32;
+
+typedef struct SecBuffer32
+{
+ ULONG cbBuffer;
+ ULONG BufferType;
+ PTR32 pvBuffer;
+} SecBuffer32;
+
+static NTSTATUS wow64_schan_allocate_certificate_credentials( void *args )
+{
+ struct
+ {
+ PTR32 c;
+ ULONG cert_encoding;
+ ULONG cert_size;
+ PTR32 cert_blob;
+ ULONG key_size;
+ PTR32 key_blob;
+ } const *params32 = args;
+ struct allocate_certificate_credentials_params params =
+ {
+ ULongToPtr(params32->c),
+ params32->cert_encoding,
+ params32->cert_size,
+ ULongToPtr(params32->cert_blob),
+ params32->key_size,
+ ULongToPtr(params32->key_blob),
+ };
+ return schan_allocate_certificate_credentials(¶ms);
+}
+
+static NTSTATUS wow64_schan_create_session( void *args )
+{
+ struct
+ {
+ PTR32 cred;
+ PTR32 session;
+ } const *params32 = args;
+ struct create_session_params params =
+ {
+ ULongToPtr(params32->cred),
+ ULongToPtr(params32->session),
+ };
+ return schan_create_session(¶ms);
+}
+
+static NTSTATUS wow64_schan_free_certificate_credentials( void *args )
+{
+ struct
+ {
+ PTR32 c;
+ } const *params32 = args;
+ struct free_certificate_credentials_params params =
+ {
+ ULongToPtr(params32->c),
+ };
+ return schan_free_certificate_credentials(¶ms);
+}
+
+static NTSTATUS wow64_schan_get_application_protocol( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 protocol;
+ } const *params32 = args;
+ struct get_application_protocol_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->protocol),
+ };
+ return schan_get_application_protocol(¶ms);
+}
+
+static NTSTATUS wow64_schan_get_connection_info( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 info;
+ } const *params32 = args;
+ struct get_connection_info_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->info),
+ };
+ return schan_get_connection_info(¶ms);
+}
+
+static NTSTATUS wow64_schan_get_session_peer_certificate( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 buffer;
+ PTR32 bufsize;
+ PTR32 retcount;
+ } const *params32 = args;
+ struct get_session_peer_certificate_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->buffer),
+ ULongToPtr(params32->bufsize),
+ ULongToPtr(params32->retcount),
+ };
+ return schan_get_session_peer_certificate(¶ms);
+}
+
+static NTSTATUS wow64_schan_get_unique_channel_binding( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 buffer;
+ PTR32 bufsize;
+ } const *params32 = args;
+ struct get_unique_channel_binding_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->buffer),
+ ULongToPtr(params32->bufsize),
+ };
+ return schan_get_unique_channel_binding(¶ms);
+}
+
+static void secbufferdesc_32to64(const SecBufferDesc32 *desc32, SecBufferDesc *desc)
+{
+ unsigned int i;
+
+ desc->ulVersion = desc32->ulVersion;
+ desc->cBuffers = desc32->cBuffers;
+ for (i = 0; i < desc->cBuffers; ++i)
+ {
+ SecBuffer32 *buffer32 = ULongToPtr(desc32->pBuffers + i * sizeof(*buffer32));
+ desc->pBuffers[i].cbBuffer = buffer32->cbBuffer;
+ desc->pBuffers[i].BufferType = buffer32->BufferType;
+ desc->pBuffers[i].pvBuffer = ULongToPtr(buffer32->pvBuffer);
+ }
+}
+
+static NTSTATUS wow64_schan_handshake( void *args )
+{
+ SecBuffer input_buffers[3];
+ SecBufferDesc input = { 0, 0, input_buffers };
+ SecBuffer output_buffers[3];
+ SecBufferDesc output = { 0, 0, output_buffers };
+
+ struct
+ {
+ schan_session session;
+ PTR32 input;
+ ULONG input_size;
+ PTR32 output;
+ PTR32 input_offset;
+ PTR32 output_buffer_idx;
+ PTR32 output_offset;
+ } const *params32 = args;
+ struct handshake_params params =
+ {
+ params32->session,
+ params32->input ? &input : NULL,
+ params32->input_size,
+ params32->output ? &output : NULL,
+ ULongToPtr(params32->input_offset),
+ ULongToPtr(params32->output_buffer_idx),
+ ULongToPtr(params32->output_offset),
+ };
+ if (params32->input)
+ {
+ SecBufferDesc32 *desc32 = ULongToPtr(params32->input);
+ assert(desc32->cBuffers <= ARRAY_SIZE(input_buffers));
+ secbufferdesc_32to64(desc32, &input);
+ }
+ if (params32->output)
+ {
+ SecBufferDesc32 *desc32 = ULongToPtr(params32->output);
+ assert(desc32->cBuffers <= ARRAY_SIZE(output_buffers));
+ secbufferdesc_32to64(desc32, &output);
+ }
+ return schan_handshake(¶ms);
+}
+
+static NTSTATUS wow64_schan_recv( void *args )
+{
+ SecBuffer buffers[3];
+ SecBufferDesc input = { 0, 0, buffers };
+
+ struct
+ {
+ schan_session session;
+ PTR32 input;
+ ULONG input_size;
+ PTR32 buffer;
+ PTR32 length;
+ } const *params32 = args;
+ struct recv_params params =
+ {
+ params32->session,
+ params32->input ? &input : NULL,
+ params32->input_size,
+ ULongToPtr(params32->buffer),
+ ULongToPtr(params32->length),
+ };
+ if (params32->input)
+ {
+ SecBufferDesc32 *desc32 = ULongToPtr(params32->input);
+ assert(desc32->cBuffers <= ARRAY_SIZE(buffers));
+ secbufferdesc_32to64(desc32, &input);
+ }
+ return schan_recv(¶ms);
+}
+
+static NTSTATUS wow64_schan_send( void *args )
+{
+ SecBuffer buffers[3];
+ SecBufferDesc output = { 0, 0, buffers };
+
+ struct
+ {
+ schan_session session;
+ PTR32 output;
+ PTR32 buffer;
+ ULONG length;
+ PTR32 output_buffer_idx;
+ PTR32 output_offset;
+ } const *params32 = args;
+ struct send_params params =
+ {
+ params32->session,
+ params32->output ? &output : NULL,
+ ULongToPtr(params32->buffer),
+ params32->length,
+ ULongToPtr(params32->output_buffer_idx),
+ ULongToPtr(params32->output_offset),
+ };
+ if (params32->output)
+ {
+ SecBufferDesc32 *desc32 = ULongToPtr(params32->output);
+ assert(desc32->cBuffers <= ARRAY_SIZE(buffers));
+ secbufferdesc_32to64(desc32, &output);
+ }
+ return schan_send(¶ms);
+}
+
+static NTSTATUS wow64_schan_set_application_protocols( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 buffer;
+ unsigned int buflen;
+ } const *params32 = args;
+ struct set_application_protocols_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->buffer),
+ params32->buflen,
+ };
+ return schan_set_application_protocols(¶ms);
+}
+
+static NTSTATUS wow64_schan_set_session_target( void *args )
+{
+ struct
+ {
+ schan_session session;
+ PTR32 target;
+ } const *params32 = args;
+ struct set_session_target_params params =
+ {
+ params32->session,
+ ULongToPtr(params32->target),
+ };
+ return schan_set_session_target(¶ms);
+}
+
+const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
+{
+ process_attach,
+ process_detach,
+ wow64_schan_allocate_certificate_credentials,
+ wow64_schan_create_session,
+ schan_dispose_session,
+ wow64_schan_free_certificate_credentials,
+ wow64_schan_get_application_protocol,
+ wow64_schan_get_connection_info,
+ schan_get_enabled_protocols,
+ schan_get_key_signature_algorithm,
+ schan_get_max_message_size,
+ schan_get_session_cipher_block_size,
+ wow64_schan_get_session_peer_certificate,
+ wow64_schan_get_unique_channel_binding,
+ wow64_schan_handshake,
+ wow64_schan_recv,
+ wow64_schan_send,
+ wow64_schan_set_application_protocols,
+ schan_set_dtls_mtu,
+ wow64_schan_set_session_target,
+ schan_set_dtls_timeouts,
+};
+
+#endif /* _WIN64 */
+
#endif /* SONAME_LIBGNUTLS */
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/160
June 2, 2022
[PATCH v2 11/12] secur32: Store certificate credentials object pointer as 64-bit.
by Nikolay Sivov
From: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/secur32/schannel_gnutls.c | 14 +++++++++-----
dlls/secur32/secur32_priv.h | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c
index 4d7711f32a2..08801cef509 100644
--- a/dlls/secur32/schannel_gnutls.c
+++ b/dlls/secur32/schannel_gnutls.c
@@ -141,6 +141,11 @@ static inline gnutls_session_t session_from_handle(UINT64 handle)
return (gnutls_session_t)(ULONG_PTR)handle;
}
+static inline gnutls_certificate_credentials_t certificate_creds_from_handle(UINT64 handle)
+{
+ return (gnutls_certificate_credentials_t)(ULONG_PTR)handle;
+}
+
struct schan_buffers
{
SIZE_T offset;
@@ -469,8 +474,7 @@ static NTSTATUS schan_create_session( void *args )
return STATUS_INTERNAL_ERROR;
}
- err = pgnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE,
- (gnutls_certificate_credentials_t)cred->credentials);
+ err = pgnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, certificate_creds_from_handle(cred->credentials));
if (err != GNUTLS_E_SUCCESS)
{
pgnutls_perror(err);
@@ -1074,7 +1078,7 @@ static NTSTATUS schan_allocate_certificate_credentials( void *args )
if (!params->cert_blob)
{
- params->c->credentials = creds;
+ params->c->credentials = (ULONG_PTR)creds;
return STATUS_SUCCESS;
}
@@ -1101,14 +1105,14 @@ static NTSTATUS schan_allocate_certificate_credentials( void *args )
return STATUS_INTERNAL_ERROR;
}
- params->c->credentials = creds;
+ params->c->credentials = (ULONG_PTR)creds;
return STATUS_SUCCESS;
}
static NTSTATUS schan_free_certificate_credentials( void *args )
{
const struct free_certificate_credentials_params *params = args;
- pgnutls_certificate_free_credentials(params->c->credentials);
+ pgnutls_certificate_free_credentials(certificate_creds_from_handle(params->c->credentials));
return STATUS_SUCCESS;
}
diff --git a/dlls/secur32/secur32_priv.h b/dlls/secur32/secur32_priv.h
index bbb2c527b18..5753ed47ffa 100644
--- a/dlls/secur32/secur32_priv.h
+++ b/dlls/secur32/secur32_priv.h
@@ -84,8 +84,8 @@ typedef UINT64 schan_session;
typedef struct schan_credentials
{
ULONG credential_use;
- void *credentials;
DWORD enabled_protocols;
+ UINT64 credentials;
} schan_credentials;
struct session_params
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/160
June 2, 2022