Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
December 2019
- 73 participants
- 1394 messages
[PATCH 3/4] ole32: Improve maximum storage size returned for generic composite monikers.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/ole32/compositemoniker.c | 2 +-
dlls/ole32/tests/moniker.c | 28 ++++++++++++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c
index 5f5c8c7deb..5914008fe3 100644
--- a/dlls/ole32/compositemoniker.c
+++ b/dlls/ole32/compositemoniker.c
@@ -315,7 +315,7 @@ CompositeMonikerImpl_GetSizeMax(IMoniker* iface,ULARGE_INTEGER* pcbSize)
IMoniker_Release(pmk);
- pcbSize->QuadPart = ptmpSize.QuadPart + sizeof(CLSID);
+ pcbSize->QuadPart += ptmpSize.QuadPart + sizeof(CLSID);
}
IEnumMoniker_Release(enumMk);
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c
index e04be638a6..8b88ae4a0d 100644
--- a/dlls/ole32/tests/moniker.c
+++ b/dlls/ole32/tests/moniker.c
@@ -1345,15 +1345,16 @@ static void test_moniker(
const BYTE *expected_moniker_marshal_data, unsigned int sizeof_expected_moniker_marshal_data,
const BYTE *expected_moniker_saved_data, unsigned int sizeof_expected_moniker_saved_data,
const BYTE *expected_moniker_comparison_data, unsigned int sizeof_expected_moniker_comparison_data,
- LPCWSTR expected_display_name)
+ int expected_max_size, LPCWSTR expected_display_name)
{
+ ULARGE_INTEGER max_size;
IStream * stream;
IROTData * rotdata;
HRESULT hr;
HGLOBAL hglobal;
LPBYTE moniker_data;
DWORD moniker_size;
- DWORD i;
+ DWORD i, moniker_type;
BOOL same;
BYTE buffer[128];
IMoniker * moniker_proxy;
@@ -1423,6 +1424,13 @@ static void test_moniker(
ok_ole_success(hr, CreateStreamOnHGlobal);
/* Saving */
+ moniker_type = 0;
+ IMoniker_IsSystemMoniker(moniker, &moniker_type);
+
+ hr = IMoniker_GetSizeMax(moniker, &max_size);
+ ok(hr == S_OK, "Failed to get max size, hr %#x.\n", hr);
+todo_wine_if(moniker_type == MKSYS_GENERICCOMPOSITE)
+ ok(expected_max_size == max_size.u.LowPart, "%s: unexpected max size %u.\n", testname, max_size.u.LowPart);
hr = IMoniker_Save(moniker, stream, TRUE);
ok_ole_success(hr, IMoniker_Save);
@@ -1541,7 +1549,7 @@ static void test_class_moniker(void)
expected_class_moniker_marshal_data, sizeof(expected_class_moniker_marshal_data),
expected_class_moniker_saved_data, sizeof(expected_class_moniker_saved_data),
expected_class_moniker_comparison_data, sizeof(expected_class_moniker_comparison_data),
- expected_class_moniker_display_name);
+ sizeof(expected_class_moniker_saved_data), expected_class_moniker_display_name);
/* Hashing */
@@ -1684,7 +1692,7 @@ static void test_item_moniker(void)
expected_item_moniker_marshal_data2, sizeof(expected_item_moniker_marshal_data2),
expected_item_moniker_saved_data2, sizeof(expected_item_moniker_saved_data2),
expected_item_moniker_comparison_data2, sizeof(expected_item_moniker_comparison_data2),
- L"Test");
+ 46, L"Test");
IMoniker_Release(moniker);
@@ -1695,7 +1703,7 @@ static void test_item_moniker(void)
expected_item_moniker_marshal_data3, sizeof(expected_item_moniker_marshal_data3),
expected_item_moniker_saved_data3, sizeof(expected_item_moniker_saved_data3),
expected_item_moniker_comparison_data2, sizeof(expected_item_moniker_comparison_data2),
- L"Test");
+ 50, L"Test");
IMoniker_Release(moniker);
@@ -1706,7 +1714,7 @@ static void test_item_moniker(void)
expected_item_moniker_marshal_data4, sizeof(expected_item_moniker_marshal_data4),
expected_item_moniker_saved_data4, sizeof(expected_item_moniker_saved_data4),
expected_item_moniker_comparison_data4, sizeof(expected_item_moniker_comparison_data4),
- L"&&Test");
+ 58, L"&&Test");
IMoniker_Release(moniker);
@@ -1717,7 +1725,7 @@ static void test_item_moniker(void)
expected_item_moniker_marshal_data5, sizeof(expected_item_moniker_marshal_data5),
expected_item_moniker_saved_data5, sizeof(expected_item_moniker_saved_data5),
expected_item_moniker_comparison_data5, sizeof(expected_item_moniker_comparison_data5),
- L"abTest");
+ 58, L"abTest");
IMoniker_Release(moniker);
@@ -1728,7 +1736,7 @@ static void test_item_moniker(void)
expected_item_moniker_marshal_data, sizeof(expected_item_moniker_marshal_data),
expected_item_moniker_saved_data, sizeof(expected_item_moniker_saved_data),
expected_item_moniker_comparison_data, sizeof(expected_item_moniker_comparison_data),
- expected_display_name);
+ 54, expected_display_name);
/* Hashing */
@@ -1793,7 +1801,7 @@ static void test_anti_moniker(void)
expected_anti_moniker_marshal_data, sizeof(expected_anti_moniker_marshal_data),
expected_anti_moniker_saved_data, sizeof(expected_anti_moniker_saved_data),
expected_anti_moniker_comparison_data, sizeof(expected_anti_moniker_comparison_data),
- expected_display_name);
+ 20, expected_display_name);
/* Hashing */
hr = IMoniker_Hash(moniker, &hash);
@@ -1863,7 +1871,7 @@ static void test_generic_composite_moniker(void)
expected_gc_moniker_marshal_data, sizeof(expected_gc_moniker_marshal_data),
expected_gc_moniker_saved_data, sizeof(expected_gc_moniker_saved_data),
expected_gc_moniker_comparison_data, sizeof(expected_gc_moniker_comparison_data),
- expected_display_name);
+ 160, expected_display_name);
/* Hashing */
--
2.24.0
Dec. 13, 2019
[PATCH 2/4] ole32: Properly handle NULL delimiter for item monikers.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/ole32/itemmoniker.c | 135 +++++++++++++++++-------------
dlls/ole32/tests/moniker.c | 165 ++++++++++++++++++++++++++++++++++---
2 files changed, 230 insertions(+), 70 deletions(-)
diff --git a/dlls/ole32/itemmoniker.c b/dlls/ole32/itemmoniker.c
index 3bf1201362..2d325ff50c 100644
--- a/dlls/ole32/itemmoniker.c
+++ b/dlls/ole32/itemmoniker.c
@@ -31,6 +31,7 @@
#include "winuser.h"
#include "winnls.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "ole2.h"
#include "moniker.h"
@@ -227,35 +228,44 @@ static HRESULT WINAPI ItemMonikerImpl_Load(IMoniker* iface,IStream* pStm)
/******************************************************************************
* ItemMoniker_Save
******************************************************************************/
-static HRESULT WINAPI ItemMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
+static HRESULT WINAPI ItemMonikerImpl_Save(IMoniker *iface, IStream *stream, BOOL fClearDirty)
{
ItemMonikerImpl *This = impl_from_IMoniker(iface);
- HRESULT res;
- CHAR *itemNameA,*itemDelimiterA;
+ int str_len;
+ HRESULT hr;
+ char *str;
+
+ TRACE("(%p, %p, %d)\n", iface, stream, fClearDirty);
/* data written by this function are : 1) DWORD : size of item delimiter string ('\0' included ) */
/* 2) String (type A): item delimiter string ('\0' included) */
/* 3) DWORD : size of item name string ('\0' included) */
/* 4) String (type A): item name string ('\0' included) */
+ if (This->itemDelimiter)
+ {
+ str_len = WideCharToMultiByte(CP_ACP, 0, This->itemDelimiter, -1, NULL, 0, NULL, NULL);
+ str = heap_alloc(str_len);
+ WideCharToMultiByte(CP_ACP, 0, This->itemDelimiter, -1, str, str_len, NULL, NULL);
- DWORD nameLength = WideCharToMultiByte( CP_ACP, 0, This->itemName, -1, NULL, 0, NULL, NULL);
- DWORD delimiterLength = WideCharToMultiByte( CP_ACP, 0, This->itemDelimiter, -1, NULL, 0, NULL, NULL);
- itemNameA=HeapAlloc(GetProcessHeap(),0,nameLength);
- itemDelimiterA=HeapAlloc(GetProcessHeap(),0,delimiterLength);
- WideCharToMultiByte( CP_ACP, 0, This->itemName, -1, itemNameA, nameLength, NULL, NULL);
- WideCharToMultiByte( CP_ACP, 0, This->itemDelimiter, -1, itemDelimiterA, delimiterLength, NULL, NULL);
-
- TRACE("%p, %s\n", pStm, fClearDirty ? "TRUE" : "FALSE");
+ hr = IStream_Write(stream, &str_len, sizeof(str_len), NULL);
+ hr = IStream_Write(stream, str, str_len, NULL);
- res=IStream_Write(pStm,&delimiterLength,sizeof(DWORD),NULL);
- res=IStream_Write(pStm,itemDelimiterA,delimiterLength * sizeof(CHAR),NULL);
- res=IStream_Write(pStm,&nameLength,sizeof(DWORD),NULL);
- res=IStream_Write(pStm,itemNameA,nameLength * sizeof(CHAR),NULL);
+ heap_free(str);
+ }
+ else
+ {
+ str_len = 0;
+ hr = IStream_Write(stream, &str_len, sizeof(str_len), NULL);
+ }
- HeapFree(GetProcessHeap(), 0, itemNameA);
- HeapFree(GetProcessHeap(), 0, itemDelimiterA);
+ str_len = WideCharToMultiByte(CP_ACP, 0, This->itemName, -1, NULL, 0, NULL, NULL);
+ str = heap_alloc(str_len);
+ WideCharToMultiByte(CP_ACP, 0, This->itemName, -1, str, str_len, NULL, NULL);
+ hr = IStream_Write(stream, &str_len, sizeof(str_len), NULL);
+ hr = IStream_Write(stream, str, str_len, NULL);
+ heap_free(str);
- return res;
+ return hr;
}
/******************************************************************************
@@ -264,7 +274,6 @@ static HRESULT WINAPI ItemMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL
static HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
{
ItemMonikerImpl *This = impl_from_IMoniker(iface);
- DWORD delimiterLength=lstrlenW(This->itemDelimiter)+1;
DWORD nameLength=lstrlenW(This->itemName)+1;
TRACE("(%p,%p)\n",iface,pcbSize);
@@ -275,10 +284,12 @@ static HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER
/* for more details see ItemMonikerImpl_Save comments */
pcbSize->u.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */
- delimiterLength*4 + /* item delimiter string */
sizeof(DWORD) + /* DWORD which contains item name length */
nameLength*4 + /* item name string */
18; /* strange, but true */
+ if (This->itemDelimiter)
+ pcbSize->u.LowPart += (lstrlenW(This->itemDelimiter) + 1) * 4;
+
pcbSize->u.HighPart=0;
return S_OK;
@@ -683,6 +694,7 @@ static HRESULT WINAPI ItemMonikerImpl_GetDisplayName(IMoniker* iface,
LPOLESTR *ppszDisplayName)
{
ItemMonikerImpl *This = impl_from_IMoniker(iface);
+ SIZE_T size;
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
@@ -693,12 +705,18 @@ static HRESULT WINAPI ItemMonikerImpl_GetDisplayName(IMoniker* iface,
return E_INVALIDARG;
}
- *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR)*(lstrlenW(This->itemDelimiter)+lstrlenW(This->itemName)+1));
+ size = lstrlenW(This->itemName) + 1;
+ if (This->itemDelimiter)
+ size += lstrlenW(This->itemDelimiter);
+ size *= sizeof(WCHAR);
+ *ppszDisplayName = CoTaskMemAlloc(size);
if (*ppszDisplayName==NULL)
return E_OUTOFMEMORY;
- lstrcpyW(*ppszDisplayName,This->itemDelimiter);
+ (*ppszDisplayName)[0] = 0;
+ if (This->itemDelimiter)
+ lstrcatW(*ppszDisplayName, This->itemDelimiter);
lstrcatW(*ppszDisplayName,This->itemName);
TRACE("-- %s\n", debugstr_w(*ppszDisplayName));
@@ -806,32 +824,34 @@ static ULONG WINAPI ItemMonikerROTDataImpl_Release(IROTData* iface)
/******************************************************************************
* ItemMonikerIROTData_GetComparisonData
******************************************************************************/
-static HRESULT WINAPI ItemMonikerROTDataImpl_GetComparisonData(IROTData* iface,
- BYTE* pbData,
- ULONG cbMax,
- ULONG* pcbData)
+static HRESULT WINAPI ItemMonikerROTDataImpl_GetComparisonData(IROTData *iface, BYTE *buffer, ULONG max_len,
+ ULONG *data_len)
{
ItemMonikerImpl *This = impl_from_IROTData(iface);
- int len = (lstrlenW(This->itemName)+1);
- int i;
- LPWSTR pszItemName;
- LPWSTR pszItemDelimiter;
+ int name_len = lstrlenW(This->itemName);
+ int delim_len, i;
+ WCHAR *ptrW;
- TRACE("(%p, %u, %p)\n", pbData, cbMax, pcbData);
+ TRACE("(%p, %p, %u, %p)\n", iface, buffer, max_len, data_len);
- *pcbData = sizeof(CLSID) + sizeof(WCHAR) + len * sizeof(WCHAR);
- if (cbMax < *pcbData)
+ delim_len = This->itemDelimiter && This->itemDelimiter[0] ? lstrlenW(This->itemDelimiter) : 0;
+ *data_len = sizeof(CLSID) + sizeof(WCHAR) + (delim_len + name_len) * sizeof(WCHAR);
+ if (max_len < *data_len)
return E_OUTOFMEMORY;
/* write CLSID */
- memcpy(pbData, &CLSID_ItemMoniker, sizeof(CLSID));
+ memcpy(buffer, &CLSID_ItemMoniker, sizeof(CLSID));
+ buffer += sizeof(CLSID);
+
/* write delimiter */
- pszItemDelimiter = (LPWSTR)(pbData+sizeof(CLSID));
- *pszItemDelimiter = *This->itemDelimiter;
+ for (i = 0, ptrW = (WCHAR *)buffer; i < delim_len; ++i)
+ ptrW[i] = towupper(This->itemDelimiter[i]);
+ buffer += (delim_len * sizeof(WCHAR));
+
/* write name */
- pszItemName = pszItemDelimiter + 1;
- for (i = 0; i < len; i++)
- pszItemName[i] = towupper(This->itemName[i]);
+ for (i = 0, ptrW = (WCHAR *)buffer; i < name_len; ++i)
+ ptrW[i] = towupper(This->itemName[i]);
+ ptrW[i] = 0;
return S_OK;
}
@@ -879,38 +899,37 @@ static const IROTDataVtbl VT_ROTDataImpl =
/******************************************************************************
* ItemMoniker_Construct (local function)
*******************************************************************************/
-static HRESULT ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDelim,LPCOLESTR lpszItem)
+static HRESULT ItemMonikerImpl_Construct(ItemMonikerImpl* This, const WCHAR *delimiter, const WCHAR *name)
{
+ int str_len;
- int sizeStr1=lstrlenW(lpszItem), sizeStr2;
- static const OLECHAR emptystr[1];
- LPCOLESTR delim;
-
- TRACE("(%p,%s,%s)\n",This,debugstr_w(lpszDelim),debugstr_w(lpszItem));
+ TRACE("(%p, %s, %s)\n", This, debugstr_w(delimiter), debugstr_w(name));
/* Initialize the virtual function table. */
This->IMoniker_iface.lpVtbl = &VT_ItemMonikerImpl;
This->IROTData_iface.lpVtbl = &VT_ROTDataImpl;
This->ref = 0;
This->pMarshal = NULL;
+ This->itemDelimiter = NULL;
- This->itemName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr1+1));
+ str_len = (lstrlenW(name) + 1) * sizeof(WCHAR);
+ This->itemName = heap_alloc(str_len);
if (!This->itemName)
return E_OUTOFMEMORY;
- lstrcpyW(This->itemName,lpszItem);
-
- if (!lpszDelim)
- FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n");
+ memcpy(This->itemName, name, str_len);
- delim = lpszDelim ? lpszDelim : emptystr;
-
- sizeStr2=lstrlenW(delim);
- This->itemDelimiter=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr2+1));
- if (!This->itemDelimiter) {
- HeapFree(GetProcessHeap(),0,This->itemName);
- return E_OUTOFMEMORY;
+ if (delimiter)
+ {
+ str_len = (lstrlenW(delimiter) + 1) * sizeof(WCHAR);
+ This->itemDelimiter = heap_alloc(str_len);
+ if (!This->itemDelimiter)
+ {
+ heap_free(This->itemName);
+ return E_OUTOFMEMORY;
+ }
+ memcpy(This->itemDelimiter, delimiter, str_len);
}
- lstrcpyW(This->itemDelimiter,delim);
+
return S_OK;
}
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c
index cbffad4dfa..e04be638a6 100644
--- a/dlls/ole32/tests/moniker.c
+++ b/dlls/ole32/tests/moniker.c
@@ -1147,14 +1147,62 @@ static const BYTE expected_item_moniker_comparison_data[] =
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
- 0x21,0x00,0x54,0x00,0x45,0x00,0x53,0x00,
- 0x54,0x00,0x00,0x00,
+ '!',0x00, 'T',0x00, 'E',0x00, 'S',0x00,
+ 'T',0x00,0x00,0x00,
+};
+
+static const BYTE expected_item_moniker_comparison_data2[] =
+{
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 'T',0x00, 'E',0x00, 'S',0x00, 'T',0x00,
+ 0x00,0x00,
+};
+
+static const BYTE expected_item_moniker_comparison_data4[] =
+{
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ '&',0x00, '&',0x00, 'T',0x00, 'E',0x00,
+ 'S',0x00, 'T',0x00,0x00,0x00,
+};
+
+static const BYTE expected_item_moniker_comparison_data5[] =
+{
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 'A',0x00, 'B',0x00, 'T',0x00, 'E',0x00,
+ 'S',0x00, 'T',0x00,0x00,0x00,
};
static const BYTE expected_item_moniker_saved_data[] =
{
- 0x02,0x00,0x00,0x00,0x21,0x00,0x05,0x00,
- 0x00,0x00,0x54,0x65,0x73,0x74,0x00,
+ 0x02,0x00,0x00,0x00, '!',0x00,0x05,0x00,
+ 0x00,0x00, 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_saved_data2[] =
+{
+ 0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
+ 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_saved_data3[] =
+{
+ 0x01,0x00,0x00,0x00,0x00,0x05,0x00,0x00,
+ 0x00,'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_saved_data4[] =
+{
+ 0x03,0x00,0x00,0x00, '&', '&',0x00,0x05,
+ 0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_saved_data5[] =
+{
+ 0x03,0x00,0x00,0x00, 'a', 'b',0x00,0x05,
+ 0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
};
static const BYTE expected_item_moniker_marshal_data[] =
@@ -1165,8 +1213,56 @@ static const BYTE expected_item_moniker_marshal_data[] =
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x21,0x00,0x05,0x00,
- 0x00,0x00,0x54,0x65,0x73,0x74,0x00,
+ 0x02,0x00,0x00,0x00, '!',0x00,0x05,0x00,
+ 0x00,0x00, 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_marshal_data2[] =
+{
+ 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
+ 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
+ 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_marshal_data3[] =
+{
+ 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
+ 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x00,0x05,0x00,0x00,
+ 0x00, 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_marshal_data4[] =
+{
+ 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
+ 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x00,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00, '&', '&',0x00,0x05,
+ 0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
+};
+
+static const BYTE expected_item_moniker_marshal_data5[] =
+{
+ 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
+ 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
+ 0x00,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00, 'a', 'b',0x00,0x05,
+ 0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
};
static const BYTE expected_anti_moniker_marshal_data[] =
@@ -1237,11 +1333,11 @@ static const BYTE expected_gc_moniker_comparison_data[] =
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
- 0x21,0x00,0x54,0x00,0x45,0x00,0x53,0x00,
- 0x54,0x00,0x00,0x00,0x04,0x03,0x00,0x00,
+ '!',0x00, 'T',0x00, 'E',0x00, 'S',0x00,
+ 'T',0x00,0x00,0x00,0x04,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x46,0x23,0x00,0x57,0x00,
- 0x49,0x00,0x4e,0x00,0x45,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x46, '#',0x00, 'W',0x00,
+ 'I',0x00, 'N',0x00, 'E',0x00,0x00,0x00,
};
static void test_moniker(
@@ -1274,7 +1370,8 @@ static void test_moniker(
hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name);
ok_ole_success(hr, IMoniker_GetDisplayName);
- ok(!lstrcmpW(display_name, expected_display_name), "%s: display name wasn't what was expected\n", testname);
+ ok(!lstrcmpW(display_name, expected_display_name), "%s: unexpected display name %s, %s.\n", testname,
+ wine_dbgstr_w(display_name), wine_dbgstr_w(expected_display_name));
CoTaskMemFree(display_name);
IBindCtx_Release(bindctx);
@@ -1580,10 +1677,54 @@ static void test_item_moniker(void)
static const WCHAR wszObjectName[] = {'T','e','s','t',0};
static const WCHAR expected_display_name[] = { '!','T','e','s','t',0 };
+ hr = CreateItemMoniker(NULL, wszObjectName, &moniker);
+ ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+
+ test_moniker("item moniker 2", moniker,
+ expected_item_moniker_marshal_data2, sizeof(expected_item_moniker_marshal_data2),
+ expected_item_moniker_saved_data2, sizeof(expected_item_moniker_saved_data2),
+ expected_item_moniker_comparison_data2, sizeof(expected_item_moniker_comparison_data2),
+ L"Test");
+
+ IMoniker_Release(moniker);
+
+ hr = CreateItemMoniker(L"", wszObjectName, &moniker);
+ ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+
+ test_moniker("item moniker 3", moniker,
+ expected_item_moniker_marshal_data3, sizeof(expected_item_moniker_marshal_data3),
+ expected_item_moniker_saved_data3, sizeof(expected_item_moniker_saved_data3),
+ expected_item_moniker_comparison_data2, sizeof(expected_item_moniker_comparison_data2),
+ L"Test");
+
+ IMoniker_Release(moniker);
+
+ hr = CreateItemMoniker(L"&&", wszObjectName, &moniker);
+ ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+
+ test_moniker("item moniker 4", moniker,
+ expected_item_moniker_marshal_data4, sizeof(expected_item_moniker_marshal_data4),
+ expected_item_moniker_saved_data4, sizeof(expected_item_moniker_saved_data4),
+ expected_item_moniker_comparison_data4, sizeof(expected_item_moniker_comparison_data4),
+ L"&&Test");
+
+ IMoniker_Release(moniker);
+
+ hr = CreateItemMoniker(L"ab", wszObjectName, &moniker);
+ ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+
+ test_moniker("item moniker 5", moniker,
+ expected_item_moniker_marshal_data5, sizeof(expected_item_moniker_marshal_data5),
+ expected_item_moniker_saved_data5, sizeof(expected_item_moniker_saved_data5),
+ expected_item_moniker_comparison_data5, sizeof(expected_item_moniker_comparison_data5),
+ L"abTest");
+
+ IMoniker_Release(moniker);
+
hr = CreateItemMoniker(wszDelimiter, wszObjectName, &moniker);
ok_ole_success(hr, CreateItemMoniker);
- test_moniker("item moniker", moniker,
+ test_moniker("item moniker 1", moniker,
expected_item_moniker_marshal_data, sizeof(expected_item_moniker_marshal_data),
expected_item_moniker_saved_data, sizeof(expected_item_moniker_saved_data),
expected_item_moniker_comparison_data, sizeof(expected_item_moniker_comparison_data),
--
2.24.0
Dec. 13, 2019
[PATCH 1/4] ole32: Use more appropriate type for codepage arguments.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/ole32/stg_prop.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index 84eaa2aac4..8421353155 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -130,7 +130,7 @@ static void PropertyStorage_DestroyDictionaries(PropertyStorage_impl *);
* string using PropertyStorage_StringCopy.
*/
static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop,
- const PROPVARIANT *propvar, LCID targetCP, LCID srcCP);
+ const PROPVARIANT *propvar, UINT targetCP, UINT srcCP);
/* Copies the string src, which is encoded using code page srcCP, and returns
* it in *dst, in the code page specified by targetCP. The returned string is
@@ -139,8 +139,8 @@ static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop,
* is CP_UNICODE, the returned string is in fact an LPWSTR.
* Returns S_OK on success, something else on failure.
*/
-static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst,
- LCID targetCP);
+static HRESULT PropertyStorage_StringCopy(LPCSTR src, UINT srcCP, LPSTR *dst,
+ UINT targetCP);
static const IPropertyStorageVtbl IPropertyStorage_Vtbl;
@@ -533,8 +533,7 @@ static HRESULT WINAPI IPropertyStorage_fnReadMultiple(
return hr;
}
-static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst,
- LCID dstCP)
+static HRESULT PropertyStorage_StringCopy(LPCSTR src, UINT srcCP, LPSTR *dst, UINT dstCP)
{
HRESULT hr = S_OK;
int len;
@@ -617,8 +616,8 @@ static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst,
return hr;
}
-static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop,
- const PROPVARIANT *propvar, LCID targetCP, LCID srcCP)
+static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop, const PROPVARIANT *propvar,
+ UINT targetCP, UINT srcCP)
{
HRESULT hr = S_OK;
@@ -644,7 +643,7 @@ static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop,
* a version 1-only property.
*/
static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This,
- PROPID propid, const PROPVARIANT *propvar, LCID lcid)
+ PROPID propid, const PROPVARIANT *propvar, UINT cp)
{
HRESULT hr = S_OK;
PROPVARIANT *prop = PropertyStorage_FindProperty(This, propid);
@@ -665,8 +664,7 @@ static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This,
if (prop)
{
PropVariantClear(prop);
- hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
- lcid);
+ hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage, cp);
}
else
{
@@ -674,8 +672,7 @@ static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This,
sizeof(PROPVARIANT));
if (prop)
{
- hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage,
- lcid);
+ hr = PropertyStorage_PropVariantCopy(prop, propvar, This->codePage, cp);
if (SUCCEEDED(hr))
{
dictionary_insert(This->propid_to_prop, UlongToPtr(propid), prop);
@@ -699,7 +696,7 @@ static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This,
* Doesn't validate id.
*/
static HRESULT PropertyStorage_StoreNameWithId(PropertyStorage_impl *This,
- LPCSTR srcName, LCID cp, PROPID id)
+ LPCSTR srcName, UINT cp, PROPID id)
{
LPSTR name;
HRESULT hr;
--
2.24.0
Dec. 13, 2019
Re: [PATCH 5/7] ddraw/tests: Avoid reference leaks in render-target tests.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62120
Your paranoid android.
=== w8 (32 bit report) ===
ddraw:
0cfc:ddraw2: unhandled exception c0000005 at 69DF3599
=== w8 (32 bit report) ===
ddraw:
ddraw4.c:3500: Test failed: Got unexpected hr 0x887601c2.
Dec. 13, 2019
Re: [PATCH 4/7] ddraw/tests: Use flags to indicate broken render-target tests.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62119
Your paranoid android.
=== w1064v1507 (32 bit report) ===
ddraw:
0c9c:ddraw2: unhandled exception c0000005 at 730B7F2E
=== w1064v1809 (32 bit report) ===
ddraw:
ddraw4.c:15936: Test failed: WM_KILLFOCUS was not received.
ddraw4.c:16113: Test failed: Got unexpected hr 0x887600e1.
ddraw4.c:16116: Test failed: Got unexpected hr 0x887600ff.
1984:ddraw4: unhandled exception c0000005 at 00489FAF
=== w864 (64 bit report) ===
ddraw:
ddraw7.c:3135: Test failed: Failed to create surface, hr 0x887601c2.
0c20:ddraw7: unhandled exception c0000005 at 00000000004EC418
Dec. 13, 2019
[PATCH] wine.inf: add powershell location to the path (resend)
by Louis Lenders
(now with signed-off header)
On win7 the location of powershell is present in the path (could not check on other versions)
Signed-off-by: Louis Lenders <xerox.xerox2000x(a)gmail.com>
---
loader/wine.inf.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index d324461c6e..d62fd5065b 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -624,7 +624,7 @@ HKLM,%Control%\Session Manager,HeapDeCommitTotalFreeThreshold,0x00040002,0
HKLM,%Control%\Session Manager,HeapSegmentCommit,0x00040002,0
HKLM,%Control%\Session Manager,HeapSegmentReserve,0x00040002,0
HKLM,%Control%\Session Manager\Environment,"ComSpec",0x00020000,"%11%\cmd.exe"
-HKLM,%Control%\Session Manager\Environment,"PATH",0x00020002,"%11%;%10%;%11%\wbem"
+HKLM,%Control%\Session Manager\Environment,"PATH",0x00020002,"%11%;%10%;%11%\wbem;%11%\WindowsPowershell\v1.0"
HKLM,%Control%\Session Manager\Environment,"PATHEXT",,".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH"
HKLM,%Control%\Session Manager\Environment,"SystemDrive",2,"c:"
HKLM,%Control%\Session Manager\Environment,"SYSTEMROOT",,"%10%"
--
2.24.0
Dec. 13, 2019
Re: [PATCH 3/7] ddraw/tests: Pass in device to check for in render-target testing.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62118
Your paranoid android.
=== w864 (64 bit report) ===
ddraw:
ddraw1.c:3178: Test failed: Failed to create surface, hr 0x887601c2.
0c50:ddraw1: unhandled exception c0000005 at 000000000043A15A
Dec. 13, 2019
Re: [PATCH 2/7] ddraw/tests: Pass in device to create with create_device.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62117
Your paranoid android.
=== w2008s64 (32 bit report) ===
ddraw:
ddraw1.c:2827: Test failed: Expected message 0x46, but didn't receive it.
ddraw1.c:2830: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768).
ddraw1.c:2834: Test failed: Got unexpected screen size 1024x768.
=== w8 (32 bit report) ===
ddraw:
ddraw2.c:3262: Test failed: Got unexpected hr 0x887601c2.
=== w864 (64 bit report) ===
ddraw:
ddraw2.c:3244: Test failed: Failed to create surface, hr 0x887601c2.
0e8c:ddraw2: unhandled exception c0000005 at 000000000046E7CA
Dec. 13, 2019
[PATCH v3 3/3] msado15: Prevent Multiple Open/Close of a _Recordset.
by Alistair Leslie-Hughes
Currently closing twice or Close/Release would cause a crash.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 15 +++++++++++----
dlls/msado15/tests/msado15.c | 3 +++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 9bf6b60df1..0dc8a496c0 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -664,9 +664,12 @@ static void close_recordset( struct recordset *recordset )
{
ULONG row, col, col_count = get_column_count( recordset );
- recordset->fields->recordset = NULL;
- Fields_Release( &recordset->fields->Fields_iface );
- recordset->fields = NULL;
+ if (recordset->fields)
+ {
+ recordset->fields->recordset = NULL;
+ Fields_Release( &recordset->fields->Fields_iface );
+ recordset->fields = NULL;
+ }
for (row = 0; row < recordset->count; row++)
for (col = 0; col < col_count; col++) VariantClear( &recordset->data[row * col_count + col] );
@@ -674,6 +677,7 @@ static void close_recordset( struct recordset *recordset )
recordset->count = recordset->allocated = recordset->index = 0;
heap_free( recordset->data );
recordset->data = NULL;
+ recordset->state = adStateClosed;
}
static ULONG WINAPI recordset_Release( _Recordset *iface )
@@ -916,8 +920,9 @@ static HRESULT WINAPI recordset_Close( _Recordset *iface )
TRACE( "%p\n", recordset );
+ if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
+
close_recordset( recordset );
- recordset->state = adStateClosed;
return S_OK;
}
@@ -971,6 +976,8 @@ static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT
FIXME( "%p, %s, %s, %d, %d, %d\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection),
cursor_type, lock_type, options );
+ if (recordset->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
+
recordset->state = adStateOpen;
return S_OK;
}
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 1fae811d10..b80600a676 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -96,6 +96,9 @@ static void test_Recordset(void)
ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
ISupportErrorInfo_Release(errorinfo);
+ hr = _Recordset_Close( recordset );
+ ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
+
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH v3 2/3] msado15: Add ISupportErrorInfo support to _Recordset.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 61 +++++++++++++++++++++++++++++++-----
dlls/msado15/tests/msado15.c | 5 +++
2 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 4b61b552f0..9bf6b60df1 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -34,14 +34,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct fields;
struct recordset
{
- _Recordset Recordset_iface;
- LONG refs;
- LONG state;
- struct fields *fields;
- LONG count;
- LONG allocated;
- LONG index;
- VARIANT *data;
+ _Recordset Recordset_iface;
+ ISupportErrorInfo ISupportErrorInfo_iface;
+ LONG refs;
+ LONG state;
+ struct fields *fields;
+ LONG count;
+ LONG allocated;
+ LONG index;
+ VARIANT *data;
};
struct fields
@@ -646,6 +647,11 @@ static inline struct recordset *impl_from_Recordset( _Recordset *iface )
return CONTAINING_RECORD( iface, struct recordset, Recordset_iface );
}
+static inline struct recordset *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
+{
+ return CONTAINING_RECORD( iface, struct recordset, ISupportErrorInfo_iface );
+}
+
static ULONG WINAPI recordset_AddRef( _Recordset *iface )
{
struct recordset *recordset = impl_from_Recordset( iface );
@@ -686,6 +692,7 @@ static ULONG WINAPI recordset_Release( _Recordset *iface )
static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, void **obj )
{
+ struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
if (IsEqualIID(riid, &IID_IUnknown) ||
@@ -698,6 +705,10 @@ static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid,
{
*obj = iface;
}
+ else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
+ {
+ *obj = &recordset->ISupportErrorInfo_iface;
+ }
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
@@ -1235,6 +1246,39 @@ static HRESULT WINAPI recordset_Save( _Recordset *iface, VARIANT destination, Pe
return E_NOTIMPL;
}
+static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_QueryInterface( &recordset->Recordset_iface, riid, obj );
+}
+
+static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_AddRef( &recordset->Recordset_iface );
+}
+
+static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_Release( &recordset->Recordset_iface );
+}
+
+static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ FIXME( "%p, %s\n", recordset, debugstr_guid(riid) );
+ return S_FALSE;
+}
+
+static const struct ISupportErrorInfoVtbl support_error_vtbl =
+{
+ supporterror_QueryInterface,
+ supporterror_AddRef,
+ supporterror_Release,
+ supporterror_InterfaceSupportsErrorInfo
+};
+
static const struct _RecordsetVtbl recordset_vtbl =
{
recordset_QueryInterface,
@@ -1330,6 +1374,7 @@ HRESULT Recordset_create( void **obj )
if (!(recordset = heap_alloc_zero( sizeof(*recordset) ))) return E_OUTOFMEMORY;
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
+ recordset->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl;
recordset->refs = 1;
recordset->index = -1;
recordset->state = adStateClosed;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index d6bb50f44e..1fae811d10 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -46,6 +46,7 @@ static LONG get_refs_recordset( _Recordset *recordset )
static void test_Recordset(void)
{
_Recordset *recordset;
+ ISupportErrorInfo *errorinfo;
Fields *fields, *fields2;
LONG refs, count, state;
HRESULT hr;
@@ -91,6 +92,10 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
+ hr = _Recordset_QueryInterface(recordset, &IID_ISupportErrorInfo, (void**)&errorinfo);
+ ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
+ ISupportErrorInfo_Release(errorinfo);
+
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH v3 1/3] msado15: Implement _Recordset get_State
by Alistair Leslie-Hughes
Please Ignore the last patchset, the _Open wasn't meant to be sent.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 7 +++++--
dlls/msado15/tests/msado15.c | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index e854b3e824..4b61b552f0 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -1050,8 +1050,10 @@ static HRESULT WINAPI recordset_get_Status( _Recordset *iface, LONG *status )
static HRESULT WINAPI recordset_get_State( _Recordset *iface, LONG *state )
{
- FIXME( "%p, %p\n", iface, state );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+ TRACE( "%p, %p\n", recordset, state );
+ *state = recordset->state;
+ return S_OK;
}
static HRESULT WINAPI recordset__xClone( _Recordset *iface, _Recordset **obj )
@@ -1330,6 +1332,7 @@ HRESULT Recordset_create( void **obj )
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
recordset->refs = 1;
recordset->index = -1;
+ recordset->state = adStateClosed;
*obj = &recordset->Recordset_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index f9a5377c50..d6bb50f44e 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -47,12 +47,17 @@ static void test_Recordset(void)
{
_Recordset *recordset;
Fields *fields, *fields2;
- LONG refs, count;
+ LONG refs, count, state;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
+ state = -1;
+ hr = _Recordset_get_State( recordset, &state );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == adStateClosed, "got %d\n", state );
+
/* handing out fields object increases recordset refcount */
refs = get_refs_recordset( recordset );
ok( refs == 1, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH 7/7] ddraw: Add Ramp device as possible return from surface QI.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/surface.c | 3 ++-
dlls/ddraw/tests/ddraw1.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index fda42f2982..0fe5a7c48c 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -216,7 +216,8 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
{
if (IsEqualGUID(riid, &IID_D3DDEVICE_WineD3D)
|| IsEqualGUID(riid, &IID_IDirect3DHALDevice)
- || IsEqualGUID(riid, &IID_IDirect3DRGBDevice))
+ || IsEqualGUID(riid, &IID_IDirect3DRGBDevice)
+ || (IsEqualGUID(riid, &IID_IDirect3DRampDevice) && This->version < 3))
{
wined3d_mutex_lock();
if (!This->device1)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index fbf6e4d9d9..3b148a96e7 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -4149,6 +4149,7 @@ static void test_rt_caps(void)
{
test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE);
test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE);
+ test_rt_caps_riid(&IID_IDirect3DRampDevice, "Ramp", FALSE);
}
static void test_primary_caps(void)
--
2.23.0
Dec. 13, 2019
[PATCH 6/7] ddraw/tests: Consider multiple devices in render-target tests.
by Jeff Smith
Adds testing of devices besides HAL and TnLHal to render-target tests.
Depending on the version of ddraw, this may include RGB, Ramp, or MMX.
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 31 ++++++++++++++++++-------
dlls/ddraw/tests/ddraw2.c | 45 ++++++++++++++++++++++++++----------
dlls/ddraw/tests/ddraw4.c | 48 +++++++++++++++++++++++++++------------
dlls/ddraw/tests/ddraw7.c | 48 ++++++++++++++++++++++++++++-----------
4 files changed, 125 insertions(+), 47 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 8407290259..fbf6e4d9d9 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3884,7 +3884,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -3918,18 +3918,21 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
+ TRUE
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -3948,18 +3951,21 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
+ TRUE
},
{
NULL,
DDSCAPS_3DDEVICE,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
0,
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -3978,6 +3984,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
0,
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
+ TRUE
},
{
&p8_fmt,
@@ -3991,6 +3998,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&p8_fmt,
@@ -4064,6 +4072,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
IDirectDrawSurface *surface;
DDSURFACEDESC surface_desc;
IDirect3DDevice *device;
+ HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
@@ -4096,19 +4105,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr;
+ if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ expected_hr = D3D_OK;
hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
- ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].create_device_hr);
+ todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
if (hr == DDERR_NOPALETTEATTACHED)
{
+ expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT :
+ is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK;
hr = IDirectDrawSurface_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
refcount = IDirectDrawPalette_AddRef(palette) - 1;
hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ todo_wine_if(!is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
/* If QueryInterface is successful, it adds multiple references to palette,
* none of which are released by IDirect3DDevice_Release. */
while (IDirectDrawPalette_Release(palette) > refcount) ;
@@ -4133,7 +4147,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
static void test_rt_caps(void)
{
- test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE);
+ test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE);
}
static void test_primary_caps(void)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 0fc8e1859e..28f0c5f994 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4303,7 +4303,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -4340,6 +4340,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -4347,6 +4348,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -4354,6 +4356,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -4375,6 +4378,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -4382,6 +4386,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -4389,6 +4394,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -4410,13 +4416,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
FALSE, TRUE /* AMD r200 */
},
{
@@ -4425,13 +4432,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
},
{
&p8_fmt,
@@ -4511,6 +4519,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
IDirectDrawSurface *surface, *rt, *expected_rt, *tmp;
DDSURFACEDESC surface_desc;
IDirect3DDevice2 *device;
+ HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
@@ -4543,19 +4552,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr;
+ if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ expected_hr = D3D_OK;
hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].create_device_hr);
+ todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
if (hr == DDERR_NOPALETTEATTACHED)
{
+ expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT :
+ is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK;
hr = IDirectDrawSurface_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
refcount = IDirectDrawPalette_AddRef(palette);
hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ todo_wine_if(!is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
/* If CreateDevice is successful, it adds multiple references to palette,
* only one of which is released by IDirect3DDevice2_Release. */
if (FAILED(hr)) refcount--;
@@ -4598,9 +4612,13 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr;
+ if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal)
+ expected_hr = DDERR_INVALIDCAPS;
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].set_rt_hr);
+ todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -4640,7 +4658,10 @@ done:
static void test_rt_caps(void)
{
- test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE);
+ test_rt_caps_riid(&IID_IDirect3DMMXDevice, "MMX", FALSE);
+ test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE);
+ test_rt_caps_riid(&IID_IDirect3DRampDevice, "Ramp", FALSE);
}
static void test_primary_caps(void)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 2df735abea..3c1e96dbb4 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -5921,7 +5921,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -5958,6 +5958,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -5965,6 +5966,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -5972,6 +5974,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -5993,6 +5996,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -6000,6 +6004,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -6007,6 +6012,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -6028,13 +6034,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
FALSE, TRUE /* AMD r200 */
},
{
@@ -6043,13 +6050,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
},
{
&p8_fmt,
@@ -6064,7 +6072,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- FALSE, FALSE, TRUE
+ TRUE, FALSE, TRUE
},
{
&z_fmt,
@@ -6072,7 +6080,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- FALSE, FALSE, TRUE
+ FALSE, TRUE, TRUE
},
{
&z_fmt,
@@ -6080,6 +6088,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&z_fmt,
@@ -6128,6 +6137,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
IDirectDrawSurface4 *surface, *rt, *expected_rt, *tmp;
DDSURFACEDESC2 surface_desc;
IDirect3DDevice3 *device;
+ HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
@@ -6155,19 +6165,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr;
+ if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ expected_hr = D3D_OK;
hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
- ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].create_device_hr);
+ todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
if (hr == DDERR_NOPALETTEATTACHED)
{
+ expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT :
+ is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK;
hr = IDirectDrawSurface4_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
refcount = IDirectDrawPalette_AddRef(palette);
hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ todo_wine_if(!is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
/* If CreateDevice is successful, it adds multiple references to palette,
* only one of which is released by IDirect3DDevice3_Release. */
if (FAILED(hr)) refcount--;
@@ -6205,11 +6220,15 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr;
+ if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal)
+ expected_hr = DDERR_INVALIDCAPS;
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(
+ todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED)
+ ok(hr == expected_hr || broken(
test_data[i].broken_set_target_ok && hr == D3D_OK),
"Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].set_rt_hr);
+ device_name, i, hr, expected_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -6241,7 +6260,8 @@ done:
static void test_rt_caps(void)
{
- test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE);
+ test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE);
}
static void test_primary_caps(void)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 7a073296ca..6aed30bfe6 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5657,7 +5657,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -5696,6 +5696,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -5703,6 +5704,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -5710,6 +5712,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -5732,6 +5735,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ TRUE
},
{
NULL,
@@ -5739,6 +5743,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
+ FALSE, TRUE
},
{
NULL,
@@ -5746,6 +5751,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
NULL,
@@ -5768,13 +5774,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
FALSE, TRUE /* AMD r200 */
},
{
@@ -5783,13 +5790,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
- DDERR_INVALIDCAPS,
+ DDERR_NOPALETTEATTACHED,
},
{
&p8_fmt,
@@ -5804,6 +5812,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
+ TRUE
},
{
&z_fmt,
@@ -5811,6 +5820,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
+ FALSE, TRUE
},
{
&z_fmt,
@@ -5818,6 +5828,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
+ FALSE, TRUE
},
{
&z_fmt,
@@ -5875,6 +5886,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
IDirectDrawSurface7 *surface, *rt, *expected_rt, *tmp;
DDSURFACEDESC2 surface_desc;
IDirect3DDevice7 *device;
+ HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
@@ -5902,18 +5914,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr;
+ if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ expected_hr = D3D_OK;
hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].create_device_hr);
+ todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
if (hr == DDERR_NOPALETTEATTACHED)
{
+ expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT :
+ is_hal ? D3DERR_SURFACENOTINVIDMEM : E_FAIL;
hr = IDirectDrawSurface7_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ todo_wine_if(!is_hal)
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, expected_hr);
}
if (FAILED(hr))
{
@@ -5947,12 +5964,16 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr;
+ if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal)
+ expected_hr = DDERR_INVALIDCAPS;
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(
+ todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED)
+ ok(hr == expected_hr || broken(
(test_data[i].broken_set_target_ok && hr == D3D_OK) ||
(test_data[i].broken_set_target_ivpf && hr == DDERR_INVALIDPIXELFORMAT)),
"Test %s %u: Got unexpected hr %#x, expected %#x.\n",
- device_name, i, hr, test_data[i].set_rt_hr);
+ device_name, i, hr, expected_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -5984,8 +6005,9 @@ done:
static void test_rt_caps(void)
{
- test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal");
- test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+ test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal", TRUE);
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE);
+ test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE);
}
static void test_primary_caps(void)
--
2.23.0
Dec. 13, 2019
[PATCH 5/7] ddraw/tests: Avoid reference leaks in render-target tests.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 7 ++++++-
dlls/ddraw/tests/ddraw2.c | 28 +++++++++++++++++-----------
dlls/ddraw/tests/ddraw4.c | 28 +++++++++++++++++-----------
dlls/ddraw/tests/ddraw7.c | 23 ++++++++++++-----------
4 files changed, 52 insertions(+), 34 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 66b84edf45..8407290259 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -4103,11 +4103,15 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ refcount = IDirectDrawPalette_AddRef(palette) - 1;
hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
else
ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ /* If QueryInterface is successful, it adds multiple references to palette,
+ * none of which are released by IDirect3DDevice_Release. */
+ while (IDirectDrawPalette_Release(palette) > refcount) ;
}
if (SUCCEEDED(hr))
{
@@ -4120,7 +4124,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount);
refcount = IDirectDraw_Release(ddraw);
ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount);
DestroyWindow(window);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 2bd56b7afd..0fc8e1859e 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4546,18 +4546,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].create_device_hr);
+ if (hr == DDERR_NOPALETTEATTACHED)
+ {
+ hr = IDirectDrawSurface_SetPalette(surface, palette);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ refcount = IDirectDrawPalette_AddRef(palette);
+ hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ else
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ /* If CreateDevice is successful, it adds multiple references to palette,
+ * only one of which is released by IDirect3DDevice2_Release. */
+ if (FAILED(hr)) refcount--;
+ while (IDirectDrawPalette_Release(palette) > refcount) ;
+ }
if (FAILED(hr))
{
- if (hr == DDERR_NOPALETTEATTACHED)
- {
- hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- }
IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -4623,7 +4628,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount);
IDirect3D2_Release(d3d);
done:
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 0ab8c74dab..2df735abea 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -6158,18 +6158,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].create_device_hr);
+ if (hr == DDERR_NOPALETTEATTACHED)
+ {
+ hr = IDirectDrawSurface4_SetPalette(surface, palette);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ refcount = IDirectDrawPalette_AddRef(palette);
+ hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ else
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ /* If CreateDevice is successful, it adds multiple references to palette,
+ * only one of which is released by IDirect3DDevice3_Release. */
+ if (FAILED(hr)) refcount--;
+ while (IDirectDrawPalette_Release(palette) > refcount) ;
+ }
if (FAILED(hr))
{
- if (hr == DDERR_NOPALETTEATTACHED)
- {
- hr = IDirectDrawSurface4_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- }
IDirectDrawSurface4_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6224,7 +6229,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount);
IDirect3D3_Release(d3d);
done:
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index f2552ad491..7a073296ca 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5905,18 +5905,18 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].create_device_hr);
+ if (hr == DDERR_NOPALETTEATTACHED)
+ {
+ hr = IDirectDrawSurface7_SetPalette(surface, palette);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ else
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
+ }
if (FAILED(hr))
{
- if (hr == DDERR_NOPALETTEATTACHED)
- {
- hr = IDirectDrawSurface7_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
- }
IDirectDrawSurface7_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -5972,7 +5972,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount);
IDirect3D7_Release(d3d);
done:
--
2.23.0
Dec. 13, 2019
[PATCH 4/7] ddraw/tests: Use flags to indicate broken render-target tests.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 35 +++++++---------------
dlls/ddraw/tests/ddraw2.c | 63 +++++++++------------------------------
dlls/ddraw/tests/ddraw4.c | 41 ++++++++++---------------
dlls/ddraw/tests/ddraw7.c | 43 +++++++++++---------------
4 files changed, 59 insertions(+), 123 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 9b0ee8e553..66b84edf45 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3908,7 +3908,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DWORD caps_in;
DWORD caps_out;
HRESULT create_device_hr;
- BOOL create_may_fail;
+ BOOL broken_create_surface;
+ BOOL broken_surface_caps;
}
test_data[] =
{
@@ -3917,126 +3918,112 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
- FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
- FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
- FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
- FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
- FALSE,
},
{
NULL,
0,
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
- FALSE,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY,
DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
0,
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */ ,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
- FALSE,
+ FALSE, TRUE /* AMD r200 */
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
- FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- TRUE /* AMD Evergreen */,
+ TRUE
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
+ FALSE, TRUE
},
{
NULL,
DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
- FALSE,
+ FALSE, TRUE
},
{
NULL,
@@ -4095,7 +4082,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
+ ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface),
"Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
if (FAILED(hr))
@@ -4105,7 +4092,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps),
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 3c5485af96..2bd56b7afd 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4329,8 +4329,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DWORD caps_out;
HRESULT create_device_hr;
HRESULT set_rt_hr;
- HRESULT alternative_set_rt_hr;
- BOOL create_may_fail;
+ BOOL broken_create_surface;
+ BOOL broken_surface_caps;
}
test_data[] =
{
@@ -4340,8 +4340,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4349,8 +4347,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4358,8 +4354,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
@@ -4367,8 +4361,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4376,8 +4368,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
@@ -4385,8 +4375,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4394,8 +4382,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4403,8 +4389,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
@@ -4412,8 +4396,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
- D3D_OK,
- FALSE,
},
{
NULL,
@@ -4421,8 +4403,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
@@ -4430,17 +4410,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
+ FALSE, TRUE /* AMD r200 */
},
{
&p8_fmt,
@@ -4448,8 +4425,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
@@ -4457,8 +4432,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
&p8_fmt,
@@ -4466,8 +4439,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- FALSE,
},
{
NULL,
@@ -4475,26 +4446,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- DDERR_INVALIDCAPS,
- TRUE /* AMD Evergreen */,
+ TRUE
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- DDERR_INVALIDCAPS,
- FALSE,
+ FALSE, TRUE
},
{
NULL,
DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
- DDERR_INVALIDCAPS,
+ DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- FALSE,
+ FALSE, TRUE
},
{
NULL,
@@ -4502,8 +4470,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- DDERR_INVALIDPIXELFORMAT,
- TRUE /* Nvidia Kepler */,
+ TRUE /* Nvidia Kepler */
},
{
NULL,
@@ -4511,8 +4478,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
- TRUE /* Nvidia Kepler */,
+ TRUE /* Nvidia Kepler */
},
};
@@ -4563,7 +4529,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
+ ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface),
"Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
if (FAILED(hr))
@@ -4573,7 +4539,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps),
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -4628,8 +4594,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ ok(hr == test_data[i].set_rt_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index b4b2f15b34..0ab8c74dab 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -5945,7 +5945,10 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DWORD caps_in;
DWORD caps_out;
HRESULT create_device_hr;
- HRESULT set_rt_hr, alternative_set_rt_hr;
+ HRESULT set_rt_hr;
+ BOOL broken_create_surface;
+ BOOL broken_surface_caps;
+ BOOL broken_set_target_ok;
}
test_data[] =
{
@@ -5955,7 +5958,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5963,7 +5965,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5971,7 +5972,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -5979,7 +5979,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5987,7 +5986,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -5995,7 +5993,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -6003,7 +6000,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -6011,7 +6007,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -6019,7 +6014,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -6027,7 +6021,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -6035,15 +6028,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
+ FALSE, TRUE /* AMD r200 */
},
{
&p8_fmt,
@@ -6051,7 +6043,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -6059,7 +6050,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -6067,7 +6057,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&z_fmt,
@@ -6075,7 +6064,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- D3D_OK /* r200 */,
+ FALSE, FALSE, TRUE
},
{
&z_fmt,
@@ -6083,7 +6072,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- D3D_OK /* r200 */,
+ FALSE, FALSE, TRUE
},
{
&z_fmt,
@@ -6091,7 +6080,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&z_fmt,
@@ -6099,7 +6087,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- D3D_OK /* r200 */,
+ FALSE, FALSE, TRUE
},
{
&z_fmt,
@@ -6107,7 +6095,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
};
@@ -6154,14 +6141,17 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface),
+ "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps),
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -6211,7 +6201,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
+ ok(hr == test_data[i].set_rt_hr || broken(
+ test_data[i].broken_set_target_ok && hr == D3D_OK),
"Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 94618c0178..f2552ad491 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5682,7 +5682,11 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DWORD caps_in;
DWORD caps_out;
HRESULT create_device_hr;
- HRESULT set_rt_hr, alternative_set_rt_hr;
+ HRESULT set_rt_hr;
+ BOOL broken_create_surface;
+ BOOL broken_surface_caps;
+ BOOL broken_set_target_ok;
+ BOOL broken_set_target_ivpf;
}
test_data[] =
{
@@ -5692,7 +5696,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5700,7 +5703,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5708,7 +5710,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -5716,7 +5717,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
DDERR_INVALIDPARAMS,
- D3D_OK,
+ FALSE, FALSE, TRUE
},
{
NULL,
@@ -5724,7 +5725,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -5732,7 +5732,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5740,7 +5739,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
D3D_OK,
D3D_OK,
- D3D_OK,
},
{
NULL,
@@ -5748,7 +5746,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
NULL,
@@ -5756,7 +5753,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
D3DERR_SURFACENOTINVIDMEM,
DDERR_INVALIDPARAMS,
- D3D_OK,
+ FALSE, FALSE, TRUE
},
{
NULL,
@@ -5764,7 +5761,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -5772,15 +5768,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
+ FALSE, TRUE /* AMD r200 */
},
{
&p8_fmt,
@@ -5788,7 +5783,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -5796,7 +5790,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&p8_fmt,
@@ -5804,7 +5797,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&z_fmt,
@@ -5812,7 +5804,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- DDERR_INVALIDPIXELFORMAT,
},
{
&z_fmt,
@@ -5820,7 +5811,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
- DDERR_INVALIDPIXELFORMAT,
},
{
&z_fmt,
@@ -5828,7 +5818,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
{
&z_fmt,
@@ -5836,7 +5825,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDPARAMS,
- DDERR_INVALIDPIXELFORMAT,
+ FALSE, FALSE, FALSE, TRUE
},
{
&z_fmt,
@@ -5844,7 +5833,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
- DDERR_INVALIDCAPS,
},
};
@@ -5900,14 +5888,17 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface),
+ "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
device_name, i, test_data[i].caps_in, hr);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps),
"Test %s %u: Got unexpected caps %#x, expected %#x.\n",
device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -5957,7 +5948,9 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
+ ok(hr == test_data[i].set_rt_hr || broken(
+ (test_data[i].broken_set_target_ok && hr == D3D_OK) ||
+ (test_data[i].broken_set_target_ivpf && hr == DDERR_INVALIDPIXELFORMAT)),
"Test %s %u: Got unexpected hr %#x, expected %#x.\n",
device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
--
2.23.0
Dec. 13, 2019
[PATCH 3/7] ddraw/tests: Pass in device to check for in render-target testing.
by Jeff Smith
This allows the test to be performed on devices other than HAL.
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 40 +++++++++++++----------
dlls/ddraw/tests/ddraw2.c | 61 +++++++++++++++++++---------------
dlls/ddraw/tests/ddraw4.c | 57 ++++++++++++++++++--------------
dlls/ddraw/tests/ddraw7.c | 69 +++++++++++++++++++++++----------------
4 files changed, 129 insertions(+), 98 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 862c98353e..9b0ee8e553 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3884,7 +3884,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -4057,9 +4057,9 @@ static void test_rt_caps(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid)))
{
- skip("Failed to create a 3D device, skipping test.\n");
+ skip("Failed to create a (%s) 3D device, skipping test.\n", device_name);
IDirectDraw_Release(ddraw);
DestroyWindow(window);
return;
@@ -4096,40 +4096,41 @@ static void test_rt_caps(void)
surface_desc.dwHeight = 480;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+ device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
+ ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].create_device_hr);
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
}
if (SUCCEEDED(hr))
{
refcount = IDirect3DDevice_Release(device);
- ok(refcount == 1, "Test %u: Got unexpected refcount %u.\n", i, refcount);
+ ok(refcount == 1, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount);
}
refcount = IDirectDrawSurface_Release(surface);
- ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
}
IDirectDrawPalette_Release(palette);
@@ -4138,6 +4139,11 @@ static void test_rt_caps(void)
DestroyWindow(window);
}
+static void test_rt_caps(void)
+{
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index fbce6cb9c2..3c5485af96 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4303,7 +4303,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -4519,9 +4519,9 @@ static void test_rt_caps(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid)))
{
- skip("Failed to create a 3D device, skipping test.\n");
+ skip("Failed to create a (%s) 3D device, skipping test.\n", device_name);
IDirectDraw2_Release(ddraw);
DestroyWindow(window);
return;
@@ -4564,33 +4564,33 @@ static void test_rt_caps(void)
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+ device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
+ ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].create_device_hr);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
}
IDirectDrawSurface_Release(surface);
@@ -4601,10 +4601,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -4624,13 +4624,13 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -4641,19 +4641,21 @@ static void test_rt_caps(void)
if (hr == DDERR_INVALIDPIXELFORMAT)
{
refcount = IDirectDrawSurface_AddRef(rt);
- ok(refcount == 2, "Test %u: Got unexpected refcount %u.\n", i, refcount);
+ ok(refcount == 2, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount);
}
hr = IDirect3DDevice2_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+ ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface_Release(tmp);
IDirectDrawSurface_Release(rt);
refcount = IDirect3DDevice2_Release(device);
- ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
refcount = IDirectDrawSurface_Release(surface);
- ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
}
IDirectDrawPalette_Release(palette);
@@ -4665,6 +4667,11 @@ done:
DestroyWindow(window);
}
+static void test_rt_caps(void)
+{
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 4e4f21686c..b4b2f15b34 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -5921,7 +5921,7 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
@@ -6124,7 +6124,7 @@ static void test_rt_caps(void)
}
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
+ hr = IDirect3D3_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
skip("No depth buffer formats available, skipping test.\n");
@@ -6154,31 +6154,31 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+ device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
+ ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].create_device_hr);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface4_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
}
IDirectDrawSurface4_Release(surface);
@@ -6189,10 +6189,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6207,28 +6207,30 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice3_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+ ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface4_Release(tmp);
IDirectDrawSurface4_Release(rt);
refcount = IDirect3DDevice3_Release(device);
- ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
refcount = IDirectDrawSurface4_Release(surface);
- ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
}
IDirectDrawPalette_Release(palette);
@@ -6240,6 +6242,11 @@ done:
DestroyWindow(window);
}
+static void test_rt_caps(void)
+{
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 03c109125f..94618c0178 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5657,13 +5657,12 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
{
- const GUID *devtype = &IID_IDirect3DHALDevice;
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirectDraw7 *ddraw;
- struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
+ struct { REFCLSID riid; BOOL present; } device_data = { riid, FALSE };
DDPIXELFORMAT z_fmt;
IDirect3D7 *d3d;
unsigned int i;
@@ -5863,11 +5862,15 @@ static void test_rt_caps(void)
hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (device_data.present)
- devtype = device_data.riid;
+ if (!device_data.present)
+ {
+ skip("Failed to enumerate %s device, skipping test.\n", device_name);
+ IDirect3D7_Release(d3d);
+ goto done;
+ }
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
+ hr = IDirect3D7_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
skip("No depth buffer formats available, skipping test.\n");
@@ -5897,31 +5900,31 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+ device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
+ ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].create_device_hr);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface7_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+ hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
}
IDirectDrawSurface7_Release(surface);
@@ -5932,10 +5935,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -5950,28 +5953,30 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+ device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+ device_name, i, hr, test_data[i].set_rt_hr);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice7_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+ ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface7_Release(tmp);
IDirectDrawSurface7_Release(rt);
refcount = IDirect3DDevice7_Release(device);
- ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
refcount = IDirectDrawSurface7_Release(surface);
- ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+ ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+ device_name, i, refcount);
}
IDirectDrawPalette_Release(palette);
@@ -5983,6 +5988,12 @@ done:
DestroyWindow(window);
}
+static void test_rt_caps(void)
+{
+ test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal");
+ test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
static void test_primary_caps(void)
{
const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
--
2.23.0
Dec. 13, 2019
[PATCH 2/7] ddraw/tests: Pass in device to create with create_device.
by Jeff Smith
This allows the function to create devices other than HAL.
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 75 +++++++++++----------
dlls/ddraw/tests/ddraw2.c | 81 ++++++++++++-----------
dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++--------------
dlls/ddraw/tests/ddraw7.c | 135 +++++++++++++++++++++-----------------
4 files changed, 210 insertions(+), 182 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 3a27e91aa1..862c98353e 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void)
return ddraw;
}
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
+ if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
return device;
}
+static IDirect3DDevice *create_device_hal(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport *viewport;
@@ -1093,7 +1098,7 @@ static void test_coop_level_d3d_state(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1165,7 +1170,7 @@ static void test_surface_interface_mismatch(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1288,7 +1293,7 @@ static void test_viewport_object(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1514,7 +1519,7 @@ static void test_zenable(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1651,7 +1656,7 @@ static void test_ck_rgba(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1809,7 +1814,7 @@ static void test_ck_default(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1965,7 +1970,7 @@ static void test_ck_complex(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2193,7 +2198,7 @@ static void test_surface_qi(void)
/* Try to create a D3D device to see if the ddraw implementation supports
* D3D. 64-bit ddraw in particular doesn't seem to support D3D, and
* doesn't support e.g. the IDirect3DTexture interfaces. */
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -2276,7 +2281,7 @@ static void test_device_qi(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -3584,7 +3589,7 @@ static void test_clear_rect_count(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -3816,7 +3821,7 @@ static void test_unsupported_formats(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -4052,7 +4057,7 @@ static void test_rt_caps(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -4335,7 +4340,7 @@ static void test_surface_lock(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -4415,7 +4420,7 @@ static void test_surface_discard(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -5945,7 +5950,7 @@ static void test_material(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -6179,7 +6184,7 @@ static void test_lighting(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -6603,7 +6608,7 @@ static void test_specular_lighting(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -7502,7 +7507,7 @@ static void test_texturemapblend(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -7892,7 +7897,7 @@ static void test_viewport_clear_rect(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8108,7 +8113,7 @@ static void test_color_fill(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
is_warp = ddraw_is_warp(ddraw);
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8530,7 +8535,7 @@ static void test_colorkey_precision(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8953,7 +8958,7 @@ static void test_shademode(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -9520,7 +9525,7 @@ static void test_blt(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -9685,7 +9690,7 @@ static void test_cross_device_blt(void)
window = create_window();
ddraw = create_ddraw();
- if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw_Release(ddraw);
@@ -9695,7 +9700,7 @@ static void test_cross_device_blt(void)
window2 = create_window();
ddraw2 = create_ddraw();
- if (!(device2 = create_device(ddraw2, window2, DDSCL_NORMAL)))
+ if (!(device2 = create_device_hal(ddraw2, window2, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw_Release(ddraw2);
@@ -10245,7 +10250,7 @@ static void test_transform_vertices(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -11002,7 +11007,7 @@ static void test_texture_load(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -11642,7 +11647,7 @@ static void test_depth_readback(void)
return;
}
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirectDraw_Release(ddraw);
@@ -11747,7 +11752,7 @@ static void test_clear(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -12050,7 +12055,7 @@ static void test_execute_data(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -12216,7 +12221,7 @@ static void test_viewport(void)
0, 0, 640, 480, 0, 0, 0, 0);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -12474,7 +12479,7 @@ static void test_find_device(void)
hr = IDirect3D_FindDevice(d3d, &search, &result);
window = create_window();
- device = create_device(ddraw, window, DDSCL_NORMAL);
+ device = create_device_hal(ddraw, window, DDSCL_NORMAL);
if (hr == D3D_OK)
ok(!!device, "Failed to create a 3D device.\n");
else
@@ -12687,7 +12692,7 @@ static void test_alphatest(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 97f21798d3..fbce6cb9c2 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -342,7 +342,7 @@ static IDirectDraw2 *create_ddraw(void)
return ddraw2;
}
-static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, REFCLSID riid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -410,7 +410,7 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device)))
+ if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, riid, surface, &device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -421,6 +421,11 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
return device;
}
+static IDirect3DDevice2 *create_device_hal(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport2 *viewport;
@@ -940,7 +945,7 @@ static void test_coop_level_d3d_state(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -1043,7 +1048,7 @@ static void test_surface_interface_mismatch(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -1177,7 +1182,7 @@ static void test_depth_blit(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -1443,7 +1448,7 @@ static void test_viewport_object(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -1679,7 +1684,7 @@ static void test_zenable(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -1781,7 +1786,7 @@ static void test_ck_rgba(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -1912,7 +1917,7 @@ static void test_ck_default(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -2016,7 +2021,7 @@ static void test_ck_complex(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2244,7 +2249,7 @@ static void test_surface_qi(void)
/* Try to create a D3D device to see if the ddraw implementation supports
* D3D. 64-bit ddraw in particular doesn't seem to support D3D, and
* doesn't support e.g. the IDirect3DTexture interfaces. */
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -2326,7 +2331,7 @@ static void test_device_qi(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -3721,7 +3726,7 @@ static void test_clear_rect_count(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -3983,7 +3988,7 @@ static void test_lighting_interface_versions(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4235,7 +4240,7 @@ static void test_unsupported_formats(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4514,7 +4519,7 @@ static void test_rt_caps(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4862,7 +4867,7 @@ static void test_surface_lock(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4942,7 +4947,7 @@ static void test_surface_discard(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -6893,7 +6898,7 @@ static void test_material(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -7110,7 +7115,7 @@ static void test_lighting(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -7469,7 +7474,7 @@ static void test_specular_lighting(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8335,7 +8340,7 @@ static void test_texturemapblend(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8637,7 +8642,7 @@ static void test_viewport_clear_rect(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8853,7 +8858,7 @@ static void test_color_fill(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
is_warp = ddraw_is_warp(ddraw);
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9271,7 +9276,7 @@ static void test_colorkey_precision(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9671,7 +9676,7 @@ static void test_shademode(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -10219,7 +10224,7 @@ static void test_blt(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -10384,7 +10389,7 @@ static void test_cross_device_blt(void)
window = create_window();
ddraw = create_ddraw();
- if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw2_Release(ddraw);
@@ -10394,7 +10399,7 @@ static void test_cross_device_blt(void)
window2 = create_window();
ddraw2 = create_ddraw();
- if (!(device2 = create_device(ddraw2, window2, DDSCL_NORMAL)))
+ if (!(device2 = create_device_hal(ddraw2, window2, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw2_Release(ddraw2);
@@ -10859,7 +10864,7 @@ static void test_draw_primitive(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -10939,7 +10944,7 @@ static void test_edge_antialiasing_blending(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -11217,7 +11222,7 @@ static void test_transform_vertices(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -12546,7 +12551,7 @@ static void test_set_render_state(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -12617,7 +12622,7 @@ static void test_depth_readback(void)
ok(!!window, "Failed to create a window.\n");
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirectDraw2_Release(ddraw);
@@ -12734,7 +12739,7 @@ static void test_clear(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -13066,7 +13071,7 @@ static void test_viewport(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -13342,7 +13347,7 @@ static void test_find_device(void)
hr = IDirect3D2_FindDevice(d3d, &search, &result);
window = create_window();
- device = create_device(ddraw, window, DDSCL_NORMAL);
+ device = create_device_hal(ddraw, window, DDSCL_NORMAL);
if (hr == D3D_OK)
ok(!!device, "Failed to create a 3D device.\n");
else
@@ -13552,7 +13557,7 @@ static void test_alphatest(void)
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirectDraw2_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 2c0a9e7f05..4e4f21686c 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -330,7 +330,7 @@ static IDirectDraw4 *create_ddraw(void)
return ddraw4;
}
-static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
+static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level, REFCLSID riid)
{
IDirectDrawSurface4 *surface, *ds;
IDirect3DDevice3 *device = NULL;
@@ -412,7 +412,7 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
return NULL;
}
- hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DHALDevice, surface, &device, NULL);
+ hr = IDirect3D3_CreateDevice(d3d3, riid, surface, &device, NULL);
IDirect3D3_Release(d3d3);
IDirectDrawSurface4_Release(surface);
if (FAILED(hr))
@@ -421,6 +421,11 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
return device;
}
+static IDirect3DDevice3 *create_device_hal(HWND window, DWORD coop_level)
+{
+ return create_device(window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport3 *create_viewport(IDirect3DDevice3 *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport3 *viewport;
@@ -633,7 +638,7 @@ static void test_process_vertices(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1131,7 +1136,7 @@ static void test_coop_level_d3d_state(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1353,7 +1358,7 @@ static void test_depth_blit(void)
D3DRECT d3drect;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1612,7 +1617,7 @@ static void test_viewport_object(void)
} desc;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1926,7 +1931,7 @@ static void test_zenable(void)
UINT i, j;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2025,7 +2030,7 @@ static void test_ck_rgba(void)
UINT i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2157,7 +2162,7 @@ static void test_ck_default(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2258,7 +2263,7 @@ static void test_ck_complex(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2488,7 +2493,7 @@ static void test_surface_qi(void)
/* Try to create a D3D device to see if the ddraw implementation supports
* D3D. 64-bit ddraw in particular doesn't seem to support D3D, and
* doesn't support e.g. the IDirect3DTexture interfaces. */
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2570,7 +2575,7 @@ static void test_device_qi(void)
HWND window;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -3934,7 +3939,7 @@ static void test_vb_discard(void)
unsigned int i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4041,7 +4046,7 @@ static void test_draw_strided(void)
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4214,7 +4219,7 @@ static void test_lighting(void)
*dst_data;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4696,7 +4701,7 @@ static void test_specular_lighting(void)
WORD *indices;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4883,7 +4888,7 @@ static void test_clear_rect_count(void)
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -5189,7 +5194,7 @@ static void test_lighting_interface_versions(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -5624,7 +5629,7 @@ static void test_block_formats_creation(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -5848,7 +5853,7 @@ static void test_unsupported_formats(void)
static const DWORD caps[] = {0, DDSCAPS_SYSTEMMEMORY, DDSCAPS_VIDEOMEMORY};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -6563,7 +6568,7 @@ static void test_surface_discard(void)
unsigned int i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -8733,7 +8738,7 @@ static void test_material(void)
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9319,7 +9324,7 @@ static void test_vb_writeonly(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9671,7 +9676,7 @@ static void test_texturemapblend(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10183,7 +10188,7 @@ static void test_signed_formats(void)
D3DDEVICEDESC device_desc, hel_desc;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10494,7 +10499,7 @@ static void test_color_fill(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10882,7 +10887,7 @@ static void test_texcoordindex(void)
DWORD *ptr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -11107,7 +11112,7 @@ static void test_colorkey_precision(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -11517,7 +11522,7 @@ static void test_shademode(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12097,7 +12102,7 @@ static void test_blt(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12266,7 +12271,7 @@ static void test_cross_device_blt(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -12274,7 +12279,7 @@ static void test_cross_device_blt(void)
}
window2 = create_window();
- if (!(device2 = create_device(window2, DDSCL_NORMAL)))
+ if (!(device2 = create_device_hal(window2, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirect3DDevice3_Release(device);
@@ -12413,7 +12418,7 @@ static void test_color_clamping(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12844,7 +12849,7 @@ static void test_draw_primitive(void)
void *data;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12975,7 +12980,7 @@ static void test_edge_antialiasing_blending(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -13263,7 +13268,7 @@ static void test_transform_vertices(void)
}
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -14665,7 +14670,7 @@ static void test_vb_refcount(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -14779,7 +14784,7 @@ static void test_compute_sphere_visibility(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -14827,7 +14832,7 @@ static void test_texture_stages_limits(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14877,7 +14882,7 @@ static void test_set_render_state(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14970,7 +14975,7 @@ static void test_map_synchronisation(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@@ -15146,7 +15151,7 @@ static void test_depth_readback(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@@ -15271,7 +15276,7 @@ static void test_clear(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -15588,7 +15593,7 @@ static void test_viewport(void)
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, 640, 480, 0, 0, 0, 0);
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -15862,7 +15867,7 @@ static void test_find_device(void)
hr = IDirect3D3_FindDevice(d3d, &search, &result);
window = create_window();
- device = create_device(window, DDSCL_NORMAL);
+ device = create_device_hal(window, DDSCL_NORMAL);
if (hr == D3D_OK)
ok(!!device, "Failed to create a 3D device.\n");
else
@@ -15975,7 +15980,7 @@ static void test_sysmem_draw(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -16214,7 +16219,7 @@ static void test_alphatest(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -16807,7 +16812,7 @@ static void test_surface_format_conversion_alpha(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index d921746152..03c109125f 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -348,7 +348,7 @@ static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7
return DDENUMRET_OK;
}
-static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
+static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level, REFCLSID riid)
{
IDirectDrawSurface7 *surface, *ds;
IDirect3DDevice7 *device = NULL;
@@ -357,8 +357,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
IDirectDraw7 *ddraw;
IDirect3D7 *d3d7;
HRESULT hr;
- struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
- const GUID *devtype = &IID_IDirect3DHALDevice;
+ struct { REFCLSID riid; BOOL present; } device_data = { riid, FALSE };
if (!(ddraw = create_ddraw()))
return NULL;
@@ -399,10 +398,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (device_data.present) devtype = device_data.riid;
+ if (!device_data.present)
+ {
+ IDirect3D7_Release(d3d7);
+ IDirectDrawSurface7_Release(surface);
+ return NULL;
+ }
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt);
+ hr = IDirect3D7_EnumZBufferFormats(d3d7, riid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
IDirect3D7_Release(d3d7);
@@ -436,7 +440,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
return NULL;
}
- hr = IDirect3D7_CreateDevice(d3d7, devtype, surface, &device);
+ hr = IDirect3D7_CreateDevice(d3d7, riid, surface, &device);
IDirect3D7_Release(d3d7);
IDirectDrawSurface7_Release(surface);
if (FAILED(hr))
@@ -445,6 +449,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
return device;
}
+static IDirect3DDevice7 *create_device_hal(HWND window, DWORD coop_level)
+{
+ IDirect3DDevice7 *device;
+ device = create_device(window, coop_level, &IID_IDirect3DTnLHalDevice);
+ if (!device)
+ device = create_device(window, coop_level, &IID_IDirect3DHALDevice);
+ return device;
+}
+
struct message
{
UINT message;
@@ -536,7 +549,7 @@ static void test_process_vertices(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1072,7 +1085,7 @@ static void test_coop_level_d3d_state(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1302,7 +1315,7 @@ static void test_depth_blit(void)
HWND window;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1448,7 +1461,7 @@ static void test_texture_load_ckey(void)
IDirect3D7 *d3d;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1545,7 +1558,7 @@ static void test_zenable(void)
UINT i, j;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1636,7 +1649,7 @@ static void test_ck_rgba(void)
UINT i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1756,7 +1769,7 @@ static void test_ck_default(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -1850,7 +1863,7 @@ static void test_ck_complex(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2134,7 +2147,7 @@ static void test_surface_qi(void)
/* Try to create a D3D device to see if the ddraw implementation supports
* D3D. 64-bit ddraw in particular doesn't seem to support D3D, and
* doesn't support e.g. the IDirect3DTexture interfaces. */
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -2216,7 +2229,7 @@ static void test_device_qi(void)
HWND window;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -3579,7 +3592,7 @@ static void test_vb_discard(void)
unsigned int i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -3684,7 +3697,7 @@ static void test_draw_strided(void)
D3DDRAWPRIMITIVESTRIDEDDATA strided;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -3853,7 +3866,7 @@ static void test_lighting(void)
*dst_data;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4355,7 +4368,7 @@ static void test_specular_lighting(void)
} *dst_data;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4516,7 +4529,7 @@ static void test_clear_rect_count(void)
D3DRECT rect = {{0}, {0}, {640}, {480}};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4720,7 +4733,7 @@ static void test_fog_special(void)
IDirectDrawSurface7 *rt;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -4913,7 +4926,7 @@ static void test_lighting_interface_versions(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -5352,7 +5365,7 @@ static void test_block_formats_creation(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -5576,7 +5589,7 @@ static void test_unsupported_formats(void)
static const DWORD caps[] = {0, DDSCAPS_SYSTEMMEMORY, DDSCAPS_VIDEOMEMORY};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -6374,7 +6387,7 @@ static void test_surface_discard(void)
unsigned int i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -6701,7 +6714,7 @@ static void test_flip(void)
IDirectDrawSurface7_Release(frontbuffer);
}
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
goto done;
@@ -8549,7 +8562,7 @@ static void test_material(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9072,7 +9085,7 @@ static void test_vb_writeonly(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9569,7 +9582,7 @@ static void test_fog_interpolation(void)
D3DDEVICEDESC7 caps;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9724,7 +9737,7 @@ static void test_fog_process_vertices(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -9909,7 +9922,7 @@ static void test_negative_fixedfunction_fog(void)
D3DDEVICEDESC7 caps;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10021,7 +10034,7 @@ static void test_table_fog_zw(void)
unsigned int i;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10180,7 +10193,7 @@ static void test_signed_formats(void)
D3DDEVICEDESC7 device_desc;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10470,7 +10483,7 @@ static void test_color_fill(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -10862,7 +10875,7 @@ static void test_texcoordindex(void)
DWORD *ptr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -11100,7 +11113,7 @@ static void test_colorkey_precision(void)
DDBLTFX fx;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -11500,7 +11513,7 @@ static void test_shademode(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12090,7 +12103,7 @@ static void test_blt(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12259,7 +12272,7 @@ static void test_cross_device_blt(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
+ if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -12267,7 +12280,7 @@ static void test_cross_device_blt(void)
}
window2 = create_window();
- if (!(device2 = create_device(window2, DDSCL_NORMAL)))
+ if (!(device2 = create_device_hal(window2, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
IDirect3DDevice7_Release(device);
@@ -12404,7 +12417,7 @@ static void test_color_clamping(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12835,7 +12848,7 @@ static void test_draw_primitive(void)
void *data;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -12962,7 +12975,7 @@ static void test_edge_antialiasing_blending(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -14005,7 +14018,7 @@ static void test_vb_refcount(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -14127,7 +14140,7 @@ static void test_compute_sphere_visibility(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -14174,7 +14187,7 @@ static void test_clip_planes_limits(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14245,7 +14258,7 @@ static void test_texture_stages_limits(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14292,7 +14305,7 @@ static void test_set_render_state(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14383,7 +14396,7 @@ static void test_map_synchronisation(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@@ -14566,7 +14579,7 @@ static void test_depth_readback(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@@ -14703,7 +14716,7 @@ static void test_clear(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -14974,7 +14987,7 @@ static void test_viewport(void)
window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -15193,7 +15206,7 @@ static void test_device_load(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -15652,7 +15665,7 @@ static void test_color_vertex(void)
window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -15791,7 +15804,7 @@ static void test_sysmem_draw(void)
window = create_window();
ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -16019,7 +16032,7 @@ static void test_multiply_transform(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -16123,7 +16136,7 @@ static void test_alphatest(void)
};
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device.\n");
DestroyWindow(window);
@@ -16354,7 +16367,7 @@ static void test_begin_end_state_block(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create 3D device.\n");
DestroyWindow(window);
@@ -16775,7 +16788,7 @@ static void test_surface_format_conversion_alpha(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
@@ -16982,7 +16995,7 @@ static void test_compressed_surface_stretch(void)
HRESULT hr;
window = create_window();
- if (!(device = create_device(window, DDSCL_NORMAL)))
+ if (!(device = create_device_hal(window, DDSCL_NORMAL)))
{
skip("Failed to create a 3D device, skipping test.\n");
DestroyWindow(window);
--
2.23.0
Dec. 13, 2019
[PATCH 1/7] ddraw/tests: Pass in device to look for when enumerating.
by Jeff Smith
This makes it possible to scan for devices other than HAL.
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ddraw/tests/ddraw7.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 470464951c..d921746152 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -339,10 +339,10 @@ static IDirectDraw7 *create_ddraw(void)
static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 *desc, void *ctx)
{
- BOOL *hal_ok = ctx;
- if (IsEqualGUID(&desc->deviceGUID, &IID_IDirect3DTnLHalDevice))
+ struct { REFCLSID riid; BOOL present; } *device_data = ctx;
+ if (IsEqualGUID(&desc->deviceGUID, device_data->riid))
{
- *hal_ok = TRUE;
+ device_data->present = TRUE;
return DDENUMRET_CANCEL;
}
return DDENUMRET_OK;
@@ -357,7 +357,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
IDirectDraw7 *ddraw;
IDirect3D7 *d3d7;
HRESULT hr;
- BOOL hal_ok = FALSE;
+ struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
const GUID *devtype = &IID_IDirect3DHALDevice;
if (!(ddraw = create_ddraw()))
@@ -397,9 +397,9 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
return NULL;
}
- hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &hal_ok);
+ hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (hal_ok) devtype = &IID_IDirect3DTnLHalDevice;
+ if (device_data.present) devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt));
hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt);
@@ -5650,7 +5650,7 @@ static void test_rt_caps(void)
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirectDraw7 *ddraw;
- BOOL hal_ok = FALSE;
+ struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
DDPIXELFORMAT z_fmt;
IDirect3D7 *d3d;
unsigned int i;
@@ -5848,10 +5848,10 @@ static void test_rt_caps(void)
goto done;
}
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+ hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (hal_ok)
- devtype = &IID_IDirect3DTnLHalDevice;
+ if (device_data.present)
+ devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt));
hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
@@ -6133,7 +6133,7 @@ static void test_surface_lock(void)
DDSURFACEDESC2 ddsd;
ULONG refcount;
DDPIXELFORMAT z_fmt;
- BOOL hal_ok = FALSE;
+ struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
const GUID *devtype = &IID_IDirect3DHALDevice;
D3DDEVICEDESC7 device_desc;
BOOL cubemap_supported;
@@ -6254,10 +6254,10 @@ static void test_surface_lock(void)
goto done;
}
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+ hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (hal_ok)
- devtype = &IID_IDirect3DTnLHalDevice;
+ if (device_data.present)
+ devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt));
hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
--
2.23.0
Dec. 13, 2019
[PATCH v2 3/3] msado15: Add ISupportErrorInfo support to _Recordset.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 61 +++++++++++++++++++++++++++++++-----
dlls/msado15/tests/msado15.c | 5 +++
2 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 4b61b552f0..9bf6b60df1 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -34,14 +34,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct fields;
struct recordset
{
- _Recordset Recordset_iface;
- LONG refs;
- LONG state;
- struct fields *fields;
- LONG count;
- LONG allocated;
- LONG index;
- VARIANT *data;
+ _Recordset Recordset_iface;
+ ISupportErrorInfo ISupportErrorInfo_iface;
+ LONG refs;
+ LONG state;
+ struct fields *fields;
+ LONG count;
+ LONG allocated;
+ LONG index;
+ VARIANT *data;
};
struct fields
@@ -646,6 +647,11 @@ static inline struct recordset *impl_from_Recordset( _Recordset *iface )
return CONTAINING_RECORD( iface, struct recordset, Recordset_iface );
}
+static inline struct recordset *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
+{
+ return CONTAINING_RECORD( iface, struct recordset, ISupportErrorInfo_iface );
+}
+
static ULONG WINAPI recordset_AddRef( _Recordset *iface )
{
struct recordset *recordset = impl_from_Recordset( iface );
@@ -686,6 +692,7 @@ static ULONG WINAPI recordset_Release( _Recordset *iface )
static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, void **obj )
{
+ struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
if (IsEqualIID(riid, &IID_IUnknown) ||
@@ -698,6 +705,10 @@ static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid,
{
*obj = iface;
}
+ else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
+ {
+ *obj = &recordset->ISupportErrorInfo_iface;
+ }
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
@@ -1235,6 +1246,39 @@ static HRESULT WINAPI recordset_Save( _Recordset *iface, VARIANT destination, Pe
return E_NOTIMPL;
}
+static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_QueryInterface( &recordset->Recordset_iface, riid, obj );
+}
+
+static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_AddRef( &recordset->Recordset_iface );
+}
+
+static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_Release( &recordset->Recordset_iface );
+}
+
+static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ FIXME( "%p, %s\n", recordset, debugstr_guid(riid) );
+ return S_FALSE;
+}
+
+static const struct ISupportErrorInfoVtbl support_error_vtbl =
+{
+ supporterror_QueryInterface,
+ supporterror_AddRef,
+ supporterror_Release,
+ supporterror_InterfaceSupportsErrorInfo
+};
+
static const struct _RecordsetVtbl recordset_vtbl =
{
recordset_QueryInterface,
@@ -1330,6 +1374,7 @@ HRESULT Recordset_create( void **obj )
if (!(recordset = heap_alloc_zero( sizeof(*recordset) ))) return E_OUTOFMEMORY;
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
+ recordset->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl;
recordset->refs = 1;
recordset->index = -1;
recordset->state = adStateClosed;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index d6bb50f44e..1fae811d10 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -46,6 +46,7 @@ static LONG get_refs_recordset( _Recordset *recordset )
static void test_Recordset(void)
{
_Recordset *recordset;
+ ISupportErrorInfo *errorinfo;
Fields *fields, *fields2;
LONG refs, count, state;
HRESULT hr;
@@ -91,6 +92,10 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
+ hr = _Recordset_QueryInterface(recordset, &IID_ISupportErrorInfo, (void**)&errorinfo);
+ ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
+ ISupportErrorInfo_Release(errorinfo);
+
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH v2 2/3] msado15: Implement _Connection Open
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/Makefile.in | 2 +-
dlls/msado15/connection.c | 38 ++++++++++++++++++++++++++++++++++++--
dlls/msado15/main.c | 1 +
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/Makefile.in b/dlls/msado15/Makefile.in
index 9852e0863d..e64da60547 100644
--- a/dlls/msado15/Makefile.in
+++ b/dlls/msado15/Makefile.in
@@ -1,5 +1,5 @@
MODULE = msado15.dll
-IMPORTS = oleaut32
+IMPORTS = oleaut32 ole32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index 73b225628c..2408000abc 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -21,6 +21,7 @@
#include "winbase.h"
#define COBJMACROS
#include "objbase.h"
+#include "msdasc.h"
#include "msado15_backcompat.h"
#include "wine/debug.h"
@@ -34,6 +35,8 @@ struct connection
{
_Connection Connection_iface;
ISupportErrorInfo ISupportErrorInfo_iface;
+ IDataInitialize *datainit;
+ IDBInitialize *dbinit;
LONG refs;
ObjectStateEnum state;
LONG timeout;
@@ -61,6 +64,11 @@ static ULONG WINAPI connection_Release( _Connection *iface )
LONG refs = InterlockedDecrement( &connection->refs );
if (!refs)
{
+ if (connection->dbinit)
+ IDBInitialize_Release(connection->dbinit);
+ if (connection->datainit)
+ IDataInitialize_Release(connection->datainit);
+
TRACE( "destroying %p\n", connection );
heap_free( connection );
}
@@ -203,9 +211,33 @@ static HRESULT WINAPI connection_RollbackTrans( _Connection *iface )
static HRESULT WINAPI connection_Open( _Connection *iface, BSTR connect_str, BSTR userid, BSTR password,
LONG options )
{
- FIXME( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid),
+ struct connection *connection = impl_from_Connection( iface );
+ HRESULT hr;
+
+ TRACE( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid),
password, options );
- return E_NOTIMPL;
+
+ hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&connection->datainit);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create IDataInitialize object\n");
+ return hr;
+ }
+
+ hr = IDataInitialize_GetDataSource(connection->datainit, NULL, CLSCTX_INPROC_SERVER, connect_str,
+ &IID_IDBInitialize, (IUnknown**)&connection->dbinit);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create IDBInitialize object\n");
+
+ IDataInitialize_Release(connection->datainit);
+ connection->datainit = NULL;
+ return hr;
+ }
+
+ connection->state = adStateOpen;
+
+ return hr;
}
static HRESULT WINAPI connection_get_Errors( _Connection *iface, Errors **obj )
@@ -392,6 +424,8 @@ HRESULT Connection_create( void **obj )
connection->refs = 1;
connection->state = adStateClosed;
connection->timeout = 30;
+ connection->datainit = NULL;
+ connection->dbinit = NULL;
*obj = &connection->Connection_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/main.c b/dlls/msado15/main.c
index 3115474b84..83c4a20566 100644
--- a/dlls/msado15/main.c
+++ b/dlls/msado15/main.c
@@ -21,6 +21,7 @@
#include "winbase.h"
#include "initguid.h"
#define COBJMACROS
+#include "msdasc.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "msado15_backcompat.h"
--
2.17.1
Dec. 13, 2019
[PATCH v2 1/3] msado15: Implement _Recordset get_State
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 7 +++++--
dlls/msado15/tests/msado15.c | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index e854b3e824..4b61b552f0 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -1050,8 +1050,10 @@ static HRESULT WINAPI recordset_get_Status( _Recordset *iface, LONG *status )
static HRESULT WINAPI recordset_get_State( _Recordset *iface, LONG *state )
{
- FIXME( "%p, %p\n", iface, state );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+ TRACE( "%p, %p\n", recordset, state );
+ *state = recordset->state;
+ return S_OK;
}
static HRESULT WINAPI recordset__xClone( _Recordset *iface, _Recordset **obj )
@@ -1330,6 +1332,7 @@ HRESULT Recordset_create( void **obj )
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
recordset->refs = 1;
recordset->index = -1;
+ recordset->state = adStateClosed;
*obj = &recordset->Recordset_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index f9a5377c50..d6bb50f44e 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -47,12 +47,17 @@ static void test_Recordset(void)
{
_Recordset *recordset;
Fields *fields, *fields2;
- LONG refs, count;
+ LONG refs, count, state;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
+ state = -1;
+ hr = _Recordset_get_State( recordset, &state );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == adStateClosed, "got %d\n", state );
+
/* handing out fields object increases recordset refcount */
refs = get_refs_recordset( recordset );
ok( refs == 1, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
Re: [PATCH 3/3] msado15: Add ISupportErrorInfo support to _Recordset.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62110
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/msado15/tests/msado15.c:93
Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/msado15/tests/msado15.c:93
Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: dlls/msado15/tests/msado15.c:93
Task: Patch failed to apply
Dec. 13, 2019
[PATCH 3/3] msado15: Add ISupportErrorInfo support to _Recordset.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 61 +++++++++++++++++++++++++++++++-----
dlls/msado15/tests/msado15.c | 5 +++
2 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 8a5f7aad41..0dc8a496c0 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -34,14 +34,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct fields;
struct recordset
{
- _Recordset Recordset_iface;
- LONG refs;
- LONG state;
- struct fields *fields;
- LONG count;
- LONG allocated;
- LONG index;
- VARIANT *data;
+ _Recordset Recordset_iface;
+ ISupportErrorInfo ISupportErrorInfo_iface;
+ LONG refs;
+ LONG state;
+ struct fields *fields;
+ LONG count;
+ LONG allocated;
+ LONG index;
+ VARIANT *data;
};
struct fields
@@ -646,6 +647,11 @@ static inline struct recordset *impl_from_Recordset( _Recordset *iface )
return CONTAINING_RECORD( iface, struct recordset, Recordset_iface );
}
+static inline struct recordset *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
+{
+ return CONTAINING_RECORD( iface, struct recordset, ISupportErrorInfo_iface );
+}
+
static ULONG WINAPI recordset_AddRef( _Recordset *iface )
{
struct recordset *recordset = impl_from_Recordset( iface );
@@ -690,6 +696,7 @@ static ULONG WINAPI recordset_Release( _Recordset *iface )
static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, void **obj )
{
+ struct recordset *recordset = impl_from_Recordset( iface );
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
if (IsEqualIID(riid, &IID_IUnknown) ||
@@ -702,6 +709,10 @@ static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid,
{
*obj = iface;
}
+ else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
+ {
+ *obj = &recordset->ISupportErrorInfo_iface;
+ }
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
@@ -1242,6 +1253,39 @@ static HRESULT WINAPI recordset_Save( _Recordset *iface, VARIANT destination, Pe
return E_NOTIMPL;
}
+static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_QueryInterface( &recordset->Recordset_iface, riid, obj );
+}
+
+static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_AddRef( &recordset->Recordset_iface );
+}
+
+static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ return recordset_Release( &recordset->Recordset_iface );
+}
+
+static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid )
+{
+ struct recordset *recordset = impl_from_ISupportErrorInfo( iface );
+ FIXME( "%p, %s\n", recordset, debugstr_guid(riid) );
+ return S_FALSE;
+}
+
+static const struct ISupportErrorInfoVtbl support_error_vtbl =
+{
+ supporterror_QueryInterface,
+ supporterror_AddRef,
+ supporterror_Release,
+ supporterror_InterfaceSupportsErrorInfo
+};
+
static const struct _RecordsetVtbl recordset_vtbl =
{
recordset_QueryInterface,
@@ -1337,6 +1381,7 @@ HRESULT Recordset_create( void **obj )
if (!(recordset = heap_alloc_zero( sizeof(*recordset) ))) return E_OUTOFMEMORY;
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
+ recordset->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl;
recordset->refs = 1;
recordset->index = -1;
recordset->state = adStateClosed;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index d3c1f30f6d..c25c7fc3cb 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -46,6 +46,7 @@ static LONG get_refs_recordset( _Recordset *recordset )
static void test_Recordset(void)
{
_Recordset *recordset;
+ ISupportErrorInfo *errorinfo;
Fields *fields, *fields2;
LONG refs, count, state;
HRESULT hr;
@@ -93,6 +94,10 @@ static void test_Recordset(void)
hr = _Recordset_Close( recordset );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
+
+ hr = _Recordset_QueryInterface(recordset, &IID_ISupportErrorInfo, (void**)&errorinfo);
+ ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
+ ISupportErrorInfo_Release(errorinfo);
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH 2/3] msado15: Implement _Connection Open
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/Makefile.in | 2 +-
dlls/msado15/connection.c | 38 ++++++++++++++++++++++++++++++++++++--
dlls/msado15/main.c | 1 +
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/Makefile.in b/dlls/msado15/Makefile.in
index 9852e0863d..e64da60547 100644
--- a/dlls/msado15/Makefile.in
+++ b/dlls/msado15/Makefile.in
@@ -1,5 +1,5 @@
MODULE = msado15.dll
-IMPORTS = oleaut32
+IMPORTS = oleaut32 ole32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index 73b225628c..2408000abc 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -21,6 +21,7 @@
#include "winbase.h"
#define COBJMACROS
#include "objbase.h"
+#include "msdasc.h"
#include "msado15_backcompat.h"
#include "wine/debug.h"
@@ -34,6 +35,8 @@ struct connection
{
_Connection Connection_iface;
ISupportErrorInfo ISupportErrorInfo_iface;
+ IDataInitialize *datainit;
+ IDBInitialize *dbinit;
LONG refs;
ObjectStateEnum state;
LONG timeout;
@@ -61,6 +64,11 @@ static ULONG WINAPI connection_Release( _Connection *iface )
LONG refs = InterlockedDecrement( &connection->refs );
if (!refs)
{
+ if (connection->dbinit)
+ IDBInitialize_Release(connection->dbinit);
+ if (connection->datainit)
+ IDataInitialize_Release(connection->datainit);
+
TRACE( "destroying %p\n", connection );
heap_free( connection );
}
@@ -203,9 +211,33 @@ static HRESULT WINAPI connection_RollbackTrans( _Connection *iface )
static HRESULT WINAPI connection_Open( _Connection *iface, BSTR connect_str, BSTR userid, BSTR password,
LONG options )
{
- FIXME( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid),
+ struct connection *connection = impl_from_Connection( iface );
+ HRESULT hr;
+
+ TRACE( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid),
password, options );
- return E_NOTIMPL;
+
+ hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&connection->datainit);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create IDataInitialize object\n");
+ return hr;
+ }
+
+ hr = IDataInitialize_GetDataSource(connection->datainit, NULL, CLSCTX_INPROC_SERVER, connect_str,
+ &IID_IDBInitialize, (IUnknown**)&connection->dbinit);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create IDBInitialize object\n");
+
+ IDataInitialize_Release(connection->datainit);
+ connection->datainit = NULL;
+ return hr;
+ }
+
+ connection->state = adStateOpen;
+
+ return hr;
}
static HRESULT WINAPI connection_get_Errors( _Connection *iface, Errors **obj )
@@ -392,6 +424,8 @@ HRESULT Connection_create( void **obj )
connection->refs = 1;
connection->state = adStateClosed;
connection->timeout = 30;
+ connection->datainit = NULL;
+ connection->dbinit = NULL;
*obj = &connection->Connection_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/main.c b/dlls/msado15/main.c
index 3115474b84..83c4a20566 100644
--- a/dlls/msado15/main.c
+++ b/dlls/msado15/main.c
@@ -21,6 +21,7 @@
#include "winbase.h"
#include "initguid.h"
#define COBJMACROS
+#include "msdasc.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "msado15_backcompat.h"
--
2.17.1
Dec. 13, 2019
[PATCH 1/3] msado15: Implement _Recordset get_State
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 7 +++++--
dlls/msado15/tests/msado15.c | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index f0bb1591aa..8a5f7aad41 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -1057,8 +1057,10 @@ static HRESULT WINAPI recordset_get_Status( _Recordset *iface, LONG *status )
static HRESULT WINAPI recordset_get_State( _Recordset *iface, LONG *state )
{
- FIXME( "%p, %p\n", iface, state );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+ TRACE( "%p, %p\n", recordset, state );
+ *state = recordset->state;
+ return S_OK;
}
static HRESULT WINAPI recordset__xClone( _Recordset *iface, _Recordset **obj )
@@ -1337,6 +1339,7 @@ HRESULT Recordset_create( void **obj )
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
recordset->refs = 1;
recordset->index = -1;
+ recordset->state = adStateClosed;
*obj = &recordset->Recordset_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 494f1be463..d3c1f30f6d 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -47,12 +47,17 @@ static void test_Recordset(void)
{
_Recordset *recordset;
Fields *fields, *fields2;
- LONG refs, count;
+ LONG refs, count, state;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
+ state = -1;
+ hr = _Recordset_get_State( recordset, &state );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == adStateClosed, "got %d\n", state );
+
/* handing out fields object increases recordset refcount */
refs = get_refs_recordset( recordset );
ok( refs == 1, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH v3 8/8] strmbase: Get rid of the "vtbl" parameter to strmbase_sink_init().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/qcap/avico.c | 24 +-------
dlls/qcap/avimux.c | 23 +-------
dlls/qcap/smartteefilter.c | 23 +-------
dlls/qedit/samplegrabber.c | 24 +-------
dlls/strmbase/pin.c | 101 +++++++++++++++++++-------------
dlls/strmbase/renderer.c | 25 +-------
dlls/strmbase/transform.c | 27 +--------
dlls/winegstreamer/gstdemux.c | 34 ++---------
dlls/wineqtdecoder/qtsplitter.c | 25 +-------
include/wine/strmbase.h | 25 +-------
10 files changed, 73 insertions(+), 258 deletions(-)
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c
index ecda162be86..53b8526f449 100644
--- a/dlls/qcap/avico.c
+++ b/dlls/qcap/avico.c
@@ -272,27 +272,6 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = {
AVICompressorPropertyBag_Save
};
-static const IPinVtbl AVICompressorInputPinVtbl = {
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
static HRESULT sink_query_accept(struct strmbase_pin *base, const AM_MEDIA_TYPE *pmt)
{
AVICompressor *This = impl_from_strmbase_pin(base);
@@ -517,8 +496,7 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
- strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl,
- &compressor->filter, sink_name, &sink_ops, NULL);
+ strmbase_sink_init(&compressor->sink, &compressor->filter, sink_name, &sink_ops, NULL);
strmbase_source_init(&compressor->source, &compressor->filter, source_name, &source_ops);
*phr = S_OK;
diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c
index c17d91322bf..e402479fb17 100644
--- a/dlls/qcap/avimux.c
+++ b/dlls/qcap/avimux.c
@@ -1500,27 +1500,6 @@ static inline AviMux* impl_from_in_IPin(IPin *iface)
return impl_from_strmbase_filter(pin->filter);
}
-static const IPinVtbl AviMuxIn_PinVtbl = {
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BasePinImpl_NewSegment
-};
-
static inline AviMuxIn* AviMuxIn_from_IAMStreamControl(IAMStreamControl *iface)
{
return CONTAINING_RECORD(iface, AviMuxIn, IAMStreamControl_iface);
@@ -1825,7 +1804,7 @@ static HRESULT create_input_pin(AviMux *avimux)
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- strmbase_sink_init(&object->pin, &AviMuxIn_PinVtbl, &avimux->filter, name, &sink_ops, NULL);
+ strmbase_sink_init(&object->pin, &avimux->filter, name, &sink_ops, NULL);
object->pin.IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl;
object->IAMStreamControl_iface.lpVtbl = &AviMuxIn_AMStreamControlVtbl;
object->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl;
diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c
index e1fcea55f91..5339cb5134f 100644
--- a/dlls/qcap/smartteefilter.c
+++ b/dlls/qcap/smartteefilter.c
@@ -81,27 +81,6 @@ static const struct strmbase_filter_ops filter_ops =
.filter_destroy = smart_tee_destroy,
};
-static const IPinVtbl SmartTeeFilterInputVtbl = {
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
static HRESULT sink_query_accept(struct strmbase_pin *base, const AM_MEDIA_TYPE *pmt)
{
SmartTeeFilter *This = impl_from_strmbase_pin(base);
@@ -358,7 +337,7 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
memset(object, 0, sizeof(*object));
strmbase_filter_init(&object->filter, outer, &CLSID_SmartTee, &filter_ops);
- strmbase_sink_init(&object->sink, &SmartTeeFilterInputVtbl, &object->filter, inputW, &sink_ops, NULL);
+ strmbase_sink_init(&object->sink, &object->filter, inputW, &sink_ops, NULL);
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
&IID_IMemAllocator, (void **)&object->sink.pAllocator);
if (FAILED(hr))
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c
index 91b8d9dce64..bbd43e79bfd 100644
--- a/dlls/qedit/samplegrabber.c
+++ b/dlls/qedit/samplegrabber.c
@@ -473,28 +473,6 @@ static const IMemInputPinVtbl IMemInputPin_VTable =
SampleGrabber_IMemInputPin_ReceiveCanBlock,
};
-static const IPinVtbl sink_vtbl =
-{
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
static inline SG_Impl *impl_from_sink_pin(struct strmbase_pin *iface)
{
return CONTAINING_RECORD(iface, SG_Impl, sink.pin);
@@ -663,7 +641,7 @@ HRESULT SampleGrabber_create(IUnknown *outer, void **out)
obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable;
obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
- strmbase_sink_init(&obj->sink, &sink_vtbl, &obj->filter, L"In", &sink_ops, NULL);
+ strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL);
strmbase_source_init(&obj->source, &obj->filter, L"Out", &source_ops);
obj->mtype.majortype = GUID_NULL;
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index 177d52740dc..6f22f249766 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -82,7 +82,7 @@ HRESULT strmbase_pin_get_media_type(struct strmbase_pin *iface, unsigned int ind
return VFW_S_NO_MORE_ITEMS;
}
-HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface, REFIID iid, void **out)
+static HRESULT WINAPI pin_QueryInterface(IPin *iface, REFIID iid, void **out)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
HRESULT hr;
@@ -107,19 +107,19 @@ HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface, REFIID iid, void **out)
return S_OK;
}
-ULONG WINAPI BasePinImpl_AddRef(IPin *iface)
+static ULONG WINAPI pin_AddRef(IPin *iface)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
return IBaseFilter_AddRef(&pin->filter->IBaseFilter_iface);
}
-ULONG WINAPI BasePinImpl_Release(IPin *iface)
+static ULONG WINAPI pin_Release(IPin *iface)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
return IBaseFilter_Release(&pin->filter->IBaseFilter_iface);
}
-HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
+static HRESULT WINAPI pin_ConnectedTo(IPin * iface, IPin ** ppPin)
{
struct strmbase_pin *This = impl_from_IPin(iface);
HRESULT hr;
@@ -145,7 +145,7 @@ HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
return hr;
}
-HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt)
+static HRESULT WINAPI pin_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *pmt)
{
struct strmbase_pin *This = impl_from_IPin(iface);
HRESULT hr;
@@ -171,7 +171,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
return hr;
}
-HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin *iface, PIN_INFO *info)
+static HRESULT WINAPI pin_QueryPinInfo(IPin *iface, PIN_INFO *info)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
@@ -184,7 +184,7 @@ HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin *iface, PIN_INFO *info)
return S_OK;
}
-HRESULT WINAPI BasePinImpl_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
+static HRESULT WINAPI pin_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
@@ -195,7 +195,7 @@ HRESULT WINAPI BasePinImpl_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
return S_OK;
}
-HRESULT WINAPI BasePinImpl_QueryId(IPin *iface, WCHAR **id)
+static HRESULT WINAPI pin_QueryId(IPin *iface, WCHAR **id)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
@@ -209,7 +209,7 @@ HRESULT WINAPI BasePinImpl_QueryId(IPin *iface, WCHAR **id)
return S_OK;
}
-HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt)
+static HRESULT WINAPI pin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
{
struct strmbase_pin *This = impl_from_IPin(iface);
@@ -219,7 +219,7 @@ HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt)
return (This->pFuncsTable->pin_query_accept(This, pmt) == S_OK ? S_OK : S_FALSE);
}
-HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types)
+static HRESULT WINAPI pin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_media_types)
{
struct strmbase_pin *pin = impl_from_IPin(iface);
AM_MEDIA_TYPE mt;
@@ -235,7 +235,7 @@ HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin *iface, IEnumMediaTypes **enum_me
return enum_media_types_create(pin, enum_media_types);
}
-HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
+static HRESULT WINAPI pin_QueryInternalConnections(IPin *iface, IPin **apPin, ULONG *cPin)
{
struct strmbase_pin *This = impl_from_IPin(iface);
@@ -244,14 +244,6 @@ HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin,
return E_NOTIMPL; /* to tell caller that all input pins connected to all output pins */
}
-HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
-{
- TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
- iface, debugstr_time(start), debugstr_time(stop), rate);
-
- return S_OK;
-}
-
/*** OutputPin implementation ***/
static inline struct strmbase_source *impl_source_from_IPin( IPin *iface )
@@ -420,26 +412,33 @@ static HRESULT WINAPI source_EndFlush(IPin *iface)
return E_UNEXPECTED;
}
+static HRESULT WINAPI source_NewSegment(IPin * iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
+{
+ TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
+ iface, debugstr_time(start), debugstr_time(stop), rate);
+ return S_OK;
+}
+
static const IPinVtbl source_vtbl =
{
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
+ pin_QueryInterface,
+ pin_AddRef,
+ pin_Release,
source_Connect,
source_ReceiveConnection,
source_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
+ pin_ConnectedTo,
+ pin_ConnectionMediaType,
+ pin_QueryPinInfo,
+ pin_QueryDirection,
+ pin_QueryId,
+ pin_QueryAccept,
+ pin_EnumMediaTypes,
+ pin_QueryInternalConnections,
source_EndOfStream,
source_BeginFlush,
source_EndFlush,
- BasePinImpl_NewSegment,
+ source_NewSegment,
};
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *This,
@@ -617,14 +616,14 @@ static struct strmbase_sink *impl_sink_from_IPin(IPin *iface)
return CONTAINING_RECORD(iface, struct strmbase_sink, pin.IPin_iface);
}
-HRESULT WINAPI BaseInputPinImpl_Connect(IPin *iface, IPin *pin, const AM_MEDIA_TYPE *pmt)
+static HRESULT WINAPI sink_Connect(IPin *iface, IPin *pin, const AM_MEDIA_TYPE *pmt)
{
ERR("(%p)->(%p, %p) outgoing connection on an input pin!\n", iface, pin, pmt);
return E_UNEXPECTED;
}
-HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
+static HRESULT WINAPI sink_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
{
struct strmbase_sink *This = impl_sink_from_IPin(iface);
PIN_DIRECTION pindirReceive;
@@ -678,7 +677,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
return hr;
}
-HRESULT WINAPI BaseInputPinImpl_Disconnect(IPin *iface)
+static HRESULT WINAPI sink_Disconnect(IPin *iface)
{
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr;
@@ -711,7 +710,7 @@ static HRESULT deliver_endofstream(IPin* pin, LPVOID unused)
return IPin_EndOfStream( pin );
}
-HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface)
+static HRESULT WINAPI sink_EndOfStream(IPin *iface)
{
struct strmbase_sink *This = impl_sink_from_IPin(iface);
HRESULT hr = S_OK;
@@ -736,7 +735,7 @@ static HRESULT deliver_beginflush(IPin* pin, LPVOID unused)
return IPin_BeginFlush( pin );
}
-HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface)
+static HRESULT WINAPI sink_BeginFlush(IPin *iface)
{
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr;
@@ -762,7 +761,7 @@ static HRESULT deliver_endflush(IPin* pin, LPVOID unused)
return IPin_EndFlush( pin );
}
-HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface)
+static HRESULT WINAPI sink_EndFlush(IPin * iface)
{
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr;
@@ -795,7 +794,7 @@ static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
return IPin_NewSegment(pin, args->tStart, args->tStop, args->rate);
}
-HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
+static HRESULT WINAPI sink_NewSegment(IPin *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
{
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
newsegmentargs args;
@@ -813,6 +812,28 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME start, R
return SendFurther(pin, deliver_newsegment, &args);
}
+static const IPinVtbl sink_vtbl =
+{
+ pin_QueryInterface,
+ pin_AddRef,
+ pin_Release,
+ sink_Connect,
+ sink_ReceiveConnection,
+ sink_Disconnect,
+ pin_ConnectedTo,
+ pin_ConnectionMediaType,
+ pin_QueryPinInfo,
+ pin_QueryDirection,
+ pin_QueryId,
+ pin_QueryAccept,
+ pin_EnumMediaTypes,
+ pin_QueryInternalConnections,
+ sink_EndOfStream,
+ sink_BeginFlush,
+ sink_EndFlush,
+ sink_NewSegment,
+};
+
/*** IMemInputPin implementation ***/
static inline struct strmbase_sink *impl_from_IMemInputPin(IMemInputPin *iface)
@@ -944,11 +965,11 @@ static const IMemInputPinVtbl MemInputPin_Vtbl =
MemInputPin_ReceiveCanBlock
};
-void strmbase_sink_init(struct strmbase_sink *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
+void strmbase_sink_init(struct strmbase_sink *pin, struct strmbase_filter *filter,
const WCHAR *name, const struct strmbase_sink_ops *func_table, IMemAllocator *allocator)
{
memset(pin, 0, sizeof(*pin));
- pin->pin.IPin_iface.lpVtbl = vtbl;
+ pin->pin.IPin_iface.lpVtbl = &sink_vtbl;
pin->pin.filter = filter;
pin->pin.dir = PINDIR_INPUT;
lstrcpyW(pin->pin.name, name);
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index a3ede130d63..642f9d66715 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -40,28 +40,6 @@ static inline struct strmbase_renderer *impl_from_IPin(IPin *iface)
return CONTAINING_RECORD(iface, struct strmbase_renderer, sink.pin.IPin_iface);
}
-static const IPinVtbl BaseRenderer_InputPin_Vtbl =
-{
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
static struct strmbase_pin *renderer_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct strmbase_renderer *filter = impl_from_strmbase_filter(iface);
@@ -436,8 +414,7 @@ HRESULT WINAPI strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown
filter->pFuncsTable = ops;
- strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &filter->filter,
- sink_name, &sink_ops, NULL);
+ strmbase_sink_init(&filter->sink, &filter->filter, sink_name, &sink_ops, NULL);
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface,
TRUE, &filter->sink.pin.IPin_iface, &filter->pPosition);
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index 69dc93affe1..74be6b107e5 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -26,8 +26,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
static const WCHAR wcsInputPinName[] = {'I','n',0};
static const WCHAR wcsOutputPinName[] = {'O','u','t',0};
-static const IPinVtbl TransformFilter_InputPin_Vtbl;
-
static inline TransformFilter *impl_from_strmbase_filter(struct strmbase_filter *iface)
{
return CONTAINING_RECORD(iface, TransformFilter, filter);
@@ -403,8 +401,7 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
filter->pFuncsTable = func_table;
ZeroMemory(&filter->pmt, sizeof(filter->pmt));
- strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &filter->filter,
- wcsInputPinName, &sink_ops, NULL);
+ strmbase_sink_init(&filter->sink, &filter->filter, wcsInputPinName, &sink_ops, NULL);
strmbase_source_init(&filter->source, &filter->filter, wcsOutputPinName, &source_ops);
filter->source_IQualityControl_iface.lpVtbl = &source_qc_vtbl;
@@ -454,25 +451,3 @@ HRESULT strmbase_transform_create(LONG filter_size, IUnknown *outer, const CLSID
CoTaskMemFree(pTf);
return E_FAIL;
}
-
-static const IPinVtbl TransformFilter_InputPin_Vtbl =
-{
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 1eae0dae9af..3945d9da8fa 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -97,7 +97,6 @@ const char* media_quark_string = "media-sample";
static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
static const IMediaSeekingVtbl GST_Seeking_Vtbl;
-static const IPinVtbl GST_InputPin_Vtbl;
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
static struct gstdemux_source *create_pin(struct gstdemux *filter, const WCHAR *name);
@@ -1502,8 +1501,7 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
}
strmbase_filter_init(&object->filter, outer, &CLSID_Gstreamer_Splitter, &filter_ops);
- strmbase_sink_init(&object->sink, &GST_InputPin_Vtbl, &object->filter,
- wcsInputPinName, &sink_ops, NULL);
+ strmbase_sink_init(&object->sink, &object->filter, wcsInputPinName, &sink_ops, NULL);
object->no_more_pads_event = CreateEventW(NULL, FALSE, FALSE, NULL);
object->init_gst = gstdecoder_init_gst;
@@ -1967,27 +1965,6 @@ static HRESULT GST_RemoveOutputPins(struct gstdemux *This)
return S_OK;
}
-static const IPinVtbl GST_InputPin_Vtbl = {
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
pthread_mutex_t cb_list_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cb_list_cond = PTHREAD_COND_INITIALIZER;
struct list cb_list = LIST_INIT(cb_list);
@@ -2235,8 +2212,7 @@ IUnknown * CALLBACK wave_parser_create(IUnknown *outer, HRESULT *phr)
}
strmbase_filter_init(&object->filter, outer, &CLSID_WAVEParser, &filter_ops);
- strmbase_sink_init(&object->sink, &GST_InputPin_Vtbl, &object->filter,
- sink_name, &wave_parser_sink_ops, NULL);
+ strmbase_sink_init(&object->sink, &object->filter, sink_name, &wave_parser_sink_ops, NULL);
object->init_gst = wave_parser_init_gst;
*phr = S_OK;
@@ -2339,8 +2315,7 @@ IUnknown * CALLBACK avi_splitter_create(IUnknown *outer, HRESULT *phr)
}
strmbase_filter_init(&object->filter, outer, &CLSID_AviSplitter, &filter_ops);
- strmbase_sink_init(&object->sink, &GST_InputPin_Vtbl, &object->filter,
- sink_name, &avi_splitter_sink_ops, NULL);
+ strmbase_sink_init(&object->sink, &object->filter, sink_name, &avi_splitter_sink_ops, NULL);
object->no_more_pads_event = CreateEventW(NULL, FALSE, FALSE, NULL);
object->init_gst = avi_splitter_init_gst;
*phr = S_OK;
@@ -2475,8 +2450,7 @@ IUnknown * CALLBACK mpeg_splitter_create(IUnknown *outer, HRESULT *phr)
}
strmbase_filter_init(&object->filter, outer, &CLSID_MPEG1Splitter, &mpeg_splitter_ops);
- strmbase_sink_init(&object->sink, &GST_InputPin_Vtbl, &object->filter,
- sink_name, &mpeg_splitter_sink_ops, NULL);
+ strmbase_sink_init(&object->sink, &object->filter, sink_name, &mpeg_splitter_sink_ops, NULL);
object->IAMStreamSelect_iface.lpVtbl = &stream_select_vtbl;
object->duration_event = CreateEventW(NULL, FALSE, FALSE, NULL);
diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index df6e8ea5d24..1421e0bf53c 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -171,7 +171,6 @@ typedef struct QTSplitter {
HANDLE splitterThread;
} QTSplitter;
-static const IPinVtbl QT_InputPin_Vtbl;
static const IBaseFilterVtbl QT_Vtbl;
static const IMediaSeekingVtbl QT_Seeking_Vtbl;
@@ -421,8 +420,7 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
ZeroMemory(This,sizeof(*This));
strmbase_filter_init(&This->filter, outer, &CLSID_QTSplitter, &filter_ops);
- strmbase_sink_init(&This->pInputPin.pin, &QT_InputPin_Vtbl, &This->filter,
- wcsInputPinName, &sink_ops, NULL);
+ strmbase_sink_init(&This->pInputPin.pin, &This->filter, wcsInputPinName, &sink_ops, NULL);
InitializeCriticalSection(&This->csReceive);
This->csReceive.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": QTSplitter.csReceive");
@@ -1030,27 +1028,6 @@ static HRESULT QT_Process_Movie(QTSplitter* filter)
return hr;
}
-static const IPinVtbl QT_InputPin_Vtbl = {
- BasePinImpl_QueryInterface,
- BasePinImpl_AddRef,
- BasePinImpl_Release,
- BaseInputPinImpl_Connect,
- BaseInputPinImpl_ReceiveConnection,
- BaseInputPinImpl_Disconnect,
- BasePinImpl_ConnectedTo,
- BasePinImpl_ConnectionMediaType,
- BasePinImpl_QueryPinInfo,
- BasePinImpl_QueryDirection,
- BasePinImpl_QueryId,
- BasePinImpl_QueryAccept,
- BasePinImpl_EnumMediaTypes,
- BasePinImpl_QueryInternalConnections,
- BaseInputPinImpl_EndOfStream,
- BaseInputPinImpl_BeginFlush,
- BaseInputPinImpl_EndFlush,
- BaseInputPinImpl_NewSegment
-};
-
static inline QTOutPin *impl_source_from_strmbase_pin(struct strmbase_pin *iface)
{
return CONTAINING_RECORD(iface, QTOutPin, pin.pin);
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index c01ef6133f4..48d7638ae16 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -103,20 +103,6 @@ struct strmbase_sink_ops
/* Base Pin */
HRESULT strmbase_pin_get_media_type(struct strmbase_pin *pin, unsigned int index, AM_MEDIA_TYPE *mt);
-LONG WINAPI BasePinImpl_GetMediaTypeVersion(struct strmbase_pin *pin);
-HRESULT WINAPI BasePinImpl_QueryInterface(IPin *iface, REFIID iid, void **out);
-ULONG WINAPI BasePinImpl_AddRef(IPin *iface);
-ULONG WINAPI BasePinImpl_Release(IPin *iface);
-HRESULT WINAPI BaseInputPinImpl_Disconnect(IPin * iface);
-HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin);
-HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt);
-HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo);
-HRESULT WINAPI BasePinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir);
-HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id);
-HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
-HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
-HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
-HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *pin,
IMediaSample **sample, REFERENCE_TIME *start, REFERENCE_TIME *stop, DWORD flags);
@@ -130,16 +116,7 @@ void strmbase_source_cleanup(struct strmbase_source *pin);
void strmbase_source_init(struct strmbase_source *pin, struct strmbase_filter *filter,
const WCHAR *name, const struct strmbase_source_ops *func_table);
-/* Base Input Pin */
-HRESULT WINAPI BaseInputPinImpl_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt);
-HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
-HRESULT WINAPI BaseInputPinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
-HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface);
-HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
-HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
-HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
-
-void strmbase_sink_init(struct strmbase_sink *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
+void strmbase_sink_init(struct strmbase_sink *pin, struct strmbase_filter *filter,
const WCHAR *name, const struct strmbase_sink_ops *ops, IMemAllocator *allocator);
void strmbase_sink_cleanup(struct strmbase_sink *pin);
--
2.24.0
Dec. 13, 2019
[PATCH v3 7/8] wineqtdecoder: Use base sink streaming methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wineqtdecoder/qtsplitter.c | 33 ++++-----------------------------
1 file changed, 4 insertions(+), 29 deletions(-)
diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index 01ec4c2cede..df6e8ea5d24 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -1030,31 +1030,6 @@ static HRESULT QT_Process_Movie(QTSplitter* filter)
return hr;
}
-static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI QTInPin_EndFlush(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI QTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
-{
- BasePinImpl_NewSegment(iface, tStart, tStop, dRate);
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
static const IPinVtbl QT_InputPin_Vtbl = {
BasePinImpl_QueryInterface,
BasePinImpl_AddRef,
@@ -1070,10 +1045,10 @@ static const IPinVtbl QT_InputPin_Vtbl = {
BasePinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
- QTInPin_EndOfStream,
- QTInPin_BeginFlush,
- QTInPin_EndFlush,
- QTInPin_NewSegment
+ BaseInputPinImpl_EndOfStream,
+ BaseInputPinImpl_BeginFlush,
+ BaseInputPinImpl_EndFlush,
+ BaseInputPinImpl_NewSegment
};
static inline QTOutPin *impl_source_from_strmbase_pin(struct strmbase_pin *iface)
--
2.24.0
Dec. 13, 2019
[PATCH v3 6/8] winegstreamer: Use base sink streaming methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/winegstreamer/gstdemux.c | 36 ++++-------------------------------
1 file changed, 4 insertions(+), 32 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index fb60d69e2ac..1eae0dae9af 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -1967,34 +1967,6 @@ static HRESULT GST_RemoveOutputPins(struct gstdemux *This)
return S_OK;
}
-static HRESULT WINAPI GSTInPin_EndOfStream(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI GSTInPin_BeginFlush(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI GSTInPin_EndFlush(IPin *iface)
-{
- FIXME("iface %p, stub!\n", iface);
- return S_OK;
-}
-
-static HRESULT WINAPI GSTInPin_NewSegment(IPin *iface, REFERENCE_TIME start,
- REFERENCE_TIME stop, double rate)
-{
- FIXME("iface %p, start %s, stop %s, rate %.16e, stub!\n",
- iface, wine_dbgstr_longlong(start), wine_dbgstr_longlong(stop), rate);
-
- BasePinImpl_NewSegment(iface, start, stop, rate);
- return S_OK;
-}
-
static const IPinVtbl GST_InputPin_Vtbl = {
BasePinImpl_QueryInterface,
BasePinImpl_AddRef,
@@ -2010,10 +1982,10 @@ static const IPinVtbl GST_InputPin_Vtbl = {
BasePinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
- GSTInPin_EndOfStream,
- GSTInPin_BeginFlush,
- GSTInPin_EndFlush,
- GSTInPin_NewSegment
+ BaseInputPinImpl_EndOfStream,
+ BaseInputPinImpl_BeginFlush,
+ BaseInputPinImpl_EndFlush,
+ BaseInputPinImpl_NewSegment
};
pthread_mutex_t cb_list_lock = PTHREAD_MUTEX_INITIALIZER;
--
2.24.0
Dec. 13, 2019
[PATCH v3 5/8] strmbase/renderer: Use base sink streaming methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/strmbase/renderer.c | 137 ++++++++++++++++++---------------------
1 file changed, 63 insertions(+), 74 deletions(-)
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 7b9736ccfb2..a3ede130d63 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -40,77 +40,6 @@ static inline struct strmbase_renderer *impl_from_IPin(IPin *iface)
return CONTAINING_RECORD(iface, struct strmbase_renderer, sink.pin.IPin_iface);
}
-static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
-{
- struct strmbase_renderer *filter = impl_from_IPin(iface);
- IFilterGraph *graph = filter->filter.filterInfo.pGraph;
- IMediaEventSink *event_sink;
- HRESULT hr = S_OK;
-
- TRACE("iface %p.\n", iface);
-
- EnterCriticalSection(&filter->csRenderLock);
- filter->eos = TRUE;
-
- if (graph && SUCCEEDED(IFilterGraph_QueryInterface(graph,
- &IID_IMediaEventSink, (void **)&event_sink)))
- {
- IMediaEventSink_Notify(event_sink, EC_COMPLETE, S_OK,
- (LONG_PTR)&filter->filter.IBaseFilter_iface);
- IMediaEventSink_Release(event_sink);
- }
- RendererPosPassThru_EOS(filter->pPosition);
- SetEvent(filter->state_event);
-
- if (filter->pFuncsTable->pfnEndOfStream)
- hr = filter->pFuncsTable->pfnEndOfStream(filter);
- LeaveCriticalSection(&filter->csRenderLock);
- return hr;
-}
-
-static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
-{
- struct strmbase_renderer *pFilter = impl_from_IPin(iface);
- HRESULT hr;
-
- TRACE("iface %p.\n", iface);
-
- EnterCriticalSection(&pFilter->filter.csFilter);
- hr = BaseInputPinImpl_BeginFlush(iface);
- if (SUCCEEDED(hr))
- {
- BaseRendererImpl_ClearPendingSample(pFilter);
- SetEvent(pFilter->flush_event);
- }
- LeaveCriticalSection(&pFilter->filter.csFilter);
- return hr;
-}
-
-static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
-{
- struct strmbase_renderer *pFilter = impl_from_IPin(iface);
- HRESULT hr;
-
- TRACE("iface %p.\n", iface);
-
- EnterCriticalSection(&pFilter->filter.csFilter);
- EnterCriticalSection(&pFilter->csRenderLock);
- pFilter->eos = FALSE;
- hr = BaseInputPinImpl_EndFlush(iface);
- if (SUCCEEDED(hr))
- {
- QualityControlRender_Start(pFilter->qcimpl, pFilter->stream_start);
- RendererPosPassThru_ResetMediaTime(pFilter->pPosition);
- ResetEvent(pFilter->flush_event);
-
- if (pFilter->pFuncsTable->pfnEndFlush)
- hr = pFilter->pFuncsTable->pfnEndFlush(pFilter);
- }
- LeaveCriticalSection(&pFilter->csRenderLock);
- LeaveCriticalSection(&pFilter->filter.csFilter);
- return hr;
-}
-
static const IPinVtbl BaseRenderer_InputPin_Vtbl =
{
BasePinImpl_QueryInterface,
@@ -127,9 +56,9 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl =
BasePinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
- BaseRenderer_InputPin_EndOfStream,
- BaseRenderer_InputPin_BeginFlush,
- BaseRenderer_InputPin_EndFlush,
+ BaseInputPinImpl_EndOfStream,
+ BaseInputPinImpl_BeginFlush,
+ BaseInputPinImpl_EndFlush,
BaseInputPinImpl_NewSegment
};
@@ -289,6 +218,63 @@ static void sink_disconnect(struct strmbase_sink *iface)
filter->pFuncsTable->pfnBreakConnect(filter);
}
+static HRESULT sink_eos(struct strmbase_sink *iface)
+{
+ struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
+ IFilterGraph *graph = filter->filter.filterInfo.pGraph;
+ IMediaEventSink *event_sink;
+ HRESULT hr;
+
+ EnterCriticalSection(&filter->csRenderLock);
+
+ filter->eos = TRUE;
+
+ if (graph && SUCCEEDED(IFilterGraph_QueryInterface(graph,
+ &IID_IMediaEventSink, (void **)&event_sink)))
+ {
+ IMediaEventSink_Notify(event_sink, EC_COMPLETE, S_OK,
+ (LONG_PTR)&filter->filter.IBaseFilter_iface);
+ IMediaEventSink_Release(event_sink);
+ }
+ RendererPosPassThru_EOS(filter->pPosition);
+ SetEvent(filter->state_event);
+
+ if (filter->pFuncsTable->pfnEndOfStream)
+ hr = filter->pFuncsTable->pfnEndOfStream(filter);
+
+ LeaveCriticalSection(&filter->csRenderLock);
+ return hr;
+}
+
+static HRESULT sink_begin_flush(struct strmbase_sink *iface)
+{
+ struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
+
+ BaseRendererImpl_ClearPendingSample(filter);
+ SetEvent(filter->flush_event);
+
+ return S_OK;
+}
+
+static HRESULT sink_end_flush(struct strmbase_sink *iface)
+{
+ struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
+ HRESULT hr = S_OK;
+
+ EnterCriticalSection(&filter->csRenderLock);
+
+ filter->eos = FALSE;
+ QualityControlRender_Start(filter->qcimpl, filter->stream_start);
+ RendererPosPassThru_ResetMediaTime(filter->pPosition);
+ ResetEvent(filter->flush_event);
+
+ if (filter->pFuncsTable->pfnEndFlush)
+ hr = filter->pFuncsTable->pfnEndFlush(filter);
+
+ LeaveCriticalSection(&filter->csRenderLock);
+ return hr;
+}
+
static const struct strmbase_sink_ops sink_ops =
{
.base.pin_query_accept = sink_query_accept,
@@ -297,6 +283,9 @@ static const struct strmbase_sink_ops sink_ops =
.pfnReceive = BaseRenderer_Receive,
.sink_connect = sink_connect,
.sink_disconnect = sink_disconnect,
+ .sink_eos = sink_eos,
+ .sink_begin_flush = sink_begin_flush,
+ .sink_end_flush = sink_end_flush,
};
void strmbase_renderer_cleanup(struct strmbase_renderer *filter)
--
2.24.0
Dec. 13, 2019
[PATCH v3 4/8] strmbase/transform: Use base sink streaming methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/strmbase/transform.c | 116 ++++++++++++++++++--------------------
1 file changed, 54 insertions(+), 62 deletions(-)
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index 993e30202bc..69dc93affe1 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -229,6 +229,52 @@ static void sink_disconnect(struct strmbase_sink *iface)
filter->pFuncsTable->pfnBreakConnect(filter, PINDIR_INPUT);
}
+static HRESULT sink_eos(struct strmbase_sink *iface)
+{
+ TransformFilter *filter = impl_from_sink_IPin(&iface->pin.IPin_iface);
+
+ if (filter->source.pin.peer)
+ return IPin_EndOfStream(filter->source.pin.peer);
+ return VFW_E_NOT_CONNECTED;
+}
+
+static HRESULT sink_begin_flush(struct strmbase_sink *iface)
+{
+ TransformFilter *filter = impl_from_sink_IPin(&iface->pin.IPin_iface);
+ HRESULT hr = S_OK;
+
+ if (filter->pFuncsTable->pfnBeginFlush)
+ hr = filter->pFuncsTable->pfnBeginFlush(filter);
+ if (SUCCEEDED(hr) && filter->source.pin.peer)
+ hr = IPin_BeginFlush(filter->source.pin.peer);
+ return hr;
+}
+
+static HRESULT sink_end_flush(struct strmbase_sink *iface)
+{
+ TransformFilter *filter = impl_from_sink_IPin(&iface->pin.IPin_iface);
+ HRESULT hr = S_OK;
+
+ if (filter->pFuncsTable->pfnEndFlush)
+ hr = filter->pFuncsTable->pfnEndFlush(filter);
+ if (SUCCEEDED(hr) && filter->source.pin.peer)
+ hr = IPin_EndFlush(filter->source.pin.peer);
+ return hr;
+}
+
+static HRESULT sink_new_segment(struct strmbase_sink *iface,
+ REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
+{
+ TransformFilter *filter = impl_from_sink_IPin(&iface->pin.IPin_iface);
+ HRESULT hr = S_OK;
+
+ if (filter->pFuncsTable->pfnNewSegment)
+ hr = filter->pFuncsTable->pfnNewSegment(filter, start, stop, rate);
+ if (SUCCEEDED(hr) && filter->source.pin.peer)
+ hr = IPin_NewSegment(filter->source.pin.peer, start, stop, rate);
+ return hr;
+}
+
static const struct strmbase_sink_ops sink_ops =
{
.base.pin_query_accept = sink_query_accept,
@@ -237,6 +283,10 @@ static const struct strmbase_sink_ops sink_ops =
.pfnReceive = TransformFilter_Input_Receive,
.sink_connect = sink_connect,
.sink_disconnect = sink_disconnect,
+ .sink_eos = sink_eos,
+ .sink_begin_flush = sink_begin_flush,
+ .sink_end_flush = sink_end_flush,
+ .sink_new_segment = sink_new_segment,
};
static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
@@ -405,64 +455,6 @@ HRESULT strmbase_transform_create(LONG filter_size, IUnknown *outer, const CLSID
return E_FAIL;
}
-static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
-{
- TransformFilter *filter = impl_from_sink_IPin(iface);
-
- TRACE("iface %p.\n", iface);
-
- if (filter->source.pin.peer)
- return IPin_EndOfStream(filter->source.pin.peer);
- return VFW_E_NOT_CONNECTED;
-}
-
-static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
-{
- TransformFilter *pTransform = impl_from_sink_IPin(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p)->()\n", iface);
-
- EnterCriticalSection(&pTransform->filter.csFilter);
- if (pTransform->pFuncsTable->pfnBeginFlush)
- hr = pTransform->pFuncsTable->pfnBeginFlush(pTransform);
- if (SUCCEEDED(hr))
- hr = BaseInputPinImpl_BeginFlush(iface);
- LeaveCriticalSection(&pTransform->filter.csFilter);
- return hr;
-}
-
-static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
-{
- TransformFilter *pTransform = impl_from_sink_IPin(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p)->()\n", iface);
-
- EnterCriticalSection(&pTransform->filter.csFilter);
- if (pTransform->pFuncsTable->pfnEndFlush)
- hr = pTransform->pFuncsTable->pfnEndFlush(pTransform);
- if (SUCCEEDED(hr))
- hr = BaseInputPinImpl_EndFlush(iface);
- LeaveCriticalSection(&pTransform->filter.csFilter);
- return hr;
-}
-
-static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
-{
- TransformFilter *pTransform = impl_from_sink_IPin(iface);
- HRESULT hr = S_OK;
-
- TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
- iface, debugstr_time(tStart), debugstr_time(tStop), dRate);
-
- if (pTransform->pFuncsTable->pfnNewSegment)
- hr = pTransform->pFuncsTable->pfnNewSegment(pTransform, tStart, tStop, dRate);
- if (SUCCEEDED(hr))
- hr = BaseInputPinImpl_NewSegment(iface, tStart, tStop, dRate);
- return hr;
-}
-
static const IPinVtbl TransformFilter_InputPin_Vtbl =
{
BasePinImpl_QueryInterface,
@@ -479,8 +471,8 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
BasePinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
- TransformFilter_InputPin_EndOfStream,
- TransformFilter_InputPin_BeginFlush,
- TransformFilter_InputPin_EndFlush,
- TransformFilter_InputPin_NewSegment
+ BaseInputPinImpl_EndOfStream,
+ BaseInputPinImpl_BeginFlush,
+ BaseInputPinImpl_EndFlush,
+ BaseInputPinImpl_NewSegment
};
--
2.24.0
Dec. 13, 2019
[PATCH v3 3/8] strmbase: Introduce callbacks for streaming events.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
v3: call sink_begin_flush()/sink_end_flush() in a more sensible place
dlls/strmbase/pin.c | 42 +++++++++++++++++++++++++++++------------
include/wine/strmbase.h | 4 ++++
2 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index 3dd00b27ccc..177d52740dc 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -718,6 +718,9 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface)
TRACE("(%p)->()\n", This);
+ if (This->pFuncsTable->sink_eos)
+ return This->pFuncsTable->sink_eos(This);
+
EnterCriticalSection(&This->pin.filter->csFilter);
if (This->flushing)
hr = S_FALSE;
@@ -735,15 +738,21 @@ static HRESULT deliver_beginflush(IPin* pin, LPVOID unused)
HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface)
{
- struct strmbase_sink *This = impl_sink_from_IPin(iface);
+ struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr;
- TRACE("(%p) semi-stub\n", This);
- EnterCriticalSection(&This->pin.filter->csFilter);
- This->flushing = TRUE;
+ TRACE("pin %p.\n", pin);
- hr = SendFurther(This, deliver_beginflush, NULL);
- LeaveCriticalSection(&This->pin.filter->csFilter);
+ EnterCriticalSection(&pin->pin.filter->csFilter);
+
+ pin->flushing = TRUE;
+
+ if (pin->pFuncsTable->sink_begin_flush)
+ hr = pin->pFuncsTable->sink_begin_flush(pin);
+ else
+ hr = SendFurther(pin, deliver_beginflush, NULL);
+
+ LeaveCriticalSection(&pin->pin.filter->csFilter);
return hr;
}
@@ -755,15 +764,21 @@ static HRESULT deliver_endflush(IPin* pin, LPVOID unused)
HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface)
{
- struct strmbase_sink *This = impl_sink_from_IPin(iface);
+ struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr;
- TRACE("(%p)->()\n", This);
- EnterCriticalSection(&This->pin.filter->csFilter);
- This->flushing = FALSE;
+ TRACE("pin %p.\n", pin);
- hr = SendFurther(This, deliver_endflush, NULL);
- LeaveCriticalSection(&This->pin.filter->csFilter);
+ EnterCriticalSection(&pin->pin.filter->csFilter);
+
+ pin->flushing = FALSE;
+
+ if (pin->pFuncsTable->sink_end_flush)
+ hr = pin->pFuncsTable->sink_end_flush(pin);
+ else
+ hr = SendFurther(pin, deliver_endflush, NULL);
+
+ LeaveCriticalSection(&pin->pin.filter->csFilter);
return hr;
}
@@ -788,6 +803,9 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME start, R
TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
iface, debugstr_time(start), debugstr_time(stop), rate);
+ if (pin->pFuncsTable->sink_new_segment)
+ return pin->pFuncsTable->sink_new_segment(pin, start, stop, rate);
+
args.tStart = start;
args.tStop = stop;
args.rate = rate;
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 83ad2e0bd6e..c01ef6133f4 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -95,6 +95,10 @@ struct strmbase_sink_ops
BaseInputPin_Receive pfnReceive;
HRESULT (*sink_connect)(struct strmbase_sink *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
void (*sink_disconnect)(struct strmbase_sink *pin);
+ HRESULT (*sink_eos)(struct strmbase_sink *pin);
+ HRESULT (*sink_begin_flush)(struct strmbase_sink *pin);
+ HRESULT (*sink_end_flush)(struct strmbase_sink *pin);
+ HRESULT (*sink_new_segment)(struct strmbase_sink *pin, REFERENCE_TIME start, REFERENCE_TIME stop, double rate);
};
/* Base Pin */
--
2.24.0
Dec. 13, 2019
[PATCH v3 2/8] wineqtdecoder: Use base sink connection methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wineqtdecoder/qtsplitter.c | 206 ++++++++++++--------------------
1 file changed, 75 insertions(+), 131 deletions(-)
diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index c8a34cbf95e..01ec4c2cede 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -228,7 +228,6 @@ static struct strmbase_pin *qt_splitter_get_pin(struct strmbase_filter *base, un
static void qt_splitter_destroy(struct strmbase_filter *iface)
{
QTSplitter *filter = impl_from_strmbase_filter(iface);
- IPin *peer = NULL;
EnterCriticalSection(&filter->csReceive);
/* Don't need to clean up output pins, disconnecting input pin will do that */
@@ -285,13 +284,15 @@ static HRESULT qt_splitter_start_stream(struct strmbase_filter *iface, REFERENCE
EnterCriticalSection(&filter->csReceive);
if (filter->pVideo_Pin)
- pin_hr = BaseOutputPinImpl_Active(&filter->pVideo_Pin->pin);
- if (SUCCEEDED(pin_hr))
- hr = pin_hr;
+ {
+ if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->pVideo_Pin->pin)))
+ hr = pin_hr;
+ }
if (filter->pAudio_Pin)
- pin_hr = BaseOutputPinImpl_Active(&filter->pAudio_Pin->pin);
- if (SUCCEEDED(pin_hr))
- hr = pin_hr;
+ {
+ if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->pAudio_Pin->pin)))
+ hr = pin_hr;
+ }
SetEvent(filter->runEvent);
LeaveCriticalSection(&filter->csReceive);
@@ -331,10 +332,75 @@ static HRESULT sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE
return S_FALSE;
}
+static HRESULT QT_Process_Movie(QTSplitter *filter);
+
+static HRESULT qt_splitter_sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
+{
+ QTSplitter *filter = impl_from_strmbase_filter(iface->pin.filter);
+ ALLOCATOR_PROPERTIES props;
+ IMemAllocator *allocator;
+ HRESULT hr = S_OK;
+
+ filter->pInputPin.pReader = NULL;
+
+ if (FAILED(hr = IPin_QueryInterface(peer, &IID_IAsyncReader, (void **)&filter->pInputPin.pReader)))
+ return hr;
+
+ if (FAILED(hr = QT_Process_Movie(filter)))
+ {
+ IAsyncReader_Release(filter->pInputPin.pReader);
+ filter->pInputPin.pReader = NULL;
+ return hr;
+ }
+
+ filter->pInputPin.pAlloc = NULL;
+ props.cBuffers = 8;
+ props.cbAlign = 1;
+ props.cbBuffer = filter->outputSize + props.cbAlign;
+ props.cbPrefix = 0;
+
+ /* Some applications depend on IAsyncReader::RequestAllocator() passing a
+ * non-NULL preferred allocator. */
+ hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC,
+ &IID_IMemAllocator, (void **)&allocator);
+ if (FAILED(hr))
+ goto err;
+
+ hr = IAsyncReader_RequestAllocator(filter->pInputPin.pReader, allocator, &props, &filter->pInputPin.pAlloc);
+ IMemAllocator_Release(allocator);
+ if (FAILED(hr))
+ {
+ WARN("Failed to get allocator, hr %#x.\n", hr);
+ goto err;
+ }
+
+ if (FAILED(hr = IMemAllocator_Commit(filter->pInputPin.pAlloc)))
+ {
+ WARN("Failed to commit allocator, hr %#x.\n", hr);
+ goto err;
+ }
+
+ return S_OK;
+err:
+ QT_RemoveOutputPins(filter);
+ IAsyncReader_Release(filter->pInputPin.pReader);
+ return hr;
+}
+
+static void qt_splitter_sink_disconnect(struct strmbase_sink *iface)
+{
+ QTSplitter *filter = impl_from_strmbase_filter(iface->pin.filter);
+
+ IMemAllocator_Decommit(filter->pInputPin.pAlloc);
+ QT_RemoveOutputPins(filter);
+}
+
static const struct strmbase_sink_ops sink_ops =
{
.base.pin_query_accept = sink_query_accept,
.base.pin_get_media_type = strmbase_pin_get_media_type,
+ .sink_connect = qt_splitter_sink_connect,
+ .sink_disconnect = qt_splitter_sink_disconnect,
};
IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
@@ -964,128 +1030,6 @@ static HRESULT QT_Process_Movie(QTSplitter* filter)
return hr;
}
-static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
-{
- HRESULT hr = S_OK;
- ALLOCATOR_PROPERTIES props;
- QTInPin *This = impl_from_IPin(iface);
- QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter);
- IMemAllocator *pAlloc;
-
- TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
-
- EnterCriticalSection(&filter->filter.csFilter);
- This->pReader = NULL;
-
- if (This->pin.pin.peer)
- hr = VFW_E_ALREADY_CONNECTED;
- else if (IPin_QueryAccept(iface, pmt) != S_OK)
- hr = VFW_E_TYPE_NOT_ACCEPTED;
- else
- {
- PIN_DIRECTION pindirReceive;
- IPin_QueryDirection(pReceivePin, &pindirReceive);
- if (pindirReceive != PINDIR_OUTPUT)
- hr = VFW_E_INVALID_DIRECTION;
- }
-
- if (FAILED(hr))
- {
- LeaveCriticalSection(&filter->filter.csFilter);
- return hr;
- }
-
- hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
- if (FAILED(hr))
- {
- LeaveCriticalSection(&filter->filter.csFilter);
- TRACE("Input source is not an AsyncReader\n");
- return hr;
- }
-
- LeaveCriticalSection(&filter->filter.csFilter);
- EnterCriticalSection(&filter->filter.csFilter);
- hr = QT_Process_Movie(filter);
- if (FAILED(hr))
- {
- IAsyncReader_Release(This->pReader);
- This->pReader = NULL;
- LeaveCriticalSection(&filter->filter.csFilter);
- TRACE("Unable to process movie\n");
- return hr;
- }
-
- This->pAlloc = NULL;
- props.cBuffers = 8;
- props.cbAlign = 1;
- props.cbBuffer = filter->outputSize + props.cbAlign;
- props.cbPrefix = 0;
- hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC,
- &IID_IMemAllocator, (LPVOID *)&pAlloc);
- if (SUCCEEDED(hr))
- {
- /* A certain IAsyncReader::RequestAllocator expects to be passed
- non-NULL preferred allocator */
- hr = IAsyncReader_RequestAllocator(This->pReader, pAlloc, &props, &This->pAlloc);
- if (FAILED(hr))
- WARN("Can't get an allocator, got %08x\n", hr);
- IMemAllocator_Release(pAlloc);
- }
-
- if (SUCCEEDED(hr))
- {
- CopyMediaType(&This->pin.mt, pmt);
- This->pin.peer = pReceivePin;
- IPin_AddRef(pReceivePin);
- hr = IMemAllocator_Commit(This->pAlloc);
- }
- else
- {
- QT_RemoveOutputPins(filter);
- if (This->pReader)
- IAsyncReader_Release(This->pReader);
- This->pReader = NULL;
- if (This->pAlloc)
- IMemAllocator_Release(This->pAlloc);
- This->pAlloc = NULL;
- }
- TRACE("Size: %i\n", props.cbBuffer);
- LeaveCriticalSection(&filter->filter.csFilter);
-
- return hr;
-}
-
-static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
-{
- HRESULT hr;
- QTInPin *This = impl_from_IPin(iface);
- QTSplitter *filter = impl_from_strmbase_filter(This->pin.pin.filter);
- FILTER_STATE state;
- TRACE("()\n");
-
- hr = IBaseFilter_GetState(&filter->filter.IBaseFilter_iface, INFINITE, &state);
- EnterCriticalSection(&filter->filter.csFilter);
- if (This->pin.pin.peer)
- {
- QTSplitter *Parser = impl_from_strmbase_filter(This->pin.pin.filter);
-
- if (SUCCEEDED(hr) && state == State_Stopped)
- {
- IMemAllocator_Decommit(This->pAlloc);
- IPin_Disconnect(This->pin.pin.peer);
- IPin_Release(This->pin.pin.peer);
- This->pin.pin.peer = NULL;
- hr = QT_RemoveOutputPins(Parser);
- }
- else
- hr = VFW_E_NOT_STOPPED;
- }
- else
- hr = S_FALSE;
- LeaveCriticalSection(&filter->filter.csFilter);
- return hr;
-}
-
static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface)
{
FIXME("iface %p, stub!\n", iface);
@@ -1116,8 +1060,8 @@ static const IPinVtbl QT_InputPin_Vtbl = {
BasePinImpl_AddRef,
BasePinImpl_Release,
BaseInputPinImpl_Connect,
- QTInPin_ReceiveConnection,
- QTInPin_Disconnect,
+ BaseInputPinImpl_ReceiveConnection,
+ BaseInputPinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo,
--
2.24.0
Dec. 13, 2019
[PATCH v3 1/8] wineqtdecoder: Store the sink as a strmbase_sink structure.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wineqtdecoder/qtsplitter.c | 43 ++++++++++++++-------------------
1 file changed, 18 insertions(+), 25 deletions(-)
diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index d861110f5f1..c8a34cbf95e 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -138,7 +138,7 @@ typedef struct QTOutPin {
} QTOutPin;
typedef struct QTInPin {
- struct strmbase_pin pin;
+ struct strmbase_sink pin;
GUID subType;
IAsyncReader *pReader;
@@ -199,7 +199,7 @@ static inline QTSplitter *impl_from_IBaseFilter( IBaseFilter *iface )
static inline QTInPin *impl_from_IPin(IPin *iface)
{
- return CONTAINING_RECORD(iface, QTInPin, pin.IPin_iface);
+ return CONTAINING_RECORD(iface, QTInPin, pin.pin.IPin_iface);
}
/*
@@ -211,7 +211,7 @@ static struct strmbase_pin *qt_splitter_get_pin(struct strmbase_filter *base, un
QTSplitter *filter = impl_from_strmbase_filter(base);
if (index == 0)
- return &filter->pInputPin.pin;
+ return &filter->pInputPin.pin.pin;
else if (index == 1)
{
if (filter->pVideo_Pin)
@@ -232,18 +232,15 @@ static void qt_splitter_destroy(struct strmbase_filter *iface)
EnterCriticalSection(&filter->csReceive);
/* Don't need to clean up output pins, disconnecting input pin will do that */
+ if (filter->pInputPin.pin.pin.peer)
+ IPin_Disconnect(filter->pInputPin.pin.pin.peer);
- if (filter->pInputPin.pin.peer)
- IPin_Disconnect(filter->pInputPin.pin.peer);
-
- FreeMediaType(&filter->pInputPin.pin.mt);
if (filter->pInputPin.pAlloc)
IMemAllocator_Release(filter->pInputPin.pAlloc);
filter->pInputPin.pAlloc = NULL;
if (filter->pInputPin.pReader)
IAsyncReader_Release(filter->pInputPin.pReader);
filter->pInputPin.pReader = NULL;
- filter->pInputPin.pin.IPin_iface.lpVtbl = NULL;
if (filter->pQTMovie)
{
@@ -274,6 +271,7 @@ static void qt_splitter_destroy(struct strmbase_filter *iface)
filter->csReceive.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->csReceive);
+ strmbase_sink_cleanup(&filter->pInputPin.pin);
strmbase_filter_cleanup(&filter->filter);
CoTaskMemFree(filter);
@@ -333,10 +331,10 @@ static HRESULT sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE
return S_FALSE;
}
-static const BasePinFuncTable sink_ops =
+static const struct strmbase_sink_ops sink_ops =
{
- .pin_query_accept = sink_query_accept,
- .pin_get_media_type = strmbase_pin_get_media_type,
+ .base.pin_query_accept = sink_query_accept,
+ .base.pin_get_media_type = strmbase_pin_get_media_type,
};
IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
@@ -357,6 +355,8 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
ZeroMemory(This,sizeof(*This));
strmbase_filter_init(&This->filter, outer, &CLSID_QTSplitter, &filter_ops);
+ strmbase_sink_init(&This->pInputPin.pin, &QT_InputPin_Vtbl, &This->filter,
+ wcsInputPinName, &sink_ops, NULL);
InitializeCriticalSection(&This->csReceive);
This->csReceive.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": QTSplitter.csReceive");
@@ -366,13 +366,6 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
This->aSession = NULL;
This->runEvent = CreateEventW(NULL, 0, 0, NULL);
- This->pInputPin.pin.dir = PINDIR_INPUT;
- This->pInputPin.pin.filter = &This->filter;
- lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
- This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl;
- This->pInputPin.pin.peer = NULL;
- This->pInputPin.pin.pFuncsTable = &sink_ops;
-
*phr = S_OK;
return &This->filter.IUnknown_inner;
}
@@ -984,7 +977,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
EnterCriticalSection(&filter->filter.csFilter);
This->pReader = NULL;
- if (This->pin.peer)
+ if (This->pin.pin.peer)
hr = VFW_E_ALREADY_CONNECTED;
else if (IPin_QueryAccept(iface, pmt) != S_OK)
hr = VFW_E_TYPE_NOT_ACCEPTED;
@@ -1066,22 +1059,22 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
{
HRESULT hr;
QTInPin *This = impl_from_IPin(iface);
- QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter);
+ QTSplitter *filter = impl_from_strmbase_filter(This->pin.pin.filter);
FILTER_STATE state;
TRACE("()\n");
hr = IBaseFilter_GetState(&filter->filter.IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(&filter->filter.csFilter);
- if (This->pin.peer)
+ if (This->pin.pin.peer)
{
- QTSplitter *Parser = impl_from_strmbase_filter(This->pin.filter);
+ QTSplitter *Parser = impl_from_strmbase_filter(This->pin.pin.filter);
if (SUCCEEDED(hr) && state == State_Stopped)
{
IMemAllocator_Decommit(This->pAlloc);
- IPin_Disconnect(This->pin.peer);
- IPin_Release(This->pin.peer);
- This->pin.peer = NULL;
+ IPin_Disconnect(This->pin.pin.peer);
+ IPin_Release(This->pin.pin.peer);
+ This->pin.pin.peer = NULL;
hr = QT_RemoveOutputPins(Parser);
}
else
--
2.24.0
Dec. 13, 2019
[PATCH v2 2/2] gdiplus: GdipGraphicsClear() should overwrite pixels, not alpha blend
by Damjan Jovanovic
All sample code in the Python Pyglet library suffers from terrible
text corruption, caused by the inability to erase the background
between rendering sequential font glyphs, resulting in leftovers
from previous letters mixing with the image of new letters.
This is because it attempts to erase the background by calling
GdipGraphicsClear() with ARGB color 0x00000000 (completely
transparent black), and in our gdiplus alpha blending that into
the background has no effect. It should be using
CompositeModeSourceCopy to overwrite the background with that brush
instead.
Try 2 split the patch.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30506
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com>
---
dlls/gdiplus/graphics.c | 4 ++++
dlls/gdiplus/tests/image.c | 43 ++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
Dec. 13, 2019
[PATCH v2 1/2] gdiplus: start implementing CompositingModeSourceCopy
by Damjan Jovanovic
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30506
Signed-off-by: Damjan Jovanovic <damjan.jov(a)gmail.com>
---
dlls/gdiplus/graphics.c | 22 +++++++++++++++-------
dlls/gdiplus/tests/image.c | 4 ++--
2 files changed, 17 insertions(+), 9 deletions(-)
Dec. 13, 2019
Re: [PATCH vkd3d 1/2] vkd3d: Add queries for KHR_timeline_semaphore extension.
by Conor McCarthy
On Fri, Dec 13, 2019 at 5:03 AM Rémi Bernon <rbernon(a)codeweavers.com> wrote:
> +
> + timeline_semaphore = &info->timeline_semaphore_properties;
> + TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n");
> + TRACE(" maxTimelineSemaphoreValueDifference: %u.\n",
> timeline_semaphore->maxTimelineSemaphoreValueDifference);
> }
>
maxTimelineSemaphoreValueDifference is declared as uint64_t, so this causes
a format argument warning.
Conor
Dec. 13, 2019
[PATCH 3/3] configure: Remove no-longer-needed check for mach-o/dyld_images.h header file.
by Ken Thomases
Signed-off-by: Ken Thomases <ken(a)codeweavers.com>
---
configure.ac | 8 --------
1 file changed, 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7fc85841caf..2117e500f90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -648,14 +648,6 @@ AC_CHECK_HEADERS([linux/ipx.h linux/irda.h linux/rtnetlink.h],,,
# include <linux/types.h>
#endif])
-AC_CHECK_HEADERS([mach-o/dyld_images.h],,,
- [#ifdef HAVE_STDBOOL_H
- # include <stdbool.h>
- #endif
- #ifdef HAVE_STDINT_H
- # include <stdint.h>
- #endif])
-
AC_CHECK_HEADERS([resolv.h],,,
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
--
2.21.0
Dec. 13, 2019
[PATCH 2/3] dbghelp: Fix reading the target's dyld image info, based on its CPU architecture.
by Ken Thomases
Signed-off-by: Ken Thomases <ken(a)codeweavers.com>
---
dlls/dbghelp/macho_module.c | 134 ++++++++++++++++++++++++++----------
1 file changed, 97 insertions(+), 37 deletions(-)
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 8eda11ab91c..f957439d435 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -60,23 +60,39 @@
#include <mach-o/nlist.h>
#include <mach-o/dyld.h>
-#ifdef HAVE_MACH_O_DYLD_IMAGES_H
-#include <mach-o/dyld_images.h>
-#else
-struct dyld_image_info {
- const struct mach_header *imageLoadAddress;
- const char *imageFilePath;
- uintptr_t imageFileModDate;
+struct dyld_image_info32 {
+ uint32_t /* const struct mach_header* */ imageLoadAddress;
+ uint32_t /* const char* */ imageFilePath;
+ uint32_t /* uintptr_t */ imageFileModDate;
};
-struct dyld_all_image_infos {
- uint32_t version;
- uint32_t infoArrayCount;
- const struct dyld_image_info *infoArray;
- void* notification;
- int processDetachedFromSharedRegion;
+struct dyld_all_image_infos32 {
+ uint32_t version;
+ uint32_t infoArrayCount;
+ uint32_t /* const struct dyld_image_info* */ infoArray;
+};
+
+struct dyld_image_info64 {
+ uint64_t /* const struct mach_header* */ imageLoadAddress;
+ uint64_t /* const char* */ imageFilePath;
+ uint64_t /* uintptr_t */ imageFileModDate;
+};
+
+struct dyld_all_image_infos64 {
+ uint32_t version;
+ uint32_t infoArrayCount;
+ uint64_t /* const struct dyld_image_info* */ infoArray;
+};
+
+union wine_image_info {
+ struct dyld_image_info32 info32;
+ struct dyld_image_info64 info64;
+};
+
+union wine_all_image_infos {
+ struct dyld_all_image_infos32 infos32;
+ struct dyld_all_image_infos64 infos64;
};
-#endif
#ifdef WORDS_BIGENDIAN
#define swap_ulong_be_to_host(n) (n)
@@ -1649,8 +1665,8 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
const WCHAR* main_name,
enum_modules_cb cb, void* user)
{
- struct dyld_all_image_infos image_infos;
- struct dyld_image_info* info_array = NULL;
+ union wine_all_image_infos image_infos;
+ union wine_image_info* info_array = NULL;
unsigned long len;
int i;
char bufstr[256];
@@ -1660,31 +1676,55 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
TRACE("(%p/%p, %s, %p, %p)\n", pcs, pcs->handle, debugstr_w(main_name), cb,
user);
+ if (pcs->is_64bit)
+ len = sizeof(image_infos.infos64);
+ else
+ len = sizeof(image_infos.infos32);
if (!pcs->dbg_hdr_addr ||
!ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
- &image_infos, sizeof(image_infos), NULL) ||
- !image_infos.infoArray)
+ &image_infos, len, NULL))
goto done;
- TRACE("Process has %u image infos at %p\n", image_infos.infoArrayCount, image_infos.infoArray);
+ if (!pcs->is_64bit)
+ {
+ struct dyld_all_image_infos32 temp = image_infos.infos32;
+ image_infos.infos64.infoArrayCount = temp.infoArrayCount;
+ image_infos.infos64.infoArray = temp.infoArray;
+ }
+ if (!image_infos.infos64.infoArray)
+ goto done;
+ TRACE("Process has %u image infos at %p\n", image_infos.infos64.infoArrayCount, (void*)image_infos.infos64.infoArray);
- len = image_infos.infoArrayCount * sizeof(info_array[0]);
+ if (pcs->is_64bit)
+ len = sizeof(info_array->info64);
+ else
+ len = sizeof(info_array->info32);
+ len *= image_infos.infos64.infoArrayCount;
info_array = HeapAlloc(GetProcessHeap(), 0, len);
if (!info_array ||
- !ReadProcessMemory(pcs->handle, image_infos.infoArray,
+ !ReadProcessMemory(pcs->handle, (void*)image_infos.infos64.infoArray,
info_array, len, NULL))
goto done;
TRACE("... read image infos\n");
- for (i = 0; i < image_infos.infoArrayCount; i++)
+ for (i = 0; i < image_infos.infos64.infoArrayCount; i++)
{
- if (info_array[i].imageFilePath != NULL &&
- ReadProcessMemory(pcs->handle, info_array[i].imageFilePath, bufstr, sizeof(bufstr), NULL))
+ struct dyld_image_info64 info;
+ if (pcs->is_64bit)
+ info = info_array[i].info64;
+ else
+ {
+ struct dyld_image_info32 *info32 = &info_array->info32 + i;
+ info.imageLoadAddress = info32->imageLoadAddress;
+ info.imageFilePath = info32->imageFilePath;
+ }
+ if (info.imageFilePath &&
+ ReadProcessMemory(pcs->handle, (void*)info.imageFilePath, bufstr, sizeof(bufstr), NULL))
{
bufstr[sizeof(bufstr) - 1] = '\0';
TRACE("[%d] image file %s\n", i, debugstr_a(bufstr));
MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, ARRAY_SIZE(bufstrW));
if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
- if (!cb(bufstrW, (unsigned long)info_array[i].imageLoadAddress, user)) break;
+ if (!cb(bufstrW, info.imageLoadAddress, user)) break;
}
}
@@ -1764,27 +1804,47 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in
WCHAR *loader = get_wine_loader_name(pcs);
BOOL ret = FALSE;
ULONG_PTR dyld_image_info_address;
- struct dyld_all_image_infos image_infos;
- struct dyld_image_info image_info;
+ union wine_all_image_infos image_infos;
+ union wine_image_info image_info;
uint32_t len;
char path[PATH_MAX];
BOOL got_path = FALSE;
+ if (pcs->is_64bit)
+ len = sizeof(image_infos.infos64);
+ else
+ len = sizeof(image_infos.infos32);
dyld_image_info_address = get_dyld_image_info_address(pcs);
if (dyld_image_info_address &&
- ReadProcessMemory(pcs->handle, (void*)dyld_image_info_address, &image_infos, sizeof(image_infos), NULL) &&
- image_infos.infoArray && image_infos.infoArrayCount &&
- ReadProcessMemory(pcs->handle, image_infos.infoArray, &image_info, sizeof(image_info), NULL) &&
- image_info.imageFilePath)
+ ReadProcessMemory(pcs->handle, (void*)dyld_image_info_address, &image_infos, len, NULL))
{
- for (len = sizeof(path); len > 0; len /= 2)
+ if (pcs->is_64bit)
+ len = sizeof(image_info.info64);
+ else
{
- if (ReadProcessMemory(pcs->handle, image_info.imageFilePath, path, len, NULL))
+ struct dyld_all_image_infos32 temp = image_infos.infos32;
+ image_infos.infos64.infoArrayCount = temp.infoArrayCount;
+ image_infos.infos64.infoArray = temp.infoArray;
+ len = sizeof(image_info.info32);
+ }
+ if (image_infos.infos64.infoArray && image_infos.infos64.infoArrayCount &&
+ ReadProcessMemory(pcs->handle, (void*)image_infos.infos64.infoArray, &image_info, len, NULL))
+ {
+ if (!pcs->is_64bit)
+ {
+ struct dyld_image_info32 temp = image_info.info32;
+ image_info.info64.imageLoadAddress = temp.imageLoadAddress;
+ image_info.info64.imageFilePath = temp.imageFilePath;
+ }
+ for (len = sizeof(path); image_info.info64.imageFilePath && len > 0; len /= 2)
{
- path[len - 1] = 0;
- got_path = TRUE;
- TRACE("got executable path from target's dyld image info: %s\n", debugstr_a(path));
- break;
+ if (ReadProcessMemory(pcs->handle, (void*)image_info.info64.imageFilePath, path, len, NULL))
+ {
+ path[len - 1] = 0;
+ got_path = TRUE;
+ TRACE("got executable path from target's dyld image info: %s\n", debugstr_a(path));
+ break;
+ }
}
}
}
--
2.21.0
Dec. 13, 2019
[PATCH 1/3] dbghelp: Fix reading the address of the target's dyld image info from its PEB.
by Ken Thomases
Signed-off-by: Ken Thomases <ken(a)codeweavers.com>
---
dlls/dbghelp/macho_module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 9d83b006b7c..8eda11ab91c 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -1366,7 +1366,7 @@ static ULONG_PTR get_dyld_image_info_address(struct process* pcs)
if (status == STATUS_SUCCESS)
{
/* Read dyld image info address from PEB */
- if (!pcs->is_64bit)
+ if (pcs->is_64bit)
ret = ReadProcessMemory(pcs->handle, &pbi.PebBaseAddress->Reserved[0],
&dyld_image_info_address, sizeof(dyld_image_info_address), NULL);
else
--
2.21.0
Dec. 13, 2019
[PATCH 2/2] msado15: Implement _Recordset get_State
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 7 +++++--
dlls/msado15/tests/msado15.c | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index f0bb1591aa..8a5f7aad41 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -1057,8 +1057,10 @@ static HRESULT WINAPI recordset_get_Status( _Recordset *iface, LONG *status )
static HRESULT WINAPI recordset_get_State( _Recordset *iface, LONG *state )
{
- FIXME( "%p, %p\n", iface, state );
- return E_NOTIMPL;
+ struct recordset *recordset = impl_from_Recordset( iface );
+ TRACE( "%p, %p\n", recordset, state );
+ *state = recordset->state;
+ return S_OK;
}
static HRESULT WINAPI recordset__xClone( _Recordset *iface, _Recordset **obj )
@@ -1337,6 +1339,7 @@ HRESULT Recordset_create( void **obj )
recordset->Recordset_iface.lpVtbl = &recordset_vtbl;
recordset->refs = 1;
recordset->index = -1;
+ recordset->state = adStateClosed;
*obj = &recordset->Recordset_iface;
TRACE( "returning iface %p\n", *obj );
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 494f1be463..d3c1f30f6d 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -47,12 +47,17 @@ static void test_Recordset(void)
{
_Recordset *recordset;
Fields *fields, *fields2;
- LONG refs, count;
+ LONG refs, count, state;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset );
ok( hr == S_OK, "got %08x\n", hr );
+ state = -1;
+ hr = _Recordset_get_State( recordset, &state );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == adStateClosed, "got %d\n", state );
+
/* handing out fields object increases recordset refcount */
refs = get_refs_recordset( recordset );
ok( refs == 1, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
[PATCH 1/2] msado15: Prevent Multiple Open/Close of a _Recordset.
by Alistair Leslie-Hughes
Currently closing twice or Close/Release would cause a crash.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/recordset.c | 15 +++++++++++----
dlls/msado15/tests/msado15.c | 3 +++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index e854b3e824..f0bb1591aa 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -658,9 +658,12 @@ static void close_recordset( struct recordset *recordset )
{
ULONG row, col, col_count = get_column_count( recordset );
- recordset->fields->recordset = NULL;
- Fields_Release( &recordset->fields->Fields_iface );
- recordset->fields = NULL;
+ if (recordset->fields)
+ {
+ recordset->fields->recordset = NULL;
+ Fields_Release( &recordset->fields->Fields_iface );
+ recordset->fields = NULL;
+ }
for (row = 0; row < recordset->count; row++)
for (col = 0; col < col_count; col++) VariantClear( &recordset->data[row * col_count + col] );
@@ -668,6 +671,7 @@ static void close_recordset( struct recordset *recordset )
recordset->count = recordset->allocated = recordset->index = 0;
heap_free( recordset->data );
recordset->data = NULL;
+ recordset->state = adStateClosed;
}
static ULONG WINAPI recordset_Release( _Recordset *iface )
@@ -905,8 +909,9 @@ static HRESULT WINAPI recordset_Close( _Recordset *iface )
TRACE( "%p\n", recordset );
+ if (recordset->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
+
close_recordset( recordset );
- recordset->state = adStateClosed;
return S_OK;
}
@@ -960,6 +965,8 @@ static HRESULT WINAPI recordset_Open( _Recordset *iface, VARIANT source, VARIANT
FIXME( "%p, %s, %s, %d, %d, %d\n", recordset, debugstr_variant(&source), debugstr_variant(&active_connection),
cursor_type, lock_type, options );
+ if (recordset->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
+
recordset->state = adStateOpen;
return S_OK;
}
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index f9a5377c50..494f1be463 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -86,6 +86,9 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
+ hr = _Recordset_Close( recordset );
+ ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
+
refs = _Recordset_Release( recordset );
ok( !refs, "got %d\n", refs );
--
2.17.1
Dec. 13, 2019
Re: [PATCH 1/3] dmloader: Get rid of single use debugstr_dmreturn()
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62086
Your paranoid android.
=== debian10 (build log) ===
error: patch failed: dlls/dmloader/debug.c:43
error: patch failed: dlls/dmloader/debug.h:39
Task: Patch failed to apply
Dec. 13, 2019
[PATCH 3/3] dmloader: Simplify tracing of DMUS_CONTAINED_OBJF_KEEP flag
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dmloader/debug.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/dlls/dmloader/debug.c b/dlls/dmloader/debug.c
index 30e3fd69cc..1be92e72af 100644
--- a/dlls/dmloader/debug.c
+++ b/dlls/dmloader/debug.c
@@ -43,33 +43,6 @@ const char *resolve_STREAM_SEEK (DWORD flag) {
}
}
-/* generic flag-dumping function */
-static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
- static char buffer[128] = "", *ptr = &buffer[0];
- unsigned int i;
- int size = sizeof(buffer);
-
- for (i=0; i < num_names; i++) {
- if ((flags & names[i].val)) {
- int cnt = snprintf(ptr, size, "%s ", names[i].name);
- if (cnt < 0 || cnt >= size) break;
- size -= cnt;
- ptr += cnt;
- }
- }
-
- ptr = &buffer[0];
- return ptr;
-}
-
-/* dump DMUS_CONTAINED_OBJF flags */
-static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
- static const flag_info flags[] = {
- FE(DMUS_CONTAINED_OBJF_KEEP)
- };
- return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
-}
-
const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) {
if (pHeader) {
char buffer[1024], *ptr = buffer;
@@ -90,7 +63,8 @@ const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT
ptr += sprintf(ptr, "DMUS_IO_CONTAINED_OBJECT_HEADER (%p):", pHeader);
ptr += sprintf(ptr, "\n - guidClassID = %s", debugstr_dmguid(&pHeader->guidClassID));
- ptr += sprintf(ptr, "\n - dwFlags = %s", debugstr_DMUS_CONTAINED_OBJF_FLAGS (pHeader->dwFlags));
+ ptr += sprintf(ptr, "\n - dwFlags = %#x%s", pHeader->dwFlags,
+ pHeader->dwFlags & DMUS_CONTAINED_OBJF_KEEP ? " (DMUS_CONTAINED_OBJF_KEEP)" : "");
ptr += sprintf(ptr, "\n - ckid = %s", debugstr_fourcc (pHeader->ckid));
ptr += sprintf(ptr, "\n - fccType = %s", debugstr_fourcc (pHeader->fccType));
--
2.23.0
Dec. 12, 2019
[PATCH 2/3] dmloader: Simplify tracing of the DMUS_CONTAINER_NOLOADS flag
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dmloader/debug.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/dlls/dmloader/debug.c b/dlls/dmloader/debug.c
index 398ce690d1..30e3fd69cc 100644
--- a/dlls/dmloader/debug.c
+++ b/dlls/dmloader/debug.c
@@ -62,14 +62,6 @@ static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t n
return ptr;
}
-/* dump DMUS_CONTAINER flags */
-static const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask) {
- static const flag_info flags[] = {
- FE(DMUS_CONTAINER_NOLOADS)
- };
- return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
-}
-
/* dump DMUS_CONTAINED_OBJF flags */
static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
static const flag_info flags[] = {
@@ -81,10 +73,11 @@ static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) {
if (pHeader) {
char buffer[1024], *ptr = buffer;
-
+
ptr += sprintf(ptr, "DMUS_IO_CONTAINER_HEADER (%p):", pHeader);
- ptr += sprintf(ptr, "\n - dwFlags = %s", debugstr_DMUS_CONTAINER_FLAGS(pHeader->dwFlags));
-
+ ptr += sprintf(ptr, "\n - dwFlags = %#x%s", pHeader->dwFlags,
+ pHeader->dwFlags & DMUS_CONTAINER_NOLOADS ? " (DMUS_CONTAINER_NOLOADS)" : "");
+
return wine_dbg_sprintf("%s", buffer);
} else {
return wine_dbg_sprintf("(NULL)");
--
2.23.0
Dec. 12, 2019
[PATCH 1/3] dmloader: Get rid of single use debugstr_dmreturn()
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dmloader/debug.c | 148 -----------------------------------------
dlls/dmloader/debug.h | 2 -
dlls/dmloader/loader.c | 2 +-
3 files changed, 1 insertion(+), 151 deletions(-)
diff --git a/dlls/dmloader/debug.c b/dlls/dmloader/debug.c
index 0d274394aa..398ce690d1 100644
--- a/dlls/dmloader/debug.c
+++ b/dlls/dmloader/debug.c
@@ -43,154 +43,6 @@ const char *resolve_STREAM_SEEK (DWORD flag) {
}
}
-/* returns name of given error code */
-const char *debugstr_dmreturn (DWORD code) {
- static const flag_info codes[] = {
- FE(S_OK),
- FE(S_FALSE),
- FE(DMUS_S_PARTIALLOAD),
- FE(DMUS_S_PARTIALDOWNLOAD),
- FE(DMUS_S_REQUEUE),
- FE(DMUS_S_FREE),
- FE(DMUS_S_END),
- FE(DMUS_S_STRING_TRUNCATED),
- FE(DMUS_S_LAST_TOOL),
- FE(DMUS_S_OVER_CHORD),
- FE(DMUS_S_UP_OCTAVE),
- FE(DMUS_S_DOWN_OCTAVE),
- FE(DMUS_S_NOBUFFERCONTROL),
- FE(DMUS_S_GARBAGE_COLLECTED),
- FE(E_NOTIMPL),
- FE(E_NOINTERFACE),
- FE(E_POINTER),
- FE(CLASS_E_NOAGGREGATION),
- FE(CLASS_E_CLASSNOTAVAILABLE),
- FE(REGDB_E_CLASSNOTREG),
- FE(E_OUTOFMEMORY),
- FE(E_FAIL),
- FE(E_INVALIDARG),
- FE(DMUS_E_DRIVER_FAILED),
- FE(DMUS_E_PORTS_OPEN),
- FE(DMUS_E_DEVICE_IN_USE),
- FE(DMUS_E_INSUFFICIENTBUFFER),
- FE(DMUS_E_BUFFERNOTSET),
- FE(DMUS_E_BUFFERNOTAVAILABLE),
- FE(DMUS_E_NOTADLSCOL),
- FE(DMUS_E_INVALIDOFFSET),
- FE(DMUS_E_ALREADY_LOADED),
- FE(DMUS_E_INVALIDPOS),
- FE(DMUS_E_INVALIDPATCH),
- FE(DMUS_E_CANNOTSEEK),
- FE(DMUS_E_CANNOTWRITE),
- FE(DMUS_E_CHUNKNOTFOUND),
- FE(DMUS_E_INVALID_DOWNLOADID),
- FE(DMUS_E_NOT_DOWNLOADED_TO_PORT),
- FE(DMUS_E_ALREADY_DOWNLOADED),
- FE(DMUS_E_UNKNOWN_PROPERTY),
- FE(DMUS_E_SET_UNSUPPORTED),
- FE(DMUS_E_GET_UNSUPPORTED),
- FE(DMUS_E_NOTMONO),
- FE(DMUS_E_BADARTICULATION),
- FE(DMUS_E_BADINSTRUMENT),
- FE(DMUS_E_BADWAVELINK),
- FE(DMUS_E_NOARTICULATION),
- FE(DMUS_E_NOTPCM),
- FE(DMUS_E_BADWAVE),
- FE(DMUS_E_BADOFFSETTABLE),
- FE(DMUS_E_UNKNOWNDOWNLOAD),
- FE(DMUS_E_NOSYNTHSINK),
- FE(DMUS_E_ALREADYOPEN),
- FE(DMUS_E_ALREADYCLOSED),
- FE(DMUS_E_SYNTHNOTCONFIGURED),
- FE(DMUS_E_SYNTHACTIVE),
- FE(DMUS_E_CANNOTREAD),
- FE(DMUS_E_DMUSIC_RELEASED),
- FE(DMUS_E_BUFFER_EMPTY),
- FE(DMUS_E_BUFFER_FULL),
- FE(DMUS_E_PORT_NOT_CAPTURE),
- FE(DMUS_E_PORT_NOT_RENDER),
- FE(DMUS_E_DSOUND_NOT_SET),
- FE(DMUS_E_ALREADY_ACTIVATED),
- FE(DMUS_E_INVALIDBUFFER),
- FE(DMUS_E_WAVEFORMATNOTSUPPORTED),
- FE(DMUS_E_SYNTHINACTIVE),
- FE(DMUS_E_DSOUND_ALREADY_SET),
- FE(DMUS_E_INVALID_EVENT),
- FE(DMUS_E_UNSUPPORTED_STREAM),
- FE(DMUS_E_ALREADY_INITED),
- FE(DMUS_E_INVALID_BAND),
- FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK),
- FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK),
- FE(DMUS_E_INVALID_TRACK_HDR),
- FE(DMUS_E_INVALID_TOOL_HDR),
- FE(DMUS_E_ALL_TOOLS_FAILED),
- FE(DMUS_E_ALL_TRACKS_FAILED),
- FE(DMUS_E_NOT_FOUND),
- FE(DMUS_E_NOT_INIT),
- FE(DMUS_E_TYPE_DISABLED),
- FE(DMUS_E_TYPE_UNSUPPORTED),
- FE(DMUS_E_TIME_PAST),
- FE(DMUS_E_TRACK_NOT_FOUND),
- FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT),
- FE(DMUS_E_NO_MASTER_CLOCK),
- FE(DMUS_E_LOADER_NOCLASSID),
- FE(DMUS_E_LOADER_BADPATH),
- FE(DMUS_E_LOADER_FAILEDOPEN),
- FE(DMUS_E_LOADER_FORMATNOTSUPPORTED),
- FE(DMUS_E_LOADER_FAILEDCREATE),
- FE(DMUS_E_LOADER_OBJECTNOTFOUND),
- FE(DMUS_E_LOADER_NOFILENAME),
- FE(DMUS_E_INVALIDFILE),
- FE(DMUS_E_ALREADY_EXISTS),
- FE(DMUS_E_OUT_OF_RANGE),
- FE(DMUS_E_SEGMENT_INIT_FAILED),
- FE(DMUS_E_ALREADY_SENT),
- FE(DMUS_E_CANNOT_FREE),
- FE(DMUS_E_CANNOT_OPEN_PORT),
- FE(DMUS_E_CANNOT_CONVERT),
- FE(DMUS_E_DESCEND_CHUNK_FAIL),
- FE(DMUS_E_NOT_LOADED),
- FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE),
- FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE),
- FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT),
- FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32),
- FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR),
- FE(DMUS_E_SCRIPT_INVALID_FILE),
- FE(DMUS_E_INVALID_SCRIPTTRACK),
- FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND),
- FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND),
- FE(DMUS_E_SCRIPT_CONTENT_READONLY),
- FE(DMUS_E_SCRIPT_NOT_A_REFERENCE),
- FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED),
- FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK),
- FE(DMUS_E_INVALID_LYRICSTRACK),
- FE(DMUS_E_INVALID_PARAMCONTROLTRACK),
- FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR),
- FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR),
- FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE),
- FE(DMUS_E_AUDIOPATHS_NOT_VALID),
- FE(DMUS_E_AUDIOPATHS_IN_USE),
- FE(DMUS_E_NO_AUDIOPATH_CONFIG),
- FE(DMUS_E_AUDIOPATH_INACTIVE),
- FE(DMUS_E_AUDIOPATH_NOBUFFER),
- FE(DMUS_E_AUDIOPATH_NOPORT),
- FE(DMUS_E_NO_AUDIOPATH),
- FE(DMUS_E_INVALIDCHUNK),
- FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER),
- FE(DMUS_E_INVALID_CONTAINER_OBJECT)
- };
-
- unsigned int i;
- for (i = 0; i < ARRAY_SIZE(codes); i++) {
- if (code == codes[i].val)
- return codes[i].name;
- }
-
- /* if we didn't find it, return value */
- return wine_dbg_sprintf("0x%08X", code);
-}
-
-
/* generic flag-dumping function */
static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
static char buffer[128] = "", *ptr = &buffer[0];
diff --git a/dlls/dmloader/debug.h b/dlls/dmloader/debug.h
index fec35cfbff..43f48e832c 100644
--- a/dlls/dmloader/debug.h
+++ b/dlls/dmloader/debug.h
@@ -39,8 +39,6 @@ typedef struct {
extern BOOL IS_VALID_DMFORM (FOURCC chunkID) DECLSPEC_HIDDEN;
/* translate STREAM_SEEK flag to string */
extern const char *resolve_STREAM_SEEK (DWORD flag) DECLSPEC_HIDDEN;
-/* returns name of given error code */
-extern const char *debugstr_dmreturn (DWORD code) DECLSPEC_HIDDEN;
extern const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) DECLSPEC_HIDDEN;
extern const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT_HEADER pHeader) DECLSPEC_HIDDEN;
diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c
index 60dd6f844b..a267d2d6b2 100644
--- a/dlls/dmloader/loader.c
+++ b/dlls/dmloader/loader.c
@@ -396,7 +396,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_GetObject(IDirectMusicLoader8 *ifac
/* load */
result = IPersistStream_Load (pPersistStream, pStream);
if (result != S_OK) {
- WARN(": failed to (completely) load object (%s)\n", debugstr_dmreturn(result));
+ WARN(": failed to (completely) load object (%08x)\n", result);
return result;
}
/* get descriptor */
--
2.23.0
Dec. 12, 2019
[PATCH] testbot/LogUtils: Fix the ParseTaskLog() Perl documentation formatting.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/LogUtils.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 4a17857f8..17a028604 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -81,6 +81,7 @@ Either 'ok' if the task was successful or a code indicating why it failed.
=item NoLog
Contains an error message if the task log could not be read.
+=back
=back
=cut
--
2.20.1
Dec. 12, 2019
Re: [PATCH] urlmon/tests: Fix the spelling of a comment.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62074
Your paranoid android.
=== w2003std (task log) ===
Task errors:
The task timed out
=== w1064v1809_ar (32 bit report) ===
urlmon:
protocol.c:1185: Test failed: unexpected call ReportResult
protocol.c:1193: Test failed: hrResult = 00000000, expected: 80004004
protocol.c:3318: Test failed: Read failed: 00000001
=== w1064v1809_ja (32 bit report) ===
urlmon:
protocol.c:903: Test failed: unexpected call ReportProgress_CONNECTING
Dec. 12, 2019
Re: [PATCH] quartz: Fix the name of a type in a comment.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=62077
Your paranoid android.
=== debian10 (32 bit report) ===
quartz:
Unhandled exception: page fault on execute access to 0x00ba0904 in 32-bit code (0x00ba0904).
=== debian10 (32 bit WoW report) ===
quartz:
Unhandled exception: page fault on execute access to 0x00b8bf04 in 32-bit code (0x00b8bf04).
=== debian10 (64 bit WoW report) ===
quartz:
Unhandled exception: page fault on execute access to 0x00b87b74 in 32-bit code (0x00b87b74).
Dec. 12, 2019
[PATCH] dswave: Use the debug functions provided by dmobject.[ch]
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
Patch 174775 is now fully superseded with this one.
dlls/dswave/dmobject.c | 247 ++++++++++++++++++++++++++++++-
dlls/dswave/dmobject.h | 14 +-
dlls/dswave/dswave.c | 3 +-
dlls/dswave/dswave_main.c | 271 +----------------------------------
dlls/dswave/dswave_private.h | 21 ---
5 files changed, 256 insertions(+), 300 deletions(-)
diff --git a/dlls/dswave/dmobject.c b/dlls/dswave/dmobject.c
index 25f3198d2b..9ea31ab32a 100644
--- a/dlls/dswave/dmobject.c
+++ b/dlls/dswave/dmobject.c
@@ -25,22 +25,257 @@
#include "objbase.h"
#include "dmusici.h"
#include "dmusicf.h"
+#include "dmusics.h"
#include "dmobject.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmobj);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
-/* RIFF format parsing */
-#define CHUNK_HDR_SIZE (sizeof(FOURCC) + sizeof(DWORD))
+/* Debugging helpers */
+const char *debugstr_dmguid(const GUID *id) {
+ unsigned int i;
+#define X(guid) { &guid, #guid }
+ static const struct {
+ const GUID *guid;
+ const char *name;
+ } guids[] = {
+ /* CLSIDs */
+ X(CLSID_AudioVBScript),
+ X(CLSID_DirectMusic),
+ X(CLSID_DirectMusicAudioPathConfig),
+ X(CLSID_DirectMusicAuditionTrack),
+ X(CLSID_DirectMusicBand),
+ X(CLSID_DirectMusicBandTrack),
+ X(CLSID_DirectMusicChordMapTrack),
+ X(CLSID_DirectMusicChordMap),
+ X(CLSID_DirectMusicChordTrack),
+ X(CLSID_DirectMusicCollection),
+ X(CLSID_DirectMusicCommandTrack),
+ X(CLSID_DirectMusicComposer),
+ X(CLSID_DirectMusicContainer),
+ X(CLSID_DirectMusicGraph),
+ X(CLSID_DirectMusicLoader),
+ X(CLSID_DirectMusicLyricsTrack),
+ X(CLSID_DirectMusicMarkerTrack),
+ X(CLSID_DirectMusicMelodyFormulationTrack),
+ X(CLSID_DirectMusicMotifTrack),
+ X(CLSID_DirectMusicMuteTrack),
+ X(CLSID_DirectMusicParamControlTrack),
+ X(CLSID_DirectMusicPatternTrack),
+ X(CLSID_DirectMusicPerformance),
+ X(CLSID_DirectMusicScript),
+ X(CLSID_DirectMusicScriptAutoImpSegment),
+ X(CLSID_DirectMusicScriptAutoImpPerformance),
+ X(CLSID_DirectMusicScriptAutoImpSegmentState),
+ X(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
+ X(CLSID_DirectMusicScriptAutoImpAudioPath),
+ X(CLSID_DirectMusicScriptAutoImpSong),
+ X(CLSID_DirectMusicScriptSourceCodeLoader),
+ X(CLSID_DirectMusicScriptTrack),
+ X(CLSID_DirectMusicSection),
+ X(CLSID_DirectMusicSegment),
+ X(CLSID_DirectMusicSegmentState),
+ X(CLSID_DirectMusicSegmentTriggerTrack),
+ X(CLSID_DirectMusicSegTriggerTrack),
+ X(CLSID_DirectMusicSeqTrack),
+ X(CLSID_DirectMusicSignPostTrack),
+ X(CLSID_DirectMusicSong),
+ X(CLSID_DirectMusicStyle),
+ X(CLSID_DirectMusicStyleTrack),
+ X(CLSID_DirectMusicSynth),
+ X(CLSID_DirectMusicSynthSink),
+ X(CLSID_DirectMusicSysExTrack),
+ X(CLSID_DirectMusicTemplate),
+ X(CLSID_DirectMusicTempoTrack),
+ X(CLSID_DirectMusicTimeSigTrack),
+ X(CLSID_DirectMusicWaveTrack),
+ X(CLSID_DirectSoundWave),
+ /* IIDs */
+ X(IID_IDirectMusic),
+ X(IID_IDirectMusic2),
+ X(IID_IDirectMusic8),
+ X(IID_IDirectMusicAudioPath),
+ X(IID_IDirectMusicBand),
+ X(IID_IDirectMusicBuffer),
+ X(IID_IDirectMusicChordMap),
+ X(IID_IDirectMusicCollection),
+ X(IID_IDirectMusicComposer),
+ X(IID_IDirectMusicContainer),
+ X(IID_IDirectMusicDownload),
+ X(IID_IDirectMusicDownloadedInstrument),
+ X(IID_IDirectMusicGetLoader),
+ X(IID_IDirectMusicGraph),
+ X(IID_IDirectMusicInstrument),
+ X(IID_IDirectMusicLoader),
+ X(IID_IDirectMusicLoader8),
+ X(IID_IDirectMusicObject),
+ X(IID_IDirectMusicPatternTrack),
+ X(IID_IDirectMusicPerformance),
+ X(IID_IDirectMusicPerformance2),
+ X(IID_IDirectMusicPerformance8),
+ X(IID_IDirectMusicPort),
+ X(IID_IDirectMusicPortDownload),
+ X(IID_IDirectMusicScript),
+ X(IID_IDirectMusicSegment),
+ X(IID_IDirectMusicSegment2),
+ X(IID_IDirectMusicSegment8),
+ X(IID_IDirectMusicSegmentState),
+ X(IID_IDirectMusicSegmentState8),
+ X(IID_IDirectMusicStyle),
+ X(IID_IDirectMusicStyle8),
+ X(IID_IDirectMusicSynth),
+ X(IID_IDirectMusicSynth8),
+ X(IID_IDirectMusicSynthSink),
+ X(IID_IDirectMusicThru),
+ X(IID_IDirectMusicTool),
+ X(IID_IDirectMusicTool8),
+ X(IID_IDirectMusicTrack),
+ X(IID_IDirectMusicTrack8),
+ X(IID_IUnknown),
+ X(IID_IPersistStream),
+ X(IID_IStream),
+ X(IID_IClassFactory),
+ /* GUIDs */
+ X(GUID_DirectMusicAllTypes),
+ X(GUID_NOTIFICATION_CHORD),
+ X(GUID_NOTIFICATION_COMMAND),
+ X(GUID_NOTIFICATION_MEASUREANDBEAT),
+ X(GUID_NOTIFICATION_PERFORMANCE),
+ X(GUID_NOTIFICATION_RECOMPOSE),
+ X(GUID_NOTIFICATION_SEGMENT),
+ X(GUID_BandParam),
+ X(GUID_ChordParam),
+ X(GUID_CommandParam),
+ X(GUID_CommandParam2),
+ X(GUID_CommandParamNext),
+ X(GUID_IDirectMusicBand),
+ X(GUID_IDirectMusicChordMap),
+ X(GUID_IDirectMusicStyle),
+ X(GUID_MuteParam),
+ X(GUID_Play_Marker),
+ X(GUID_RhythmParam),
+ X(GUID_TempoParam),
+ X(GUID_TimeSignature),
+ X(GUID_Valid_Start_Time),
+ X(GUID_Clear_All_Bands),
+ X(GUID_ConnectToDLSCollection),
+ X(GUID_Disable_Auto_Download),
+ X(GUID_DisableTempo),
+ X(GUID_DisableTimeSig),
+ X(GUID_Download),
+ X(GUID_DownloadToAudioPath),
+ X(GUID_Enable_Auto_Download),
+ X(GUID_EnableTempo),
+ X(GUID_EnableTimeSig),
+ X(GUID_IgnoreBankSelectForGM),
+ X(GUID_SeedVariations),
+ X(GUID_StandardMIDIFile),
+ X(GUID_Unload),
+ X(GUID_UnloadFromAudioPath),
+ X(GUID_Variations),
+ X(GUID_PerfMasterTempo),
+ X(GUID_PerfMasterVolume),
+ X(GUID_PerfMasterGrooveLevel),
+ X(GUID_PerfAutoDownload),
+ X(GUID_DefaultGMCollection),
+ X(GUID_Synth_Default),
+ X(GUID_Buffer_Reverb),
+ X(GUID_Buffer_EnvReverb),
+ X(GUID_Buffer_Stereo),
+ X(GUID_Buffer_3D_Dry),
+ X(GUID_Buffer_Mono),
+ X(GUID_DMUS_PROP_GM_Hardware),
+ X(GUID_DMUS_PROP_GS_Capable),
+ X(GUID_DMUS_PROP_GS_Hardware),
+ X(GUID_DMUS_PROP_DLS1),
+ X(GUID_DMUS_PROP_DLS2),
+ X(GUID_DMUS_PROP_Effects),
+ X(GUID_DMUS_PROP_INSTRUMENT2),
+ X(GUID_DMUS_PROP_LegacyCaps),
+ X(GUID_DMUS_PROP_MemorySize),
+ X(GUID_DMUS_PROP_SampleMemorySize),
+ X(GUID_DMUS_PROP_SamplePlaybackRate),
+ X(GUID_DMUS_PROP_SetSynthSink),
+ X(GUID_DMUS_PROP_SinkUsesDSound),
+ X(GUID_DMUS_PROP_SynthSink_DSOUND),
+ X(GUID_DMUS_PROP_SynthSink_WAVE),
+ X(GUID_DMUS_PROP_Volume),
+ X(GUID_DMUS_PROP_WavesReverb),
+ X(GUID_DMUS_PROP_WriteLatency),
+ X(GUID_DMUS_PROP_WritePeriod),
+ X(GUID_DMUS_PROP_XG_Capable),
+ X(GUID_DMUS_PROP_XG_Hardware)
+ };
+#undef X
+
+ if (!id)
+ return "(null)";
+
+ for (i = 0; i < ARRAY_SIZE(guids); i++)
+ if (IsEqualGUID(id, guids[i].guid))
+ return guids[i].name;
+
+ return debugstr_guid(id);
+}
-static inline const char *debugstr_fourcc(DWORD fourcc)
+void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc)
{
- if (!fourcc) return "''";
- return wine_dbg_sprintf("'%c%c%c%c'", (char)(fourcc), (char)(fourcc >> 8),
- (char)(fourcc >> 16), (char)(fourcc >> 24));
+ if (!desc || !TRACE_ON(dmfile))
+ return;
+
+ TRACE_(dmfile)("DMUS_OBJECTDESC (%p):", desc);
+ TRACE_(dmfile)(" - dwSize = %u\n", desc->dwSize);
+
+#define X(flag) if (desc->dwValidData & flag) TRACE_(dmfile)(#flag " ")
+ TRACE_(dmfile)(" - dwValidData = %#08x ( ", desc->dwValidData);
+ X(DMUS_OBJ_OBJECT);
+ X(DMUS_OBJ_CLASS);
+ X(DMUS_OBJ_NAME);
+ X(DMUS_OBJ_CATEGORY);
+ X(DMUS_OBJ_FILENAME);
+ X(DMUS_OBJ_FULLPATH);
+ X(DMUS_OBJ_URL);
+ X(DMUS_OBJ_VERSION);
+ X(DMUS_OBJ_DATE);
+ X(DMUS_OBJ_LOADED);
+ X(DMUS_OBJ_MEMORY);
+ X(DMUS_OBJ_STREAM);
+ TRACE_(dmfile)(")\n");
+#undef X
+
+ if (desc->dwValidData & DMUS_OBJ_CLASS)
+ TRACE_(dmfile)(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
+ if (desc->dwValidData & DMUS_OBJ_OBJECT)
+ TRACE_(dmfile)(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
+
+ if (desc->dwValidData & DMUS_OBJ_DATE) {
+ SYSTEMTIME time;
+ FileTimeToSystemTime(&desc->ftDate, &time);
+ TRACE_(dmfile)(" - ftDate = \'%04u-%02u-%02u %02u:%02u:%02u\'\n",
+ time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond);
+ }
+ if (desc->dwValidData & DMUS_OBJ_VERSION)
+ TRACE_(dmfile)(" - vVersion = \'%u,%u,%u,%u\'\n",
+ HIWORD(desc->vVersion.dwVersionMS), LOWORD(desc->vVersion.dwVersionMS),
+ HIWORD(desc->vVersion.dwVersionLS), LOWORD(desc->vVersion.dwVersionLS));
+ if (desc->dwValidData & DMUS_OBJ_NAME)
+ TRACE_(dmfile)(" - wszName = %s\n", debugstr_w(desc->wszName));
+ if (desc->dwValidData & DMUS_OBJ_CATEGORY)
+ TRACE_(dmfile)(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
+ if (desc->dwValidData & DMUS_OBJ_FILENAME)
+ TRACE_(dmfile)(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
+ if (desc->dwValidData & DMUS_OBJ_MEMORY)
+ TRACE_(dmfile)(" - llMemLength = 0x%s - pbMemData = %p\n",
+ wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
+ if (desc->dwValidData & DMUS_OBJ_STREAM)
+ TRACE_(dmfile)(" - pStream = %p\n", desc->pStream);
}
+
+/* RIFF format parsing */
+#define CHUNK_HDR_SIZE (sizeof(FOURCC) + sizeof(DWORD))
+
const char *debugstr_chunk(const struct chunk_entry *chunk)
{
const char *type = "";
diff --git a/dlls/dswave/dmobject.h b/dlls/dswave/dmobject.h
index 4a721cc152..d347020691 100644
--- a/dlls/dswave/dmobject.h
+++ b/dlls/dswave/dmobject.h
@@ -60,8 +60,6 @@ static inline HRESULT stream_reset_chunk_start(IStream *stream, const struct chu
return IStream_Seek(stream, offset, STREAM_SEEK_SET, NULL);
}
-const char *debugstr_chunk(const struct chunk_entry *chunk) DECLSPEC_HIDDEN;
-
/* IDirectMusicObject base object */
struct dmobject {
@@ -106,3 +104,15 @@ HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream
BOOL clear_dirty) DECLSPEC_HIDDEN;
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface,
ULARGE_INTEGER *size) DECLSPEC_HIDDEN;
+
+/* Debugging helpers */
+const char *debugstr_chunk(const struct chunk_entry *chunk) DECLSPEC_HIDDEN;
+const char *debugstr_dmguid(const GUID *id) DECLSPEC_HIDDEN;
+void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
+
+static inline const char *debugstr_fourcc(DWORD fourcc)
+{
+ if (!fourcc) return "''";
+ return wine_dbg_sprintf("'%c%c%c%c'", (char)(fourcc), (char)(fourcc >> 8),
+ (char)(fourcc >> 16), (char)(fourcc >> 24));
+}
diff --git a/dlls/dswave/dswave.c b/dlls/dswave/dswave.c
index 4f1481ce5b..a561660cfa 100644
--- a/dlls/dswave/dswave.c
+++ b/dlls/dswave/dswave.c
@@ -124,7 +124,8 @@ static HRESULT WINAPI wave_IDirectMusicObject_ParseDescriptor(IDirectMusicObject
if (FAILED(hr))
return hr;
- TRACE("returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC(desc));
+ TRACE("returning descriptor:\n");
+ dump_DMUS_OBJECTDESC(desc);
return S_OK;
}
diff --git a/dlls/dswave/dswave_main.c b/dlls/dswave/dswave_main.c
index 4f3a73d9e9..12df6da861 100644
--- a/dlls/dswave/dswave_main.c
+++ b/dlls/dswave/dswave_main.c
@@ -35,6 +35,7 @@
#include "dmusici.h"
#include "dswave_private.h"
+#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dswave);
@@ -176,273 +177,3 @@ HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}
-
-/******************************************************************
- * Helper functions
- *
- *
- */
-/* FOURCC to string conversion for debug messages */
-const char *debugstr_fourcc (DWORD fourcc) {
- if (!fourcc) return "'null'";
- return wine_dbg_sprintf ("\'%c%c%c%c\'",
- (char)(fourcc), (char)(fourcc >> 8),
- (char)(fourcc >> 16), (char)(fourcc >> 24));
-}
-
-/* DMUS_VERSION struct to string conversion for debug messages */
-static const char *debugstr_dmversion(const DMUS_VERSION *version)
-{
- if (!version)
- return "'null'";
- return wine_dbg_sprintf("'%hu,%hu,%hu,%hu'",
- HIWORD(version->dwVersionMS), LOWORD(version->dwVersionMS),
- HIWORD(version->dwVersionLS), LOWORD(version->dwVersionLS));
-}
-
-/* returns name of given GUID */
-const char *debugstr_dmguid (const GUID *id) {
- static const guid_info guids[] = {
- /* CLSIDs */
- GE(CLSID_AudioVBScript),
- GE(CLSID_DirectMusic),
- GE(CLSID_DirectMusicAudioPathConfig),
- GE(CLSID_DirectMusicAuditionTrack),
- GE(CLSID_DirectMusicBand),
- GE(CLSID_DirectMusicBandTrack),
- GE(CLSID_DirectMusicChordMapTrack),
- GE(CLSID_DirectMusicChordMap),
- GE(CLSID_DirectMusicChordTrack),
- GE(CLSID_DirectMusicCollection),
- GE(CLSID_DirectMusicCommandTrack),
- GE(CLSID_DirectMusicComposer),
- GE(CLSID_DirectMusicContainer),
- GE(CLSID_DirectMusicGraph),
- GE(CLSID_DirectMusicLoader),
- GE(CLSID_DirectMusicLyricsTrack),
- GE(CLSID_DirectMusicMarkerTrack),
- GE(CLSID_DirectMusicMelodyFormulationTrack),
- GE(CLSID_DirectMusicMotifTrack),
- GE(CLSID_DirectMusicMuteTrack),
- GE(CLSID_DirectMusicParamControlTrack),
- GE(CLSID_DirectMusicPatternTrack),
- GE(CLSID_DirectMusicPerformance),
- GE(CLSID_DirectMusicScript),
- GE(CLSID_DirectMusicScriptAutoImpSegment),
- GE(CLSID_DirectMusicScriptAutoImpPerformance),
- GE(CLSID_DirectMusicScriptAutoImpSegmentState),
- GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
- GE(CLSID_DirectMusicScriptAutoImpAudioPath),
- GE(CLSID_DirectMusicScriptAutoImpSong),
- GE(CLSID_DirectMusicScriptSourceCodeLoader),
- GE(CLSID_DirectMusicScriptTrack),
- GE(CLSID_DirectMusicSection),
- GE(CLSID_DirectMusicSegment),
- GE(CLSID_DirectMusicSegmentState),
- GE(CLSID_DirectMusicSegmentTriggerTrack),
- GE(CLSID_DirectMusicSegTriggerTrack),
- GE(CLSID_DirectMusicSeqTrack),
- GE(CLSID_DirectMusicSignPostTrack),
- GE(CLSID_DirectMusicSong),
- GE(CLSID_DirectMusicStyle),
- GE(CLSID_DirectMusicStyleTrack),
- GE(CLSID_DirectMusicSynth),
- GE(CLSID_DirectMusicSynthSink),
- GE(CLSID_DirectMusicSysExTrack),
- GE(CLSID_DirectMusicTemplate),
- GE(CLSID_DirectMusicTempoTrack),
- GE(CLSID_DirectMusicTimeSigTrack),
- GE(CLSID_DirectMusicWaveTrack),
- GE(CLSID_DirectSoundWave),
- /* IIDs */
- GE(IID_IDirectMusic),
- GE(IID_IDirectMusic2),
- GE(IID_IDirectMusic8),
- GE(IID_IDirectMusicAudioPath),
- GE(IID_IDirectMusicBand),
- GE(IID_IDirectMusicBuffer),
- GE(IID_IDirectMusicChordMap),
- GE(IID_IDirectMusicCollection),
- GE(IID_IDirectMusicComposer),
- GE(IID_IDirectMusicContainer),
- GE(IID_IDirectMusicDownload),
- GE(IID_IDirectMusicDownloadedInstrument),
- GE(IID_IDirectMusicGetLoader),
- GE(IID_IDirectMusicGraph),
- GE(IID_IDirectMusicInstrument),
- GE(IID_IDirectMusicLoader),
- GE(IID_IDirectMusicLoader8),
- GE(IID_IDirectMusicObject),
- GE(IID_IDirectMusicPatternTrack),
- GE(IID_IDirectMusicPerformance),
- GE(IID_IDirectMusicPerformance2),
- GE(IID_IDirectMusicPerformance8),
- GE(IID_IDirectMusicPort),
- GE(IID_IDirectMusicPortDownload),
- GE(IID_IDirectMusicScript),
- GE(IID_IDirectMusicSegment),
- GE(IID_IDirectMusicSegment2),
- GE(IID_IDirectMusicSegment8),
- GE(IID_IDirectMusicSegmentState),
- GE(IID_IDirectMusicSegmentState8),
- GE(IID_IDirectMusicStyle),
- GE(IID_IDirectMusicStyle8),
- GE(IID_IDirectMusicSynth),
- GE(IID_IDirectMusicSynth8),
- GE(IID_IDirectMusicSynthSink),
- GE(IID_IDirectMusicThru),
- GE(IID_IDirectMusicTool),
- GE(IID_IDirectMusicTool8),
- GE(IID_IDirectMusicTrack),
- GE(IID_IDirectMusicTrack8),
- GE(IID_IUnknown),
- GE(IID_IPersistStream),
- GE(IID_IStream),
- GE(IID_IClassFactory),
- /* GUIDs */
- GE(GUID_DirectMusicAllTypes),
- GE(GUID_NOTIFICATION_CHORD),
- GE(GUID_NOTIFICATION_COMMAND),
- GE(GUID_NOTIFICATION_MEASUREANDBEAT),
- GE(GUID_NOTIFICATION_PERFORMANCE),
- GE(GUID_NOTIFICATION_RECOMPOSE),
- GE(GUID_NOTIFICATION_SEGMENT),
- GE(GUID_BandParam),
- GE(GUID_ChordParam),
- GE(GUID_CommandParam),
- GE(GUID_CommandParam2),
- GE(GUID_CommandParamNext),
- GE(GUID_IDirectMusicBand),
- GE(GUID_IDirectMusicChordMap),
- GE(GUID_IDirectMusicStyle),
- GE(GUID_MuteParam),
- GE(GUID_Play_Marker),
- GE(GUID_RhythmParam),
- GE(GUID_TempoParam),
- GE(GUID_TimeSignature),
- GE(GUID_Valid_Start_Time),
- GE(GUID_Clear_All_Bands),
- GE(GUID_ConnectToDLSCollection),
- GE(GUID_Disable_Auto_Download),
- GE(GUID_DisableTempo),
- GE(GUID_DisableTimeSig),
- GE(GUID_Download),
- GE(GUID_DownloadToAudioPath),
- GE(GUID_Enable_Auto_Download),
- GE(GUID_EnableTempo),
- GE(GUID_EnableTimeSig),
- GE(GUID_IgnoreBankSelectForGM),
- GE(GUID_SeedVariations),
- GE(GUID_StandardMIDIFile),
- GE(GUID_Unload),
- GE(GUID_UnloadFromAudioPath),
- GE(GUID_Variations),
- GE(GUID_PerfMasterTempo),
- GE(GUID_PerfMasterVolume),
- GE(GUID_PerfMasterGrooveLevel),
- GE(GUID_PerfAutoDownload),
- GE(GUID_DefaultGMCollection),
- GE(GUID_Synth_Default),
- GE(GUID_Buffer_Reverb),
- GE(GUID_Buffer_EnvReverb),
- GE(GUID_Buffer_Stereo),
- GE(GUID_Buffer_3D_Dry),
- GE(GUID_Buffer_Mono),
- GE(GUID_DMUS_PROP_GM_Hardware),
- GE(GUID_DMUS_PROP_GS_Capable),
- GE(GUID_DMUS_PROP_GS_Hardware),
- GE(GUID_DMUS_PROP_DLS1),
- GE(GUID_DMUS_PROP_DLS2),
- GE(GUID_DMUS_PROP_Effects),
- GE(GUID_DMUS_PROP_INSTRUMENT2),
- GE(GUID_DMUS_PROP_LegacyCaps),
- GE(GUID_DMUS_PROP_MemorySize),
- GE(GUID_DMUS_PROP_SampleMemorySize),
- GE(GUID_DMUS_PROP_SamplePlaybackRate),
- GE(GUID_DMUS_PROP_SetSynthSink),
- GE(GUID_DMUS_PROP_SinkUsesDSound),
- GE(GUID_DMUS_PROP_SynthSink_DSOUND),
- GE(GUID_DMUS_PROP_SynthSink_WAVE),
- GE(GUID_DMUS_PROP_Volume),
- GE(GUID_DMUS_PROP_WavesReverb),
- GE(GUID_DMUS_PROP_WriteLatency),
- GE(GUID_DMUS_PROP_WritePeriod),
- GE(GUID_DMUS_PROP_XG_Capable),
- GE(GUID_DMUS_PROP_XG_Hardware)
- };
-
- unsigned int i;
-
- if (!id) return "(null)";
-
- for (i = 0; i < ARRAY_SIZE(guids); i++) {
- if (IsEqualGUID(id, guids[i].guid))
- return guids[i].name;
- }
- /* if we didn't find it, act like standard debugstr_guid */
- return debugstr_guid(id);
-}
-
-/* generic flag-dumping function */
-static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
- char buffer[128] = "", *ptr = &buffer[0];
- unsigned int i;
- int size = sizeof(buffer);
-
- for (i=0; i < num_names; i++)
- {
- if ((flags & names[i].val) || /* standard flag*/
- ((!flags) && (!names[i].val))) { /* zero value only */
- int cnt = snprintf(ptr, size, "%s ", names[i].name);
- if (cnt < 0 || cnt >= size) break;
- size -= cnt;
- ptr += cnt;
- }
- }
-
- return wine_dbg_sprintf("%s", buffer);
-}
-
-/* dump DMUS_OBJ flags */
-static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
- static const flag_info flags[] = {
- FE(DMUS_OBJ_OBJECT),
- FE(DMUS_OBJ_CLASS),
- FE(DMUS_OBJ_NAME),
- FE(DMUS_OBJ_CATEGORY),
- FE(DMUS_OBJ_FILENAME),
- FE(DMUS_OBJ_FULLPATH),
- FE(DMUS_OBJ_URL),
- FE(DMUS_OBJ_VERSION),
- FE(DMUS_OBJ_DATE),
- FE(DMUS_OBJ_LOADED),
- FE(DMUS_OBJ_MEMORY),
- FE(DMUS_OBJ_STREAM)
- };
- return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
-}
-
-/* dump whole DMUS_OBJECTDESC struct */
-const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
- if (pDesc) {
- char buffer[1024] = "", *ptr = &buffer[0];
-
- ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
- ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
- ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
- if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
- if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
- if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
- if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
- if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
- if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
- if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
- if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s - pbMemData = %p\n",
- wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
- if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
-
- return wine_dbg_sprintf("%s", buffer);
- } else {
- return wine_dbg_sprintf("(NULL)");
- }
-}
diff --git a/dlls/dswave/dswave_private.h b/dlls/dswave/dswave_private.h
index 3554cde36c..10560d0254 100644
--- a/dlls/dswave/dswave_private.h
+++ b/dlls/dswave/dswave_private.h
@@ -60,25 +60,4 @@ typedef struct _DMUS_PRIVATE_CHUNK {
DWORD dwSize; /* size of the chunk */
} DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
-/* used for generic dumping (copied from ddraw) */
-typedef struct {
- DWORD val;
- const char* name;
-} flag_info;
-
-typedef struct {
- const GUID *guid;
- const char* name;
-} guid_info;
-
-#define FE(x) { x, #x }
-#define GE(x) { &x, #x }
-
-/* FOURCC to string conversion for debug messages */
-extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
-/* returns name of given GUID */
-extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
-/* dump whole DMUS_OBJECTDESC struct */
-extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN;
-
#endif /* __WINE_DSWAVE_PRIVATE_H */
--
2.23.0
Dec. 12, 2019