https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dbca2b2f260790d1e9167…
commit dbca2b2f260790d1e91675738424eac8fc0813ad
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sat Mar 24 13:11:07 2018 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sat Mar 24 13:11:07 2018 +0100
[VERSION_WINETEST] Sync with Wine Staging 3.3. CORE-14434
---
modules/rostests/winetests/version/info.c | 124 ++++++++++++++++++++++
modules/rostests/winetests/version/install.c | 151 +++++++++++++++++++++++++--
2 files changed, 269 insertions(+), 6 deletions(-)
diff --git a/modules/rostests/winetests/version/info.c
b/modules/rostests/winetests/version/info.c
index b99a335d81..6f16999b08 100644
--- a/modules/rostests/winetests/version/info.c
+++ b/modules/rostests/winetests/version/info.c
@@ -578,6 +578,129 @@ 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());
+ 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());
+ 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());
+ 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[] = {
@@ -738,6 +861,7 @@ START_TEST(info)
test_info();
test_32bit_win();
test_VerQueryValueA();
+ test_VerQueryValue_InvalidLength();
test_extra_block();
test_GetFileVersionInfoEx();
}
diff --git a/modules/rostests/winetests/version/install.c
b/modules/rostests/winetests/version/install.c
index 9b84dce492..b06125ff50 100644
--- a/modules/rostests/winetests/version/install.c
+++ b/modules/rostests/winetests/version/install.c
@@ -24,11 +24,13 @@
#include "winbase.h"
#include "winerror.h"
#include "winver.h"
+#include "shlobj.h"
static void test_find_file(void)
{
DWORD ret;
UINT dwCur, dwOut ;
+ char tmp[MAX_PATH];
char appdir[MAX_PATH];
char curdir[MAX_PATH];
char filename[MAX_PATH];
@@ -115,10 +117,11 @@ static void test_find_file(void)
}
}
}
- if(!GetModuleFileNameA(NULL, filename, MAX_PATH) ||
- !GetSystemDirectoryA(windir, MAX_PATH) ||
- !GetTempPathA(MAX_PATH, appdir))
- trace("GetModuleFileNameA, GetSystemDirectoryA or GetTempPathA
failed\n");
+ if(!GetSystemDirectoryA(windir, MAX_PATH) ||
+ !SHGetSpecialFolderPathA(0, appdir, CSIDL_PROGRAM_FILES, FALSE) ||
+ !GetTempPathA(MAX_PATH, tmp) ||
+ !GetTempFileNameA(tmp, "tes", 0, filename))
+ ok(0, "GetSystemDirectoryA, SHGetSpecialFolderPathA, GetTempPathA or
GetTempFileNameA failed\n");
else {
char *p = strrchr(filename, '\\');
if(p) {
@@ -150,7 +153,7 @@ static void test_find_file(void)
memset(outBuf, 0, MAX_PATH);
memset(curdir, 0, MAX_PATH);
ret = VerFindFileA(VFFF_ISSHAREDFILE, filename, NULL, appdir, curdir, &dwCur,
outBuf, &dwOut);
- todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %x expected
VFF_CURNEDEST\n", ret);
+ ok(VFF_CURNEDEST == ret, "Wrong return value got %x expected
VFF_CURNEDEST\n", ret);
ok(dwOut == 1 + strlen(windir), "Wrong length of buffer for current
location: "
"got %d(%s) expected %d\n", dwOut, outBuf, lstrlenA(windir)+1);
@@ -159,9 +162,145 @@ static void test_find_file(void)
memset(outBuf, 0, MAX_PATH);
memset(curdir, 0, MAX_PATH);
ret = VerFindFileA(0, filename, NULL, appdir, curdir, &dwCur, outBuf,
&dwOut);
- todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %x expected
VFF_CURNEDEST\n", ret);
+ ok(VFF_CURNEDEST == ret, "Wrong return value got %x expected
VFF_CURNEDEST\n", ret);
ok(dwOut == 1 + strlen(appdir), "Wrong length of buffer for current
location: "
"got %d(%s) expected %d\n", dwOut, outBuf, lstrlenA(appdir)+1);
+
+ /* search for filename */
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, filename, NULL, NULL, curdir, &dwCur, outBuf,
&dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, filename, NULL, empty, curdir, &dwCur, outBuf,
&dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, filename, NULL, appdir, curdir, &dwCur, outBuf,
&dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, filename, NULL, NULL, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, filename, NULL, empty, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, filename, NULL, appdir, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ /* search for regedit */
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit", NULL, NULL, curdir, &dwCur,
outBuf, &dwOut);
+ ok(!ret, "Wrong return value got %x expected 0\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit", NULL, empty, curdir, &dwCur,
outBuf, &dwOut);
+ ok(!ret, "Wrong return value got %x expected 0\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit", NULL, appdir, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit", NULL, NULL, curdir,
&dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit", NULL, empty, curdir,
&dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit", NULL, appdir, curdir,
&dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ /* search for regedit.exe */
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit.exe", NULL, NULL, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit.exe", NULL, empty, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "regedit.exe", NULL, appdir, curdir, &dwCur,
outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit.exe", NULL, NULL,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit.exe", NULL, empty,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "regedit.exe", NULL, appdir,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ /* nonexistent filename */
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "doesnotexist.exe", NULL, NULL, curdir,
&dwCur, outBuf, &dwOut);
+ ok(!ret, "Wrong return value got %x expected 0\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "doesnotexist.exe", NULL, empty, curdir,
&dwCur, outBuf, &dwOut);
+ ok(!ret, "Wrong return value got %x expected 0\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "doesnotexist.exe", NULL, appdir, curdir,
&dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(0, "doesnotexist.exe", NULL,
"C:\\random_path_does_not_exist", curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "doesnotexist.exe", NULL, NULL,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "doesnotexist.exe", NULL, empty,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "doesnotexist.exe", NULL, appdir,
curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, "doesnotexist.exe", NULL,
"C:\\random_path_does_not_exist", curdir, &dwCur, outBuf, &dwOut);
+ ok(ret & VFF_CURNEDEST, "Wrong return value got %x expected
VFF_CURNEDEST set\n", ret);
+
+ DeleteFileA(filename);
}
}