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