mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 09:10:56 +00:00
[ATL_WINETEST]
- Sync to Wine 1.3.37 svn path=/trunk/; revision=56158
This commit is contained in:
parent
252df91f2c
commit
4ae01ae604
5 changed files with 176 additions and 13 deletions
|
@ -4,6 +4,7 @@ add_definitions(-D_DLL -D__USE_CRTIMP)
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
atl_ax.c
|
atl_ax.c
|
||||||
module.c
|
module.c
|
||||||
|
registrar.c
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
add_executable(atl_winetest ${SOURCE})
|
add_executable(atl_winetest ${SOURCE})
|
||||||
|
@ -11,5 +12,5 @@ add_executable(atl_winetest ${SOURCE})
|
||||||
target_link_libraries(atl_winetest wine uuid)
|
target_link_libraries(atl_winetest wine uuid)
|
||||||
|
|
||||||
set_module_type(atl_winetest win32cui)
|
set_module_type(atl_winetest win32cui)
|
||||||
add_importlibs(atl_winetest ole32 user32 atl msvcrt kernel32 ntdll)
|
add_importlibs(atl_winetest ole32 user32 atl msvcrt kernel32 ntdll advapi32)
|
||||||
add_cd_file(TARGET atl_winetest DESTINATION reactos/bin FOR all)
|
add_cd_file(TARGET atl_winetest DESTINATION reactos/bin FOR all)
|
||||||
|
|
|
@ -36,7 +36,14 @@
|
||||||
#include <ocidl.h>
|
#include <ocidl.h>
|
||||||
#include <exdisp.h>
|
#include <exdisp.h>
|
||||||
|
|
||||||
HRESULT WINAPI AtlAxAttachControl(IUnknown *, HWND, IUnknown **);
|
static HRESULT (WINAPI *pAtlAxAttachControl)(IUnknown *, HWND, IUnknown **);
|
||||||
|
|
||||||
|
static void init_function_pointers(void)
|
||||||
|
{
|
||||||
|
HMODULE hatl = GetModuleHandleA("atl.dll");
|
||||||
|
|
||||||
|
pAtlAxAttachControl = (void *)GetProcAddress(hatl, "AtlAxAttachControl");
|
||||||
|
}
|
||||||
|
|
||||||
static ATOM register_class(void)
|
static ATOM register_class(void)
|
||||||
{
|
{
|
||||||
|
@ -64,16 +71,16 @@ static void test_AtlAxAttachControl(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IUnknown *pObj, *pContainer;
|
IUnknown *pObj, *pContainer;
|
||||||
|
|
||||||
hr = AtlAxAttachControl(NULL, NULL, NULL);
|
hr = pAtlAxAttachControl(NULL, NULL, NULL);
|
||||||
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
||||||
|
|
||||||
pContainer = (IUnknown *)0xdeadbeef;
|
pContainer = (IUnknown *)0xdeadbeef;
|
||||||
hr = AtlAxAttachControl(NULL, NULL, &pContainer);
|
hr = pAtlAxAttachControl(NULL, NULL, &pContainer);
|
||||||
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
||||||
ok(pContainer == (IUnknown *)0xdeadbeef,
|
ok(pContainer == (IUnknown *)0xdeadbeef,
|
||||||
"Expected the output container pointer to be untouched, got %p\n", pContainer);
|
"Expected the output container pointer to be untouched, got %p\n", pContainer);
|
||||||
|
|
||||||
hr = AtlAxAttachControl(NULL, hwnd, NULL);
|
hr = pAtlAxAttachControl(NULL, hwnd, NULL);
|
||||||
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
|
hr = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
|
||||||
|
@ -86,13 +93,11 @@ static void test_AtlAxAttachControl(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = AtlAxAttachControl(pObj, NULL, NULL);
|
hr = pAtlAxAttachControl(pObj, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
|
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
|
||||||
|
|
||||||
pContainer = (IUnknown *)0xdeadbeef;
|
pContainer = (IUnknown *)0xdeadbeef;
|
||||||
hr = AtlAxAttachControl(pObj, NULL, &pContainer);
|
hr = pAtlAxAttachControl(pObj, NULL, &pContainer);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
|
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
|
||||||
ok(pContainer != (IUnknown *)0xdeadbeef &&
|
ok(pContainer != (IUnknown *)0xdeadbeef &&
|
||||||
pContainer != NULL,
|
pContainer != NULL,
|
||||||
|
@ -101,7 +106,7 @@ static void test_AtlAxAttachControl(void)
|
||||||
if (pContainer != (IUnknown *)0xdeadbeef && pContainer != NULL)
|
if (pContainer != (IUnknown *)0xdeadbeef && pContainer != NULL)
|
||||||
IUnknown_Release(pContainer);
|
IUnknown_Release(pContainer);
|
||||||
|
|
||||||
hr = AtlAxAttachControl(pObj, hwnd, NULL);
|
hr = pAtlAxAttachControl(pObj, hwnd, NULL);
|
||||||
ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
|
ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
|
||||||
|
|
||||||
IUnknown_Release(pObj);
|
IUnknown_Release(pObj);
|
||||||
|
@ -111,12 +116,17 @@ static void test_AtlAxAttachControl(void)
|
||||||
|
|
||||||
START_TEST(atl_ax)
|
START_TEST(atl_ax)
|
||||||
{
|
{
|
||||||
|
init_function_pointers();
|
||||||
|
|
||||||
if (!register_class())
|
if (!register_class())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
|
|
||||||
test_AtlAxAttachControl();
|
if (pAtlAxAttachControl)
|
||||||
|
test_AtlAxAttachControl();
|
||||||
|
else
|
||||||
|
win_skip("AtlAxAttachControl is not available\n");
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <winnls.h>
|
#include <winnls.h>
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
#include <winnt.h>
|
#include <winnt.h>
|
||||||
#include <initguid.h>
|
|
||||||
#include <wtypes.h>
|
#include <wtypes.h>
|
||||||
#include <olectl.h>
|
#include <olectl.h>
|
||||||
#include <ocidl.h>
|
#include <ocidl.h>
|
||||||
|
@ -92,10 +91,14 @@ static void test_StructSize(void)
|
||||||
ok (hres == S_OK, "AtlModuleInit with %d failed (0x%x).\n", i, (int)hres);
|
ok (hres == S_OK, "AtlModuleInit with %d failed (0x%x).\n", i, (int)hres);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ok (FAILED(hres), "AtlModuleInit with %d succeeded? (0x%x).\n", i, (int)hres);
|
ok (FAILED(hres) ||
|
||||||
|
broken((i > FIELD_OFFSET( struct _ATL_MODULEW, dwAtlBuildVer )) && (hres == S_OK)), /* Win95 */
|
||||||
|
"AtlModuleInit with %d succeeded? (0x%x).\n", i, (int)hres);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeapFree (GetProcessHeap(), 0, tst);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(module)
|
START_TEST(module)
|
||||||
|
|
145
rostests/winetests/atl/registrar.c
Normal file
145
rostests/winetests/atl/registrar.c
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* ATL test program
|
||||||
|
*
|
||||||
|
* Copyright 2010 Damjan Jovanovic
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include <wine/test.h>
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
#include <wingdi.h>
|
||||||
|
#include <winnls.h>
|
||||||
|
#include <winerror.h>
|
||||||
|
#include <winnt.h>
|
||||||
|
#include <wtypes.h>
|
||||||
|
#include <olectl.h>
|
||||||
|
#include <ocidl.h>
|
||||||
|
#include <initguid.h>
|
||||||
|
#include <atliface.h>
|
||||||
|
|
||||||
|
static const char textA[] =
|
||||||
|
"HKCR \n"
|
||||||
|
"{ \n"
|
||||||
|
" ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n"
|
||||||
|
" { \n"
|
||||||
|
" val 'string' = s 'string' \n"
|
||||||
|
" val 'dword_quoted_dec' = d '1' \n"
|
||||||
|
" val 'dword_unquoted_dec' = d 1 \n"
|
||||||
|
" val 'dword_quoted_hex' = d '0xA' \n"
|
||||||
|
" val 'dword_unquoted_hex' = d 0xA \n"
|
||||||
|
" val 'binary_quoted' = b 'deadbeef' \n"
|
||||||
|
" val 'binary_unquoted' = b deadbeef \n"
|
||||||
|
" } \n"
|
||||||
|
"}";
|
||||||
|
|
||||||
|
static void test_registrar(void)
|
||||||
|
{
|
||||||
|
IRegistrar *registrar = NULL;
|
||||||
|
HRESULT hr;
|
||||||
|
INT count;
|
||||||
|
WCHAR *textW = NULL;
|
||||||
|
|
||||||
|
if (!GetProcAddress(GetModuleHandleA("atl.dll"), "AtlAxAttachControl"))
|
||||||
|
{
|
||||||
|
win_skip("Old versions of atl.dll don't support binary values\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_Registrar, NULL, CLSCTX_INPROC_SERVER, &IID_IRegistrar, (void**)®istrar);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
skip("creating IRegistrar failed, hr = 0x%08X\n", hr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0);
|
||||||
|
textW = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR));
|
||||||
|
if (textW)
|
||||||
|
{
|
||||||
|
DWORD dword;
|
||||||
|
DWORD size;
|
||||||
|
LONG lret;
|
||||||
|
HKEY key;
|
||||||
|
BYTE bytes[4];
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count);
|
||||||
|
hr = IRegistrar_StringRegister(registrar, textW);
|
||||||
|
ok(SUCCEEDED(hr), "IRegistrar_StringRegister failed, hr = 0x%08X\n", hr);
|
||||||
|
|
||||||
|
lret = RegOpenKeyA(HKEY_CLASSES_ROOT, "eebf73c4-50fd-478f-bbcf-db212221227a", &key);
|
||||||
|
ok(lret == ERROR_SUCCESS, "error %d opening registry key\n", lret);
|
||||||
|
|
||||||
|
size = sizeof(dword);
|
||||||
|
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
|
||||||
|
ok(dword != 0xA, "unquoted hex is not supposed to be preserved\n");
|
||||||
|
|
||||||
|
size = sizeof(dword);
|
||||||
|
lret = RegQueryValueExA(key, "dword_quoted_hex", NULL, NULL, (BYTE*)&dword, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
|
||||||
|
ok(dword != 0xA, "quoted hex is not supposed to be preserved\n");
|
||||||
|
|
||||||
|
size = sizeof(dword);
|
||||||
|
lret = RegQueryValueExA(key, "dword_unquoted_dec", NULL, NULL, (BYTE*)&dword, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
|
||||||
|
ok(dword == 1, "unquoted dec is not supposed to be %d\n", dword);
|
||||||
|
|
||||||
|
size = sizeof(dword);
|
||||||
|
lret = RegQueryValueExA(key, "dword_quoted_dec", NULL, NULL, (BYTE*)&dword, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
|
||||||
|
ok(dword == 1, "quoted dec is not supposed to be %d\n", dword);
|
||||||
|
|
||||||
|
size = 4;
|
||||||
|
lret = RegQueryValueExA(key, "binary_quoted", NULL, NULL, bytes, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %d\n", lret);
|
||||||
|
ok(bytes[0] == 0xde && bytes[1] == 0xad && bytes[2] == 0xbe && bytes[3] == 0xef,
|
||||||
|
"binary quoted value was not preserved (it's 0x%02X%02X%02X%02X)\n",
|
||||||
|
0xff & bytes[0], 0xff & bytes[1], 0xff & bytes[2], 0xff & bytes[3]);
|
||||||
|
|
||||||
|
size = 4;
|
||||||
|
lret = RegQueryValueExA(key, "binary_unquoted", NULL, NULL, bytes, &size);
|
||||||
|
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %d\n", lret);
|
||||||
|
ok(bytes[0] == 0xde && bytes[1] == 0xad && bytes[2] == 0xbe && bytes[3] == 0xef,
|
||||||
|
"binary unquoted value was not preserved (it's 0x%02X%02X%02X%02X)\n",
|
||||||
|
0xff & bytes[0], 0xff & bytes[1], 0xff & bytes[2], 0xff & bytes[3]);
|
||||||
|
|
||||||
|
hr = IRegistrar_StringUnregister(registrar, textW);
|
||||||
|
ok(SUCCEEDED(hr), "IRegistrar_StringUnregister failed, hr = 0x%08X\n", hr);
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, textW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
skip("allocating memory failed\n");
|
||||||
|
|
||||||
|
IRegistrar_Release(registrar);
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(registrar)
|
||||||
|
{
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
test_registrar();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
|
@ -6,10 +6,14 @@
|
||||||
#define STANDALONE
|
#define STANDALONE
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
extern void func_atl_ax(void);
|
||||||
extern void func_module(void);
|
extern void func_module(void);
|
||||||
|
extern void func_registrar(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
|
{ "atl_ax", func_atl_ax },
|
||||||
{ "module", func_module },
|
{ "module", func_module },
|
||||||
|
{ "registrar", func_registrar },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue