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
February 2021
- 81 participants
- 640 discussions
[PATCH vkd3d 2/5] vkd3d-shader: Introduce a helper to print d3d-asm boolean literals.
by Henri Verbeet 18 Feb '21
by Henri Verbeet 18 Feb '21
18 Feb '21
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
libs/vkd3d-shader/trace.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index 30f7bc19..bb5c373a 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -726,6 +726,12 @@ static void shader_print_hex_literal(struct vkd3d_d3d_asm_compiler *compiler,
vkd3d_string_buffer_printf(&compiler->buffer, "%s0x%08x%s", prefix, i, suffix);
}
+static void shader_print_bool_literal(struct vkd3d_d3d_asm_compiler *compiler,
+ const char *prefix, unsigned int b, const char *suffix)
+{
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%s", prefix, b ? "true" : "false", suffix);
+}
+
static void shader_print_subscript(struct vkd3d_d3d_asm_compiler *compiler,
unsigned int offset, const struct vkd3d_shader_src_param *rel_addr)
{
@@ -1601,9 +1607,9 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
break;
case VKD3DSIH_DEFB:
- vkd3d_string_buffer_printf(buffer, " %sb%u%s = %s", compiler->colours.reg,
- ins->dst[0].reg.idx[0].offset, compiler->colours.reset,
- ins->src[0].reg.u.immconst_uint[0] ? "true" : "false");
+ vkd3d_string_buffer_printf(buffer, " %sb%u%s", compiler->colours.reg,
+ ins->dst[0].reg.idx[0].offset, compiler->colours.reset);
+ shader_print_bool_literal(compiler, " = ", ins->src[0].reg.u.immconst_uint[0], "");
break;
default:
--
2.11.0
1
0
[PATCH vkd3d 1/5] vkd3d-shader: Introduce a helper to print d3d-asm hexadecimal literals.
by Henri Verbeet 18 Feb '21
by Henri Verbeet 18 Feb '21
18 Feb '21
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
libs/vkd3d-shader/trace.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index 81943632..30f7bc19 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -720,6 +720,12 @@ static void shader_print_uint_literal(struct vkd3d_d3d_asm_compiler *compiler,
vkd3d_string_buffer_printf(&compiler->buffer, "%s%u%s", prefix, i, suffix);
}
+static void shader_print_hex_literal(struct vkd3d_d3d_asm_compiler *compiler,
+ const char *prefix, unsigned int i, const char *suffix)
+{
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s0x%08x%s", prefix, i, suffix);
+}
+
static void shader_print_subscript(struct vkd3d_d3d_asm_compiler *compiler,
unsigned int offset, const struct vkd3d_shader_src_param *rel_addr)
{
@@ -1429,11 +1435,10 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
vkd3d_string_buffer_printf(buffer, " {\n");
for (i = 0; i < ins->declaration.icb->vec4_count; ++i)
{
- shader_addline(buffer, " {0x%08x, 0x%08x, 0x%08x, 0x%08x},\n",
- ins->declaration.icb->data[4 * i + 0],
- ins->declaration.icb->data[4 * i + 1],
- ins->declaration.icb->data[4 * i + 2],
- ins->declaration.icb->data[4 * i + 3]);
+ shader_print_hex_literal(compiler, " {", ins->declaration.icb->data[4 * i + 0], "");
+ shader_print_hex_literal(compiler, ", ", ins->declaration.icb->data[4 * i + 1], "");
+ shader_print_hex_literal(compiler, ", ", ins->declaration.icb->data[4 * i + 2], "");
+ shader_print_hex_literal(compiler, ", ", ins->declaration.icb->data[4 * i + 3], "},\n");
}
shader_addline(buffer, "}");
break;
--
2.11.0
1
0
[PATCH resend 1/3] kernel32: Print processor group in Get(Active|Maximum)ProcessorCount
by Alex Henrie 18 Feb '21
by Alex Henrie 18 Feb '21
18 Feb '21
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/kernel32/process.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 41a5b34af19..46ccb04b133 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -620,7 +620,7 @@ DWORD WINAPI GetActiveProcessorCount(WORD group)
{
DWORD cpus = system_info.NumberOfProcessors;
- FIXME("semi-stub, returning %u\n", cpus);
+ FIXME("(0x%x): semi-stub, returning %u\n", group, cpus);
return cpus;
}
@@ -631,7 +631,7 @@ DWORD WINAPI GetMaximumProcessorCount(WORD group)
{
DWORD cpus = system_info.NumberOfProcessors;
- FIXME("semi-stub, returning %u\n", cpus);
+ FIXME("(0x%x): semi-stub, returning %u\n", group, cpus);
return cpus;
}
--
2.30.1
1
2
From: Michael Müller <michael(a)fds-team.de>
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
Tested with Microsoft's winobj and by using the following patch.
dlls/aclui/Makefile.in | 3 +
dlls/aclui/aclui.rc | 56 +++++
dlls/aclui/aclui_main.c | 497 +++++++++++++++++++++++++++++++++++++-
dlls/aclui/resource.h | 36 +++
dlls/aclui/user_icons.bmp | Bin 0 -> 2730 bytes
5 files changed, 587 insertions(+), 5 deletions(-)
create mode 100644 dlls/aclui/aclui.rc
create mode 100644 dlls/aclui/resource.h
create mode 100644 dlls/aclui/user_icons.bmp
diff --git a/dlls/aclui/Makefile.in b/dlls/aclui/Makefile.in
index 83bd379c1ba..dc6a5e04843 100644
--- a/dlls/aclui/Makefile.in
+++ b/dlls/aclui/Makefile.in
@@ -1,6 +1,9 @@
MODULE = aclui.dll
IMPORTLIB = aclui
+IMPORTS = comctl32 user32 advapi32 gdi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = aclui_main.c
+
+RC_SRCS = aclui.rc
diff --git a/dlls/aclui/aclui.rc b/dlls/aclui/aclui.rc
new file mode 100644
index 00000000000..feccde4f35e
--- /dev/null
+++ b/dlls/aclui/aclui.rc
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resource.h"
+
+#define WINE_FILEDESCRIPTION_STR "Wine Security Descriptor Editor"
+#define WINE_FILENAME_STR "aclui.dll"
+#define WINE_FILEVERSION 5,1,2600,5512
+#define WINE_FILEVERSION_STR "5.1.2600.5512"
+#define WINE_PRODUCTVERSION 5,1,2600,5512
+#define WINE_PRODUCTVERSION_STR "5.1"
+
+#include "wine/wine_common_ver.rc"
+
+#pragma makedep po
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+IDD_SECURITY_PROPERTIES DIALOGEX 0, 0, 240, 215
+STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION
+CAPTION "Security"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "&Group or user names:", -1, 5, 5, 230, 10
+ CONTROL "", IDC_USERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | LVS_SORTASCENDING | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 5, 17, 230, 63, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
+
+ LTEXT "", IDC_ACE_USER, 5, 105, 110, 10
+ LTEXT "Allow", -1, 120, 105, 55, 10, SS_CENTER
+ LTEXT "Deny", -1, 180, 105, 55, 10, SS_CENTER
+ CONTROL "", IDC_ACE, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | LVS_SINGLESEL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 5, 115, 230, 95, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
+END
+
+STRINGTABLE
+BEGIN
+ IDS_PERMISSION_FOR "Permissions for %1"
+END
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+/* @makedep: user_icons.bmp */
+IDB_USER_ICONS BITMAP user_icons.bmp
diff --git a/dlls/aclui/aclui_main.c b/dlls/aclui/aclui_main.c
index 033a47191cb..15d0cc5788a 100644
--- a/dlls/aclui/aclui_main.c
+++ b/dlls/aclui/aclui_main.c
@@ -19,18 +19,51 @@
*/
#include <stdarg.h>
-
+#define COBJMACROS
+#define NONAMELESSUNION
#include "initguid.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnt.h"
#include "aclui.h"
+#include "resource.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(aclui);
+/* the aclui.h files does not contain the necessary COBJMACROS */
+#define ISecurityInformation_AddRef(This) (This)->lpVtbl->AddRef(This)
+#define ISecurityInformation_Release(This) (This)->lpVtbl->Release(This)
+#define ISecurityInformation_GetObjectInformation(This, obj) (This)->lpVtbl->GetObjectInformation(This, obj)
+#define ISecurityInformation_GetSecurity(This, info, sd, def) (This)->lpVtbl->GetSecurity(This, info, sd, def)
+#define ISecurityInformation_GetAccessRights(This, type, flags, access, count, def) (This)->lpVtbl->GetAccessRights(This, type, flags, access, count, def)
+
+struct user
+{
+ WCHAR *name;
+ PSID sid;
+};
+
+struct security_page
+{
+ ISecurityInformation *security;
+ SI_OBJECT_INFO info;
+ PSECURITY_DESCRIPTOR sd;
+
+ SI_ACCESS *access;
+ ULONG access_count;
+
+ struct user *users;
+ unsigned int user_count;
+
+ HWND dialog;
+ HIMAGELIST image_list_user;
+};
+
+static HINSTANCE aclui_instance;
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
@@ -40,20 +73,474 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
+ aclui_instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
break;
}
return TRUE;
}
-HPROPSHEETPAGE WINAPI CreateSecurityPage(LPSECURITYINFO psi)
+static WCHAR *WINAPIV load_formatstr(UINT resource, ...)
+{
+ __ms_va_list valist;
+ WCHAR *str;
+ DWORD ret;
+
+ __ms_va_start(valist, resource);
+ ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
+ aclui_instance, resource, 0, (WCHAR*)&str, 0, &valist);
+ __ms_va_end(valist);
+ return ret ? str : NULL;
+}
+
+static void security_page_free(struct security_page *page)
+{
+ unsigned int i;
+
+ for (i = 0; i < page->user_count; ++i)
+ free(page->users[i].name);
+ free(page->users);
+
+ LocalFree(page->sd);
+ if (page->image_list_user) ImageList_Destroy(page->image_list_user);
+ if (page->security) ISecurityInformation_Release(page->security);
+ free(page);
+}
+
+static WCHAR *get_sid_name(PSID sid, SID_NAME_USE *sid_type)
{
- FIXME("(%p): stub\n", psi);
+ WCHAR *name, *domain;
+ DWORD domain_len = 0;
+ DWORD name_len = 0;
+ BOOL ret;
+
+ LookupAccountSidW(NULL, sid, NULL, &name_len, NULL, &domain_len, sid_type);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ return NULL;
+ if (!(name = malloc(name_len * sizeof(WCHAR))))
+ return NULL;
+ if (!(domain = malloc(domain_len * sizeof(WCHAR))))
+ {
+ free(name);
+ return NULL;
+ }
+
+ ret = LookupAccountSidW(NULL, sid, name, &name_len, domain, &domain_len, sid_type);
+ free(domain);
+ if (ret) return name;
+ free(name);
return NULL;
}
-BOOL WINAPI EditSecurity(HWND owner, LPSECURITYINFO psi)
+static void users_add(struct security_page *page, PSID sid)
+{
+ struct user *new_array, *user;
+ SID_NAME_USE sid_type;
+ unsigned int i;
+ LVITEMW item;
+ WCHAR *name;
+
+ /* check if we already processed this user or group */
+ for (i = 0; i < page->user_count; ++i)
+ {
+ if (EqualSid(sid, page->users[i].sid))
+ return;
+ }
+
+ if (!(name = get_sid_name(sid, &sid_type)))
+ return;
+
+ if (!(new_array = realloc(page->users, (page->user_count + 1) * sizeof(*page->users))))
+ return;
+ page->users = new_array;
+ user = &page->users[page->user_count++];
+
+ user->name = name;
+ user->sid = sid;
+
+ /* Add in GUI */
+ item.mask = LVIF_PARAM | LVIF_TEXT;
+ item.iItem = -1;
+ item.iSubItem = 0;
+ item.pszText = name;
+ item.lParam = (LPARAM)user;
+
+ if (page->image_list_user)
+ {
+ item.mask |= LVIF_IMAGE;
+ item.iImage = (sid_type == SidTypeGroup || sid_type == SidTypeWellKnownGroup) ? 0 : 1;
+ }
+
+ SendMessageW(GetDlgItem(page->dialog, IDC_USERS), LVM_INSERTITEMW, 0, (LPARAM)&item);
+}
+
+static PSID get_sid_from_ace(ACE_HEADER *ace)
+{
+ switch (ace->AceType)
+ {
+ case ACCESS_ALLOWED_ACE_TYPE:
+ return (SID *)&((ACCESS_ALLOWED_ACE *)ace)->SidStart;
+ case ACCESS_DENIED_ACE_TYPE:
+ return (SID *)&((ACCESS_DENIED_ACE *)ace)->SidStart;
+ default:
+ FIXME("Don't know how to extract SID from ace type %d\n", ace->AceType);
+ return NULL;
+ }
+}
+
+static void users_refresh(struct security_page *page)
+{
+ BOOL defaulted, present;
+ ACE_HEADER *ace;
+ unsigned int i;
+ DWORD index;
+ ACL *dacl;
+ PSID sid;
+
+ for (i = 0; i < page->user_count; ++i)
+ free(page->users[i].name);
+ free(page->users);
+
+ if (!GetSecurityDescriptorOwner(page->sd, &sid, &defaulted)
+ || !GetSecurityDescriptorDacl(page->sd, &present, &dacl, &defaulted))
+ {
+ ERR("Failed to query descriptor information, error %u.\n", GetLastError());
+ return;
+ }
+
+ page->user_count = 1;
+ if (present)
+ page->user_count += dacl->AceCount;
+ if (!(page->users = malloc(page->user_count * sizeof(*page->users))))
+ return;
+
+ users_add(page, sid);
+
+ /* Everyone else who appears in the DACL */
+ if (GetSecurityDescriptorDacl(page->sd, &present, &dacl, &defaulted) && present)
+ {
+ for (index = 0; index < dacl->AceCount; index++)
+ {
+ if (!GetAce(dacl, index, (void**)&ace))
+ break;
+ if (!(sid = get_sid_from_ace(ace)))
+ continue;
+ users_add(page, sid);
+ }
+ }
+}
+
+static HIMAGELIST create_image_list(UINT resource, UINT width, UINT height, UINT count, COLORREF mask_color)
+{
+ HIMAGELIST image_list;
+ HBITMAP image;
+ INT ret;
+
+ if (!(image_list = ImageList_Create(width, height, ILC_COLOR32 | ILC_MASK, 0, count)))
+ return NULL;
+ if (!(image = LoadBitmapW(aclui_instance, MAKEINTRESOURCEW(resource))))
+ goto error;
+
+ ret = ImageList_AddMasked(image_list, image, mask_color);
+ DeleteObject(image);
+ if (ret != -1) return image_list;
+
+error:
+ ImageList_Destroy(image_list);
+ return NULL;
+}
+
+static void compute_access_masks(PSECURITY_DESCRIPTOR sd, PSID sid, ACCESS_MASK *allowed, ACCESS_MASK *denied)
+{
+ BOOL defaulted, present;
+ ACE_HEADER *ace;
+ PSID ace_sid;
+ DWORD index;
+ ACL *dacl;
+
+ *allowed = 0;
+ *denied = 0;
+
+ if (!GetSecurityDescriptorDacl(sd, &present, &dacl, &defaulted) || !present)
+ return;
+
+ for (index = 0; index < dacl->AceCount; index++)
+ {
+ if (!GetAce(dacl, index, (void**)&ace))
+ break;
+
+ ace_sid = get_sid_from_ace(ace);
+ if (!ace_sid || !EqualSid(ace_sid, sid))
+ continue;
+
+ if (ace->AceType == ACCESS_ALLOWED_ACE_TYPE)
+ *allowed |= ((ACCESS_ALLOWED_ACE*)ace)->Mask;
+ else if (ace->AceType == ACCESS_DENIED_ACE_TYPE)
+ *denied |= ((ACCESS_DENIED_ACE*)ace)->Mask;
+ }
+}
+
+static void show_ace_entries(struct security_page *page, struct user *user)
+{
+ ACCESS_MASK allowed, denied;
+ WCHAR *infotext;
+ ULONG i, index;
+ LVITEMW item;
+ HWND control;
+
+ compute_access_masks(page->sd, user->sid, &allowed, &denied);
+
+ if ((infotext = load_formatstr(IDS_PERMISSION_FOR, user->name)))
+ {
+ SetDlgItemTextW(page->dialog, IDC_ACE_USER, infotext);
+ LocalFree(infotext);
+ }
+
+ control = GetDlgItem(page->dialog, IDC_ACE);
+ index = 0;
+ for (i = 0; i < page->access_count; i++)
+ {
+ if (!(page->access[i].dwFlags & SI_ACCESS_GENERAL))
+ continue;
+
+ item.mask = LVIF_TEXT;
+ item.iItem = index;
+
+ item.iSubItem = 1;
+ if ((page->access[i].mask & allowed) == page->access[i].mask)
+ item.pszText = (WCHAR *)L"X";
+ else
+ item.pszText = (WCHAR *)L"-";
+ SendMessageW(control, LVM_SETITEMW, 0, (LPARAM)&item);
+
+ item.iSubItem = 2;
+ if ((page->access[i].mask & denied) == page->access[i].mask)
+ item.pszText = (WCHAR *)L"X";
+ else
+ item.pszText = (WCHAR *)L"-";
+ SendMessageW(control, LVM_SETITEMW, 0, (LPARAM)&item);
+
+ index++;
+ }
+}
+
+static void create_ace_entries(struct security_page *page)
+{
+ WCHAR str[256];
+ HWND control;
+ LVITEMW item;
+ ULONG i, index;
+
+ control = GetDlgItem(page->dialog, IDC_ACE);
+ index = 0;
+ for (i = 0; i < page->access_count; i++)
+ {
+ if (!(page->access[i].dwFlags & SI_ACCESS_GENERAL))
+ continue;
+
+ item.mask = LVIF_TEXT;
+ item.iItem = index;
+ item.iSubItem = 0;
+ if (IS_INTRESOURCE(page->access[i].pszName))
+ {
+ str[0] = 0;
+ LoadStringW(page->info.hInstance, (UINT)(DWORD_PTR)page->access[i].pszName, str, 256);
+ item.pszText = str;
+ }
+ else
+ item.pszText = (WCHAR *)page->access[i].pszName;
+ SendMessageW(control, LVM_INSERTITEMW, 0, (LPARAM)&item);
+
+ index++;
+ }
+}
+
+static void security_page_init_dlg(HWND hwnd, struct security_page *page)
{
- FIXME("(%p, %p): stub\n", owner, psi);
+ LVCOLUMNW column;
+ HWND control;
+ RECT rect;
+ ULONG def = 0;
+ HRESULT hr;
+
+ page->dialog = hwnd;
+
+ if (FAILED(hr = ISecurityInformation_GetSecurity(page->security, DACL_SECURITY_INFORMATION
+ | OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION, &page->sd, FALSE)))
+ {
+ ERR("Failed to get security descriptor, hr %#x.\n", hr);
+ return;
+ }
+
+ if (FAILED(hr = ISecurityInformation_GetAccessRights(page->security,
+ NULL, 0, &page->access, &page->access_count, &def)))
+ {
+ ERR("Failed to get access mapping, hr %#x.\n", hr);
+ return;
+ }
+
+ /* Prepare user list */
+ control = GetDlgItem(hwnd, IDC_USERS);
+ SendMessageW(control, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
+
+ GetClientRect(control, &rect);
+ column.mask = LVCF_FMT | LVCF_WIDTH;
+ column.fmt = LVCFMT_LEFT;
+ column.cx = rect.right - rect.left;
+ SendMessageW(control, LVM_INSERTCOLUMNW, 0, (LPARAM)&column);
+
+ if ((page->image_list_user = create_image_list(IDB_USER_ICONS, 18, 18, 2, RGB(255, 0, 255))))
+ SendMessageW(control, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)page->image_list_user);
+
+ /* Prepare ACE list */
+ control = GetDlgItem(hwnd, IDC_ACE);
+ SendMessageW(control, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
+
+ column.mask = LVCF_FMT | LVCF_WIDTH;
+ column.fmt = LVCFMT_LEFT;
+ column.cx = 170;
+ SendMessageW(control, LVM_INSERTCOLUMNW, 0, (LPARAM)&column);
+
+ column.mask = LVCF_FMT | LVCF_WIDTH;
+ column.fmt = LVCFMT_CENTER;
+ column.cx = 85;
+ SendMessageW(control, LVM_INSERTCOLUMNW, 1, (LPARAM)&column);
+
+ column.mask = LVCF_FMT | LVCF_WIDTH;
+ column.fmt = LVCFMT_CENTER;
+ column.cx = 85;
+ SendMessageW(control, LVM_INSERTCOLUMNW, 2, (LPARAM)&column);
+
+ users_refresh(page);
+ create_ace_entries(page);
+
+ if (page->user_count)
+ {
+ LVITEMW item;
+ item.mask = LVIF_STATE;
+ item.iItem = 0;
+ item.iSubItem = 0;
+ item.state = LVIS_FOCUSED | LVIS_SELECTED;
+ item.stateMask = item.state;
+ SendMessageW(GetDlgItem(hwnd, IDC_USERS), LVM_SETITEMW, 0, (LPARAM)&item);
+ }
+}
+
+static INT_PTR CALLBACK security_page_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ PROPSHEETPAGEW *ppsp = (PROPSHEETPAGEW *)lParam;
+ SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam);
+ security_page_init_dlg(hwndDlg, (struct security_page *)ppsp->lParam);
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ struct security_page *page = (struct security_page *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
+ NMHDR *hdr = (NMHDR *)lParam;
+
+ if (hdr->hwndFrom == GetDlgItem(hwndDlg, IDC_USERS) && hdr->code == LVN_ITEMCHANGED)
+ {
+ NMLISTVIEW *nmv = (NMLISTVIEW *)lParam;
+ if (!(nmv->uOldState & LVIS_SELECTED) && (nmv->uNewState & LVIS_SELECTED))
+ show_ace_entries(page, (struct user *)nmv->lParam);
+ return TRUE;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
return FALSE;
}
+
+static UINT CALLBACK security_page_callback(HWND hwnd, UINT msg, PROPSHEETPAGEW *ppsp)
+{
+ struct security_page *page = (struct security_page *)ppsp->lParam;
+
+ if (msg == PSPCB_RELEASE)
+ security_page_free(page);
+
+ return 1;
+}
+
+HPROPSHEETPAGE WINAPI CreateSecurityPage(ISecurityInformation *security)
+{
+ struct security_page *page;
+ PROPSHEETPAGEW propsheet;
+ HPROPSHEETPAGE ret;
+
+ TRACE("%p\n", security);
+
+ InitCommonControls();
+
+ if (!(page = calloc(1, sizeof(*page))))
+ return NULL;
+
+ if (FAILED(ISecurityInformation_GetObjectInformation(security, &page->info)))
+ {
+ free(page);
+ return NULL;
+ }
+
+ page->security = security;
+ ISecurityInformation_AddRef(security);
+
+ memset(&propsheet, 0, sizeof(propsheet));
+ propsheet.dwSize = sizeof(propsheet);
+ propsheet.dwFlags = PSP_DEFAULT | PSP_USECALLBACK;
+ propsheet.hInstance = aclui_instance;
+ propsheet.u.pszTemplate = (WCHAR *)MAKEINTRESOURCE(IDD_SECURITY_PROPERTIES);
+ propsheet.pfnDlgProc = security_page_proc;
+ propsheet.pfnCallback = security_page_callback;
+ propsheet.lParam = (LPARAM)page;
+
+ if (page->info.dwFlags & SI_PAGE_TITLE)
+ {
+ propsheet.pszTitle = page->info.pszPageTitle;
+ propsheet.dwFlags |= PSP_USETITLE;
+ }
+
+ if (!(ret = CreatePropertySheetPageW(&propsheet)))
+ {
+ ERR("Failed to create property sheet page.\n");
+ ISecurityInformation_Release(security);
+ free(page);
+ return NULL;
+ }
+ return ret;
+}
+
+BOOL WINAPI EditSecurity(HWND owner, LPSECURITYINFO psi)
+{
+ PROPSHEETHEADERW prop;
+ HPROPSHEETPAGE pages[1];
+ SI_OBJECT_INFO info;
+ BOOL ret;
+
+ TRACE("(%p, %p)\n", owner, psi);
+
+ if (FAILED(ISecurityInformation_GetObjectInformation(psi, &info)))
+ return FALSE;
+ if (!(pages[0] = CreateSecurityPage(psi)))
+ return FALSE;
+
+ memset(&prop, 0, sizeof(prop));
+ prop.dwSize = sizeof(prop);
+ prop.dwFlags = PSH_DEFAULT;
+ prop.hwndParent = owner;
+ prop.hInstance = aclui_instance;
+ prop.pszCaption = load_formatstr(IDS_PERMISSION_FOR, info.pszObjectName);
+ prop.nPages = 1;
+ prop.u2.nStartPage = 0;
+ prop.u3.phpage = pages;
+
+ ret = PropertySheetW(&prop) != -1;
+ LocalFree((void *)prop.pszCaption);
+ return ret;
+}
diff --git a/dlls/aclui/resource.h b/dlls/aclui/resource.h
new file mode 100644
index 00000000000..f92d99692c7
--- /dev/null
+++ b/dlls/aclui/resource.h
@@ -0,0 +1,36 @@
+/*
+ * Definitions for aclui dialog controls
+ *
+ * Copyright (c) 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_ACLUI__
+#define __WINE_ACLUI__
+
+#define IDD_SECURITY_PROPERTIES 100
+
+#define IDC_USERS 101
+
+#define IDC_ACE_USER 110
+#define IDC_ACE 111
+
+#define IDS_PERMISSION_FOR 1000
+
+#define IDB_USER_ICONS 2000
+#define IDB_CHECKBOX 2001
+
+#endif /* __WINE_ACLUI__ */
diff --git a/dlls/aclui/user_icons.bmp b/dlls/aclui/user_icons.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..29259e2724ccf67b7e3e84c3fc6d749bc9e8ae26
GIT binary patch
literal 2730
zcmdUtc~F#P0LH1N8IS3YY|3(`$+FC$Q3M3!8WF=I!cj3Jj^t)pSCB(Uu2clUR2&33
zmt$E#SWXd>M2$=FNK;cX1Ox;D6*{J|rkY>xw}vCAo72=EeY4NL`+nd1{Py{t_qBB>
zousF|c8KpNp*Mx52tB1YUGEt&P8ZJ&pS>qB9lg-gyZ_O%U9u`<^ud#kPmfy&di<}{
zakhb0O*)MQyY8!{B!$ke8g;%$TT?AHpKYKjQ9<Q)`9rGS5x~WIjZVh+t~9YeWct~V
zEwe@`w-H)Mmdu6>KWlM+A%)TIkK`T6*g}5L`zZYvknL+p)?dmLW4gBmX<im&3QoGe
z9hD;2`2T&>{G?_dsa{rOyBm_(a)A>?UD(a)ut;exz8p2V*`?1=8)iGhP3WM|43gK1tH7D
z8bj?`$*&atY)>N!!&Z{9b}ngd2BZl8)|L9C$rjUnv2_eX;$7(MM3$P2bJ7mhChsOT
z=mS(TbJRY(a)6#LC%zs!Utv2O)po-5eN&a=t#v*MUCZVaonEFE>gyQI1rpz=1>`qjSk
z(1bfsn;cG_mytG~lq=p*pDej8P3ojEj2pLaVHO&|OY6Ov?B~V=9~T_mY|#WQL?bt)
zYP}h?p*9TO?4xFrJ%xfVWy(|7^3BomF{~!lPD(-+YqOMycaZ#LLdVm>Idf1&k$5*L
zr_`C0DQBH6m+H&LFk;ksOk3y41SyOES|-TdnIdy0dA*&;V$RV|9jHu{Q+uqL^3Q(a)f
z6yt!}-<-;AK4Umi&wW?VQyR9MQhyUF6lNR<m``n>IUT3!80_s7`OHM$Cggh?k>h28
zI&>v>bAK4a3Cqpm<q$a&6&_3s^kHI<uU0lb4itsj;}(&C_3lPYQZ8V%rx};XM9O1a
z8S1<;hBJDODz|!aV51$?qSyKudy0aW(A?BWbIS?xLsw82>!|HWx_>As^dUy|$rfgQ
z5_m7iMmdusH!x|VKa;{0%naI$S!Nq^vaX|_ah;iIU6?7`*?r{lL!8k(BmLcIBGynF
zX2<4D3M^wQuuMKJbOwvKgKUWoK(a)+-+k_hL=GS=*j<CVxDCIoo#f?oj7Ir{Rvhscw7
zn5Fw~;9fI;OVv%RRlU5O-i4dy+GAN#uG>BB1c!%VnsgGA+-_zGkK{AX>BfBTSv(`R
z^T+hxAIrGw{wwxzo0;kq%5=X}UXy3?x;z7;T_^B8G{~M)BgD7d;ls+Cyd^qvEbe$L
zYqY1unO|d`-=lp88+9+HBA4WyExKNmed%xg5y~3gP-HVBxR4n^g-rEHV^-X86m>)F
zJu^bWiD8^Xp4pk#kyUl+<el&Ti3K_BIF$C`T|0pP=YxDCyjH3nZKnCk4%Fucbuyf`
z7c(cOTAbY`tadh_zp0!TWlC()&!Z4L53y&<if{0qs-4S&KkH<D@!cJks=KsV;#-E<
zb9#i0M{lu0)5k1v4$X6~lW(a)FOC&P7(a)28+aFtWvkLJg<#;+v=Dm%fvdWfT$xqC~CTh
zsO#p&_rK`mNc+_(a)a+ei_9jrS%NV3SHy7(heU*2YQc|Y%nel2r4sBa(E$w{hcz$*SA
zcKgn<DCIN;F$Z|nKLbT-l}_L2c^N;tmRv=4Xn-)$OLW6+?Vc?a{hH?X;Gk-IB4%KE
z4dzk%F^;Z8e}fXI_(a)XEBjn5*@hns%GvET}BmA!Z#9AHgFKeh$kEX!@<+acZi{UEQs
mZ-|`3t(<G``Nvrv<n3+g$E*Ar9%a|qcJ$w2KFI$MfBy-k(a)DaHH
literal 0
HcmV?d00001
--
2.30.1
1
1
[PATCH 1/3] ntdll: Implement NtQuerySystemInformation(SystemExtendedHandleInformation).
by Zebediah Figura 18 Feb '21
by Zebediah Figura 18 Feb '21
18 Feb '21
From: Michael Müller <michael(a)fds-team.de>
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/ntdll/tests/info.c | 79 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/system.c | 50 +++++++++++++++++++++++++
include/winternl.h | 20 ++++++++++
3 files changed, 149 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index c848248fae3..419d8582dd3 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -609,6 +609,84 @@ done:
HeapFree( GetProcessHeap(), 0, shi);
}
+static void test_query_handle_ex(void)
+{
+ SYSTEM_HANDLE_INFORMATION_EX *info = malloc(sizeof(SYSTEM_HANDLE_INFORMATION_EX));
+ ULONG size, expect_size;
+ NTSTATUS status;
+ unsigned int i;
+ HANDLE event;
+ BOOL found, ret;
+
+ event = CreateEventA(NULL, FALSE, FALSE, NULL);
+ ok(event != NULL, "failed to create event, error %u\n", GetLastError());
+ ret = SetHandleInformation(event, HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
+ HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE);
+ ok(ret, "got error %u\n", GetLastError());
+
+ size = 0;
+ status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, sizeof(SYSTEM_HANDLE_INFORMATION_EX), &size);
+ ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#x\n", status);
+ ok(size > sizeof(SYSTEM_HANDLE_INFORMATION_EX), "got size %u\n", size);
+
+ while (status == STATUS_INFO_LENGTH_MISMATCH)
+ {
+ info = realloc(info, size);
+ status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
+ }
+ ok(!status, "got %#x\n", status);
+ expect_size = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles[info->NumberOfHandles]);
+ ok(size == expect_size, "expected size %u, got %u\n", expect_size, size);
+ ok(info->NumberOfHandles > 1, "got %Iu handles\n", info->NumberOfHandles);
+
+ found = FALSE;
+ for (i = 0; i < info->NumberOfHandles; ++i)
+ {
+ if (info->Handles[i].UniqueProcessId == GetCurrentProcessId()
+ && (HANDLE)info->Handles[i].HandleValue == event)
+ {
+ todo_wine ok(info->Handles[i].HandleAttributes == (OBJ_INHERIT | OBJ_PROTECT_CLOSE),
+ "got flags %#x\n", info->Handles[i].HandleAttributes);
+ ok(info->Handles[i].GrantedAccess == EVENT_ALL_ACCESS, "got access %#x\n", info->Handles[i].GrantedAccess);
+ found = TRUE;
+ }
+ ok(!info->Handles[i].CreatorBackTraceIndex, "got backtrace index %u\n", info->Handles[i].CreatorBackTraceIndex);
+ }
+ ok(found, "event handle not found\n");
+
+ ret = SetHandleInformation(event, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0);
+ ok(ret, "got error %u\n", GetLastError());
+ CloseHandle(event);
+
+ status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
+ while (status == STATUS_INFO_LENGTH_MISMATCH)
+ {
+ info = realloc(info, size);
+ status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
+ }
+ ok(!status, "got %#x\n", status);
+ expect_size = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles[info->NumberOfHandles]);
+ ok(size == expect_size, "expected size %u, got %u\n", expect_size, size);
+ ok(info->NumberOfHandles > 1, "got %Iu handles\n", info->NumberOfHandles);
+
+ found = FALSE;
+ for (i = 0; i < info->NumberOfHandles; ++i)
+ {
+ if (info->Handles[i].UniqueProcessId == GetCurrentProcessId()
+ && (HANDLE)info->Handles[i].HandleValue == event)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ ok(!found, "event handle found\n");
+
+ status = pNtQuerySystemInformation(SystemExtendedHandleInformation, NULL, sizeof(SYSTEM_HANDLE_INFORMATION_EX), &size);
+ ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08x\n", status );
+
+ free(info);
+}
+
static void test_query_cache(void)
{
NTSTATUS status;
@@ -2959,6 +3037,7 @@ START_TEST(info)
test_query_procperf();
test_query_module();
test_query_handle();
+ test_query_handle_ex();
test_query_cache();
test_query_interrupt();
test_time_adjustment();
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index a889b2e020c..e2482f91041 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2461,6 +2461,56 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
break;
}
+ case SystemExtendedHandleInformation:
+ {
+ struct handle_info *handle_info;
+ DWORD i, num_handles;
+
+ if (size < sizeof(SYSTEM_HANDLE_INFORMATION_EX))
+ {
+ ret = STATUS_INFO_LENGTH_MISMATCH;
+ break;
+ }
+
+ if (!info)
+ {
+ ret = STATUS_ACCESS_VIOLATION;
+ break;
+ }
+
+ num_handles = (size - FIELD_OFFSET( SYSTEM_HANDLE_INFORMATION_EX, Handles ))
+ / sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
+ if (!(handle_info = malloc( sizeof(*handle_info) * num_handles ))) return STATUS_NO_MEMORY;
+
+ SERVER_START_REQ( get_system_handles )
+ {
+ wine_server_set_reply( req, handle_info, sizeof(*handle_info) * num_handles );
+ if (!(ret = wine_server_call( req )))
+ {
+ SYSTEM_HANDLE_INFORMATION_EX *shi = info;
+ shi->NumberOfHandles = wine_server_reply_size( req ) / sizeof(*handle_info);
+ len = FIELD_OFFSET( SYSTEM_HANDLE_INFORMATION_EX, Handles[shi->NumberOfHandles] );
+ for (i = 0; i < shi->NumberOfHandles; i++)
+ {
+ memset( &shi->Handles[i], 0, sizeof(shi->Handles[i]) );
+ shi->Handles[i].UniqueProcessId = handle_info[i].owner;
+ shi->Handles[i].HandleValue = handle_info[i].handle;
+ shi->Handles[i].GrantedAccess = handle_info[i].access;
+ /* FIXME: Fill out Object, HandleAttributes, ObjectTypeIndex */
+ }
+ }
+ else if (ret == STATUS_BUFFER_TOO_SMALL)
+ {
+ len = FIELD_OFFSET( SYSTEM_HANDLE_INFORMATION_EX, Handles[reply->count] );
+ ret = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+ SERVER_END_REQ;
+
+ free( handle_info );
+ break;
+ }
+
case SystemCacheInformation:
{
SYSTEM_CACHE_INFORMATION sci = { 0 };
diff --git a/include/winternl.h b/include/winternl.h
index a95d2ae6cd1..bb396e90064 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1898,6 +1898,25 @@ typedef struct _SYSTEM_HANDLE_INFORMATION {
SYSTEM_HANDLE_ENTRY Handle[1];
} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
+typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
+{
+ void *Object;
+ ULONG_PTR UniqueProcessId;
+ ULONG_PTR HandleValue;
+ ULONG GrantedAccess;
+ USHORT CreatorBackTraceIndex;
+ USHORT ObjectTypeIndex;
+ ULONG HandleAttributes;
+ ULONG Reserved;
+} SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX;
+
+typedef struct _SYSTEM_HANDLE_INFORMATION_EX
+{
+ ULONG_PTR NumberOfHandles;
+ ULONG_PTR Reserved;
+ SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handles[1];
+} SYSTEM_HANDLE_INFORMATION_EX;
+
/* System Information Class 0x15 */
typedef struct _SYSTEM_CACHE_INFORMATION {
@@ -2289,6 +2308,7 @@ typedef struct _RTL_ATOM_TABLE
#define LOGONID_CURRENT ((ULONG)-1)
+#define OBJ_PROTECT_CLOSE 0x00000001
#define OBJ_INHERIT 0x00000002
#define OBJ_PERMANENT 0x00000010
#define OBJ_EXCLUSIVE 0x00000020
--
2.20.1
1
2
[PATCH 1/6] winegstreamer: Move GST_BUFFER_OFFSET_NONE handling to the Unix library.
by Zebediah Figura 17 Feb '21
by Zebediah Figura 17 Feb '21
17 Feb '21
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/winegstreamer/gst_private.h | 1 +
dlls/winegstreamer/gstdemux.c | 6 ------
dlls/winegstreamer/wg_parser.c | 5 +++++
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 33c87f2c1ec..2ac10ee37d3 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -145,6 +145,7 @@ struct wg_parser
GstPad *my_src, *their_sink;
guint64 file_size, start_offset, next_offset, stop_offset;
+ guint64 next_pull_offset;
pthread_t push_thread;
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 4e476c78e9e..a4164ab643b 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -66,8 +66,6 @@ struct parser
* separate lock. */
bool streaming, sink_connected;
- uint64_t next_pull_offset;
-
HANDLE read_thread;
BOOL (*init_gst)(struct parser *filter);
@@ -796,8 +794,6 @@ static GstFlowReturn read_buffer(struct parser *This, guint64 ofs, guint len, Gs
TRACE("filter %p, offset %s, length %u, buffer %p.\n", This, wine_dbgstr_longlong(ofs), len, buffer);
- if (ofs == GST_BUFFER_OFFSET_NONE)
- ofs = This->next_pull_offset;
if (ofs >= This->file_size)
{
WARN("Reading past eof: %s, %u\n", wine_dbgstr_longlong(ofs), len);
@@ -805,7 +801,6 @@ static GstFlowReturn read_buffer(struct parser *This, guint64 ofs, guint len, Gs
}
if (len + ofs > This->file_size)
len = This->file_size - ofs;
- This->next_pull_offset = ofs + len;
gst_buffer_map(buffer, &info, GST_MAP_WRITE);
hr = IAsyncReader_SyncRead(This->reader, ofs, len, info.data);
@@ -998,7 +993,6 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons
filter->sink_connected = true;
filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL);
- filter->next_pull_offset = 0;
if (FAILED(hr = unix_funcs->wg_parser_connect(filter->wg_parser, filter->file_size)))
goto err;
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 96c6fc1e715..f2f878ffabc 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -989,6 +989,10 @@ static GstFlowReturn request_buffer_src(GstPad *pad, GstObject *parent, guint64
GST_LOG("pad %p, offset %" G_GINT64_MODIFIER "u, length %u, buffer %p.", pad, offset, size, *buffer);
+ if (offset == GST_BUFFER_OFFSET_NONE)
+ offset = parser->next_pull_offset;
+ parser->next_pull_offset = offset + size;
+
if (!*buffer)
*buffer = new_buffer = gst_buffer_new_and_alloc(size);
@@ -1325,6 +1329,7 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
gst_pad_set_element_private(parser->my_src, parser);
parser->start_offset = parser->next_offset = parser->stop_offset = 0;
+ parser->next_pull_offset = 0;
if (!parser->init_gst(parser))
return E_FAIL;
--
2.30.1
1
5
Signed-off-by: Esme Povirk <esme(a)codeweavers.com>
---
This just causes log spam. Any useful information can be found from
errors or using WINE_MONO_VERBOSE=1.
dlls/mscoree/corruntimehost.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c
index cf8acae09e0..51522c57d83 100644
--- a/dlls/mscoree/corruntimehost.c
+++ b/dlls/mscoree/corruntimehost.c
@@ -1319,7 +1319,6 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup)
ULONG_PTR *tokens = fixup->tokens;
for (i=0; i<fixup->fixup->count; i++)
{
- TRACE("%#lx\n", tokens[i]);
vtable[i] = mono_marshal_get_vtfixup_ftnptr(
image, tokens[i], fixup->fixup->type);
}
@@ -1363,7 +1362,6 @@ static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
fixup->vtable = (BYTE*)hmodule + vtable_fixup->rva;
fixup->done = FALSE;
- TRACE("vtable_fixup->type=0x%x\n",vtable_fixup->type);
#if __x86_64__
if (vtable_fixup->type & COR_VTABLE_64BIT)
#else
--
2.25.1
1
0
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
Supersedes 199974, 199975, 199989, 199990.
Changes:
- squash patches for different ddraw versions into one;
- use 'const GUID *' instead of 'REFCLSID';
- don't change D3D_OK to DD_OK in test data;
- fix typo ("hardware");
- pass the device guid as parameter to test function.
dlls/ddraw/tests/ddraw1.c | 72 +++++++++-----
dlls/ddraw/tests/ddraw2.c | 98 ++++++++++++-------
dlls/ddraw/tests/ddraw4.c | 170 ++++++++++++++++++++++-----------
dlls/ddraw/tests/ddraw7.c | 191 +++++++++++++++++++++++++-------------
4 files changed, 361 insertions(+), 170 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index d3e9fe0e1ff..96930a5f722 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -166,6 +166,11 @@ static BOOL ddraw_is_vmware(IDirectDraw *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface *create_overlay(IDirectDraw *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -605,7 +610,7 @@ static IDirectDraw *create_ddraw(void)
return ddraw;
}
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice *create_device_ex(IDirectDraw *ddraw, HWND window, DWORD coop_level, const GUID *device_guid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -665,7 +670,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
+ if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -675,6 +680,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
return device;
}
+static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport *viewport;
@@ -4316,11 +4326,12 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirect3DDevice *device;
+ BOOL software_device;
IDirectDraw *ddraw;
DWORD z_depth = 0;
unsigned int i;
@@ -4486,10 +4497,12 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -4502,7 +4515,7 @@ static void test_rt_caps(void)
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -4527,32 +4540,41 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK || broken(test_data[i].create_may_fail),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
-
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(test_data[i].caps_out == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out, i, software_device);
+
+ hr = IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device);
+ if (software_device)
+ todo_wine
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
if (SUCCEEDED(hr))
{
@@ -14407,6 +14429,12 @@ static void test_get_display_mode(void)
IDirectDraw_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw1)
{
DDDEVICEIDENTIFIER identifier;
@@ -14468,7 +14496,7 @@ START_TEST(ddraw1)
test_clear_rect_count();
test_coop_level_activateapp();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index bc915c97864..2b16b742a32 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -163,6 +163,11 @@ static BOOL ddraw_is_vmware(IDirectDraw2 *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface *create_overlay(IDirectDraw2 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -435,7 +440,7 @@ static IDirectDraw2 *create_ddraw(void)
return ddraw2;
}
-static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice2 *create_device_ex(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, const GUID *device_guid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -503,7 +508,7 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device)))
+ if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, device_guid, surface, &device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -514,6 +519,11 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
return device;
}
+static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport2 *viewport;
@@ -4739,11 +4749,12 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirect3DDevice2 *device;
+ BOOL software_device;
IDirectDraw2 *ddraw;
DWORD z_depth = 0;
IDirect3D2 *d3d;
@@ -4952,10 +4963,12 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4974,7 +4987,7 @@ static void test_rt_caps(void)
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -4999,34 +5012,50 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK || broken(test_data[i].create_may_fail),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(test_data[i].caps_out == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out, i, software_device);
+
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+ if (software_device)
+ todo_wine
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+
+ if (hr == DD_OK)
+ {
+ refcount = IDirect3DDevice2_Release(device);
+ ok(!refcount, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+ }
}
IDirectDrawSurface_Release(surface);
@@ -5037,10 +5066,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -5060,13 +5089,14 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -5081,8 +5111,8 @@ static void test_rt_caps(void)
}
hr = IDirect3DDevice2_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface_Release(tmp);
IDirectDrawSurface_Release(rt);
@@ -15211,6 +15241,12 @@ done:
IDirectDraw2_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw2)
{
DDDEVICEIDENTIFIER identifier;
@@ -15276,7 +15312,7 @@ START_TEST(ddraw2)
test_lighting_interface_versions();
test_coop_level_activateapp();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index f009b4583f4..7e1c9837243 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -164,6 +164,11 @@ static BOOL ddraw_is_vmware(IDirectDraw4 *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface4 *create_overlay(IDirectDraw4 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -6355,10 +6360,12 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw4 *ddraw;
DDPIXELFORMAT z_fmt;
IDirect3D3 *d3d;
@@ -6377,7 +6384,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
DWORD caps2_in;
DWORD caps2_out;
HRESULT create_device_hr;
@@ -6388,7 +6395,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,},
0,
0,
D3D_OK,
@@ -6398,7 +6405,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6408,7 +6416,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6418,7 +6427,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6428,7 +6437,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6438,7 +6447,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6448,7 +6457,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6458,7 +6468,8 @@ static void test_rt_caps(void)
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6468,7 +6479,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6478,7 +6489,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6488,7 +6499,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_TEXTUREMANAGE,
DDSCAPS2_TEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6498,7 +6509,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_D3DTEXTUREMANAGE,
DDSCAPS2_D3DTEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6508,7 +6519,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6518,7 +6529,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6528,7 +6539,8 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6538,7 +6550,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6548,7 +6560,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6558,7 +6570,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6568,7 +6580,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6578,7 +6591,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_ZBUFFER,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6588,7 +6602,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6598,7 +6612,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6607,11 +6621,13 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
- ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
if (FAILED(IDirectDraw4_QueryInterface(ddraw, &IID_IDirect3D3, (void **)&d3d)))
{
@@ -6620,17 +6636,17 @@ static void test_rt_caps(void)
}
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
+ hr = IDirect3D3_EnumZBufferFormats(d3d, device_guid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
- skip("No depth buffer formats available, skipping test.\n");
+ skip("No depth buffer formats available, software_device %u, skipping test.\n", software_device);
IDirect3D3_Release(d3d);
goto done;
}
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -6651,34 +6667,71 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x and caps2 %#x, hr %#x.\n",
- i, test_data[i].caps_in, test_data[i].caps2_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || (software_device && (surface_desc.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER))
+ == (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER) && hr == DDERR_UNSUPPORTED)
+ || broken(software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[software_device]
+ ? test_data[i].caps_out[software_device] : test_data[i].caps_out[0];
+
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
- "Test %u: Got unexpected caps2 %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out);
+ "Got unexpected caps2 %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out, i, software_device);
+
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface4_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (software_device)
+ {
+ /* _CreateDevice succeeds with software device, but the palette gets extra reference
+ * on Windows (probably due to a bug) which doesn't go away on the device and surface
+ * destruction and ddraw is not destroyed cleanly, so skipping this test. */
+ IDirectDrawSurface4_Release(surface);
+ continue;
+ }
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
IDirectDrawSurface4_Release(surface);
@@ -6689,10 +6742,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6708,21 +6761,21 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice3_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface4_Release(tmp);
IDirectDrawSurface4_Release(rt);
@@ -6732,7 +6785,8 @@ static void test_rt_caps(void)
ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(!refcount, "Got unexpected refcount %u.\n", refcount);
IDirect3D3_Release(d3d);
done:
@@ -18271,6 +18325,12 @@ done:
IDirectDraw4_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -18343,7 +18403,7 @@ START_TEST(ddraw4)
test_texturemanage();
test_block_formats_creation();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 628360630dc..68f68ef6446 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -30,6 +30,7 @@ HRESULT WINAPI GetSurfaceFromDC(HDC dc, struct IDirectDrawSurface **surface, HDC
static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID iid, IUnknown *outer_unknown);
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode;
+static const GUID *hw_device_guid = &IID_IDirect3DHALDevice;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -190,6 +191,11 @@ static BOOL ddraw_is_amd(IDirectDraw7 *ddraw)
return ddraw_is_vendor(ddraw, 0x1002);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DTnLHalDevice && device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface7 *create_overlay(IDirectDraw7 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -6085,13 +6091,13 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
- const GUID *devtype = &IID_IDirect3DHALDevice;
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw7 *ddraw;
- BOOL hal_ok = FALSE;
DDPIXELFORMAT z_fmt;
IDirect3D7 *d3d;
unsigned int i;
@@ -6109,7 +6115,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
DWORD caps2_in;
DWORD caps2_out;
HRESULT create_device_hr;
@@ -6120,7 +6126,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,},
0,
0,
D3D_OK,
@@ -6130,7 +6136,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6140,7 +6147,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6150,7 +6158,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6160,7 +6168,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6170,7 +6178,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6180,7 +6188,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6190,7 +6199,7 @@ static void test_rt_caps(void)
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6200,7 +6209,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6210,7 +6219,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6220,7 +6229,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_TEXTUREMANAGE,
DDSCAPS2_TEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6230,7 +6239,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_D3DTEXTUREMANAGE,
DDSCAPS2_D3DTEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6240,7 +6249,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6250,7 +6259,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6260,7 +6269,8 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6270,7 +6280,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6280,7 +6290,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6290,7 +6300,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6300,7 +6310,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6310,7 +6321,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_ZBUFFER,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6320,7 +6332,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6330,7 +6342,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6339,6 +6351,8 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -6351,23 +6365,18 @@ static void test_rt_caps(void)
goto done;
}
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
- ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (hal_ok)
- devtype = &IID_IDirect3DTnLHalDevice;
-
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
+ hr = IDirect3D7_EnumZBufferFormats(d3d, device_guid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
- skip("No depth buffer formats available, skipping test.\n");
+ skip("No depth buffer formats available, software_device %u, skipping test.\n", software_device);
IDirect3D7_Release(d3d);
goto done;
}
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -6388,34 +6397,68 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x and caps2 %#x, hr %#x.\n",
- i, test_data[i].caps_in, test_data[i].caps2_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || (software_device && (surface_desc.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER))
+ == (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER) && hr == DDERR_UNSUPPORTED)
+ || broken(software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
- "Test %u: Got unexpected caps2 %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[software_device]
+ ? test_data[i].caps_out[software_device] : test_data[i].caps_out[0];
+
+ todo_wine_if(test_data[i].caps_out[software_device]
+ && surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0])
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || broken(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0]),
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
+ ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
+ "Got unexpected caps2 %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out, i, software_device);
+
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface7_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (software_device)
+ todo_wine
+ ok(hr == E_FAIL, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
IDirectDrawSurface7_Release(surface);
@@ -6426,10 +6469,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6445,21 +6488,21 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice7_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface7_Release(tmp);
IDirectDrawSurface7_Release(rt);
@@ -6469,7 +6512,8 @@ static void test_rt_caps(void)
ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(!refcount, "Got unexpected refcount %u.\n", refcount);
IDirect3D7_Release(d3d);
done:
@@ -18533,12 +18577,21 @@ done:
IDirectDraw7_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(hw_device_guid);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
HMODULE module, dwmapi;
DEVMODEW current_mode;
IDirectDraw7 *ddraw;
+ IDirect3D7 *d3d;
+ BOOL hal_ok;
+ HRESULT hr;
module = GetModuleHandleA("ddraw.dll");
if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx")))
@@ -18561,6 +18614,20 @@ START_TEST(ddraw7)
HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart),
HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart));
}
+
+ if (IDirectDraw7_QueryInterface(ddraw, &IID_IDirect3D7, (void **)&d3d) == DD_OK)
+ {
+ hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (hal_ok)
+ hw_device_guid = &IID_IDirect3DTnLHalDevice;
+ IDirectDraw7_Release(d3d);
+ }
+ else
+ {
+ trace("D3D interface is not available.\n");
+ }
+
IDirectDraw7_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode));
@@ -18612,7 +18679,7 @@ START_TEST(ddraw7)
test_texturemanage();
test_block_formats_creation();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
--
2.29.2
2
1
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
v3: I got caught by the change to the parameterized_arg rule that was
actually prepending types instead of appending types them, as the helper
name suggests, reversing the list order.
So I decided to clean all this type_list_t single linked list mess
first, to use the usual double linked list structure and helpers. As
there was already a ifref_list_t / ifref_t that is mostly a type list,
I just renamed it and used it everywhere type_list_t was used.
Then this also:
* Fix memmove off-by-one error in format_parameterized_type_c_name.
* Fix incorrect usage of u.type_list for STMT_TYPE and STMT_TYPEREF,
* Use STMT_TYPE with a partially specialized parameterized type for the
delayed definitions, instead of trying to force use of type_list.
* Removes development code leftovers.
* Add loc_info_t to replace_type_parameters_in_statement(_list).
* Print proper error message in unsupported cases.
* Delay the delegate patches to a later batch.
Thanks Jacek for the review!
tools/widl/parser.y | 4 ++--
tools/widl/typetree.c | 8 ++++----
tools/widl/typetree.h | 2 +-
tools/widl/widltypes.h | 2 +-
tools/widl/write_msft.c | 6 +++---
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 6ab4f83a0ad..54006529ba9 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1821,10 +1821,10 @@ static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface)
return list;
}
-static ifref_t *make_ifref(type_t *iface)
+static ifref_t *make_ifref(type_t *type)
{
ifref_t *l = xmalloc(sizeof(ifref_t));
- l->iface = iface;
+ l->type = type;
l->attrs = NULL;
return l;
}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 203fffcdee6..2f49a92511a 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -565,19 +565,19 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref
/* FIXME: this should probably not be allowed, here or in coclass, */
/* but for now there's too many places in Wine IDL where it is to */
/* even print a warning. */
- if (!(ifref->iface->defined)) continue;
- if (!(requires = type_iface_get_requires(ifref->iface))) continue;
+ if (!(ifref->type->defined)) continue;
+ if (!(requires = type_iface_get_requires(ifref->type))) continue;
LIST_FOR_EACH_ENTRY(required, requires, ifref_t, entry)
{
int found = 0;
LIST_FOR_EACH_ENTRY(tmp, ifaces, ifref_t, entry)
- if ((found = type_is_equal(tmp->iface, required->iface))) break;
+ if ((found = type_is_equal(tmp->type, required->type))) break;
if (!found)
error_loc("interface '%s' also requires interface '%s', "
"but runtimeclass '%s' does not implement it.\n",
- ifref->iface->name, required->iface->name, runtimeclass->name);
+ ifref->type->name, required->type->name, runtimeclass->name);
}
}
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 96b681e0379..186f42307f4 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -363,7 +363,7 @@ static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
if (!ifaces) return NULL;
LIST_FOR_EACH_ENTRY(entry, ifaces, ifref_t, entry)
if (is_attr(entry->attrs, ATTR_DEFAULT))
- return entry->iface;
+ return entry->type;
return NULL;
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 7596577493d..f31d40cad91 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -538,7 +538,7 @@ struct _declarator_t {
};
struct _ifref_t {
- type_t *iface;
+ type_t *type;
attr_list_t *attrs;
/* parser-internal */
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 5728f041f6f..63635cec011 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2352,10 +2352,10 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
i = 0;
if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) {
- if(iref->iface->typelib_idx == -1)
- add_interface_typeinfo(typelib, iref->iface);
+ if(iref->type->typelib_idx == -1)
+ add_interface_typeinfo(typelib, iref->type);
ref = (MSFT_RefRecord*) (typelib->typelib_segment_data[MSFT_SEG_REFERENCES] + offset + i * sizeof(*ref));
- ref->reftype = typelib->typelib_typeinfo_offsets[iref->iface->typelib_idx];
+ ref->reftype = typelib->typelib_typeinfo_offsets[iref->type->typelib_idx];
ref->flags = 0;
ref->oCustData = -1;
ref->onext = -1;
--
2.30.0
2
14
Signed-off-by: Floris Renaud <jkfloris(a)dds.nl>
---
po/nl.po | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/po/nl.po b/po/nl.po
index 27ef0b5aaba..9bc3c9f9e53 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -6043,7 +6043,7 @@ msgstr "Geen MDI-kindvenster.\n"
#: dlls/kernel32/winerror.mc:2628
msgid "Popup menu already active.\n"
-msgstr "Popup-menu reeds actief.\n"
+msgstr "Pop-up menu reeds actief.\n"
#: dlls/kernel32/winerror.mc:2633
msgid "No scrollbars.\n"
@@ -8102,7 +8102,7 @@ msgstr "client"
#: dlls/oleacc/oleacc.rc:42
msgid "popup menu"
-msgstr "popupmenu"
+msgstr "pop-up menu"
#: dlls/oleacc/oleacc.rc:43
msgid "menu item"
@@ -12961,7 +12961,7 @@ msgstr "&Verwijder dubbelen"
#: programs/conhost/conhost.rc:65
msgid "Popup menu"
-msgstr "Popup menu"
+msgstr "Pop-up menu"
#: programs/conhost/conhost.rc:66
msgid "&Control"
@@ -13021,7 +13021,7 @@ msgstr "H&oogte :"
#: programs/conhost/conhost.rc:111
msgid "End of program"
-msgstr "Programma is beëindigd"
+msgstr "Einde programma"
#: programs/conhost/conhost.rc:112
msgid "&Close console"
@@ -13029,7 +13029,7 @@ msgstr "&Console afsluiten"
#: programs/conhost/conhost.rc:114
msgid "Edition"
-msgstr "Versie"
+msgstr "Modus"
#: programs/conhost/conhost.rc:120
msgid "Console parameters"
@@ -16108,7 +16108,7 @@ msgstr ""
#: programs/wineboot/wineboot.rc:46
msgid "The Wine configuration in %s is being updated, please wait..."
msgstr ""
-"De Wine configuratie in %s wordt bijgewerkt, even geduld alstublieft..."
+"De Wine configuratie in %s wordt bijgewerkt.\nEven geduld alstublieft..."
#: programs/winecfg/winecfg.rc:140
msgid ""
@@ -16205,7 +16205,7 @@ msgid ""
msgstr ""
"Elke DLL (Dynamic Link Library) kan apart worden ingesteld op "
"'ingebouwd' (de versie van Wine) of 'windows' (afkomstig van Windows of "
-"meegeleverd met een programma."
+"meegeleverd met een programma)."
#: programs/winecfg/winecfg.rc:193
msgid "&New override for library:"
--
2.30.0
1
0