From 3fa4b5dde4f026cc4ea13cef847826042fe5e6fb Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Fri, 27 Feb 2009 16:45:02 +0000 Subject: [PATCH] - Add winetests for msctf, msvfw32, ntdsapi, ntprint, oleacc svn path=/trunk/; revision=39791 --- rostests/winetests/directory.rbuild | 15 ++ rostests/winetests/msctf/inputprocessor.c | 155 +++++++++++++++ rostests/winetests/msctf/msctf.rbuild | 11 ++ rostests/winetests/msctf/testlist.c | 15 ++ rostests/winetests/msvfw32/msvfw.c | 59 ++++++ rostests/winetests/msvfw32/msvfw32.rbuild | 10 + rostests/winetests/msvfw32/testlist.c | 15 ++ rostests/winetests/ntdsapi/ntdsapi.c | 99 ++++++++++ rostests/winetests/ntdsapi/ntdsapi.rbuild | 10 + rostests/winetests/ntdsapi/testlist.c | 15 ++ rostests/winetests/ntprint/ntprint.c | 230 ++++++++++++++++++++++ rostests/winetests/ntprint/ntprint.rbuild | 9 + rostests/winetests/ntprint/testlist.c | 15 ++ rostests/winetests/oleacc/main.c | 141 +++++++++++++ rostests/winetests/oleacc/oleacc.rbuild | 10 + rostests/winetests/oleacc/testlist.c | 15 ++ 16 files changed, 824 insertions(+) create mode 100644 rostests/winetests/msctf/inputprocessor.c create mode 100644 rostests/winetests/msctf/msctf.rbuild create mode 100644 rostests/winetests/msctf/testlist.c create mode 100644 rostests/winetests/msvfw32/msvfw.c create mode 100644 rostests/winetests/msvfw32/msvfw32.rbuild create mode 100644 rostests/winetests/msvfw32/testlist.c create mode 100644 rostests/winetests/ntdsapi/ntdsapi.c create mode 100644 rostests/winetests/ntdsapi/ntdsapi.rbuild create mode 100644 rostests/winetests/ntdsapi/testlist.c create mode 100644 rostests/winetests/ntprint/ntprint.c create mode 100644 rostests/winetests/ntprint/ntprint.rbuild create mode 100644 rostests/winetests/ntprint/testlist.c create mode 100644 rostests/winetests/oleacc/main.c create mode 100644 rostests/winetests/oleacc/oleacc.rbuild create mode 100644 rostests/winetests/oleacc/testlist.c diff --git a/rostests/winetests/directory.rbuild b/rostests/winetests/directory.rbuild index 7f852f45a04..8148cf40773 100644 --- a/rostests/winetests/directory.rbuild +++ b/rostests/winetests/directory.rbuild @@ -91,6 +91,9 @@ + + + @@ -103,6 +106,9 @@ + + + @@ -112,12 +118,21 @@ + + + + + + + + + diff --git a/rostests/winetests/msctf/inputprocessor.c b/rostests/winetests/msctf/inputprocessor.c new file mode 100644 index 00000000000..b7e2695b38d --- /dev/null +++ b/rostests/winetests/msctf/inputprocessor.c @@ -0,0 +1,155 @@ +/* + * Unit tests for ITfInputProcessor + * + * Copyright 2009 Aric Stewart, 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 + */ + +#include + +#define COBJMACROS +#include "wine/test.h" +#include "winuser.h" +#include "shlwapi.h" +#include "shlguid.h" +#include "comcat.h" +#include "initguid.h" +#include "msctf.h" + +static ITfInputProcessorProfiles* g_ipp; +static LANGID gLangid; +static ITfCategoryMgr * g_cm; + +DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3); +DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed); +DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7); +DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31); +DEFINE_GUID(GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14); +DEFINE_GUID(GUID_TFCAT_TIP_HANDWRITING, 0x246ecb87,0xc2f2,0x4abe,0x90,0x5b,0xc8,0xb3,0x8a,0xdd,0x2c,0x43); +DEFINE_GUID (GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, 0x046B8C80,0x1647,0x40F7,0x9B,0x21,0xB9,0x3B,0x81,0xAA,0xBC,0x1B); +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + + +static HRESULT initialize(void) +{ + HRESULT hr; + CoInitialize(NULL); + hr = CoCreateInstance (&CLSID_TF_InputProcessorProfiles, NULL, + CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp); + if (SUCCEEDED(hr)) + hr = CoCreateInstance (&CLSID_TF_CategoryMgr, NULL, + CLSCTX_INPROC_SERVER, &IID_ITfCategoryMgr, (void**)&g_cm); + return hr; +} + +static void cleanup(void) +{ + if (g_ipp) + ITfInputProcessorProfiles_Release(g_ipp); + if (g_cm) + ITfCategoryMgr_Release(g_cm); + CoUninitialize(); +} + +static void test_Register(void) +{ + HRESULT hr; + + static const WCHAR szDesc[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',0}; + static const WCHAR szFile[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',' ','F','i','l','e',0}; + + hr = ITfInputProcessorProfiles_Register(g_ipp, &CLSID_FakeService); + ok(SUCCEEDED(hr),"Unable to register text service(%x)\n",hr); + hr = ITfInputProcessorProfiles_AddLanguageProfile(g_ipp, &CLSID_FakeService, gLangid, &CLSID_FakeService, szDesc, sizeof(szDesc)/sizeof(WCHAR), szFile, sizeof(szFile)/sizeof(WCHAR), 1); + ok(SUCCEEDED(hr),"Unable to add Language Profile (%x)\n",hr); +} + +static void test_Unregister(void) +{ + HRESULT hr; + hr = ITfInputProcessorProfiles_Unregister(g_ipp, &CLSID_FakeService); + ok(SUCCEEDED(hr),"Unable to unregister text service(%x)\n",hr); +} + +static void test_EnumInputProcessorInfo(void) +{ + IEnumGUID *ppEnum; + BOOL found = FALSE; + + if (SUCCEEDED(ITfInputProcessorProfiles_EnumInputProcessorInfo(g_ipp, &ppEnum))) + { + ULONG fetched; + GUID g; + while (IEnumGUID_Next(ppEnum, 1, &g, &fetched) == S_OK) + { + if(IsEqualGUID(&g,&CLSID_FakeService)) + found = TRUE; + } + } + ok(found,"Did not find registered text service\n"); +} + +static void test_EnumLanguageProfiles(void) +{ + BOOL found = FALSE; + IEnumTfLanguageProfiles *ppEnum; + if (SUCCEEDED(ITfInputProcessorProfiles_EnumLanguageProfiles(g_ipp,gLangid,&ppEnum))) + { + TF_LANGUAGEPROFILE profile; + while (IEnumTfLanguageProfiles_Next(ppEnum,1,&profile,NULL)==S_OK) + { + if (IsEqualGUID(&profile.clsid,&CLSID_FakeService)) + { + found = TRUE; + ok(profile.langid == gLangid, "LangId Incorrect\n"); + todo_wine ok(IsEqualGUID(&profile.catid,&GUID_TFCAT_TIP_KEYBOARD), "CatId Incorrect\n"); + ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n"); + } + } + } + ok(found,"Registered text service not found\n"); +} + +static void test_RegisterCategory(void) +{ + HRESULT hr; + hr = ITfCategoryMgr_RegisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService); + ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterCategory failed\n"); +} + +static void test_UnregisterCategory(void) +{ + HRESULT hr; + hr = ITfCategoryMgr_UnregisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService); + todo_wine ok(SUCCEEDED(hr),"ITfCategoryMgr_UnregisterCategory failed\n"); +} + +START_TEST(inputprocessor) +{ + if (SUCCEEDED(initialize())) + { + gLangid = GetUserDefaultLCID(); + test_Register(); + test_RegisterCategory(); + test_EnumInputProcessorInfo(); + test_EnumLanguageProfiles(); + test_UnregisterCategory(); + test_Unregister(); + } + else + skip("Unable to create InputProcessor\n"); + cleanup(); +} diff --git a/rostests/winetests/msctf/msctf.rbuild b/rostests/winetests/msctf/msctf.rbuild new file mode 100644 index 00000000000..c8e061f1f65 --- /dev/null +++ b/rostests/winetests/msctf/msctf.rbuild @@ -0,0 +1,11 @@ + + -Wno-format + . + inputprocessor.c + testlist.c + wine + ole32 + user32 + kernel32 + ntdll + diff --git a/rostests/winetests/msctf/testlist.c b/rostests/winetests/msctf/testlist.c new file mode 100644 index 00000000000..8338fa7b8ce --- /dev/null +++ b/rostests/winetests/msctf/testlist.c @@ -0,0 +1,15 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_inputprocessor(void); + +const struct test winetest_testlist[] = +{ + { "inputprocessor", func_inputprocessor }, + { 0, 0 } +}; diff --git a/rostests/winetests/msvfw32/msvfw.c b/rostests/winetests/msvfw32/msvfw.c new file mode 100644 index 00000000000..537c230ffeb --- /dev/null +++ b/rostests/winetests/msvfw32/msvfw.c @@ -0,0 +1,59 @@ +/* + * Unit tests for video playback + * + * Copyright 2008 Jörg Höhle + * Copyright 2008 Austin English + * + * 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 + */ + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include "wine/test.h" + +static void test_OpenCase(void) +{ + HIC h; + /* Open a compressor with combinations of lowercase + * and uppercase compressortype and handler. + */ + h = ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS); + ok(0!=h,"ICOpen(vidc.msvc) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS); + ok(0!=h,"ICOpen(vidc.MSVC) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS); + todo_wine ok(0!=h,"ICOpen(VIDC.msvc) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS); + todo_wine ok(0!=h,"ICOpen(VIDC.MSVC) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } +} + +START_TEST(msvfw) +{ + test_OpenCase(); +} diff --git a/rostests/winetests/msvfw32/msvfw32.rbuild b/rostests/winetests/msvfw32/msvfw32.rbuild new file mode 100644 index 00000000000..42b97c593ac --- /dev/null +++ b/rostests/winetests/msvfw32/msvfw32.rbuild @@ -0,0 +1,10 @@ + + -Wno-format + . + msvfw.c + testlist.c + wine + msvfw32 + kernel32 + ntdll + diff --git a/rostests/winetests/msvfw32/testlist.c b/rostests/winetests/msvfw32/testlist.c new file mode 100644 index 00000000000..1aa529c6574 --- /dev/null +++ b/rostests/winetests/msvfw32/testlist.c @@ -0,0 +1,15 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_msvfw(void); + +const struct test winetest_testlist[] = +{ + { "msvfw", func_msvfw }, + { 0, 0 } +}; diff --git a/rostests/winetests/ntdsapi/ntdsapi.c b/rostests/winetests/ntdsapi/ntdsapi.c new file mode 100644 index 00000000000..08436ae8e85 --- /dev/null +++ b/rostests/winetests/ntdsapi/ntdsapi.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2008 Robert Shearman (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 + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winnls.h" +#include "rpc.h" +#include "rpcdce.h" +#include "ntdsapi.h" + +#include "wine/test.h" + +static const char *wine_dbgstr_w(LPCWSTR str) +{ + static char buf[512]; + if (!str) + return "(null)"; + WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL); + return buf; +} + +static void test_DsMakeSpn(void) +{ + DWORD ret; + WCHAR spn[256]; + DWORD spn_length; + static const WCHAR wszServiceClass[] = {'c','l','a','s','s',0}; + static const WCHAR wszServiceHost[] = {'h','o','s','t',0}; + static const WCHAR wszInstanceName[] = {'i','n','s','t','a','n','c','e',0}; + static const WCHAR wszReferrer[] = {'r','e','f','e','r','r','e','r',0}; + static const WCHAR wszSpn1[] = {'c','l','a','s','s','/','h','o','s','t',0}; + static const WCHAR wszSpn2[] = {'c','l','a','s','s','/','i','n','s','t','a','n','c','e','/','h','o','s','t',0}; + static const WCHAR wszSpn3[] = {'c','l','a','s','s','/','i','n','s','t','a','n','c','e',':','5','5','5','/','h','o','s','t',0}; + static const WCHAR wszSpn4[] = {'c','l','a','s','s','/','i','n','s','t','a','n','c','e',':','5','5','5','/','h','o','s','t',0}; + static const WCHAR wszSpn5[] = {'c','l','a','s','s','/','h','o','s','t',':','5','5','5',0}; + + spn[0] = '\0'; + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(NULL, NULL, NULL, 0, NULL, &spn_length, spn); + ok(ret == ERROR_INVALID_PARAMETER, "DsMakeSpnW should have failed with ERROR_INVALID_PARAMETER instead of %d\n", ret); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(NULL, wszServiceHost, NULL, 0, NULL, &spn_length, spn); + ok(ret == ERROR_INVALID_PARAMETER, "DsMakeSpnW should have failed with ERROR_INVALID_PARAMETER instead of %d\n", ret); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(wszServiceClass, wszServiceHost, NULL, 0, NULL, &spn_length, spn); + ok(ret == ERROR_SUCCESS, "DsMakeSpnW should have succeeded instead of failing with %d\n", ret); + ok(!lstrcmpW(spn, wszSpn1), "DsMakeSpnW returned unexpected SPN %s\n", wine_dbgstr_w(spn)); + ok(spn_length == lstrlenW(wszSpn1) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn1) + 1, spn_length); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(wszServiceClass, wszServiceHost, wszInstanceName, 0, NULL, &spn_length, spn); + ok(ret == ERROR_SUCCESS, "DsMakeSpnW should have succeeded instead of failing with %d\n", ret); + ok(!lstrcmpW(spn, wszSpn2), "DsMakeSpnW returned unexpected SPN %s\n", wine_dbgstr_w(spn)); + ok(spn_length == lstrlenW(wszSpn2) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn2) + 1, spn_length); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(wszServiceClass, wszServiceHost, wszInstanceName, 555, NULL, &spn_length, spn); + ok(ret == ERROR_SUCCESS, "DsMakeSpnW should have succeeded instead of failing with %d\n", ret); + ok(!lstrcmpW(spn, wszSpn3), "DsMakeSpnW returned unexpected SPN %s\n", wine_dbgstr_w(spn)); + ok(spn_length == lstrlenW(wszSpn3) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn3) + 1, spn_length); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(wszServiceClass, wszServiceHost, wszInstanceName, 555, wszReferrer, &spn_length, spn); + ok(ret == ERROR_SUCCESS, "DsMakeSpnW should have succeeded instead of failing with %d\n", ret); + ok(!lstrcmpW(spn, wszSpn4), "DsMakeSpnW returned unexpected SPN %s\n", wine_dbgstr_w(spn)); + ok(spn_length == lstrlenW(wszSpn4) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn4) + 1, spn_length); + + spn_length = sizeof(spn)/sizeof(spn[0]); + ret = DsMakeSpnW(wszServiceClass, wszServiceHost, NULL, 555, wszReferrer, &spn_length, spn); + ok(ret == ERROR_SUCCESS, "DsMakeSpnW should have succeeded instead of failing with %d\n", ret); + ok(!lstrcmpW(spn, wszSpn5), "DsMakeSpnW returned unexpected SPN %s\n", wine_dbgstr_w(spn)); + ok(spn_length == lstrlenW(wszSpn5) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn5) + 1, spn_length); +} + +START_TEST( ntdsapi ) +{ + test_DsMakeSpn(); +} diff --git a/rostests/winetests/ntdsapi/ntdsapi.rbuild b/rostests/winetests/ntdsapi/ntdsapi.rbuild new file mode 100644 index 00000000000..89b4b00c0ce --- /dev/null +++ b/rostests/winetests/ntdsapi/ntdsapi.rbuild @@ -0,0 +1,10 @@ + + -Wno-format + . + ntdsapi.c + testlist.c + wine + ntdsapi + kernel32 + ntdll + diff --git a/rostests/winetests/ntdsapi/testlist.c b/rostests/winetests/ntdsapi/testlist.c new file mode 100644 index 00000000000..c21305eb764 --- /dev/null +++ b/rostests/winetests/ntdsapi/testlist.c @@ -0,0 +1,15 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_ntdsapi(void); + +const struct test winetest_testlist[] = +{ + { "ntdsapi", func_ntdsapi }, + { 0, 0 } +}; diff --git a/rostests/winetests/ntprint/ntprint.c b/rostests/winetests/ntprint/ntprint.c new file mode 100644 index 00000000000..fca7b8d4848 --- /dev/null +++ b/rostests/winetests/ntprint/ntprint.c @@ -0,0 +1,230 @@ +/* + * Unit test suite for the Spooler Setup API (Printing) + * + * Copyright 2007 Detlef Riekenberg + * + * 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 +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "wine/test.h" + + +/* ##### */ + +static HMODULE hdll; +static HANDLE (WINAPI *pPSetupCreateMonitorInfo)(LPVOID, LPVOID, LPVOID); +static VOID (WINAPI *pPSetupDestroyMonitorInfo)(HANDLE); +static BOOL (WINAPI *pPSetupEnumMonitor)(HANDLE, DWORD, LPWSTR, LPDWORD); + +/* ########################### */ + +static LPCSTR load_functions(void) +{ + LPCSTR ptr; + + ptr = "ntprint.dll"; + hdll = LoadLibraryA(ptr); + if (!hdll) return ptr; + + ptr = "PSetupCreateMonitorInfo"; + pPSetupCreateMonitorInfo = (VOID *) GetProcAddress(hdll, ptr); + if (!pPSetupCreateMonitorInfo) return ptr; + + ptr = "PSetupDestroyMonitorInfo"; + pPSetupDestroyMonitorInfo = (VOID *) GetProcAddress(hdll, ptr); + if (!pPSetupDestroyMonitorInfo) return ptr; + + ptr = "PSetupEnumMonitor"; + pPSetupEnumMonitor = (VOID *) GetProcAddress(hdll, ptr); + if (!pPSetupEnumMonitor) return ptr; + + return NULL; +} + +/* ########################### */ + +static void test_PSetupCreateMonitorInfo(VOID) +{ + HANDLE mi; + BYTE buffer[1024] ; + + SetLastError(0xdeadbeef); + mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL); + ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError()); + if (mi) pPSetupDestroyMonitorInfo(mi); + + + memset(buffer, 0, sizeof(buffer)); + SetLastError(0xdeadbeef); + mi = pPSetupCreateMonitorInfo(buffer, NULL, NULL); + ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError()); + if (mi) pPSetupDestroyMonitorInfo(mi); + +} + +/* ########################### */ + +static void test_PSetupDestroyMonitorInfo(VOID) +{ + HANDLE mi; + + + SetLastError(0xdeadbeef); + pPSetupDestroyMonitorInfo(NULL); + /* lasterror is returned */ + trace("returned with %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL); + ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError()); + + if (!mi) return; + + SetLastError(0xdeadbeef); + pPSetupDestroyMonitorInfo(mi); + /* lasterror is returned */ + trace("returned with %u\n", GetLastError()); + + /* Try to destroy the handle twice crash with native ntprint.dll */ + if (0) { + SetLastError(0xdeadbeef); + pPSetupDestroyMonitorInfo(mi); + trace(" with %u\n", GetLastError()); + } + +} + +/* ########################### */ + +static void test_PSetupEnumMonitor(VOID) +{ + HANDLE mi; + WCHAR buffer[MAX_PATH+2]; + DWORD minsize = 0; + DWORD size; + DWORD res; + DWORD index=0; + + SetLastError(0xdeadbeef); + mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL); + if (!mi) { + skip("PSetupCreateMonitorInfo\n"); + return; + } + + minsize = 0; + SetLastError(0xdeadbeef); + res = pPSetupEnumMonitor(mi, 0, NULL, &minsize); + ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (minsize > 0), + "got %u with %u and %u (expected '0' with ERROR_INSUFFICIENT_BUFFER " + "and '> 0')\n", res, GetLastError(), minsize); + + + size = sizeof(buffer) / sizeof(buffer[0]); + if ((minsize + 1) > size) { + skip("overflow: %u\n", minsize); + pPSetupDestroyMonitorInfo(mi); + return; + } + + if (0) { + /* XP: ERROR_INVALID_PARAMETER, w2k: Crash */ + SetLastError(0xdeadbeef); + size = sizeof(buffer) / sizeof(buffer[0]); + res = pPSetupEnumMonitor(NULL, 0, buffer, &size); + ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER), + "got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)\n", + res, GetLastError()); + } + + if (0) { + /* XP: Crash, w2k: Success (how can that work?) */ + SetLastError(0xdeadbeef); + size = sizeof(buffer) / sizeof(buffer[0]); + res = pPSetupEnumMonitor(mi, 0, NULL, &size); + trace("got %u with %u and %u\n", res, GetLastError(), size); + } + + if (0) { + /* XP: ERROR_INVALID_PARAMETER, w2k: Crash */ + SetLastError(0xdeadbeef); + res = pPSetupEnumMonitor(mi, 0, buffer, NULL); + ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER), + "got %u with %u (expected '0' with ERROR_INVALID_PARAMETER)\n", + res, GetLastError()); + } + + SetLastError(0xdeadbeef); + size = minsize - 1; + res = pPSetupEnumMonitor(mi, 0, buffer, &size); + ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER), + "got %u with %u and %u (expected '0' with ERROR_INSUFFICIENT_BUFFER)\n", + res, GetLastError(), size); + + + SetLastError(0xdeadbeef); + size = minsize; + res = pPSetupEnumMonitor(mi, 0, buffer, &size); + ok( res, "got %u with %u and %u (expected '!= 0')\n", + res, GetLastError(), size); + + SetLastError(0xdeadbeef); + size = minsize + 1; + res = pPSetupEnumMonitor(mi, 0, buffer, &size); + ok( res, "got %u with %u and %u (expected '!= 0')\n", + res, GetLastError(), size); + + /* try max. 20 monitors */ + while (res && (index < 20)) { + SetLastError(0xdeadbeef); + buffer[0] = '\0'; + size = sizeof(buffer) / sizeof(buffer[0]); + res = pPSetupEnumMonitor(mi, index, buffer, &size); + ok( res || (GetLastError() == ERROR_NO_MORE_ITEMS), + "(%u) got %u with %u and %u (expected '!=0' or: '0' with " + "ERROR_NO_MORE_ITEMS)\n", index, res, GetLastError(), size); + + if (res) index++; + } + pPSetupDestroyMonitorInfo(mi); + +} + +/* ########################### */ + +START_TEST(ntprint) +{ + LPCSTR ptr; + + /* ntprint.dll does not exist on win9x */ + ptr = load_functions(); + if (ptr) { + skip("%s not found\n", ptr); + return; + } + + test_PSetupCreateMonitorInfo(); + test_PSetupDestroyMonitorInfo(); + test_PSetupEnumMonitor(); + +} diff --git a/rostests/winetests/ntprint/ntprint.rbuild b/rostests/winetests/ntprint/ntprint.rbuild new file mode 100644 index 00000000000..4782d65e8f4 --- /dev/null +++ b/rostests/winetests/ntprint/ntprint.rbuild @@ -0,0 +1,9 @@ + + -Wno-format + . + ntprint.c + testlist.c + wine + kernel32 + ntdll + diff --git a/rostests/winetests/ntprint/testlist.c b/rostests/winetests/ntprint/testlist.c new file mode 100644 index 00000000000..25fb277033c --- /dev/null +++ b/rostests/winetests/ntprint/testlist.c @@ -0,0 +1,15 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_ntprint(void); + +const struct test winetest_testlist[] = +{ + { "ntprint", func_ntprint }, + { 0, 0 } +}; diff --git a/rostests/winetests/oleacc/main.c b/rostests/winetests/oleacc/main.c new file mode 100644 index 00000000000..db7ee9e5dfb --- /dev/null +++ b/rostests/winetests/oleacc/main.c @@ -0,0 +1,141 @@ +/* + * oleacc tests + * + * Copyright 2008 Nikolay Sivov + * + * 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 +#include "wine/test.h" + +static void test_getroletext(void) +{ + INT ret, role; + CHAR buf[2], *buff; + WCHAR bufW[2], *buffW; + + /* wrong role number */ + ret = GetRoleTextA(-1, NULL, 0); + ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret); + buf[0] = '*'; + ret = GetRoleTextA(-1, buf, 2); + ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret); + ok(buf[0] == '*' || + broken(buf[0] == 0), /* Win98 and WinMe */ + "GetRoleTextA modified buffer on wrong role number\n"); + buf[0] = '*'; + ret = GetRoleTextA(-1, buf, 0); + ok(ret == 0, "GetRoleTextA doesn't return zero on wrong role number, got %d\n", ret); + ok(buf[0] == '*', "GetRoleTextA modified buffer on wrong role number\n"); + + ret = GetRoleTextW(-1, NULL, 0); + ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret); + bufW[0] = '*'; + ret = GetRoleTextW(-1, bufW, 2); + ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret); + ok(bufW[0] == '\0' || + broken(bufW[0] == '*'), /* Win98 and WinMe */ + "GetRoleTextW doesn't return NULL char on wrong role number\n"); + bufW[0] = '*'; + ret = GetRoleTextW(-1, bufW, 0); + ok(ret == 0, "GetRoleTextW doesn't return zero on wrong role number, got %d\n", ret); + + /* zero role number - not documented */ + ret = GetRoleTextA(0, NULL, 0); + ok(ret > 0, "GetRoleTextA doesn't return (>0) for zero role number, got %d\n", ret); + ret = GetRoleTextW(0, NULL, 0); + ok(ret > 0, "GetRoleTextW doesn't return (>0) for zero role number, got %d\n", ret); + + /* NULL buffer, return length */ + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0); + ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret); + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 1); + ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret); + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0); + ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret); + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 1); + ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret); + + /* use a smaller buffer */ + buf[0] = '*'; + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 1); + ok(ret == 0, "GetRoleTextA returned wrong length\n"); + ok(buf[0] == '\0', "GetRoleTextA returned not zero-length buffer\n"); + buf[1] = '*'; + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buf, 2); + ok(ret == 1 || + ret == 0, /* Vista and W2K8 */ + "GetRoleTextA returned wrong length, got %d, expected 0 or 1\n", ret); + if (ret == 1) + ok(buf[1] == '\0', "GetRoleTextA returned not zero-length buffer : (%c)\n", buf[1]); + + bufW[0] = '*'; + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 1); + ok(ret == 0, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret); + ok(bufW[0] == '\0', "GetRoleTextW returned not zero-length buffer\n"); + bufW[1] = '*'; + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, bufW, 2); + ok(ret == 1, "GetRoleTextW returned wrong length, got %d, expected 1\n", ret); + ok(bufW[1] == '\0', "GetRoleTextW returned not zero-length buffer\n"); + + /* use bigger buffer */ + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0); + buff = HeapAlloc(GetProcessHeap(), 0, 2*ret); + buff[2*ret-1] = '*'; + ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buff, 2*ret); + ok(buff[2*ret-1] == '*', "GetRoleTextA shouldn't modify this part of buffer\n"); + HeapFree(GetProcessHeap(), 0, buff); + + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0); + buffW = HeapAlloc(GetProcessHeap(), 0, 2*ret*sizeof(WCHAR)); + buffW[2*ret-1] = '*'; + ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, buffW, 2*ret); + ok(buffW[2*ret-1] == '*', "GetRoleTextW shouldn't modify this part of buffer\n"); + HeapFree(GetProcessHeap(), 0, buffW); + + /* check returned length for all roles */ + for(role = 0; role <= ROLE_SYSTEM_OUTLINEBUTTON; role++){ + CHAR buff2[100]; + WCHAR buff2W[100]; + + /* NT4 and W2K don't clear the buffer on a nonexistent role in the A-call */ + memset(buff2, 0, sizeof(buff2)); + + ret = GetRoleTextA(role, NULL, 0); + /* Win98 up to W2K miss some of the roles */ + if (role >= ROLE_SYSTEM_SPLITBUTTON) + ok(ret > 0 || broken(ret == 0), "Expected the role %d to be present\n", role); + else + ok(ret > 0, "Expected the role to be present\n"); + + GetRoleTextA(role, buff2, sizeof(buff2)); + ok(ret == lstrlenA(buff2), + "GetRoleTextA: returned length doesn't match returned buffer for role %d\n", role); + + /* Win98 and WinMe don't clear the buffer on a nonexistent role in the W-call */ + memset(buff2W, 0, sizeof(buff2W)); + + ret = GetRoleTextW(role, NULL, 0); + GetRoleTextW(role, buff2W, sizeof(buff2W)/sizeof(WCHAR)); + ok(ret == lstrlenW(buff2W), + "GetRoleTextW: returned length doesn't match returned buffer for role %d\n", role); + } +} + +START_TEST(main) +{ + test_getroletext(); +} diff --git a/rostests/winetests/oleacc/oleacc.rbuild b/rostests/winetests/oleacc/oleacc.rbuild new file mode 100644 index 00000000000..ce229a5dd5f --- /dev/null +++ b/rostests/winetests/oleacc/oleacc.rbuild @@ -0,0 +1,10 @@ + + -Wno-format + . + main.c + testlist.c + wine + kernel32 + oleacc + ntdll + diff --git a/rostests/winetests/oleacc/testlist.c b/rostests/winetests/oleacc/testlist.c new file mode 100644 index 00000000000..6f0c3974819 --- /dev/null +++ b/rostests/winetests/oleacc/testlist.c @@ -0,0 +1,15 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_main(void); + +const struct test winetest_testlist[] = +{ + { "main", func_main }, + { 0, 0 } +};