Author: rharabien Date: Thu Mar 15 20:15:43 2012 New Revision: 56158
URL: http://svn.reactos.org/svn/reactos?rev=56158&view=rev Log: [ATL_WINETEST] - Sync to Wine 1.3.37
Added: trunk/rostests/winetests/atl/registrar.c (with props) Modified: trunk/rostests/winetests/atl/CMakeLists.txt trunk/rostests/winetests/atl/atl_ax.c trunk/rostests/winetests/atl/module.c trunk/rostests/winetests/atl/testlist.c
Modified: trunk/rostests/winetests/atl/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/CMakeLists.t... ============================================================================== --- trunk/rostests/winetests/atl/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/atl/CMakeLists.txt [iso-8859-1] Thu Mar 15 20:15:43 2012 @@ -4,6 +4,7 @@ list(APPEND SOURCE atl_ax.c module.c + registrar.c testlist.c)
add_executable(atl_winetest ${SOURCE}) @@ -11,5 +12,5 @@ target_link_libraries(atl_winetest wine uuid)
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)
Modified: trunk/rostests/winetests/atl/atl_ax.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/atl_ax.c?rev... ============================================================================== --- trunk/rostests/winetests/atl/atl_ax.c [iso-8859-1] (original) +++ trunk/rostests/winetests/atl/atl_ax.c [iso-8859-1] Thu Mar 15 20:15:43 2012 @@ -36,7 +36,14 @@ #include <ocidl.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) { @@ -64,16 +71,16 @@ HRESULT hr; 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);
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(pContainer == (IUnknown *)0xdeadbeef, "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);
hr = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, @@ -86,13 +93,11 @@ return; }
- hr = AtlAxAttachControl(pObj, NULL, NULL); - todo_wine + hr = pAtlAxAttachControl(pObj, NULL, NULL); ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
pContainer = (IUnknown *)0xdeadbeef; - hr = AtlAxAttachControl(pObj, NULL, &pContainer); - todo_wine + hr = pAtlAxAttachControl(pObj, NULL, &pContainer); ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr); ok(pContainer != (IUnknown *)0xdeadbeef && pContainer != NULL, @@ -101,7 +106,7 @@ if (pContainer != (IUnknown *)0xdeadbeef && pContainer != NULL) 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);
IUnknown_Release(pObj); @@ -111,12 +116,17 @@
START_TEST(atl_ax) { + init_function_pointers(); + if (!register_class()) return;
CoInitialize(NULL);
- test_AtlAxAttachControl(); + if (pAtlAxAttachControl) + test_AtlAxAttachControl(); + else + win_skip("AtlAxAttachControl is not available\n");
CoUninitialize(); }
Modified: trunk/rostests/winetests/atl/module.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/module.c?rev... ============================================================================== --- trunk/rostests/winetests/atl/module.c [iso-8859-1] (original) +++ trunk/rostests/winetests/atl/module.c [iso-8859-1] Thu Mar 15 20:15:43 2012 @@ -32,7 +32,6 @@ #include <winnls.h> #include <winerror.h> #include <winnt.h> -#include <initguid.h> #include <wtypes.h> #include <olectl.h> #include <ocidl.h> @@ -92,10 +91,14 @@ ok (hres == S_OK, "AtlModuleInit with %d failed (0x%x).\n", i, (int)hres); break; 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; } } + + HeapFree (GetProcessHeap(), 0, tst); }
START_TEST(module)
Added: trunk/rostests/winetests/atl/registrar.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/registrar.c?... ============================================================================== --- trunk/rostests/winetests/atl/registrar.c (added) +++ trunk/rostests/winetests/atl/registrar.c [iso-8859-1] Thu Mar 15 20:15:43 2012 @@ -1,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(); +}
Propchange: trunk/rostests/winetests/atl/registrar.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/winetests/atl/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/atl/testlist.c?r... ============================================================================== --- trunk/rostests/winetests/atl/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/atl/testlist.c [iso-8859-1] Thu Mar 15 20:15:43 2012 @@ -6,10 +6,14 @@ #define STANDALONE #include "wine/test.h"
+extern void func_atl_ax(void); extern void func_module(void); +extern void func_registrar(void);
const struct test winetest_testlist[] = { + { "atl_ax", func_atl_ax }, { "module", func_module }, + { "registrar", func_registrar }, { 0, 0 } };