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
September 2018
- 70 participants
- 1549 messages
[PATCH resend v2 3/4] comctl32/listview: Get rid of useless float cast
by Gabriel Ivăncescu
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v2: Use a signed variable to get rid of some casts.
dlls/comctl32/listview.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 95d619a..6703e6d 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9906,7 +9906,8 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
{
- UINT pulScrollLines = 3;
+ INT pulScrollLines;
+ UINT tmp;
TRACE("(wheelDelta=%d)\n", wheelDelta);
@@ -9923,7 +9924,9 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
break;
case LV_VIEW_DETAILS:
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ tmp = 3;
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
/* if scrolling changes direction, ignore left overs */
if ((wheelDelta < 0 && infoPtr->cWheelRemainder < 0) ||
@@ -9933,10 +9936,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
infoPtr->cWheelRemainder = wheelDelta;
if (infoPtr->cWheelRemainder && pulScrollLines)
{
- int cLineScroll;
+ INT cLineScroll;
pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
- cLineScroll = pulScrollLines * (float)infoPtr->cWheelRemainder / WHEEL_DELTA;
- infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ cLineScroll = (pulScrollLines * infoPtr->cWheelRemainder) / WHEEL_DELTA;
+ infoPtr->cWheelRemainder -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll);
}
break;
--
1.9.1
Sept. 25, 2018
[PATCH resend v2 2/4] user32/edit: Get rid of useless float cast
by Gabriel Ivăncescu
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v2: Use a signed variable to get rid of some casts.
dlls/user32/edit.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 48c65ea..af2084b 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -5098,9 +5098,10 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
case WM_MOUSEWHEEL:
{
- int wheelDelta;
- UINT pulScrollLines = 3;
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ INT wheelDelta, pulScrollLines;
+ UINT tmp = 3;
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
if (wParam & (MK_SHIFT | MK_CONTROL)) {
result = DefWindowProcW(hwnd, msg, wParam, lParam);
@@ -5115,10 +5116,10 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
es->wheelDeltaRemainder = wheelDelta;
if (es->wheelDeltaRemainder && pulScrollLines)
{
- int cLineScroll;
- pulScrollLines = (int) min((UINT) es->line_count, pulScrollLines);
- cLineScroll = pulScrollLines * (float)es->wheelDeltaRemainder / WHEEL_DELTA;
- es->wheelDeltaRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ INT cLineScroll;
+ pulScrollLines = min((UINT)es->line_count, pulScrollLines);
+ cLineScroll = (pulScrollLines * es->wheelDeltaRemainder) / WHEEL_DELTA;
+ es->wheelDeltaRemainder -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
result = EDIT_EM_LineScroll(es, 0, -cLineScroll);
}
}
--
1.9.1
Sept. 25, 2018
[PATCH resend v2 1/4] comctl32/edit: Get rid of useless float cast
by Gabriel Ivăncescu
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v2: Use a signed variable to get rid of some casts.
dlls/comctl32/edit.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index f0180ad..3f2e48c 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -4906,9 +4906,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case WM_MOUSEWHEEL:
{
- int wheelDelta;
- UINT pulScrollLines = 3;
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ INT wheelDelta, pulScrollLines;
+ UINT tmp = 3;
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
if (wParam & (MK_SHIFT | MK_CONTROL))
{
@@ -4926,10 +4927,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if (es->wheelDeltaRemainder && pulScrollLines)
{
- int cLineScroll;
- pulScrollLines = (int) min((UINT) es->line_count, pulScrollLines);
- cLineScroll = pulScrollLines * (float)es->wheelDeltaRemainder / WHEEL_DELTA;
- es->wheelDeltaRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ INT cLineScroll;
+ pulScrollLines = min((UINT)es->line_count, pulScrollLines);
+ cLineScroll = (pulScrollLines * es->wheelDeltaRemainder) / WHEEL_DELTA;
+ es->wheelDeltaRemainder -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
result = EDIT_EM_LineScroll(es, 0, -cLineScroll);
}
break;
--
1.9.1
Sept. 25, 2018
[PATCH resend v2 2/2] user32/listbox: Handle Mouse Wheel scrolling for multi-column listboxes properly
by Gabriel Ivăncescu
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22253
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
dlls/user32/listbox.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index c8bd148..a30fee5 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -2000,9 +2000,11 @@ static LRESULT LISTBOX_HandleHScroll( LB_DESCR *descr, WORD scrollReq, WORD pos
static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta )
{
- UINT pulScrollLines = 3;
+ INT pulScrollLines;
+ UINT tmp = 3;
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
/* if scrolling changes direction, ignore left overs */
if ((delta < 0 && descr->wheel_remain < 0) ||
@@ -2013,10 +2015,21 @@ static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta )
if (descr->wheel_remain && pulScrollLines)
{
- int cLineScroll;
- pulScrollLines = min((UINT) descr->page_size, pulScrollLines);
- cLineScroll = pulScrollLines * (float)descr->wheel_remain / WHEEL_DELTA;
- descr->wheel_remain -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ INT cLineScroll;
+ if (descr->style & LBS_MULTICOLUMN)
+ {
+ pulScrollLines = min((UINT)descr->width / descr->column_width, pulScrollLines);
+ pulScrollLines = max(1U, pulScrollLines);
+ cLineScroll = (pulScrollLines * descr->wheel_remain) / WHEEL_DELTA;
+ descr->wheel_remain -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
+ cLineScroll *= descr->page_size;
+ }
+ else
+ {
+ pulScrollLines = min((UINT)descr->page_size, pulScrollLines);
+ cLineScroll = (pulScrollLines * descr->wheel_remain) / WHEEL_DELTA;
+ descr->wheel_remain -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
+ }
LISTBOX_SetTopItem( descr, descr->top_item - cLineScroll, TRUE );
}
return 0;
--
1.9.1
Sept. 25, 2018
[PATCH resend v2 1/2] comctl32/listbox: Handle Mouse Wheel scrolling for multi-column listboxes properly
by Gabriel Ivăncescu
Multi-column listboxes scroll horizontally, so each wheel tick must go an
entire page at a time instead of an item at a time. But we have to limit
the amount of scrolling in this case to avoid "jumping over" columns,
if the window is too small. This matches Windows behavior.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22253
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v2: Use a signed variable to get rid of some casts.
The calculation has also been simplified to just integer arithmetic in all
cases, since the division (the only operation with a fractional result) was
immediately truncated to integer anyway, so the float cast was useless. This
works fine because the multiplication is done before the division (parentheses
have been added to emphasize this point).
dlls/comctl32/listbox.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 2137ef8..7aa273a 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1995,9 +1995,11 @@ static LRESULT LISTBOX_HandleHScroll( LB_DESCR *descr, WORD scrollReq, WORD pos
static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta )
{
- UINT pulScrollLines = 3;
+ INT pulScrollLines;
+ UINT tmp = 3;
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
/* if scrolling changes direction, ignore left overs */
if ((delta < 0 && descr->wheel_remain < 0) ||
@@ -2008,10 +2010,21 @@ static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta )
if (descr->wheel_remain && pulScrollLines)
{
- int cLineScroll;
- pulScrollLines = min((UINT) descr->page_size, pulScrollLines);
- cLineScroll = pulScrollLines * (float)descr->wheel_remain / WHEEL_DELTA;
- descr->wheel_remain -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ INT cLineScroll;
+ if (descr->style & LBS_MULTICOLUMN)
+ {
+ pulScrollLines = min((UINT)descr->width / descr->column_width, pulScrollLines);
+ pulScrollLines = max(1U, pulScrollLines);
+ cLineScroll = (pulScrollLines * descr->wheel_remain) / WHEEL_DELTA;
+ descr->wheel_remain -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
+ cLineScroll *= descr->page_size;
+ }
+ else
+ {
+ pulScrollLines = min((UINT)descr->page_size, pulScrollLines);
+ cLineScroll = (pulScrollLines * descr->wheel_remain) / WHEEL_DELTA;
+ descr->wheel_remain -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
+ }
LISTBOX_SetTopItem( descr, descr->top_item - cLineScroll, TRUE );
}
return 0;
--
1.9.1
Sept. 25, 2018
[PATCH] testbot: Better check for the "No build or test VM" disposition.
by Francois Gouget
Use a direct test instead of an indirect one.
Also the $Impacts->{UnitCount} field has been renamed.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/Patches.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 469fedcdc..96e4a0dda 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -266,7 +266,7 @@ sub Submit($$$)
if ($NewJob->Steps->IsEmpty())
{
# This may be a Wine patch but there is no suitable VM to test it!
- if ($Impacts->{UnitCount})
+ if ($BuildVMs->IsEmpty() and $WineVMs->IsEmpty())
{
$self->Disposition("No build or test VM!");
}
--
2.19.0
Sept. 25, 2018
[PATCH] testbot/web: Avoid race conditions when submitting jobs.
by Francois Gouget
Rename the patch so one instance of Submit.pl gets exclusive access to
it and only one job gets created.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/web/Submit.pl | 52 ++++++++++++++++++++++++++++++++-----------
1 file changed, 39 insertions(+), 13 deletions(-)
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index ae4aca3dd..9ad8fd5e0 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -745,13 +745,9 @@ sub OnPrev($)
return $self->{Page} == 3 ? $self->OnPage3Prev() : $self->OnPage2Prev();
}
-sub OnSubmit($)
+sub SubmitJob($$$)
{
- my ($self) = @_;
-
- return !1 if (!$self->Validate());
- my $BaseName = $self->ValidateAndGetFileName("FileName");
- return !1 if (!$BaseName);
+ my ($self, $BaseName, $Staging) = @_;
# See also Patches::Submit() in lib/WineTestBot/Patches.pm
@@ -778,11 +774,7 @@ sub OnSubmit($)
# Add steps and tasks for the 32 and 64-bit tests
my $FileType = $self->GetParam("FileType");
my $Impacts;
- if ($FileType eq "patch")
- {
- my $TmpStagingFullPath = $self->GetTmpStagingFullPath($BaseName);
- $Impacts = GetPatchImpacts($TmpStagingFullPath);
- }
+ $Impacts = GetPatchImpacts($Staging) if ($FileType eq "patch");
my $BuildStep;
foreach my $Bits ("32", "64")
@@ -913,8 +905,7 @@ sub OnSubmit($)
}
# Stage the test patch/executable so the job can pick it up
- my $TmpStagingFullPath = $self->GetTmpStagingFullPath($BaseName);
- if (!rename($TmpStagingFullPath, "$DataDir/staging/job". $NewJob->Id ."_$BaseName"))
+ if (!rename($Staging, "$DataDir/staging/job". $NewJob->Id ."_$BaseName"))
{
$self->{ErrMessage} = "Could not stage '$BaseName': $!\n";
return !1;
@@ -943,6 +934,41 @@ sub OnSubmit($)
exit;
}
+sub OnSubmit($)
+{
+ my ($self) = @_;
+
+ return !1 if (!$self->Validate());
+ my $BaseName = $self->ValidateAndGetFileName("FileName");
+ return !1 if (!$BaseName);
+
+ # Rename the staging file to avoid race conditions if the user clicks on
+ # Submit multiple times
+ my $OldStaging = $self->GetTmpStagingFullPath($BaseName);
+ my $Staging = CreateNewLink($OldStaging, "$DataDir/staging", $BaseName);
+ if (!defined $Staging)
+ {
+ $self->{ErrMessage} = "Could not rename '$BaseName': $!";
+ return !1;
+ }
+ if (!unlink $OldStaging)
+ {
+ unlink $Staging;
+ $self->{ErrMessage} = $!{ENOENT} ?
+ "$BaseName has already been submitted or has expired" :
+ "Could not remove the staging '$BaseName' file: $!";
+ return !1;
+ }
+
+ if (!$self->SubmitJob($BaseName, $Staging))
+ {
+ # Restore the file for the next attempt
+ rename($Staging, $OldStaging);
+ return !1;
+ }
+ return 1;
+}
+
sub OnShowAllVMs($)
{
my ($self) = @_;
--
2.19.0
Sept. 25, 2018
[PATCH] testbot: Retry updating the wine / build VMs after a timeout.
by Francois Gouget
In case of a regular build failure, retrying is pointless. But in case
of a timeout the VM host may be less busy next time and since the
snapshot is unchanged we can retry.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/WineRunReconfig.pl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 19f5ed467..6dd131826 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -481,4 +481,7 @@ if ($NewStatus eq 'completed')
# Wrap up
#
-WrapUpAndExit($NewStatus, undef, $TaskTimedOut);
+# In case of a regular build failure retrying is pointless. But in case of a
+# timeout the VM host may be less busy next time and since the snapshot is
+# unchanged we can retry.
+WrapUpAndExit($NewStatus, $TaskTimedOut, $TaskTimedOut);
--
2.19.0
Sept. 25, 2018
[PATCH] crypt32/base64: Fix certificate request header and trailer in CryptBinaryToStringW() output.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/crypt32/base64.c | 4 +-
dlls/crypt32/tests/base64.c | 226 +++++++++++++++++++++++++-----------
2 files changed, 159 insertions(+), 71 deletions(-)
diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c
index 2ba8055961..bc30779098 100644
--- a/dlls/crypt32/base64.c
+++ b/dlls/crypt32/base64.c
@@ -53,10 +53,10 @@ static const WCHAR CERT_TRAILER_START_W[] = {
'-','-','-','-','-','E','N','D',' ',0 };
static const WCHAR CERT_REQUEST_HEADER_W[] = {
'-','-','-','-','-','B','E','G','I','N',' ','N','E','W',' ','C','E','R','T',
-'I','F','I','C','A','T','E','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
+'I','F','I','C','A','T','E',' ','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
static const WCHAR CERT_REQUEST_TRAILER_W[] = {
'-','-','-','-','-','E','N','D',' ','N','E','W',' ','C','E','R','T','I','F',
-'I','C','A','T','E','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
+'I','C','A','T','E',' ','R','E','Q','U','E','S','T','-','-','-','-','-',0 };
static const WCHAR X509_HEADER_W[] = {
'-','-','-','-','-','B','E','G','I','N',' ','X','5','0','9',' ','C','R','L',
'-','-','-','-','-',0 };
diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c
index 633e6d1775..7bc1ec7d0e 100644
--- a/dlls/crypt32/tests/base64.c
+++ b/dlls/crypt32/tests/base64.c
@@ -20,11 +20,10 @@
*/
#include <stdio.h>
#include <stdarg.h>
-#include <windef.h>
-#include <winbase.h>
-#include <winerror.h>
+#include <windows.h>
#include <wincrypt.h>
+#include "wine/heap.h"
#include "wine/test.h"
#define CERT_HEADER "-----BEGIN CERTIFICATE-----\r\n"
@@ -81,6 +80,19 @@ static const struct BinTests testsNoCR[] = {
"SElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkwAA==\n" },
};
+static WCHAR *strdupAtoW(const char *str)
+{
+ WCHAR *ret = NULL;
+ DWORD len;
+
+ if (!str) return ret;
+ len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+ ret = heap_alloc(len * sizeof(WCHAR));
+ if (ret)
+ MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+ return ret;
+}
+
static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
DWORD format, const char *expected, const char *header, const char *trailer)
{
@@ -117,93 +129,169 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
}
}
-static void testBinaryToStringA(void)
+static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWORD format,
+ const WCHAR *expected, const char *header, const char *trailer)
+{
+ WCHAR *headerW, *trailerW;
+ DWORD strLen = 0, strLen2;
+ const WCHAR *ptr;
+ WCHAR *strW;
+ BOOL ret;
+
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen);
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+
+ strLen2 = strLen;
+ strW = heap_alloc(strLen * sizeof(WCHAR));
+ ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen);
+
+ headerW = strdupAtoW(header);
+ trailerW = strdupAtoW(trailer);
+
+ ptr = strW;
+ if (headerW)
+ {
+ ok(!memcmp(headerW, ptr, lstrlenW(headerW)), "Expected header %s, got %s.\n", wine_dbgstr_w(headerW),
+ wine_dbgstr_w(ptr));
+ ptr += lstrlenW(headerW);
+ }
+ ok(!memcmp(expected, ptr, lstrlenW(expected)), "Expected %s, got %s.\n", wine_dbgstr_w(expected),
+ wine_dbgstr_w(ptr));
+ ptr += lstrlenW(expected);
+ if (trailerW)
+ ok(!memcmp(trailerW, ptr, lstrlenW(trailerW)), "Expected trailer %s, got %s.\n", wine_dbgstr_w(trailerW),
+ wine_dbgstr_w(ptr));
+
+ heap_free(strW);
+ heap_free(headerW);
+ heap_free(trailerW);
+}
+
+static void test_CryptBinaryToString(void)
{
+ DWORD strLen, strLen2, i;
BOOL ret;
- DWORD strLen = 0, i;
ret = CryptBinaryToStringA(NULL, 0, 0, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+ strLen = 123;
ret = CryptBinaryToStringA(NULL, 0, 0, NULL, &strLen);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ ok(strLen == 123, "Unexpected length.\n");
+
+ if (0)
+ ret = CryptBinaryToStringW(NULL, 0, 0, NULL, NULL);
+
+ strLen = 123;
+ ret = CryptBinaryToStringW(NULL, 0, 0, NULL, &strLen);
+ ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected error %d\n", GetLastError());
+ ok(strLen == 123, "Unexpected length.\n");
+
for (i = 0; i < ARRAY_SIZE(tests); i++)
{
- DWORD strLen = 0;
+ WCHAR *strW, *encodedW;
LPSTR str = NULL;
BOOL ret;
- ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BINARY, NULL, &strLen);
+ strLen = 0;
+ ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- str = HeapAlloc(GetProcessHeap(), 0, strLen);
- if (str)
- {
- DWORD strLen2 = strLen;
-
- ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BINARY, str, &strLen2);
- ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
- strLen2);
- ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen),
- "Unexpected value\n");
- HeapFree(GetProcessHeap(), 0, str);
- }
- encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BASE64, tests[i].base64, NULL, NULL);
- encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BASE64HEADER, tests[i].base64, CERT_HEADER,
- CERT_TRAILER);
- encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BASE64REQUESTHEADER, tests[i].base64,
- CERT_REQUEST_HEADER, CERT_REQUEST_TRAILER);
- encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen,
- CRYPT_STRING_BASE64X509CRLHEADER, tests[i].base64, X509_HEADER,
- X509_TRAILER);
+ ok(strLen == tests[i].toEncodeLen, "Unexpected required length %u.\n", strLen);
+
+ strLen2 = strLen;
+ str = heap_alloc(strLen);
+ ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, str, &strLen2);
+ ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Expected length %u, got %u\n", strLen, strLen2);
+ ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n");
+ heap_free(str);
+
+ strLen = 0;
+ ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, NULL, &strLen);
+ todo_wine {
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen == tests[i].toEncodeLen, "Unexpected required length %u.\n", strLen);
}
+ strLen2 = strLen;
+ strW = heap_alloc(strLen);
+ ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, strW, &strLen2);
+ todo_wine
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Expected length %u, got %u\n", strLen, strLen2);
+ todo_wine
+ ok(!memcmp(strW, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n");
+ heap_free(strW);
+
+ encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64,
+ tests[i].base64, NULL, NULL);
+ encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64HEADER,
+ tests[i].base64, CERT_HEADER, CERT_TRAILER);
+ encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64REQUESTHEADER,
+ tests[i].base64, CERT_REQUEST_HEADER, CERT_REQUEST_TRAILER);
+ encodeAndCompareBase64_A(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64X509CRLHEADER,
+ tests[i].base64, X509_HEADER, X509_TRAILER);
+
+ encodedW = strdupAtoW(tests[i].base64);
+
+ encode_compare_base64_W(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64, encodedW, NULL, NULL);
+ encode_compare_base64_W(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64HEADER, encodedW,
+ CERT_HEADER, CERT_TRAILER);
+ encode_compare_base64_W(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64REQUESTHEADER,
+ encodedW, CERT_REQUEST_HEADER, CERT_REQUEST_TRAILER);
+ encode_compare_base64_W(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BASE64X509CRLHEADER, encodedW,
+ X509_HEADER, X509_TRAILER);
+
+ heap_free(encodedW);
+ }
+
for (i = 0; i < ARRAY_SIZE(testsNoCR); i++)
{
- DWORD strLen = 0;
LPSTR str = NULL;
+ WCHAR *encodedW;
BOOL ret;
- ret = CryptBinaryToStringA(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
- NULL, &strLen);
+ ret = CryptBinaryToStringA(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- str = HeapAlloc(GetProcessHeap(), 0, strLen);
- if (str)
- {
- DWORD strLen2 = strLen;
-
- ret = CryptBinaryToStringA(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen, CRYPT_STRING_BINARY | CRYPT_STRING_NOCR,
- str, &strLen2);
- ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
- ok(strLen == strLen2, "Expected length %d, got %d\n", strLen,
- strLen2);
- ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen),
- "Unexpected value\n");
- HeapFree(GetProcessHeap(), 0, str);
- }
- encodeAndCompareBase64_A(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR,
- testsNoCR[i].base64, NULL, NULL);
- encodeAndCompareBase64_A(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen,
- CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, testsNoCR[i].base64,
- CERT_HEADER_NOCR, CERT_TRAILER_NOCR);
- encodeAndCompareBase64_A(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen,
- CRYPT_STRING_BASE64REQUESTHEADER | CRYPT_STRING_NOCR,
- testsNoCR[i].base64, CERT_REQUEST_HEADER_NOCR,
- CERT_REQUEST_TRAILER_NOCR);
- encodeAndCompareBase64_A(testsNoCR[i].toEncode,
- testsNoCR[i].toEncodeLen,
- CRYPT_STRING_BASE64X509CRLHEADER | CRYPT_STRING_NOCR,
- testsNoCR[i].base64, X509_HEADER_NOCR, X509_TRAILER_NOCR);
+
+ strLen2 = strLen;
+ str = heap_alloc(strLen);
+ ret = CryptBinaryToStringA(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, str, &strLen2);
+ ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
+ ok(strLen == strLen2, "Expected length %d, got %d\n", strLen, strLen2);
+ ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen), "Unexpected value\n");
+ heap_free(str);
+
+ encodeAndCompareBase64_A(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR,
+ testsNoCR[i].base64, NULL, NULL);
+ encodeAndCompareBase64_A(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, testsNoCR[i].base64, CERT_HEADER_NOCR, CERT_TRAILER_NOCR);
+ encodeAndCompareBase64_A(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64REQUESTHEADER | CRYPT_STRING_NOCR, testsNoCR[i].base64, CERT_REQUEST_HEADER_NOCR,
+ CERT_REQUEST_TRAILER_NOCR);
+ encodeAndCompareBase64_A(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64X509CRLHEADER | CRYPT_STRING_NOCR, testsNoCR[i].base64, X509_HEADER_NOCR, X509_TRAILER_NOCR);
+
+ encodedW = strdupAtoW(testsNoCR[i].base64);
+
+ encode_compare_base64_W(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, encodedW, NULL, NULL);
+ encode_compare_base64_W(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, encodedW, CERT_HEADER_NOCR, CERT_TRAILER_NOCR);
+ encode_compare_base64_W(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64REQUESTHEADER | CRYPT_STRING_NOCR, encodedW, CERT_REQUEST_HEADER_NOCR,
+ CERT_REQUEST_TRAILER_NOCR);
+ encode_compare_base64_W(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
+ CRYPT_STRING_BASE64X509CRLHEADER | CRYPT_STRING_NOCR, encodedW,
+ X509_HEADER_NOCR, X509_TRAILER_NOCR);
+
+ heap_free(encodedW);
}
}
@@ -545,6 +633,6 @@ static void testStringToBinaryA(void)
START_TEST(base64)
{
- testBinaryToStringA();
+ test_CryptBinaryToString();
testStringToBinaryA();
}
--
2.19.0
Sept. 25, 2018
Re: [PATCH] quartz: Don't round a <1sec difference to 0 in WAVEParserImpl_seek
by Andrew Eikum
I agree this seems weird, but that makes me wonder why it's there in
the first place. I've kind of lost track of the quartz interfaces; can
you write a test for this? E.g. Set two positions near each other and
Get to verify it changed.
I also noticed MPEGSplitter_seek and AVISplitter_seek have similar
code. I think writing a test for one and duplicating that logic in the
others would be fine.
Andrew
On Sun, Sep 23, 2018 at 02:22:26PM -0600, Alex Henrie wrote:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34302
> Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
> ---
> For some reason, the game sets the audio stream position to a negative
> value, then seeks to 0. If Wine decides that it doesn't actually need to
> do the seek operation, it then reads garbage data from the negative
> offset.
>
> Unfortunately, there is still another bug with the audio in this game:
> Wine keeps reading past the end of the audio stream, causing a crash at
> the end of the audio clip.
> ---
> dlls/quartz/waveparser.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c
> index fa9cd45d27..995e43196d 100644
> --- a/dlls/quartz/waveparser.c
> +++ b/dlls/quartz/waveparser.c
> @@ -211,10 +211,9 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
> return E_INVALIDARG;
> }
>
> - if (curpos/1000000 == newpos/1000000)
> + if (curpos == newpos)
> {
> - TRACE("Requesting position %s same as current position %s\n",
> - wine_dbgstr_longlong(newpos), wine_dbgstr_longlong(curpos));
> + TRACE("Requesting position %s same as current position\n", wine_dbgstr_longlong(newpos));
> return S_OK;
> }
>
> --
> 2.19.0
>
Sept. 25, 2018