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
July 2021
- 86 participants
- 1756 messages
Re: [PATCH 1/3] kernelbase/tests: Fix the Sleep() test for non-default timer resolutions.
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=94690
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
kernelbase:
sync.c:208: Test failed: got 1.556679, expected about 0.100000
July 29, 2021
[PATCH] dpnhupnp: Build with msvcrt.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/dpnhupnp/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dpnhupnp/Makefile.in b/dlls/dpnhupnp/Makefile.in
index 6aa9ef1dd80..369f1ba276a 100644
--- a/dlls/dpnhupnp/Makefile.in
+++ b/dlls/dpnhupnp/Makefile.in
@@ -1,6 +1,6 @@
MODULE = dpnhupnp.dll
-EXTRADLLFLAGS = -Wb,--prefer-native
+EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
C_SRCS = \
main.c
--
2.30.2
July 29, 2021
[PATCH 3/3] ntdll: Improve the Nt{Query,Set}TimerResolution() stubs.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
This allows using them in the tests dealing with timers.
---
dlls/kernelbase/tests/sync.c | 8 ++---
dlls/ntdll/tests/time.c | 60 ++++++++++++++++++------------------
dlls/ntdll/unix/sync.c | 33 +++++++++++++++++---
3 files changed, 63 insertions(+), 38 deletions(-)
diff --git a/dlls/kernelbase/tests/sync.c b/dlls/kernelbase/tests/sync.c
index 54c2dfe99f5..abb0254c929 100644
--- a/dlls/kernelbase/tests/sync.c
+++ b/dlls/kernelbase/tests/sync.c
@@ -201,13 +201,13 @@ static void test_Sleep(void)
cur = 156250;
status = NtQueryTimerResolution(&dummy, &dummy, &cur);
- todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
expected_time = 100.0 * cur / 10000000.0;
elapsed_time = (t2.QuadPart - t1.QuadPart) / (double)frequency.QuadPart;
- todo_wine ok(0.9 * expected_time <= elapsed_time &&
- elapsed_time <= 1.5 * expected_time,
- "got %f, expected about %f\n", elapsed_time, expected_time);
+ ok(0.9 * expected_time <= elapsed_time &&
+ elapsed_time <= 1.5 * expected_time,
+ "got %f, expected about %f\n", elapsed_time, expected_time);
}
START_TEST(sync)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index 5f9c49989d8..f75b159f441 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -218,16 +218,16 @@ static void test_RtlQueryPerformanceCounter(void)
#define CHECK_CURRENT_TIMER(expected) \
do { \
- todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %x\n", status); \
- todo_wine ok(cur2 == (expected), "expected new timer resolution %u, got %u\n", (expected), cur2); \
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %x\n", status); \
+ ok(cur2 == (expected), "expected new timer resolution %u, got %u\n", (expected), cur2); \
min2 = min + 10; \
cur2 = min2 + 1; \
max2 = cur2 + 1; \
status = NtQueryTimerResolution(&min2, &max2, &cur2); \
- todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %x\n", status); \
- todo_wine ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2); \
- todo_wine ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2); \
- todo_wine ok(cur2 == expected, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", (expected), cur2); \
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %x\n", status); \
+ ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2); \
+ ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2); \
+ ok(cur2 == expected, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", (expected), cur2); \
} while (0)
static void test_TimerResolution(void)
@@ -236,46 +236,46 @@ static void test_TimerResolution(void)
NTSTATUS status;
status = NtQueryTimerResolution(NULL, &max, &cur);
- todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(NULL,,) success\n");
+ ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(NULL,,) success\n");
status = NtQueryTimerResolution(&min, NULL, &cur);
- todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,NULL,) success\n");
+ ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,NULL,) success\n");
status = NtQueryTimerResolution(&min, &max, NULL);
- todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,,NULL) success\n");
+ ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,,NULL) success\n");
min = 212121;
cur = min + 1;
max = cur + 1;
status = NtQueryTimerResolution(&min, &max, &cur);
- todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
- todo_wine ok(min == 156250 /* 1/64s HPET */ || min == 156001 /* RTC */,
- "unexpected minimum timer resolution %u\n", min);
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ ok(min == 156250 /* 1/64s HPET */ || min == 156001 /* RTC */,
+ "unexpected minimum timer resolution %u\n", min);
ok(0 < max, "invalid maximum timer resolution, should be 0 < %u\n", max);
- todo_wine ok(max <= cur && cur <= min, "invalid timer resolutions, should be %u <= %u <= %u\n", max, cur, min);
+ ok(max <= cur && cur <= min, "invalid timer resolutions, should be %u <= %u <= %u\n", max, cur, min);
status = NtSetTimerResolution(0, FALSE, NULL);
- todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution(,,NULL) success\n");
+ ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution(,,NULL) success\n");
/* Nothing happens if that pointer is not good */
status = NtSetTimerResolution(cur - 1, TRUE, NULL);
- todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %x\n", status);
min2 = min + 1;
cur2 = min2 + 1;
max2 = cur2 + 1;
status = NtQueryTimerResolution(&min2, &max2, &cur2);
- todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
- todo_wine ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2);
- todo_wine ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2);
- todo_wine ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", cur, cur2);
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2);
+ ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2);
+ ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", cur, cur2);
/* 'fails' until the first valid timer resolution request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- todo_wine ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
/* and returns the current timer resolution */
- todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+ ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
cur2 = 7654321;
@@ -285,18 +285,18 @@ static void test_TimerResolution(void)
/* Rescinds our timer resolution request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
/* -> the timer resolution was reset to its initial value */
- todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", min, cur2);
+ ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", min, cur2);
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- todo_wine ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
- todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+ ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
+ ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
cur2 = 7654321;
status = NtSetTimerResolution(min + 1, TRUE, &cur2);
- todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
/* This works because:
* - Either cur is the minimum (15.6 ms) resolution already, i.e. the
* closest valid value 'set' is rounded to.
@@ -310,8 +310,8 @@ static void test_TimerResolution(void)
cur2 = 7654321;
set = max < cur ? cur - 1 : max;
status = NtSetTimerResolution(set, TRUE, &cur2);
- todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
- todo_wine ok(cur2 <= set, "expected new timer resolution %u <= %u\n", cur2, set);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(cur2 <= set, "expected new timer resolution %u <= %u\n", cur2, set);
trace("timer resolution: %u(max) <= %u(cur) <= %u(prev) <= %u(min)\n", max, cur2, cur, min);
cur2 = 7654321;
@@ -321,8 +321,8 @@ static void test_TimerResolution(void)
/* Cleanup by rescinding the last request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
- todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", set, cur2);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", set, cur2);
}
static void test_RtlQueryTimeZoneInformation(void)
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index 7bdce91e034..d839195fd07 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -1599,8 +1599,13 @@ NTSTATUS WINAPI NtSetSystemTime( const LARGE_INTEGER *new, LARGE_INTEGER *old )
*/
NTSTATUS WINAPI NtQueryTimerResolution( ULONG *min_res, ULONG *max_res, ULONG *current_res )
{
- FIXME( "(%p,%p,%p), stub!\n", min_res, max_res, current_res );
- return STATUS_NOT_IMPLEMENTED;
+ TRACE( "(%p,%p,%p)\n", min_res, max_res, current_res );
+ if (!min_res || !max_res || !current_res)
+ return STATUS_ACCESS_VIOLATION;
+
+ *max_res = *current_res = 10000; /* See NtSetTimerResolution() */
+ *min_res = 156250;
+ return STATUS_SUCCESS;
}
@@ -1609,8 +1614,28 @@ NTSTATUS WINAPI NtQueryTimerResolution( ULONG *min_res, ULONG *max_res, ULONG *c
*/
NTSTATUS WINAPI NtSetTimerResolution( ULONG res, BOOLEAN set, ULONG *current_res )
{
- FIXME( "(%u,%u,%p), stub!\n", res, set, current_res );
- return STATUS_NOT_IMPLEMENTED;
+ static BOOL has_request = FALSE;
+ TRACE( "(%u,%u,%p), semi-stub!\n", res, set, current_res );
+
+ if (!current_res)
+ return STATUS_ACCESS_VIOLATION;
+
+ /* Wine has no support for anything other that 1 ms and does not keep of
+ * track resolution requests anyway.
+ * Fortunately NtSetTimerResolution() should ignore requests to lower the
+ * timer resolution. So by claiming that 'some other process' requested the
+ * max resolution already, there no need to actually change it.
+ */
+ *current_res = 10000;
+
+ /* Just keep track of whether this process requested a specific timer
+ * resolution.
+ */
+ if (!has_request && !set)
+ return STATUS_TIMER_RESOLUTION_NOT_SET;
+ has_request = set;
+
+ return STATUS_SUCCESS;
}
--
2.20.1
July 29, 2021
[PATCH 2/3] ntdll/tests: Add some Nt{Query,Set}TimerResolution() tests.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
dlls/ntdll/tests/time.c | 110 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index ee683e9a0aa..5f9c49989d8 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -216,6 +216,115 @@ static void test_RtlQueryPerformanceCounter(void)
}
#endif
+#define CHECK_CURRENT_TIMER(expected) \
+ do { \
+ todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %x\n", status); \
+ todo_wine ok(cur2 == (expected), "expected new timer resolution %u, got %u\n", (expected), cur2); \
+ min2 = min + 10; \
+ cur2 = min2 + 1; \
+ max2 = cur2 + 1; \
+ status = NtQueryTimerResolution(&min2, &max2, &cur2); \
+ todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %x\n", status); \
+ todo_wine ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2); \
+ todo_wine ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2); \
+ todo_wine ok(cur2 == expected, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", (expected), cur2); \
+ } while (0)
+
+static void test_TimerResolution(void)
+{
+ ULONG min, max, cur, min2, max2, cur2, set;
+ NTSTATUS status;
+
+ status = NtQueryTimerResolution(NULL, &max, &cur);
+ todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(NULL,,) success\n");
+
+ status = NtQueryTimerResolution(&min, NULL, &cur);
+ todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,NULL,) success\n");
+
+ status = NtQueryTimerResolution(&min, &max, NULL);
+ todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtQueryTimerResolution(,,NULL) success\n");
+
+ min = 212121;
+ cur = min + 1;
+ max = cur + 1;
+ status = NtQueryTimerResolution(&min, &max, &cur);
+ todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ todo_wine ok(min == 156250 /* 1/64s HPET */ || min == 156001 /* RTC */,
+ "unexpected minimum timer resolution %u\n", min);
+ ok(0 < max, "invalid maximum timer resolution, should be 0 < %u\n", max);
+ todo_wine ok(max <= cur && cur <= min, "invalid timer resolutions, should be %u <= %u <= %u\n", max, cur, min);
+
+ status = NtSetTimerResolution(0, FALSE, NULL);
+ todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution(,,NULL) success\n");
+
+ /* Nothing happens if that pointer is not good */
+ status = NtSetTimerResolution(cur - 1, TRUE, NULL);
+ todo_wine ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %x\n", status);
+
+ min2 = min + 1;
+ cur2 = min2 + 1;
+ max2 = cur2 + 1;
+ status = NtQueryTimerResolution(&min2, &max2, &cur2);
+ todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ todo_wine ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2);
+ todo_wine ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2);
+ todo_wine ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", cur, cur2);
+
+ /* 'fails' until the first valid timer resolution request */
+ cur2 = 7654321;
+ status = NtSetTimerResolution(0, FALSE, &cur2);
+ todo_wine ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
+ /* and returns the current timer resolution */
+ todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+
+
+ cur2 = 7654321;
+ status = NtSetTimerResolution(max - 1, TRUE, &cur2);
+ CHECK_CURRENT_TIMER(max);
+
+ /* Rescinds our timer resolution request */
+ cur2 = 7654321;
+ status = NtSetTimerResolution(0, FALSE, &cur2);
+ todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ /* -> the timer resolution was reset to its initial value */
+ todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", min, cur2);
+
+ cur2 = 7654321;
+ status = NtSetTimerResolution(0, FALSE, &cur2);
+ todo_wine ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
+ todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+
+ cur2 = 7654321;
+ status = NtSetTimerResolution(min + 1, TRUE, &cur2);
+ todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ /* This works because:
+ * - Either cur is the minimum (15.6 ms) resolution already, i.e. the
+ * closest valid value 'set' is rounded to.
+ * - Or some other application requested a higher timer resolution, cur,
+ * and any attempt to lower the resolution has no effect until that
+ * request is rescinded (hopefully after this test is done).
+ */
+ CHECK_CURRENT_TIMER(cur);
+
+ /* The requested resolution may (win7) or may not be rounded */
+ cur2 = 7654321;
+ set = max < cur ? cur - 1 : max;
+ status = NtSetTimerResolution(set, TRUE, &cur2);
+ todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ todo_wine ok(cur2 <= set, "expected new timer resolution %u <= %u\n", cur2, set);
+ trace("timer resolution: %u(max) <= %u(cur) <= %u(prev) <= %u(min)\n", max, cur2, cur, min);
+
+ cur2 = 7654321;
+ status = NtSetTimerResolution(cur + 1, TRUE, &cur2);
+ CHECK_CURRENT_TIMER(cur); /* see min + 1 test */
+
+ /* Cleanup by rescinding the last request */
+ cur2 = 7654321;
+ status = NtSetTimerResolution(0, FALSE, &cur2);
+ todo_wine ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ todo_wine ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", set, cur2);
+}
+
static void test_RtlQueryTimeZoneInformation(void)
{
RTL_DYNAMIC_TIME_ZONE_INFORMATION tzinfo, tzinfo2;
@@ -379,4 +488,5 @@ START_TEST(time)
#if defined(__i386__) || defined(__x86_64__)
test_RtlQueryPerformanceCounter();
#endif
+ test_TimerResolution();
}
--
2.20.1
July 29, 2021
[PATCH 1/3] kernelbase/tests: Fix the Sleep() test for non-default timer resolutions.
by Francois Gouget
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51533
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
This should fix the failures on cw-rx460 when the Radeon driver sets
the timer resolution to 2 ms.
---
dlls/kernelbase/tests/sync.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/kernelbase/tests/sync.c b/dlls/kernelbase/tests/sync.c
index 50ce62602b0..54c2dfe99f5 100644
--- a/dlls/kernelbase/tests/sync.c
+++ b/dlls/kernelbase/tests/sync.c
@@ -19,10 +19,14 @@
*/
#include <stdarg.h>
+#include <stdlib.h>
+
+#include <ntstatus.h>
+#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
-#include <stdlib.h>
#include <winerror.h>
+#include <winternl.h>
#include "wine/test.h"
@@ -176,7 +180,9 @@ static void test_Sleep(void)
{
LARGE_INTEGER frequency;
LARGE_INTEGER t1, t2;
- double elapsed_time;
+ double elapsed_time, expected_time;
+ ULONG dummy, cur;
+ NTSTATUS status;
BOOL ret;
int i;
@@ -193,8 +199,15 @@ static void test_Sleep(void)
ret = QueryPerformanceCounter(&t2);
ok(ret, "QueryPerformanceCounter failed\n");
+ cur = 156250;
+ status = NtQueryTimerResolution(&dummy, &dummy, &cur);
+ todo_wine ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ expected_time = 100.0 * cur / 10000000.0;
+
elapsed_time = (t2.QuadPart - t1.QuadPart) / (double)frequency.QuadPart;
- todo_wine ok(elapsed_time >= 1.5 && elapsed_time <= 4.0, "got %f\n", elapsed_time);
+ todo_wine ok(0.9 * expected_time <= elapsed_time &&
+ elapsed_time <= 1.5 * expected_time,
+ "got %f, expected about %f\n", elapsed_time, expected_time);
}
START_TEST(sync)
--
2.20.1
July 29, 2021
Re: [PATCH] winewrapper: Use early binding on FreeBSD
by Alexandre Julliard
Gerald Pfeifer <gerald(a)pfeifer.com> writes:
> On Tue, 27 Jul 2021, Alexandre Julliard wrote:
>>> +if [ "`uname -s`" = "FreeBSD" ]
>>> +then
>>> + # Workaround for https://bugs.winehq.org/show_bug.cgi?id=50257
>>> + export LD_BIND_NOW=1
>>> + export LD_32_BIND_NOW=1
>>> +fi
>>> +
>> That doesn't look like a proper solution, it's only hiding the bug,
>> and then only when running from inside the build tree.
>
> For the actual ports (ports/emulators/wine-devel) we have put a script
> in place that sets those variables and then invokes the actual binary.
>
> My patch was meant to people helping test and development upstream Wine.
>
> Any chance of getting this in until, if ever, the issue gets resolved
> differently?
>
> (Looking at https://bugs.winehq.org/show_bug.cgi?id=50257 this does not
> appear to be simply fixable? Or do you see a way to address this on the
> Wine side?)
It looks like a FreeBSD linker bug, someone will have to investigate
exactly why the linker behaves that way. Depending on what it does, it's
possible that using the -nolibc flag would work around it.
But really the right fix is to build with Mingw. I don't know why that
doesn't work on FreeBSD, but fixing that should be the priority.
--
Alexandre Julliard
julliard(a)winehq.org
July 29, 2021
Re: [PATCH 01/10] gdi32: Use get_dc_attr in SetArcDirection.
by Huw Davies
On Thu, Jul 29, 2021 at 10:28:14AM +0200, Jacek Caban wrote:
> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
> ---
> dlls/gdi32/dc.c | 29 ----------------------------
> dlls/gdi32/enhmfdrv/dc.c | 6 +++---
> dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 1 -
> dlls/gdi32/enhmfdrv/init.c | 2 +-
> dlls/gdi32/gdi_private.h | 1 +
> dlls/gdi32/gdidc.c | 22 +++++++++++++++++++++
> 6 files changed, 27 insertions(+), 34 deletions(-)
I've sent in version two of this series with a few white-space
changes.
Thanks,
Huw.
July 29, 2021
[PATCH v2 10/10] gdi32: Remove no longer used driver entry points.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/gdi32/dibdrv/dc.c | 8 --------
dlls/gdi32/driver.c | 24 ------------------------
dlls/gdi32/enhmfdrv/init.c | 4 ----
dlls/gdi32/font.c | 4 ----
dlls/gdi32/mfdrv/init.c | 4 ----
dlls/gdi32/path.c | 4 ----
dlls/wineandroid.drv/init.c | 4 ----
dlls/winemac.drv/gdi.c | 4 ----
dlls/wineps.drv/init.c | 4 ----
dlls/winex11.drv/init.c | 4 ----
dlls/winex11.drv/xrender.c | 4 ----
include/wine/gdi_driver.h | 6 +-----
12 files changed, 1 insertion(+), 73 deletions(-)
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index b9332b32d58..d05c50aab7b 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -713,7 +713,6 @@ const struct gdi_dc_funcs dib_driver =
dibdrv_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
dibdrv_SelectPen, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
dibdrv_SetBoundsRect, /* pSetBoundsRect */
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
@@ -725,9 +724,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
dibdrv_SetPixel, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
@@ -1309,7 +1305,6 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
windrv_SetBoundsRect, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -1321,9 +1316,6 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
windrv_SetPixel, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index b5cb80dce65..ddc39bd1825 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -761,11 +761,6 @@ static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen, const struct brush_p
return pen;
}
-static INT CDECL nulldrv_SetArcDirection( PHYSDEV dev, INT dir )
-{
- return dir;
-}
-
static COLORREF CDECL nulldrv_SetBkColor( PHYSDEV dev, COLORREF color )
{
return color;
@@ -822,21 +817,6 @@ static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF colo
return color;
}
-static INT CDECL nulldrv_SetPolyFillMode( PHYSDEV dev, INT mode )
-{
- return mode;
-}
-
-static INT CDECL nulldrv_SetRelAbs( PHYSDEV dev, INT mode )
-{
- return mode;
-}
-
-static INT CDECL nulldrv_SetStretchBltMode( PHYSDEV dev, INT mode )
-{
- return mode;
-}
-
static INT CDECL nulldrv_SetTextCharacterExtra( PHYSDEV dev, INT extra )
{
return extra;
@@ -980,7 +960,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_SelectFont, /* pSelectFont */
nulldrv_SelectPalette, /* pSelectPalette */
nulldrv_SelectPen, /* pSelectPen */
- nulldrv_SetArcDirection, /* pSetArcDirection */
nulldrv_SetBkColor, /* pSetBkColor */
nulldrv_SetBoundsRect, /* pSetBoundsRect */
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
@@ -992,9 +971,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_SetMapMode, /* pSetMapMode */
nulldrv_SetMapperFlags, /* pSetMapperFlags */
nulldrv_SetPixel, /* pSetPixel */
- nulldrv_SetPolyFillMode, /* pSetPolyFillMode */
- nulldrv_SetRelAbs, /* pSetRelAbs */
- nulldrv_SetStretchBltMode, /* pSetStretchBltMode */
nulldrv_SetTextCharacterExtra, /* pSetTextCharacterExtra */
nulldrv_SetTextColor, /* pSetTextColor */
nulldrv_SetTextJustification, /* pSetTextJustification */
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 3eb01025e50..516c6c4e884 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -127,7 +127,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SelectFont, /* pSelectFont */
EMFDRV_SelectPalette, /* pSelectPalette */
EMFDRV_SelectPen, /* pSelectPen */
- NULL, /* pSetArcDirection */
EMFDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBoundsRect */
EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
@@ -139,9 +138,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SetMapMode, /* pSetMapMode */
EMFDRV_SetMapperFlags, /* pSetMapperFlags */
EMFDRV_SetPixel, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
EMFDRV_SetTextColor, /* pSetTextColor */
EMFDRV_SetTextJustification, /* pSetTextJustification */
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index fd1f25025b6..bbf55724013 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3904,7 +3904,6 @@ const struct gdi_dc_funcs font_driver =
font_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -3916,9 +3915,6 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 12ea0f55948..31a0297c9e3 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -190,7 +190,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SelectFont, /* pSelectFont */
MFDRV_SelectPalette, /* pSelectPalette */
MFDRV_SelectPen, /* pSelectPen */
- NULL, /* pSetArcDirection */
MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBoundsRect, /* pSetBoundsRect */
MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
@@ -202,9 +201,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SetMapMode, /* pSetMapMode */
MFDRV_SetMapperFlags, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */
MFDRV_SetTextColor, /* pSetTextColor */
MFDRV_SetTextJustification, /* pSetTextJustification */
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index b9414967982..8a0369a82d0 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -2165,7 +2165,6 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -2177,9 +2176,6 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c
index dd79e187670..94301a016c6 100644
--- a/dlls/wineandroid.drv/init.c
+++ b/dlls/wineandroid.drv/init.c
@@ -374,7 +374,6 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -386,9 +385,6 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c
index 00f358f0985..7e03c96a256 100644
--- a/dlls/winemac.drv/gdi.c
+++ b/dlls/winemac.drv/gdi.c
@@ -354,7 +354,6 @@ static const struct gdi_dc_funcs macdrv_funcs =
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -366,9 +365,6 @@ static const struct gdi_dc_funcs macdrv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 3bfb085db6b..f18a56671cc 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -868,7 +868,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
PSDRV_SelectPen, /* pSelectPen */
- NULL, /* pSetArcDirection */
PSDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBoundsRect */
PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
@@ -880,9 +879,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
PSDRV_SetPixel, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
PSDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 51924afb9af..0f0e1849e17 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -433,7 +433,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
X11DRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
X11DRV_SelectPen, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
X11DRV_SetBoundsRect, /* pSetBoundsRect */
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
@@ -445,9 +444,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
X11DRV_SetPixel, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index c09c2403631..5949588cd24 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -2245,7 +2245,6 @@ static const struct gdi_dc_funcs xrender_funcs =
xrenderdrv_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
- NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
@@ -2257,9 +2256,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
- NULL, /* pSetPolyFillMode */
- NULL, /* pSetRelAbs */
- NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */
NULL, /* pSetTextJustification */
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 5492fa9d1e5..2d342903cf9 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -158,7 +158,6 @@ struct gdi_dc_funcs
HFONT (CDECL *pSelectFont)(PHYSDEV,HFONT,UINT*);
HPALETTE (CDECL *pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
HPEN (CDECL *pSelectPen)(PHYSDEV,HPEN,const struct brush_pattern*);
- INT (CDECL *pSetArcDirection)(PHYSDEV,INT);
COLORREF (CDECL *pSetBkColor)(PHYSDEV,COLORREF);
UINT (CDECL *pSetBoundsRect)(PHYSDEV,RECT*,UINT);
COLORREF (CDECL *pSetDCBrushColor)(PHYSDEV, COLORREF);
@@ -170,9 +169,6 @@ struct gdi_dc_funcs
INT (CDECL *pSetMapMode)(PHYSDEV,INT);
DWORD (CDECL *pSetMapperFlags)(PHYSDEV,DWORD);
COLORREF (CDECL *pSetPixel)(PHYSDEV,INT,INT,COLORREF);
- INT (CDECL *pSetPolyFillMode)(PHYSDEV,INT);
- INT (CDECL *pSetRelAbs)(PHYSDEV,INT);
- INT (CDECL *pSetStretchBltMode)(PHYSDEV,INT);
INT (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT);
COLORREF (CDECL *pSetTextColor)(PHYSDEV,COLORREF);
BOOL (CDECL *pSetTextJustification)(PHYSDEV,INT,INT);
@@ -199,7 +195,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
-#define WINE_GDI_DRIVER_VERSION 53
+#define WINE_GDI_DRIVER_VERSION 54
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
--
2.25.1
July 29, 2021
[PATCH v2 09/10] gdi32: Store map mode in DC_ATTR.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/gdi32/dc.c | 25 ++++---------------------
dlls/gdi32/driver.c | 2 +-
dlls/gdi32/font.c | 3 ++-
dlls/gdi32/gdidc.c | 9 +++++++++
dlls/gdi32/mapping.c | 22 +++++++++++-----------
dlls/gdi32/ntgdi_private.h | 1 -
include/ntgdi.h | 1 +
7 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 3c9dca8c512..bae1e9d21ab 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -98,7 +98,7 @@ static void set_initial_dc_state( DC *dc )
dc->charExtra = 0;
dc->breakExtra = 0;
dc->breakRem = 0;
- dc->MapMode = MM_TEXT;
+ dc->attr->map_mode = MM_TEXT;
dc->attr->graphics_mode = GM_COMPATIBLE;
dc->attr->cur_pos.x = 0;
dc->attr->cur_pos.y = 0;
@@ -405,7 +405,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
newdc->charExtra = dc->charExtra;
newdc->breakExtra = dc->breakExtra;
newdc->breakRem = dc->breakRem;
- newdc->MapMode = dc->MapMode;
newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
newdc->xformWorld2Vport = dc->xformWorld2Vport;
newdc->xformVport2World = dc->xformVport2World;
@@ -479,9 +478,9 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->charExtra = dcs->charExtra;
dc->breakExtra = dcs->breakExtra;
dc->breakRem = dcs->breakRem;
- dc->MapMode = dcs->MapMode;
- dc->attr->graphics_mode = dcs->attr->graphics_mode;
- dc->attr->cur_pos = dcs->attr->cur_pos;
+ dc->attr->map_mode = dcs->attr->map_mode;
+ dc->attr->graphics_mode = dcs->attr->graphics_mode;
+ dc->attr->cur_pos = dcs->attr->cur_pos;
dc->attr->arc_direction = dcs->attr->arc_direction;
dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
dc->xformWorld2Vport = dcs->xformWorld2Vport;
@@ -1392,22 +1391,6 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
}
-/***********************************************************************
- * GetMapMode (GDI32.@)
- */
-INT WINAPI GetMapMode( HDC hdc )
-{
- INT ret = 0;
- DC * dc = get_dc_ptr( hdc );
- if (dc)
- {
- ret = dc->MapMode;
- release_dc_ptr( dc );
- }
- return ret;
-}
-
-
/***********************************************************************
* GetBrushOrgEx (GDI32.@)
*/
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 851e80b1cd9..b5cb80dce65 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -799,7 +799,7 @@ static DWORD CDECL nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
dc->attr->layout = layout;
if (layout != old_layout)
{
- if (layout & LAYOUT_RTL) dc->MapMode = MM_ANISOTROPIC;
+ if (layout & LAYOUT_RTL) dc->attr->map_mode = MM_ANISOTROPIC;
DC_UpdateXforms( dc );
}
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 6e4a52fec02..fd1f25025b6 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -5995,7 +5995,8 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
TRACE("%p, %d, %d, %08x, %s, %s, %d, %p)\n", hdc, x, y, flags,
wine_dbgstr_rect(lprect), debugstr_wn(str, count), count, lpDx);
- TRACE("align = %x bkmode = %x mapmode = %x\n", align, dc->attr->background_mode, dc->MapMode);
+ TRACE("align = %x bkmode = %x mapmode = %x\n", align, dc->attr->background_mode,
+ dc->attr->map_mode);
if(align & TA_UPDATECP)
{
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 35986dba37e..bbd172239cd 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -164,6 +164,15 @@ DWORD WINAPI GetLayout( HDC hdc )
return dc_attr ? dc_attr->layout : GDI_ERROR;
}
+/***********************************************************************
+ * GetMapMode (GDI32.@)
+ */
+INT WINAPI GetMapMode( HDC hdc )
+{
+ DC_ATTR *dc_attr = get_dc_attr( hdc );
+ return dc_attr ? dc_attr->map_mode : 0;
+}
+
/***********************************************************************
* GetPolyFillMode (GDI32.@)
*/
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index b2148fa3bae..b7a615cbf79 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -117,14 +117,14 @@ BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT
if (size)
*size = dc->vport_ext;
- if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
+ if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->vport_ext.cx = (dc->vport_ext.cx * x_num) / x_denom;
dc->vport_ext.cy = (dc->vport_ext.cy * y_num) / y_denom;
if (dc->vport_ext.cx == 0) dc->vport_ext.cx = 1;
if (dc->vport_ext.cy == 0) dc->vport_ext.cy = 1;
- if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
+ if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@@ -136,14 +136,14 @@ BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_
if (size)
*size = dc->wnd_ext;
- if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
+ if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->wnd_ext.cx = (dc->wnd_ext.cx * x_num) / x_denom;
dc->wnd_ext.cy = (dc->wnd_ext.cy * y_num) / y_denom;
if (dc->wnd_ext.cx == 0) dc->wnd_ext.cx = 1;
if (dc->wnd_ext.cy == 0) dc->wnd_ext.cy = 1;
- if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
+ if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@@ -151,10 +151,10 @@ BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_
INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
{
DC *dc = get_nulldrv_dc( dev );
- INT ret = dc->MapMode;
+ INT ret = dc->attr->map_mode;
SIZE virtual_size, virtual_res;
- if (mode == dc->MapMode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return ret;
+ if (mode == dc->attr->map_mode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return ret;
virtual_size = get_dc_virtual_size( dc );
virtual_res = get_dc_virtual_res( dc );
@@ -203,7 +203,7 @@ INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
return 0;
}
/* RTL layout is always MM_ANISOTROPIC */
- if (!(dc->attr->layout & LAYOUT_RTL)) dc->MapMode = mode;
+ if (!(dc->attr->layout & LAYOUT_RTL)) dc->attr->map_mode = mode;
DC_UpdateXforms( dc );
return ret;
}
@@ -215,11 +215,11 @@ BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
if (size)
*size = dc->vport_ext;
- if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
+ if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->vport_ext.cx = cx;
dc->vport_ext.cy = cy;
- if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
+ if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@@ -244,14 +244,14 @@ BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
if (size)
*size = dc->wnd_ext;
- if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
+ if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->wnd_ext.cx = cx;
dc->wnd_ext.cy = cy;
/* The API docs say that you should call SetWindowExtEx before
SetViewportExtEx. This advice does not imply that Windows
doesn't ensure the isotropic mapping after SetWindowExtEx! */
- if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
+ if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index cb7a8e7f7c9..19a5819f031 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -124,7 +124,6 @@ typedef struct tagDC
INT charExtra; /* Spacing from SetTextCharacterExtra() */
INT breakExtra; /* breakTotalExtra / breakCount */
INT breakRem; /* breakTotalExtra % breakCount */
- INT MapMode;
ABORTPROC pAbortProc; /* AbortProc for Printing */
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */
diff --git a/include/ntgdi.h b/include/ntgdi.h
index a4ed8b6aec9..08df860a5e6 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -111,6 +111,7 @@ typedef struct DC_ATTR
WORD rop_mode;
WORD rel_abs_mode;
WORD stretch_blt_mode;
+ INT map_mode;
void *emf;
} DC_ATTR;
--
2.25.1
July 29, 2021
[PATCH v2 08/10] gdi32: Use get_dc_attr in SetStretchBltMode.
by Huw Davies
From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/gdi32/dc.c | 28 ----------------------------
dlls/gdi32/enhmfdrv/dc.c | 4 ++--
dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 1 -
dlls/gdi32/enhmfdrv/init.c | 2 +-
dlls/gdi32/gdi_private.h | 2 ++
dlls/gdi32/gdidc.c | 23 +++++++++++++++++++++++
dlls/gdi32/mfdrv/dc.c | 4 ++--
dlls/gdi32/mfdrv/init.c | 2 +-
dlls/gdi32/mfdrv/metafiledrv.h | 1 -
9 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 70e7132d0c5..3c9dca8c512 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -1392,34 +1392,6 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
}
-/***********************************************************************
- * SetStretchBltMode (GDI32.@)
- */
-INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
-{
- INT ret = 0;
- DC *dc;
-
- if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
- if ((dc = get_dc_ptr( hdc )))
- {
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetStretchBltMode );
- mode = physdev->funcs->pSetStretchBltMode( physdev, mode );
- if (mode)
- {
- ret = dc->attr->stretch_blt_mode;
- dc->attr->stretch_blt_mode = mode;
- }
- release_dc_ptr( dc );
- }
- return ret;
-}
-
-
/***********************************************************************
* GetMapMode (GDI32.@)
*/
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index 78969c69783..1faf777c47e 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -134,13 +134,13 @@ BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
-INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
+BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode )
{
EMRSETSTRETCHBLTMODE emr;
emr.emr.iType = EMR_SETSTRETCHBLTMODE;
emr.emr.nSize = sizeof(emr);
emr.iMode = mode;
- return EMFDRV_WriteRecord( dev, &emr.emr ) ? mode : 0;
+ return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir )
diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
index 12b39067b2b..981cdea7887 100644
--- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
@@ -123,7 +123,6 @@ extern DWORD CDECL EMFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HID
extern INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
-extern INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetTextJustification( PHYSDEV dev, INT nBreakExtra, INT nBreakCount ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 8f210cb71a3..3eb01025e50 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -141,7 +141,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPolyFillMode */
NULL, /* pSetRelAbs */
- EMFDRV_SetStretchBltMode, /* pSetStretchBltMode */
+ NULL, /* pSetStretchBltMode */
NULL, /* pSetTextCharacterExtra */
EMFDRV_SetTextColor, /* pSetTextColor */
EMFDRV_SetTextJustification, /* pSetTextJustification */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index dec66f69dbc..105d72b23f0 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -71,6 +71,7 @@ extern BOOL METADC_SetPixel( HDC hdc, INT x, INT y, COLORREF color ) DECLSPEC_HI
extern BOOL METADC_SetPolyFillMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetRelAbs( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetROP2( HDC hdc, INT rop ) DECLSPEC_HIDDEN;
+extern BOOL METADC_SetStretchBltMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextAlign( HDC hdc, UINT align ) DECLSPEC_HIDDEN;
/* enhanced metafiles */
@@ -118,6 +119,7 @@ extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) DECLSPEC_HIDDEN;
+extern BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align ) DECLSPEC_HIDDEN;
#endif /* __WINE_GDI_PRIVATE_H */
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index f8a6eea6de5..35986dba37e 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -205,6 +205,29 @@ INT WINAPI GetStretchBltMode( HDC hdc )
return dc_attr ? dc_attr->stretch_blt_mode : 0;
}
+/***********************************************************************
+ * SetStretchBltMode (GDI32.@)
+ */
+INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
+{
+ DC_ATTR *dc_attr;
+ INT ret;
+
+ if (mode <= 0 || mode > MAXSTRETCHBLTMODE)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ if (is_meta_dc( hdc )) return METADC_SetStretchBltMode( hdc, mode );
+ if (!(dc_attr = get_dc_attr( hdc ))) return 0;
+ if (dc_attr->emf && !EMFDC_SetStretchBltMode( dc_attr, mode )) return 0;
+
+ ret = dc_attr->stretch_blt_mode;
+ dc_attr->stretch_blt_mode = mode;
+ return ret;
+}
+
/***********************************************************************
* GetCurrentPositionEx (GDI32.@)
*/
diff --git a/dlls/gdi32/mfdrv/dc.c b/dlls/gdi32/mfdrv/dc.c
index 4b886aaba6d..044e228b2bf 100644
--- a/dlls/gdi32/mfdrv/dc.c
+++ b/dlls/gdi32/mfdrv/dc.c
@@ -65,9 +65,9 @@ BOOL METADC_SetPolyFillMode( HDC hdc, INT mode )
return metadc_param1( hdc, META_SETPOLYFILLMODE, mode );
}
-INT CDECL MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
+BOOL METADC_SetStretchBltMode( HDC hdc, INT mode )
{
- return MFDRV_MetaParam1( dev, META_SETSTRETCHBLTMODE, (WORD)mode) ? mode : 0;
+ return metadc_param1( hdc, META_SETSTRETCHBLTMODE, mode );
}
INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index f8c4153c410..12ea0f55948 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -204,7 +204,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetPixel */
NULL, /* pSetPolyFillMode */
NULL, /* pSetRelAbs */
- MFDRV_SetStretchBltMode, /* pSetStretchBltMode */
+ NULL, /* pSetStretchBltMode */
MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */
MFDRV_SetTextColor, /* pSetTextColor */
MFDRV_SetTextJustification, /* pSetTextJustification */
diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h
index 889cdfbb6a2..567b60158b2 100644
--- a/dlls/gdi32/mfdrv/metafiledrv.h
+++ b/dlls/gdi32/mfdrv/metafiledrv.h
@@ -111,7 +111,6 @@ extern COLORREF CDECL MFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPE
extern DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
-extern INT CDECL MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) DECLSPEC_HIDDEN;
--
2.25.1
July 29, 2021