2009-08-12 22:50:52 +02:00
|
|
|
/*
|
|
|
|
* Utility routines for comctl32 v6 tests
|
|
|
|
*
|
|
|
|
* Copyright 2006 Mike McCormack for CodeWeavers
|
|
|
|
* Copyright 2007 George Gov
|
|
|
|
* Copyright 2009 Owen Rudge for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
#define ARCH "x86"
|
|
|
|
#elif defined __x86_64__
|
|
|
|
#define ARCH "amd64"
|
2015-08-09 14:03:33 +02:00
|
|
|
#elif defined __arm__
|
|
|
|
#define ARCH "arm"
|
|
|
|
#elif defined __aarch64__
|
|
|
|
#define ARCH "arm64"
|
2009-08-12 22:50:52 +02:00
|
|
|
#else
|
|
|
|
#define ARCH "none"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const CHAR manifest_name[] = "cc6.manifest";
|
|
|
|
|
|
|
|
static const CHAR manifest[] =
|
|
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
|
|
|
|
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
|
|
|
|
" <assemblyIdentity\n"
|
|
|
|
" type=\"win32\"\n"
|
|
|
|
" name=\"Wine.ComCtl32.Tests\"\n"
|
|
|
|
" version=\"1.0.0.0\"\n"
|
|
|
|
" processorArchitecture=\"" ARCH "\"\n"
|
|
|
|
" />\n"
|
|
|
|
"<description>Wine comctl32 test suite</description>\n"
|
|
|
|
"<dependency>\n"
|
|
|
|
" <dependentAssembly>\n"
|
|
|
|
" <assemblyIdentity\n"
|
|
|
|
" type=\"win32\"\n"
|
|
|
|
" name=\"microsoft.windows.common-controls\"\n"
|
|
|
|
" version=\"6.0.0.0\"\n"
|
|
|
|
" processorArchitecture=\"" ARCH "\"\n"
|
|
|
|
" publicKeyToken=\"6595b64144ccf1df\"\n"
|
|
|
|
" language=\"*\"\n"
|
|
|
|
" />\n"
|
|
|
|
"</dependentAssembly>\n"
|
|
|
|
"</dependency>\n"
|
|
|
|
"</assembly>\n";
|
|
|
|
|
2009-10-20 19:57:48 +02:00
|
|
|
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
|
2009-08-12 22:50:52 +02:00
|
|
|
{
|
2018-01-23 12:44:18 +01:00
|
|
|
DeactivateActCtx(0, cookie);
|
|
|
|
ReleaseActCtx(hCtx);
|
2009-08-12 22:50:52 +02:00
|
|
|
|
|
|
|
DeleteFileA(manifest_name);
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:57:48 +02:00
|
|
|
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
|
2009-08-12 22:50:52 +02:00
|
|
|
{
|
2013-09-09 08:00:47 +02:00
|
|
|
ACTCTX_SECTION_KEYED_DATA data;
|
2018-01-23 12:44:18 +01:00
|
|
|
DWORD written;
|
2018-01-25 15:23:18 +01:00
|
|
|
HMODULE hmod;
|
2009-08-12 22:50:52 +02:00
|
|
|
ACTCTXA ctx;
|
|
|
|
HANDLE file;
|
2018-01-23 12:44:18 +01:00
|
|
|
BOOL ret;
|
2009-08-12 22:50:52 +02:00
|
|
|
|
|
|
|
/* create manifest */
|
|
|
|
file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
|
|
|
|
if (file != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) &&
|
|
|
|
written == sizeof(manifest)-1);
|
|
|
|
CloseHandle( file );
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
DeleteFileA( manifest_name );
|
|
|
|
skip("Failed to fill manifest file. Skipping comctl32 V6 tests.\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
trace("created %s\n", manifest_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
skip("Failed to create manifest file. Skipping comctl32 V6 tests.\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&ctx, 0, sizeof(ctx));
|
|
|
|
ctx.cbSize = sizeof(ctx);
|
|
|
|
ctx.lpSource = manifest_name;
|
|
|
|
|
2018-01-23 12:44:18 +01:00
|
|
|
*hCtx = CreateActCtxA(&ctx);
|
2009-10-20 19:57:48 +02:00
|
|
|
ok(*hCtx != 0, "Expected context handle\n");
|
2009-08-12 22:50:52 +02:00
|
|
|
|
2018-01-25 15:23:18 +01:00
|
|
|
hmod = GetModuleHandleA("comctl32.dll");
|
|
|
|
|
2018-01-23 12:44:18 +01:00
|
|
|
ret = ActivateActCtx(*hCtx, pcookie);
|
2022-02-28 08:25:25 +01:00
|
|
|
ok(ret, "Failed to activate context, error %ld.\n", GetLastError());
|
2009-08-12 22:50:52 +02:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
win_skip("A problem during context activation occurred.\n");
|
|
|
|
DeleteFileA(manifest_name);
|
|
|
|
}
|
|
|
|
|
2013-09-09 08:00:47 +02:00
|
|
|
data.cbSize = sizeof(data);
|
2018-01-23 12:44:18 +01:00
|
|
|
ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
|
2013-09-09 08:00:47 +02:00
|
|
|
"comctl32.dll", &data);
|
2022-02-28 08:25:25 +01:00
|
|
|
ok(ret, "failed to find comctl32.dll in active context, %lu\n", GetLastError());
|
2013-09-09 08:00:47 +02:00
|
|
|
if (ret)
|
2018-01-25 15:23:18 +01:00
|
|
|
{
|
|
|
|
FreeLibrary(hmod);
|
2013-09-09 08:00:47 +02:00
|
|
|
LoadLibraryA("comctl32.dll");
|
2018-01-25 15:23:18 +01:00
|
|
|
}
|
2013-09-09 08:00:47 +02:00
|
|
|
|
2009-08-12 22:50:52 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef ARCH
|