Wine-devel
Threads by month
- ----- 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
July 2020
- 75 participants
- 841 discussions
Based on ole32/defaulthandler.c implementation.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/ieframe/ieframe.h | 2 ++
dlls/ieframe/oleobject.c | 15 ++++++++++++---
dlls/ieframe/webbrowser.c | 3 +++
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h
index 8d238863be..329cea2f7c 100644
--- a/dlls/ieframe/ieframe.h
+++ b/dlls/ieframe/ieframe.h
@@ -199,6 +199,8 @@ struct WebBrowser {
DWORD sink_aspects;
DWORD sink_flags;
+ IOleAdviseHolder *advise_holder;
+
/* window context */
HWND frame_hwnd;
diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c
index 28ead0f687..39acd43028 100644
--- a/dlls/ieframe/oleobject.c
+++ b/dlls/ieframe/oleobject.c
@@ -760,11 +760,20 @@ static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect,
}
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
- DWORD* pdwConnection)
+ DWORD *pdwConnection)
{
WebBrowser *This = impl_from_IOleObject(iface);
- FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
- return E_NOTIMPL;
+ HRESULT hr = S_OK;
+
+ TRACE("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
+
+ if(!This->advise_holder)
+ hr = CreateOleAdviseHolder(&This->advise_holder);
+
+ if(hr == S_OK)
+ hr = IOleAdviseHolder_Advise(This->advise_holder, pAdvSink, pdwConnection);
+
+ return hr;
}
static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c
index 356b0a2833..87b74b8e01 100644
--- a/dlls/ieframe/webbrowser.c
+++ b/dlls/ieframe/webbrowser.c
@@ -170,6 +170,9 @@ static ULONG WINAPI WebBrowser_Release(IUnknown *iface)
if(This->sink)
IAdviseSink_Release(This->sink);
+ if(This->advise_holder)
+ IOleAdviseHolder_Release(This->advise_holder);
+
if(This->doc_host.document)
IUnknown_Release(This->doc_host.document);
--
2.26.2
2
4
28 Jul '20
Signed-off-by: Myah Caron <qsniyg(a)protonmail.com>
---
v3:
- Fix test failure under windows server (as it doesn't have the necessary media components, mark it as broken)
- Add an extra test using AMMSF_NORENDER
dlls/amstream/multimedia.c | 7 ++-
dlls/amstream/tests/amstream.c | 79 ++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c
index 200bd5c4a5..8f978b72ff 100644
--- a/dlls/amstream/multimedia.c
+++ b/dlls/amstream/multimedia.c
@@ -177,9 +177,12 @@ static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface,
{
struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration);
+ TRACE("(%p/%p)->(%p)\n", This, iface, pDuration);
- return E_NOTIMPL;
+ if (!This->media_seeking)
+ return E_NOINTERFACE;
+
+ return IMediaSeeking_GetDuration(This->media_seeking, pDuration);
}
static HRESULT WINAPI multimedia_stream_Seek(IAMMultiMediaStream *iface, STREAM_TIME seek_time)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 48953684f9..b0f1d42242 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -335,6 +335,84 @@ static void test_openfile(const WCHAR *test_avi_path)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
+static void test_mmstream_get_duration(const WCHAR *test_avi_path)
+{
+ IAMMultiMediaStream *mmstream = create_ammultimediastream();
+ LONGLONG duration;
+ HRESULT hr;
+ ULONG ref;
+
+ duration = 0xdeadbeefdeadbeefULL;
+ hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
+ ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+ ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n",
+ wine_dbgstr_longlong(duration));
+
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL);
+ ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr);
+
+ hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ duration = 0xdeadbeefdeadbeefULL;
+ hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
+
+ ok(hr == S_OK ||
+ broken(hr == S_FALSE && duration == 0) /* win server */, "Got hr %#x.\n", hr);
+ ok(duration == 0xf4240ULL ||
+ broken(hr == S_FALSE && duration == 0) /* win server */, "Got duration %s.\n",
+ wine_dbgstr_longlong(duration));
+
+ ref = IAMMultiMediaStream_Release(mmstream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ mmstream = create_ammultimediastream();
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ duration = 0xdeadbeefdeadbeefULL;
+ hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
+ todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ ok(duration == 0, "Got duration %s.\n",
+ wine_dbgstr_longlong(duration));
+
+ ref = IAMMultiMediaStream_Release(mmstream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ mmstream = create_ammultimediastream();
+
+ hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0);
+ todo_wine ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+
+ duration = 0xdeadbeefdeadbeefULL;
+ hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
+ todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ todo_wine ok(duration == 0, "Got duration %s.\n",
+ wine_dbgstr_longlong(duration));
+
+ ref = IAMMultiMediaStream_Release(mmstream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ mmstream = create_ammultimediastream();
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NORENDER);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ duration = 0xdeadbeefdeadbeefULL;
+ hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
+ todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ ok(duration == 0, "Got duration %s.\n",
+ wine_dbgstr_longlong(duration));
+
+ ref = IAMMultiMediaStream_Release(mmstream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
static void test_renderfile(const WCHAR *test_avi_path)
{
IAMMultiMediaStream *pams;
@@ -5351,6 +5429,7 @@ START_TEST(amstream)
test_avi_path = load_resource(L"test.avi");
test_openfile(test_avi_path);
+ test_mmstream_get_duration(test_avi_path);
test_renderfile(test_avi_path);
unload_resource(test_avi_path);
--
2.27.0
2
3
Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com>
---
dlls/qdvd/navigator.c | 436 ++++++++++++++++++++++++++++++++++++
dlls/qdvd/tests/navigator.c | 2 +-
2 files changed, 437 insertions(+), 1 deletion(-)
diff --git a/dlls/qdvd/navigator.c b/dlls/qdvd/navigator.c
index 00cb0af995..74bd9a3923 100644
--- a/dlls/qdvd/navigator.c
+++ b/dlls/qdvd/navigator.c
@@ -27,6 +27,7 @@ struct navigator
{
struct strmbase_filter filter;
IDvdControl2 IDvdControl2_iface;
+ IDvdInfo2 IDvdInfo2_iface;
};
static inline struct navigator *impl_from_strmbase_filter(struct strmbase_filter *filter)
@@ -40,6 +41,8 @@ static HRESULT navigator_query_interface(struct strmbase_filter *iface, REFIID i
if (IsEqualGUID(iid, &IID_IDvdControl2))
*out = &filter->IDvdControl2_iface;
+ else if (IsEqualGUID(iid, &IID_IDvdInfo2))
+ *out = &filter->IDvdInfo2_iface;
else
return E_NOINTERFACE;
@@ -504,6 +507,438 @@ static const struct IDvdControl2Vtbl dvd_control2_vtbl =
dvd_control2_SelectDefaultSubpictureLanguage,
};
+static struct navigator *impl_from_IDvdInfo2(IDvdInfo2 *iface)
+{
+ return CONTAINING_RECORD(iface, struct navigator, IDvdInfo2_iface);
+}
+
+static HRESULT WINAPI dvd_info2_QueryInterface(IDvdInfo2 *iface, REFIID iid, void **out)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+ return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out);
+}
+
+static ULONG WINAPI dvd_info2_AddRef(IDvdInfo2 *iface)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+ return IUnknown_AddRef(filter->filter.outer_unk);
+}
+
+static ULONG WINAPI dvd_info2_Release(IDvdInfo2 *iface)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+ return IUnknown_Release(filter->filter.outer_unk);
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentDomain(IDvdInfo2 *iface, DVD_DOMAIN *domain)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, domain %p.\n", filter, domain);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentLocation(IDvdInfo2 *iface, DVD_PLAYBACK_LOCATION2 *location)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, location %p.\n", filter, location);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetTotalTitleTime(IDvdInfo2 *iface, DVD_HMSF_TIMECODE *time, ULONG *flags)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, time %p, flags %p.\n", filter, time, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentButton(IDvdInfo2 *iface, ULONG *count, ULONG *current)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, count %p, current %p.\n", filter, count, current);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentAngle(IDvdInfo2 *iface, ULONG *count, ULONG *current)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, count %p, current %p.\n", filter, count, current);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentAudio(IDvdInfo2 *iface, ULONG *count, ULONG *current)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, count %p, current %p.\n", filter, count, current);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentSubpicture(IDvdInfo2 *iface, ULONG *count, ULONG *current, BOOL *enable)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, count %p, current %p, enable %p.\n", filter, count, current, enable);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentUOPS(IDvdInfo2 *iface, ULONG *uops)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, uops %p.\n", filter, uops);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetAllSPRMs(IDvdInfo2 *iface, SPRMARRAY *regs)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, regs %p.\n", filter, regs);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetAllGPRMs(IDvdInfo2 *iface, GPRMARRAY *regs)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, regs %p.\n", filter, regs);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetAudioLanguage(IDvdInfo2 *iface, ULONG stream, LCID *language)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, language %p.\n", filter, stream, language);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetSubpictureLanguage(IDvdInfo2 *iface, ULONG stream, LCID *language)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, language %p.\n", filter, stream, language);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetTitleAttributes(IDvdInfo2 *iface, ULONG index,
+ DVD_MenuAttributes *menu, DVD_TitleAttributes *title)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, index %u, menu %p, title %p.\n", filter, index, menu, title);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetVMGAttributes(IDvdInfo2 *iface, DVD_MenuAttributes *attr)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, attr %p.\n", filter, attr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetVideoAttributes(IDvdInfo2 *iface, DVD_VideoAttributes *attr)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, attr %p.\n", filter, attr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetAudioAttributes(IDvdInfo2 *iface, ULONG stream, DVD_AudioAttributes *attr)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, attr %p.\n", filter, stream, attr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetKaraokeAttributes(IDvdInfo2 *iface, ULONG stream, DVD_KaraokeAttributes *attr)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, attr %p.\n", filter, stream, attr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetSubpictureAttributes(IDvdInfo2 *iface, ULONG stream,
+ DVD_SubpictureAttributes *attr)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, attr %p.\n", filter, stream, attr);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCurrentVolumeInfo(IDvdInfo2 *iface, ULONG *volume_count, ULONG *current,
+ DVD_DISC_SIDE *side, ULONG *title_count)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, volume_count %p, current %p, side %p, title_count %p.\n",
+ filter, volume_count, current, side, title_count);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDVDTextNumberOfLanguages(IDvdInfo2 *iface, ULONG *count)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, count %p.\n", filter, count);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDVDTextLanguageInfo(IDvdInfo2 *iface, ULONG index, ULONG *string_count,
+ LCID *language, enum DVD_TextCharSet *character_set)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, index %u, string_count %p, language %p, character_set %p.\n",
+ filter, index, string_count, language, character_set);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDVDTextStringAsNative(IDvdInfo2 *iface, ULONG lang_index, ULONG string_index,
+ BYTE *string, ULONG size, ULONG *ret_size, enum DVD_TextStringType *type)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, lang_index %u, string_index %u, string %p, size %u, ret_size %p, type %p.\n",
+ filter, lang_index, string_index, string, size, ret_size, type);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDVDTextStringAsUnicode(IDvdInfo2 *iface, ULONG lang_index, ULONG string_index,
+ WCHAR *string, ULONG size, ULONG *ret_size, enum DVD_TextStringType *type)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, lang_index %u, string_index %u, string %p, size %u, ret_size %p, type %p.\n",
+ filter, lang_index, string_index, string, size, ret_size, type);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetPlayerParentalLevel(IDvdInfo2 *iface, ULONG *level, BYTE country_code[2])
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, level %p, country_code %p.\n", filter, level, country_code);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetNumberOfChapters(IDvdInfo2 *iface, ULONG title, ULONG *count)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, title %u, count %p.\n", filter, title, count);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetTitleParentalLevels(IDvdInfo2 *iface, ULONG title, ULONG *levels)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, title %u, levels %p.\n", filter, title, levels);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDVDDirectory(IDvdInfo2 *iface, WCHAR *path, ULONG size, ULONG *ret_size)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, path %p, size %u, ret_size %p.\n", filter, path, size, ret_size);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_IsAudioStreamEnabled(IDvdInfo2 *iface, ULONG stream, BOOL *enable)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, enable %p.\n", filter, stream, enable);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDiscID(IDvdInfo2 *iface, const WCHAR *path, ULONGLONG *id)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, path %s, id %p.\n", filter, debugstr_w(path), id);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetState(IDvdInfo2 *iface, IDvdState **state)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, state %p.\n", filter, state);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetMenuLanguages(IDvdInfo2 *iface, LCID *languages, ULONG count, ULONG *ret_count)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, languages %p, count %u, ret_count %p.\n", filter, languages, count, ret_count);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetButtonAtPosition(IDvdInfo2 *iface, POINT point, ULONG *button)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, point %s, button %p.\n", filter, wine_dbgstr_point(&point), button);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetCmdFromEvent(IDvdInfo2 *iface, LONG_PTR param, IDvdCmd **cmd)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, param %#lx, cmd %p.\n", filter, param, cmd);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDefaultMenuLanguage(IDvdInfo2 *iface, LCID *language)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, language %p.\n", filter, language);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDefaultAudioLanguage(IDvdInfo2 *iface, LCID *language,
+ DVD_AUDIO_LANG_EXT *extension)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, language %p, extension %p.\n", filter, language, extension);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_SelectDefaultSubpictureLanguage(IDvdInfo2 *iface, LCID *language,
+ DVD_SUBPICTURE_LANG_EXT *extension)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, language %p, extension %p.\n", filter, language, extension);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetDecoderCaps(IDvdInfo2 *iface, DVD_DECODER_CAPS *caps)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, caps %p.\n", filter, caps);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_GetButtonRect(IDvdInfo2 *iface, ULONG button, RECT *rect)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, button %u, rect %p.\n", filter, button, rect);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI dvd_info2_IsSubpictureStreamEnabled(IDvdInfo2 *iface, ULONG stream, BOOL *enable)
+{
+ struct navigator *filter = impl_from_IDvdInfo2(iface);
+
+ FIXME("filter %p, stream %u, enable %p.\n", filter, stream, enable);
+
+ return E_NOTIMPL;
+}
+
+static const struct IDvdInfo2Vtbl dvd_info2_vtbl =
+{
+ dvd_info2_QueryInterface,
+ dvd_info2_AddRef,
+ dvd_info2_Release,
+ dvd_info2_GetCurrentDomain,
+ dvd_info2_GetCurrentLocation,
+ dvd_info2_GetTotalTitleTime,
+ dvd_info2_GetCurrentButton,
+ dvd_info2_GetCurrentAngle,
+ dvd_info2_GetCurrentAudio,
+ dvd_info2_GetCurrentSubpicture,
+ dvd_info2_GetCurrentUOPS,
+ dvd_info2_GetAllSPRMs,
+ dvd_info2_GetAllGPRMs,
+ dvd_info2_GetAudioLanguage,
+ dvd_info2_GetSubpictureLanguage,
+ dvd_info2_GetTitleAttributes,
+ dvd_info2_GetVMGAttributes,
+ dvd_info2_GetVideoAttributes,
+ dvd_info2_GetAudioAttributes,
+ dvd_info2_GetKaraokeAttributes,
+ dvd_info2_GetSubpictureAttributes,
+ dvd_info2_GetCurrentVolumeInfo,
+ dvd_info2_GetDVDTextNumberOfLanguages,
+ dvd_info2_GetDVDTextLanguageInfo,
+ dvd_info2_GetDVDTextStringAsNative,
+ dvd_info2_GetDVDTextStringAsUnicode,
+ dvd_info2_GetPlayerParentalLevel,
+ dvd_info2_GetNumberOfChapters,
+ dvd_info2_GetTitleParentalLevels,
+ dvd_info2_GetDVDDirectory,
+ dvd_info2_IsAudioStreamEnabled,
+ dvd_info2_GetDiscID,
+ dvd_info2_GetState,
+ dvd_info2_GetMenuLanguages,
+ dvd_info2_GetButtonAtPosition,
+ dvd_info2_GetCmdFromEvent,
+ dvd_info2_GetDefaultMenuLanguage,
+ dvd_info2_GetDefaultAudioLanguage,
+ dvd_info2_SelectDefaultSubpictureLanguage,
+ dvd_info2_GetDecoderCaps,
+ dvd_info2_GetButtonRect,
+ dvd_info2_IsSubpictureStreamEnabled
+};
+
HRESULT navigator_create(IUnknown *outer, IUnknown **out)
{
struct navigator *object;
@@ -513,6 +948,7 @@ HRESULT navigator_create(IUnknown *outer, IUnknown **out)
strmbase_filter_init(&object->filter, outer, &CLSID_DVDNavigator, &filter_ops);
object->IDvdControl2_iface.lpVtbl = &dvd_control2_vtbl;
+ object->IDvdInfo2_iface.lpVtbl = &dvd_info2_vtbl;
TRACE("Created DVD Navigator filter %p.\n", object);
*out = &object->filter.IUnknown_inner;
diff --git a/dlls/qdvd/tests/navigator.c b/dlls/qdvd/tests/navigator.c
index db2ba392dc..51999065cf 100644
--- a/dlls/qdvd/tests/navigator.c
+++ b/dlls/qdvd/tests/navigator.c
@@ -62,7 +62,7 @@ static void test_interfaces(void)
todo_wine check_interface(filter, &IID_IDvdControl, TRUE);
check_interface(filter, &IID_IDvdControl2, TRUE);
todo_wine check_interface(filter, &IID_IDvdInfo, TRUE);
- todo_wine check_interface(filter, &IID_IDvdInfo2, TRUE);
+ check_interface(filter, &IID_IDvdInfo2, TRUE);
check_interface(filter, &IID_IMediaFilter, TRUE);
check_interface(filter, &IID_IPersist, TRUE);
todo_wine check_interface(filter, &IID_ISpecifyPropertyPages, TRUE);
--
2.27.0
2
1
[PATCH 5/7] kernelbase: Use IOCTL_CONDRV_READ_OUTPUT in ReadConsoleOutputW.
by Jacek Caban 28 Jul '20
by Jacek Caban 28 Jul '20
28 Jul '20
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/kernelbase/console.c | 59 +++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 24 deletions(-)
1
0
[PATCH 4/7] kernelbase: Use IOCTL_CONDRV_READ_OUTPUT in ReadConsoleOutputAttribute.
by Jacek Caban 28 Jul '20
by Jacek Caban 28 Jul '20
28 Jul '20
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/kernelbase/console.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
1
0
[PATCH 3/7] kernelbase: Use IOCTL_CONDRV_READ_OUTPUT in ReadConsoleOutputCharacterW.
by Jacek Caban 28 Jul '20
by Jacek Caban 28 Jul '20
28 Jul '20
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/kernelbase/console.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
1
0
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
include/wine/condrv.h | 3 +-
server/console.c | 90 +++++++++++++++++++++++++++++++++++++++++--
server/trace.c | 1 +
3 files changed, 90 insertions(+), 4 deletions(-)
1
0
[PATCH v2 1/3] ddraw/tests: Test non-primary surface in test_lost_device.
by Gabriel Ivăncescu 28 Jul '20
by Gabriel Ivăncescu 28 Jul '20
28 Jul '20
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 48 +++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw2.c | 48 +++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw4.c | 50 ++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 52 ++++++++++++++++++++++++++++++++++++++-
4 files changed, 194 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 652e52a..a8e842e 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -7309,7 +7309,7 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
- IDirectDrawSurface *surface, *back_buffer;
+ IDirectDrawSurface *surface, *surface2, *back_buffer;
IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
@@ -7336,6 +7336,21 @@ static void test_lost_device(void)
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface2, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
@@ -7349,6 +7364,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7358,6 +7375,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7367,6 +7386,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7376,6 +7397,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7386,6 +7409,8 @@ static void test_lost_device(void)
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE || broken(ddraw_is_warp(ddraw) && hr == DDERR_SURFACELOST),
"Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7406,6 +7431,8 @@ static void test_lost_device(void)
ok(ret, "Failed to set foreground window.\n");
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST || broken(hr == DD_OK) /* WinXP */, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7413,6 +7440,8 @@ static void test_lost_device(void)
ok(ret, "Failed to set foreground window.\n");
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST || broken(hr == DD_OK) /* WinXP */, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7420,6 +7449,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7427,6 +7458,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7445,6 +7478,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7454,6 +7489,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7463,6 +7500,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7472,6 +7511,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7481,6 +7522,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7490,6 +7533,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7507,6 +7552,7 @@ static void test_lost_device(void)
IDirectDrawSurface_Release(back_buffer);
IDirectDrawSurface_Release(sysmem_surface);
+ IDirectDrawSurface_Release(surface2);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index edaf868..1c0ccd9 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -8262,7 +8262,7 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
- IDirectDrawSurface *surface, *back_buffer;
+ IDirectDrawSurface *surface, *surface2, *back_buffer;
IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
@@ -8289,6 +8289,21 @@ static void test_lost_device(void)
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface2, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
@@ -8302,6 +8317,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8311,6 +8328,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8320,6 +8339,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8329,6 +8350,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8338,6 +8361,8 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8358,6 +8383,8 @@ static void test_lost_device(void)
ok(ret, "Failed to set foreground window.\n");
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8365,6 +8392,8 @@ static void test_lost_device(void)
ok(ret, "Failed to set foreground window.\n");
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8372,6 +8401,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8379,6 +8410,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8397,6 +8430,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8406,6 +8441,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8415,6 +8452,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8424,6 +8463,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8433,6 +8474,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8442,6 +8485,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8459,6 +8504,7 @@ static void test_lost_device(void)
IDirectDrawSurface_Release(back_buffer);
IDirectDrawSurface_Release(sysmem_surface);
+ IDirectDrawSurface_Release(surface2);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw2_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index d1abde0..97318bd 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -9655,7 +9655,7 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
- IDirectDrawSurface4 *surface, *back_buffer;
+ IDirectDrawSurface4 *surface, *surface2, *back_buffer;
IDirectDrawSurface4 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
@@ -9682,6 +9682,21 @@ static void test_lost_device(void)
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface2, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
@@ -9697,6 +9712,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9708,6 +9725,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9719,6 +9738,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9730,6 +9751,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9741,6 +9764,8 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9758,6 +9783,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9767,6 +9794,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9776,6 +9805,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9785,6 +9816,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9794,6 +9827,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9814,6 +9849,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9825,6 +9862,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9836,6 +9875,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9847,6 +9888,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9858,6 +9901,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9867,6 +9912,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface4_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9887,6 +9934,7 @@ static void test_lost_device(void)
IDirectDrawSurface4_Release(back_buffer);
IDirectDrawSurface4_Release(sysmem_surface);
+ IDirectDrawSurface4_Release(surface2);
IDirectDrawSurface4_Release(surface);
refcount = IDirectDraw4_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 13eadfd..bd64134 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -9413,7 +9413,7 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
- IDirectDrawSurface7 *surface, *back_buffer;
+ IDirectDrawSurface7 *surface, *surface2, *back_buffer;
IDirectDrawSurface7 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
@@ -9440,6 +9440,21 @@ static void test_lost_device(void)
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface2, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
@@ -9455,6 +9470,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9466,6 +9483,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9477,6 +9496,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9488,6 +9509,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9499,6 +9522,8 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9511,6 +9536,8 @@ static void test_lost_device(void)
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9518,6 +9545,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9527,6 +9556,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9536,6 +9567,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9545,6 +9578,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9554,6 +9589,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9574,6 +9611,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9585,6 +9624,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9596,6 +9637,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9607,6 +9650,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9618,6 +9663,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9629,6 +9676,8 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_IsLost(surface2);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9647,6 +9696,7 @@ static void test_lost_device(void)
IDirectDrawSurface7_Release(back_buffer);
IDirectDrawSurface7_Release(sysmem_surface);
+ IDirectDrawSurface7_Release(surface2);
IDirectDrawSurface7_Release(surface);
refcount = IDirectDraw7_Release(ddraw);
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
--
2.21.0
4
11
[PATCH v3 1/3] ddraw/tests: Test non-primary video memory surface in test_lost_device.
by Gabriel Ivăncescu 28 Jul '20
by Gabriel Ivăncescu 28 Jul '20
28 Jul '20
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
v3: Make sure the surface resides in video memory (thanks Stefan).
dlls/ddraw/tests/ddraw1.c | 97 ++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw2.c | 97 ++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw4.c | 102 ++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 109 +++++++++++++++++++++++++++++++++++++-
4 files changed, 400 insertions(+), 5 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 652e52a..782a3c1 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -7309,8 +7309,8 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface *sysmem_surface, *vidmem_surface;
IDirectDrawSurface *surface, *back_buffer;
- IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
IDirectDraw *ddraw;
@@ -7345,12 +7345,36 @@ static void test_lost_device(void)
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL);
+ if (FAILED(hr))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -7360,6 +7384,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -7369,6 +7398,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7378,6 +7412,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7388,6 +7427,11 @@ static void test_lost_device(void)
"Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK || broken(ddraw_is_warp(ddraw) && hr == DDERR_SURFACELOST), "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -7408,6 +7452,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST || broken(hr == DD_OK) /* WinXP */, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -7415,6 +7464,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST || broken(hr == DD_OK) /* WinXP */, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7422,6 +7476,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7429,6 +7488,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -7447,6 +7511,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7456,6 +7525,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7465,6 +7539,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7474,6 +7553,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7483,6 +7567,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7492,6 +7581,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -7506,6 +7600,7 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(back_buffer);
+ if (vidmem_surface) IDirectDrawSurface_Release(vidmem_surface);
IDirectDrawSurface_Release(sysmem_surface);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index edaf868..6680171 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -8262,8 +8262,8 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface *sysmem_surface, *vidmem_surface;
IDirectDrawSurface *surface, *back_buffer;
- IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
IDirectDraw2 *ddraw;
@@ -8298,12 +8298,36 @@ static void test_lost_device(void)
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL);
+ if (FAILED(hr))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -8313,6 +8337,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -8322,6 +8351,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8331,6 +8365,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8340,6 +8379,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -8360,6 +8404,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -8367,6 +8416,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8374,6 +8428,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8381,6 +8440,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -8399,6 +8463,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8408,6 +8477,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8417,6 +8491,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8426,6 +8505,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8435,6 +8519,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8444,6 +8533,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -8458,6 +8552,7 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(back_buffer);
+ if (vidmem_surface) IDirectDrawSurface_Release(vidmem_surface);
IDirectDrawSurface_Release(sysmem_surface);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw2_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index d1abde0..11e5b46 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -9655,8 +9655,8 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface4 *sysmem_surface, *vidmem_surface;
IDirectDrawSurface4 *surface, *back_buffer;
- IDirectDrawSurface4 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
IDirectDraw4 *ddraw;
@@ -9691,6 +9691,25 @@ static void test_lost_device(void)
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL);
+ if (FAILED(hr))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDraw4_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
@@ -9699,6 +9718,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9710,6 +9734,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9721,6 +9750,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9732,6 +9766,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9743,6 +9782,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -9760,6 +9804,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9769,6 +9818,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9778,6 +9832,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9787,6 +9846,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9796,6 +9860,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface4_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -9816,6 +9885,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9827,6 +9901,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9838,6 +9917,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9849,6 +9933,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9860,6 +9949,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9869,6 +9963,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
@@ -9886,6 +9985,7 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface4_Release(back_buffer);
+ if (vidmem_surface) IDirectDrawSurface4_Release(vidmem_surface);
IDirectDrawSurface4_Release(sysmem_surface);
IDirectDrawSurface4_Release(surface);
refcount = IDirectDraw4_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 13eadfd..996471e 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -9413,8 +9413,8 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface7 *sysmem_surface, *vidmem_surface;
IDirectDrawSurface7 *surface, *back_buffer;
- IDirectDrawSurface7 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
IDirectDraw7 *ddraw;
@@ -9440,6 +9440,21 @@ static void test_lost_device(void)
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 640;
+ surface_desc.dwHeight = 480;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
@@ -9447,7 +9462,11 @@ static void test_lost_device(void)
surface_desc.dwWidth = 100;
surface_desc.dwHeight = 100;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
- ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
hr = IDirectDraw7_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9457,6 +9476,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9468,6 +9492,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9479,6 +9508,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9490,6 +9524,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9501,6 +9540,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -9513,6 +9557,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9520,6 +9569,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9529,6 +9583,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9538,6 +9597,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9547,6 +9611,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9556,6 +9625,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface7_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -9576,6 +9650,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9587,6 +9666,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9598,6 +9682,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9609,6 +9698,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9620,6 +9714,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9631,6 +9730,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -9646,6 +9750,7 @@ static void test_lost_device(void)
IDirectDrawSurface7_Release(back_buffer);
+ if (vidmem_surface) IDirectDrawSurface7_Release(vidmem_surface);
IDirectDrawSurface7_Release(sysmem_surface);
IDirectDrawSurface7_Release(surface);
refcount = IDirectDraw7_Release(ddraw);
--
2.21.0
3
9
28 Jul '20
2
1