Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/user32/tests/broadcast.c | 60 +++++++++-------------------------- 1 file changed, 15 insertions(+), 45 deletions(-)
diff --git a/dlls/user32/tests/broadcast.c b/dlls/user32/tests/broadcast.c index afdb536816..2dfdc98b34 100644 --- a/dlls/user32/tests/broadcast.c +++ b/dlls/user32/tests/broadcast.c @@ -128,13 +128,6 @@ if (0) /* TODO: Check the hang flags */ ok(0, "Returned: %d\n", ret); }
- recips = BSM_APPLICATIONS; - ResetEvent(hevent); - ret = broadcast( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0 ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - SetLastError( 0xdeadbeef ); recips = BSM_APPLICATIONS; ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 ); @@ -147,18 +140,6 @@ if (0) /* TODO: Check the hang flags */ ok(ret==1, "Returned: %d\n", ret); ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); - ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcast( 0, &recips, WM_NULL, 100, 0 ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); }
/* BSF_SENDNOTIFYMESSAGE and BSF_QUERY are both synchronous within the same process @@ -209,13 +190,6 @@ if (0) /* TODO: Check the hang flags */ ok(0, "Returned: %d\n", ret); }
- recips = BSM_APPLICATIONS; - ResetEvent(hevent); - ret = broadcastex( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - recips = BSM_APPLICATIONS; ret = broadcastex( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0, NULL ); ok(ret==1, "Returned: %d\n", ret); @@ -227,18 +201,6 @@ if (0) /* TODO: Check the hang flags */ ok(ret==1, "Returned: %d\n", ret); ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcastex( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL ); - ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcastex( 0, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); }
static void test_noprivileges(void) @@ -266,8 +228,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == BSM_ALLDESKTOPS || recips == BSM_ALL_RECIPS, /* win2k3 */ "Received by: %08x\n", recips); @@ -277,8 +241,10 @@ static void test_noprivileges(void) recips = BSM_ALLCOMPONENTS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == BSM_ALLCOMPONENTS || recips == BSM_ALL_RECIPS, /* win2k3 */ "Received by: %08x\n", recips); @@ -288,8 +254,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS|BSM_APPLICATIONS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) || recips == BSM_APPLICATIONS, /* win2k3 */ "Received by: %08x\n", recips); @@ -300,7 +268,9 @@ static void test_noprivileges(void) ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL ); ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT || + WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT /* win10 */, + "Asynchronous message sent instead of synchronous message or no message\n"); ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) || recips == BSM_APPLICATIONS, /* win2k3 */ "Received by: %08x\n", recips);
Alex Henrie alexhenrie24@gmail.com writes:
@@ -266,8 +228,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL );
- ok(ret==1, "Returned: %d error %u\n", ret, GetLastError());
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
- ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) ||
(ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */,
"Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n",
ret, GetLastError());
These still look like hiding the problem. Why are these calls failing?
On Thu, Apr 26, 2018 at 1:13 PM Alexandre Julliard julliard@winehq.org wrote:
Alex Henrie alexhenrie24@gmail.com writes:
@@ -266,8 +228,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100,
0, NULL );
- ok(ret==1, "Returned: %d error %u\n", ret, GetLastError());
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous
message sent instead\n");
- ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) ||
(ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT)
/* win10 */,
"Asynchronous message sent instead of synchronous message or no
message. Returned: %d error %08x\n",
ret, GetLastError());
These still look like hiding the problem. Why are these calls failing?
Lack of privileges. The test_noprivileges function calls AdjustTokenPrivileges to disable all privileges, then verifies that BroadcastSystemMessage can no longer send a message to BSM_ALLDESKTOPS, BSM_ALLCOMPONENTS, or BSM_APPLICATIONS.
If I understand correctly, before Windows 10 BroadcastSystemMessage would still send the message to the current application. In Windows 10, BroadcastSystemMessage does not send the message at all.
-Alex