Compare commits

...

53 Commits
v5.19 ... v5.22

Author SHA1 Message Date
Alistair Leslie-Hughes
371d6ff606 Release v5.22 2020-11-21 11:24:11 +11:00
Alistair Leslie-Hughes
88ffa8d374 Rebase against bedfb9cae224a369efa4588332a5518dbee57035. 2020-11-21 09:56:05 +11:00
Alistair Leslie-Hughes
7734f7a808 Rebase against 65d917402f43d6c061668cff811f5fd6729d5750. 2020-11-19 14:33:39 +11:00
Alistair Leslie-Hughes
0192a7b36c Rebase against 764a93f121c6b0f88c3444454ebb85eb7cb63295. 2020-11-18 09:40:10 +11:00
Alistair Leslie-Hughes
5566259fb5 Rebase against 86e6c0bc28177a3794950fe2a13b8208400b6194. 2020-11-17 10:18:40 +11:00
Alistair Leslie-Hughes
7bdc1d6bac Updated eventfd_synchronization patchset 2020-11-15 14:23:28 +11:00
Alistair Leslie-Hughes
852a7d9a7d Removed dwmapi-DwmGetTransportAttributes patchset
Only contains tests, and DwmGetTransportAttributes is upstream.
2020-11-15 09:47:44 +11:00
Alistair Leslie-Hughes
3b6b470bca Rebase against cf49617c1a378dd4a37ab7226187708c501b046f. 2020-11-14 21:51:08 +11:00
Alistair Leslie-Hughes
cd3ee9b25d Rebase against 1f15ddce9c7d0ee71521d7b98c698488b76d3f01. 2020-11-12 09:22:07 +11:00
Alistair Leslie-Hughes
c7ea1850c7 Rebase against b940c5e7c91bff963336dd7d2c4defc3a82c75a1. 2020-11-11 10:26:07 +11:00
Alistair Leslie-Hughes
41c7c741d7 Updated mfplat-streaming-support patchset 2020-11-10 16:42:53 +11:00
Alistair Leslie-Hughes
009f571ba1 Rebase against 572aa09de1b0e3ba0e8b19f48d5e96539625bb0a. 2020-11-10 14:02:03 +11:00
Alistair Leslie-Hughes
e2d9f97b61 Release v5.21 2020-11-07 16:30:34 +11:00
Alistair Leslie-Hughes
c32fb530b8 Rebase against 70d77a439ab58dcf56664d1545aa0c4cd3edb31e. 2020-11-07 11:30:52 +11:00
Alistair Leslie-Hughes
9d2a93164f Rebase against 4919b9b99fe20cfb8599b7b827811fdd7937ea9d. 2020-11-06 11:12:16 +11:00
Alistair Leslie-Hughes
4130b2a71c Rebase against b793799d3d5facb765d97041669da4bc159b860b. 2020-11-05 11:02:49 +11:00
Alistair Leslie-Hughes
786cac8be4 Rebase against 908c837b17ac1c285ef32e98f53df730c3770295. 2020-11-04 10:18:49 +11:00
Paul Gofman
6ad4bdecd2 Updated ntdll-Syscall_Emulation patchset. 2020-11-03 19:55:50 +03:00
Alistair Leslie-Hughes
950d7c6c43 Rebase against dfa4c07941322dbcad54507cd0acf271a6c719ab. 2020-11-03 20:45:48 +11:00
Zebediah Figura
66561ecf5d patchinstall.py: Remove the autogenerated patch list. 2020-11-01 15:25:10 -06:00
Alistair Leslie-Hughes
7925f8829e Fix rebase 2020-11-01 08:27:02 +11:00
Alistair Leslie-Hughes
f7739e7052 Rebase against 03eaa2cc93e5e2ea4c36495870c268797aea3ca8. 2020-10-31 19:32:08 +11:00
Alistair Leslie-Hughes
44f49e8001 Rebase against c9e2deac39924473ac538ee22a2a0c0dbe3bad85. 2020-10-30 14:28:10 +11:00
Zebediah Figura
c118dfd709 msxml3-FreeThreadedXMLHTTP60: Restore a mistakenly deleted hunk.
Spotted by Gijs Vermeulen.
2020-10-29 10:47:54 -05:00
Alistair Leslie-Hughes
c811f7aa7e Rebase against 03395fdf71b606b589b917eab5d4766842188b91. 2020-10-29 15:52:40 +11:00
Alistair Leslie-Hughes
495ae4e9af Updated mfplat-streaming-support patchset 2020-10-28 15:13:16 +11:00
Alistair Leslie-Hughes
819539b19f Updated dinput-remap-joystick patchset
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50066
2020-10-28 15:10:34 +11:00
Zebediah Figura
bd2086ff97 Rebase against 2148167f2557cc6c7d1e2f5ffef28bd936503a9a. 2020-10-27 17:40:08 -05:00
Zebediah Figura
db6b6282eb bcrypt-ECDHSecretAgreement: Also add a missing RESOLVE_FUNC for key_asymmetric_duplicate.
Spotted by Juuso Alasuutari <juuso.alasuutari@gmail.com>.
2020-10-27 10:43:26 -05:00
Erich E. Hoover
3dc5147b28 ntdll-Junction_Points: Updates from Erich E. Hoover. 2020-10-26 22:07:42 -05:00
Zebediah Figura
d1a75649b7 bcrypt-ECDHSecretAgreement: Add a missing function table entry. 2020-10-26 18:44:49 -05:00
Zebediah Figura
40dda2bf72 Rebase against 93107c08f5aa7f37ad7ece9cd7ca248dba3030ce. 2020-10-26 18:36:59 -05:00
Zebediah Figura
534f6ae34e ntdll-Fix_Aligment: Remove patch set.
This is fixed upstream, presumably by e3e477e6a14fbcb153258b47d1905915dc4c1f22.
2020-10-24 15:42:52 -05:00
Zebediah Figura
411aeb2398 server-Stored_ACLs: Restore some definitions for FreeBSD. 2020-10-24 10:28:29 -05:00
Zebediah Figura
7e7e0bbe3e ntdll-DOS_Attributes: Restore some definitions for FreeBSD. 2020-10-24 10:28:17 -05:00
Alistair Leslie-Hughes
bf69e4ee2b Release v5.20 2020-10-24 12:18:18 +11:00
Alistair Leslie-Hughes
8d04884c1f Updated winex11.drv-Query_server_position patchset
Reverted to the older patch to stop issues with windows
not being hidden correctly.
2020-10-22 12:40:44 +11:00
Alistair Leslie-Hughes
8d07859cb1 Rebase against f6a5a3d03c1eb914444af96352ca54eec79d7e2c. 2020-10-22 08:18:16 +11:00
Alistair Leslie-Hughes
05efccaeaf Fix rebase 2020-10-21 20:19:12 +11:00
Alistair Leslie-Hughes
8cacc0d955 Updated mfplat-streaming-support patchset 2020-10-21 17:52:40 +11:00
Alistair Leslie-Hughes
5b5a6de9b8 Rebase against 42bba70a024060fbd698aadec20fbb6f61ad9e16. 2020-10-21 16:32:58 +11:00
Zebediah Figura
be9c96813a eventfd_synchronization: Create esync file descriptors for console server objects. 2020-10-17 19:24:53 -05:00
Zebediah Figura
ed56966feb eventfd_synchronization: Rebase and reënable. 2020-10-17 16:57:58 -05:00
Alistair Leslie-Hughes
80498dd440 Rebase against de679af492ed93d70c99dff7f7cfc01cc8f25eb0. 2020-10-16 10:49:21 +11:00
Alistair Leslie-Hughes
601cfd7fdb Updated mfplat-streaming-support patchset 2020-10-15 16:57:57 +11:00
Alistair Leslie-Hughes
6d726da3ba Rebase against e909986e6ea5ecd49b2b847f321ad89b2ae4f6f1. 2020-10-15 09:36:18 +11:00
Alistair Leslie-Hughes
6a87f0a479 Updated windows.networking.connectivity.dll patchset 2020-10-14 18:26:41 +11:00
Alistair Leslie-Hughes
2d12fd01d7 Updated windows.globalization-dll patchset 2020-10-14 18:24:09 +11:00
Alistair Leslie-Hughes
fbf364bce9 Updated windows.gaming.input-dll patchset 2020-10-14 18:12:00 +11:00
Alistair Leslie-Hughes
23ca7fe894 Updated windows.media.speech.dll patchset 2020-10-14 18:00:35 +11:00
Alistair Leslie-Hughes
ae8bdc6121 Added widl-winrt-support patchset 2020-10-14 17:43:08 +11:00
Alistair Leslie-Hughes
3cea972271 Rebase against f4a66ad257df4605e73dfea792eec55a70a04e84. 2020-10-14 08:12:47 +11:00
Paul Gofman
b49e874386 Updated and reenabled ntdll-FLS_Callbacks patchset. 2020-10-10 15:23:36 +03:00
277 changed files with 13223 additions and 14048 deletions

View File

@@ -1,4 +1,4 @@
From 104e3d8f36af9bc2179f7878b4f99b7417f59376 Mon Sep 17 00:00:00 2001
From ef218059ebea8a860dea6b12a7b28984c51d2777 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Fri, 2 Oct 2020 11:29:24 -0500
Subject: [PATCH] bcrypt: Allow multiple backends to coexist.
@@ -7,10 +7,10 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
dlls/bcrypt/Makefile.in | 3 +-
dlls/bcrypt/bcrypt_internal.h | 3 +
dlls/bcrypt/gnutls.c | 34 +++++--
dlls/bcrypt/macos.c | 20 +++-
dlls/bcrypt/unixlib.c | 186 ++++++++++++++++++++++++++++++++++
5 files changed, 229 insertions(+), 17 deletions(-)
dlls/bcrypt/gnutls.c | 32 ++++--
dlls/bcrypt/macos.c | 18 +++-
dlls/bcrypt/unixlib.c | 194 ++++++++++++++++++++++++++++++++++
5 files changed, 235 insertions(+), 15 deletions(-)
create mode 100644 dlls/bcrypt/unixlib.c
diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in
@@ -27,10 +27,10 @@ index 24803fb2d7c..46a20d473dd 100644
RC_SRCS = version.rc
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index 5edc9e6c9c6..29db7210b59 100644
index 463672db470..90551868cf0 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -210,4 +210,7 @@ struct key_funcs
@@ -215,4 +215,7 @@ struct key_funcs
NTSTATUS (CDECL *key_import_ecc)( struct key *, UCHAR *, ULONG );
};
@@ -39,10 +39,10 @@ index 5edc9e6c9c6..29db7210b59 100644
+
#endif /* __BCRYPT_INTERNAL_H */
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index 21520bb4a84..b761c732acf 100644
index 5ed51e8704c..7a1eada329c 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -332,9 +332,12 @@ fail:
@@ -347,9 +347,12 @@ fail:
static void gnutls_uninitialize(void)
{
@@ -58,16 +58,7 @@ index 21520bb4a84..b761c732acf 100644
}
struct buffer
@@ -1568,7 +1571,7 @@ static void CDECL key_asymmetric_destroy( struct key *key )
if (key_data(key)->privkey) pgnutls_privkey_deinit( key_data(key)->privkey );
}
-static const struct key_funcs key_funcs =
+static struct key_funcs key_funcs =
{
key_set_property,
key_symmetric_init,
@@ -1589,19 +1592,28 @@ static const struct key_funcs key_funcs =
@@ -1848,19 +1851,28 @@ static const struct key_funcs key_funcs =
key_import_ecc
};
@@ -104,19 +95,10 @@ index 21520bb4a84..b761c732acf 100644
+}
+#endif
diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c
index 37615e97689..5868b445625 100644
index d8bba46ad5c..8df5ca8645f 100644
--- a/dlls/bcrypt/macos.c
+++ b/dlls/bcrypt/macos.c
@@ -259,7 +259,7 @@ static void CDECL key_asymmetric_destroy( struct key *key )
{
}
-static const struct key_funcs key_funcs =
+static struct key_funcs key_funcs =
{
key_set_property,
key_symmetric_init,
@@ -280,11 +280,21 @@ static const struct key_funcs key_funcs =
@@ -287,11 +287,21 @@ static const struct key_funcs key_funcs =
key_import_ecc
};
@@ -144,10 +126,10 @@ index 37615e97689..5868b445625 100644
#endif
diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c
new file mode 100644
index 00000000000..791b5d54188
index 00000000000..a158ec1630a
--- /dev/null
+++ b/dlls/bcrypt/unixlib.c
@@ -0,0 +1,186 @@
@@ -0,0 +1,194 @@
+#if 0
+#pragma makedep unix
+#endif
@@ -268,6 +250,12 @@ index 00000000000..791b5d54188
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS CDECL key_asymmetric_duplicate( struct key *key_orig, struct key *key_copy )
+{
+ FIXME( "not implemented\n" );
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static void CDECL key_asymmetric_destroy( struct key *key )
+{
+ FIXME( "not implemented\n" );
@@ -285,6 +273,7 @@ index 00000000000..791b5d54188
+ key_symmetric_destroy,
+ key_asymmetric_init,
+ key_asymmetric_generate,
+ key_asymmetric_duplicate,
+ key_asymmetric_sign,
+ key_asymmetric_verify,
+ key_asymmetric_destroy,
@@ -317,6 +306,7 @@ index 00000000000..791b5d54188
+ RESOLVE_FUNC(symmetric_destroy)
+ RESOLVE_FUNC(asymmetric_init)
+ RESOLVE_FUNC(asymmetric_generate)
+ RESOLVE_FUNC(asymmetric_duplicate)
+ RESOLVE_FUNC(asymmetric_sign)
+ RESOLVE_FUNC(asymmetric_verify)
+ RESOLVE_FUNC(asymmetric_destroy)

View File

@@ -1,4 +1,4 @@
From dd993178a8e0f8db6b09e059ba39820c9b609913 Mon Sep 17 00:00:00 2001
From 6f2d3fa75e7fd783816d52af0ca9b3c16f2a947e Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Fri, 2 Oct 2020 12:11:49 -0500
Subject: [PATCH] bcrypt: Implement BCryptSecretAgreement with libgcrypt.
@@ -9,16 +9,16 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
dlls/bcrypt/Makefile.in | 1 +
dlls/bcrypt/bcrypt_internal.h | 4 +
dlls/bcrypt/bcrypt_main.c | 55 ++++++-
dlls/bcrypt/gcrypt.c | 289 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gcrypt.c | 290 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gnutls.c | 3 +-
dlls/bcrypt/macos.c | 3 +-
dlls/bcrypt/tests/bcrypt.c | 2 +-
dlls/bcrypt/unixlib.c | 15 +-
9 files changed, 376 insertions(+), 10 deletions(-)
9 files changed, 377 insertions(+), 10 deletions(-)
create mode 100644 dlls/bcrypt/gcrypt.c
diff --git a/configure.ac b/configure.ac
index 865aa924d07..35233aa5d08 100644
index 372785ee0fd..68fff9bf6d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ AC_ARG_WITH(faudio, AS_HELP_STRING([--without-faudio],[do not use FAudio (XAu
@@ -62,7 +62,7 @@ index 46a20d473dd..4a3016784af 100644
macos.c \
md2.c \
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index 7563d19aac5..f4fcfebabd6 100644
index 90551868cf0..03254f72d92 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -191,6 +191,8 @@ struct key
@@ -74,7 +74,7 @@ index 7563d19aac5..f4fcfebabd6 100644
};
struct key_funcs
@@ -212,9 +214,11 @@ struct key_funcs
@@ -213,9 +215,11 @@ struct key_funcs
NTSTATUS (CDECL *key_export_ecc)( struct key *, UCHAR *, ULONG, ULONG * );
NTSTATUS (CDECL *key_import_dsa_capi)( struct key *, UCHAR *, ULONG );
NTSTATUS (CDECL *key_import_ecc)( struct key *, UCHAR *, ULONG );
@@ -87,10 +87,10 @@ index 7563d19aac5..f4fcfebabd6 100644
#endif /* __BCRYPT_INTERNAL_H */
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index a91f31e9f09..6787b0d66cb 100644
index 85d06f6001e..0f023d02076 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1807,9 +1807,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1828,9 +1828,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
{
struct key *privkey = privatekey;
struct key *pubkey = publickey;
@@ -104,7 +104,7 @@ index a91f31e9f09..6787b0d66cb 100644
if (!privkey || privkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!pubkey || pubkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
@@ -1818,18 +1821,39 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1839,18 +1842,39 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
if (!(secret = heap_alloc_zero( sizeof(*secret) ))) return STATUS_NO_MEMORY;
secret->hdr.magic = MAGIC_SECRET;
@@ -146,7 +146,7 @@ index a91f31e9f09..6787b0d66cb 100644
heap_free( secret );
return STATUS_SUCCESS;
}
@@ -1839,12 +1863,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
@@ -1860,12 +1884,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
{
struct secret *secret = handle;
@@ -184,10 +184,10 @@ index a91f31e9f09..6787b0d66cb 100644
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
diff --git a/dlls/bcrypt/gcrypt.c b/dlls/bcrypt/gcrypt.c
new file mode 100644
index 00000000000..d127e1a2903
index 00000000000..00849358c68
--- /dev/null
+++ b/dlls/bcrypt/gcrypt.c
@@ -0,0 +1,289 @@
@@ -0,0 +1,290 @@
+#if 0
+#pragma makedep unix
+#endif
@@ -449,6 +449,7 @@ index 00000000000..d127e1a2903
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ key_compute_secret_ecc
+};
+
@@ -478,10 +479,10 @@ index 00000000000..d127e1a2903
+}
+#endif
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index cffaa2a5c77..aa60054d315 100644
index 7a1eada329c..4505a8d965c 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -1754,7 +1754,8 @@ static struct key_funcs key_funcs =
@@ -1848,7 +1848,8 @@ static const struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@@ -492,10 +493,10 @@ index cffaa2a5c77..aa60054d315 100644
struct key_funcs * gnutls_lib_init( DWORD reason )
diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c
index 5868b445625..a631d42b3f1 100644
index 8df5ca8645f..e44436a73fb 100644
--- a/dlls/bcrypt/macos.c
+++ b/dlls/bcrypt/macos.c
@@ -277,7 +277,8 @@ static struct key_funcs key_funcs =
@@ -284,7 +284,8 @@ static const struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@@ -506,7 +507,7 @@ index 5868b445625..a631d42b3f1 100644
struct key_funcs * macos_lib_init( DWORD reason )
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index d499ce65a65..334694c4336 100644
index 0ae4b5dad53..559f49ec78c 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -2102,7 +2102,7 @@ static void test_ECDH(void)
@@ -519,10 +520,10 @@ index d499ce65a65..334694c4336 100644
if (status != STATUS_SUCCESS)
{
diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c
index 791b5d54188..a691d82afe2 100644
index c122df63f0b..fabb0ea40aa 100644
--- a/dlls/bcrypt/unixlib.c
+++ b/dlls/bcrypt/unixlib.c
@@ -123,6 +123,12 @@ static void CDECL key_asymmetric_destroy( struct key *key )
@@ -129,6 +129,12 @@ static void CDECL key_asymmetric_destroy( struct key *key )
FIXME( "not implemented\n" );
}
@@ -535,7 +536,7 @@ index 791b5d54188..a691d82afe2 100644
static struct key_funcs key_funcs =
{
key_set_property,
@@ -141,13 +147,15 @@ static struct key_funcs key_funcs =
@@ -148,13 +154,15 @@ static struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@@ -552,7 +553,7 @@ index 791b5d54188..a691d82afe2 100644
if (reason == DLL_PROCESS_ATTACH)
{
@@ -155,7 +163,9 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
@@ -162,7 +170,9 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
if (macos_funcs && macos_funcs->key_##name) \
key_funcs.key_##name = macos_funcs->key_##name; \
if (gnutls_funcs && gnutls_funcs->key_##name) \
@@ -563,7 +564,7 @@ index 791b5d54188..a691d82afe2 100644
RESOLVE_FUNC(set_property)
RESOLVE_FUNC(symmetric_init)
@@ -174,6 +184,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
@@ -181,6 +191,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
RESOLVE_FUNC(export_ecc)
RESOLVE_FUNC(import_dsa_capi)
RESOLVE_FUNC(import_ecc)

View File

@@ -1,167 +0,0 @@
From b037d19858277d7dde0df6cdf4678a55517366af Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Tue, 22 Sep 2020 22:00:11 -0600
Subject: [PATCH] winspool: Add sRGB color profile
"This profile is made available by the International Color Consortium,
and may be copied, distributed, embedded, made, used, and sold without
restriction. Altered versions of this profile shall have the original
identification and copyright information removed and shall not be
misrepresented as the original profile."
See http://www.color.org/srgbprofiles.xalter
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37396
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
.../winspool.drv/sRGB_Color_Space_Profile.icm | Bin 0 -> 3024 bytes
dlls/winspool.drv/winspool.rc | 3 ++
dlls/winspool.drv/wspool.c | 38 ++++++++++++++++++
dlls/winspool.drv/wspool.h | 2 +
4 files changed, 43 insertions(+)
create mode 100644 dlls/winspool.drv/sRGB_Color_Space_Profile.icm
diff --git a/dlls/winspool.drv/sRGB_Color_Space_Profile.icm b/dlls/winspool.drv/sRGB_Color_Space_Profile.icm
new file mode 100644
index 0000000000000000000000000000000000000000..49afbfef10f22a1832590b68369d2f248ea553b9
GIT binary patch
literal 3024
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
literal 0
HcmV?d00001
diff --git a/dlls/winspool.drv/winspool.rc b/dlls/winspool.drv/winspool.rc
index 50772ce60bb..1b573be096e 100644
--- a/dlls/winspool.drv/winspool.rc
+++ b/dlls/winspool.drv/winspool.rc
@@ -47,6 +47,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: generic.ppd */
1 PPDFILE generic.ppd
+/* @makedep: sRGB_Color_Space_Profile.icm */
+IDR_SRGB_ICM RCDATA sRGB_Color_Space_Profile.icm
+
#define WINE_FILENAME_STR "winspool.drv"
#define WINE_FILEDESCRIPTION_STR "Wine core printer driver"
diff --git a/dlls/winspool.drv/wspool.c b/dlls/winspool.drv/wspool.c
index bbfb0fb0f42..baa7bfdb455 100644
--- a/dlls/winspool.drv/wspool.c
+++ b/dlls/winspool.drv/wspool.c
@@ -104,6 +104,43 @@ BOOL load_backend(void)
return FALSE;
}
+static void create_color_profiles(void)
+{
+ static const WCHAR color_dir[] = {'\\','s','p','o','o','l',
+ '\\','d','r','i','v','e','r','s',
+ '\\','c','o','l','o','r','\\',0};
+ static const WCHAR srgb_icm[] = {'s','R','G','B',' ',
+ 'C','o','l','o','r',' ',
+ 'S','p','a','c','e',' ',
+ 'P','r','o','f','i','l','e','.','i','c','m',0};
+ WCHAR profile_path[MAX_PATH];
+ HANDLE file;
+ HRSRC res;
+ DWORD size, written;
+ char *data;
+ BOOL ret;
+
+ GetSystemDirectoryW(profile_path, ARRAY_SIZE(profile_path));
+ lstrcatW(profile_path, color_dir);
+ lstrcatW(profile_path, srgb_icm);
+
+ file = CreateFileW(profile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (file == INVALID_HANDLE_VALUE)
+ return;
+
+ ret = ((res = FindResourceA(WINSPOOL_hInstance, MAKEINTRESOURCEA(IDR_SRGB_ICM), (const char *)RT_RCDATA)) &&
+ (size = SizeofResource(WINSPOOL_hInstance, res)) &&
+ (data = LoadResource(WINSPOOL_hInstance, res)) &&
+ WriteFile(file, data, size, &written, NULL) &&
+ written == size);
+ CloseHandle(file);
+ if (!ret)
+ {
+ ERR("Failed to create %s\n", wine_dbgstr_w(profile_path));
+ DeleteFileW(profile_path);
+ }
+}
+
/******************************************************************************
* DllMain
*
@@ -118,6 +155,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD reason, LPVOID lpReserved)
WINSPOOL_hInstance = hInstance;
DisableThreadLibraryCalls(hInstance);
WINSPOOL_LoadSystemPrinters();
+ create_color_profiles();
break;
}
case DLL_PROCESS_DETACH:
diff --git a/dlls/winspool.drv/wspool.h b/dlls/winspool.drv/wspool.h
index 06c28231330..a229b1ffe88 100644
--- a/dlls/winspool.drv/wspool.h
+++ b/dlls/winspool.drv/wspool.h
@@ -33,5 +33,7 @@ extern void WINSPOOL_LoadSystemPrinters(void) DECLSPEC_HIDDEN;
#define IDS_FILE_EXISTS 11
#define IDS_CANNOT_OPEN 12
+#define IDR_SRGB_ICM 2
+
#define FILENAME_DIALOG 100
#define EDITBOX 201
--
2.28.0

View File

@@ -1 +0,0 @@
Fixes: [37396] Add sRGB color profile.

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] dinput: Allow remapping of joystick buttons
Changed
- Change the array to store the origial button.
- Remove lookup loops.
- Changed max Buttons to 32 to match DIJOYSTATE structure.
- Changed max Buttons to 128 to match DIJOYSTATE2 structure.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=35815
---
@@ -119,7 +119,7 @@ index e758cac..4a382c2 100644
struct JoystickGenericImpl;
+/* Number of buttons for which to allow remapping */
+#define MAX_MAP_BUTTONS 32
+#define MAX_MAP_BUTTONS 128
+
typedef void joy_polldev_handler(LPDIRECTINPUTDEVICE8A iface);

View File

@@ -1,36 +0,0 @@
From b9eb0aeed5bc09d8a54c383c9d5149cacf36f1c3 Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Wed, 5 Dec 2018 13:18:26 +0100
Subject: [PATCH] dwmapi: Add tests for DwmGetTransportAttributes().
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
---
dlls/dwmapi/tests/dwmapi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/dwmapi/tests/dwmapi.c b/dlls/dwmapi/tests/dwmapi.c
index 1904e283bba..d79861f53ed 100644
--- a/dlls/dwmapi/tests/dwmapi.c
+++ b/dlls/dwmapi/tests/dwmapi.c
@@ -33,7 +33,18 @@ static void test_DwmIsCompositionEnabled(void)
ok(enabled == TRUE || enabled == FALSE, "Got unexpected %#x.\n", enabled);
}
+static void test_dwm_get_transport_attributes(void)
+{
+ BOOL isremoting, isconnected;
+ DWORD generation;
+ HRESULT hr;
+
+ hr = DwmGetTransportAttributes(&isremoting, &isconnected, &generation);
+ ok(hr == S_OK || hr == DWM_E_COMPOSITIONDISABLED, "Got unexpected %#x.\n", hr);
+}
+
START_TEST(dwmapi)
{
test_DwmIsCompositionEnabled();
+ test_dwm_get_transport_attributes();
}
--
2.27.0

View File

@@ -1 +0,0 @@
# Tests for bug 31350.

View File

@@ -1,301 +0,0 @@
From 70a09ccf3108ded29c3049ab3ee5aea843b43215 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 02:59:17 +0200
Subject: [PATCH] dxdiagn: Enumerate DirectSound devices and add some basic
properties.
---
dlls/dxdiagn/Makefile.in | 2 +-
dlls/dxdiagn/provider.c | 91 +++++++++++++++++++++++
dlls/dxdiagn/tests/container.c | 131 +++++++++++++++++++++++++++++++++
3 files changed, 223 insertions(+), 1 deletion(-)
diff --git a/dlls/dxdiagn/Makefile.in b/dlls/dxdiagn/Makefile.in
index fa4b611f245..88c99803b06 100644
--- a/dlls/dxdiagn/Makefile.in
+++ b/dlls/dxdiagn/Makefile.in
@@ -1,5 +1,5 @@
MODULE = dxdiagn.dll
-IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 user32 advapi32
+IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 user32 advapi32 dsound
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 6b6f4e640cc..4ae5046b818 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -36,6 +36,7 @@
#include "wine/fil_data.h"
#include "psapi.h"
#include "wbemcli.h"
+#include "dsound.h"
#include "wine/debug.h"
@@ -1364,11 +1365,85 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
return fill_display_information_fallback(node);
}
+struct enum_context
+{
+ IDxDiagContainerImpl_Container *cont;
+ HRESULT hr;
+ int index;
+};
+
+static const WCHAR szGUIDFmt[] =
+{
+ '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0',
+ '2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2',
+ 'x','%','0','2','x','%','0','2','x','%','0','2','x',0
+};
+
+static LPWSTR guid_to_string(LPWSTR lpwstr, REFGUID lpcguid)
+{
+ wsprintfW(lpwstr, szGUIDFmt, lpcguid->Data1, lpcguid->Data2,
+ lpcguid->Data3, lpcguid->Data4[0], lpcguid->Data4[1],
+ lpcguid->Data4[2], lpcguid->Data4[3], lpcguid->Data4[4],
+ lpcguid->Data4[5], lpcguid->Data4[6], lpcguid->Data4[7]);
+
+ return lpwstr;
+}
+
+BOOL CALLBACK dsound_enum(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID context)
+{
+ static const WCHAR deviceid_fmtW[] = {'%','u',0};
+ static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+ static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+
+ struct enum_context *enum_ctx = context;
+ IDxDiagContainerImpl_Container *device;
+ WCHAR buffer[256];
+ const WCHAR *p, *name;
+
+ /* the default device is enumerated twice, one time without GUID */
+ if (!guid) return TRUE;
+
+ _snwprintf(buffer, sizeof(buffer)/sizeof(WCHAR), deviceid_fmtW, enum_ctx->index);
+ device = allocate_information_node(buffer);
+ if (!device)
+ {
+ enum_ctx->hr = E_OUTOFMEMORY;
+ return FALSE;
+ }
+
+ add_subcontainer(enum_ctx->cont, device);
+
+ guid_to_string(buffer, guid);
+ enum_ctx->hr = add_bstr_property(device, szGuidDeviceID, buffer);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->hr = add_bstr_property(device, szDescription, desc);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->hr = add_bstr_property(device, szDriverPath, module);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ name = module;
+ if ((p = wcsrchr(name, '\\'))) name = p + 1;
+ if ((p = wcsrchr(name, '/'))) name = p + 1;
+
+ enum_ctx->hr = add_bstr_property(device, szDriverName, name);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->index++;
+ return TRUE;
+}
+
static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
static const WCHAR DxDiag_SoundCaptureDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e','D','e','v','i','c','e','s',0};
+ struct enum_context enum_ctx;
IDxDiagContainerImpl_Container *cont;
cont = allocate_information_node(DxDiag_SoundDevices);
@@ -1377,12 +1452,28 @@ static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
add_subcontainer(node, cont);
+ enum_ctx.cont = cont;
+ enum_ctx.hr = S_OK;
+ enum_ctx.index = 0;
+
+ DirectSoundEnumerateW(dsound_enum, &enum_ctx);
+ if (FAILED(enum_ctx.hr))
+ return enum_ctx.hr;
+
cont = allocate_information_node(DxDiag_SoundCaptureDevices);
if (!cont)
return E_OUTOFMEMORY;
add_subcontainer(node, cont);
+ enum_ctx.cont = cont;
+ enum_ctx.hr = S_OK;
+ enum_ctx.index = 0;
+
+ DirectSoundCaptureEnumerateW(dsound_enum, &enum_ctx);
+ if (FAILED(enum_ctx.hr))
+ return enum_ctx.hr;
+
return S_OK;
}
diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c
index c011ff9cc07..3f9f9d6d29f 100644
--- a/dlls/dxdiagn/tests/container.c
+++ b/dlls/dxdiagn/tests/container.c
@@ -922,6 +922,135 @@ cleanup:
IDxDiagProvider_Release(pddp);
}
+static void test_DxDiag_SoundDevices(void)
+{
+ static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
+ static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+ static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+ static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+
+ static const struct property_test property_tests[] =
+ {
+ {szDescription, VT_BSTR},
+ {szGuidDeviceID, VT_BSTR},
+ {szDriverName, VT_BSTR},
+ {szDriverPath, VT_BSTR},
+ };
+
+ IDxDiagContainer *sound_cont = NULL;
+ DWORD count, i;
+ HRESULT hr;
+
+ if (!create_root_IDxDiagContainer())
+ {
+ skip("Unable to create the root IDxDiagContainer\n");
+ return;
+ }
+
+ hr = IDxDiagContainer_GetChildContainer(pddc, L"DxDiag_SoundDevices", &sound_cont);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+ if (hr == S_OK)
+ ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+ hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ for (i = 0; i < count; i++)
+ {
+ WCHAR child_container[256];
+ IDxDiagContainer *child;
+
+ hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+ ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+ hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr == S_OK)
+ {
+ trace("Testing container %s\n", wine_dbgstr_w(child_container));
+ test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+ }
+ IDxDiagContainer_Release(child);
+ }
+
+cleanup:
+ if (sound_cont) IDxDiagContainer_Release(sound_cont);
+ IDxDiagContainer_Release(pddc);
+ IDxDiagProvider_Release(pddp);
+}
+
+static void test_DxDiag_SoundCaptureDevices(void)
+{
+ static const struct property_test property_tests[] =
+ {
+ {L"szDescription", VT_BSTR},
+ {L"szGuidDeviceID", VT_BSTR},
+ {L"szDriverPath", VT_BSTR},
+ {L"szDriverName", VT_BSTR},
+ };
+
+ IDxDiagContainer *sound_cont = NULL;
+ DWORD count, i;
+ HRESULT hr;
+
+ if (!create_root_IDxDiagContainer())
+ {
+ skip("Unable to create the root IDxDiagContainer\n");
+ return;
+ }
+
+ hr = IDxDiagContainer_GetChildContainer(pddc, L"DxDiag_SoundCaptureDevices", &sound_cont);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+ if (hr == S_OK)
+ ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+ hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ for (i = 0; i < count; i++)
+ {
+ WCHAR child_container[256];
+ IDxDiagContainer *child;
+
+ hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+ ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+ hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr == S_OK)
+ {
+ trace("Testing container %s\n", wine_dbgstr_w(child_container));
+ test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+ }
+ IDxDiagContainer_Release(child);
+ }
+
+cleanup:
+ if (sound_cont) IDxDiagContainer_Release(sound_cont);
+ IDxDiagContainer_Release(pddc);
+ IDxDiagProvider_Release(pddp);
+}
+
START_TEST(container)
{
CoInitialize(NULL);
@@ -936,5 +1065,7 @@ START_TEST(container)
test_root_children();
test_DxDiag_SystemInfo();
test_DxDiag_DisplayDevices();
+ test_DxDiag_SoundDevices();
+ test_DxDiag_SoundCaptureDevices();
CoUninitialize();
}
--
2.28.0

View File

@@ -1 +0,0 @@
Fixes: [32613] Implement enumeration of sound devices and basic properties to dxdiagn

View File

@@ -1,107 +0,0 @@
From 8f0d1a97147714cdee9f69781f6b919bf005aed0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 03:58:04 +0200
Subject: [PATCH] dxdiagn: Calling GetChildContainer with an empty string on a
leaf container returns the object itself
---
dlls/dxdiagn/container.c | 4 ++--
dlls/dxdiagn/tests/container.c | 25 +++++++++++++++++++++++--
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/dxdiagn/container.c b/dlls/dxdiagn/container.c
index 87d593a15a7..d84f185a795 100644
--- a/dlls/dxdiagn/container.c
+++ b/dlls/dxdiagn/container.c
@@ -167,7 +167,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i
TRACE("Trying to get parent container %s\n", debugstr_w(tmp));
hr = IDxDiagContainerImpl_GetChildContainerInternal(pContainer, tmp, &pContainer);
if (FAILED(hr))
- goto on_error;
+ goto out;
cur++; /* go after '.' (just replaced by \0) */
tmp = cur;
cur = wcschr(tmp, '.');
@@ -181,7 +181,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i
TRACE("Succeeded in getting the container instance\n");
}
-on_error:
+out:
HeapFree(GetProcessHeap(), 0, orig_tmp);
return hr;
}
diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c
index 18423779075..350b46a0253 100644
--- a/dlls/dxdiagn/tests/container.c
+++ b/dlls/dxdiagn/tests/container.c
@@ -819,7 +819,8 @@ static void test_DxDiag_SystemInfo(void)
{L"szProcessorEnglish", VT_BSTR},
};
- IDxDiagContainer *container;
+ IDxDiagContainer *container, *container2;
+ static const WCHAR empty[] = {0};
HRESULT hr;
if (!create_root_IDxDiagContainer())
@@ -828,6 +829,9 @@ static void test_DxDiag_SystemInfo(void)
return;
}
+ hr = IDxDiagContainer_GetChildContainer(pddc, empty, &container2);
+ ok(hr == E_INVALIDARG, "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr);
+
hr = IDxDiagContainer_GetChildContainer(pddc, L"DxDiag_SystemInfo", &container);
ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
@@ -835,6 +839,14 @@ static void test_DxDiag_SystemInfo(void)
{
trace("Testing container DxDiag_SystemInfo\n");
test_container_properties(container, property_tests, ARRAY_SIZE(property_tests));
+
+ container2 = NULL;
+ hr = IDxDiagContainer_GetChildContainer(container, empty, &container2);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+ ok(container2 != NULL, "Expected container2 != NULL\n");
+ ok(container2 != container, "Expected container != container2\n");
+ if (hr == S_OK) IDxDiagContainer_Release(container2);
+
IDxDiagContainer_Release(container);
}
@@ -928,6 +940,7 @@ static void test_DxDiag_SoundDevices(void)
static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+ static const WCHAR empty[] = {0};
static const struct property_test property_tests[] =
{
@@ -967,7 +980,7 @@ static void test_DxDiag_SoundDevices(void)
for (i = 0; i < count; i++)
{
WCHAR child_container[256];
- IDxDiagContainer *child;
+ IDxDiagContainer *child, *child2;
hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
@@ -980,6 +993,14 @@ static void test_DxDiag_SoundDevices(void)
trace("Testing container %s\n", wine_dbgstr_w(child_container));
test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
}
+
+ child2 = NULL;
+ hr = IDxDiagContainer_GetChildContainer(child, empty, &child2);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+ ok(child2 != NULL, "Expected child2 != NULL\n");
+ ok(child2 != child, "Expected child != child2\n");
+ if (hr == S_OK) IDxDiagContainer_Release(child2);
+
IDxDiagContainer_Release(child);
}
--
2.28.0

View File

@@ -1,2 +0,0 @@
Fixes: [38014] Implement special handling for calling GetChildContainer with an empty string
Depends: dxdiagn-Enumerate_DirectSound

View File

@@ -1,4 +1,4 @@
From e0719eabba7a7c187767441b361acedd50766234 Mon Sep 17 00:00:00 2001
From 723ccff12d0b9516490e34519e244a6486d11b8b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 13 Jun 2018 10:44:49 -0500
Subject: [PATCH] configure: Check for sys/eventfd.h, ppoll(), and shm_open().
@@ -7,14 +7,16 @@ We use ppoll() instead of poll() for the better time granularity.
Although perhaps we shouldn't since the server doesn't do this.
---
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
configure | 68 +++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 12 ++++++++
include/config.h.in | 9 ++++++
3 files changed, 89 insertions(+)
diff --git a/configure.ac b/configure.ac
index da5f24aba5f..6c2653c4c82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,6 +509,7 @@ AC_CHECK_HEADERS(\
diff --git a/configure b/configure
index 5672688a0d7..24ae489c3a9 100755
--- a/configure
+++ b/configure
@@ -7467,6 +7467,7 @@ for ac_header in \
sys/cdio.h \
sys/epoll.h \
sys/event.h \
@@ -22,7 +24,7 @@ index da5f24aba5f..6c2653c4c82 100644
sys/filio.h \
sys/ioctl.h \
sys/ipc.h \
@@ -2191,6 +2192,7 @@ AC_CHECK_FUNCS(\
@@ -17815,6 +17816,7 @@ for ac_func in \
pipe2 \
poll \
port_create \
@@ -30,7 +32,100 @@ index da5f24aba5f..6c2653c4c82 100644
prctl \
pread \
proc_pidinfo \
@@ -2265,6 +2267,16 @@ case $host_os in
@@ -18224,6 +18226,72 @@ fi
;;
esac
+if test "$ac_cv_header_sys_mman_h" = "yes" -a "x$RT_LIBS" = "x"
+then
+ ac_save_LIBS=$LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5
+$as_echo_n "checking for library containing shm_open... " >&6; }
+if ${ac_cv_search_shm_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shm_open ();
+int
+main ()
+{
+return shm_open ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' rt; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_shm_open=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_shm_open+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_shm_open+:} false; then :
+
+else
+ ac_cv_search_shm_open=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_open" >&5
+$as_echo "$ac_cv_search_shm_open" >&6; }
+ac_res=$ac_cv_search_shm_open
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_SHM_OPEN 1" >>confdefs.h
+
+ test "$ac_res" = "none required" || RT_LIBS="$ac_res"
+
+fi
+
+fi
+LIBS=$ac_save_LIBS
+
if test "x$with_ldap" != "xno"
then
if ${LDAP_CFLAGS:+false} :; then :
diff --git a/configure.ac b/configure.ac
index 7a03cbc1cab..bfa64a8d68a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -494,6 +494,7 @@ AC_CHECK_HEADERS(\
sys/cdio.h \
sys/epoll.h \
sys/event.h \
+ sys/eventfd.h \
sys/filio.h \
sys/ioctl.h \
sys/ipc.h \
@@ -2207,6 +2208,7 @@ AC_CHECK_FUNCS(\
pipe2 \
poll \
port_create \
+ ppoll \
prctl \
pread \
proc_pidinfo \
@@ -2271,6 +2273,16 @@ case $host_os in
;;
esac
@@ -47,6 +142,40 @@ index da5f24aba5f..6c2653c4c82 100644
dnl **** Check for OpenLDAP ***
if test "x$with_ldap" != "xno"
then
diff --git a/include/config.h.in b/include/config.h.in
index 4adb6325e14..6f1323311d9 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -687,6 +687,9 @@
/* Define to 1 if you have the <port.h> header file. */
#undef HAVE_PORT_H
+/* Define to 1 if you have the `ppoll' function. */
+#undef HAVE_PPOLL
+
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
@@ -804,6 +807,9 @@
/* Define to 1 if `interface_id' is a member of `sg_io_hdr_t'. */
#undef HAVE_SG_IO_HDR_T_INTERFACE_ID
+/* Define to 1 if you have the `shm_open' function. */
+#undef HAVE_SHM_OPEN
+
/* Define if sigaddset is supported */
#undef HAVE_SIGADDSET
@@ -1004,6 +1010,9 @@
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#undef HAVE_SYS_EVENTFD_H
+
/* Define to 1 if you have the <sys/event.h> header file. */
#undef HAVE_SYS_EVENT_H
--
2.25.1
2.28.0

View File

@@ -1,4 +1,4 @@
From d407857d923dd08446cf38f83549c0b76442cc81 Mon Sep 17 00:00:00 2001
From d10e2324d1295c27e00975526420375a338b5eb1 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 20:09:59 -0500
Subject: [PATCH] server: Create server objects for eventfd-based
@@ -6,13 +6,16 @@ Subject: [PATCH] server: Create server objects for eventfd-based
---
server/Makefile.in | 1 +
server/esync.c | 137 ++++++++++++++++++++++++++++++++++++++++++++
server/protocol.def | 10 ++++
3 files changed, 148 insertions(+)
server/esync.c | 320 ++++++++++++++++++++++++++++++++++++++++++++
server/esync.h | 22 +++
server/main.c | 4 +
server/protocol.def | 24 ++++
5 files changed, 371 insertions(+)
create mode 100644 server/esync.c
create mode 100644 server/esync.h
diff --git a/server/Makefile.in b/server/Makefile.in
index 60ecca706..2c895bcec 100644
index 9a695cefc30..8bd612b4728 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -11,6 +11,7 @@ C_SRCS = \
@@ -25,10 +28,10 @@ index 60ecca706..2c895bcec 100644
file.c \
diff --git a/server/esync.c b/server/esync.c
new file mode 100644
index 000000000..147fb7724
index 00000000000..b8b257281bf
--- /dev/null
+++ b/server/esync.c
@@ -0,0 +1,137 @@
@@ -0,0 +1,320 @@
+/*
+ * eventfd-based synchronization objects
+ *
@@ -52,11 +55,19 @@ index 000000000..147fb7724
+#include "config.h"
+#include "wine/port.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdarg.h>
+#ifdef HAVE_SYS_EVENTFD_H
+# include <sys/eventfd.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#include <unistd.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
@@ -67,10 +78,72 @@ index 000000000..147fb7724
+#include "request.h"
+#include "file.h"
+
+int do_esync(void)
+{
+#ifdef HAVE_SYS_EVENTFD_H
+ static int do_esync_cached = -1;
+
+ if (do_esync_cached == -1)
+ do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC"));
+
+ return do_esync_cached;
+#else
+ return 0;
+#endif
+}
+
+static char shm_name[29];
+static int shm_fd;
+static off_t shm_size;
+static void **shm_addrs;
+static int shm_addrs_size; /* length of the allocated shm_addrs array */
+static long pagesize;
+
+static void shm_cleanup(void)
+{
+ close( shm_fd );
+ if (shm_unlink( shm_name ) == -1)
+ perror( "shm_unlink" );
+}
+
+void esync_init(void)
+{
+ struct stat st;
+
+ if (fstat( config_dir_fd, &st ) == -1)
+ fatal_error( "cannot stat config dir\n" );
+
+ if (st.st_ino != (unsigned long)st.st_ino)
+ sprintf( shm_name, "/wine-%lx%08lx-esync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino );
+ else
+ sprintf( shm_name, "/wine-%lx-esync", (unsigned long)st.st_ino );
+
+ shm_unlink( shm_name );
+
+ shm_fd = shm_open( shm_name, O_RDWR | O_CREAT | O_EXCL, 0644 );
+ if (shm_fd == -1)
+ perror( "shm_open" );
+
+ pagesize = sysconf( _SC_PAGESIZE );
+
+ shm_addrs = calloc( 128, sizeof(shm_addrs[0]) );
+ shm_addrs_size = 128;
+
+ shm_size = pagesize;
+ if (ftruncate( shm_fd, shm_size ) == -1)
+ perror( "ftruncate" );
+
+ fprintf( stderr, "esync: up and running.\n" );
+
+ atexit( shm_cleanup );
+}
+
+struct esync
+{
+ struct object obj; /* object header */
+ int fd; /* eventfd file descriptor */
+ struct object obj; /* object header */
+ int fd; /* eventfd file descriptor */
+ enum esync_type type;
+ unsigned int shm_idx; /* index into the shared memory section */
+};
+
+static void esync_dump( struct object *obj, int verbose );
@@ -90,6 +163,7 @@ index 000000000..147fb7724
+ no_map_access, /* map_access */
+ default_get_sd, /* get_sd */
+ default_set_sd, /* set_sd */
+ default_get_full_name, /* get_full_name */
+ no_lookup_name, /* lookup_name */
+ directory_link_name, /* link_name */
+ default_unlink_name, /* unlink_name */
@@ -112,8 +186,58 @@ index 000000000..147fb7724
+ close( esync->fd );
+}
+
+static int type_matches( enum esync_type type1, enum esync_type type2 )
+{
+ return (type1 == type2) ||
+ ((type1 == ESYNC_AUTO_EVENT || type1 == ESYNC_MANUAL_EVENT) &&
+ (type2 == ESYNC_AUTO_EVENT || type2 == ESYNC_MANUAL_EVENT));
+}
+
+static void *get_shm( unsigned int idx )
+{
+ int entry = (idx * 8) / pagesize;
+ int offset = (idx * 8) % pagesize;
+
+ if (entry >= shm_addrs_size)
+ {
+ int new_size = max(shm_addrs_size * 2, entry + 1);
+
+ if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) )))
+ fprintf( stderr, "esync: couldn't expand shm_addrs array to size %d\n", entry + 1 );
+
+ memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) );
+
+ shm_addrs_size = new_size;
+ }
+
+ if (!shm_addrs[entry])
+ {
+ void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize );
+ if (addr == (void *)-1)
+ {
+ fprintf( stderr, "esync: failed to map page %d (offset %#lx): ", entry, entry * pagesize );
+ perror( "mmap" );
+ }
+
+ if (debug_level)
+ fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr );
+
+ if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
+ return (void *)((unsigned long)shm_addrs[entry] + offset);
+}
+
+struct semaphore
+{
+ int max;
+ int count;
+};
+C_ASSERT(sizeof(struct semaphore) == 8);
+
+struct esync *create_esync( struct object *root, const struct unicode_str *name,
+ unsigned int attr, int initval, int flags,
+ unsigned int attr, int initval, int max, enum esync_type type,
+ const struct security_descriptor *sd )
+{
+#ifdef HAVE_SYS_EVENTFD_H
@@ -123,8 +247,13 @@ index 000000000..147fb7724
+ {
+ if (get_error() != STATUS_OBJECT_NAME_EXISTS)
+ {
+ int flags = EFD_CLOEXEC | EFD_NONBLOCK;
+
+ if (type == ESYNC_SEMAPHORE)
+ flags |= EFD_SEMAPHORE;
+
+ /* initialize it if it didn't already exist */
+ esync->fd = eventfd( initval, flags | EFD_CLOEXEC | EFD_NONBLOCK );
+ esync->fd = eventfd( initval, flags );
+ if (esync->fd == -1)
+ {
+ perror( "eventfd" );
@@ -132,6 +261,49 @@ index 000000000..147fb7724
+ release_object( esync );
+ return NULL;
+ }
+ esync->type = type;
+
+ /* Use the fd as index, since that'll be unique across all
+ * processes, but should hopefully end up also allowing reuse. */
+ esync->shm_idx = esync->fd + 1; /* we keep index 0 reserved */
+ while (esync->shm_idx * 8 >= shm_size)
+ {
+ /* Better expand the shm section. */
+ shm_size += pagesize;
+ if (ftruncate( shm_fd, shm_size ) == -1)
+ {
+ fprintf( stderr, "esync: couldn't expand %s to size %ld: ",
+ shm_name, (long)shm_size );
+ perror( "ftruncate" );
+ }
+ }
+
+ /* Initialize the shared memory portion. We want to do this on the
+ * server side to avoid a potential though unlikely race whereby
+ * the same object is opened and used between the time it's created
+ * and the time its shared memory portion is initialized. */
+ switch (type)
+ {
+ case ESYNC_SEMAPHORE:
+ {
+ struct semaphore *semaphore = get_shm( esync->shm_idx );
+ semaphore->max = max;
+ semaphore->count = initval;
+ break;
+ }
+ default:
+ assert( 0 );
+ }
+ }
+ else
+ {
+ /* validate the type */
+ if (!type_matches( type, esync->type ))
+ {
+ release_object( &esync->obj );
+ set_error( STATUS_OBJECT_TYPE_MISMATCH );
+ return NULL;
+ }
+ }
+ }
+ return esync;
@@ -150,9 +322,21 @@ index 000000000..147fb7724
+ const struct security_descriptor *sd;
+ const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root );
+
+ if (!do_esync())
+ {
+ set_error( STATUS_NOT_IMPLEMENTED );
+ return;
+ }
+
+ if (!req->type)
+ {
+ set_error( STATUS_INVALID_PARAMETER );
+ return;
+ }
+
+ if (!objattr) return;
+
+ if ((esync = create_esync( root, &name, objattr->attributes, req->initval, req->flags, sd )))
+ if ((esync = create_esync( root, &name, objattr->attributes, req->initval, req->max, req->type, sd )))
+ {
+ if (get_error() == STATUS_OBJECT_NAME_EXISTS)
+ reply->handle = alloc_handle( current->process, esync, req->access, objattr->attributes );
@@ -160,30 +344,96 @@ index 000000000..147fb7724
+ reply->handle = alloc_handle_no_access_check( current->process, esync,
+ req->access, objattr->attributes );
+
+ reply->type = esync->type;
+ reply->shm_idx = esync->shm_idx;
+ send_client_fd( current->process, esync->fd, reply->handle );
+ release_object( esync );
+ }
+
+ if (root) release_object( root );
+}
diff --git a/server/esync.h b/server/esync.h
new file mode 100644
index 00000000000..7ca4ca89394
--- /dev/null
+++ b/server/esync.h
@@ -0,0 +1,22 @@
+/*
+ * eventfd-based synchronization objects
+ *
+ * Copyright (C) 2018 Zebediah Figura
+ *
+ * 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
+ */
+
+extern int do_esync(void);
+void esync_init(void);
diff --git a/server/main.c b/server/main.c
index 2b5065e1852..385ae5ee370 100644
--- a/server/main.c
+++ b/server/main.c
@@ -36,6 +36,7 @@
#include "file.h"
#include "thread.h"
#include "request.h"
+#include "esync.h"
/* command-line options */
int debug_level = 0;
@@ -140,6 +141,9 @@ int main( int argc, char *argv[] )
sock_init();
open_master_socket();
+ if (do_esync())
+ esync_init();
+
if (debug_level) fprintf( stderr, "wineserver: starting (pid=%ld)\n", (long) getpid() );
set_current_time();
init_scheduler();
diff --git a/server/protocol.def b/server/protocol.def
index 007ef1f67..cd97ba008 100644
index 5ca762fdabf..552d504cc8d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4021,3 +4021,13 @@ struct handle_info
unsigned int threads; /* number of threads */
unsigned int handles; /* number of handles */
@@ -3665,3 +3665,27 @@ struct handle_info
@REQ(resume_process)
obj_handle_t handle; /* process handle */
@END
+
+enum esync_type
+{
+ ESYNC_SEMAPHORE = 1,
+ ESYNC_AUTO_EVENT,
+ ESYNC_MANUAL_EVENT,
+ ESYNC_MUTEX,
+ ESYNC_AUTO_SERVER,
+ ESYNC_MANUAL_SERVER,
+ ESYNC_QUEUE,
+};
+
+/* Create a new eventfd-based synchronization object */
+@REQ(create_esync)
+ unsigned int access; /* wanted access rights */
+ int initval; /* initial value */
+ int flags; /* flags (EFD_SEMAPHORE or 0) */
+ int type; /* type of esync object */
+ int max; /* maximum count on a semaphore */
+ VARARG(objattr,object_attributes); /* object attributes */
+@REPLY
+ obj_handle_t handle; /* handle to the object */
+ int type; /* actual type (may be different for events) */
+ unsigned int shm_idx;
+@END
--
2.21.0
2.28.0

View File

@@ -0,0 +1,108 @@
From e5a3456cde339352e78b10fed8a2fc65ca560041 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 12:16:34 -0500
Subject: [PATCH] ntdll: Implement NtReleaseSemaphore().
---
dlls/ntdll/unix/esync.c | 43 +++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/esync.h | 1 +
dlls/ntdll/unix/sync.c | 3 +++
3 files changed, 47 insertions(+)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index 7c409c7a9ca..8f28a36d93f 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdlib.h>
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
@@ -173,6 +174,16 @@ static struct esync *add_to_list( HANDLE handle, enum esync_type type, int fd, v
return &esync_list[entry][idx];
}
+static struct esync *get_cached_object( HANDLE handle )
+{
+ UINT_PTR entry, idx = handle_to_index( handle, &entry );
+
+ if (entry >= ESYNC_LIST_ENTRIES || !esync_list[entry]) return NULL;
+ if (!esync_list[entry][idx].type) return NULL;
+
+ return &esync_list[entry][idx];
+}
+
static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, int initval, int max )
{
@@ -228,6 +239,38 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
return create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, max );
}
+NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
+{
+ struct esync *obj;
+ struct semaphore *semaphore;
+ uint64_t count64 = count;
+ ULONG current;
+
+ TRACE("%p, %d, %p.\n", handle, count, prev);
+
+ if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE;
+ semaphore = obj->shm;
+
+ do
+ {
+ current = semaphore->count;
+
+ if (count + current > semaphore->max)
+ return STATUS_SEMAPHORE_LIMIT_EXCEEDED;
+ } while (InterlockedCompareExchange( &semaphore->count, count + current, current ) != current);
+
+ if (prev) *prev = current;
+
+ /* We don't have to worry about a race between increasing the count and
+ * write(). The fact that we were able to increase the count means that we
+ * have permission to actually write that many releases to the semaphore. */
+
+ if (write( obj->fd, &count64, sizeof(count64) ) == -1)
+ return errno_to_status( errno );
+
+ return STATUS_SUCCESS;
+}
+
void esync_init(void)
{
struct stat st;
diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h
index a50a755149a..09838e95535 100644
--- a/dlls/ntdll/unix/esync.h
+++ b/dlls/ntdll/unix/esync.h
@@ -23,6 +23,7 @@ extern void esync_init(void) DECLSPEC_HIDDEN;
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
+extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) DECLSPEC_HIDDEN;
/* We have to synchronize on the fd cache mutex so that our calls to receive_fd
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index 663a170fc61..f4bcda4b473 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -407,6 +407,9 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, ULONG *previous
{
NTSTATUS ret;
+ if (do_esync())
+ return esync_release_semaphore( handle, count, previous );
+
SERVER_START_REQ( release_semaphore )
{
req->handle = wine_server_obj_handle( handle );
--
2.28.0

View File

@@ -1,123 +0,0 @@
From 3f6f2c22a0ee8e7c9067b74aef67018ed0739484 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 20:45:57 -0500
Subject: [PATCH 04/83] ntdll: Store esync objects locally.
Slight tweak for optimization: return UINT_PTR instead, and remove a useless
cmpxchg.
---
dlls/ntdll/esync.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index da35bdf85..2bb85d910 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include "wine/port.h"
#include <assert.h>
#include <stdarg.h>
@@ -26,6 +27,9 @@
#ifdef HAVE_SYS_EVENTFD_H
# include <sys/eventfd.h>
#endif
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -34,6 +38,7 @@
#include "winternl.h"
#include "wine/server.h"
#include "wine/debug.h"
+#include "wine/library.h"
#include "ntdll_misc.h"
#include "esync.h"
@@ -78,6 +83,59 @@ struct semaphore
int max;
};
+/* We'd like lookup to be fast. To that end, we use a static list indexed by handle.
+ * This is copied and adapted from the fd cache code. */
+
+#define ESYNC_LIST_BLOCK_SIZE (65536 / sizeof(struct esync *))
+#define ESYNC_LIST_ENTRIES 128
+
+static struct esync * *esync_list[ESYNC_LIST_ENTRIES];
+static struct esync * esync_list_initial_block[ESYNC_LIST_BLOCK_SIZE];
+
+static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry )
+{
+ UINT_PTR idx = (((UINT_PTR)handle) >> 2) - 1;
+ *entry = idx / ESYNC_LIST_BLOCK_SIZE;
+ return idx % ESYNC_LIST_BLOCK_SIZE;
+}
+
+static BOOL add_to_list( HANDLE handle, struct esync *obj )
+{
+ UINT_PTR entry, idx = handle_to_index( handle, &entry );
+
+ if (entry >= ESYNC_LIST_ENTRIES)
+ {
+ FIXME( "too many allocated handles, not caching %p\n", handle );
+ return FALSE;
+ }
+
+ if (!esync_list[entry]) /* do we need to allocate a new block of entries? */
+ {
+ if (!entry) esync_list[0] = esync_list_initial_block;
+ else
+ {
+ void *ptr = wine_anon_mmap( NULL, ESYNC_LIST_BLOCK_SIZE * sizeof(struct esync *),
+ PROT_READ | PROT_WRITE, 0 );
+ if (ptr == MAP_FAILED) return FALSE;
+ esync_list[entry] = ptr;
+ }
+ }
+
+ obj = InterlockedExchangePointer((void **)&esync_list[entry][idx], obj);
+ assert(!obj);
+ return TRUE;
+}
+
+static void *esync_get_object( HANDLE handle )
+{
+ UINT_PTR entry, idx = handle_to_index( handle, &entry );
+
+ if (entry >= ESYNC_LIST_ENTRIES || !esync_list[entry]) return NULL;
+
+ return esync_list[entry][idx];
+}
+
+
static NTSTATUS create_esync(int *fd, HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, int initval, int flags)
{
@@ -115,7 +173,7 @@ static NTSTATUS create_esync(int *fd, HANDLE *handle, ACCESS_MASK access,
return ret;
}
-extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
+NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max)
{
struct semaphore *semaphore;
@@ -135,6 +193,8 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
semaphore->obj.type = ESYNC_SEMAPHORE;
semaphore->obj.fd = fd;
semaphore->max = max;
+
+ add_to_list( *handle, &semaphore->obj );
}
return ret;
--
2.20.1

View File

@@ -0,0 +1,77 @@
From f0d0cdcb048b4af8003ba5279bd90293ecc7f8ba Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 12:20:44 -0500
Subject: [PATCH] ntdll: Implement NtClose().
---
dlls/ntdll/unix/esync.c | 18 ++++++++++++++++++
dlls/ntdll/unix/esync.h | 1 +
dlls/ntdll/unix/server.c | 4 ++++
3 files changed, 23 insertions(+)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index 8f28a36d93f..02b07bf36be 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -184,6 +184,24 @@ static struct esync *get_cached_object( HANDLE handle )
return &esync_list[entry][idx];
}
+NTSTATUS esync_close( HANDLE handle )
+{
+ UINT_PTR entry, idx = handle_to_index( handle, &entry );
+
+ TRACE("%p.\n", handle);
+
+ if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
+ {
+ if (InterlockedExchange((int *)&esync_list[entry][idx].type, 0))
+ {
+ close( esync_list[entry][idx].fd );
+ return STATUS_SUCCESS;
+ }
+ }
+
+ return STATUS_INVALID_HANDLE;
+}
+
static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, int initval, int max )
{
diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h
index 09838e95535..14e52416764 100644
--- a/dlls/ntdll/unix/esync.h
+++ b/dlls/ntdll/unix/esync.h
@@ -20,6 +20,7 @@
extern int do_esync(void) DECLSPEC_HIDDEN;
extern void esync_init(void) DECLSPEC_HIDDEN;
+extern NTSTATUS esync_close( HANDLE handle ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 971341bf6e0..d8837f6fde0 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -88,6 +88,7 @@
#include "wine/server.h"
#include "wine/debug.h"
#include "unix_private.h"
+#include "esync.h"
#include "ddk/wdm.h"
WINE_DEFAULT_DEBUG_CHANNEL(server);
@@ -1644,6 +1645,9 @@ NTSTATUS WINAPI NtClose( HANDLE handle )
NTSTATUS ret;
int fd = remove_fd_from_cache( handle );
+ if (do_esync())
+ esync_close( handle );
+
SERVER_START_REQ( close_handle )
{
req->handle = wine_server_obj_handle( handle );
--
2.28.0

View File

@@ -1,78 +0,0 @@
From eb0273dfd273f1f6c48db45b444ec318fe514699 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 21:02:14 -0500
Subject: [PATCH 05/83] ntdll: Implement NtReleaseSemaphore().
---
dlls/ntdll/esync.c | 22 ++++++++++++++++++++++
dlls/ntdll/esync.h | 1 +
dlls/ntdll/sync.c | 4 ++++
3 files changed, 27 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 2bb85d910..bca95b9b2 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdlib.h>
#ifdef HAVE_SYS_EVENTFD_H
# include <sys/eventfd.h>
@@ -199,3 +200,24 @@ NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
return ret;
}
+
+NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
+{
+ struct semaphore *semaphore = esync_get_object( handle );
+ uint64_t count64 = count;
+
+ TRACE("%p, %d, %p.\n", handle, count, prev);
+
+ if (!semaphore) return STATUS_INVALID_HANDLE;
+
+ if (prev)
+ {
+ FIXME("Can't write previous value.\n");
+ *prev = 1;
+ }
+
+ if (write( semaphore->obj.fd, &count64, sizeof(count64) ) == -1)
+ return FILE_GetNtStatus();
+
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h
index 1a88170cf..fec0b68e8 100644
--- a/dlls/ntdll/esync.h
+++ b/dlls/ntdll/esync.h
@@ -22,6 +22,7 @@ extern int do_esync(void) DECLSPEC_HIDDEN;
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
+extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) DECLSPEC_HIDDEN;
/* We have to synchronize on the fd cache CS so that our calls to receive_fd
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index c259267fb..93052ddb5 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -333,6 +333,10 @@ NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS cla
NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, PULONG previous )
{
NTSTATUS ret;
+
+ if (do_esync())
+ return esync_release_semaphore( handle, count, previous );
+
SERVER_START_REQ( release_semaphore )
{
req->handle = wine_server_obj_handle( handle );
--
2.20.1

View File

@@ -1,78 +0,0 @@
From 2aba7f5090f92b609f6d2763603dbeb761f9c65a Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 21:07:51 -0500
Subject: [PATCH] ntdll: Close esync objects.
---
dlls/ntdll/esync.c | 19 +++++++++++++++++++
dlls/ntdll/esync.h | 1 +
dlls/ntdll/om.c | 4 ++++
3 files changed, 24 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index bca95b9b2d9..f7a427425b7 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -136,6 +136,25 @@ static void *esync_get_object( HANDLE handle )
return esync_list[entry][idx];
}
+NTSTATUS esync_close( HANDLE handle )
+{
+ UINT_PTR entry, idx = handle_to_index( handle, &entry );
+ struct esync *obj;
+
+ TRACE("%p.\n", handle);
+
+ if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
+ {
+ if ((obj = InterlockedExchangePointer( (void **)&esync_list[entry][idx], 0 )))
+ {
+ close( obj->fd );
+ RtlFreeHeap( GetProcessHeap(), 0, obj );
+ return STATUS_SUCCESS;
+ }
+ }
+
+ return STATUS_INVALID_HANDLE;
+}
static NTSTATUS create_esync(int *fd, HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, int initval, int flags)
diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h
index fec0b68e8d5..a22618de849 100644
--- a/dlls/ntdll/esync.h
+++ b/dlls/ntdll/esync.h
@@ -19,6 +19,7 @@
*/
extern int do_esync(void) DECLSPEC_HIDDEN;
+extern NTSTATUS esync_close( HANDLE handle ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index f8f0760de70..b8d73a982b2 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -34,6 +34,7 @@
#include "windef.h"
#include "winternl.h"
#include "ntdll_misc.h"
+#include "esync.h"
#include "wine/server.h"
#include "wine/exception.h"
@@ -387,6 +388,9 @@ NTSTATUS close_handle( HANDLE handle )
NTSTATUS ret;
int fd = server_remove_fd_from_cache( handle );
+ if (do_esync())
+ esync_close( handle );
+
SERVER_START_REQ( close_handle )
{
req->handle = wine_server_obj_handle( handle );
--
2.26.0

View File

@@ -1,39 +1,48 @@
From bb968ec541ccdcd1b04b4b967065d5ee81f3fd78 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 21:23:52 -0500
Subject: [PATCH] ntdll: Implement waiting on esync objects.
From 908363daafc3b5220967d31e2e878f617d465026 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 12:34:42 -0500
Subject: [PATCH] ntdll: Implement NtWaitForMultipleObjects().
This is the most basic case: WAIT_ANY. We use poll() (actually ppoll(), for
the better granularity) to select on all of the handles that we can.
---
dlls/ntdll/esync.c | 161 +++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/esync.h | 3 +
dlls/ntdll/sync.c | 7 ++
3 files changed, 171 insertions(+)
dlls/ntdll/unix/esync.c | 170 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/esync.h | 3 +
dlls/ntdll/unix/sync.c | 7 ++
3 files changed, 180 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index f7a427425..f6ceefe53 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -22,6 +22,13 @@
#include "wine/port.h"
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index 02b07bf36be..1b71105491c 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -22,17 +22,25 @@
#pragma makedep unix
#endif
+#define _GNU_SOURCE
+
#include "config.h"
#include <assert.h>
+#include <errno.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
@@ -240,3 +247,157 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@@ -289,6 +297,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
return STATUS_SUCCESS;
}
+
+#define TICKSPERSEC 10000000
+#define TICKSPERMSEC 10000
+
@@ -68,6 +77,19 @@ index f7a427425..f6ceefe53 100644
+ return poll( fds, nfds, -1 );
+}
+
+static void update_grabbed_object( struct esync *obj )
+{
+ if (obj->type == ESYNC_SEMAPHORE)
+ {
+ struct semaphore *semaphore = obj->shm;
+ /* We don't have to worry about a race between this and read(); the
+ * fact that we were able to grab it at all means the count is nonzero,
+ * and if someone else grabbed it then the count must have been >= 2,
+ * etc. */
+ InterlockedExchangeAdd( &semaphore->count, -1 );
+ }
+}
+
+/* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we
+ * need to delegate to server_select(). */
+NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any,
@@ -79,8 +101,7 @@ index f7a427425..f6ceefe53 100644
+ LONGLONG timeleft;
+ LARGE_INTEGER now;
+ ULONGLONG end;
+ int ret;
+ int i;
+ int i, ret;
+
+ NtQuerySystemTime( &now );
+ if (timeout)
@@ -95,23 +116,16 @@ index f7a427425..f6ceefe53 100644
+
+ for (i = 0; i < count; i++)
+ {
+ objs[i] = esync_get_object( handles[i] );
+ if (objs[i])
+ if ((objs[i] = get_cached_object( handles[i] )))
+ has_esync = 1;
+ else
+ has_server = 1;
+ }
+
+ if (has_esync && has_server)
+ {
+ FIXME("Can't wait on esync and server objects at the same time!\n");
+ /* Wait on just the eventfds; it's the best we can do. */
+ }
+ else if (has_server)
+ {
+ /* It's just server objects, so delegate to the server. */
+ return STATUS_NOT_IMPLEMENTED;
+ }
+
+ if (TRACE_ON(esync))
+ {
@@ -145,13 +159,15 @@ index f7a427425..f6ceefe53 100644
+ /* Find out which object triggered the wait. */
+ for (i = 0; i < count; i++)
+ {
+ struct esync *obj = objs[i];
+
+ if (fds[i].revents & (POLLERR | POLLHUP | POLLNVAL))
+ {
+ ERR("Polling on fd %d returned %#x.\n", fds[i].fd, fds[i].revents);
+ return STATUS_INVALID_HANDLE;
+ }
+
+ if (objs[i])
+ if (obj)
+ {
+ int64_t value;
+ ssize_t size;
@@ -160,6 +176,7 @@ index f7a427425..f6ceefe53 100644
+ {
+ /* We found our object. */
+ TRACE("Woken up by handle %p [%d].\n", handles[i], i);
+ update_grabbed_object( obj );
+ return i;
+ }
+ }
@@ -176,8 +193,8 @@ index f7a427425..f6ceefe53 100644
+ }
+ else
+ {
+ ERR("ppoll failed: %s\n", strerror(errno));
+ return FILE_GetNtStatus();
+ ERR("ppoll failed: %s\n", strerror( errno ));
+ return errno_to_status( errno );
+ }
+ }
+ }
@@ -187,11 +204,15 @@ index f7a427425..f6ceefe53 100644
+ return STATUS_NOT_IMPLEMENTED;
+ }
+}
diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h
index a22618de8..8f7f9b030 100644
--- a/dlls/ntdll/esync.h
+++ b/dlls/ntdll/esync.h
@@ -25,6 +25,9 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
+
void esync_init(void)
{
struct stat st;
diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h
index 14e52416764..87516e7597a 100644
--- a/dlls/ntdll/unix/esync.h
+++ b/dlls/ntdll/unix/esync.h
@@ -26,6 +26,9 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) DECLSPEC_HIDDEN;
@@ -199,13 +220,13 @@ index a22618de8..8f7f9b030 100644
+ BOOLEAN alertable, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
+
/* We have to synchronize on the fd cache CS so that our calls to receive_fd
/* We have to synchronize on the fd cache mutex so that our calls to receive_fd
* don't race with theirs. It looks weird, I know.
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 93052ddb5..40bc619a2 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -1089,6 +1089,13 @@ static NTSTATUS wait_objects( DWORD count, const HANDLE *handles,
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index f4bcda4b473..445c2a4324d 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -1273,6 +1273,13 @@ NTSTATUS WINAPI NtWaitForMultipleObjects( DWORD count, const HANDLE *handles, BO
if (!count || count > MAXIMUM_WAIT_OBJECTS) return STATUS_INVALID_PARAMETER_1;
@@ -220,5 +241,5 @@ index 93052ddb5..40bc619a2 100644
select_op.wait.op = wait_any ? SELECT_WAIT : SELECT_WAIT_ALL;
for (i = 0; i < count; i++) select_op.wait.handles[i] = wine_server_obj_handle( handles[i] );
--
2.21.0
2.28.0

Some files were not shown because too many files have changed in this diff Show More