2003-12-04 03:01:39 +01:00
|
|
|
/*
|
|
|
|
* Wine Conformance Test EXE
|
|
|
|
*
|
2004-12-22 15:50:50 +01:00
|
|
|
* Copyright 2003, 2004 Jakob Eriksson (for Solid Form Sweden AB)
|
2003-12-04 03:01:39 +01:00
|
|
|
* Copyright 2003 Dimitrie O. Paun
|
|
|
|
* Copyright 2003 Ferenc Wagner
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-12-04 03:01:39 +01:00
|
|
|
*
|
|
|
|
* This program is dedicated to Anna Lindh,
|
|
|
|
* Swedish Minister of Foreign Affairs.
|
|
|
|
* Anna was murdered September 11, 2003.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-02-19 12:55:23 +01:00
|
|
|
#define COBJMACROS
|
2003-12-04 03:01:39 +01:00
|
|
|
#include <stdio.h>
|
2005-03-10 18:17:35 +01:00
|
|
|
#include <assert.h>
|
2003-12-04 03:01:39 +01:00
|
|
|
#include <windows.h>
|
2021-06-16 04:33:57 +02:00
|
|
|
#include <commctrl.h>
|
2014-10-07 19:52:59 +02:00
|
|
|
#include <winternl.h>
|
2009-02-19 12:55:23 +01:00
|
|
|
#include <mshtml.h>
|
2003-12-04 03:01:39 +01:00
|
|
|
|
|
|
|
#include "winetest.h"
|
2004-06-16 00:45:15 +02:00
|
|
|
#include "resource.h"
|
2004-01-15 02:48:05 +01:00
|
|
|
|
2010-12-09 12:19:08 +01:00
|
|
|
/* Don't submit the results if more than SKIP_LIMIT tests have been skipped */
|
|
|
|
#define SKIP_LIMIT 10
|
|
|
|
|
2011-04-22 13:20:49 +02:00
|
|
|
/* Don't submit the results if more than FAILURES_LIMIT tests have failed */
|
|
|
|
#define FAILURES_LIMIT 50
|
|
|
|
|
2003-12-04 03:01:39 +01:00
|
|
|
struct wine_test
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int subtest_count;
|
|
|
|
char **subtests;
|
|
|
|
char *exename;
|
2009-02-25 11:56:31 +01:00
|
|
|
char *maindllpath;
|
2003-12-04 03:01:39 +01:00
|
|
|
};
|
|
|
|
|
2005-03-31 17:22:41 +02:00
|
|
|
char *tag = NULL;
|
2010-09-28 20:12:10 +02:00
|
|
|
char *description = NULL;
|
2010-11-21 16:43:18 +01:00
|
|
|
char *url = NULL;
|
2010-02-06 10:21:22 +01:00
|
|
|
char *email = NULL;
|
2010-06-22 19:36:08 +02:00
|
|
|
BOOL aborting = FALSE;
|
2004-01-15 02:48:05 +01:00
|
|
|
static struct wine_test *wine_tests;
|
2010-12-09 12:19:08 +01:00
|
|
|
static int nr_of_files, nr_of_tests, nr_of_skips;
|
2009-10-26 13:38:05 +01:00
|
|
|
static int nr_native_dlls;
|
2004-09-07 21:33:52 +02:00
|
|
|
static const char whitespace[] = " \t\r\n";
|
2007-08-03 12:59:36 +02:00
|
|
|
static const char testexe[] = "_test.exe";
|
2008-05-27 11:48:50 +02:00
|
|
|
static char build_id[64];
|
2010-12-27 14:45:17 +01:00
|
|
|
static BOOL is_wow64;
|
2011-04-22 13:20:49 +02:00
|
|
|
static int failures;
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2008-11-19 12:19:42 +01:00
|
|
|
/* filters for running only specific tests */
|
|
|
|
static char *filters[64];
|
|
|
|
static unsigned int nb_filters = 0;
|
2010-09-28 20:10:46 +02:00
|
|
|
static BOOL exclude_tests = FALSE;
|
2008-11-19 12:19:42 +01:00
|
|
|
|
2009-02-03 20:45:34 +01:00
|
|
|
/* Needed to check for .NET dlls */
|
|
|
|
static HMODULE hmscoree;
|
|
|
|
static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR, LPCWSTR, LPVOID, HMODULE *);
|
|
|
|
|
2010-07-17 08:48:42 +02:00
|
|
|
/* For SxS DLLs e.g. msvcr90 */
|
|
|
|
static HANDLE (WINAPI *pCreateActCtxA)(PACTCTXA);
|
|
|
|
static BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR *);
|
|
|
|
static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
|
|
|
|
static void (WINAPI *pReleaseActCtx)(HANDLE);
|
|
|
|
|
2009-02-25 11:56:31 +01:00
|
|
|
/* To store the current PATH setting (related to .NET only provided dlls) */
|
|
|
|
static char *curpath;
|
|
|
|
|
2008-11-19 12:19:42 +01:00
|
|
|
/* check if test is being filtered out */
|
|
|
|
static BOOL test_filtered_out( LPCSTR module, LPCSTR testname )
|
|
|
|
{
|
|
|
|
char *p, dllname[MAX_PATH];
|
|
|
|
unsigned int i, len;
|
|
|
|
|
|
|
|
strcpy( dllname, module );
|
|
|
|
CharLowerA( dllname );
|
|
|
|
p = strstr( dllname, testexe );
|
|
|
|
if (p) *p = 0;
|
|
|
|
len = strlen(dllname);
|
|
|
|
|
2010-09-28 20:10:46 +02:00
|
|
|
if (!nb_filters) return exclude_tests;
|
2008-11-19 12:19:42 +01:00
|
|
|
for (i = 0; i < nb_filters; i++)
|
|
|
|
{
|
|
|
|
if (!strncmp( dllname, filters[i], len ))
|
|
|
|
{
|
2010-09-28 20:10:46 +02:00
|
|
|
if (!filters[i][len]) return exclude_tests;
|
2008-11-19 12:19:42 +01:00
|
|
|
if (filters[i][len] != ':') continue;
|
2010-12-10 12:13:15 +01:00
|
|
|
if (testname && !strcmp( testname, &filters[i][len+1] )) return exclude_tests;
|
|
|
|
if (!testname && !exclude_tests) return FALSE;
|
2008-11-19 12:19:42 +01:00
|
|
|
}
|
|
|
|
}
|
2010-09-28 20:10:46 +02:00
|
|
|
return !exclude_tests;
|
2008-11-19 12:19:42 +01:00
|
|
|
}
|
|
|
|
|
2007-08-23 18:28:23 +02:00
|
|
|
static char * get_file_version(char * file_name)
|
|
|
|
{
|
|
|
|
static char version[32];
|
|
|
|
DWORD size;
|
|
|
|
DWORD handle;
|
|
|
|
|
|
|
|
size = GetFileVersionInfoSizeA(file_name, &handle);
|
|
|
|
if (size) {
|
2009-05-17 13:28:23 +02:00
|
|
|
char * data = heap_alloc(size);
|
2007-08-23 18:28:23 +02:00
|
|
|
if (data) {
|
|
|
|
if (GetFileVersionInfoA(file_name, handle, size, data)) {
|
2013-12-19 22:25:13 +01:00
|
|
|
static const char backslash[] = "\\";
|
2007-08-23 18:28:23 +02:00
|
|
|
VS_FIXEDFILEINFO *pFixedVersionInfo;
|
|
|
|
UINT len;
|
|
|
|
if (VerQueryValueA(data, backslash, (LPVOID *)&pFixedVersionInfo, &len)) {
|
2022-02-07 08:41:13 +01:00
|
|
|
sprintf(version, "%ld.%ld.%ld.%ld",
|
2007-08-23 18:28:23 +02:00
|
|
|
pFixedVersionInfo->dwFileVersionMS >> 16,
|
|
|
|
pFixedVersionInfo->dwFileVersionMS & 0xffff,
|
|
|
|
pFixedVersionInfo->dwFileVersionLS >> 16,
|
|
|
|
pFixedVersionInfo->dwFileVersionLS & 0xffff);
|
|
|
|
} else
|
2021-03-15 19:28:48 +01:00
|
|
|
sprintf(version, "version not found");
|
2007-08-23 18:28:23 +02:00
|
|
|
} else
|
2022-02-07 08:41:13 +01:00
|
|
|
sprintf(version, "version error %lu", GetLastError());
|
2009-05-17 13:28:23 +02:00
|
|
|
heap_free(data);
|
2007-08-23 18:28:23 +02:00
|
|
|
} else
|
2021-03-15 19:28:48 +01:00
|
|
|
sprintf(version, "version error %u", ERROR_OUTOFMEMORY);
|
2021-03-29 15:53:26 +02:00
|
|
|
} else if (GetLastError() == ERROR_FILE_NOT_FOUND)
|
|
|
|
sprintf(version, "dll is missing");
|
|
|
|
else
|
2022-02-07 08:41:13 +01:00
|
|
|
sprintf(version, "version not present %lu", GetLastError());
|
2007-08-23 18:28:23 +02:00
|
|
|
|
|
|
|
return version;
|
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static BOOL running_under_wine (void)
|
2004-04-23 02:06:57 +02:00
|
|
|
{
|
|
|
|
HMODULE module = GetModuleHandleA("ntdll.dll");
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
if (!module) return FALSE;
|
2004-04-23 04:46:18 +02:00
|
|
|
return (GetProcAddress(module, "wine_server_call") != NULL);
|
2004-04-23 02:06:57 +02:00
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static BOOL check_mount_mgr(void)
|
2010-01-28 15:50:52 +01:00
|
|
|
{
|
2010-12-27 14:45:17 +01:00
|
|
|
HANDLE handle = CreateFileA( "\\\\.\\MountPointManager", GENERIC_READ,
|
|
|
|
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
|
|
|
|
if (handle == INVALID_HANDLE_VALUE) return FALSE;
|
|
|
|
CloseHandle( handle );
|
2010-01-28 15:50:52 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static BOOL check_wow64_registry(void)
|
2010-12-27 14:45:17 +01:00
|
|
|
{
|
|
|
|
char buffer[MAX_PATH];
|
|
|
|
DWORD type, size = MAX_PATH;
|
|
|
|
HKEY hkey;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
if (!is_wow64) return TRUE;
|
|
|
|
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey ))
|
|
|
|
return FALSE;
|
|
|
|
ret = !RegQueryValueExA( hkey, "ProgramFilesDir (x86)", NULL, &type, (BYTE *)buffer, &size );
|
|
|
|
RegCloseKey( hkey );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static BOOL check_display_driver(void)
|
2010-03-05 13:10:16 +01:00
|
|
|
{
|
2010-12-27 14:45:17 +01:00
|
|
|
HWND hwnd = CreateWindowA( "STATIC", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
|
|
|
0, 0, GetModuleHandleA(0), 0 );
|
|
|
|
if (!hwnd) return FALSE;
|
|
|
|
DestroyWindow( hwnd );
|
2010-03-05 13:10:16 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static BOOL running_on_visible_desktop (void)
|
2004-12-22 15:50:50 +01:00
|
|
|
{
|
2005-03-14 11:06:22 +01:00
|
|
|
HWND desktop;
|
2012-01-19 21:05:28 +01:00
|
|
|
HMODULE huser32 = GetModuleHandleA("user32.dll");
|
2009-10-02 14:54:12 +02:00
|
|
|
HWINSTA (WINAPI *pGetProcessWindowStation)(void);
|
|
|
|
BOOL (WINAPI *pGetUserObjectInformationA)(HANDLE,INT,LPVOID,DWORD,LPDWORD);
|
|
|
|
|
|
|
|
pGetProcessWindowStation = (void *)GetProcAddress(huser32, "GetProcessWindowStation");
|
|
|
|
pGetUserObjectInformationA = (void *)GetProcAddress(huser32, "GetUserObjectInformationA");
|
2005-03-07 11:58:37 +01:00
|
|
|
|
2005-03-14 11:06:22 +01:00
|
|
|
desktop = GetDesktopWindow();
|
|
|
|
if (!GetWindowLongPtrW(desktop, GWLP_WNDPROC)) /* Win9x */
|
|
|
|
return IsWindowVisible(desktop);
|
|
|
|
|
|
|
|
if (pGetProcessWindowStation && pGetUserObjectInformationA)
|
2005-03-10 18:17:35 +01:00
|
|
|
{
|
|
|
|
DWORD len;
|
|
|
|
HWINSTA wstation;
|
|
|
|
USEROBJECTFLAGS uoflags;
|
2005-03-07 11:58:37 +01:00
|
|
|
|
2019-12-11 20:30:15 +01:00
|
|
|
wstation = pGetProcessWindowStation();
|
2005-03-10 18:17:35 +01:00
|
|
|
assert(pGetUserObjectInformationA(wstation, UOI_FLAGS, &uoflags, sizeof(uoflags), &len));
|
|
|
|
return (uoflags.dwFlags & WSF_VISIBLE) != 0;
|
|
|
|
}
|
2005-03-14 11:06:22 +01:00
|
|
|
return IsWindowVisible(desktop);
|
2004-12-22 15:50:50 +01:00
|
|
|
}
|
|
|
|
|
2011-01-10 00:40:33 +01:00
|
|
|
static int running_as_admin (void)
|
|
|
|
{
|
|
|
|
PSID administrators = NULL;
|
|
|
|
SID_IDENTIFIER_AUTHORITY nt_authority = { SECURITY_NT_AUTHORITY };
|
|
|
|
HANDLE token;
|
|
|
|
DWORD groups_size;
|
|
|
|
PTOKEN_GROUPS groups;
|
|
|
|
DWORD group_index;
|
|
|
|
|
|
|
|
/* Create a well-known SID for the Administrators group. */
|
|
|
|
if (! AllocateAndInitializeSid(&nt_authority, 2, SECURITY_BUILTIN_DOMAIN_RID,
|
|
|
|
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
|
|
|
|
&administrators))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* Get the process token */
|
|
|
|
if (! OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
|
|
|
{
|
|
|
|
FreeSid(administrators);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the group info from the token */
|
|
|
|
groups_size = 0;
|
|
|
|
GetTokenInformation(token, TokenGroups, NULL, 0, &groups_size);
|
|
|
|
groups = heap_alloc(groups_size);
|
|
|
|
if (groups == NULL)
|
|
|
|
{
|
|
|
|
CloseHandle(token);
|
|
|
|
FreeSid(administrators);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (! GetTokenInformation(token, TokenGroups, groups, groups_size, &groups_size))
|
|
|
|
{
|
|
|
|
heap_free(groups);
|
|
|
|
CloseHandle(token);
|
|
|
|
FreeSid(administrators);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
CloseHandle(token);
|
|
|
|
|
|
|
|
/* Now check if the token groups include the Administrators group */
|
|
|
|
for (group_index = 0; group_index < groups->GroupCount; group_index++)
|
|
|
|
{
|
|
|
|
if (EqualSid(groups->Groups[group_index].Sid, administrators))
|
|
|
|
{
|
|
|
|
heap_free(groups);
|
|
|
|
FreeSid(administrators);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we end up here we didn't find the Administrators group */
|
|
|
|
heap_free(groups);
|
|
|
|
FreeSid(administrators);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int running_elevated (void)
|
|
|
|
{
|
|
|
|
HANDLE token;
|
|
|
|
TOKEN_ELEVATION elevation_info;
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
/* Get the process token */
|
|
|
|
if (! OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* Get the elevation info from the token */
|
|
|
|
if (! GetTokenInformation(token, TokenElevation, &elevation_info,
|
|
|
|
sizeof(TOKEN_ELEVATION), &size))
|
|
|
|
{
|
|
|
|
CloseHandle(token);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
CloseHandle(token);
|
|
|
|
|
|
|
|
return elevation_info.TokenIsElevated;
|
|
|
|
}
|
|
|
|
|
2009-10-13 14:51:39 +02:00
|
|
|
/* check for native dll when running under wine */
|
|
|
|
static BOOL is_native_dll( HMODULE module )
|
2009-09-29 13:28:15 +02:00
|
|
|
{
|
2019-04-22 19:47:56 +02:00
|
|
|
static const char builtin_signature[] = "Wine builtin DLL";
|
2009-09-29 13:28:15 +02:00
|
|
|
static const char fakedll_signature[] = "Wine placeholder DLL";
|
|
|
|
const IMAGE_DOS_HEADER *dos;
|
|
|
|
|
2009-10-13 14:51:39 +02:00
|
|
|
if (!running_under_wine()) return FALSE;
|
2009-09-29 13:28:15 +02:00
|
|
|
if (!((ULONG_PTR)module & 1)) return FALSE; /* not loaded as datafile */
|
2009-10-13 14:51:39 +02:00
|
|
|
/* builtin dlls can't be loaded as datafile, so we must have native or fake dll */
|
2009-09-29 13:28:15 +02:00
|
|
|
dos = (const IMAGE_DOS_HEADER *)((const char *)module - 1);
|
|
|
|
if (dos->e_magic != IMAGE_DOS_SIGNATURE) return FALSE;
|
2019-04-22 19:47:56 +02:00
|
|
|
if (dos->e_lfanew >= sizeof(*dos) + 32)
|
|
|
|
{
|
|
|
|
if (!memcmp( dos + 1, builtin_signature, sizeof(builtin_signature) )) return FALSE;
|
|
|
|
if (!memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) return FALSE;
|
|
|
|
}
|
2009-10-13 14:51:39 +02:00
|
|
|
return TRUE;
|
2009-09-29 13:28:15 +02:00
|
|
|
}
|
|
|
|
|
2014-11-10 02:44:05 +01:00
|
|
|
/*
|
|
|
|
* Windows 8 has a concept of stub DLLs. When DLLMain is called the user is prompted
|
|
|
|
* to install that component. To bypass this check we need to look at the version resource.
|
|
|
|
*/
|
|
|
|
static BOOL is_stub_dll(const char *filename)
|
|
|
|
{
|
2022-01-27 10:17:26 +01:00
|
|
|
UINT size;
|
|
|
|
DWORD ver;
|
2014-11-10 02:44:05 +01:00
|
|
|
BOOL isstub = FALSE;
|
|
|
|
char *p, *data;
|
|
|
|
|
|
|
|
size = GetFileVersionInfoSizeA(filename, &ver);
|
|
|
|
if (!size) return FALSE;
|
|
|
|
|
|
|
|
data = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if (!data) return FALSE;
|
|
|
|
|
|
|
|
if (GetFileVersionInfoA(filename, ver, size, data))
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
sprintf(buf, "\\StringFileInfo\\%04x%04x\\OriginalFilename", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 1200);
|
|
|
|
if (VerQueryValueA(data, buf, (void**)&p, &size))
|
|
|
|
isstub = !lstrcmpiA("wcodstub.dll", p);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, data);
|
|
|
|
|
|
|
|
return isstub;
|
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static void print_version (void)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
2008-12-10 09:46:02 +01:00
|
|
|
#ifdef __i386__
|
|
|
|
static const char platform[] = "i386";
|
|
|
|
#elif defined(__x86_64__)
|
|
|
|
static const char platform[] = "x86_64";
|
2010-09-18 18:02:47 +02:00
|
|
|
#elif defined(__arm__)
|
|
|
|
static const char platform[] = "arm";
|
2013-01-16 00:57:34 +01:00
|
|
|
#elif defined(__aarch64__)
|
|
|
|
static const char platform[] = "arm64";
|
2010-05-31 19:20:16 +02:00
|
|
|
#else
|
|
|
|
# error CPU unknown
|
2008-12-10 09:46:02 +01:00
|
|
|
#endif
|
2012-01-19 21:05:28 +01:00
|
|
|
OSVERSIONINFOEXA ver;
|
2014-10-07 19:52:59 +02:00
|
|
|
RTL_OSVERSIONINFOEXW rtlver;
|
2010-12-27 14:45:17 +01:00
|
|
|
BOOL ext;
|
2011-01-10 00:40:33 +01:00
|
|
|
int is_win2k3_r2, is_admin, is_elevated;
|
2008-12-10 09:46:02 +01:00
|
|
|
const char *(CDECL *wine_get_build_id)(void);
|
2014-10-07 19:52:59 +02:00
|
|
|
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
|
2008-12-10 09:46:02 +01:00
|
|
|
void (CDECL *wine_get_host_version)( const char **sysname, const char **release );
|
2009-11-20 10:48:17 +01:00
|
|
|
BOOL (WINAPI *pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *);
|
2014-10-07 19:52:59 +02:00
|
|
|
NTSTATUS (WINAPI *pRtlGetVersion)(RTL_OSVERSIONINFOEXW *);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2012-01-19 21:05:28 +01:00
|
|
|
ver.dwOSVersionInfoSize = sizeof(ver);
|
|
|
|
if (!(ext = GetVersionExA ((OSVERSIONINFOA *) &ver)))
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
2012-01-19 21:05:28 +01:00
|
|
|
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
|
|
|
if (!GetVersionExA ((OSVERSIONINFOA *) &ver))
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_FATAL, "Can't get OS version.");
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
2014-10-07 19:52:59 +02:00
|
|
|
|
|
|
|
/* try to get non-faked values */
|
|
|
|
if (ver.dwMajorVersion == 6 && ver.dwMinorVersion == 2)
|
|
|
|
{
|
|
|
|
rtlver.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
|
|
|
|
|
|
|
|
pRtlGetVersion = (void *)GetProcAddress(hntdll, "RtlGetVersion");
|
|
|
|
pRtlGetVersion(&rtlver);
|
|
|
|
|
|
|
|
ver.dwMajorVersion = rtlver.dwMajorVersion;
|
|
|
|
ver.dwMinorVersion = rtlver.dwMinorVersion;
|
|
|
|
ver.dwBuildNumber = rtlver.dwBuildNumber;
|
|
|
|
ver.dwPlatformId = rtlver.dwPlatformId;
|
|
|
|
ver.wServicePackMajor = rtlver.wServicePackMajor;
|
|
|
|
ver.wServicePackMinor = rtlver.wServicePackMinor;
|
|
|
|
ver.wSuiteMask = rtlver.wSuiteMask;
|
|
|
|
ver.wProductType = rtlver.wProductType;
|
|
|
|
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, rtlver.szCSDVersion, -1, ver.szCSDVersion, sizeof(ver.szCSDVersion), NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2010-12-27 14:45:17 +01:00
|
|
|
xprintf (" Platform=%s%s\n", platform, is_wow64 ? " (WOW64)" : "");
|
2004-04-23 04:52:21 +02:00
|
|
|
xprintf (" bRunningUnderWine=%d\n", running_under_wine ());
|
2004-12-22 15:50:50 +01:00
|
|
|
xprintf (" bRunningOnVisibleDesktop=%d\n", running_on_visible_desktop ());
|
2011-01-10 00:40:33 +01:00
|
|
|
is_admin = running_as_admin ();
|
|
|
|
if (0 <= is_admin)
|
|
|
|
{
|
|
|
|
xprintf (" Account=%s", is_admin ? "admin" : "non-admin");
|
|
|
|
is_elevated = running_elevated ();
|
|
|
|
if (0 <= is_elevated)
|
|
|
|
xprintf(", %s", is_elevated ? "elevated" : "not elevated");
|
|
|
|
xprintf ("\n");
|
|
|
|
}
|
2010-02-06 10:21:22 +01:00
|
|
|
xprintf (" Submitter=%s\n", email );
|
2010-09-28 20:12:10 +02:00
|
|
|
if (description)
|
|
|
|
xprintf (" Description=%s\n", description );
|
2010-11-21 16:43:18 +01:00
|
|
|
if (url)
|
|
|
|
xprintf (" URL=%s\n", url );
|
2008-06-10 17:45:24 +02:00
|
|
|
xprintf (" dwMajorVersion=%u\n dwMinorVersion=%u\n"
|
|
|
|
" dwBuildNumber=%u\n PlatformId=%u\n szCSDVersion=%s\n",
|
2003-12-04 03:01:39 +01:00
|
|
|
ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
|
|
|
|
ver.dwPlatformId, ver.szCSDVersion);
|
|
|
|
|
2014-10-07 19:52:59 +02:00
|
|
|
wine_get_build_id = (void *)GetProcAddress(hntdll, "wine_get_build_id");
|
|
|
|
wine_get_host_version = (void *)GetProcAddress(hntdll, "wine_get_host_version");
|
2008-03-27 16:47:31 +01:00
|
|
|
if (wine_get_build_id) xprintf( " WineBuild=%s\n", wine_get_build_id() );
|
2008-12-10 09:46:02 +01:00
|
|
|
if (wine_get_host_version)
|
|
|
|
{
|
|
|
|
const char *sysname, *release;
|
|
|
|
wine_get_host_version( &sysname, &release );
|
|
|
|
xprintf( " Host system=%s\n Host version=%s\n", sysname, release );
|
|
|
|
}
|
2005-09-15 20:56:20 +02:00
|
|
|
is_win2k3_r2 = GetSystemMetrics(SM_SERVERR2);
|
|
|
|
if(is_win2k3_r2)
|
|
|
|
xprintf(" R2 build number=%d\n", is_win2k3_r2);
|
|
|
|
|
2003-12-04 03:01:39 +01:00
|
|
|
if (!ext) return;
|
|
|
|
|
|
|
|
xprintf (" wServicePackMajor=%d\n wServicePackMinor=%d\n"
|
|
|
|
" wSuiteMask=%d\n wProductType=%d\n wReserved=%d\n",
|
|
|
|
ver.wServicePackMajor, ver.wServicePackMinor, ver.wSuiteMask,
|
|
|
|
ver.wProductType, ver.wReserved);
|
2009-11-20 10:48:17 +01:00
|
|
|
|
|
|
|
pGetProductInfo = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"),"GetProductInfo");
|
|
|
|
if (pGetProductInfo && !running_under_wine())
|
|
|
|
{
|
|
|
|
DWORD prodtype = 0;
|
|
|
|
|
|
|
|
pGetProductInfo(ver.dwMajorVersion, ver.dwMinorVersion, ver.wServicePackMajor, ver.wServicePackMinor, &prodtype);
|
|
|
|
xprintf(" dwProductInfo=%u\n", prodtype);
|
|
|
|
}
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2011-07-29 14:59:45 +02:00
|
|
|
static void print_language(void)
|
|
|
|
{
|
2011-09-15 08:55:07 +02:00
|
|
|
HMODULE hkernel32;
|
2015-06-24 17:42:07 +02:00
|
|
|
BOOL (WINAPI *pGetSystemPreferredUILanguages)(DWORD, PULONG, PZZWSTR, PULONG);
|
2011-09-15 08:55:07 +02:00
|
|
|
LANGID (WINAPI *pGetUserDefaultUILanguage)(void);
|
|
|
|
LANGID (WINAPI *pGetThreadUILanguage)(void);
|
|
|
|
|
2015-06-24 17:42:07 +02:00
|
|
|
xprintf (" SystemDefaultLCID=%04x\n", GetSystemDefaultLCID());
|
|
|
|
xprintf (" UserDefaultLCID=%04x\n", GetUserDefaultLCID());
|
|
|
|
xprintf (" ThreadLocale=%04x\n", GetThreadLocale());
|
2011-09-15 08:55:07 +02:00
|
|
|
|
|
|
|
hkernel32 = GetModuleHandleA("kernel32.dll");
|
2015-06-24 17:42:07 +02:00
|
|
|
pGetSystemPreferredUILanguages = (void*)GetProcAddress(hkernel32, "GetSystemPreferredUILanguages");
|
2011-09-15 08:55:07 +02:00
|
|
|
pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
|
|
|
|
pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
|
2015-06-24 17:42:07 +02:00
|
|
|
|
|
|
|
if (pGetSystemPreferredUILanguages && !running_under_wine())
|
|
|
|
{
|
|
|
|
WCHAR langW[32];
|
2018-07-24 22:13:46 +02:00
|
|
|
ULONG num, size = ARRAY_SIZE(langW);
|
2015-06-24 17:42:07 +02:00
|
|
|
if (pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &num, langW, &size))
|
|
|
|
{
|
|
|
|
char lang[32], *p = lang;
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, langW, size, lang, sizeof(lang), NULL, NULL);
|
|
|
|
for (p += strlen(p) + 1; *p != '\0'; p += strlen(p) + 1) *(p - 1) = ',';
|
|
|
|
xprintf (" SystemPreferredUILanguages=%s\n", lang);
|
|
|
|
}
|
|
|
|
}
|
2011-09-15 08:55:07 +02:00
|
|
|
if (pGetUserDefaultUILanguage)
|
2015-06-24 17:42:07 +02:00
|
|
|
xprintf (" UserDefaultUILanguage=%04x\n", pGetUserDefaultUILanguage());
|
2011-09-15 08:55:07 +02:00
|
|
|
if (pGetThreadUILanguage)
|
2015-06-24 17:42:07 +02:00
|
|
|
xprintf (" ThreadUILanguage=%04x\n", pGetThreadUILanguage());
|
2022-02-18 15:19:55 +01:00
|
|
|
xprintf (" Country=%d\n", GetUserGeoID(GEOCLASS_NATION));
|
|
|
|
xprintf (" ACP=%d\n", GetACP());
|
2011-07-29 14:59:45 +02:00
|
|
|
}
|
|
|
|
|
2013-10-11 22:43:04 +02:00
|
|
|
static inline BOOL is_dot_dir(const char* x)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
|
|
|
return ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))));
|
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static void remove_dir (const char *dir)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
|
|
|
HANDLE hFind;
|
2012-01-19 21:05:28 +01:00
|
|
|
WIN32_FIND_DATAA wfd;
|
2003-12-04 03:01:39 +01:00
|
|
|
char path[MAX_PATH];
|
|
|
|
size_t dirlen = strlen (dir);
|
|
|
|
|
|
|
|
/* Make sure the directory exists before going further */
|
|
|
|
memcpy (path, dir, dirlen);
|
|
|
|
strcpy (path + dirlen++, "\\*");
|
2012-01-19 21:05:28 +01:00
|
|
|
hFind = FindFirstFileA (path, &wfd);
|
2003-12-04 03:01:39 +01:00
|
|
|
if (hFind == INVALID_HANDLE_VALUE) return;
|
|
|
|
|
|
|
|
do {
|
|
|
|
char *lp = wfd.cFileName;
|
|
|
|
|
|
|
|
if (!lp[0]) lp = wfd.cAlternateFileName; /* ? FIXME not (!lp) ? */
|
|
|
|
if (is_dot_dir (lp)) continue;
|
|
|
|
strcpy (path + dirlen, lp);
|
|
|
|
if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)
|
|
|
|
remove_dir(path);
|
2012-01-19 21:05:28 +01:00
|
|
|
else if (!DeleteFileA(path))
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_WARNING, "Can't delete file %s: error %d",
|
|
|
|
path, GetLastError ());
|
2012-01-19 21:05:28 +01:00
|
|
|
} while (FindNextFileA(hFind, &wfd));
|
2003-12-04 03:01:39 +01:00
|
|
|
FindClose (hFind);
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!RemoveDirectoryA(dir))
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_WARNING, "Can't remove directory %s: error %d",
|
|
|
|
dir, GetLastError ());
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static const char* get_test_source_file(const char* test, const char* subtest)
|
2004-03-20 20:21:39 +01:00
|
|
|
{
|
|
|
|
static char buffer[MAX_PATH];
|
2017-02-10 16:39:32 +01:00
|
|
|
int len = strlen(test);
|
2010-02-06 20:36:12 +01:00
|
|
|
|
2021-04-29 15:14:40 +02:00
|
|
|
if (len > 4 && !strcmp( test + len - 4, ".exe" ) &&
|
|
|
|
strcmp( test, "ntoskrnl.exe" )) /* the one exception! */
|
2010-02-06 20:36:12 +01:00
|
|
|
{
|
|
|
|
len = sprintf(buffer, "programs/%s", test) - 4;
|
|
|
|
buffer[len] = 0;
|
|
|
|
}
|
|
|
|
else len = sprintf(buffer, "dlls/%s", test);
|
2004-03-20 20:21:39 +01:00
|
|
|
|
2010-02-06 20:36:12 +01:00
|
|
|
sprintf(buffer + len, "/tests/%s.c", subtest);
|
2004-03-20 20:21:39 +01:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-01-19 21:05:28 +01:00
|
|
|
static void* extract_rcdata (LPCSTR name, LPCSTR type, DWORD* size)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
|
|
|
HRSRC rsrc;
|
|
|
|
HGLOBAL hdl;
|
2004-06-16 00:45:15 +02:00
|
|
|
LPVOID addr;
|
2004-01-15 02:48:05 +01:00
|
|
|
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!(rsrc = FindResourceA(NULL, name, type)) ||
|
2004-01-15 02:48:05 +01:00
|
|
|
!(*size = SizeofResource (0, rsrc)) ||
|
|
|
|
!(hdl = LoadResource (0, rsrc)) ||
|
|
|
|
!(addr = LockResource (hdl)))
|
2004-06-16 00:45:15 +02:00
|
|
|
return NULL;
|
2004-01-15 02:48:05 +01:00
|
|
|
return addr;
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2004-04-20 06:00:07 +02:00
|
|
|
/* Fills in the name and exename fields */
|
2005-06-04 12:01:25 +02:00
|
|
|
static void
|
2012-01-19 21:05:28 +01:00
|
|
|
extract_test (struct wine_test *test, const char *dir, LPSTR res_name)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
|
|
|
BYTE* code;
|
|
|
|
DWORD size;
|
2004-02-19 05:12:42 +01:00
|
|
|
char *exepos;
|
2008-05-26 07:18:55 +02:00
|
|
|
HANDLE hfile;
|
|
|
|
DWORD written;
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2009-07-07 10:59:29 +02:00
|
|
|
code = extract_rcdata (res_name, "TESTRES", &size);
|
2006-09-11 14:23:07 +02:00
|
|
|
if (!code) report (R_FATAL, "Can't find test resource %s: %d",
|
|
|
|
res_name, GetLastError ());
|
2009-05-17 13:28:23 +02:00
|
|
|
test->name = heap_strdup( res_name );
|
2008-05-26 07:18:55 +02:00
|
|
|
test->exename = strmake (NULL, "%s\\%s", dir, test->name);
|
2007-08-03 12:59:36 +02:00
|
|
|
exepos = strstr (test->name, testexe);
|
2004-02-19 05:12:42 +01:00
|
|
|
if (!exepos) report (R_FATAL, "Not an .exe file: %s", test->name);
|
|
|
|
*exepos = 0;
|
2009-05-17 13:28:23 +02:00
|
|
|
test->name = heap_realloc (test->name, exepos - test->name + 1);
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_STEP, "Extracting: %s", test->name);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2008-05-26 07:18:55 +02:00
|
|
|
hfile = CreateFileA(test->exename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
|
|
|
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if (hfile == INVALID_HANDLE_VALUE)
|
|
|
|
report (R_FATAL, "Failed to open file %s.", test->exename);
|
|
|
|
|
|
|
|
if (!WriteFile(hfile, code, size, &written, NULL))
|
|
|
|
report (R_FATAL, "Failed to write file %s.", test->exename);
|
|
|
|
|
|
|
|
CloseHandle(hfile);
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2009-02-23 12:22:24 +01:00
|
|
|
static DWORD wait_process( HANDLE process, DWORD timeout )
|
|
|
|
{
|
|
|
|
DWORD wait, diff = 0, start = GetTickCount();
|
|
|
|
MSG msg;
|
|
|
|
|
|
|
|
while (diff < timeout)
|
|
|
|
{
|
|
|
|
wait = MsgWaitForMultipleObjects( 1, &process, FALSE, timeout - diff, QS_ALLINPUT );
|
|
|
|
if (wait != WAIT_OBJECT_0 + 1) return wait;
|
2012-01-19 21:05:28 +01:00
|
|
|
while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
|
2009-02-23 12:22:24 +01:00
|
|
|
diff = GetTickCount() - start;
|
|
|
|
}
|
|
|
|
return WAIT_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
2009-02-25 11:56:31 +01:00
|
|
|
static void append_path( const char *path)
|
|
|
|
{
|
|
|
|
char *newpath;
|
|
|
|
|
2009-05-17 13:28:23 +02:00
|
|
|
newpath = heap_alloc(strlen(curpath) + 1 + strlen(path) + 1);
|
2009-02-25 11:56:31 +01:00
|
|
|
strcpy(newpath, curpath);
|
|
|
|
strcat(newpath, ";");
|
|
|
|
strcat(newpath, path);
|
|
|
|
SetEnvironmentVariableA("PATH", newpath);
|
|
|
|
|
2009-05-17 13:28:23 +02:00
|
|
|
heap_free(newpath);
|
2009-02-25 11:56:31 +01:00
|
|
|
}
|
|
|
|
|
2004-04-20 06:00:07 +02:00
|
|
|
/* Run a command for MS milliseconds. If OUT != NULL, also redirect
|
|
|
|
stdout to there.
|
|
|
|
|
|
|
|
Return the exit status, -2 if can't create process or the return
|
|
|
|
value of WaitForSingleObject.
|
|
|
|
*/
|
2005-06-04 12:01:25 +02:00
|
|
|
static int
|
2021-03-16 10:34:07 +01:00
|
|
|
run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms, BOOL nocritical, DWORD* pid)
|
2004-04-20 06:00:07 +02:00
|
|
|
{
|
2012-01-19 21:05:28 +01:00
|
|
|
STARTUPINFOA si;
|
2004-04-20 06:00:07 +02:00
|
|
|
PROCESS_INFORMATION pi;
|
2021-03-16 10:34:07 +01:00
|
|
|
DWORD wait, status, flags;
|
|
|
|
UINT old_errmode;
|
2004-04-20 06:00:07 +02:00
|
|
|
|
2017-02-08 14:12:07 +01:00
|
|
|
/* Flush to disk so we know which test caused Windows to crash if it does */
|
|
|
|
if (out_file)
|
|
|
|
FlushFileBuffers(out_file);
|
|
|
|
|
2012-01-19 21:05:28 +01:00
|
|
|
GetStartupInfoA (&si);
|
2008-07-10 17:45:22 +02:00
|
|
|
si.dwFlags = STARTF_USESTDHANDLES;
|
|
|
|
si.hStdInput = GetStdHandle( STD_INPUT_HANDLE );
|
|
|
|
si.hStdOutput = out_file ? out_file : GetStdHandle( STD_OUTPUT_HANDLE );
|
2008-11-19 12:19:22 +01:00
|
|
|
si.hStdError = out_file ? out_file : GetStdHandle( STD_ERROR_HANDLE );
|
2021-03-16 10:34:07 +01:00
|
|
|
if (nocritical)
|
|
|
|
{
|
|
|
|
old_errmode = SetErrorMode(0);
|
|
|
|
SetErrorMode(old_errmode | SEM_FAILCRITICALERRORS);
|
|
|
|
flags = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
flags = CREATE_DEFAULT_ERROR_MODE;
|
2004-04-20 06:00:07 +02:00
|
|
|
|
2021-03-16 10:34:07 +01:00
|
|
|
if (!CreateProcessA (NULL, cmd, NULL, NULL, TRUE, flags,
|
2009-02-23 12:22:24 +01:00
|
|
|
NULL, tempdir, &si, &pi))
|
2017-02-22 15:33:21 +01:00
|
|
|
{
|
2021-03-16 10:34:07 +01:00
|
|
|
if (nocritical) SetErrorMode(old_errmode);
|
2017-02-22 15:33:21 +01:00
|
|
|
if (pid) *pid = 0;
|
2009-02-23 12:22:24 +01:00
|
|
|
return -2;
|
2017-02-22 15:33:21 +01:00
|
|
|
}
|
2009-02-23 12:22:24 +01:00
|
|
|
|
2021-03-16 10:34:07 +01:00
|
|
|
if (nocritical) SetErrorMode(old_errmode);
|
2009-02-23 12:22:24 +01:00
|
|
|
CloseHandle (pi.hThread);
|
2017-02-22 15:33:21 +01:00
|
|
|
if (pid) *pid = pi.dwProcessId;
|
2009-02-23 12:22:24 +01:00
|
|
|
status = wait_process( pi.hProcess, ms );
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case WAIT_OBJECT_0:
|
|
|
|
GetExitCodeProcess (pi.hProcess, &status);
|
2004-04-20 06:00:07 +02:00
|
|
|
CloseHandle (pi.hProcess);
|
2009-02-23 12:22:24 +01:00
|
|
|
return status;
|
|
|
|
case WAIT_FAILED:
|
|
|
|
report (R_ERROR, "Wait for '%s' failed: %d", cmd, GetLastError ());
|
|
|
|
break;
|
|
|
|
case WAIT_TIMEOUT:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
report (R_ERROR, "Wait returned %d", status);
|
|
|
|
break;
|
2004-04-20 06:00:07 +02:00
|
|
|
}
|
2009-02-23 12:22:24 +01:00
|
|
|
if (!TerminateProcess (pi.hProcess, 257))
|
|
|
|
report (R_ERROR, "TerminateProcess failed: %d", GetLastError ());
|
|
|
|
wait = wait_process( pi.hProcess, 5000 );
|
|
|
|
switch (wait)
|
|
|
|
{
|
|
|
|
case WAIT_OBJECT_0:
|
|
|
|
break;
|
|
|
|
case WAIT_FAILED:
|
|
|
|
report (R_ERROR, "Wait for termination of '%s' failed: %d", cmd, GetLastError ());
|
|
|
|
break;
|
|
|
|
case WAIT_TIMEOUT:
|
|
|
|
report (R_ERROR, "Can't kill process '%s'", cmd);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
report (R_ERROR, "Waiting for termination: %d", wait);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CloseHandle (pi.hProcess);
|
2004-04-20 06:00:07 +02:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2008-11-19 13:24:43 +01:00
|
|
|
static DWORD
|
2012-01-19 21:05:28 +01:00
|
|
|
get_subtests (const char *tempdir, struct wine_test *test, LPSTR res_name)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
2008-07-10 17:45:22 +02:00
|
|
|
char *cmd;
|
|
|
|
HANDLE subfile;
|
2008-11-19 13:24:43 +01:00
|
|
|
DWORD err, total;
|
2004-04-20 06:00:07 +02:00
|
|
|
char buffer[8192], *index;
|
2004-05-04 06:13:05 +02:00
|
|
|
static const char header[] = "Valid test names:";
|
2008-11-19 13:24:43 +01:00
|
|
|
int status, allocated;
|
2008-07-10 17:45:22 +02:00
|
|
|
char tmpdir[MAX_PATH], subname[MAX_PATH];
|
|
|
|
SECURITY_ATTRIBUTES sa;
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2004-04-20 06:00:07 +02:00
|
|
|
test->subtest_count = 0;
|
|
|
|
|
2008-07-10 17:45:22 +02:00
|
|
|
if (!GetTempPathA( MAX_PATH, tmpdir ) ||
|
|
|
|
!GetTempFileNameA( tmpdir, "sub", 0, subname ))
|
|
|
|
report (R_FATAL, "Can't name subtests file.");
|
|
|
|
|
|
|
|
/* make handle inheritable */
|
|
|
|
sa.nLength = sizeof(sa);
|
|
|
|
sa.lpSecurityDescriptor = NULL;
|
|
|
|
sa.bInheritHandle = TRUE;
|
|
|
|
|
|
|
|
subfile = CreateFileA( subname, GENERIC_READ|GENERIC_WRITE,
|
|
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
|
|
|
&sa, CREATE_ALWAYS, 0, NULL );
|
2008-07-16 18:33:12 +02:00
|
|
|
|
|
|
|
if ((subfile == INVALID_HANDLE_VALUE) &&
|
|
|
|
(GetLastError() == ERROR_INVALID_PARAMETER)) {
|
|
|
|
/* FILE_SHARE_DELETE not supported on win9x */
|
|
|
|
subfile = CreateFileA( subname, GENERIC_READ|GENERIC_WRITE,
|
|
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
|
|
&sa, CREATE_ALWAYS, 0, NULL );
|
|
|
|
}
|
2008-07-10 17:45:22 +02:00
|
|
|
if (subfile == INVALID_HANDLE_VALUE) {
|
2008-11-19 13:24:43 +01:00
|
|
|
err = GetLastError();
|
2008-07-10 17:45:22 +02:00
|
|
|
report (R_ERROR, "Can't open subtests output of %s: %u",
|
|
|
|
test->name, GetLastError());
|
|
|
|
goto quit;
|
|
|
|
}
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2005-05-27 22:10:59 +02:00
|
|
|
cmd = strmake (NULL, "%s --list", test->exename);
|
2009-02-25 11:56:31 +01:00
|
|
|
if (test->maindllpath) {
|
|
|
|
/* We need to add the path (to the main dll) to PATH */
|
|
|
|
append_path(test->maindllpath);
|
|
|
|
}
|
2021-03-16 10:34:07 +01:00
|
|
|
status = run_ex (cmd, subfile, tempdir, 5000, TRUE, NULL);
|
2008-11-19 13:24:43 +01:00
|
|
|
err = GetLastError();
|
2009-02-25 11:56:31 +01:00
|
|
|
if (test->maindllpath) {
|
|
|
|
/* Restore PATH again */
|
|
|
|
SetEnvironmentVariableA("PATH", curpath);
|
|
|
|
}
|
2009-05-17 13:28:23 +02:00
|
|
|
heap_free (cmd);
|
2004-04-20 06:00:07 +02:00
|
|
|
|
2021-03-16 10:34:17 +01:00
|
|
|
if (status)
|
2008-11-19 13:24:43 +01:00
|
|
|
{
|
2021-03-16 10:34:17 +01:00
|
|
|
if (status == -2)
|
|
|
|
report (R_ERROR, "Cannot run %s error %u", test->exename, err);
|
|
|
|
else
|
|
|
|
err = status;
|
2012-10-10 10:12:11 +02:00
|
|
|
CloseHandle( subfile );
|
2008-11-19 13:24:43 +01:00
|
|
|
goto quit;
|
|
|
|
}
|
|
|
|
|
2008-07-10 17:45:22 +02:00
|
|
|
SetFilePointer( subfile, 0, NULL, FILE_BEGIN );
|
|
|
|
ReadFile( subfile, buffer, sizeof(buffer), &total, NULL );
|
|
|
|
CloseHandle( subfile );
|
2004-04-20 06:00:07 +02:00
|
|
|
if (sizeof buffer == total) {
|
|
|
|
report (R_ERROR, "Subtest list of %s too big.",
|
|
|
|
test->name, sizeof buffer);
|
2008-11-19 13:24:43 +01:00
|
|
|
err = ERROR_OUTOFMEMORY;
|
2004-04-20 06:00:07 +02:00
|
|
|
goto quit;
|
|
|
|
}
|
2004-01-15 02:48:05 +01:00
|
|
|
buffer[total] = 0;
|
2004-04-20 06:00:07 +02:00
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
index = strstr (buffer, header);
|
2004-04-20 06:00:07 +02:00
|
|
|
if (!index) {
|
|
|
|
report (R_ERROR, "Can't parse subtests output of %s",
|
2004-01-15 02:48:05 +01:00
|
|
|
test->name);
|
2008-11-19 13:24:43 +01:00
|
|
|
err = ERROR_INTERNAL_ERROR;
|
2004-04-20 06:00:07 +02:00
|
|
|
goto quit;
|
|
|
|
}
|
2004-01-15 02:48:05 +01:00
|
|
|
index += sizeof header;
|
|
|
|
|
|
|
|
allocated = 10;
|
2009-05-17 13:28:23 +02:00
|
|
|
test->subtests = heap_alloc (allocated * sizeof(char*));
|
2004-09-07 21:33:52 +02:00
|
|
|
index = strtok (index, whitespace);
|
2004-01-15 02:48:05 +01:00
|
|
|
while (index) {
|
|
|
|
if (test->subtest_count == allocated) {
|
|
|
|
allocated *= 2;
|
2009-05-17 13:28:23 +02:00
|
|
|
test->subtests = heap_realloc (test->subtests,
|
|
|
|
allocated * sizeof(char*));
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
2010-12-09 12:05:19 +01:00
|
|
|
test->subtests[test->subtest_count++] = heap_strdup(index);
|
2004-09-07 21:33:52 +02:00
|
|
|
index = strtok (NULL, whitespace);
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
2009-05-17 13:28:23 +02:00
|
|
|
test->subtests = heap_realloc (test->subtests,
|
|
|
|
test->subtest_count * sizeof(char*));
|
2008-11-19 13:24:43 +01:00
|
|
|
err = 0;
|
2004-04-20 06:00:07 +02:00
|
|
|
|
|
|
|
quit:
|
2008-07-10 17:45:22 +02:00
|
|
|
if (!DeleteFileA (subname))
|
|
|
|
report (R_WARNING, "Can't delete file '%s': %u", subname, GetLastError());
|
2008-11-19 13:24:43 +01:00
|
|
|
return err;
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static void
|
2008-07-10 17:45:22 +02:00
|
|
|
run_test (struct wine_test* test, const char* subtest, HANDLE out_file, const char *tempdir)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
2017-02-10 16:40:18 +01:00
|
|
|
/* Build the source filename so analysis tools can link to it */
|
2004-03-20 20:21:39 +01:00
|
|
|
const char* file = get_test_source_file(test->name, subtest);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2010-12-09 12:05:19 +01:00
|
|
|
if (test_filtered_out( test->name, subtest ))
|
|
|
|
{
|
|
|
|
report (R_STEP, "Skipping: %s:%s", test->name, subtest);
|
2021-03-24 14:30:05 +01:00
|
|
|
xprintf ("%s:%s skipped %s\n", test->name, subtest, file);
|
2010-12-09 12:19:08 +01:00
|
|
|
nr_of_skips++;
|
2010-12-09 12:05:19 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int status;
|
2017-02-22 15:33:21 +01:00
|
|
|
DWORD pid, start = GetTickCount();
|
2010-12-09 12:05:19 +01:00
|
|
|
char *cmd = strmake (NULL, "%s %s", test->exename, subtest);
|
|
|
|
report (R_STEP, "Running: %s:%s", test->name, subtest);
|
2021-03-24 14:30:05 +01:00
|
|
|
xprintf ("%s:%s start %s\n", test->name, subtest, file);
|
2021-03-16 10:34:07 +01:00
|
|
|
status = run_ex (cmd, out_file, tempdir, 120000, FALSE, &pid);
|
2021-07-05 19:07:19 +02:00
|
|
|
if (status == -2) status = -GetLastError();
|
2010-12-09 12:05:19 +01:00
|
|
|
heap_free (cmd);
|
2017-02-22 15:33:21 +01:00
|
|
|
xprintf ("%s:%s:%04x done (%d) in %ds\n", test->name, subtest, pid, status, (GetTickCount()-start)/1000);
|
2011-04-22 13:20:49 +02:00
|
|
|
if (status) failures++;
|
2010-12-09 12:05:19 +01:00
|
|
|
}
|
2012-10-07 18:36:21 +02:00
|
|
|
if (failures) report (R_STATUS, "Running tests - %u failures", failures);
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static BOOL CALLBACK
|
2012-01-19 21:05:28 +01:00
|
|
|
EnumTestFileProc (HMODULE hModule, LPCSTR lpszType,
|
|
|
|
LPSTR lpszName, LONG_PTR lParam)
|
2003-12-04 03:01:39 +01:00
|
|
|
{
|
2008-11-19 12:19:42 +01:00
|
|
|
if (!test_filtered_out( lpszName, NULL )) (*(int*)lParam)++;
|
2004-01-15 02:48:05 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-14 15:10:32 +02:00
|
|
|
static const struct clsid_mapping
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
CLSID clsid;
|
|
|
|
} clsid_list[] =
|
|
|
|
{
|
|
|
|
{"oledb32", {0xc8b522d1, 0x5cf3, 0x11ce, {0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d}}},
|
|
|
|
{NULL, {0, 0, 0, {0,0,0,0,0,0,0,0}}}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL get_main_clsid(const char *name, CLSID *clsid)
|
|
|
|
{
|
|
|
|
const struct clsid_mapping *mapping;
|
|
|
|
|
|
|
|
for(mapping = clsid_list; mapping->name; mapping++)
|
|
|
|
{
|
|
|
|
if(!strcasecmp(name, mapping->name))
|
|
|
|
{
|
|
|
|
*clsid = mapping->clsid;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-09-29 13:06:09 +02:00
|
|
|
static HMODULE load_com_dll(const char *name, char **path, char *filename)
|
2009-09-14 15:10:32 +02:00
|
|
|
{
|
|
|
|
HMODULE dll = NULL;
|
|
|
|
HKEY hkey;
|
|
|
|
char keyname[100];
|
|
|
|
char dllname[MAX_PATH];
|
2009-09-29 13:06:09 +02:00
|
|
|
char *p;
|
2009-09-14 15:10:32 +02:00
|
|
|
CLSID clsid;
|
|
|
|
|
|
|
|
if(!get_main_clsid(name, &clsid)) return NULL;
|
|
|
|
|
2022-01-31 14:13:15 +01:00
|
|
|
sprintf(keyname, "CLSID\\{%08lx-%04x-%04x-%02x%2x-%02x%2x%02x%2x%02x%2x}\\InprocServer32",
|
2009-09-14 15:10:32 +02:00
|
|
|
clsid.Data1, clsid.Data2, clsid.Data3, clsid.Data4[0], clsid.Data4[1],
|
|
|
|
clsid.Data4[2], clsid.Data4[3], clsid.Data4[4], clsid.Data4[5],
|
|
|
|
clsid.Data4[6], clsid.Data4[7]);
|
|
|
|
|
|
|
|
if(RegOpenKeyA(HKEY_CLASSES_ROOT, keyname, &hkey) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
LONG size = sizeof(dllname);
|
|
|
|
if(RegQueryValueA(hkey, NULL, dllname, &size) == ERROR_SUCCESS)
|
2009-09-29 13:06:09 +02:00
|
|
|
{
|
|
|
|
if ((dll = LoadLibraryExA(dllname, NULL, LOAD_LIBRARY_AS_DATAFILE)))
|
|
|
|
{
|
|
|
|
strcpy( filename, dllname );
|
|
|
|
p = strrchr(dllname, '\\');
|
|
|
|
if (p) *p = 0;
|
|
|
|
*path = heap_strdup( dllname );
|
|
|
|
}
|
|
|
|
}
|
2009-09-14 15:10:32 +02:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
return dll;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void get_dll_path(HMODULE dll, char **path, char *filename)
|
|
|
|
{
|
|
|
|
char dllpath[MAX_PATH];
|
|
|
|
|
|
|
|
GetModuleFileNameA(dll, dllpath, MAX_PATH);
|
|
|
|
strcpy(filename, dllpath);
|
|
|
|
*strrchr(dllpath, '\\') = '\0';
|
|
|
|
*path = heap_strdup( dllpath );
|
|
|
|
}
|
|
|
|
|
2006-09-11 14:23:07 +02:00
|
|
|
static BOOL CALLBACK
|
2012-01-19 21:05:28 +01:00
|
|
|
extract_test_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lParam)
|
2006-09-11 14:23:07 +02:00
|
|
|
{
|
|
|
|
const char *tempdir = (const char *)lParam;
|
2007-08-03 12:59:36 +02:00
|
|
|
char dllname[MAX_PATH];
|
2009-02-03 20:45:34 +01:00
|
|
|
char filename[MAX_PATH];
|
|
|
|
WCHAR dllnameW[MAX_PATH];
|
2007-08-03 12:59:36 +02:00
|
|
|
HMODULE dll;
|
2008-11-19 13:24:43 +01:00
|
|
|
DWORD err;
|
2010-07-17 08:48:42 +02:00
|
|
|
HANDLE actctx;
|
|
|
|
ULONG_PTR cookie;
|
2021-03-10 18:15:58 +01:00
|
|
|
BOOL run;
|
2007-08-03 12:59:36 +02:00
|
|
|
|
2010-06-22 19:36:08 +02:00
|
|
|
if (aborting) return TRUE;
|
2010-12-10 12:13:41 +01:00
|
|
|
|
|
|
|
/* Check if the main dll is present on this system */
|
|
|
|
CharLowerA(lpszName);
|
|
|
|
strcpy(dllname, lpszName);
|
|
|
|
*strstr(dllname, testexe) = 0;
|
|
|
|
|
2010-12-09 12:19:08 +01:00
|
|
|
if (test_filtered_out( lpszName, NULL ))
|
|
|
|
{
|
|
|
|
nr_of_skips++;
|
2021-04-21 09:32:37 +02:00
|
|
|
if (exclude_tests) xprintf (" %s=skipped\n", dllname);
|
2010-12-09 12:19:08 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2010-07-17 08:48:42 +02:00
|
|
|
extract_test (&wine_tests[nr_of_files], tempdir, lpszName);
|
|
|
|
|
|
|
|
if (pCreateActCtxA != NULL && pActivateActCtx != NULL &&
|
|
|
|
pDeactivateActCtx != NULL && pReleaseActCtx != NULL)
|
|
|
|
{
|
|
|
|
ACTCTXA actctxinfo;
|
|
|
|
memset(&actctxinfo, 0, sizeof(ACTCTXA));
|
|
|
|
actctxinfo.cbSize = sizeof(ACTCTXA);
|
|
|
|
actctxinfo.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
|
|
|
|
actctxinfo.lpSource = wine_tests[nr_of_files].exename;
|
2012-01-19 21:05:28 +01:00
|
|
|
actctxinfo.lpResourceName = (LPSTR)CREATEPROCESS_MANIFEST_RESOURCE_ID;
|
2010-07-17 08:48:42 +02:00
|
|
|
actctx = pCreateActCtxA(&actctxinfo);
|
|
|
|
if (actctx != INVALID_HANDLE_VALUE &&
|
|
|
|
! pActivateActCtx(actctx, &cookie))
|
|
|
|
{
|
|
|
|
pReleaseActCtx(actctx);
|
|
|
|
actctx = INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
} else actctx = INVALID_HANDLE_VALUE;
|
|
|
|
|
2009-02-25 11:56:31 +01:00
|
|
|
wine_tests[nr_of_files].maindllpath = NULL;
|
2009-03-05 10:07:37 +01:00
|
|
|
strcpy(filename, dllname);
|
2007-08-03 12:59:36 +02:00
|
|
|
dll = LoadLibraryExA(dllname, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
2009-09-14 15:10:32 +02:00
|
|
|
|
2009-09-29 13:06:09 +02:00
|
|
|
if (!dll) dll = load_com_dll(dllname, &wine_tests[nr_of_files].maindllpath, filename);
|
2009-09-14 15:10:32 +02:00
|
|
|
|
2009-02-03 20:45:34 +01:00
|
|
|
if (!dll && pLoadLibraryShim)
|
|
|
|
{
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, dllname, -1, dllnameW, MAX_PATH);
|
2009-10-13 14:51:39 +02:00
|
|
|
if (SUCCEEDED( pLoadLibraryShim(dllnameW, NULL, NULL, &dll) ) && dll)
|
|
|
|
{
|
2009-09-14 15:10:32 +02:00
|
|
|
get_dll_path(dll, &wine_tests[nr_of_files].maindllpath, filename);
|
2009-10-13 14:51:39 +02:00
|
|
|
FreeLibrary(dll);
|
|
|
|
dll = LoadLibraryExA(filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
|
|
|
}
|
|
|
|
else dll = 0;
|
2009-02-03 20:45:34 +01:00
|
|
|
}
|
2009-09-14 15:10:32 +02:00
|
|
|
|
2021-03-10 18:15:58 +01:00
|
|
|
run = TRUE;
|
2021-03-16 10:34:07 +01:00
|
|
|
if (dll)
|
2014-11-10 02:44:05 +01:00
|
|
|
{
|
2021-03-10 18:15:58 +01:00
|
|
|
if (is_stub_dll(dllname))
|
2014-11-10 02:44:05 +01:00
|
|
|
{
|
2021-03-10 18:15:58 +01:00
|
|
|
xprintf (" %s=dll is a stub\n", dllname);
|
|
|
|
run = FALSE;
|
2014-11-10 02:44:05 +01:00
|
|
|
}
|
2021-03-10 18:15:58 +01:00
|
|
|
else if (is_native_dll(dll))
|
2010-07-17 08:48:42 +02:00
|
|
|
{
|
2021-03-15 19:28:40 +01:00
|
|
|
xprintf (" %s=dll is native\n", dllname);
|
2021-03-10 18:15:58 +01:00
|
|
|
nr_native_dlls++;
|
|
|
|
run = FALSE;
|
2010-07-17 08:48:42 +02:00
|
|
|
}
|
2021-03-10 18:15:58 +01:00
|
|
|
FreeLibrary(dll);
|
2009-10-13 14:51:39 +02:00
|
|
|
}
|
2007-08-03 12:59:36 +02:00
|
|
|
|
2021-03-10 18:15:58 +01:00
|
|
|
if (run)
|
2008-11-19 13:24:43 +01:00
|
|
|
{
|
2021-03-10 18:15:58 +01:00
|
|
|
err = get_subtests( tempdir, &wine_tests[nr_of_files], lpszName );
|
2021-03-16 10:34:07 +01:00
|
|
|
switch (err)
|
2021-03-10 18:15:58 +01:00
|
|
|
{
|
2021-03-16 10:34:07 +01:00
|
|
|
case 0:
|
2021-03-10 18:15:58 +01:00
|
|
|
xprintf (" %s=%s\n", dllname, get_file_version(filename));
|
|
|
|
nr_of_tests += wine_tests[nr_of_files].subtest_count;
|
|
|
|
nr_of_files++;
|
2021-03-16 10:34:07 +01:00
|
|
|
break;
|
|
|
|
case STATUS_DLL_NOT_FOUND:
|
|
|
|
xprintf (" %s=dll is missing\n", dllname);
|
2021-03-29 15:52:59 +02:00
|
|
|
/* or it is a side-by-side dll but the test has no manifest */
|
2021-03-16 10:34:07 +01:00
|
|
|
break;
|
|
|
|
case STATUS_ORDINAL_NOT_FOUND:
|
|
|
|
xprintf (" %s=dll is missing an ordinal (%s)\n", dllname, get_file_version(filename));
|
|
|
|
break;
|
|
|
|
case STATUS_ENTRYPOINT_NOT_FOUND:
|
|
|
|
xprintf (" %s=dll is missing an entrypoint (%s)\n", dllname, get_file_version(filename));
|
|
|
|
break;
|
2021-03-29 15:52:59 +02:00
|
|
|
case ERROR_SXS_CANT_GEN_ACTCTX:
|
|
|
|
xprintf (" %s=dll is missing the requested side-by-side version\n", dllname);
|
|
|
|
break;
|
2021-03-16 10:34:07 +01:00
|
|
|
default:
|
2021-03-10 18:15:58 +01:00
|
|
|
xprintf (" %s=load error %u\n", dllname, err);
|
2021-03-16 10:34:07 +01:00
|
|
|
break;
|
|
|
|
}
|
2008-11-19 13:24:43 +01:00
|
|
|
}
|
2010-07-17 08:48:42 +02:00
|
|
|
|
|
|
|
if (actctx != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
pDeactivateActCtx(0, cookie);
|
|
|
|
pReleaseActCtx(actctx);
|
|
|
|
}
|
2006-09-11 14:23:07 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static char *
|
2009-05-31 13:43:52 +02:00
|
|
|
run_tests (char *logname, char *outdir)
|
2004-01-15 02:48:05 +01:00
|
|
|
{
|
2006-09-11 14:23:07 +02:00
|
|
|
int i;
|
2004-06-16 00:45:15 +02:00
|
|
|
char *strres, *eol, *nextline;
|
|
|
|
DWORD strsize;
|
2008-07-10 17:45:22 +02:00
|
|
|
SECURITY_ATTRIBUTES sa;
|
|
|
|
char tmppath[MAX_PATH], tempdir[MAX_PATH+4];
|
2021-07-19 15:16:59 +02:00
|
|
|
BOOL newdir;
|
2009-02-25 11:56:31 +01:00
|
|
|
DWORD needed;
|
2010-07-17 08:48:42 +02:00
|
|
|
HMODULE kernel32;
|
2009-02-25 11:56:31 +01:00
|
|
|
|
|
|
|
/* Get the current PATH only once */
|
|
|
|
needed = GetEnvironmentVariableA("PATH", NULL, 0);
|
2009-05-17 13:28:23 +02:00
|
|
|
curpath = heap_alloc(needed);
|
2009-02-25 11:56:31 +01:00
|
|
|
GetEnvironmentVariableA("PATH", curpath, needed);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2004-07-06 23:03:22 +02:00
|
|
|
SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2008-07-10 17:45:22 +02:00
|
|
|
if (!GetTempPathA( MAX_PATH, tmppath ))
|
|
|
|
report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
|
|
|
|
|
2004-02-19 05:12:42 +01:00
|
|
|
if (!logname) {
|
2008-07-10 17:45:22 +02:00
|
|
|
static char tmpname[MAX_PATH];
|
|
|
|
if (!GetTempFileNameA( tmppath, "res", 0, tmpname ))
|
|
|
|
report (R_FATAL, "Can't name logfile.");
|
|
|
|
logname = tmpname;
|
2004-02-19 05:12:42 +01:00
|
|
|
}
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_OUT, logname);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2008-07-10 17:45:22 +02:00
|
|
|
/* make handle inheritable */
|
|
|
|
sa.nLength = sizeof(sa);
|
|
|
|
sa.lpSecurityDescriptor = NULL;
|
|
|
|
sa.bInheritHandle = TRUE;
|
2004-06-16 00:45:15 +02:00
|
|
|
|
2021-12-20 11:46:18 +01:00
|
|
|
logfile = strcmp(logname, "-") == 0 ? GetStdHandle( STD_OUTPUT_HANDLE ) :
|
|
|
|
CreateFileA( logname, GENERIC_READ|GENERIC_WRITE,
|
2008-07-10 17:45:22 +02:00
|
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
|
|
|
&sa, CREATE_ALWAYS, 0, NULL );
|
2008-07-16 18:33:12 +02:00
|
|
|
|
|
|
|
if ((logfile == INVALID_HANDLE_VALUE) &&
|
|
|
|
(GetLastError() == ERROR_INVALID_PARAMETER)) {
|
|
|
|
/* FILE_SHARE_DELETE not supported on win9x */
|
|
|
|
logfile = CreateFileA( logname, GENERIC_READ|GENERIC_WRITE,
|
|
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
|
|
&sa, CREATE_ALWAYS, 0, NULL );
|
|
|
|
}
|
2008-07-10 17:45:22 +02:00
|
|
|
if (logfile == INVALID_HANDLE_VALUE)
|
|
|
|
report (R_FATAL, "Could not open logfile: %u", GetLastError());
|
|
|
|
|
2021-07-19 15:16:59 +02:00
|
|
|
if (outdir)
|
2021-07-26 11:55:45 +02:00
|
|
|
{
|
|
|
|
/* Get a full path so it is still valid after a chdir */
|
|
|
|
GetFullPathNameA( outdir, ARRAY_SIZE(tempdir), tempdir, NULL );
|
|
|
|
}
|
2021-07-19 15:16:59 +02:00
|
|
|
else
|
|
|
|
{
|
2009-05-31 13:43:52 +02:00
|
|
|
strcpy( tempdir, tmppath );
|
2021-07-19 15:16:59 +02:00
|
|
|
strcat( tempdir, "wct" ); /* try stable path for ZoneAlarm */
|
2005-03-29 21:51:49 +02:00
|
|
|
}
|
2021-07-19 15:16:59 +02:00
|
|
|
newdir = CreateDirectoryA( tempdir, NULL );
|
|
|
|
if (!newdir && !outdir)
|
|
|
|
{
|
|
|
|
if (!GetTempFileNameA( tmppath, "wct", 0, tempdir ))
|
|
|
|
report (R_FATAL, "Can't name temporary dir (check %%TEMP%%).");
|
|
|
|
DeleteFileA( tempdir );
|
|
|
|
newdir = CreateDirectoryA( tempdir, NULL );
|
|
|
|
}
|
|
|
|
if (!newdir && (!outdir || GetLastError() != ERROR_ALREADY_EXISTS))
|
|
|
|
report (R_FATAL, "Could not create directory %s (%d)", tempdir, GetLastError());
|
2009-05-31 13:43:52 +02:00
|
|
|
|
2005-03-29 21:51:49 +02:00
|
|
|
report (R_DIR, tempdir);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2007-03-02 19:09:35 +01:00
|
|
|
xprintf ("Version 4\n");
|
2008-05-27 11:48:50 +02:00
|
|
|
xprintf ("Tests from build %s\n", build_id[0] ? build_id : "-" );
|
2009-02-19 20:27:53 +01:00
|
|
|
xprintf ("Archive: -\n"); /* no longer used */
|
2005-03-31 17:22:41 +02:00
|
|
|
xprintf ("Tag: %s\n", tag);
|
2004-04-23 04:52:21 +02:00
|
|
|
xprintf ("Build info:\n");
|
2009-07-07 10:59:29 +02:00
|
|
|
strres = extract_rcdata ("BUILD_INFO", "STRINGRES", &strsize);
|
2004-06-16 00:45:15 +02:00
|
|
|
while (strres) {
|
|
|
|
eol = memchr (strres, '\n', strsize);
|
|
|
|
if (!eol) {
|
|
|
|
nextline = NULL;
|
|
|
|
eol = strres + strsize;
|
|
|
|
} else {
|
|
|
|
strsize -= eol - strres + 1;
|
|
|
|
nextline = strsize?eol+1:NULL;
|
|
|
|
if (eol > strres && *(eol-1) == '\r') eol--;
|
|
|
|
}
|
|
|
|
xprintf (" %.*s\n", eol-strres, strres);
|
|
|
|
strres = nextline;
|
|
|
|
}
|
2003-12-04 03:01:39 +01:00
|
|
|
xprintf ("Operating system version:\n");
|
|
|
|
print_version ();
|
2011-07-29 14:59:45 +02:00
|
|
|
print_language ();
|
2007-08-23 08:55:05 +02:00
|
|
|
xprintf ("Dll info:\n" );
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_STATUS, "Counting tests");
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!EnumResourceNamesA (NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files))
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_FATAL, "Can't enumerate test files: %d",
|
|
|
|
GetLastError ());
|
2009-05-17 13:28:23 +02:00
|
|
|
wine_tests = heap_alloc (nr_of_files * sizeof wine_tests[0]);
|
2004-01-15 02:48:05 +01:00
|
|
|
|
2009-02-03 20:45:34 +01:00
|
|
|
/* Do this only once during extraction (and version checking) */
|
|
|
|
hmscoree = LoadLibraryA("mscoree.dll");
|
|
|
|
pLoadLibraryShim = NULL;
|
|
|
|
if (hmscoree)
|
|
|
|
pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
|
2010-07-17 08:48:42 +02:00
|
|
|
kernel32 = GetModuleHandleA("kernel32.dll");
|
|
|
|
pCreateActCtxA = (void *)GetProcAddress(kernel32, "CreateActCtxA");
|
|
|
|
pActivateActCtx = (void *)GetProcAddress(kernel32, "ActivateActCtx");
|
|
|
|
pDeactivateActCtx = (void *)GetProcAddress(kernel32, "DeactivateActCtx");
|
|
|
|
pReleaseActCtx = (void *)GetProcAddress(kernel32, "ReleaseActCtx");
|
2009-02-03 20:45:34 +01:00
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_STATUS, "Extracting tests");
|
2004-02-21 05:01:56 +01:00
|
|
|
report (R_PROGRESS, 0, nr_of_files);
|
2006-09-11 14:23:07 +02:00
|
|
|
nr_of_files = 0;
|
|
|
|
nr_of_tests = 0;
|
2010-12-09 12:19:08 +01:00
|
|
|
nr_of_skips = 0;
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!EnumResourceNamesA (NULL, "TESTRES", extract_test_proc, (LPARAM)tempdir))
|
2006-09-11 14:23:07 +02:00
|
|
|
report (R_FATAL, "Can't enumerate test files: %d",
|
|
|
|
GetLastError ());
|
|
|
|
|
2009-02-03 20:45:34 +01:00
|
|
|
FreeLibrary(hmscoree);
|
|
|
|
|
2010-06-22 19:36:08 +02:00
|
|
|
if (aborting) return logname;
|
|
|
|
|
2007-08-23 08:55:05 +02:00
|
|
|
xprintf ("Test output:\n" );
|
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_DELTA, 0, "Extracting: Done");
|
|
|
|
|
2009-10-26 13:38:05 +01:00
|
|
|
if (nr_native_dlls)
|
|
|
|
report( R_WARNING, "Some dlls are configured as native, you won't be able to submit results." );
|
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
report (R_STATUS, "Running tests");
|
2004-02-21 05:01:56 +01:00
|
|
|
report (R_PROGRESS, 1, nr_of_tests);
|
2004-01-15 02:48:05 +01:00
|
|
|
for (i = 0; i < nr_of_files; i++) {
|
|
|
|
struct wine_test *test = wine_tests + i;
|
|
|
|
int j;
|
|
|
|
|
2010-06-22 19:36:08 +02:00
|
|
|
if (aborting) break;
|
|
|
|
|
2009-02-25 11:56:31 +01:00
|
|
|
if (test->maindllpath) {
|
|
|
|
/* We need to add the path (to the main dll) to PATH */
|
|
|
|
append_path(test->maindllpath);
|
|
|
|
}
|
|
|
|
|
2004-01-15 02:48:05 +01:00
|
|
|
for (j = 0; j < test->subtest_count; j++) {
|
2010-06-22 19:36:08 +02:00
|
|
|
if (aborting) break;
|
2010-12-09 12:05:19 +01:00
|
|
|
run_test (test, test->subtests[j], logfile, tempdir);
|
2004-01-15 02:48:05 +01:00
|
|
|
}
|
2009-02-25 11:56:31 +01:00
|
|
|
|
|
|
|
if (test->maindllpath) {
|
|
|
|
/* Restore PATH again */
|
|
|
|
SetEnvironmentVariableA("PATH", curpath);
|
|
|
|
}
|
2004-01-15 02:48:05 +01:00
|
|
|
}
|
|
|
|
report (R_DELTA, 0, "Running: Done");
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2013-06-01 00:09:43 +02:00
|
|
|
report (R_STATUS, "Cleaning up - %u failures", failures);
|
2021-12-20 11:46:18 +01:00
|
|
|
if (strcmp(logname, "-") != 0) CloseHandle( logfile );
|
2008-07-10 17:45:22 +02:00
|
|
|
logfile = 0;
|
2021-07-19 15:16:59 +02:00
|
|
|
if (newdir)
|
2009-05-31 13:43:52 +02:00
|
|
|
remove_dir (tempdir);
|
2009-05-17 13:28:23 +02:00
|
|
|
heap_free(wine_tests);
|
|
|
|
heap_free(curpath);
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2004-02-19 05:12:42 +01:00
|
|
|
return logname;
|
|
|
|
}
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2009-01-17 00:21:20 +01:00
|
|
|
static BOOL WINAPI ctrl_handler(DWORD ctrl_type)
|
|
|
|
{
|
|
|
|
if (ctrl_type == CTRL_C_EVENT) {
|
|
|
|
printf("Ignoring Ctrl-C, use Ctrl-Break if you really want to terminate\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-04-17 22:02:26 +02:00
|
|
|
|
|
|
|
static BOOL CALLBACK
|
2012-01-19 21:05:28 +01:00
|
|
|
extract_only_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lParam)
|
2009-04-17 22:02:26 +02:00
|
|
|
{
|
|
|
|
const char *target_dir = (const char *)lParam;
|
|
|
|
char filename[MAX_PATH];
|
|
|
|
|
|
|
|
if (test_filtered_out( lpszName, NULL )) return TRUE;
|
|
|
|
|
|
|
|
strcpy(filename, lpszName);
|
|
|
|
CharLowerA(filename);
|
|
|
|
|
|
|
|
extract_test( &wine_tests[nr_of_files], target_dir, filename );
|
|
|
|
nr_of_files++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void extract_only (const char *target_dir)
|
|
|
|
{
|
|
|
|
BOOL res;
|
|
|
|
|
|
|
|
report (R_DIR, target_dir);
|
|
|
|
res = CreateDirectoryA( target_dir, NULL );
|
|
|
|
if (!res && GetLastError() != ERROR_ALREADY_EXISTS)
|
|
|
|
report (R_FATAL, "Could not create directory: %s (%d)", target_dir, GetLastError ());
|
|
|
|
|
|
|
|
nr_of_files = 0;
|
|
|
|
report (R_STATUS, "Counting tests");
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!EnumResourceNamesA(NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files))
|
2009-04-17 22:02:26 +02:00
|
|
|
report (R_FATAL, "Can't enumerate test files: %d", GetLastError ());
|
|
|
|
|
2009-05-17 13:28:23 +02:00
|
|
|
wine_tests = heap_alloc (nr_of_files * sizeof wine_tests[0] );
|
2009-04-17 22:02:26 +02:00
|
|
|
|
|
|
|
report (R_STATUS, "Extracting tests");
|
|
|
|
report (R_PROGRESS, 0, nr_of_files);
|
|
|
|
nr_of_files = 0;
|
2012-01-19 21:05:28 +01:00
|
|
|
if (!EnumResourceNamesA(NULL, "TESTRES", extract_only_proc, (LPARAM)target_dir))
|
2009-04-17 22:02:26 +02:00
|
|
|
report (R_FATAL, "Can't enumerate test files: %d", GetLastError ());
|
|
|
|
|
|
|
|
report (R_DELTA, 0, "Extracting: Done");
|
|
|
|
}
|
|
|
|
|
2005-06-04 12:01:25 +02:00
|
|
|
static void
|
|
|
|
usage (void)
|
2004-02-19 05:12:42 +01:00
|
|
|
{
|
2007-01-09 23:42:26 +01:00
|
|
|
fprintf (stderr,
|
2008-11-19 12:19:42 +01:00
|
|
|
"Usage: winetest [OPTION]... [TESTS]\n\n"
|
2009-04-17 16:21:00 +02:00
|
|
|
" --help print this message and exit\n"
|
|
|
|
" --version print the build version and exit\n"
|
|
|
|
" -c console mode, no GUI\n"
|
2009-06-02 01:32:43 +02:00
|
|
|
" -d DIR Use DIR as temp directory (default: %%TEMP%%\\wct)\n"
|
2009-04-17 16:21:00 +02:00
|
|
|
" -e preserve the environment\n"
|
|
|
|
" -h print this message and exit\n"
|
2010-09-28 20:12:10 +02:00
|
|
|
" -i INFO an optional description of the test platform\n"
|
2010-02-06 10:21:22 +01:00
|
|
|
" -m MAIL an email address to enable developers to contact you\n"
|
2010-09-28 20:10:46 +02:00
|
|
|
" -n exclude the specified tests\n"
|
2009-04-17 16:21:00 +02:00
|
|
|
" -p shutdown when the tests are done\n"
|
|
|
|
" -q quiet mode, no output at all\n"
|
|
|
|
" -o FILE put report into FILE, do not submit\n"
|
|
|
|
" -s FILE submit FILE, do not run tests\n"
|
2017-02-10 16:42:48 +01:00
|
|
|
" -S URL URL to submit the results to\n"
|
2009-04-17 22:02:26 +02:00
|
|
|
" -t TAG include TAG of characters [-.0-9a-zA-Z] in the report\n"
|
2010-11-21 16:43:18 +01:00
|
|
|
" -u URL include TestBot URL in the report\n"
|
2009-04-17 22:02:26 +02:00
|
|
|
" -x DIR Extract tests to DIR (default: .\\wct) and exit\n");
|
2004-01-15 02:48:05 +01:00
|
|
|
}
|
2003-12-04 03:01:39 +01:00
|
|
|
|
2019-10-17 17:05:47 +02:00
|
|
|
int __cdecl main( int argc, char *argv[] )
|
2004-01-15 02:48:05 +01:00
|
|
|
{
|
2010-12-27 14:45:17 +01:00
|
|
|
BOOL (WINAPI *pIsWow64Process)(HANDLE hProcess, PBOOL Wow64Process);
|
2009-05-31 13:43:52 +02:00
|
|
|
char *logname = NULL, *outdir = NULL;
|
2009-04-17 22:02:26 +02:00
|
|
|
const char *extract = NULL;
|
2017-02-10 16:42:48 +01:00
|
|
|
const char *cp, *submit = NULL, *submiturl = NULL;
|
2004-07-23 01:42:03 +02:00
|
|
|
int reset_env = 1;
|
2007-10-28 02:48:59 +02:00
|
|
|
int poweroff = 0;
|
2005-03-31 17:22:41 +02:00
|
|
|
int interactive = 1;
|
2008-12-16 12:07:53 +01:00
|
|
|
int i;
|
2004-02-19 05:12:42 +01:00
|
|
|
|
2021-06-16 04:33:57 +02:00
|
|
|
InitCommonControls();
|
|
|
|
|
2008-05-27 11:48:50 +02:00
|
|
|
if (!LoadStringA( 0, IDS_BUILD_ID, build_id, sizeof(build_id) )) build_id[0] = 0;
|
|
|
|
|
2010-12-27 14:45:17 +01:00
|
|
|
pIsWow64Process = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"),"IsWow64Process");
|
|
|
|
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
|
|
|
|
|
2009-04-17 22:02:26 +02:00
|
|
|
for (i = 1; i < argc && argv[i]; i++)
|
2008-12-16 12:07:53 +01:00
|
|
|
{
|
2009-04-17 16:21:00 +02:00
|
|
|
if (!strcmp(argv[i], "--help")) {
|
|
|
|
usage ();
|
|
|
|
exit (0);
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--version")) {
|
|
|
|
printf("%-12.12s\n", build_id[0] ? build_id : "unknown");
|
|
|
|
exit (0);
|
|
|
|
}
|
|
|
|
else if ((argv[i][0] != '-' && argv[i][0] != '/') || argv[i][2]) {
|
2018-07-24 22:13:46 +02:00
|
|
|
if (nb_filters == ARRAY_SIZE(filters))
|
2008-11-19 12:19:42 +01:00
|
|
|
{
|
|
|
|
report (R_ERROR, "Too many test filters specified");
|
|
|
|
exit (2);
|
|
|
|
}
|
2008-12-16 12:07:53 +01:00
|
|
|
filters[nb_filters++] = argv[i];
|
2004-03-25 00:40:06 +01:00
|
|
|
}
|
2008-12-16 12:07:53 +01:00
|
|
|
else switch (argv[i][1]) {
|
2004-03-25 00:40:06 +01:00
|
|
|
case 'c':
|
|
|
|
report (R_TEXTMODE);
|
2005-03-31 17:22:41 +02:00
|
|
|
interactive = 0;
|
2004-03-25 00:40:06 +01:00
|
|
|
break;
|
2004-07-23 01:42:03 +02:00
|
|
|
case 'e':
|
|
|
|
reset_env = 0;
|
|
|
|
break;
|
2004-03-25 00:40:06 +01:00
|
|
|
case 'h':
|
2007-10-28 02:48:59 +02:00
|
|
|
case '?':
|
2004-03-25 00:40:06 +01:00
|
|
|
usage ();
|
|
|
|
exit (0);
|
2010-09-28 20:12:10 +02:00
|
|
|
case 'i':
|
|
|
|
if (!(description = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
|
|
|
break;
|
2010-02-06 10:21:22 +01:00
|
|
|
case 'm':
|
|
|
|
if (!(email = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
|
|
|
break;
|
2010-09-28 20:10:46 +02:00
|
|
|
case 'n':
|
|
|
|
exclude_tests = TRUE;
|
|
|
|
break;
|
2007-10-28 02:48:59 +02:00
|
|
|
case 'p':
|
|
|
|
poweroff = 1;
|
|
|
|
break;
|
2004-03-25 00:40:06 +01:00
|
|
|
case 'q':
|
|
|
|
report (R_QUIET);
|
2005-03-31 17:22:41 +02:00
|
|
|
interactive = 0;
|
2004-03-25 00:40:06 +01:00
|
|
|
break;
|
|
|
|
case 's':
|
2008-12-16 12:07:53 +01:00
|
|
|
if (!(submit = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
2017-02-10 16:42:48 +01:00
|
|
|
break;
|
|
|
|
case 'S':
|
|
|
|
if (!(submiturl = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
2004-03-25 00:40:06 +01:00
|
|
|
break;
|
|
|
|
case 'o':
|
2008-12-16 12:07:53 +01:00
|
|
|
if (!(logname = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
2004-03-25 00:40:06 +01:00
|
|
|
break;
|
|
|
|
case 't':
|
2008-12-16 12:07:53 +01:00
|
|
|
if (!(tag = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
2005-04-11 18:10:01 +02:00
|
|
|
if (strlen (tag) > MAXTAGLEN)
|
|
|
|
report (R_FATAL, "tag is too long (maximum %d characters)",
|
|
|
|
MAXTAGLEN);
|
2005-04-18 11:54:24 +02:00
|
|
|
cp = findbadtagchar (tag);
|
2004-03-25 00:40:06 +01:00
|
|
|
if (cp) {
|
|
|
|
report (R_ERROR, "invalid char in tag: %c", *cp);
|
2004-02-19 05:12:42 +01:00
|
|
|
usage ();
|
|
|
|
exit (2);
|
|
|
|
}
|
2004-03-25 00:40:06 +01:00
|
|
|
break;
|
2010-11-21 16:43:18 +01:00
|
|
|
case 'u':
|
|
|
|
if (!(url = argv[++i]))
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
exit( 2 );
|
|
|
|
}
|
|
|
|
break;
|
2009-04-17 22:02:26 +02:00
|
|
|
case 'x':
|
2009-04-26 19:55:03 +02:00
|
|
|
report (R_TEXTMODE);
|
2009-04-17 22:02:26 +02:00
|
|
|
if (!(extract = argv[++i]))
|
|
|
|
extract = ".\\wct";
|
|
|
|
|
|
|
|
extract_only (extract);
|
|
|
|
break;
|
2009-05-31 13:43:52 +02:00
|
|
|
case 'd':
|
|
|
|
outdir = argv[++i];
|
|
|
|
break;
|
2004-03-25 00:40:06 +01:00
|
|
|
default:
|
2008-12-16 12:07:53 +01:00
|
|
|
report (R_ERROR, "invalid option: -%c", argv[i][1]);
|
2004-03-25 00:40:06 +01:00
|
|
|
usage ();
|
|
|
|
exit (2);
|
|
|
|
}
|
2004-02-19 05:12:42 +01:00
|
|
|
}
|
2017-02-10 16:42:48 +01:00
|
|
|
if (submit) {
|
|
|
|
if (tag)
|
|
|
|
report (R_WARNING, "ignoring tag for submission");
|
|
|
|
send_file (submiturl, submit);
|
|
|
|
|
|
|
|
} else if (!extract) {
|
2010-12-16 15:29:59 +01:00
|
|
|
int is_win9x = (GetVersion() & 0x80000000) != 0;
|
|
|
|
|
2005-03-31 17:22:41 +02:00
|
|
|
report (R_STATUS, "Starting up");
|
|
|
|
|
2010-12-16 15:29:59 +01:00
|
|
|
if (is_win9x)
|
|
|
|
report (R_WARNING, "Running on win9x is not supported. You won't be able to submit results.");
|
|
|
|
|
2005-03-31 17:22:41 +02:00
|
|
|
if (!running_on_visible_desktop ())
|
|
|
|
report (R_FATAL, "Tests must be run on a visible desktop");
|
2005-03-25 18:11:52 +01:00
|
|
|
|
2010-12-27 14:45:17 +01:00
|
|
|
if (running_under_wine())
|
|
|
|
{
|
|
|
|
if (!check_mount_mgr())
|
|
|
|
report (R_FATAL, "Mount manager not running, most likely your WINEPREFIX wasn't created correctly.");
|
|
|
|
|
|
|
|
if (!check_wow64_registry())
|
|
|
|
report (R_FATAL, "WoW64 keys missing, most likely your WINEPREFIX wasn't created correctly.");
|
2010-03-05 13:10:16 +01:00
|
|
|
|
2010-12-27 14:45:17 +01:00
|
|
|
if (!check_display_driver())
|
|
|
|
report (R_FATAL, "Unable to create a window, the display driver is not working.");
|
|
|
|
}
|
2010-01-28 15:50:52 +01:00
|
|
|
|
2009-01-17 00:21:20 +01:00
|
|
|
SetConsoleCtrlHandler(ctrl_handler, TRUE);
|
|
|
|
|
2008-08-01 10:48:58 +02:00
|
|
|
if (reset_env)
|
|
|
|
{
|
|
|
|
SetEnvironmentVariableA( "WINETEST_PLATFORM", running_under_wine () ? "wine" : "windows" );
|
|
|
|
SetEnvironmentVariableA( "WINETEST_DEBUG", "1" );
|
|
|
|
SetEnvironmentVariableA( "WINETEST_INTERACTIVE", "0" );
|
|
|
|
SetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", "0" );
|
|
|
|
}
|
2004-07-23 01:42:03 +02:00
|
|
|
|
2017-06-27 19:12:23 +02:00
|
|
|
if (nb_filters && !exclude_tests)
|
|
|
|
{
|
|
|
|
run_tests( logname, outdir );
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2010-12-09 12:19:08 +01:00
|
|
|
while (!tag) {
|
|
|
|
if (!interactive)
|
|
|
|
report (R_FATAL, "Please specify a tag (-t option) if "
|
|
|
|
"running noninteractive!");
|
|
|
|
if (guiAskTag () == IDABORT) exit (1);
|
|
|
|
}
|
|
|
|
report (R_TAG);
|
2010-02-06 10:21:22 +01:00
|
|
|
|
2010-12-09 12:19:08 +01:00
|
|
|
while (!email) {
|
|
|
|
if (!interactive)
|
|
|
|
report (R_FATAL, "Please specify an email address (-m option) to enable developers\n"
|
|
|
|
" to contact you about your report if necessary.");
|
|
|
|
if (guiAskEmail () == IDABORT) exit (1);
|
2008-11-19 12:19:42 +01:00
|
|
|
}
|
2008-05-27 11:48:50 +02:00
|
|
|
|
2010-12-09 12:19:08 +01:00
|
|
|
if (!build_id[0])
|
|
|
|
report( R_WARNING, "You won't be able to submit results without a valid build id.\n"
|
|
|
|
"To submit results, winetest needs to be built from a git checkout." );
|
|
|
|
|
2004-10-04 21:32:20 +02:00
|
|
|
if (!logname) {
|
2009-05-31 13:43:52 +02:00
|
|
|
logname = run_tests (NULL, outdir);
|
2010-06-22 19:36:08 +02:00
|
|
|
if (aborting) {
|
|
|
|
DeleteFileA(logname);
|
|
|
|
exit (0);
|
|
|
|
}
|
2011-04-22 13:20:49 +02:00
|
|
|
if (failures > FAILURES_LIMIT)
|
|
|
|
report( R_WARNING,
|
2018-12-11 04:57:06 +01:00
|
|
|
"%d tests failed. There is probably something broken with your setup.\n"
|
2011-04-22 13:20:49 +02:00
|
|
|
"You need to address this before submitting results.", failures );
|
|
|
|
|
|
|
|
if (build_id[0] && nr_of_skips <= SKIP_LIMIT && failures <= FAILURES_LIMIT &&
|
|
|
|
!nr_native_dlls && !is_win9x &&
|
2008-05-27 11:48:50 +02:00
|
|
|
report (R_ASK, MB_YESNO, "Do you want to submit the test results?") == IDYES)
|
2017-02-10 16:42:48 +01:00
|
|
|
if (!send_file (submiturl, logname) && !DeleteFileA(logname))
|
2008-07-10 17:45:22 +02:00
|
|
|
report (R_WARNING, "Can't remove logfile: %u", GetLastError());
|
2009-05-31 13:43:52 +02:00
|
|
|
} else run_tests (logname, outdir);
|
2013-06-01 00:09:43 +02:00
|
|
|
report (R_STATUS, "Finished - %u failures", failures);
|
2004-02-19 05:12:42 +01:00
|
|
|
}
|
2007-10-28 02:48:59 +02:00
|
|
|
if (poweroff)
|
|
|
|
{
|
|
|
|
HANDLE hToken;
|
|
|
|
TOKEN_PRIVILEGES npr;
|
|
|
|
|
|
|
|
/* enable the shutdown privilege for the current process */
|
|
|
|
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
|
|
|
|
{
|
2012-01-19 21:05:28 +01:00
|
|
|
LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid);
|
2007-10-28 02:48:59 +02:00
|
|
|
npr.PrivilegeCount = 1;
|
|
|
|
npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
|
|
|
AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0);
|
|
|
|
CloseHandle(hToken);
|
|
|
|
}
|
|
|
|
ExitWindowsEx(EWX_SHUTDOWN | EWX_POWEROFF | EWX_FORCEIFHUNG, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER);
|
|
|
|
}
|
2004-01-15 02:48:05 +01:00
|
|
|
exit (0);
|
2003-12-04 03:01:39 +01:00
|
|
|
}
|