ReactOS  0.4.14-dev-98-gb0d4763
broadcast.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "wine/test.h"
Include dependency graph for broadcast.c:

Go to the source code of this file.

Macros

#define _WIN32_WINNT   0x0501
 

Typedefs

typedef LONG(WINAPIPBROADCAST) (DWORD, LPDWORD, UINT, WPARAM, LPARAM)
 
typedef LONG(WINAPIPBROADCASTEX) (DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO)
 

Functions

static LRESULT WINAPI main_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL init_procs (void)
 
static void test_parameters (PBROADCAST broadcast, const char *functionname)
 
static void test_parametersEx (PBROADCASTEX broadcastex)
 
static void test_noprivileges (void)
 
 START_TEST (broadcast)
 

Variables

static HANDLE hevent
 

Macro Definition Documentation

◆ _WIN32_WINNT

#define _WIN32_WINNT   0x0501

Definition at line 22 of file broadcast.c.

Typedef Documentation

◆ PBROADCAST

typedef LONG(WINAPI * PBROADCAST) (DWORD, LPDWORD, UINT, WPARAM, LPARAM)

Definition at line 36 of file broadcast.c.

◆ PBROADCASTEX

typedef LONG(WINAPI * PBROADCASTEX) (DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO)

Definition at line 37 of file broadcast.c.

Function Documentation

◆ init_procs()

static BOOL init_procs ( void  )
static

Definition at line 57 of file broadcast.c.

58 {
59  WNDCLASSA cls;
60 
61  hevent = CreateEventA(NULL, TRUE, FALSE, "Asynchronous checking event");
62 
63  cls.style = CS_DBLCLKS;
65  cls.cbClsExtra = 0;
66  cls.cbWndExtra = 0;
67  cls.hInstance = GetModuleHandleA(0);
68  cls.hIcon = 0;
71  cls.lpszMenuName = NULL;
72  cls.lpszClassName = "MainWindowClass";
73 
74  if (!RegisterClassA(&cls))
75  return FALSE;
76 
77  if (!CreateWindowExA(0, "MainWindowClass", "Main window", WS_CAPTION | WS_SYSMENU |
78  WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, 100, 100, 200,
79  200, 0, 0, GetModuleHandleA(NULL), NULL))
80  return FALSE;
81  return TRUE;
82 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define TRUE
Definition: types.h:120
int cbClsExtra
Definition: winuser.h:3139
LPCSTR lpszMenuName
Definition: winuser.h:3145
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3144
static HANDLE hevent
Definition: broadcast.c:38
int cbWndExtra
Definition: winuser.h:3140
HCURSOR hCursor
Definition: winuser.h:3143
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:637
const char * LPCSTR
Definition: xmlstorage.h:183
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_CAPTION
Definition: pedump.c:624
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define CS_DBLCLKS
Definition: winuser.h:646
static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: broadcast.c:40
LPCSTR lpszClassName
Definition: winuser.h:3146
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3137
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HINSTANCE hInstance
Definition: winuser.h:3141
#define WS_POPUP
Definition: pedump.c:616
WNDPROC lpfnWndProc
Definition: winuser.h:3138
#define IDC_ARROW
Definition: winuser.h:682
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_SYSMENU
Definition: pedump.c:629
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3142

Referenced by START_TEST().

◆ main_window_procA()

static LRESULT WINAPI main_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 40 of file broadcast.c.

41 {
42  if (msg == WM_NULL)
43  {
44  trace("main_window_procA: Sleeping for %lu ms\n", wparam);
45  if (wparam)
46  {
49  }
50  trace("main_window_procA: Returning WM_NULL with parameter %08lx\n", lparam);
51  return lparam;
52  }
53 
54  return DefWindowProcA(hwnd, msg, wparam, lparam);
55 }
#define WM_NULL
Definition: winuser.h:1589
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE hevent
Definition: broadcast.c:38
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define trace
Definition: atltest.h:70
#define WAIT_TIMEOUT
Definition: dderror.h:14
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by init_procs().

◆ START_TEST()

START_TEST ( broadcast  )

Definition at line 317 of file broadcast.c.

318 {
319  if (!init_procs())
320  return;
321 
322  trace("Running BroadcastSystemMessageA tests\n");
323  test_parameters(BroadcastSystemMessageA, "BroadcastSystemMessageA");
324 
325  trace("Running BroadcastSystemMessageW tests\n");
326  test_parameters(BroadcastSystemMessageW, "BroadcastSystemMessageW");
327 
328  trace("Running BroadcastSystemMessageExA tests\n");
330 
331  trace("Running BroadcastSystemMessageExW tests\n");
333 
334  trace("Attempting privileges checking tests\n");
336 }
static void test_parametersEx(PBROADCASTEX broadcastex)
Definition: broadcast.c:175
LONG WINAPI BroadcastSystemMessageW(DWORD dwFlags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam)
Definition: message.c:3397
LONG WINAPI BroadcastSystemMessageExW(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo)
Definition: message.c:3428
static void test_parameters(PBROADCAST broadcast, const char *functionname)
Definition: broadcast.c:84
#define trace
Definition: atltest.h:70
static BOOL init_procs(void)
Definition: broadcast.c:57
LONG WINAPI BroadcastSystemMessageExA(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo)
Definition: message.c:3412
static void test_noprivileges(void)
Definition: broadcast.c:251
LONG WINAPI BroadcastSystemMessageA(DWORD dwFlags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam)
Definition: message.c:3382

◆ test_noprivileges()

static void test_noprivileges ( void  )
static

Definition at line 251 of file broadcast.c.

252 {
253  HANDLE token;
254  DWORD recips;
255  BOOL ret;
256 
257  static const DWORD BSM_ALL_RECIPS = BSM_VXDS | BSM_NETDRIVER |
259 
261  {
262  skip("Can't open security token for process\n");
263  return;
264  }
266  {
267  skip("Can't adjust security token for process\n");
268  return;
269  }
270 
271  trace("Trying privileged edition!\n");
272  SetLastError(0xcafebabe);
273  recips = BSM_ALLDESKTOPS;
275  ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL );
276  ok(ret==1, "Returned: %d error %u\n", ret, GetLastError());
277  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
278  ok(recips == BSM_ALLDESKTOPS ||
279  recips == BSM_ALL_RECIPS, /* win2k3 */
280  "Received by: %08x\n", recips);
282 
283  SetLastError(0xcafebabe);
284  recips = BSM_ALLCOMPONENTS;
286  ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL );
287  ok(ret==1, "Returned: %d error %u\n", ret, GetLastError());
288  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
289  ok(recips == BSM_ALLCOMPONENTS ||
290  recips == BSM_ALL_RECIPS, /* win2k3 */
291  "Received by: %08x\n", recips);
293 
294  SetLastError(0xcafebabe);
297  ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL );
298  ok(ret==1, "Returned: %d error %u\n", ret, GetLastError());
299  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
300  ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) ||
301  recips == BSM_APPLICATIONS, /* win2k3 */
302  "Received by: %08x\n", recips);
304 
305  SetLastError(0xcafebabe);
309  ok(!ret, "Returned: %d\n", ret);
310  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
311  ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) ||
312  recips == BSM_APPLICATIONS, /* win2k3 */
313  "Received by: %08x\n", recips);
315 }
#define BSM_ALLCOMPONENTS
Definition: dbt.h:47
#define WM_NULL
Definition: winuser.h:1589
#define TRUE
Definition: types.h:120
#define BROADCAST_QUERY_DENY
Definition: winuser.h:178
#define BSF_QUERY
Definition: dbt.h:59
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI BroadcastSystemMessageExW(DWORD dwflags, LPDWORD lpdwRecipients, UINT uiMessage, WPARAM wParam, LPARAM lParam, PBSMINFO pBSMInfo)
Definition: message.c:3428
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE hevent
Definition: broadcast.c:38
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent(IN HANDLE hEvent)
Definition: synch.c:695
smooth NULL
Definition: ftsmooth.c:416
#define trace
Definition: atltest.h:70
#define BSM_NETDRIVER
Definition: dbt.h:51
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
#define BSM_VXDS
Definition: dbt.h:52
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
#define skip(...)
Definition: atltest.h:64
#define BSM_ALLDESKTOPS
Definition: dbt.h:49
#define BSM_INSTALLABLEDRIVERS
Definition: dbt.h:50
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
#define BSM_APPLICATIONS
Definition: dbt.h:48

Referenced by START_TEST().

◆ test_parameters()

static void test_parameters ( PBROADCAST  broadcast,
const char functionname 
)
static

Definition at line 84 of file broadcast.c.

85 {
86  LONG ret;
87  DWORD recips;
88 
89  SetLastError(0xcafebabe);
90  recips = BSM_APPLICATIONS;
91  ret = broadcast( 0x80000000, &recips, WM_NULL, 0, 0 );
93  {
94  win_skip("%s is not implemented\n", functionname);
95  return;
96  }
97  ok(!ret || broken(ret), "Returned: %d\n", ret);
98  if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
99 
100  SetLastError(0xcafebabe);
101  recips = BSM_APPLICATIONS;
102  ret = broadcast( 0x80000000, &recips, WM_NULL, 0, 0 );
103  ok(!ret || broken(ret), "Returned: %d\n", ret);
104  if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
105 
106 if (0) /* TODO: Check the hang flags */
107 {
108  SetLastError(0xcafebabe);
109  recips = BSM_APPLICATIONS;
110  ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
111  ok(0, "Last error: %08x\n", GetLastError());
112  ok(0, "Returned: %d\n", ret);
113 
114  SetLastError(0xcafebabe);
115  recips = BSM_APPLICATIONS;
116  ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0 );
117  ok(0, "Last error: %08x\n", GetLastError());
118  ok(0, "Returned: %d\n", ret);
119 
120  SetLastError(0xcafebabe);
121  recips = BSM_APPLICATIONS;
122  ret = broadcast( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
123  ok(0, "Last error: %08x\n", GetLastError());
124  ok(0, "Returned: %d\n", ret);
125 
126  SetLastError(0xcafebabe);
127  recips = BSM_APPLICATIONS;
128  ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
129  ok(0, "Last error: %08x\n", GetLastError());
130  ok(0, "Returned: %d\n", ret);
131 }
132 
133  recips = BSM_APPLICATIONS;
135  ret = broadcast( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0 );
136  ok(ret==1, "Returned: %d\n", ret);
137  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
139 
140  SetLastError( 0xdeadbeef );
141  recips = BSM_APPLICATIONS;
142  ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 );
143  if (ret)
144  {
145  ok(ret==1, "Returned: %d\n", ret);
146  ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
148 
149  recips = BSM_APPLICATIONS;
150  ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
151  ok(ret==1, "Returned: %d\n", ret);
152  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
154 
155  recips = BSM_APPLICATIONS;
156  ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
157  ok(!ret, "Returned: %d\n", ret);
158  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
160  }
161  else /* BSF_SENDNOTIFYMESSAGE not supported on NT4 */
162  ok( GetLastError() == ERROR_INVALID_PARAMETER, "failed with err %u\n", GetLastError() );
163 
164  recips = BSM_APPLICATIONS;
165  ret = broadcast( 0, &recips, WM_NULL, 100, 0 );
166  ok(ret==1, "Returned: %d\n", ret);
167  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
169 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WM_NULL
Definition: winuser.h:1589
#define BSF_FORCEIFHUNG
Definition: dbt.h:54
#define BROADCAST_QUERY_DENY
Definition: winuser.h:178
#define BSF_NOTIMEOUTIFNOTHUNG
Definition: dbt.h:57
#define BSF_QUERY
Definition: dbt.h:59
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define BSF_NOHANG
Definition: dbt.h:56
#define BSF_POSTMESSAGE
Definition: dbt.h:58
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE hevent
Definition: broadcast.c:38
long LONG
Definition: pedump.c:60
BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent(IN HANDLE hEvent)
Definition: synch.c:695
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141
#define BSM_APPLICATIONS
Definition: dbt.h:48

Referenced by START_TEST().

◆ test_parametersEx()

static void test_parametersEx ( PBROADCASTEX  broadcastex)
static

Definition at line 175 of file broadcast.c.

176 {
177  LONG ret;
178  DWORD recips;
179 
180  SetLastError(0xcafebabe);
181  recips = BSM_APPLICATIONS;
182  ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
183  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
184  ok(!ret, "Returned: %d\n", ret);
185 
186  SetLastError(0xcafebabe);
187  recips = BSM_APPLICATIONS;
188  ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
189  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
190  ok(!ret, "Returned: %d\n", ret);
191 
192 if (0) /* TODO: Check the hang flags */
193 {
194  SetLastError(0xcafebabe);
195  recips = BSM_APPLICATIONS;
196  ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
197  ok(0, "Last error: %08x\n", GetLastError());
198  ok(0, "Returned: %d\n", ret);
199 
200  SetLastError(0xcafebabe);
201  recips = BSM_APPLICATIONS;
202  ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
203  ok(0, "Last error: %08x\n", GetLastError());
204  ok(0, "Returned: %d\n", ret);
205 
206  SetLastError(0xcafebabe);
207  recips = BSM_APPLICATIONS;
208  ret = broadcastex( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
209  ok(0, "Last error: %08x\n", GetLastError());
210  ok(0, "Returned: %d\n", ret);
211 
212  SetLastError(0xcafebabe);
213  recips = BSM_APPLICATIONS;
214  ret = broadcastex( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
215  ok(0, "Last error: %08x\n", GetLastError());
216  ok(0, "Returned: %d\n", ret);
217 }
218 
219  recips = BSM_APPLICATIONS;
221  ret = broadcastex( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0, NULL );
222  ok(ret==1, "Returned: %d\n", ret);
223  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
225 
226  recips = BSM_APPLICATIONS;
227  ret = broadcastex( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0, NULL );
228  ok(ret==1, "Returned: %d\n", ret);
229  ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
231 
232  recips = BSM_APPLICATIONS;
233  ret = broadcastex( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL );
234  ok(ret==1, "Returned: %d\n", ret);
235  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
237 
238  recips = BSM_APPLICATIONS;
239  ret = broadcastex( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL );
240  ok(!ret, "Returned: %d\n", ret);
241  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
243 
244  recips = BSM_APPLICATIONS;
245  ret = broadcastex( 0, &recips, WM_NULL, 100, 0, NULL );
246  ok(ret==1, "Returned: %d\n", ret);
247  ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
249 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WM_NULL
Definition: winuser.h:1589
#define BSF_FORCEIFHUNG
Definition: dbt.h:54
#define BROADCAST_QUERY_DENY
Definition: winuser.h:178
#define BSF_NOTIMEOUTIFNOTHUNG
Definition: dbt.h:57
#define BSF_QUERY
Definition: dbt.h:59
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define BSF_NOHANG
Definition: dbt.h:56
#define BSF_POSTMESSAGE
Definition: dbt.h:58
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE hevent
Definition: broadcast.c:38
long LONG
Definition: pedump.c:60
BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent(IN HANDLE hEvent)
Definition: synch.c:695
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
#define BSM_APPLICATIONS
Definition: dbt.h:48

Referenced by START_TEST().

Variable Documentation

◆ hevent