mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 05:01:03 +00:00
- Add winetests for mscms, msvcrtd, quartz, secur32
svn path=/trunk/; revision=39794
This commit is contained in:
parent
bd5f91d815
commit
83f58a9337
22 changed files with 7335 additions and 0 deletions
|
@ -91,6 +91,9 @@
|
|||
<directory name="msacm32">
|
||||
<xi:include href="msacm32/msacm32.rbuild" />
|
||||
</directory>
|
||||
<directory name="mscms">
|
||||
<xi:include href="mscms/mscms.rbuild" />
|
||||
</directory>
|
||||
<directory name="msctf">
|
||||
<xi:include href="msctf/msctf.rbuild" />
|
||||
</directory>
|
||||
|
@ -106,6 +109,9 @@
|
|||
<directory name="msvcrt">
|
||||
<xi:include href="msvcrt/msvcrt.rbuild" />
|
||||
</directory>
|
||||
<directory name="msvcrtd">
|
||||
<xi:include href="msvcrtd/msvcrtd.rbuild" />
|
||||
</directory>
|
||||
<directory name="msvfw32">
|
||||
<xi:include href="msvfw32/msvfw32.rbuild" />
|
||||
</directory>
|
||||
|
@ -145,6 +151,9 @@
|
|||
<directory name="qmgr">
|
||||
<xi:include href="qmgr/qmgr.rbuild" />
|
||||
</directory>
|
||||
<directory name="quartz">
|
||||
<xi:include href="quartz/quartz.rbuild" />
|
||||
</directory>
|
||||
<directory name="rasapi32">
|
||||
<xi:include href="rasapi32/rasapi32.rbuild" />
|
||||
</directory>
|
||||
|
@ -169,6 +178,9 @@
|
|||
<directory name="schannel">
|
||||
<xi:include href="schannel/schannel.rbuild" />
|
||||
</directory>
|
||||
<directory name="secur32">
|
||||
<xi:include href="secur32/secur32.rbuild" />
|
||||
</directory>
|
||||
<directory name="serialui">
|
||||
<xi:include href="serialui/serialui.rbuild" />
|
||||
</directory>
|
||||
|
|
10
rostests/winetests/mscms/mscms.rbuild
Normal file
10
rostests/winetests/mscms/mscms.rbuild
Normal file
|
@ -0,0 +1,10 @@
|
|||
<module name="mscms_winetest" type="win32cui" installbase="bin" installname="mscms_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="mscms_winetest">.</include>
|
||||
<file>profile.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
1569
rostests/winetests/mscms/profile.c
Normal file
1569
rostests/winetests/mscms/profile.c
Normal file
File diff suppressed because it is too large
Load diff
15
rostests/winetests/mscms/testlist.c
Normal file
15
rostests/winetests/mscms/testlist.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_profile(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "profile", func_profile },
|
||||
{ 0, 0 }
|
||||
};
|
73
rostests/winetests/msvcrtd/debug.c
Normal file
73
rostests/winetests/msvcrtd/debug.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Unit test suite for debug functions.
|
||||
*
|
||||
* Copyright 2004 Patrik Stridvall
|
||||
*
|
||||
* 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 "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
|
||||
#include "crtdbg.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
static void * (*pMSVCRTD_operator_new_dbg)(unsigned long, int, const char *, int) = NULL;
|
||||
|
||||
/* Some exports are only available in later versions */
|
||||
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hModule,y)
|
||||
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
|
||||
|
||||
static int init_functions(void)
|
||||
{
|
||||
HMODULE hModule = LoadLibraryA("msvcrtd.dll");
|
||||
|
||||
if (!hModule) {
|
||||
trace("LoadLibraryA failed to load msvcrtd.dll with GLE=%d\n", GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SET(pMSVCRTD_operator_new_dbg, "??2@YAPAXIHPBDH@Z");
|
||||
if (pMSVCRTD_operator_new_dbg == NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
static void test_new(void)
|
||||
{
|
||||
void *mem;
|
||||
|
||||
mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__);
|
||||
ok(mem != NULL, "memory not allocated\n");
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
START_TEST(debug)
|
||||
{
|
||||
if (!init_functions())
|
||||
return;
|
||||
|
||||
test_new();
|
||||
}
|
9
rostests/winetests/msvcrtd/msvcrtd.rbuild
Normal file
9
rostests/winetests/msvcrtd/msvcrtd.rbuild
Normal file
|
@ -0,0 +1,9 @@
|
|||
<module name="msvcrtd_winetest" type="win32cui" installbase="bin" installname="msvcrtd_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="msvcrtd_winetest">.</include>
|
||||
<file>debug.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
15
rostests/winetests/msvcrtd/testlist.c
Normal file
15
rostests/winetests/msvcrtd/testlist.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_debug(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "debug", func_debug },
|
||||
{ 0, 0 }
|
||||
};
|
477
rostests/winetests/quartz/avisplitter.c
Normal file
477
rostests/winetests/quartz/avisplitter.c
Normal file
|
@ -0,0 +1,477 @@
|
|||
/*
|
||||
* Unit tests for the avi splitter functions
|
||||
*
|
||||
* Copyright (C) 2007 Google (Lei Zhang)
|
||||
* Copyright (C) 2008 Google (Maarten Lankhorst)
|
||||
*
|
||||
* 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 COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "dshow.h"
|
||||
#include "tlhelp32.h"
|
||||
|
||||
static HANDLE (WINAPI *pCreateToolhelp32Snapshot)(DWORD, DWORD);
|
||||
static BOOL (WINAPI *pThread32First)(HANDLE, LPTHREADENTRY32);
|
||||
static BOOL (WINAPI *pThread32Next)(HANDLE, LPTHREADENTRY32);
|
||||
|
||||
static IUnknown *pAviSplitter = NULL;
|
||||
|
||||
static int count_threads(void)
|
||||
{
|
||||
THREADENTRY32 te;
|
||||
int threads;
|
||||
HANDLE h;
|
||||
|
||||
h = pCreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
te.dwSize = sizeof(te);
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return -1;
|
||||
|
||||
pThread32First(h, &te);
|
||||
if (te.th32OwnerProcessID == GetCurrentProcessId())
|
||||
threads = 1;
|
||||
else
|
||||
threads = 0;
|
||||
|
||||
while (pThread32Next(h, &te))
|
||||
if (te.th32OwnerProcessID == GetCurrentProcessId())
|
||||
++threads;
|
||||
|
||||
CloseHandle(h);
|
||||
return threads;
|
||||
}
|
||||
|
||||
static int create_avisplitter(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IUnknown, (LPVOID*)&pAviSplitter);
|
||||
return (hr == S_OK && pAviSplitter != NULL);
|
||||
}
|
||||
|
||||
static void release_avisplitter(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
Sleep(1000);
|
||||
hr = IUnknown_Release(pAviSplitter);
|
||||
|
||||
/* Looks like wine has a reference leak somewhere on test_threads tests,
|
||||
* it passes in windows
|
||||
*/
|
||||
ok(hr == 0, "IUnknown_Release failed with %d\n", (INT)hr);
|
||||
|
||||
while (hr > 0)
|
||||
hr = IUnknown_Release(pAviSplitter);
|
||||
pAviSplitter = NULL;
|
||||
}
|
||||
|
||||
static void test_query_interface(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
IUnknown *iface= NULL;
|
||||
|
||||
hr = IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter,
|
||||
(void**)&iface);
|
||||
|
||||
ok(hr == S_OK,
|
||||
"IID_IBaseFilter should exist, got %08x!\n", GetLastError());
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ref = IUnknown_Release(iface);
|
||||
iface = NULL;
|
||||
ok(ref == 1, "Reference is %u, expected 1\n", ref);
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(pAviSplitter, &IID_IMediaSeeking,
|
||||
(void**)&iface);
|
||||
if (hr == S_OK)
|
||||
ref = IUnknown_Release(iface);
|
||||
iface = NULL;
|
||||
todo_wine ok(hr == E_NOINTERFACE,
|
||||
"Query for IMediaSeeking returned: %08x\n", hr);
|
||||
|
||||
/* These interfaces should not be present:
|
||||
IID_IKsPropertySet, IID_IMediaPosition, IID_IQualityControl, IID_IQualProp
|
||||
*/
|
||||
}
|
||||
|
||||
static void test_pin(IPin *pin)
|
||||
{
|
||||
IMemInputPin *mpin = NULL;
|
||||
|
||||
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin);
|
||||
|
||||
ok(mpin == NULL, "IMemInputPin found!\n");
|
||||
if (mpin)
|
||||
IMemInputPin_Release(mpin);
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void test_basefilter(void)
|
||||
{
|
||||
IEnumPins *pin_enum = NULL;
|
||||
IBaseFilter *base = NULL;
|
||||
IPin *pins[2];
|
||||
ULONG ref;
|
||||
HRESULT hr;
|
||||
|
||||
IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter, (void *)&base);
|
||||
if (base == NULL)
|
||||
{
|
||||
/* test_query_interface handles this case */
|
||||
skip("No IBaseFilter\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IBaseFilter_EnumPins(base, NULL);
|
||||
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
||||
|
||||
hr= IBaseFilter_EnumPins(base, &pin_enum);
|
||||
ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
|
||||
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
|
||||
ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);
|
||||
|
||||
pins[0] = (void *)0xdead;
|
||||
pins[1] = (void *)0xdeed;
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
|
||||
ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
|
||||
ok(pins[0] != (void *)0xdead && pins[0] != NULL,
|
||||
"pins[0] = %p\n", pins[0]);
|
||||
if (pins[0] != (void *)0xdead && pins[0] != NULL)
|
||||
{
|
||||
test_pin(pins[0]);
|
||||
IPin_Release(pins[0]);
|
||||
}
|
||||
|
||||
ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);
|
||||
|
||||
ref = IEnumPins_Release(pin_enum);
|
||||
ok(ref == 0, "ref is %u and not 0!\n", ref);
|
||||
|
||||
IBaseFilter_Release(base);
|
||||
}
|
||||
|
||||
static const WCHAR wfile[] = {'t','e','s','t','.','a','v','i',0};
|
||||
static const char afile[] = "test.avi";
|
||||
|
||||
/* This test doesn't use the quartz filtergraph because it makes it impossible
|
||||
* to be certain that a thread is really one owned by the avi splitter
|
||||
* A lot of the decoder filters will also have their own thread, and windows'
|
||||
* filtergraph has a separate thread for start/stop/seeking requests.
|
||||
* By avoiding the filtergraph all together and connecting streams directly to
|
||||
* the null renderer I am sure that this is not the case here.
|
||||
*/
|
||||
static void test_threads(void)
|
||||
{
|
||||
IFileSourceFilter *pfile = NULL;
|
||||
IBaseFilter *preader = NULL, *pavi = NULL;
|
||||
IEnumPins *enumpins = NULL;
|
||||
IPin *filepin = NULL, *avipin = NULL;
|
||||
HRESULT hr;
|
||||
int baselevel, curlevel, expected;
|
||||
HANDLE file = NULL;
|
||||
PIN_DIRECTION dir = PINDIR_OUTPUT;
|
||||
char buffer[13];
|
||||
DWORD readbytes;
|
||||
FILTER_STATE state;
|
||||
|
||||
/* We need another way of counting threads on NT4. Skip these tests (for now) */
|
||||
if (!pCreateToolhelp32Snapshot || !pThread32First || !pThread32Next)
|
||||
{
|
||||
win_skip("Needed thread functions are not available (NT4)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Before doing anything (number of threads at the start differs per OS) */
|
||||
baselevel = count_threads();
|
||||
|
||||
file = CreateFileW(wfile, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
skip("Could not read test file \"%s\", skipping test\n", afile);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(buffer, 0, 13);
|
||||
readbytes = 12;
|
||||
ReadFile(file, buffer, readbytes, &readbytes, NULL);
|
||||
CloseHandle(file);
|
||||
if (strncmp(buffer, "RIFF", 4) || strcmp(buffer + 8, "AVI "))
|
||||
{
|
||||
skip("%s is not an avi riff file, not doing the avi splitter test\n",
|
||||
afile);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(pAviSplitter, &IID_IFileSourceFilter,
|
||||
(void **)&pfile);
|
||||
ok(hr == E_NOINTERFACE,
|
||||
"Avi splitter returns unexpected error: %08x\n", hr);
|
||||
if (pfile)
|
||||
IUnknown_Release(pfile);
|
||||
pfile = NULL;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IBaseFilter, (LPVOID*)&preader);
|
||||
ok(hr == S_OK, "Could not create asynchronous reader: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
hr = IUnknown_QueryInterface(preader, &IID_IFileSourceFilter,
|
||||
(void**)&pfile);
|
||||
ok(hr == S_OK, "Could not get IFileSourceFilter: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
hr = IUnknown_QueryInterface(pAviSplitter, &IID_IBaseFilter,
|
||||
(void**)&pavi);
|
||||
ok(hr == S_OK, "Could not get base filter: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
hr = IFileSourceFilter_Load(pfile, wfile, NULL);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
trace("Could not load file\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = IBaseFilter_EnumPins(preader, &enumpins);
|
||||
ok(hr == S_OK, "No enumpins: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
hr = IEnumPins_Next(enumpins, 1, &filepin, NULL);
|
||||
ok(hr == S_OK, "No pin: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
IUnknown_Release(enumpins);
|
||||
enumpins = NULL;
|
||||
|
||||
hr = IBaseFilter_EnumPins(pavi, &enumpins);
|
||||
ok(hr == S_OK, "No enumpins: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
hr = IEnumPins_Next(enumpins, 1, &avipin, NULL);
|
||||
ok(hr == S_OK, "No pin: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
curlevel = count_threads();
|
||||
ok(curlevel == baselevel,
|
||||
"Amount of threads should be %d not %d\n", baselevel, curlevel);
|
||||
|
||||
hr = IPin_Connect(filepin, avipin, NULL);
|
||||
ok(hr == S_OK, "Could not connect: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
|
||||
expected = 1 + baselevel;
|
||||
curlevel = count_threads();
|
||||
ok(curlevel == expected,
|
||||
"Amount of threads should be %d not %d\n", expected, curlevel);
|
||||
|
||||
IUnknown_Release(avipin);
|
||||
avipin = NULL;
|
||||
|
||||
IEnumPins_Reset(enumpins);
|
||||
|
||||
/* Windows puts the pins in the order: Outputpins - Inputpin,
|
||||
* wine does the reverse, just don't test it for now
|
||||
* Hate to admit it, but windows way makes more sense
|
||||
*/
|
||||
while (IEnumPins_Next(enumpins, 1, &avipin, NULL) == S_OK)
|
||||
{
|
||||
ok(hr == S_OK, "hr: %08x\n", hr);
|
||||
IPin_QueryDirection(avipin, &dir);
|
||||
if (dir == PINDIR_OUTPUT)
|
||||
{
|
||||
/* Well, connect it to a null renderer! */
|
||||
IBaseFilter *pnull = NULL;
|
||||
IEnumPins *nullenum = NULL;
|
||||
IPin *nullpin = NULL;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_NullRenderer, NULL,
|
||||
CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&pnull);
|
||||
ok(hr == S_OK, "Could not create null renderer: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
break;
|
||||
|
||||
IBaseFilter_EnumPins(pnull, &nullenum);
|
||||
IEnumPins_Next(nullenum, 1, &nullpin, NULL);
|
||||
IEnumPins_Release(nullenum);
|
||||
IPin_QueryDirection(nullpin, &dir);
|
||||
|
||||
hr = IPin_Connect(avipin, nullpin, NULL);
|
||||
ok(hr == S_OK, "Failed to connect output pin: %08x\n", hr);
|
||||
IPin_Release(nullpin);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
IBaseFilter_Release(pnull);
|
||||
break;
|
||||
}
|
||||
IBaseFilter_Run(pnull, 0);
|
||||
++expected;
|
||||
}
|
||||
|
||||
IUnknown_Release(avipin);
|
||||
avipin = NULL;
|
||||
}
|
||||
|
||||
if (avipin)
|
||||
IUnknown_Release(avipin);
|
||||
avipin = NULL;
|
||||
|
||||
if (hr != S_OK)
|
||||
goto fail2;
|
||||
/* At this point there is a minimalistic connected avi splitter that can
|
||||
* Be used for all sorts of source filter tests, however that still needs
|
||||
* to be written at a later time.
|
||||
*
|
||||
* Interesting tests:
|
||||
* - Can you disconnect an output pin while running?
|
||||
* Expecting: Yes
|
||||
* - Can you disconnect the pullpin while running?
|
||||
* Expecting: No
|
||||
* - Is the reference count incremented during playback or when connected?
|
||||
* Does this happen once for every output pin? Or is there something else
|
||||
* going on.
|
||||
* Expecting: You tell me
|
||||
*/
|
||||
|
||||
IBaseFilter_Run(preader, 0);
|
||||
IBaseFilter_Run(pavi, 0);
|
||||
IBaseFilter_GetState(pavi, INFINITE, &state);
|
||||
|
||||
curlevel = count_threads();
|
||||
ok(curlevel == expected,
|
||||
"Amount of threads should be %d not %d\n", expected, curlevel);
|
||||
|
||||
IBaseFilter_Pause(pavi);
|
||||
IBaseFilter_Pause(preader);
|
||||
IBaseFilter_Stop(pavi);
|
||||
IBaseFilter_Stop(preader);
|
||||
IBaseFilter_GetState(pavi, INFINITE, &state);
|
||||
IBaseFilter_GetState(preader, INFINITE, &state);
|
||||
|
||||
fail2:
|
||||
IEnumPins_Reset(enumpins);
|
||||
while (IEnumPins_Next(enumpins, 1, &avipin, NULL) == S_OK)
|
||||
{
|
||||
IPin *to = NULL;
|
||||
|
||||
IPin_QueryDirection(avipin, &dir);
|
||||
IPin_ConnectedTo(avipin, &to);
|
||||
if (to)
|
||||
{
|
||||
IPin_Release(to);
|
||||
|
||||
if (dir == PINDIR_OUTPUT)
|
||||
{
|
||||
PIN_INFO info;
|
||||
IPin_QueryPinInfo(to, &info);
|
||||
|
||||
/* Release twice: Once normal, second from the
|
||||
* previous while loop
|
||||
*/
|
||||
IBaseFilter_Stop(info.pFilter);
|
||||
IPin_Disconnect(to);
|
||||
IPin_Disconnect(avipin);
|
||||
IBaseFilter_Release(info.pFilter);
|
||||
IBaseFilter_Release(info.pFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPin_Disconnect(to);
|
||||
IPin_Disconnect(avipin);
|
||||
}
|
||||
}
|
||||
IPin_Release(avipin);
|
||||
avipin = NULL;
|
||||
}
|
||||
|
||||
fail:
|
||||
if (hr != S_OK)
|
||||
skip("Prerequisites not matched, skipping remainder of test\n");
|
||||
if (enumpins)
|
||||
IUnknown_Release(enumpins);
|
||||
|
||||
if (avipin)
|
||||
IUnknown_Release(avipin);
|
||||
if (filepin)
|
||||
{
|
||||
IPin *to = NULL;
|
||||
|
||||
IPin_ConnectedTo(filepin, &to);
|
||||
if (to)
|
||||
{
|
||||
IPin_Disconnect(filepin);
|
||||
IPin_Disconnect(to);
|
||||
}
|
||||
IUnknown_Release(filepin);
|
||||
}
|
||||
|
||||
if (preader)
|
||||
IUnknown_Release(preader);
|
||||
if (pavi)
|
||||
IUnknown_Release(pavi);
|
||||
if (pfile)
|
||||
IUnknown_Release(pfile);
|
||||
|
||||
curlevel = count_threads();
|
||||
todo_wine
|
||||
ok(curlevel == baselevel,
|
||||
"Amount of threads should be %d not %d\n", baselevel, curlevel);
|
||||
}
|
||||
|
||||
START_TEST(avisplitter)
|
||||
{
|
||||
HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
|
||||
|
||||
pCreateToolhelp32Snapshot = (void*)GetProcAddress(kernel32, "CreateToolhelp32Snapshot");
|
||||
pThread32First = (void*)GetProcAddress(kernel32, "Thread32First");
|
||||
pThread32Next = (void*)GetProcAddress(kernel32, "Thread32Next");
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
if (!create_avisplitter())
|
||||
{
|
||||
skip("Could not create avisplitter\n");
|
||||
return;
|
||||
}
|
||||
|
||||
test_query_interface();
|
||||
test_basefilter();
|
||||
test_threads();
|
||||
|
||||
release_avisplitter();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
1854
rostests/winetests/quartz/filtergraph.c
Normal file
1854
rostests/winetests/quartz/filtergraph.c
Normal file
File diff suppressed because it is too large
Load diff
466
rostests/winetests/quartz/filtermapper.c
Normal file
466
rostests/winetests/quartz/filtermapper.c
Normal file
|
@ -0,0 +1,466 @@
|
|||
/*
|
||||
* Filtermapper unit tests for Quartz
|
||||
*
|
||||
* Copyright (C) 2008 Alexander Dorofeyev
|
||||
*
|
||||
* 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 COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "winbase.h"
|
||||
#include "initguid.h"
|
||||
#include "dshow.h"
|
||||
|
||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
/* Helper function, checks if filter with given name was enumerated. */
|
||||
static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
|
||||
{
|
||||
IMoniker *pMoniker = NULL;
|
||||
BOOL found = FALSE;
|
||||
ULONG nb;
|
||||
HRESULT hr;
|
||||
static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
|
||||
|
||||
while(!found && IEnumMoniker_Next(pEnum, 1, &pMoniker, &nb) == S_OK)
|
||||
{
|
||||
IPropertyBag * pPropBagCat = NULL;
|
||||
VARIANT var;
|
||||
|
||||
VariantInit(&var);
|
||||
|
||||
hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
|
||||
ok(SUCCEEDED(hr), "IMoniker_BindToStorage failed with %x\n", hr);
|
||||
if (FAILED(hr) || !pPropBagCat)
|
||||
{
|
||||
VariantClear(&var);
|
||||
IMoniker_Release(pMoniker);
|
||||
continue;
|
||||
}
|
||||
|
||||
hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, &var, NULL);
|
||||
ok(SUCCEEDED(hr), "IPropertyBag_Read failed with %x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
CHAR val1[512], val2[512];
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, V_UNION(&var, bstrVal), -1, val1, sizeof(val1), 0, 0);
|
||||
WideCharToMultiByte(CP_ACP, 0, wszFilterName, -1, val2, sizeof(val2), 0, 0);
|
||||
if (!lstrcmpA(val1, val2)) found = TRUE;
|
||||
}
|
||||
|
||||
IPropertyBag_Release(pPropBagCat);
|
||||
IMoniker_Release(pMoniker);
|
||||
VariantClear(&var);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static void test_fm2_enummatchingfilters(void)
|
||||
{
|
||||
IFilterMapper2 *pMapper = NULL;
|
||||
HRESULT hr;
|
||||
REGFILTER2 rgf2;
|
||||
REGFILTERPINS2 rgPins2[2];
|
||||
REGPINTYPES rgPinType;
|
||||
static const WCHAR wszFilterName1[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '1', 0 };
|
||||
static const WCHAR wszFilterName2[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '2', 0 };
|
||||
CLSID clsidFilter1;
|
||||
CLSID clsidFilter2;
|
||||
IEnumMoniker *pEnum = NULL;
|
||||
BOOL found;
|
||||
|
||||
ZeroMemory(&rgf2, sizeof(rgf2));
|
||||
|
||||
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IFilterMapper2, (LPVOID*)&pMapper);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
|
||||
if (FAILED(hr)) goto out;
|
||||
|
||||
hr = CoCreateGuid(&clsidFilter1);
|
||||
ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
|
||||
hr = CoCreateGuid(&clsidFilter2);
|
||||
ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
|
||||
|
||||
/* Test that a test renderer filter is returned when enumerating filters with bRender=FALSE */
|
||||
rgf2.dwVersion = 2;
|
||||
rgf2.dwMerit = MERIT_UNLIKELY;
|
||||
S1(U(rgf2)).cPins2 = 1;
|
||||
S1(U(rgf2)).rgPins2 = rgPins2;
|
||||
|
||||
rgPins2[0].dwFlags = REG_PINFLAG_B_RENDERER;
|
||||
rgPins2[0].cInstances = 1;
|
||||
rgPins2[0].nMediaTypes = 1;
|
||||
rgPins2[0].lpMediaType = &rgPinType;
|
||||
rgPins2[0].nMediums = 0;
|
||||
rgPins2[0].lpMedium = NULL;
|
||||
rgPins2[0].clsPinCategory = NULL;
|
||||
|
||||
rgPinType.clsMajorType = &GUID_NULL;
|
||||
rgPinType.clsMinorType = &GUID_NULL;
|
||||
|
||||
hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1, NULL,
|
||||
&CLSID_LegacyAmFilterCategory, NULL, &rgf2);
|
||||
ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
|
||||
|
||||
rgPins2[0].dwFlags = 0;
|
||||
|
||||
rgPins2[1].dwFlags = REG_PINFLAG_B_OUTPUT;
|
||||
rgPins2[1].cInstances = 1;
|
||||
rgPins2[1].nMediaTypes = 1;
|
||||
rgPins2[1].lpMediaType = &rgPinType;
|
||||
rgPins2[1].nMediums = 0;
|
||||
rgPins2[1].lpMedium = NULL;
|
||||
rgPins2[1].clsPinCategory = NULL;
|
||||
|
||||
S1(U(rgf2)).cPins2 = 2;
|
||||
|
||||
hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2, NULL,
|
||||
&CLSID_LegacyAmFilterCategory, NULL, &rgf2);
|
||||
ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
|
||||
0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
|
||||
if (SUCCEEDED(hr) && pEnum)
|
||||
{
|
||||
found = enum_find_filter(wszFilterName1, pEnum);
|
||||
ok(found, "EnumMatchingFilters failed to return the test filter 1\n");
|
||||
}
|
||||
|
||||
if (pEnum) IEnumMoniker_Release(pEnum);
|
||||
pEnum = NULL;
|
||||
|
||||
hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
|
||||
0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
|
||||
if (SUCCEEDED(hr) && pEnum)
|
||||
{
|
||||
found = enum_find_filter(wszFilterName2, pEnum);
|
||||
ok(found, "EnumMatchingFilters failed to return the test filter 2\n");
|
||||
}
|
||||
|
||||
if (pEnum) IEnumMoniker_Release(pEnum);
|
||||
pEnum = NULL;
|
||||
|
||||
/* Non renderer must not be returned with bRender=TRUE */
|
||||
|
||||
hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
|
||||
0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr) && pEnum)
|
||||
{
|
||||
found = enum_find_filter(wszFilterName1, pEnum);
|
||||
ok(found, "EnumMatchingFilters failed to return the test filter 1\n");
|
||||
}
|
||||
|
||||
if (pEnum) IEnumMoniker_Release(pEnum);
|
||||
pEnum = NULL;
|
||||
|
||||
hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
|
||||
0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr) && pEnum)
|
||||
{
|
||||
found = enum_find_filter(wszFilterName2, pEnum);
|
||||
ok(!found, "EnumMatchingFilters should not return the test filter 2\n");
|
||||
}
|
||||
|
||||
hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
|
||||
&clsidFilter1);
|
||||
ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
|
||||
&clsidFilter2);
|
||||
ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
|
||||
|
||||
out:
|
||||
|
||||
if (pEnum) IEnumMoniker_Release(pEnum);
|
||||
if (pMapper) IFilterMapper2_Release(pMapper);
|
||||
}
|
||||
|
||||
static void test_legacy_filter_registration(void)
|
||||
{
|
||||
IFilterMapper2 *pMapper2 = NULL;
|
||||
IFilterMapper *pMapper = NULL;
|
||||
HRESULT hr;
|
||||
static const WCHAR wszFilterName[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', 0 };
|
||||
static const CHAR szFilterName[] = "Testfilter";
|
||||
static const WCHAR wszPinName[] = {'P', 'i', 'n', '1', 0 };
|
||||
CLSID clsidFilter;
|
||||
CHAR szRegKey[MAX_PATH];
|
||||
static const CHAR szClsid[] = "CLSID";
|
||||
WCHAR wszGuidstring[MAX_PATH];
|
||||
CHAR szGuidstring[MAX_PATH];
|
||||
LONG lRet;
|
||||
HKEY hKey = NULL;
|
||||
IEnumMoniker *pEnum = NULL;
|
||||
BOOL found;
|
||||
IEnumRegFilters *pRegEnum = NULL;
|
||||
|
||||
/* Test if legacy filter registration scheme works (filter is added to HKCR\Filter). IFilterMapper_RegisterFilter
|
||||
* registers in this way. Filters so registered must then be accessible through both IFilterMapper_EnumMatchingFilters
|
||||
* and IFilterMapper2_EnumMatchingFilters. */
|
||||
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IFilterMapper2, (LPVOID*)&pMapper2);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
|
||||
if (FAILED(hr)) goto out;
|
||||
|
||||
hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterMapper, (LPVOID)&pMapper);
|
||||
ok(hr == S_OK, "IFilterMapper2_QueryInterface failed with %x\n", hr);
|
||||
if (FAILED(hr)) goto out;
|
||||
|
||||
/* Register a test filter. */
|
||||
hr = CoCreateGuid(&clsidFilter);
|
||||
ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
|
||||
|
||||
lRet = StringFromGUID2(&clsidFilter, wszGuidstring, MAX_PATH);
|
||||
ok(lRet > 0, "StringFromGUID2 failed\n");
|
||||
if (!lRet) goto out;
|
||||
WideCharToMultiByte(CP_ACP, 0, wszGuidstring, -1, szGuidstring, MAX_PATH, 0, 0);
|
||||
|
||||
lstrcpyA(szRegKey, szClsid);
|
||||
lstrcatA(szRegKey, "\\");
|
||||
lstrcatA(szRegKey, szGuidstring);
|
||||
|
||||
/* Register---- functions need a filter class key to write pin and pin media type data to. Create a bogus
|
||||
* class key for it. */
|
||||
lRet = RegCreateKeyExA(HKEY_CLASSES_ROOT, szRegKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
|
||||
ok(lRet == ERROR_SUCCESS, "RegCreateKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
|
||||
|
||||
/* Set default value - this is interpreted as "friendly name" later. */
|
||||
lRet = RegSetValueExA(hKey, NULL, 0, REG_SZ, (LPBYTE)szFilterName, lstrlenA(szFilterName) + 1);
|
||||
ok(lRet == ERROR_SUCCESS, "RegSetValueExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
|
||||
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
hKey = NULL;
|
||||
|
||||
hr = IFilterMapper_RegisterFilter(pMapper, clsidFilter, wszFilterName, MERIT_UNLIKELY);
|
||||
ok(hr == S_OK, "IFilterMapper_RegisterFilter failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper_RegisterPin(pMapper, clsidFilter, wszPinName, TRUE, FALSE, FALSE, FALSE, GUID_NULL, NULL);
|
||||
ok(hr == S_OK, "IFilterMapper_RegisterPin failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper_RegisterPinType(pMapper, clsidFilter, wszPinName, GUID_NULL, GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper_RegisterPinType failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper2_EnumMatchingFilters(pMapper2, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
|
||||
0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
|
||||
if (SUCCEEDED(hr) && pEnum)
|
||||
{
|
||||
found = enum_find_filter(wszFilterName, pEnum);
|
||||
ok(found, "IFilterMapper2_EnumMatchingFilters failed to return the test filter\n");
|
||||
}
|
||||
|
||||
if (pEnum) IEnumMoniker_Release(pEnum);
|
||||
pEnum = NULL;
|
||||
|
||||
found = FALSE;
|
||||
hr = IFilterMapper_EnumMatchingFilters(pMapper, &pRegEnum, MERIT_UNLIKELY, TRUE, GUID_NULL, GUID_NULL,
|
||||
FALSE, FALSE, GUID_NULL, GUID_NULL);
|
||||
ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed with %x\n", hr);
|
||||
if (SUCCEEDED(hr) && pRegEnum)
|
||||
{
|
||||
ULONG cFetched;
|
||||
REGFILTER *prgf;
|
||||
|
||||
while(!found && IEnumRegFilters_Next(pRegEnum, 1, &prgf, &cFetched) == S_OK)
|
||||
{
|
||||
CHAR val[512];
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, prgf->Name, -1, val, sizeof(val), 0, 0);
|
||||
if (!lstrcmpA(val, szFilterName)) found = TRUE;
|
||||
|
||||
CoTaskMemFree(prgf);
|
||||
}
|
||||
|
||||
IEnumRegFilters_Release(pRegEnum);
|
||||
}
|
||||
ok(found, "IFilterMapper_EnumMatchingFilters failed to return the test filter\n");
|
||||
|
||||
hr = IFilterMapper_UnregisterFilter(pMapper, clsidFilter);
|
||||
ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
|
||||
|
||||
lRet = RegOpenKeyExA(HKEY_CLASSES_ROOT, szClsid, 0, KEY_WRITE | DELETE, &hKey);
|
||||
ok(lRet == ERROR_SUCCESS, "RegOpenKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet));
|
||||
|
||||
lRet = RegDeleteKeyA(hKey, szGuidstring);
|
||||
ok(lRet == ERROR_SUCCESS, "RegDeleteKeyA failed with %x\n", HRESULT_FROM_WIN32(lRet));
|
||||
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
hKey = NULL;
|
||||
|
||||
out:
|
||||
|
||||
if (pMapper) IFilterMapper_Release(pMapper);
|
||||
if (pMapper2) IFilterMapper2_Release(pMapper2);
|
||||
}
|
||||
|
||||
static ULONG getRefcount(IUnknown *iface)
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
return IUnknown_Release(iface);
|
||||
}
|
||||
|
||||
static void test_ifiltermapper_from_filtergraph(void)
|
||||
{
|
||||
IFilterGraph2* pgraph2 = NULL;
|
||||
IFilterMapper2 *pMapper2 = NULL;
|
||||
IFilterGraph *filtergraph = NULL;
|
||||
HRESULT hr;
|
||||
ULONG refcount;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (LPVOID*)&pgraph2);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
|
||||
if (!pgraph2) goto out;
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(pgraph2, &IID_IFilterMapper2, (LPVOID*)&pMapper2);
|
||||
ok(hr == S_OK, "IFilterGraph2_QueryInterface failed with %08x\n", hr);
|
||||
if (!pMapper2) goto out;
|
||||
|
||||
refcount = getRefcount((IUnknown*)pgraph2);
|
||||
ok(refcount == 2, "unexpected reference count: %u\n", refcount);
|
||||
refcount = getRefcount((IUnknown*)pMapper2);
|
||||
ok(refcount == 2, "unexpected reference count: %u\n", refcount);
|
||||
|
||||
IFilterMapper2_AddRef(pMapper2);
|
||||
refcount = getRefcount((IUnknown*)pgraph2);
|
||||
ok(refcount == 3, "unexpected reference count: %u\n", refcount);
|
||||
refcount = getRefcount((IUnknown*)pMapper2);
|
||||
ok(refcount == 3, "unexpected reference count: %u\n", refcount);
|
||||
IFilterMapper2_Release(pMapper2);
|
||||
|
||||
hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (LPVOID*)&filtergraph);
|
||||
ok(hr == S_OK, "IFilterMapper2_QueryInterface failed with %08x\n", hr);
|
||||
if (!filtergraph) goto out;
|
||||
|
||||
IFilterMapper2_Release(pMapper2);
|
||||
pMapper2 = NULL;
|
||||
IFilterGraph_Release(filtergraph);
|
||||
filtergraph = NULL;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pMapper2);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
|
||||
if (!pMapper2) goto out;
|
||||
|
||||
hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (LPVOID*)&filtergraph);
|
||||
ok(hr == E_NOINTERFACE, "IFilterMapper2_QueryInterface unexpected result: %08x\n", hr);
|
||||
|
||||
out:
|
||||
|
||||
if (pMapper2) IFilterMapper2_Release(pMapper2);
|
||||
if (filtergraph) IFilterGraph_Release(filtergraph);
|
||||
if (pgraph2) IFilterGraph2_Release(pgraph2);
|
||||
}
|
||||
|
||||
static void test_register_filter_with_null_clsMinorType(void)
|
||||
{
|
||||
IFilterMapper2 *pMapper = NULL;
|
||||
HRESULT hr;
|
||||
REGFILTER2 rgf2;
|
||||
REGFILTERPINS rgPins;
|
||||
REGFILTERPINS2 rgPins2;
|
||||
REGPINTYPES rgPinType;
|
||||
static WCHAR wszPinName[] = {'P', 'i', 'n', 0 };
|
||||
static const WCHAR wszFilterName1[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '1', 0 };
|
||||
static const WCHAR wszFilterName2[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', '2', 0 };
|
||||
CLSID clsidFilter1;
|
||||
CLSID clsidFilter2;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IFilterMapper2, (LPVOID*)&pMapper);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
|
||||
if (FAILED(hr)) goto out;
|
||||
|
||||
hr = CoCreateGuid(&clsidFilter1);
|
||||
ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
|
||||
hr = CoCreateGuid(&clsidFilter2);
|
||||
ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
|
||||
|
||||
rgPinType.clsMajorType = &GUID_NULL;
|
||||
/* Make sure quartz accepts it without crashing */
|
||||
rgPinType.clsMinorType = NULL;
|
||||
|
||||
/* Test with pin descript version 1 */
|
||||
ZeroMemory(&rgf2, sizeof(rgf2));
|
||||
rgf2.dwVersion = 1;
|
||||
rgf2.dwMerit = MERIT_UNLIKELY;
|
||||
S(U(rgf2)).cPins = 1;
|
||||
S(U(rgf2)).rgPins = &rgPins;
|
||||
|
||||
rgPins.strName = wszPinName;
|
||||
rgPins.bRendered = 1;
|
||||
rgPins.bOutput = 0;
|
||||
rgPins.bZero = 0;
|
||||
rgPins.bMany = 0;
|
||||
rgPins.clsConnectsToFilter = NULL;
|
||||
rgPins.strConnectsToPin = NULL;
|
||||
rgPins.nMediaTypes = 1;
|
||||
rgPins.lpMediaType = &rgPinType;
|
||||
|
||||
hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1, NULL,
|
||||
&CLSID_LegacyAmFilterCategory, NULL, &rgf2);
|
||||
ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter1);
|
||||
ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
|
||||
|
||||
/* Test with pin descript version 2 */
|
||||
ZeroMemory(&rgf2, sizeof(rgf2));
|
||||
rgf2.dwVersion = 2;
|
||||
rgf2.dwMerit = MERIT_UNLIKELY;
|
||||
S1(U(rgf2)).cPins2 = 1;
|
||||
S1(U(rgf2)).rgPins2 = &rgPins2;
|
||||
|
||||
rgPins2.dwFlags = REG_PINFLAG_B_RENDERER;
|
||||
rgPins2.cInstances = 1;
|
||||
rgPins2.nMediaTypes = 1;
|
||||
rgPins2.lpMediaType = &rgPinType;
|
||||
rgPins2.nMediums = 0;
|
||||
rgPins2.lpMedium = NULL;
|
||||
rgPins2.clsPinCategory = NULL;
|
||||
|
||||
hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2, NULL,
|
||||
&CLSID_LegacyAmFilterCategory, NULL, &rgf2);
|
||||
ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
|
||||
|
||||
hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter2);
|
||||
ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
|
||||
|
||||
out:
|
||||
|
||||
if (pMapper) IFilterMapper2_Release(pMapper);
|
||||
}
|
||||
|
||||
|
||||
START_TEST(filtermapper)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_fm2_enummatchingfilters();
|
||||
test_legacy_filter_registration();
|
||||
test_ifiltermapper_from_filtergraph();
|
||||
test_register_filter_with_null_clsMinorType();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
92
rostests/winetests/quartz/memallocator.c
Normal file
92
rostests/winetests/quartz/memallocator.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Unit tests for Direct Show functions
|
||||
*
|
||||
* Copyright (C) 2005 Christian Costa
|
||||
*
|
||||
* 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 <assert.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "uuids.h"
|
||||
#include "dshow.h"
|
||||
#include "control.h"
|
||||
|
||||
static void CommitDecommitTest(void)
|
||||
{
|
||||
IMemAllocator* pMemAllocator;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)&pMemAllocator);
|
||||
ok(hr==S_OK, "Unable to create memory allocator %x\n", hr);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ALLOCATOR_PROPERTIES RequestedProps;
|
||||
ALLOCATOR_PROPERTIES ActualProps;
|
||||
|
||||
IMediaSample *sample = NULL, *sample2 = NULL;
|
||||
|
||||
RequestedProps.cBuffers = 2;
|
||||
RequestedProps.cbBuffer = 65536;
|
||||
RequestedProps.cbAlign = 1;
|
||||
RequestedProps.cbPrefix = 0;
|
||||
|
||||
hr = IMemAllocator_SetProperties(pMemAllocator, &RequestedProps, &ActualProps);
|
||||
ok(hr==S_OK, "SetProperties returned: %x\n", hr);
|
||||
|
||||
hr = IMemAllocator_Commit(pMemAllocator);
|
||||
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
||||
hr = IMemAllocator_Commit(pMemAllocator);
|
||||
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
||||
|
||||
hr = IMemAllocator_GetBuffer(pMemAllocator, &sample, NULL, NULL, 0);
|
||||
ok(hr==S_OK, "Could not get a buffer: %x\n", hr);
|
||||
|
||||
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||
ok(hr==S_OK, "Decommit returned: %x\n", hr);
|
||||
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||
ok(hr==S_OK, "Cecommit returned: %x\n", hr);
|
||||
|
||||
/* Decommit and recommit while holding a sample */
|
||||
if (sample)
|
||||
{
|
||||
hr = IMemAllocator_Commit(pMemAllocator);
|
||||
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
||||
|
||||
hr = IMemAllocator_GetBuffer(pMemAllocator, &sample2, NULL, NULL, 0);
|
||||
ok(hr==S_OK, "Could not get a buffer: %x\n", hr);
|
||||
IUnknown_Release(sample);
|
||||
if (sample2)
|
||||
IUnknown_Release(sample2);
|
||||
|
||||
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||
ok(hr==S_OK, "Cecommit returned: %x\n", hr);
|
||||
}
|
||||
IMemAllocator_Release(pMemAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(memallocator)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
CommitDecommitTest();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
214
rostests/winetests/quartz/misc.c
Normal file
214
rostests/winetests/quartz/misc.c
Normal file
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* Misc unit tests for Quartz
|
||||
*
|
||||
* Copyright (C) 2007 Google (Lei Zhang)
|
||||
*
|
||||
* 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 COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "dshow.h"
|
||||
|
||||
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
|
||||
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
|
||||
ok(ppv != NULL, "Pointer is NULL\n");
|
||||
|
||||
#define QI_FAIL(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
|
||||
ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface returned %x\n", hr); \
|
||||
ok(ppv == NULL, "Pointer is %p\n", ppv);
|
||||
|
||||
#define ADDREF_EXPECT(iface, num) if (iface) { \
|
||||
refCount = IUnknown_AddRef(iface); \
|
||||
ok(refCount == num, "IUnknown_AddRef should return %d, got %d\n", num, refCount); \
|
||||
}
|
||||
|
||||
#define RELEASE_EXPECT(iface, num) if (iface) { \
|
||||
refCount = IUnknown_Release(iface); \
|
||||
ok(refCount == num, "IUnknown_Release should return %d, got %d\n", num, refCount); \
|
||||
}
|
||||
|
||||
static void test_aggregation(const CLSID clsidOuter, const CLSID clsidInner,
|
||||
const IID iidOuter, const IID iidInner)
|
||||
{
|
||||
HRESULT hr;
|
||||
ULONG refCount;
|
||||
IUnknown *pUnkOuter = NULL;
|
||||
IUnknown *pUnkInner = NULL;
|
||||
IUnknown *pUnkInnerFail = NULL;
|
||||
IUnknown *pUnkOuterTest = NULL;
|
||||
IUnknown *pUnkInnerTest = NULL;
|
||||
IUnknown *pUnkAggregatee = NULL;
|
||||
IUnknown *pUnkAggregator = NULL;
|
||||
IUnknown *pUnkTest = NULL;
|
||||
|
||||
hr = CoCreateInstance(&clsidOuter, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IUnknown, (LPVOID*)&pUnkOuter);
|
||||
ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
|
||||
ok(pUnkOuter != NULL, "pUnkOuter is NULL\n");
|
||||
|
||||
if (!pUnkOuter)
|
||||
{
|
||||
skip("pUnkOuter is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* for aggregation, we should only be able to request IUnknown */
|
||||
hr = CoCreateInstance(&clsidInner, pUnkOuter, CLSCTX_INPROC_SERVER,
|
||||
&iidInner, (LPVOID*)&pUnkInnerFail);
|
||||
ok(hr == E_NOINTERFACE, "CoCreateInstance returned %x\n", hr);
|
||||
ok(pUnkInnerFail == NULL, "pUnkInnerFail is not NULL\n");
|
||||
|
||||
/* aggregation, request IUnknown */
|
||||
hr = CoCreateInstance(&clsidInner, pUnkOuter, CLSCTX_INPROC_SERVER,
|
||||
&IID_IUnknown, (LPVOID*)&pUnkInner);
|
||||
ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
|
||||
ok(pUnkInner != NULL, "pUnkInner is NULL\n");
|
||||
|
||||
if (!pUnkInner)
|
||||
{
|
||||
skip("pUnkInner is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ADDREF_EXPECT(pUnkOuter, 2);
|
||||
ADDREF_EXPECT(pUnkInner, 2);
|
||||
RELEASE_EXPECT(pUnkOuter, 1);
|
||||
RELEASE_EXPECT(pUnkInner, 1);
|
||||
|
||||
QI_FAIL(pUnkOuter, iidInner, pUnkAggregatee);
|
||||
QI_FAIL(pUnkInner, iidOuter, pUnkAggregator);
|
||||
|
||||
/* these QueryInterface calls should work */
|
||||
QI_SUCCEED(pUnkOuter, iidOuter, pUnkAggregator);
|
||||
QI_SUCCEED(pUnkOuter, IID_IUnknown, pUnkOuterTest);
|
||||
/* IGraphConfig interface comes with DirectShow 9 */
|
||||
if(IsEqualGUID(&IID_IGraphConfig, &iidInner))
|
||||
{
|
||||
hr = IUnknown_QueryInterface(pUnkInner, &iidInner, (LPVOID*)&pUnkAggregatee);
|
||||
ok(hr == S_OK || broken(hr == E_NOINTERFACE), "IUnknown_QueryInterface returned %x\n", hr);
|
||||
ok(pUnkAggregatee != NULL || broken(!pUnkAggregatee), "Pointer is NULL\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
QI_SUCCEED(pUnkInner, iidInner, pUnkAggregatee);
|
||||
}
|
||||
QI_SUCCEED(pUnkInner, IID_IUnknown, pUnkInnerTest);
|
||||
|
||||
if (!pUnkAggregator || !pUnkOuterTest || !pUnkAggregatee
|
||||
|| !pUnkInnerTest)
|
||||
{
|
||||
skip("One of the required interfaces is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ADDREF_EXPECT(pUnkAggregator, 5);
|
||||
ADDREF_EXPECT(pUnkOuterTest, 6);
|
||||
ADDREF_EXPECT(pUnkAggregatee, 7);
|
||||
ADDREF_EXPECT(pUnkInnerTest, 3);
|
||||
RELEASE_EXPECT(pUnkAggregator, 6);
|
||||
RELEASE_EXPECT(pUnkOuterTest, 5);
|
||||
RELEASE_EXPECT(pUnkAggregatee, 4);
|
||||
RELEASE_EXPECT(pUnkInnerTest, 2);
|
||||
|
||||
QI_SUCCEED(pUnkAggregator, IID_IUnknown, pUnkTest);
|
||||
QI_SUCCEED(pUnkOuterTest, IID_IUnknown, pUnkTest);
|
||||
QI_SUCCEED(pUnkAggregatee, IID_IUnknown, pUnkTest);
|
||||
QI_SUCCEED(pUnkInnerTest, IID_IUnknown, pUnkTest);
|
||||
|
||||
QI_FAIL(pUnkAggregator, iidInner, pUnkTest);
|
||||
QI_FAIL(pUnkOuterTest, iidInner, pUnkTest);
|
||||
QI_FAIL(pUnkAggregatee, iidInner, pUnkTest);
|
||||
QI_SUCCEED(pUnkInnerTest, iidInner, pUnkTest);
|
||||
|
||||
QI_SUCCEED(pUnkAggregator, iidOuter, pUnkTest);
|
||||
QI_SUCCEED(pUnkOuterTest, iidOuter, pUnkTest);
|
||||
QI_SUCCEED(pUnkAggregatee, iidOuter, pUnkTest);
|
||||
QI_FAIL(pUnkInnerTest, iidOuter, pUnkTest);
|
||||
|
||||
RELEASE_EXPECT(pUnkAggregator, 10);
|
||||
RELEASE_EXPECT(pUnkOuterTest, 9);
|
||||
RELEASE_EXPECT(pUnkAggregatee, 8);
|
||||
RELEASE_EXPECT(pUnkInnerTest, 2);
|
||||
RELEASE_EXPECT(pUnkOuter, 7);
|
||||
RELEASE_EXPECT(pUnkInner, 1);
|
||||
|
||||
do
|
||||
{
|
||||
refCount = IUnknown_Release(pUnkInner);
|
||||
} while (refCount);
|
||||
|
||||
do
|
||||
{
|
||||
refCount = IUnknown_Release(pUnkOuter);
|
||||
} while (refCount);
|
||||
}
|
||||
|
||||
static void test_video_renderer_aggregations(void)
|
||||
{
|
||||
const IID * iids[] = {
|
||||
&IID_IMediaFilter, &IID_IBaseFilter, &IID_IBasicVideo, &IID_IVideoWindow
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(iids) / sizeof(iids[0]); i++)
|
||||
{
|
||||
test_aggregation(CLSID_SystemClock, CLSID_VideoRenderer,
|
||||
IID_IReferenceClock, *iids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_filter_graph_aggregations(void)
|
||||
{
|
||||
const IID * iids[] = {
|
||||
&IID_IFilterGraph2, &IID_IMediaControl, &IID_IGraphBuilder,
|
||||
&IID_IFilterGraph, &IID_IMediaSeeking, &IID_IBasicAudio, &IID_IBasicVideo,
|
||||
&IID_IVideoWindow, &IID_IMediaEventEx, &IID_IMediaFilter,
|
||||
&IID_IMediaEventSink, &IID_IGraphConfig, &IID_IMediaPosition
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(iids) / sizeof(iids[0]); i++)
|
||||
{
|
||||
test_aggregation(CLSID_SystemClock, CLSID_FilterGraph,
|
||||
IID_IReferenceClock, *iids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_filter_mapper_aggregations(void)
|
||||
{
|
||||
const IID * iids[] = {
|
||||
&IID_IFilterMapper2, &IID_IFilterMapper
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(iids) / sizeof(iids[0]); i++)
|
||||
{
|
||||
test_aggregation(CLSID_SystemClock, CLSID_FilterMapper2,
|
||||
IID_IReferenceClock, *iids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(misc)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_video_renderer_aggregations();
|
||||
test_filter_graph_aggregations();
|
||||
test_filter_mapper_aggregations();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
18
rostests/winetests/quartz/quartz.rbuild
Normal file
18
rostests/winetests/quartz/quartz.rbuild
Normal file
|
@ -0,0 +1,18 @@
|
|||
<module name="quartz_winetest" type="win32cui" installbase="bin" installname="quartz_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="quartz_winetest">.</include>
|
||||
<file>avisplitter.c</file>
|
||||
<file>filtergraph.c</file>
|
||||
<file>filtermapper.c</file>
|
||||
<file>memallocator.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>referenceclock.c</file>
|
||||
<file>videorenderer.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>oleaut32</library>
|
||||
<library>ole32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
115
rostests/winetests/quartz/referenceclock.c
Normal file
115
rostests/winetests/quartz/referenceclock.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Unit tests for Direct Show functions - IReferenceClock
|
||||
*
|
||||
* Copyright (C) 2007 Alex Villacís Lasso
|
||||
*
|
||||
* 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 <assert.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "uuids.h"
|
||||
#include "dshow.h"
|
||||
#include "control.h"
|
||||
|
||||
static void test_IReferenceClock_query_interface(const char * clockdesc, IReferenceClock * pClock)
|
||||
{
|
||||
HRESULT hr;
|
||||
IUnknown *pF;
|
||||
|
||||
hr = IReferenceClock_QueryInterface(pClock, &IID_IUnknown, (LPVOID *)&pF);
|
||||
ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr);
|
||||
ok(pF != NULL, "pF is NULL\n");
|
||||
|
||||
hr = IReferenceClock_QueryInterface(pClock, &IID_IDirectDraw, (LPVOID *)&pF);
|
||||
ok(hr == E_NOINTERFACE, "IReferenceClock_QueryInterface returned %x\n", hr);
|
||||
ok(pF == NULL, "pF is not NULL\n");
|
||||
|
||||
hr = IReferenceClock_QueryInterface(pClock, &IID_IReferenceClock, (LPVOID *)&pF);
|
||||
ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr);
|
||||
ok(pF != NULL, "pF is NULL\n");
|
||||
}
|
||||
|
||||
/* The following method expects a reference clock that will keep ticking for
|
||||
* at least 5 seconds since its creation. This method assumes no other methods
|
||||
* were called on the IReferenceClock interface since its creation.
|
||||
*/
|
||||
static void test_IReferenceClock_methods(const char * clockdesc, IReferenceClock * pClock)
|
||||
{
|
||||
HRESULT hr;
|
||||
REFERENCE_TIME time1;
|
||||
REFERENCE_TIME time2;
|
||||
signed long diff;
|
||||
|
||||
/* Test response from invalid (NULL) argument */
|
||||
hr = IReferenceClock_GetTime(pClock, NULL);
|
||||
ok (hr == E_POINTER, "%s - Expected E_POINTER (0x%08x), got 0x%08x\n", clockdesc, E_POINTER, hr);
|
||||
|
||||
/* Test response for valid value - try 1 */
|
||||
/* TODO: test whether Windows actually returns S_FALSE in its first invocation */
|
||||
time1 = (REFERENCE_TIME)0xdeadbeef;
|
||||
hr = IReferenceClock_GetTime(pClock, &time1);
|
||||
ok (hr == S_FALSE || hr == S_OK, "%s - Expected S_OK or S_FALSE, got 0x%08x\n", clockdesc, hr);
|
||||
ok (time1 != 0xdeadbeef, "%s - value was NOT changed on return!\n", clockdesc);
|
||||
|
||||
/* Test response for valid value - try 2 */
|
||||
time2 = (REFERENCE_TIME)0xdeadbeef;
|
||||
hr = IReferenceClock_GetTime(pClock, &time2);
|
||||
ok (hr == S_FALSE || hr == S_OK, "%s - Expected S_OK or S_FALSE, got 0x%08x\n", clockdesc, hr);
|
||||
ok (time2 != 0xdeadbeef, "%s - value was NOT changed on return!\n", clockdesc);
|
||||
|
||||
/* In case the second invocation managed to return S_FALSE, MSDN says the
|
||||
returned time is the same as the previous one. */
|
||||
ok ((hr != S_FALSE || time1 == time2), "%s - returned S_FALSE, but values not equal!\n", clockdesc);
|
||||
|
||||
time1 = time2;
|
||||
Sleep(1000); /* Sleep for at least 1 second */
|
||||
hr = IReferenceClock_GetTime(pClock, &time2);
|
||||
/* After a 1-second sleep, there is no excuse to get S_FALSE (see TODO above) */
|
||||
ok (hr == S_OK, "%s - Expected S_OK, got 0x%08x\n", clockdesc, hr);
|
||||
|
||||
/* FIXME: How much deviation should be allowed after a sleep? */
|
||||
/* 0.3% is common, and 0.4% is sometimes observed. */
|
||||
diff = time2 - time1;
|
||||
ok (9940000 <= diff && diff <= 10240000, "%s - Expected difference around 10000000, got %lu\n", clockdesc, diff);
|
||||
|
||||
}
|
||||
|
||||
static void test_IReferenceClock_SystemClock(void)
|
||||
{
|
||||
IReferenceClock * pReferenceClock;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pReferenceClock);
|
||||
ok(hr == S_OK, "Unable to create reference clock from system clock %x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
test_IReferenceClock_query_interface("SystemClock", pReferenceClock);
|
||||
test_IReferenceClock_methods("SystemClock", pReferenceClock);
|
||||
IReferenceClock_Release(pReferenceClock);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(referenceclock)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
test_IReferenceClock_SystemClock();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
27
rostests/winetests/quartz/testlist.c
Normal file
27
rostests/winetests/quartz/testlist.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_avisplitter(void);
|
||||
extern void func_videorenderer(void);
|
||||
extern void func_referenceclock(void);
|
||||
extern void func_misc(void);
|
||||
extern void func_memallocator(void);
|
||||
extern void func_filtermapper(void);
|
||||
extern void func_filtergraph(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "avisplitter", func_avisplitter },
|
||||
{ "videorenderer", func_videorenderer },
|
||||
{ "referenceclock", func_referenceclock },
|
||||
{ "misc", func_misc },
|
||||
{ "memallocator", func_memallocator },
|
||||
{ "filtermapper", func_filtermapper },
|
||||
{ "filtergraph", func_filtergraph },
|
||||
{ 0, 0 }
|
||||
};
|
165
rostests/winetests/quartz/videorenderer.c
Normal file
165
rostests/winetests/quartz/videorenderer.c
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Unit tests for Video Renderer functions
|
||||
*
|
||||
* Copyright (C) 2007 Google (Lei Zhang)
|
||||
*
|
||||
* 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 COBJMACROS
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "dshow.h"
|
||||
|
||||
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
|
||||
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
|
||||
ok(ppv != NULL, "Pointer is NULL\n");
|
||||
|
||||
#define RELEASE_EXPECT(iface, num) if (iface) { \
|
||||
hr = IUnknown_Release(iface); \
|
||||
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
|
||||
}
|
||||
|
||||
static IUnknown *pVideoRenderer = NULL;
|
||||
|
||||
static int create_video_renderer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IUnknown, (LPVOID*)&pVideoRenderer);
|
||||
return (hr == S_OK && pVideoRenderer != NULL);
|
||||
}
|
||||
|
||||
static void release_video_renderer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = IUnknown_Release(pVideoRenderer);
|
||||
ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
|
||||
}
|
||||
|
||||
static void test_query_interface(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
IBaseFilter *pBaseFilter = NULL;
|
||||
IBasicVideo *pBasicVideo = NULL;
|
||||
IDirectDrawVideo *pDirectDrawVideo = NULL;
|
||||
IKsPropertySet *pKsPropertySet = NULL;
|
||||
IMediaPosition *pMediaPosition = NULL;
|
||||
IMediaSeeking *pMediaSeeking = NULL;
|
||||
IQualityControl *pQualityControl = NULL;
|
||||
IQualProp *pQualProp = NULL;
|
||||
IVideoWindow *pVideoWindow = NULL;
|
||||
|
||||
QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter);
|
||||
RELEASE_EXPECT(pBaseFilter, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo);
|
||||
RELEASE_EXPECT(pBasicVideo, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking);
|
||||
RELEASE_EXPECT(pMediaSeeking, 1);
|
||||
todo_wine {
|
||||
QI_SUCCEED(pVideoRenderer, IID_IDirectDrawVideo, pDirectDrawVideo);
|
||||
RELEASE_EXPECT(pDirectDrawVideo, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IKsPropertySet, pKsPropertySet);
|
||||
RELEASE_EXPECT(pKsPropertySet, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IMediaPosition, pMediaPosition);
|
||||
RELEASE_EXPECT(pMediaPosition, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IQualityControl, pQualityControl);
|
||||
RELEASE_EXPECT(pQualityControl, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IQualProp, pQualProp);
|
||||
RELEASE_EXPECT(pQualProp, 1);
|
||||
}
|
||||
QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow);
|
||||
RELEASE_EXPECT(pVideoWindow, 1);
|
||||
}
|
||||
|
||||
static void test_pin(IPin *pin)
|
||||
{
|
||||
IMemInputPin *mpin = NULL;
|
||||
|
||||
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin);
|
||||
|
||||
ok(mpin != NULL, "No IMemInputPin found!\n");
|
||||
if (mpin)
|
||||
{
|
||||
ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n");
|
||||
ok(IMemInputPin_NotifyAllocator(mpin, NULL, 0) == E_POINTER, "NotifyAllocator likes a NULL pointer argument\n");
|
||||
IMemInputPin_Release(mpin);
|
||||
}
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static void test_basefilter(void)
|
||||
{
|
||||
IEnumPins *pin_enum = NULL;
|
||||
IBaseFilter *base = NULL;
|
||||
IPin *pins[2];
|
||||
ULONG ref;
|
||||
HRESULT hr;
|
||||
|
||||
IUnknown_QueryInterface(pVideoRenderer, &IID_IBaseFilter, (void *)&base);
|
||||
if (base == NULL)
|
||||
{
|
||||
/* test_query_interface handles this case */
|
||||
skip("No IBaseFilter\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IBaseFilter_EnumPins(base, NULL);
|
||||
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
||||
|
||||
hr= IBaseFilter_EnumPins(base, &pin_enum);
|
||||
ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
|
||||
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
|
||||
ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);
|
||||
|
||||
pins[0] = (void *)0xdead;
|
||||
pins[1] = (void *)0xdeed;
|
||||
|
||||
hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
|
||||
ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
|
||||
ok(pins[0] != (void *)0xdead && pins[0] != NULL, "pins[0] = %p\n", pins[0]);
|
||||
if (pins[0] != (void *)0xdead && pins[0] != NULL)
|
||||
{
|
||||
test_pin(pins[0]);
|
||||
IPin_Release(pins[0]);
|
||||
}
|
||||
|
||||
ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);
|
||||
|
||||
ref = IEnumPins_Release(pin_enum);
|
||||
ok(ref == 0, "ref is %u and not 0!\n", ref);
|
||||
|
||||
IBaseFilter_Release(base);
|
||||
}
|
||||
|
||||
START_TEST(videorenderer)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
if (!create_video_renderer())
|
||||
return;
|
||||
|
||||
test_query_interface();
|
||||
test_basefilter();
|
||||
|
||||
release_video_renderer();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
258
rostests/winetests/secur32/main.c
Normal file
258
rostests/winetests/secur32/main.c
Normal file
|
@ -0,0 +1,258 @@
|
|||
/*
|
||||
* Miscellaneous secur32 tests
|
||||
*
|
||||
* Copyright 2005, 2006 Kai Blin
|
||||
*
|
||||
* 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 SECURITY_WIN32
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <sspi.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE secdll;
|
||||
static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pEnumerateSecurityPackagesA)(PULONG, PSecPkgInfoA*);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pFreeContextBuffer)(PVOID pv);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pQuerySecurityPackageInfoA)(SEC_CHAR*, PSecPkgInfoA*);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pAcquireCredentialsHandleA)(SEC_CHAR*, SEC_CHAR*,
|
||||
ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID, PCredHandle, PTimeStamp);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pInitializeSecurityContextA)(PCredHandle, PCtxtHandle,
|
||||
SEC_CHAR*, ULONG, ULONG, ULONG, PSecBufferDesc, ULONG,
|
||||
PCtxtHandle, PSecBufferDesc, PULONG, PTimeStamp);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pCompleteAuthToken)(PCtxtHandle, PSecBufferDesc);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pAcceptSecurityContext)(PCredHandle, PCtxtHandle,
|
||||
PSecBufferDesc, ULONG, ULONG, PCtxtHandle, PSecBufferDesc,
|
||||
PULONG, PTimeStamp);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pFreeCredentialsHandle)(PCredHandle);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pDeleteSecurityContext)(PCtxtHandle);
|
||||
static SECURITY_STATUS (SEC_ENTRY * pQueryContextAttributesA)(PCtxtHandle, ULONG, PVOID);
|
||||
|
||||
static void InitFunctionPtrs(void)
|
||||
{
|
||||
secdll = LoadLibraryA("secur32.dll");
|
||||
if(!secdll)
|
||||
secdll = LoadLibraryA("security.dll");
|
||||
if(secdll)
|
||||
{
|
||||
pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA");
|
||||
pEnumerateSecurityPackagesA = (PVOID)GetProcAddress(secdll, "EnumerateSecurityPackagesA");
|
||||
pFreeContextBuffer = (PVOID)GetProcAddress(secdll, "FreeContextBuffer");
|
||||
pQuerySecurityPackageInfoA = (PVOID)GetProcAddress(secdll, "QuerySecurityPackageInfoA");
|
||||
pAcquireCredentialsHandleA = (PVOID)GetProcAddress(secdll, "AcquireCredentialsHandleA");
|
||||
pInitializeSecurityContextA = (PVOID)GetProcAddress(secdll, "InitializeSecurityContextA");
|
||||
pCompleteAuthToken = (PVOID)GetProcAddress(secdll, "CompleteAuthToken");
|
||||
pAcceptSecurityContext = (PVOID)GetProcAddress(secdll, "AcceptSecurityContext");
|
||||
pFreeCredentialsHandle = (PVOID)GetProcAddress(secdll, "FreeCredentialsHandle");
|
||||
pDeleteSecurityContext = (PVOID)GetProcAddress(secdll, "DeleteSecurityContext");
|
||||
pQueryContextAttributesA = (PVOID)GetProcAddress(secdll, "QueryContextAttributesA");
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*/
|
||||
/* General helper functions */
|
||||
|
||||
static const char* getSecError(SECURITY_STATUS status)
|
||||
{
|
||||
static char buf[20];
|
||||
|
||||
#define _SEC_ERR(x) case (x): return #x;
|
||||
switch(status)
|
||||
{
|
||||
_SEC_ERR(SEC_E_OK);
|
||||
_SEC_ERR(SEC_E_INSUFFICIENT_MEMORY);
|
||||
_SEC_ERR(SEC_E_INVALID_HANDLE);
|
||||
_SEC_ERR(SEC_E_UNSUPPORTED_FUNCTION);
|
||||
_SEC_ERR(SEC_E_TARGET_UNKNOWN);
|
||||
_SEC_ERR(SEC_E_INTERNAL_ERROR);
|
||||
_SEC_ERR(SEC_E_SECPKG_NOT_FOUND);
|
||||
_SEC_ERR(SEC_E_NOT_OWNER);
|
||||
_SEC_ERR(SEC_E_CANNOT_INSTALL);
|
||||
_SEC_ERR(SEC_E_INVALID_TOKEN);
|
||||
_SEC_ERR(SEC_E_CANNOT_PACK);
|
||||
_SEC_ERR(SEC_E_QOP_NOT_SUPPORTED);
|
||||
_SEC_ERR(SEC_E_NO_IMPERSONATION);
|
||||
_SEC_ERR(SEC_I_CONTINUE_NEEDED);
|
||||
_SEC_ERR(SEC_E_BUFFER_TOO_SMALL);
|
||||
_SEC_ERR(SEC_E_ILLEGAL_MESSAGE);
|
||||
_SEC_ERR(SEC_E_LOGON_DENIED);
|
||||
_SEC_ERR(SEC_E_NO_CREDENTIALS);
|
||||
_SEC_ERR(SEC_E_OUT_OF_SEQUENCE);
|
||||
default:
|
||||
sprintf(buf, "%08x\n", status);
|
||||
return buf;
|
||||
}
|
||||
#undef _SEC_ERR
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*/
|
||||
/* Helper for testQuerySecurityPagageInfo */
|
||||
|
||||
static SECURITY_STATUS setupPackageA(SEC_CHAR *p_package_name,
|
||||
PSecPkgInfo *p_pkg_info)
|
||||
{
|
||||
SECURITY_STATUS ret;
|
||||
|
||||
ret = pQuerySecurityPackageInfoA( p_package_name, p_pkg_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------- */
|
||||
/* The test functions */
|
||||
|
||||
static void testInitSecurityInterface(void)
|
||||
{
|
||||
PSecurityFunctionTable sec_fun_table = NULL;
|
||||
|
||||
sec_fun_table = pInitSecurityInterfaceA();
|
||||
ok(sec_fun_table != NULL, "InitSecurityInterface() returned NULL.\n");
|
||||
|
||||
}
|
||||
|
||||
static void testEnumerateSecurityPackages(void)
|
||||
{
|
||||
|
||||
SECURITY_STATUS sec_status;
|
||||
ULONG num_packages, i;
|
||||
PSecPkgInfo pkg_info = NULL;
|
||||
|
||||
trace("Running testEnumerateSecurityPackages\n");
|
||||
|
||||
sec_status = pEnumerateSecurityPackagesA(&num_packages, &pkg_info);
|
||||
|
||||
ok(sec_status == SEC_E_OK,
|
||||
"EnumerateSecurityPackages() should return %d, not %08x\n",
|
||||
SEC_E_OK, sec_status);
|
||||
|
||||
if (num_packages == 0)
|
||||
{
|
||||
todo_wine
|
||||
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %d\n",
|
||||
num_packages);
|
||||
skip("no sec packages to check\n");
|
||||
return;
|
||||
}
|
||||
else
|
||||
ok(num_packages > 0, "Number of sec packages should be > 0 ,but is %d\n",
|
||||
num_packages);
|
||||
|
||||
ok(pkg_info != NULL,
|
||||
"pkg_info should not be NULL after EnumerateSecurityPackages\n");
|
||||
|
||||
trace("Number of packages: %d\n", num_packages);
|
||||
for(i = 0; i < num_packages; ++i){
|
||||
trace("%d: Package \"%s\"\n", i, pkg_info[i].Name);
|
||||
trace("Supported flags:\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_INTEGRITY)
|
||||
trace("\tSECPKG_FLAG_INTEGRITY\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_PRIVACY)
|
||||
trace("\tSECPKG_FLAG_PRIVACY\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_TOKEN_ONLY)
|
||||
trace("\tSECPKG_FLAG_TOKEN_ONLY\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_DATAGRAM)
|
||||
trace("\tSECPKG_FLAG_DATAGRAM\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_CONNECTION)
|
||||
trace("\tSECPKG_FLAG_CONNECTION\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_MULTI_REQUIRED)
|
||||
trace("\tSECPKG_FLAG_MULTI_REQUIRED\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_CLIENT_ONLY)
|
||||
trace("\tSECPKG_FLAG_CLIENT_ONLY\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_EXTENDED_ERROR)
|
||||
trace("\tSECPKG_FLAG_EXTENDED_ERROR\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_IMPERSONATION)
|
||||
trace("\tSECPKG_FLAG_IMPERSONATION\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_ACCEPT_WIN32_NAME)
|
||||
trace("\tSECPKG_FLAG_ACCEPT_WIN32_NAME\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_STREAM)
|
||||
trace("\tSECPKG_FLAG_STREAM\n");
|
||||
if(pkg_info[i].fCapabilities & SECPKG_FLAG_READONLY_WITH_CHECKSUM)
|
||||
trace("\tSECPKG_FLAG_READONLY_WITH_CHECKSUM\n");
|
||||
trace("Comment: %s\n", pkg_info[i].Comment);
|
||||
trace("\n");
|
||||
}
|
||||
|
||||
pFreeContextBuffer(pkg_info);
|
||||
}
|
||||
|
||||
|
||||
static void testQuerySecurityPackageInfo(void)
|
||||
{
|
||||
SECURITY_STATUS sec_status;
|
||||
PSecPkgInfo pkg_info;
|
||||
static SEC_CHAR ntlm[] = "NTLM",
|
||||
winetest[] = "Winetest";
|
||||
|
||||
trace("Running testQuerySecurityPackageInfo\n");
|
||||
|
||||
/* Test with an existing package. Test should pass */
|
||||
|
||||
pkg_info = (void *)0xdeadbeef;
|
||||
sec_status = setupPackageA(ntlm, &pkg_info);
|
||||
|
||||
ok((sec_status == SEC_E_OK) || (sec_status == SEC_E_SECPKG_NOT_FOUND) ||
|
||||
broken(sec_status == SEC_E_UNSUPPORTED_FUNCTION), /* win95 */
|
||||
"Return value of QuerySecurityPackageInfo() shouldn't be %s\n",
|
||||
getSecError(sec_status) );
|
||||
|
||||
if (sec_status == SEC_E_OK)
|
||||
{
|
||||
ok(pkg_info != (void *)0xdeadbeef, "wrong pkg_info address %p\n", pkg_info);
|
||||
ok(pkg_info->wVersion == 1, "wVersion always should be 1, but is %d\n", pkg_info->wVersion);
|
||||
/* there is no point in testing pkg_info->cbMaxToken since it varies
|
||||
* between implementations.
|
||||
*/
|
||||
|
||||
sec_status = pFreeContextBuffer(pkg_info);
|
||||
ok( sec_status == SEC_E_OK,
|
||||
"Return value of FreeContextBuffer() shouldn't be %s\n",
|
||||
getSecError(sec_status) );
|
||||
}
|
||||
|
||||
/* Test with a nonexistent package, test should fail */
|
||||
|
||||
pkg_info = (void *)0xdeadbeef;
|
||||
sec_status = pQuerySecurityPackageInfoA(winetest, &pkg_info);
|
||||
|
||||
ok( sec_status == SEC_E_SECPKG_NOT_FOUND,
|
||||
"Return value of QuerySecurityPackageInfo() should be %s for a nonexistent package\n",
|
||||
getSecError(SEC_E_SECPKG_NOT_FOUND));
|
||||
|
||||
ok(pkg_info == (void *)0xdeadbeef, "wrong pkg_info address %p\n", pkg_info);
|
||||
}
|
||||
|
||||
START_TEST(main)
|
||||
{
|
||||
InitFunctionPtrs();
|
||||
if(pInitSecurityInterfaceA)
|
||||
testInitSecurityInterface();
|
||||
if(pFreeContextBuffer)
|
||||
{
|
||||
if(pEnumerateSecurityPackagesA)
|
||||
testEnumerateSecurityPackages();
|
||||
if(pQuerySecurityPackageInfoA)
|
||||
{
|
||||
testQuerySecurityPackageInfo();
|
||||
}
|
||||
}
|
||||
if(secdll)
|
||||
FreeLibrary(secdll);
|
||||
}
|
1299
rostests/winetests/secur32/ntlm.c
Normal file
1299
rostests/winetests/secur32/ntlm.c
Normal file
File diff suppressed because it is too large
Load diff
460
rostests/winetests/secur32/schannel.c
Normal file
460
rostests/winetests/secur32/schannel.c
Normal file
|
@ -0,0 +1,460 @@
|
|||
/*
|
||||
* Schannel tests
|
||||
*
|
||||
* Copyright 2006 Juan Lang
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#define SECURITY_WIN32
|
||||
#include <security.h>
|
||||
#include <schannel.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE secdll, crypt32dll;
|
||||
|
||||
static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA;
|
||||
static ENUMERATE_SECURITY_PACKAGES_FN_A pEnumerateSecurityPackagesA;
|
||||
static FREE_CONTEXT_BUFFER_FN pFreeContextBuffer;
|
||||
static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle;
|
||||
static QUERY_CREDENTIALS_ATTRIBUTES_FN_A pQueryCredentialsAttributesA;
|
||||
|
||||
static PCCERT_CONTEXT (WINAPI *pCertCreateCertificateContext)(DWORD,const BYTE*,DWORD);
|
||||
static BOOL (WINAPI *pCertFreeCertificateContext)(PCCERT_CONTEXT);
|
||||
static BOOL (WINAPI *pCertSetCertificateContextProperty)(PCCERT_CONTEXT,DWORD,DWORD,const void*);
|
||||
|
||||
static BOOL (WINAPI *pCryptAcquireContextW)(HCRYPTPROV*, LPCWSTR, LPCWSTR, DWORD, DWORD);
|
||||
static BOOL (WINAPI *pCryptDestroyKey)(HCRYPTKEY);
|
||||
static BOOL (WINAPI *pCryptImportKey)(HCRYPTPROV,CONST BYTE*,DWORD,HCRYPTKEY,DWORD,HCRYPTKEY*);
|
||||
static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV,ULONG_PTR);
|
||||
|
||||
static const BYTE bigCert[] = { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
|
||||
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
||||
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
|
||||
0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
|
||||
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30,
|
||||
0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20,
|
||||
0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01,
|
||||
0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
|
||||
0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 };
|
||||
static WCHAR cspNameW[] = { 'W','i','n','e','C','r','y','p','t','T','e',
|
||||
'm','p',0 };
|
||||
static BYTE privKey[] = {
|
||||
0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00,
|
||||
0x02, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x79, 0x10, 0x1c, 0xd0, 0x6b, 0x10,
|
||||
0x18, 0x30, 0x94, 0x61, 0xdc, 0x0e, 0xcb, 0x96, 0x4e, 0x21, 0x3f, 0x79, 0xcd,
|
||||
0xa9, 0x17, 0x62, 0xbc, 0xbb, 0x61, 0x4c, 0xe0, 0x75, 0x38, 0x6c, 0xf3, 0xde,
|
||||
0x60, 0x86, 0x03, 0x97, 0x65, 0xeb, 0x1e, 0x6b, 0xdb, 0x53, 0x85, 0xad, 0x68,
|
||||
0x21, 0xf1, 0x5d, 0xe7, 0x1f, 0xe6, 0x53, 0xb4, 0xbb, 0x59, 0x3e, 0x14, 0x27,
|
||||
0xb1, 0x83, 0xa7, 0x3a, 0x54, 0xe2, 0x8f, 0x65, 0x8e, 0x6a, 0x4a, 0xcf, 0x3b,
|
||||
0x1f, 0x65, 0xff, 0xfe, 0xf1, 0x31, 0x3a, 0x37, 0x7a, 0x8b, 0xcb, 0xc6, 0xd4,
|
||||
0x98, 0x50, 0x36, 0x67, 0xe4, 0xa1, 0xe8, 0x7e, 0x8a, 0xc5, 0x23, 0xf2, 0x77,
|
||||
0xf5, 0x37, 0x61, 0x49, 0x72, 0x59, 0xe8, 0x3d, 0xf7, 0x60, 0xb2, 0x77, 0xca,
|
||||
0x78, 0x54, 0x6d, 0x65, 0x9e, 0x03, 0x97, 0x1b, 0x61, 0xbd, 0x0c, 0xd8, 0x06,
|
||||
0x63, 0xe2, 0xc5, 0x48, 0xef, 0xb3, 0xe2, 0x6e, 0x98, 0x7d, 0xbd, 0x4e, 0x72,
|
||||
0x91, 0xdb, 0x31, 0x57, 0xe3, 0x65, 0x3a, 0x49, 0xca, 0xec, 0xd2, 0x02, 0x4e,
|
||||
0x22, 0x7e, 0x72, 0x8e, 0xf9, 0x79, 0x84, 0x82, 0xdf, 0x7b, 0x92, 0x2d, 0xaf,
|
||||
0xc9, 0xe4, 0x33, 0xef, 0x89, 0x5c, 0x66, 0x99, 0xd8, 0x80, 0x81, 0x47, 0x2b,
|
||||
0xb1, 0x66, 0x02, 0x84, 0x59, 0x7b, 0xc3, 0xbe, 0x98, 0x45, 0x4a, 0x3d, 0xdd,
|
||||
0xea, 0x2b, 0xdf, 0x4e, 0xb4, 0x24, 0x6b, 0xec, 0xe7, 0xd9, 0x0c, 0x45, 0xb8,
|
||||
0xbe, 0xca, 0x69, 0x37, 0x92, 0x4c, 0x38, 0x6b, 0x96, 0x6d, 0xcd, 0x86, 0x67,
|
||||
0x5c, 0xea, 0x54, 0x94, 0xa4, 0xca, 0xa4, 0x02, 0xa5, 0x21, 0x4d, 0xae, 0x40,
|
||||
0x8f, 0x9d, 0x51, 0x83, 0xf2, 0x3f, 0x33, 0xc1, 0x72, 0xb4, 0x1d, 0x94, 0x6e,
|
||||
0x7d, 0xe4, 0x27, 0x3f, 0xea, 0xff, 0xe5, 0x9b, 0xa7, 0x5e, 0x55, 0x8e, 0x0d,
|
||||
0x69, 0x1c, 0x7a, 0xff, 0x81, 0x9d, 0x53, 0x52, 0x97, 0x9a, 0x76, 0x79, 0xda,
|
||||
0x93, 0x32, 0x16, 0xec, 0x69, 0x51, 0x1a, 0x4e, 0xc3, 0xf1, 0x72, 0x80, 0x78,
|
||||
0x5e, 0x66, 0x4a, 0x8d, 0x85, 0x2f, 0x3f, 0xb2, 0xa7 };
|
||||
|
||||
static const BYTE selfSignedCert[] = {
|
||||
0x30, 0x82, 0x01, 0x1f, 0x30, 0x81, 0xce, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
|
||||
0x10, 0xeb, 0x0d, 0x57, 0x2a, 0x9c, 0x09, 0xba, 0xa4, 0x4a, 0xb7, 0x25, 0x49,
|
||||
0xd9, 0x3e, 0xb5, 0x73, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1d,
|
||||
0x05, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03,
|
||||
0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30,
|
||||
0x1e, 0x17, 0x0d, 0x30, 0x36, 0x30, 0x36, 0x32, 0x39, 0x30, 0x35, 0x30, 0x30,
|
||||
0x34, 0x36, 0x5a, 0x17, 0x0d, 0x30, 0x37, 0x30, 0x36, 0x32, 0x39, 0x31, 0x31,
|
||||
0x30, 0x30, 0x34, 0x36, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e,
|
||||
0x67, 0x00, 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41,
|
||||
0x00, 0xe2, 0x54, 0x3a, 0xa7, 0x83, 0xb1, 0x27, 0x14, 0x3e, 0x59, 0xbb, 0xb4,
|
||||
0x53, 0xe6, 0x1f, 0xe7, 0x5d, 0xf1, 0x21, 0x68, 0xad, 0x85, 0x53, 0xdb, 0x6b,
|
||||
0x1e, 0xeb, 0x65, 0x97, 0x03, 0x86, 0x60, 0xde, 0xf3, 0x6c, 0x38, 0x75, 0xe0,
|
||||
0x4c, 0x61, 0xbb, 0xbc, 0x62, 0x17, 0xa9, 0xcd, 0x79, 0x3f, 0x21, 0x4e, 0x96,
|
||||
0xcb, 0x0e, 0xdc, 0x61, 0x94, 0x30, 0x18, 0x10, 0x6b, 0xd0, 0x1c, 0x10, 0x79,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
|
||||
0x1d, 0x05, 0x00, 0x03, 0x41, 0x00, 0x25, 0x90, 0x53, 0x34, 0xd9, 0x56, 0x41,
|
||||
0x5e, 0xdb, 0x7e, 0x01, 0x36, 0xec, 0x27, 0x61, 0x5e, 0xb7, 0x4d, 0x90, 0x66,
|
||||
0xa2, 0xe1, 0x9d, 0x58, 0x76, 0xd4, 0x9c, 0xba, 0x2c, 0x84, 0xc6, 0x83, 0x7a,
|
||||
0x22, 0x0d, 0x03, 0x69, 0x32, 0x1a, 0x6d, 0xcb, 0x0c, 0x15, 0xb3, 0x6b, 0xc7,
|
||||
0x0a, 0x8c, 0xb4, 0x5c, 0x34, 0x78, 0xe0, 0x3c, 0x9c, 0xe9, 0xf3, 0x30, 0x9f,
|
||||
0xa8, 0x76, 0x57, 0x92, 0x36 };
|
||||
|
||||
static void InitFunctionPtrs(void)
|
||||
{
|
||||
HMODULE advapi32dll;
|
||||
|
||||
crypt32dll = LoadLibraryA("crypt32.dll");
|
||||
secdll = LoadLibraryA("secur32.dll");
|
||||
if(!secdll)
|
||||
secdll = LoadLibraryA("security.dll");
|
||||
advapi32dll = GetModuleHandleA("advapi32.dll");
|
||||
|
||||
#define GET_PROC(h, func) p ## func = (void*)GetProcAddress(h, #func)
|
||||
|
||||
if(secdll)
|
||||
{
|
||||
GET_PROC(secdll, AcquireCredentialsHandleA);
|
||||
GET_PROC(secdll, EnumerateSecurityPackagesA);
|
||||
GET_PROC(secdll, FreeContextBuffer);
|
||||
GET_PROC(secdll, FreeCredentialsHandle);
|
||||
GET_PROC(secdll, QueryCredentialsAttributesA);
|
||||
}
|
||||
|
||||
GET_PROC(advapi32dll, CryptAcquireContextW);
|
||||
GET_PROC(advapi32dll, CryptDestroyKey);
|
||||
GET_PROC(advapi32dll, CryptImportKey);
|
||||
GET_PROC(advapi32dll, CryptReleaseContext);
|
||||
|
||||
GET_PROC(crypt32dll, CertFreeCertificateContext);
|
||||
GET_PROC(crypt32dll, CertSetCertificateContextProperty);
|
||||
GET_PROC(crypt32dll, CertCreateCertificateContext);
|
||||
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
static void test_strength(PCredHandle handle)
|
||||
{
|
||||
SecPkgCred_CipherStrengths strength = {-1,-1};
|
||||
SECURITY_STATUS st;
|
||||
|
||||
st = pQueryCredentialsAttributesA(handle, SECPKG_ATTR_CIPHER_STRENGTHS, &strength);
|
||||
ok(st == SEC_E_OK, "QueryCredentialsAttributesA failed: %u\n", GetLastError());
|
||||
ok(strength.dwMinimumCipherStrength, "dwMinimumCipherStrength not changed\n");
|
||||
ok(strength.dwMaximumCipherStrength, "dwMaximumCipherStrength not changed\n");
|
||||
trace("strength %d - %d\n", strength.dwMinimumCipherStrength, strength.dwMaximumCipherStrength);
|
||||
}
|
||||
|
||||
static void testAcquireSecurityContext(void)
|
||||
{
|
||||
BOOL has_schannel = FALSE;
|
||||
SecPkgInfoA *package_info;
|
||||
ULONG i;
|
||||
SECURITY_STATUS st;
|
||||
CredHandle cred;
|
||||
TimeStamp exp;
|
||||
SCHANNEL_CRED schanCred;
|
||||
PCCERT_CONTEXT certs[2];
|
||||
HCRYPTPROV csp;
|
||||
static CHAR unisp_name_a[] = UNISP_NAME_A;
|
||||
WCHAR ms_def_prov_w[MAX_PATH];
|
||||
BOOL ret;
|
||||
HCRYPTKEY key;
|
||||
CRYPT_KEY_PROV_INFO keyProvInfo;
|
||||
|
||||
if (!pAcquireCredentialsHandleA || !pCertCreateCertificateContext ||
|
||||
!pEnumerateSecurityPackagesA || !pFreeContextBuffer ||
|
||||
!pFreeCredentialsHandle || !pCryptAcquireContextW)
|
||||
{
|
||||
win_skip("Needed functions are not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(pEnumerateSecurityPackagesA(&i, &package_info)))
|
||||
{
|
||||
while(i--)
|
||||
{
|
||||
if (!strcmp(package_info[i].Name, unisp_name_a))
|
||||
{
|
||||
has_schannel = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pFreeContextBuffer(package_info);
|
||||
}
|
||||
if (!has_schannel)
|
||||
{
|
||||
skip("Schannel not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
lstrcpyW(ms_def_prov_w, MS_DEF_PROV_W);
|
||||
|
||||
keyProvInfo.pwszContainerName = cspNameW;
|
||||
keyProvInfo.pwszProvName = ms_def_prov_w;
|
||||
keyProvInfo.dwProvType = PROV_RSA_FULL;
|
||||
keyProvInfo.dwFlags = 0;
|
||||
keyProvInfo.cProvParam = 0;
|
||||
keyProvInfo.rgProvParam = NULL;
|
||||
keyProvInfo.dwKeySpec = AT_SIGNATURE;
|
||||
|
||||
certs[0] = pCertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
|
||||
sizeof(bigCert));
|
||||
certs[1] = pCertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert,
|
||||
sizeof(selfSignedCert));
|
||||
|
||||
pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_DELETEKEYSET);
|
||||
|
||||
st = pAcquireCredentialsHandleA(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
ok(st == SEC_E_SECPKG_NOT_FOUND,
|
||||
"Expected SEC_E_SECPKG_NOT_FOUND, got %08x\n", st);
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on Win2K */
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, 0, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
|
||||
st);
|
||||
}
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_BOTH, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
|
||||
st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_NO_CREDENTIALS, "Expected SEC_E_NO_CREDENTIALS, got %08x\n",
|
||||
st);
|
||||
if (0)
|
||||
{
|
||||
/* Crashes */
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, NULL, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
if(st == SEC_E_OK)
|
||||
pFreeCredentialsHandle(&cred);
|
||||
memset(&cred, 0, sizeof(cred));
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, NULL, NULL, NULL, &cred, &exp);
|
||||
ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
/* expriy is indeterminate in win2k3 */
|
||||
trace("expiry: %08x%08x\n", exp.HighPart, exp.LowPart);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
|
||||
/* Bad version in SCHANNEL_CRED */
|
||||
memset(&schanCred, 0, sizeof(schanCred));
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
|
||||
/* No cert in SCHANNEL_CRED succeeds for outbound.. */
|
||||
schanCred.dwVersion = SCHANNEL_CRED_VERSION;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
/* but fails for inbound. */
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_NO_CREDENTIALS ||
|
||||
st == SEC_E_OK /* Vista/win2k8 */,
|
||||
"Expected SEC_E_NO_CREDENTIALS or SEC_E_OK, got %08x\n", st);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes with bad paCred pointer */
|
||||
schanCred.cCreds = 1;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Bogus cert in SCHANNEL_CRED. Windows fails with
|
||||
* SEC_E_UNKNOWN_CREDENTIALS, but I'll accept SEC_E_NO_CREDENTIALS too.
|
||||
*/
|
||||
schanCred.cCreds = 1;
|
||||
schanCred.paCred = &certs[0];
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
|
||||
st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n",
|
||||
st);
|
||||
|
||||
/* Good cert, but missing private key. Windows fails with
|
||||
* SEC_E_NO_CREDENTIALS, but I'll accept SEC_E_UNKNOWN_CREDENTIALS too.
|
||||
*/
|
||||
schanCred.cCreds = 1;
|
||||
schanCred.paCred = &certs[1];
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS ||
|
||||
st == SEC_E_INTERNAL_ERROR, /* win2k */
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, SEC_E_NO_CREDENTIALS "
|
||||
"or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_NO_CREDENTIALS ||
|
||||
st == SEC_E_INTERNAL_ERROR, /* win2k */
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, SEC_E_NO_CREDENTIALS "
|
||||
"or SEC_E_INTERNAL_ERROR, got %08x\n", st);
|
||||
|
||||
/* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */
|
||||
if (pCertSetCertificateContextProperty)
|
||||
{
|
||||
ret = pCertSetCertificateContextProperty(certs[1],
|
||||
CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo);
|
||||
schanCred.dwVersion = SCH_CRED_V3;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
}
|
||||
|
||||
ret = pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_NEWKEYSET);
|
||||
ok(ret, "CryptAcquireContextW failed: %08x\n", GetLastError());
|
||||
ret = 0;
|
||||
if (pCryptImportKey)
|
||||
{
|
||||
ret = pCryptImportKey(csp, privKey, sizeof(privKey), 0, 0, &key);
|
||||
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
PCCERT_CONTEXT tmp;
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes */
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
/* Good cert with private key, bogus version */
|
||||
schanCred.dwVersion = SCH_CRED_V1;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
schanCred.dwVersion = SCH_CRED_V2;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_INTERNAL_ERROR ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_INTERNAL_ERROR or SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
|
||||
/* Succeeds on V3 or higher */
|
||||
schanCred.dwVersion = SCH_CRED_V3;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS, /* win2k3 */
|
||||
"AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
schanCred.dwVersion = SCHANNEL_CRED_VERSION;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_OK ||
|
||||
st == SEC_E_UNKNOWN_CREDENTIALS, /* win2k3 */
|
||||
"AcquireCredentialsHandleA failed: %08x\n", st);
|
||||
if (st == SEC_E_OK) test_strength(&cred);
|
||||
pFreeCredentialsHandle(&cred);
|
||||
|
||||
/* How about more than one cert? */
|
||||
schanCred.cCreds = 2;
|
||||
schanCred.paCred = certs;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS ||
|
||||
st == SEC_E_NO_CREDENTIALS /* Vista/win2k8 */,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_NO_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS ||
|
||||
st == SEC_E_NO_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
tmp = certs[0];
|
||||
certs[0] = certs[1];
|
||||
certs[1] = tmp;
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_OUTBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS ||
|
||||
st == SEC_E_NO_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND,
|
||||
NULL, &schanCred, NULL, NULL, &cred, NULL);
|
||||
ok(st == SEC_E_UNKNOWN_CREDENTIALS,
|
||||
"Expected SEC_E_UNKNOWN_CREDENTIALS, got %08x\n", st);
|
||||
/* FIXME: what about two valid certs? */
|
||||
|
||||
if (pCryptDestroyKey)
|
||||
pCryptDestroyKey(key);
|
||||
}
|
||||
|
||||
if (pCryptReleaseContext)
|
||||
pCryptReleaseContext(csp, 0);
|
||||
pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_DELETEKEYSET);
|
||||
|
||||
if (pCertFreeCertificateContext)
|
||||
{
|
||||
pCertFreeCertificateContext(certs[0]);
|
||||
pCertFreeCertificateContext(certs[1]);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(schannel)
|
||||
{
|
||||
InitFunctionPtrs();
|
||||
|
||||
testAcquireSecurityContext();
|
||||
|
||||
if(secdll)
|
||||
FreeLibrary(secdll);
|
||||
if(crypt32dll)
|
||||
FreeLibrary(crypt32dll);
|
||||
}
|
153
rostests/winetests/secur32/secur32.c
Normal file
153
rostests/winetests/secur32/secur32.c
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* tests
|
||||
*
|
||||
* Copyright 2006 Robert Reif
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#define SECURITY_WIN32
|
||||
#include <security.h>
|
||||
#include <schannel.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HMODULE secdll;
|
||||
|
||||
static BOOLEAN (WINAPI * pGetComputerObjectNameA)(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG lpnSize);
|
||||
static BOOLEAN (WINAPI * pGetComputerObjectNameW)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG lpnSize);
|
||||
static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void);
|
||||
static PSecurityFunctionTableW (SEC_ENTRY * pInitSecurityInterfaceW)(void);
|
||||
|
||||
static EXTENDED_NAME_FORMAT formats[] = {
|
||||
NameUnknown, NameFullyQualifiedDN, NameSamCompatible, NameDisplay,
|
||||
NameUniqueId, NameCanonical, NameUserPrincipal, NameCanonicalEx,
|
||||
NameServicePrincipal, NameDnsDomain
|
||||
};
|
||||
|
||||
static void testGetComputerObjectNameA(void)
|
||||
{
|
||||
char name[256];
|
||||
ULONG size;
|
||||
BOOLEAN rc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
|
||||
size = sizeof(name);
|
||||
ZeroMemory(name, sizeof(name));
|
||||
rc = pGetComputerObjectNameA(formats[i], name, &size);
|
||||
ok(rc || ((formats[i] == NameUnknown) &&
|
||||
(GetLastError() == ERROR_INVALID_PARAMETER)) ||
|
||||
(GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
|
||||
(GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
|
||||
(GetLastError() == ERROR_NO_SUCH_USER) ||
|
||||
(GetLastError() == ERROR_NONE_MAPPED) ||
|
||||
(GetLastError() == ERROR_ACCESS_DENIED),
|
||||
"GetComputerObjectNameA(%d) failed: %d\n",
|
||||
formats[i], GetLastError());
|
||||
if (rc)
|
||||
trace("GetComputerObjectNameA() returned %s\n", name);
|
||||
}
|
||||
}
|
||||
|
||||
static void testGetComputerObjectNameW(void)
|
||||
{
|
||||
WCHAR nameW[256];
|
||||
ULONG size;
|
||||
BOOLEAN rc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
|
||||
size = sizeof(nameW)/sizeof(nameW[0]);
|
||||
ZeroMemory(nameW, sizeof(nameW));
|
||||
rc = pGetComputerObjectNameW(formats[i], nameW, &size);
|
||||
ok(rc || ((formats[i] == NameUnknown) &&
|
||||
(GetLastError() == ERROR_INVALID_PARAMETER)) ||
|
||||
(GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) ||
|
||||
(GetLastError() == ERROR_NO_SUCH_DOMAIN) ||
|
||||
(GetLastError() == ERROR_NO_SUCH_USER) ||
|
||||
(GetLastError() == ERROR_NONE_MAPPED) ||
|
||||
(GetLastError() == ERROR_ACCESS_DENIED),
|
||||
"GetComputerObjectNameW(%d) failed: %d\n",
|
||||
formats[i], GetLastError());
|
||||
if (rc) {
|
||||
char name[256];
|
||||
WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, sizeof(name), NULL, NULL );
|
||||
trace("GetComputerObjectNameW() returned %s\n", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test_InitSecurityInterface(void)
|
||||
{
|
||||
PSecurityFunctionTableA sftA;
|
||||
PSecurityFunctionTableW sftW;
|
||||
|
||||
sftA = pInitSecurityInterfaceA();
|
||||
ok(sftA != NULL, "pInitSecurityInterfaceA failed\n");
|
||||
ok(sftA->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftA->dwVersion);
|
||||
ok(!sftA->Reserved2 || broken(sftA->Reserved2 != NULL) /* WinME */,
|
||||
"Reserved2 should be NULL instead of %p in security function table\n",
|
||||
sftA->Reserved2);
|
||||
ok(sftA->Reserved3 == sftA->EncryptMessage ||
|
||||
broken(sftA->Reserved3 != sftA->EncryptMessage) /* Win9x */,
|
||||
"Reserved3 should be equal to EncryptMessage in the security function table\n");
|
||||
ok(sftA->Reserved4 == sftA->DecryptMessage ||
|
||||
broken(sftA->Reserved4 != sftA->DecryptMessage) /* Win9x */,
|
||||
"Reserved4 should be equal to DecryptMessage in the security function table\n");
|
||||
|
||||
if (!pInitSecurityInterfaceW)
|
||||
{
|
||||
skip("InitSecurityInterfaceW not exported by secur32.dll\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sftW = pInitSecurityInterfaceW();
|
||||
ok(sftW != NULL, "pInitSecurityInterfaceW failed\n");
|
||||
ok(sftW->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftW->dwVersion);
|
||||
ok(!sftW->Reserved2, "Reserved2 should be NULL instead of %p in security function table\n", sftW->Reserved2);
|
||||
ok(sftW->Reserved3 == sftW->EncryptMessage, "Reserved3 should be equal to EncryptMessage in the security function table\n");
|
||||
ok(sftW->Reserved4 == sftW->DecryptMessage, "Reserved4 should be equal to DecryptMessage in the security function table\n");
|
||||
}
|
||||
|
||||
START_TEST(secur32)
|
||||
{
|
||||
secdll = LoadLibraryA("secur32.dll");
|
||||
|
||||
if (!secdll)
|
||||
secdll = LoadLibraryA("security.dll");
|
||||
|
||||
if (secdll)
|
||||
{
|
||||
pGetComputerObjectNameA = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameA");
|
||||
pGetComputerObjectNameW = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameW");
|
||||
pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA");
|
||||
pInitSecurityInterfaceW = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceW");
|
||||
|
||||
if (pGetComputerObjectNameA)
|
||||
testGetComputerObjectNameA();
|
||||
|
||||
if (pGetComputerObjectNameW)
|
||||
testGetComputerObjectNameW();
|
||||
|
||||
test_InitSecurityInterface();
|
||||
|
||||
FreeLibrary(secdll);
|
||||
}
|
||||
}
|
13
rostests/winetests/secur32/secur32.rbuild
Normal file
13
rostests/winetests/secur32/secur32.rbuild
Normal file
|
@ -0,0 +1,13 @@
|
|||
<module name="secur32_winetest" type="win32cui" installbase="bin" installname="secur32_winetest.exe" allowwarnings="true">
|
||||
<compilerflag compiler="cc">-Wno-format</compilerflag>
|
||||
<include base="secur32_winetest">.</include>
|
||||
<file>main.c</file>
|
||||
<file>ntlm.c</file>
|
||||
<file>schannel.c</file>
|
||||
<file>secur32.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
21
rostests/winetests/secur32/testlist.c
Normal file
21
rostests/winetests/secur32/testlist.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_secur32(void);
|
||||
extern void func_schannel(void);
|
||||
extern void func_ntlm(void);
|
||||
extern void func_main(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "secur32", func_secur32 },
|
||||
{ "schannel", func_schannel },
|
||||
{ "ntlm", func_ntlm },
|
||||
{ "main", func_main },
|
||||
{ 0, 0 }
|
||||
};
|
Loading…
Reference in a new issue