Added patch with tests for VerQueryValueA (by Mark Jansen).

This commit is contained in:
Sebastian Lackner 2015-03-10 18:16:26 +01:00
parent 538f3aaaea
commit 82b52e11c3
3 changed files with 195 additions and 12 deletions

1
debian/changelog vendored
View File

@ -1,6 +1,7 @@
wine-staging (1.7.39) UNRELEASED; urgency=low
* Added patch for tests of RtlIpv6StringToAddress, RtlIpv{4,6}StringToAddressEx (by Mark Jansen).
* Added patch to fix multithreading issues with fullscreen clipping.
* Added patch with tests for VerQueryValueA (by Mark Jansen).
-- Sebastian Lackner <sebastian@fds-team.de> Mon, 09 Mar 2015 16:52:35 +0100
wine-staging (1.7.38) unstable; urgency=low

View File

@ -193,6 +193,7 @@ patch_enable_all ()
enable_user32_ScrollWindowEx="$1"
enable_user32_WndProc="$1"
enable_vcomp_Stub_Functions="$1"
enable_version_VerQueryValue="$1"
enable_version_VersionInfoEx="$1"
enable_windowscodecs_TIFF_Decoder="$1"
enable_wine_inf_Performance="$1"
@ -622,6 +623,9 @@ patch_enable ()
vcomp-Stub_Functions)
enable_vcomp_Stub_Functions="$2"
;;
version-VerQueryValue)
enable_version_VerQueryValue="$2"
;;
version-VersionInfoEx)
enable_version_VersionInfoEx="$2"
;;
@ -1643,18 +1647,6 @@ if test "$enable_dxgi_GetDesc" -eq 1; then
) >> "$patchlist"
fi
# Patchset makedep-PARENTSPEC
# |
# | Modified files:
# | * tools/makedep.c
# |
if test "$enable_makedep_PARENTSPEC" -eq 1; then
patch_apply makedep-PARENTSPEC/0001-makedep-Add-support-for-PARENTSPEC-Makefile-variable.patch
(
echo '+ { "Sebastian Lackner", "makedep: Add support for PARENTSPEC Makefile variable.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-DllRedirects
# |
# | Modified files:
@ -1675,6 +1667,18 @@ if test "$enable_ntdll_DllRedirects" -eq 1; then
) >> "$patchlist"
fi
# Patchset makedep-PARENTSPEC
# |
# | Modified files:
# | * tools/makedep.c
# |
if test "$enable_makedep_PARENTSPEC" -eq 1; then
patch_apply makedep-PARENTSPEC/0001-makedep-Add-support-for-PARENTSPEC-Makefile-variable.patch
(
echo '+ { "Sebastian Lackner", "makedep: Add support for PARENTSPEC Makefile variable.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Helper
# |
# | Modified files:
@ -3932,6 +3936,18 @@ if test "$enable_vcomp_Stub_Functions" -eq 1; then
) >> "$patchlist"
fi
# Patchset version-VerQueryValue
# |
# | Modified files:
# | * dlls/version/tests/info.c
# |
if test "$enable_version_VerQueryValue" -eq 1; then
patch_apply version-VerQueryValue/0001-version-Test-for-VerQueryValueA-try-2.patch
(
echo '+ { "Mark Jansen", "version: Test for VerQueryValueA.", 2 },';
) >> "$patchlist"
fi
# Patchset version-VersionInfoEx
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,166 @@
From bcc6ed08de4f52715ee6399462cf99b71407b074 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more+wine@gmail.com>
Date: Fri, 27 Feb 2015 21:24:58 +0100
Subject: version: Test for VerQueryValueA (try 2)
This patch supersedes both '[2/2] version: Test for VerQueryValueA'
and '[1/2] version: Fix wrong length reported when selecting a block.
(resend 2)', as it is a better tests, and proves the fix to not work
fully.
The patch shows a difference in handling between wine's VerQueryValue,
and windows' VerQueryValue when selecting a 'BLOCK' object.
Implemented pointer checking and commented the binary structure as
suggested by nsivov from #winehackers.
---
dlls/version/tests/info.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
diff --git a/dlls/version/tests/info.c b/dlls/version/tests/info.c
index 107cfac..1c60cd6 100644
--- a/dlls/version/tests/info.c
+++ b/dlls/version/tests/info.c
@@ -574,6 +574,132 @@ static void test_VerQueryValueA(void)
HeapFree(GetProcessHeap(), 0, ver);
}
+static void test_VerQueryValue_InvalidLength(void)
+{
+ /* this buffer is created with the reactos resource compiler from this resource:
+#include "winver.h"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+FILEFLAGSMASK 63
+FILEFLAGS 0
+FILEOS VOS_UNKNOWN
+FILETYPE VFT_APP
+FILESUBTYPE VFT2_UNKNOWN
+{
+ BLOCK "StringFileInfo"
+ {
+ }
+}
+*/
+ char preparedbuffer[] = {
+ /* VS_VERSION_INFO_STRUCT32 */
+ 0x80, 0x00, /* wLength */
+ 0x34, 0x00, /* wValueLength */
+ 0x00, 0x00, /* wType */
+ /* L"VS_VERSION_INFO" + DWORD alignment */
+ 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f,
+ 0x00, 0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ /* VS_FIXEDFILEINFO */
+ 0xbd, 0x04, 0xef, 0xfe, /* dwSignature */
+ 0x00, 0x00, 0x01, 0x00, /* dwStrucVersion */
+ 0x00, 0x00, 0x01, 0x00, /* dwFileVersionMS */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileVersionLS */
+ 0x00, 0x00, 0x01, 0x00, /* dwProductVersionMS */
+ 0x00, 0x00, 0x00, 0x00, /* dwProductVersionLS */
+ 0x3f, 0x00, 0x00, 0x00, /* dwFileFlagsMask */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileFlags */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileOS */
+ 0x01, 0x00, 0x00, 0x00, /* dwFileType */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileSubtype */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileDateMS */
+ 0x00, 0x00, 0x00, 0x00, /* dwFileDateLS */
+
+ /* first child: */
+ 0x24, 0x00, /* wLength */
+ 0x00, 0x00, /* wValueLength */
+ 0x01, 0x00, /* wType */
+ /* L"StringFileInfo" + DWORD alignment */
+ 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00,
+ 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x00, 0x00,
+ /* "FE2X" */
+ 0x46, 0x45, 0x32, 0x58,
+
+ /* Extra bytes allocated for W->A conversions. */
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba, 0x0d, 0xf0, 0xad, 0xba,
+ };
+ char *p;
+ UINT len, ret;
+ WCHAR FileDescriptionW[] = { '\\', '\\', 'S', 't', 'r', 'i', 'n', 'g', 'F', 'i', 'l', 'e', 'I', 'n', 'f', 'o', 0 };
+
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueA(preparedbuffer, "StringFileInfo", (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueA error %u\n", GetLastError());
+ todo_wine
+ ok(len == 0, "VerQueryValueA returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueA(preparedbuffer, "\\StringFileInfo", (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueA error %u\n", GetLastError());
+ todo_wine
+ ok(len == 0, "VerQueryValueA returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueA(preparedbuffer, "\\\\StringFileInfo", (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueA error %u\n", GetLastError());
+ todo_wine
+ ok(len == 0, "VerQueryValueA returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+
+ /* also test the W versions. */
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueW(preparedbuffer, FileDescriptionW + 2, (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueW error %u\n", GetLastError());
+ ok(len == 0, "VerQueryValueW returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueW(preparedbuffer, FileDescriptionW + 1, (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueW error %u\n", GetLastError());
+ ok(len == 0, "VerQueryValueW returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+
+ p = (char *)0xdeadbeef;
+ len = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = VerQueryValueW(preparedbuffer, FileDescriptionW, (LPVOID *)&p, &len);
+ ok(ret, "VerQueryValueW error %u\n", GetLastError());
+ ok(len == 0, "VerQueryValueW returned %u, expected 0\n", len);
+ todo_wine
+ ok(p == preparedbuffer + 0x7e, "p was %p, expected %p\n", p, preparedbuffer + 0x7e);
+}
+
static void test_extra_block(void)
{
WORD extra_block[] = {
@@ -630,5 +756,6 @@ START_TEST(info)
test_info();
test_32bit_win();
test_VerQueryValueA();
+ test_VerQueryValue_InvalidLength();
test_extra_block();
}
--
2.3.1