mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
[APPHELP_APITEST:db] Fix the test for Win10, use WCHAR for data paths
svn path=/trunk/; revision=75201
This commit is contained in:
parent
41af86fadd
commit
5c59bd330a
|
@ -270,7 +270,7 @@ BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid)
|
|||
*
|
||||
* @return TRUE if it succeeds, FALSE if it fails.
|
||||
*/
|
||||
BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size)
|
||||
BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size)
|
||||
{
|
||||
if (!SdbpCheckTagType(tag, TAG_TYPE_BINARY))
|
||||
return FALSE;
|
||||
|
|
|
@ -32,7 +32,7 @@ BOOL WINAPI SdbWriteDWORDTag(PDB db, TAG tag, DWORD data);
|
|||
BOOL WINAPI SdbWriteQWORDTag(PDB db, TAG tag, QWORD data);
|
||||
BOOL WINAPI SdbWriteStringTag(PDB db, TAG tag, LPCWSTR string);
|
||||
BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid);
|
||||
BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, BYTE* data, DWORD size);
|
||||
BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size);
|
||||
BOOL WINAPI SdbWriteBinaryTagFromFile(PDB db, TAG tag, LPCWSTR path);
|
||||
TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag);
|
||||
BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid);
|
||||
|
|
|
@ -603,7 +603,7 @@ static void test_crc_imp(size_t len, DWORD expected)
|
|||
DWORD num = 333;
|
||||
BOOL ret;
|
||||
|
||||
test_create_file_imp("testxx.exe", crc_test, len);
|
||||
test_create_file_imp(L"testxx.exe", crc_test, len);
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
winetest_ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
|
||||
|
@ -629,7 +629,7 @@ static void test_crc2_imp(size_t len, int fill, DWORD expected)
|
|||
for (n = 0; n < len; ++n)
|
||||
crc_test[n] = (char)(fill ? fill : n);
|
||||
|
||||
test_create_file_imp("testxx.exe", crc_test, len);
|
||||
test_create_file_imp(L"testxx.exe", crc_test, len);
|
||||
free(crc_test);
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -678,7 +678,7 @@ static void test_ApplicationAttributes(void)
|
|||
pSdbFreeFileAttributes(pattrinfo);
|
||||
|
||||
/* Test a file with as much features as possible */
|
||||
test_create_exe("testxx.exe", 0);
|
||||
test_create_exe(L"testxx.exe", 0);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -721,7 +721,7 @@ static void test_ApplicationAttributes(void)
|
|||
|
||||
|
||||
/* Disable resource and exports */
|
||||
test_create_exe("testxx.exe", 1);
|
||||
test_create_exe(L"testxx.exe", 1);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -747,7 +747,7 @@ static void test_ApplicationAttributes(void)
|
|||
pSdbFreeFileAttributes(pattrinfo);
|
||||
|
||||
/* A file with just 'MZ' */
|
||||
test_create_file("testxx.exe", "MZ", 2);
|
||||
test_create_file(L"testxx.exe", "MZ", 2);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -768,7 +768,7 @@ static void test_ApplicationAttributes(void)
|
|||
pSdbFreeFileAttributes(pattrinfo);
|
||||
|
||||
/* Empty file */
|
||||
test_create_file("testxx.exe", NULL, 0);
|
||||
test_create_file(L"testxx.exe", NULL, 0);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -786,7 +786,7 @@ static void test_ApplicationAttributes(void)
|
|||
pSdbFreeFileAttributes(pattrinfo);
|
||||
|
||||
/* minimal NE executable */
|
||||
test_create_ne("testxx.exe", 0);
|
||||
test_create_ne(L"testxx.exe", 0);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
@ -811,7 +811,7 @@ static void test_ApplicationAttributes(void)
|
|||
pSdbFreeFileAttributes(pattrinfo);
|
||||
|
||||
/* NE executable with description / module name pointers zero, to show they are always used */
|
||||
test_create_ne("testxx.exe", 1);
|
||||
test_create_ne(L"testxx.exe", 1);
|
||||
|
||||
ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
|
||||
ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
|
||||
|
|
|
@ -7,11 +7,11 @@ extern "C" {
|
|||
|
||||
|
||||
/* data.c */
|
||||
void test_create_db_imp(const char* name, int win10);
|
||||
void test_create_db_imp(const WCHAR* name, int win10);
|
||||
DWORD test_get_db_size();
|
||||
void test_create_exe_imp(const char* name, int skip_rsrc_exports);
|
||||
void test_create_file_imp(const char* name, const char* contents, size_t len);
|
||||
void test_create_ne_imp(const char* name, int skip_names);
|
||||
void test_create_exe_imp(const WCHAR* name, int skip_rsrc_exports);
|
||||
void test_create_file_imp(const WCHAR* name, const char* contents, size_t len);
|
||||
void test_create_ne_imp(const WCHAR* name, int skip_names);
|
||||
DWORD get_host_winver(void);
|
||||
DWORD get_module_version(HMODULE mod);
|
||||
void silence_debug_output(void); // Silence output if the environment variable is not set.
|
||||
|
|
|
@ -474,14 +474,14 @@ static export_section_t export_dir =
|
|||
};
|
||||
|
||||
|
||||
void test_create_exe_imp(const char* name, int skip_rsrc_exports)
|
||||
void test_create_exe_imp(const WCHAR* name, int skip_rsrc_exports)
|
||||
{
|
||||
HANDLE file;
|
||||
char *buf, *cur;
|
||||
DWORD size = 0x800;
|
||||
buf = malloc(size);
|
||||
|
||||
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
|
||||
if(file == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
@ -522,7 +522,7 @@ void test_create_exe_imp(const char* name, int skip_rsrc_exports)
|
|||
|
||||
|
||||
/* Almost everything in this filetype is ignored, only e_lfanew, ne_restab and ne_nrestab are relevant */
|
||||
void test_create_ne_imp(const char* name, int skip_names)
|
||||
void test_create_ne_imp(const WCHAR* name, int skip_names)
|
||||
{
|
||||
HANDLE file;
|
||||
DWORD size;
|
||||
|
@ -535,7 +535,7 @@ void test_create_ne_imp(const char* name, int skip_names)
|
|||
20,'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0,0,0
|
||||
};
|
||||
|
||||
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
|
||||
if(file == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
@ -554,9 +554,9 @@ void test_create_ne_imp(const char* name, int skip_names)
|
|||
CloseHandle(file);
|
||||
}
|
||||
|
||||
void test_create_file_imp(const char* name, const char* contents, size_t len)
|
||||
void test_create_file_imp(const WCHAR* name, const char* contents, size_t len)
|
||||
{
|
||||
HANDLE file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -777,10 +777,10 @@ DWORD test_get_db_size()
|
|||
return sizeof(rawData);
|
||||
}
|
||||
|
||||
void test_create_db_imp(const char* name, int win10)
|
||||
void test_create_db_imp(const WCHAR* name, int win10)
|
||||
{
|
||||
HANDLE file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", name);
|
||||
HANDLE file = CreateFileW(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", wine_dbgstr_w(name));
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD size;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright 2012 Detlef Riekenberg
|
||||
* Copyright 2013 Mislav Blažević
|
||||
* Copyright 2015,2016 Mark Jansen
|
||||
* Copyright 2015-2017 Mark Jansen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -318,7 +318,11 @@ static void test_Sdb(void)
|
|||
|
||||
/* FIXME: doesnt work on win10?! */
|
||||
pdb = pSdbOpenDatabase(path1, DOS_PATH);
|
||||
ok(pdb != NULL, "unexpected NULL handle\n");
|
||||
if (g_WinVersion < WINVER_WIN10)
|
||||
{
|
||||
/* ERROR,SdbOpenDatabaseEx,845,Failed to open SDB - File size too large or small. */
|
||||
ok(pdb != NULL, "unexpected NULL handle\n");
|
||||
}
|
||||
if (pdb)
|
||||
{
|
||||
binary = (PBYTE)pSdbGetBinaryTagData(pdb, _TAGID_ROOT);
|
||||
|
@ -545,7 +549,7 @@ static void test_stringtable()
|
|||
}
|
||||
}
|
||||
|
||||
static void match_str_attr_imp(PDB pdb, TAGID parent, TAG find, const char* compare)
|
||||
static void match_strw_attr_imp(PDB pdb, TAGID parent, TAG find, const WCHAR* compare)
|
||||
{
|
||||
TAGID attr = pSdbFindFirstTag(pdb, parent, find);
|
||||
winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
|
||||
|
@ -555,9 +559,7 @@ static void match_str_attr_imp(PDB pdb, TAGID parent, TAG find, const char* comp
|
|||
winetest_ok(name != NULL, "Could not convert attr to str.\n");
|
||||
if (name)
|
||||
{
|
||||
char name_a[100];
|
||||
WideCharToMultiByte(CP_ACP, 0, name, -1, name_a, sizeof(name_a), NULL, NULL);
|
||||
winetest_ok(strcmp(name_a, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, compare, name_a);
|
||||
winetest_ok(wcscmp(name, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, wine_dbgstr_w(compare), wine_dbgstr_w(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +599,7 @@ static void match_guid_attr_imp(PDB pdb, TAGID parent, TAG find, const GUID* com
|
|||
}
|
||||
}
|
||||
|
||||
#define match_str_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_str_attr_imp
|
||||
#define match_strw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_strw_attr_imp
|
||||
#define match_dw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_dw_attr_imp
|
||||
#define match_qw_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_qw_attr_imp
|
||||
#define match_guid_attr (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_guid_attr_imp
|
||||
|
@ -631,8 +633,8 @@ static void check_db_properties(PDB pdb, TAGID root)
|
|||
}
|
||||
}
|
||||
match_qw_attr(pdb, root, TAG_TIME, 0x1d1b91a02c0d63e);
|
||||
match_str_attr(pdb, root, TAG_COMPILER_VERSION, "2.1.0.3");
|
||||
match_str_attr(pdb, root, TAG_NAME, "apphelp_test1");
|
||||
match_strw_attr(pdb, root, TAG_COMPILER_VERSION, L"2.1.0.3");
|
||||
match_strw_attr(pdb, root, TAG_NAME, L"apphelp_test1");
|
||||
match_dw_attr(pdb, root, TAG_OS_PLATFORM, 1);
|
||||
}
|
||||
|
||||
|
@ -643,14 +645,14 @@ static void check_db_layer(PDB pdb, TAGID layer)
|
|||
if (!layer)
|
||||
return;
|
||||
|
||||
match_str_attr(pdb, layer, TAG_NAME, "TestNewMode");
|
||||
match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
|
||||
shimref = pSdbFindFirstTag(pdb, layer, TAG_SHIM_REF);
|
||||
ok(shimref != TAGID_NULL, "Expected a valid shim ref, got NULL\n");
|
||||
if (!shimref)
|
||||
return;
|
||||
|
||||
match_str_attr(pdb, shimref, TAG_NAME, "VirtualRegistry");
|
||||
match_str_attr(pdb, shimref, TAG_COMMAND_LINE, "ThemeActive");
|
||||
match_strw_attr(pdb, shimref, TAG_NAME, L"VirtualRegistry");
|
||||
match_strw_attr(pdb, shimref, TAG_COMMAND_LINE, L"ThemeActive");
|
||||
inexclude = pSdbFindFirstTag(pdb, shimref, TAG_INEXCLUD);
|
||||
ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
|
||||
if (!inexclude)
|
||||
|
@ -658,7 +660,7 @@ static void check_db_layer(PDB pdb, TAGID layer)
|
|||
|
||||
is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
|
||||
ok(is_include == TAGID_NULL, "Expected a NULL include ref, but got one anyway.\n");
|
||||
match_str_attr(pdb, inexclude, TAG_MODULE, "exclude.dll");
|
||||
match_strw_attr(pdb, inexclude, TAG_MODULE, L"exclude.dll");
|
||||
|
||||
inexclude = pSdbFindNextTag(pdb, shimref, inexclude);
|
||||
ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
|
||||
|
@ -667,7 +669,7 @@ static void check_db_layer(PDB pdb, TAGID layer)
|
|||
|
||||
is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
|
||||
ok(is_include != TAGID_NULL, "Expected a valid include ref, got NULL\n");
|
||||
match_str_attr(pdb, inexclude, TAG_MODULE, "include.dll");
|
||||
match_strw_attr(pdb, inexclude, TAG_MODULE, L"include.dll");
|
||||
}
|
||||
|
||||
static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num)
|
||||
|
@ -681,11 +683,11 @@ static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num
|
|||
return;
|
||||
|
||||
|
||||
match_str_attr(pdb, matching_file, TAG_NAME, "*");
|
||||
match_str_attr(pdb, matching_file, TAG_COMPANY_NAME, "CompanyName");
|
||||
match_str_attr(pdb, matching_file, TAG_PRODUCT_NAME, "ProductName");
|
||||
match_str_attr(pdb, matching_file, TAG_PRODUCT_VERSION, "1.0.0.1");
|
||||
match_str_attr(pdb, matching_file, TAG_FILE_VERSION, "1.0.0.0");
|
||||
match_strw_attr(pdb, matching_file, TAG_NAME, L"*");
|
||||
match_strw_attr(pdb, matching_file, TAG_COMPANY_NAME, L"CompanyName");
|
||||
match_strw_attr(pdb, matching_file, TAG_PRODUCT_NAME, L"ProductName");
|
||||
match_strw_attr(pdb, matching_file, TAG_PRODUCT_VERSION, L"1.0.0.1");
|
||||
match_strw_attr(pdb, matching_file, TAG_FILE_VERSION, L"1.0.0.0");
|
||||
|
||||
if (num == 0 || num == 3)
|
||||
{
|
||||
|
@ -705,14 +707,14 @@ static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num
|
|||
{
|
||||
match_dw_attr(pdb, matching_file, TAG_SIZE, 0x800);
|
||||
match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0x178bd629);
|
||||
match_str_attr(pdb, matching_file, TAG_FILE_DESCRIPTION, "FileDescription");
|
||||
match_strw_attr(pdb, matching_file, TAG_FILE_DESCRIPTION, L"FileDescription");
|
||||
match_dw_attr(pdb, matching_file, TAG_MODULE_TYPE, 3);
|
||||
match_dw_attr(pdb, matching_file, TAG_VERFILEOS, 4);
|
||||
match_dw_attr(pdb, matching_file, TAG_VERFILETYPE, 1);
|
||||
match_dw_attr(pdb, matching_file, TAG_LINKER_VERSION, 0x40002);
|
||||
match_str_attr(pdb, matching_file, TAG_ORIGINAL_FILENAME, "OriginalFilename");
|
||||
match_str_attr(pdb, matching_file, TAG_INTERNAL_NAME, "InternalName");
|
||||
match_str_attr(pdb, matching_file, TAG_LEGAL_COPYRIGHT, "LegalCopyright");
|
||||
match_strw_attr(pdb, matching_file, TAG_ORIGINAL_FILENAME, L"OriginalFilename");
|
||||
match_strw_attr(pdb, matching_file, TAG_INTERNAL_NAME, L"InternalName");
|
||||
match_strw_attr(pdb, matching_file, TAG_LEGAL_COPYRIGHT, L"LegalCopyright");
|
||||
match_dw_attr(pdb, matching_file, TAG_LINK_DATE, 0x12345);
|
||||
match_dw_attr(pdb, matching_file, TAG_UPTO_LINK_DATE, 0x12345);
|
||||
}
|
||||
|
@ -724,7 +726,7 @@ static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num
|
|||
if (num == 2)
|
||||
{
|
||||
ok(matching_file != TAGID_NULL, "Did expect a secondary match on %d\n", num);
|
||||
match_str_attr(pdb, matching_file, TAG_NAME, "test_checkfile.txt");
|
||||
match_strw_attr(pdb, matching_file, TAG_NAME, L"test_checkfile.txt");
|
||||
match_dw_attr(pdb, matching_file, TAG_SIZE, 0x4);
|
||||
match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0xb0b0b0b0);
|
||||
}
|
||||
|
@ -790,23 +792,23 @@ static void check_matching_layer(PDB pdb, TAGID layer, int num)
|
|||
if (num == 2)
|
||||
{
|
||||
match_dw_attr(pdb, layer, TAG_LAYER_TAGID, 0x18e);
|
||||
match_str_attr(pdb, layer, TAG_NAME, "TestNewMode");
|
||||
match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
TAGID layer_tagid = pSdbFindFirstTag(pdb, layer, TAG_LAYER_TAGID);
|
||||
ok(layer_tagid == TAGID_NULL, "expected not to find a layer tagid, got %x\n", layer_tagid);
|
||||
match_str_attr(pdb, layer, TAG_NAME, "WinSrv03");
|
||||
match_strw_attr(pdb, layer, TAG_NAME, L"WinSrv03");
|
||||
}
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
const char* name;
|
||||
const char* app_name;
|
||||
const char* vendor;
|
||||
const WCHAR* name;
|
||||
const WCHAR* app_name;
|
||||
const WCHAR* vendor;
|
||||
GUID exe_id;
|
||||
const char* extra_file;
|
||||
const WCHAR* extra_file;
|
||||
DWORD dwLayerCount;
|
||||
TAGREF atrExes_0;
|
||||
DWORD adwExeFlags_0;
|
||||
|
@ -815,9 +817,9 @@ static struct
|
|||
const char* env_var;
|
||||
} test_exedata[5] = {
|
||||
{
|
||||
"test_allow.exe",
|
||||
"apphelp_name_allow",
|
||||
"apphelp_vendor_allow",
|
||||
L"test_allow.exe",
|
||||
L"apphelp_name_allow",
|
||||
L"apphelp_vendor_allow",
|
||||
{ 0x4e50c93f, 0xb863, 0x4dfa, { 0xba, 0xe2, 0xd8, 0x0e, 0xf4, 0xce, 0x5c, 0x89 } },
|
||||
NULL,
|
||||
0,
|
||||
|
@ -828,9 +830,9 @@ static struct
|
|||
NULL,
|
||||
},
|
||||
{
|
||||
"test_disallow.exe",
|
||||
"apphelp_name_disallow",
|
||||
"apphelp_vendor_disallow",
|
||||
L"test_disallow.exe",
|
||||
L"apphelp_name_disallow",
|
||||
L"apphelp_vendor_disallow",
|
||||
{ 0x156720e1, 0xef98, 0x4d04, { 0x96, 0x5a, 0xd8, 0x5d, 0xe0, 0x5e, 0x6d, 0x9f } },
|
||||
NULL,
|
||||
0,
|
||||
|
@ -841,11 +843,11 @@ static struct
|
|||
NULL,
|
||||
},
|
||||
{
|
||||
"test_new.exe",
|
||||
"fixnew_name",
|
||||
"fixnew_vendor",
|
||||
L"test_new.exe",
|
||||
L"fixnew_name",
|
||||
L"fixnew_vendor",
|
||||
{ 0xce70ef69, 0xa21d, 0x408b, { 0x84, 0x5b, 0xf9, 0x9e, 0xac, 0x06, 0x09, 0xe7 } },
|
||||
"test_checkfile.txt",
|
||||
L"test_checkfile.txt",
|
||||
1,
|
||||
0x2ec,
|
||||
0,
|
||||
|
@ -854,9 +856,9 @@ static struct
|
|||
NULL,
|
||||
},
|
||||
{
|
||||
"test_w2k3.exe",
|
||||
"fix_name",
|
||||
"fix_vendor",
|
||||
L"test_w2k3.exe",
|
||||
L"fix_name",
|
||||
L"fix_vendor",
|
||||
{ 0xb4ead144, 0xf640, 0x4e4b, { 0x94, 0xc4, 0x0c, 0x7f, 0xa8, 0x66, 0x23, 0xb0 } },
|
||||
NULL,
|
||||
0,
|
||||
|
@ -867,9 +869,9 @@ static struct
|
|||
NULL,
|
||||
},
|
||||
{
|
||||
"test_unknown_file.exe",
|
||||
"apphelp_name_allow",
|
||||
"apphelp_vendor_allow",
|
||||
L"test_unknown_file.exe",
|
||||
L"apphelp_name_allow",
|
||||
L"apphelp_vendor_allow",
|
||||
{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
NULL,
|
||||
1,
|
||||
|
@ -893,9 +895,9 @@ static void check_db_exes(PDB pdb, TAGID root)
|
|||
ok(num < 4, "Too many matches, expected only 4!\n");
|
||||
if (num >= 4)
|
||||
break;
|
||||
match_str_attr(pdb, exe, TAG_NAME, test_exedata[num].name);
|
||||
match_str_attr(pdb, exe, TAG_APP_NAME, test_exedata[num].app_name);
|
||||
match_str_attr(pdb, exe, TAG_VENDOR, test_exedata[num].vendor);
|
||||
match_strw_attr(pdb, exe, TAG_NAME, test_exedata[num].name);
|
||||
match_strw_attr(pdb, exe, TAG_APP_NAME, test_exedata[num].app_name);
|
||||
match_strw_attr(pdb, exe, TAG_VENDOR, test_exedata[num].vendor);
|
||||
match_guid_attr(pdb, exe, TAG_EXE_ID, &test_exedata[num].exe_id);
|
||||
check_matching_file(pdb, exe, pSdbFindFirstTag(pdb, exe, TAG_MATCHING_FILE), num);
|
||||
apphelp = pSdbFindFirstTag(pdb, exe, TAG_APPHELP);
|
||||
|
@ -929,21 +931,21 @@ static void check_db_exes(PDB pdb, TAGID root)
|
|||
static struct
|
||||
{
|
||||
DWORD htmlhelpid;
|
||||
const char* link;
|
||||
const char* apphelp_title;
|
||||
const char* apphelp_details;
|
||||
const WCHAR* link;
|
||||
const WCHAR* apphelp_title;
|
||||
const WCHAR* apphelp_details;
|
||||
} test_layerdata[2] = {
|
||||
{
|
||||
2,
|
||||
"http://reactos.org/disallow",
|
||||
"apphelp_name_disallow",
|
||||
"Not allowed!",
|
||||
L"http://reactos.org/disallow",
|
||||
L"apphelp_name_disallow",
|
||||
L"Not allowed!",
|
||||
},
|
||||
{
|
||||
1,
|
||||
"http://reactos.org/allow",
|
||||
"apphelp_name_allow",
|
||||
"Allow it!",
|
||||
L"http://reactos.org/allow",
|
||||
L"apphelp_name_allow",
|
||||
L"Allow it!",
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -962,10 +964,10 @@ static void check_db_apphelp(PDB pdb, TAGID root)
|
|||
ok(link != TAGID_NULL, "expected to find a link tag\n");
|
||||
if (link != TAGID_NULL)
|
||||
{
|
||||
match_str_attr(pdb, link, TAG_LINK_URL, test_layerdata[num].link);
|
||||
match_strw_attr(pdb, link, TAG_LINK_URL, test_layerdata[num].link);
|
||||
}
|
||||
match_str_attr(pdb, apphelp, TAG_APPHELP_TITLE, test_layerdata[num].apphelp_title);
|
||||
match_str_attr(pdb, apphelp, TAG_APPHELP_DETAILS, test_layerdata[num].apphelp_details);
|
||||
match_strw_attr(pdb, apphelp, TAG_APPHELP_TITLE, test_layerdata[num].apphelp_title);
|
||||
match_strw_attr(pdb, apphelp, TAG_APPHELP_DETAILS, test_layerdata[num].apphelp_details);
|
||||
apphelp = pSdbFindNextTag(pdb, root, apphelp);
|
||||
num++;
|
||||
}
|
||||
|
@ -980,7 +982,7 @@ static void test_CheckDatabaseManually(void)
|
|||
BOOL ret;
|
||||
DWORD ver_hi, ver_lo;
|
||||
|
||||
test_create_db("test_db.sdb", g_WinVersion >= WINVER_WIN10);
|
||||
test_create_db(L"test_db.sdb", g_WinVersion >= WINVER_WIN10);
|
||||
|
||||
/* both ver_hi and ver_lo cannot be null, it'll crash. */
|
||||
ver_hi = ver_lo = 0x12345678;
|
||||
|
@ -1066,6 +1068,29 @@ static void test_is_testdb(PDB pdb)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL IsUserAdmin()
|
||||
{
|
||||
BOOL Result;
|
||||
SID_IDENTIFIER_AUTHORITY NtAuthority = { SECURITY_NT_AUTHORITY };
|
||||
PSID AdministratorsGroup;
|
||||
|
||||
Result = AllocateAndInitializeSid(&NtAuthority, 2,
|
||||
SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
&AdministratorsGroup);
|
||||
if (Result)
|
||||
{
|
||||
if (!CheckTokenMembership( NULL, AdministratorsGroup, &Result))
|
||||
Result = FALSE;
|
||||
FreeSid(AdministratorsGroup);
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename SDBQUERYRESULT_T>
|
||||
static void check_adwExeFlags(DWORD adwExeFlags_0, SDBQUERYRESULT_T& query, const char* file, int line, int cur)
|
||||
{
|
||||
|
@ -1081,10 +1106,9 @@ void check_adwExeFlags(DWORD, SDBQUERYRESULT_2k3&, const char*, int, int)
|
|||
|
||||
|
||||
template<typename SDBQUERYRESULT_T>
|
||||
static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
||||
static void test_mode_generic(const WCHAR* workdir, HSDB hsdb, int cur)
|
||||
{
|
||||
char exename[MAX_PATH], testfile[MAX_PATH];
|
||||
WCHAR exenameW[MAX_PATH];
|
||||
WCHAR exename[MAX_PATH], testfile[MAX_PATH];
|
||||
BOOL ret;
|
||||
SDBQUERYRESULT_T query;
|
||||
PDB pdb;
|
||||
|
@ -1095,17 +1119,16 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
|
||||
memset(&query, 0xab, sizeof(query));
|
||||
|
||||
sprintf(exename, "%s\\%s", workdir, test_exedata[cur].name);
|
||||
swprintf(exename, L"%s\\%s", workdir, test_exedata[cur].name);
|
||||
if (test_exedata[cur].extra_file)
|
||||
sprintf(testfile, "%s\\%s", workdir, test_exedata[cur].extra_file);
|
||||
swprintf(testfile, L"%s\\%s", workdir, test_exedata[cur].extra_file);
|
||||
test_create_exe(exename, 0);
|
||||
MultiByteToWideChar(CP_ACP, 0, exename, -1, exenameW, MAX_PATH);
|
||||
|
||||
if (test_exedata[cur].extra_file)
|
||||
{
|
||||
/* First we try without the file at all. */
|
||||
DeleteFileA(testfile);
|
||||
ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
DeleteFileW(testfile);
|
||||
ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
|
||||
/* Now re-try with the correct file */
|
||||
test_create_file(testfile, "aaaa", 4);
|
||||
|
@ -1113,13 +1136,13 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
|
||||
#if 0
|
||||
// Results seem to be cached based on filename, until we can invalidate this, do not test the same filename twice!
|
||||
DeleteFileA(exename);
|
||||
DeleteFileW(exename);
|
||||
// skip exports
|
||||
test_create_exe(exename, 1);
|
||||
ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, &query);
|
||||
ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
|
||||
|
||||
DeleteFileA(exename);
|
||||
DeleteFileW(exename);
|
||||
test_create_exe(exename, 0);
|
||||
#endif
|
||||
|
||||
|
@ -1128,7 +1151,7 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
SetEnvironmentVariableA("__COMPAT_LAYER", test_exedata[cur].env_var);
|
||||
}
|
||||
|
||||
ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
|
||||
|
||||
exe_count = (test_exedata[cur].env_var == NULL) ? 1 : 0;
|
||||
|
@ -1147,7 +1170,11 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
else if (g_WinVersion < WINVER_WIN10)
|
||||
expect_flags = 0x101;
|
||||
else
|
||||
{
|
||||
expect_flags = 0x121; /* for 2 and 3, this becomes 101 when not elevated. */
|
||||
if ((cur == 2 || cur == 3) && !IsUserAdmin())
|
||||
expect_flags &= ~0x20;
|
||||
}
|
||||
|
||||
if (test_exedata[cur].env_var)
|
||||
expect_flags &= ~0x100;
|
||||
|
@ -1187,7 +1214,7 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
TAG tag = pSdbGetTagFromTagID(pdb, tagid);
|
||||
test_is_testdb(pdb);
|
||||
ok(tag == TAG_EXE, "Expected tag to be TAG_EXE, was 0x%x for %d.\n", tag, cur);
|
||||
match_str_attr(pdb, tagid, TAG_NAME, test_exedata[cur].name);
|
||||
match_strw_attr(pdb, tagid, TAG_NAME, test_exedata[cur].name);
|
||||
|
||||
/* And back again */
|
||||
ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
|
||||
|
@ -1215,7 +1242,7 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
TAG tag = pSdbGetTagFromTagID(pdb, tagid);
|
||||
test_is_testdb(pdb);
|
||||
ok(tag == TAG_LAYER, "Expected tag to be TAG_LAYER, was 0x%x for %d.\n", tag, cur);
|
||||
match_str_attr(pdb, tagid, TAG_NAME, "TestNewMode");
|
||||
match_strw_attr(pdb, tagid, TAG_NAME, L"TestNewMode");
|
||||
|
||||
/* And back again */
|
||||
ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
|
||||
|
@ -1236,17 +1263,26 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
|
||||
|
||||
|
||||
if (RtlDosPathNameToNtPathName_U(exenameW, &exenameNT, NULL, NULL))
|
||||
if (RtlDosPathNameToNtPathName_U(exename, &exenameNT, NULL, NULL))
|
||||
{
|
||||
ret = pSdbGetMatchingExe(hsdb, exenameNT.Buffer, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
if (!ret && g_WinVersion >= WINVER_WIN10)
|
||||
{
|
||||
/*
|
||||
ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion failed 123 [c0000001]
|
||||
ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe [c0000001]
|
||||
*/
|
||||
trace("Using DOS path for Win10\n");
|
||||
ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
|
||||
}
|
||||
ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
|
||||
|
||||
RtlFreeUnicodeString(&exenameNT);
|
||||
}
|
||||
|
||||
if (test_exedata[cur].extra_file)
|
||||
DeleteFileA(testfile);
|
||||
DeleteFileA(exename);
|
||||
DeleteFileW(testfile);
|
||||
DeleteFileW(exename);
|
||||
|
||||
if (test_exedata[cur].env_var)
|
||||
{
|
||||
|
@ -1257,25 +1293,23 @@ static void test_mode_generic(const char* workdir, HSDB hsdb, int cur)
|
|||
template<typename SDBQUERYRESULT_T>
|
||||
static void test_MatchApplications(void)
|
||||
{
|
||||
char workdir[MAX_PATH], dbpath[MAX_PATH];
|
||||
WCHAR dbpathW[MAX_PATH];
|
||||
WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
|
||||
BOOL ret;
|
||||
HSDB hsdb;
|
||||
|
||||
ret = GetTempPathA(MAX_PATH, workdir);
|
||||
ok(ret, "GetTempPathA error: %d\n", GetLastError());
|
||||
lstrcatA(workdir, "apphelp_test");
|
||||
ret = GetTempPathW(_countof(workdir), workdir);
|
||||
ok(ret, "GetTempPathW error: %d\n", GetLastError());
|
||||
wcscat(workdir, L"apphelp_test");
|
||||
|
||||
ret = CreateDirectoryA(workdir, NULL);
|
||||
ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
|
||||
ret = CreateDirectoryW(workdir, NULL);
|
||||
ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
|
||||
|
||||
/* SdbInitDatabase needs an nt-path */
|
||||
sprintf(dbpath, "\\??\\%s\\test.sdb", workdir);
|
||||
swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
|
||||
|
||||
test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, dbpath, -1, dbpathW, MAX_PATH);
|
||||
hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpathW);
|
||||
hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
|
||||
|
||||
ok(hsdb != NULL, "Expected a valid database handle\n");
|
||||
|
||||
|
@ -1292,16 +1326,15 @@ static void test_MatchApplications(void)
|
|||
pSdbReleaseDatabase(hsdb);
|
||||
}
|
||||
|
||||
DeleteFileA(dbpath + 4);
|
||||
DeleteFileW(dbpath + 4);
|
||||
|
||||
ret = RemoveDirectoryA(workdir);
|
||||
ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
|
||||
ret = RemoveDirectoryW(workdir);
|
||||
ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_TagRef(void)
|
||||
{
|
||||
char tmpdir[MAX_PATH], dbpath[MAX_PATH];
|
||||
WCHAR dbpathW[MAX_PATH];
|
||||
WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH];
|
||||
BOOL ret;
|
||||
HSDB hsdb;
|
||||
PDB pdb;
|
||||
|
@ -1309,16 +1342,15 @@ static void test_TagRef(void)
|
|||
DWORD size;
|
||||
TAGREF tr;
|
||||
|
||||
ret = GetTempPathA(MAX_PATH, tmpdir);
|
||||
ret = GetTempPathW(_countof(tmpdir), tmpdir);
|
||||
ok(ret, "GetTempPathA error: %d\n", GetLastError());
|
||||
|
||||
/* SdbInitDatabase needs an nt-path */
|
||||
sprintf(dbpath, "\\??\\%stest.sdb", tmpdir);
|
||||
swprintf(dbpath, L"\\??\\%stest.sdb", tmpdir);
|
||||
|
||||
test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, dbpath, -1, dbpathW, MAX_PATH);
|
||||
hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpathW);
|
||||
hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
|
||||
|
||||
/* HSDB is the only arg that can't be null */
|
||||
ret = pSdbTagRefToTagID(hsdb, 0, NULL, NULL);
|
||||
|
@ -1437,7 +1469,7 @@ static void test_TagRef(void)
|
|||
|
||||
pSdbReleaseDatabase(hsdb);
|
||||
|
||||
DeleteFileA(dbpath + 4);
|
||||
DeleteFileW(dbpath + 4);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue