ReactOS  0.4.12-dev-945-g5a2911d
synch.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for synch.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

LONG WINAPI InterlockedIncrement (IN OUT LONG volatile *lpAddend)
 
LONG WINAPI InterlockedDecrement (IN OUT LONG volatile *lpAddend)
 
LONG WINAPI InterlockedExchange (IN OUT LONG volatile *Target, IN LONG Value)
 
LONG WINAPI InterlockedExchangeAdd (IN OUT LONG volatile *Addend, IN LONG Value)
 
LONG WINAPI InterlockedCompareExchange (IN OUT LONG volatile *Destination, IN LONG Exchange, IN LONG Comperand)
 
DWORD WINAPI WaitForSingleObject (IN HANDLE hHandle, IN DWORD dwMilliseconds)
 
DWORD WINAPI WaitForSingleObjectEx (IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
 
DWORD WINAPI WaitForMultipleObjects (IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
 
DWORD WINAPI WaitForMultipleObjectsEx (IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds, IN BOOL bAlertable)
 
DWORD WINAPI SignalObjectAndWait (IN HANDLE hObjectToSignal, IN HANDLE hObjectToWaitOn, IN DWORD dwMilliseconds, IN BOOL bAlertable)
 
HANDLE WINAPI CreateWaitableTimerW (IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, IN BOOL bManualReset, IN LPCWSTR lpTimerName OPTIONAL)
 
HANDLE WINAPI CreateWaitableTimerA (IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, IN BOOL bManualReset, IN LPCSTR lpTimerName OPTIONAL)
 
HANDLE WINAPI OpenWaitableTimerW (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpTimerName)
 
HANDLE WINAPI OpenWaitableTimerA (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpTimerName)
 
BOOL WINAPI SetWaitableTimer (IN HANDLE hTimer, IN const LARGE_INTEGER *pDueTime, IN LONG lPeriod, IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL, IN OPTIONAL LPVOID lpArgToCompletionRoutine, IN BOOL fResume)
 
BOOL WINAPI CancelWaitableTimer (IN HANDLE hTimer)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA (IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW (IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreA (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreW (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore (IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA (IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW (IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexA (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex (IN HANDLE hMutex)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA (IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW (IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
 
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW (IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
 
BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent (IN HANDLE hEvent)
 
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent (IN HANDLE hEvent)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent (IN HANDLE hEvent)
 
VOID WINAPI InitializeCriticalSection (OUT LPCRITICAL_SECTION lpCriticalSection)
 
BOOL WINAPI InitializeCriticalSectionAndSpinCount (OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount)
 
VOID WINAPI DECLSPEC_HOTPATCH Sleep (IN DWORD dwMilliseconds)
 
DWORD WINAPI SleepEx (IN DWORD dwMilliseconds, IN BOOL bAlertable)
 
BOOL WINAPI RegisterWaitForSingleObject (OUT PHANDLE phNewWaitObject, IN HANDLE hObject, IN WAITORTIMERCALLBACK Callback, IN PVOID Context, IN ULONG dwMilliseconds, IN ULONG dwFlags)
 
HANDLE WINAPI RegisterWaitForSingleObjectEx (IN HANDLE hObject, IN WAITORTIMERCALLBACK Callback, IN PVOID Context, IN ULONG dwMilliseconds, IN ULONG dwFlags)
 
BOOL WINAPI UnregisterWait (IN HANDLE WaitHandle)
 
BOOL WINAPI UnregisterWaitEx (IN HANDLE WaitHandle, IN HANDLE CompletionEvent)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file synch.c.

Function Documentation

◆ CancelWaitableTimer()

BOOL WINAPI CancelWaitableTimer ( IN HANDLE  hTimer)

Definition at line 411 of file synch.c.

412 {
414 
415  /* Cancel the timer */
416  Status = NtCancelTimer(hTimer, NULL);
417  if (NT_SUCCESS(Status)) return TRUE;
418 
419  /* If we got here, then we failed */
421  return FALSE;
422 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtCancelTimer(IN HANDLE TimerHandle, OUT PBOOLEAN CurrentState OPTIONAL)
Definition: timer.c:252
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

◆ CreateEventA()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA ( IN LPSECURITY_ATTRIBUTES lpEventAttributes  OPTIONAL,
IN BOOL  bManualReset,
IN BOOL  bInitialState,
IN LPCSTR lpName  OPTIONAL 
)

Definition at line 583 of file synch.c.

587 {
588  ConvertWin32AnsiObjectApiToUnicodeApi(Event, lpName, lpEventAttributes, bManualReset, bInitialState);
589 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54

Referenced by create_function_addr_events(), DllMain(), do_test(), get_events(), init_event(), init_procs(), MCICDA_Play(), overlapped_server(), read_file_test(), read_pipe_test(), release_host_object(), service_process(), start_dummy_thread(), start_host_object2(), START_TEST(), test_accept(), test_AcceptEx(), test_AddMandatoryAce(), test_apc_deadlock(), test_completion(), test_ConnectEx(), test_CreateThread_basic(), test_dde(), test_debug_children(), test_default_dacl_owner_sid(), test_defwinproc(), test_delegated_methods(), test_DragQueryFile(), test_event(), test_event_security(), test_events(), test_FakeDLL(), test_file_completion_information(), test_foregroundwindow(), test_getservbyname(), test_ImmThreads(), test_implicit_mta(), test_Input_mouse(), test_interthread_messages(), test_ioctl(), test_ip_pktinfo(), test_layered_window(), test_local_server(), test_name_collisions(), test_no_couninitialize_server(), test_ntncdf(), test_ntncdf_async(), test_NtSuspendProcess(), test_null_device(), test_open_url_async(), test_overlapped(), test_overlapped_error(), test_PdhCollectQueryDataEx(), test_peek(), test_PeekMessage(), test_process_security(), test_query_handle(), test_query_handle_ex(), test_query_object(), test_query_object_types(), test_read_device(), test_read_write(), test_readfileex_pending(), test_register_local_server(), test_runner(), test_select(), test_send(), test_SendMessage_other_thread(), test_sioAddressListChange(), test_smresult(), test_tableweak_and_normal_marshal_and_releasedata(), test_tableweak_and_normal_marshal_and_unmarshal(), test_TerminateThread(), test_thread_objects(), test_two_tableweak_marshal_and_releasedata(), test_WaitForInputIdle(), test_window_from_point(), test_winevents(), test_write_watch(), test_WSARecv(), and testCtrlHandler().

◆ CreateEventW()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW ( IN LPSECURITY_ATTRIBUTES lpEventAttributes  OPTIONAL,
IN BOOL  bManualReset,
IN BOOL  bInitialState,
IN LPCWSTR lpName  OPTIONAL 
)

Definition at line 597 of file synch.c.

601 {
603  lpEventAttributes,
604  lpName,
605  bManualReset ? NotificationEvent : SynchronizationEvent,
606  bInitialState);
607 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
Definition: msgtrace.h:9
#define CreateNtObjectFromWin32Api(obj, ntobj, capsobj, sec, name,...)
Definition: base_x.h:140

Referenced by _overlapped_read_async(), _overlapped_read_sync(), _overlapped_write_async(), _overlapped_write_sync(), AllocEventData(), ANIMATE_Play(), apartment_hostobject_in_hostapt(), AVISplitter_ProcessStreamList(), BackgroundCopyJobConstructor(), BaseRenderer_Init(), check_hook_thread(), child_process(), ClientRpcChannelBuffer_GetEventHandle(), ClientSideInstallW(), ConDrvInitConsole(), create_overlapped_pipe(), create_server_process(), CreateGPEvent(), CreatePublicEvent(), CreateRenderingSubsystem(), CreateTestThread(), CRYPT_MakeInetContext(), dispatch_rpc(), DosStartProcess32(), download_url(), DP_MSG_BuildAndLinkReplyStruct(), DPL_CreateAndSetLobbyHandles(), DSoundRender_create(), EmulatorInitialize(), EventsQueue_Init(), FileAsyncReader_RequestAllocator(), FileAsyncReader_SyncRead(), FilterGraph_create(), get_np_event(), GUIDisplayStatusMessage(), GuiInit(), GuiInitFrontEnd(), IDirectPlay4Impl_EnumSessions(), init(), init_async(), init_events(), init_thread_sync_helpers(), init_urlcache(), CIconWatcher::Initialize(), CDesktopThread::Initialize(), COutputPin::InitializeIOThread(), InitializePnPManager(), InitializeScreenSaver(), InstallDevice(), KsSynchronousDeviceControl(), local_server_thread(), LsarStartRpcServer(), main(), ManualResetEvent_Construct(), MCI_SendCommandAsync(), MCIAVI_drvOpen(), MCIAVI_OpenAudio(), MCIQTZ_drvOpen(), midiStreamOpen(), mmTaskCreate(), NBCmdQueueCancel(), NetRegisterDomainNameChangeNotification(), OutputQueue_Construct(), CKsClockForwarder::Pause(), PdhCollectQueryDataEx(), proc_PlaySound(), ProcessDlgProc(), ProcessPage_OnDebug(), PullPin_Init(), queue_task(), ReferenceClock_AdvisePeriodic(), ReferenceClock_AdviseTime(), RPC_StartLocalServer(), rpcrt4_conn_release_and_wait(), rpcrt4_ncacn_http_alloc(), rpcrt4_ncacn_http_open(), rpcrt4_protseq_np_alloc(), rpcrt4_protseq_sock_alloc(), rpcrt4_sock_wait_init(), RPCRT4_start_listen(), RPCRT4_start_listen_protseq(), RpcServerUnregisterIf(), run_server(), ScmWaitForLsa(), ScreenSaverThreadMain(), serv_main(), server(), serverThreadMain3(), serverThreadMain5(), service_main(), ServiceMain(), SHCreateThread(), START_TEST(), CProgressDialog::StartProgressDialog(), StartStopEnumEventsThread(), TCPSendIoctl(), test_AbortWaitCts(), test_activateapp(), test_alertable(), test_async(), test_async_HttpSendRequestEx(), test_attach_input(), test_audioclient(), test_bsc_marshaling(), test_cancelio(), test_concurrent_header_access(), test_connection_cache(), test_CoWaitForMultipleHandles_thread(), test_create(), test_CreateRemoteThread(), test_deletecontext(), test_event(), test_fragmentsize(), test_http_connection(), test_inet_ntoa(), test_interthread_messages(), test_messages(), test_mixerOpen(), test_NamedPipe_2(), test_nonalertable(), test_notify(), test_overlapped(), test_persistent_connection(), test_QueueUserWorkItem(), test_read_write(), test_readdirectorychanges(), test_readdirectorychanges_filedir(), test_readdirectorychanges_null(), test_redirect(), test_RegisterWaitForSingleObject(), test_RegNotifyChangeKeyValue(), test_RtlRegisterWait(), test_SetFocus(), test_SetForegroundWindow(), test_ShowCursor(), test_signalandwait(), test_stop_wait_for_call(), test_threads(), test_timer_queue(), test_timers(), test_TransmitFile(), test_uninitialized(), test_WaitBreak(), test_WaitCommEvent(), test_WaitCts(), test_WaitDcd(), test_WaitDsr(), test_WaitForMultipleObjects(), test_WaitForSingleObject(), test_WaitRing(), test_WaitRx(), test_waittxempty(), test_worst_case(), TestKM(), testNotifyAddrChange(), TestRead(), testWaitForConsoleInput(), TestWrite(), ThemeServiceMain(), ThemeWatchForStart(), TIME_MMTimeStart(), TIME_SetEventInternal(), VMR9DefaultAllocatorPresenterImpl_create(), WaitForLsass(), WaitForSCManager(), wave_in_test_deviceIn(), WAVE_mciPlay(), WAVE_mciRecord(), wave_out_test_deviceOut(), WdmAudCommitWaveBufferByLegacy(), WdmAudSetMixerDeviceFormatByLegacy(), wined3d_cs_create(), winhttp_request_Send(), WINMM_CreateIData(), WriteFileEx_Remixer(), WSACreateEvent(), and wWinMain().

◆ CreateMutexA()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA ( IN LPSECURITY_ATTRIBUTES lpMutexAttributes  OPTIONAL,
IN BOOL  bInitialOwner,
IN LPCSTR lpName  OPTIONAL 
)

Definition at line 509 of file synch.c.

512 {
513  ConvertWin32AnsiObjectApiToUnicodeApi(Mutex, lpName, lpMutexAttributes, bInitialOwner);
514 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
Definition: Mutex.h:15
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54

Referenced by get_base_dir(), test_handles(), test_mutex(), test_mutex_security(), and test_name_collisions().

◆ CreateMutexW()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW ( IN LPSECURITY_ATTRIBUTES lpMutexAttributes  OPTIONAL,
IN BOOL  bInitialOwner,
IN LPCWSTR lpName  OPTIONAL 
)

Definition at line 522 of file synch.c.

525 {
526  CreateNtObjectFromWin32Api(Mutex, Mutant, MUTEX,
527  lpMutexAttributes,
528  lpName,
529  bInitialOwner);
530 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
Definition: Mutex.h:15
#define CreateNtObjectFromWin32Api(obj, ntobj, capsobj, sec, name,...)
Definition: base_x.h:140

Referenced by cache_containers_add(), child_process(), ComDBOpen(), CreateAssemblyCache(), CreateProfileMutex(), DoStartStartupItems(), EnterCriticalPolicySection(), INetCfg_fnQueryInterface(), K32CreateDBMonMutex(), main(), proxy_manager_construct(), RPCRT4_start_listen_protseq(), and wWinMain().

◆ CreateSemaphoreA()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA ( IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes  OPTIONAL,
IN LONG  lInitialCount,
IN LONG  lMaximumCount,
IN LPCSTR lpName  OPTIONAL 
)

Definition at line 430 of file synch.c.

434 {
435  ConvertWin32AnsiObjectApiToUnicodeApi(Semaphore, lpName, lpSemaphoreAttributes, lInitialCount, lMaximumCount);
436 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54

Referenced by DPLAYX_ConstructData(), test_CoWaitForMultipleHandles(), test_GetKeyState(), test_name_collisions(), test_RtlQueueWorkItem(), test_semaphore(), test_semaphore_security(), test_tp_group_cancel(), test_tp_group_wait(), test_tp_simple(), test_tp_timer(), and test_tp_window_length().

◆ CreateSemaphoreW()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW ( IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes  OPTIONAL,
IN LONG  lInitialCount,
IN LONG  lMaximumCount,
IN LPCWSTR lpName  OPTIONAL 
)

Definition at line 444 of file synch.c.

448 {
449  CreateNtObjectFromWin32Api(Semaphore, Semaphore, SEMAPHORE,
450  lpSemaphoreAttributes,
451  lpName,
452  lInitialCount,
453  lMaximumCount);
454 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define CreateNtObjectFromWin32Api(obj, ntobj, capsobj, sec, name,...)
Definition: base_x.h:140

Referenced by BaseMemAllocator_Commit(), child_process(), CRYPT_ImportSystemRootCertsToReg(), DllMain(), init_urlcache(), Initialize(), SHGlobalCounterCreateNamedW(), test_alertable_wait(), test_async_file_errors(), test_iocp_callback(), test_RtlIsCriticalSectionLocked(), test_RtlRegisterWait(), test_signalandwait(), test_tp_disassociate(), test_tp_instance(), test_tp_multi_wait(), test_tp_wait(), and test_WM_DISPLAYCHANGE().

◆ CreateWaitableTimerA()

HANDLE WINAPI CreateWaitableTimerA ( IN LPSECURITY_ATTRIBUTES lpTimerAttributes  OPTIONAL,
IN BOOL  bManualReset,
IN LPCSTR lpTimerName  OPTIONAL 
)

Definition at line 346 of file synch.c.

349 {
350  ConvertWin32AnsiObjectApiToUnicodeApi(WaitableTimer, lpTimerName, lpTimerAttributes, bManualReset);
351 }
HANDLE WaitableTimer
Definition: notevil.c:39
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54

Referenced by test_waitable_timer().

◆ CreateWaitableTimerW()

HANDLE WINAPI CreateWaitableTimerW ( IN LPSECURITY_ATTRIBUTES lpTimerAttributes  OPTIONAL,
IN BOOL  bManualReset,
IN LPCWSTR lpTimerName  OPTIONAL 
)

Definition at line 331 of file synch.c.

334 {
336  lpTimerAttributes,
337  lpTimerName,
338  bManualReset ? NotificationTimer : SynchronizationTimer);
339 }
HANDLE WaitableTimer
Definition: notevil.c:39
Definition: timer.h:3
#define CreateNtObjectFromWin32Api(obj, ntobj, capsobj, sec, name,...)
Definition: base_x.h:140

◆ InitializeCriticalSection()

VOID WINAPI InitializeCriticalSection ( OUT LPCRITICAL_SECTION  lpCriticalSection)

Definition at line 697 of file synch.c.

698 {
700 
701  /* Initialize the critical section and raise an exception if we failed */
702  Status = RtlInitializeCriticalSection((PVOID)lpCriticalSection);
704 }
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by __mingw_TLScallback(), __xmlGlobalInitMutexLock(), _Locale_init(), _tmain(), alloc_device(), alloc_serverprotoseq(), ANIMATE_Create(), apartment_construct(), ApiInit(), AtlModuleInit(), audiomediastream_create(), BackgroundCopyJobConstructor(), BaseFilter_Init(), BaseRenderer_Init(), Binding_Create(), BitmapClipper_Create(), BitmapImpl_Create(), BitmapScaler_Create(), BmpDecoder_Create(), chm_dup(), chm_openW(), CKsAllocator::CKsAllocator(), CKsProxy::CKsProxy(), ClientThreadSetupHelper(), ComponentEnum_Clone(), ConDrvInitConsole(), ConStreamInitEx(), ContextPropertyList_Create(), COutputPin::COutputPin(), CProgressDialog::CProgressDialog(), create_binding_protocol(), create_open_state(), CreateComponentEnumerator(), CreateD3D9(), CreateIProp(), CreateSidCacheMgr(), createtestfilter(), CreateTextServices(), CRYPT_CollectionOpenStore(), CRYPT_MemOpenStore(), CRYPT_RegOpenStore(), CryptInitOIDFunctionSet(), ddrawmediastream_create(), DirectSoundCaptureDevice_Create(), DirectSoundDevice_Create(), DllMain(), dplay_create(), dplobby_create(), DriverProc(), EventsQueue_Init(), file_device_create(), FileAsyncReader_Construct(), FilterGraph_create(), FlipRotator_Create(), FormatConverter_CreateInstance(), GdiProcessSetup(), get_or_create_threaddata(), GifDecoder_CreateInstance(), GifEncoder_CreateInstance(), GuiInitFrontEnd(), handle_create(), HTTP_HttpOpenRequestW(), IcoDecoder_CreateInstance(), ATL::CComCriticalSection::Init(), init_handle_table(), init_ioinfo_cs(), init_tests(), InitD3D9BaseDevice(), InitEventSourceList(), CIconWatcher::Initialize(), initialize_directinput_instance(), InitializeGPNotifications(), InitializePrintMonitor2(), IWICStreamImpl_InitializeFromIStreamRegion(), IWICStreamImpl_InitializeFromMemory(), LogfListInitialize(), main(), MCIAVI_drvOpen(), MCICDA_drvOpen(), MessageInit(), MetadataReader_Create(), MimeInternational_Construct(), MMDevice_Create(), msvcrt_init_fp(), msvcrt_initialize_mlock(), NBCmdQueueCreate(), NBNameCacheCreate(), NetBIOSInit(), NetBIOSRegisterAdapter(), NetBTCall(), new_stub_manager(), NewPrimarySoundBuffer(), nfs41_client_create(), nfs41_root_create(), nfs41_server_list_init(), OutputQueue_Construct(), PaletteImpl_Create(), PerfDataInitialize(), pnfs_file_device_list_create(), pnfs_layout_list_create(), PosPassThru_Construct(), PropertyStorage_BaseConstruct(), PropertyStore_CreateInstance(), proxy_manager_construct(), PullPin_Init(), QUARTZ_CreateSystemClock(), queue_task(), RpcAssoc_Alloc(), rpcrt4_ncacn_http_alloc(), RpcThreadRoutine(), RunningObjectTableImpl_Initialize(), RuntimeHost_Construct(), ScmInitNamedPipeCriticalSection(), session_alloc(), START_TEST(), StdMemAllocator_create(), SvcNetBiosInit(), test_async_HttpSendRequestEx(), test_condvars_base(), test_condvars_consumer_producer(), test_messages(), test_RtlIsCriticalSectionLocked(), test_winmodule(), TestMessages(), TgaDecoder_CreateInstance(), TransformFilter_Init(), WbemPath_create(), WbemServices_create(), WinHttpRequest_create(), WINMM_CreateIData(), wmainCRTStartup(), WsAsyncGlobalInitialize(), WsCreateStartupSynchronization(), WsNcOpen(), WsNqInitialize(), WsProcInitialize(), WsRasInitializeAutodial(), WsTcOpen(), xmlInitThreads(), and xmlNewRMutex().

◆ InitializeCriticalSectionAndSpinCount()

BOOL WINAPI InitializeCriticalSectionAndSpinCount ( OUT LPCRITICAL_SECTION  lpCriticalSection,
IN DWORD  dwSpinCount 
)

Definition at line 711 of file synch.c.

713 {
715 
716  /* Initialize the critical section */
718  dwSpinCount);
719  if (!NT_SUCCESS(Status))
720  {
721  /* Set failure code */
723  return FALSE;
724  }
725 
726  /* Success */
727  return TRUE;
728 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSectionAndSpinCount(_In_ PRTL_CRITICAL_SECTION CriticalSection, _In_ ULONG SpinCount)
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by _kbhit(), and WahCreateHandleContextTable().

◆ InterlockedCompareExchange()

LONG WINAPI InterlockedCompareExchange ( IN OUT LONG volatile Destination,
IN LONG  Exchange,
IN LONG  Comperand 
)

Definition at line 70 of file synch.c.

73 {
74  return _InterlockedCompareExchange(Destination, Exchange, Comperand);
75 }
long __cdecl _InterlockedCompareExchange(_Interlocked_operand_ long volatile *_Destination, long _Exchange, long _Comparand)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875

◆ InterlockedDecrement()

LONG WINAPI InterlockedDecrement ( IN OUT LONG volatile lpAddend)

Definition at line 38 of file synch.c.

39 {
40  return _InterlockedDecrement(lpAddend);
41 }
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)

◆ InterlockedExchange()

LONG WINAPI InterlockedExchange ( IN OUT LONG volatile Target,
IN LONG  Value 
)

Definition at line 48 of file synch.c.

50 {
52 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1067

◆ InterlockedExchangeAdd()

LONG WINAPI InterlockedExchangeAdd ( IN OUT LONG volatile Addend,
IN LONG  Value 
)

Definition at line 59 of file synch.c.

61 {
63 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
IN OUT PLONG Addend
Definition: CrNtStubs.h:22
long __cdecl _InterlockedExchangeAdd(_Interlocked_operand_ long volatile *_Addend, long _Value)

◆ InterlockedIncrement()

LONG WINAPI InterlockedIncrement ( IN OUT LONG volatile lpAddend)

Definition at line 28 of file synch.c.

29 {
30  return _InterlockedIncrement(lpAddend);
31 }
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)

◆ OpenEventA()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCSTR  lpName 
)

Definition at line 615 of file synch.c.

618 {
620 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
static BOOL bInheritHandle
Definition: pipe.c:82
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86

Referenced by do_wait_idle_child(), doChild(), doChildren(), dummy_process(), local_server_proc(), ole_server(), test_event(), test_event_security(), and window_from_point_proc().

◆ OpenEventW()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCWSTR  lpName 
)

◆ OpenMutexA()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexA ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCSTR  lpName 
)

Definition at line 538 of file synch.c.

541 {
543 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
Definition: Mutex.h:15
static BOOL bInheritHandle
Definition: pipe.c:82
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86

Referenced by test_mutex(), and test_mutex_security().

◆ OpenMutexW()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCWSTR  lpName 
)

Definition at line 551 of file synch.c.

554 {
555  OpenNtObjectFromWin32Api(Mutant, dwDesiredAccess, bInheritHandle, lpName);
556 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define OpenNtObjectFromWin32Api(ntobj, acc, inh, name)
Definition: base_x.h:148
static BOOL bInheritHandle
Definition: pipe.c:82

Referenced by K32CreateDBMonMutex(), test_mutex(), and wWinMain().

◆ OpenSemaphoreA()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreA ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCSTR  lpName 
)

Definition at line 462 of file synch.c.

465 {
467 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
static BOOL bInheritHandle
Definition: pipe.c:82
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86

Referenced by test_semaphore(), and test_semaphore_security().

◆ OpenSemaphoreW()

HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreW ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCWSTR  lpName 
)

Definition at line 475 of file synch.c.

478 {
479  OpenNtObjectFromWin32Api(Semaphore, dwDesiredAccess, bInheritHandle, lpName);
480 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define OpenNtObjectFromWin32Api(ntobj, acc, inh, name)
Definition: base_x.h:148
static BOOL bInheritHandle
Definition: pipe.c:82

Referenced by SHGlobalCounterCreateNamedW(), and test_semaphore().

◆ OpenWaitableTimerA()

HANDLE WINAPI OpenWaitableTimerA ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCSTR  lpTimerName 
)

Definition at line 370 of file synch.c.

373 {
375 }
HANDLE WaitableTimer
Definition: notevil.c:39
static BOOL bInheritHandle
Definition: pipe.c:82
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86

Referenced by test_waitable_timer().

◆ OpenWaitableTimerW()

HANDLE WINAPI OpenWaitableTimerW ( IN DWORD  dwDesiredAccess,
IN BOOL  bInheritHandle,
IN LPCWSTR  lpTimerName 
)

Definition at line 358 of file synch.c.

361 {
362  OpenNtObjectFromWin32Api(Timer, dwDesiredAccess, bInheritHandle, lpTimerName);
363 }
#define OpenNtObjectFromWin32Api(ntobj, acc, inh, name)
Definition: base_x.h:148
static BOOL bInheritHandle
Definition: pipe.c:82

Referenced by test_waitable_timer().

◆ PulseEvent()

BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent ( IN HANDLE  hEvent)

Definition at line 641 of file synch.c.

642 {
644 
645  /* Pulse the event */
647  if (NT_SUCCESS(Status)) return TRUE;
648 
649  /* If we got here, then we failed */
651  return FALSE;
652 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
static HANDLE hEvent
Definition: comm.c:54
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtPulseEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:248

Referenced by ReleaseReadLock(), test_noprivileges(), test_parameters(), test_parametersEx(), and TIME_TriggerCallBack().

◆ RegisterWaitForSingleObject()

BOOL WINAPI RegisterWaitForSingleObject ( OUT PHANDLE  phNewWaitObject,
IN HANDLE  hObject,
IN WAITORTIMERCALLBACK  Callback,
IN PVOID  Context,
IN ULONG  dwMilliseconds,
IN ULONG  dwFlags 
)

Definition at line 796 of file synch.c.

802 {
804 
805  /* Get real handle */
806  hObject = TranslateStdHandle(hObject);
807 
808  /* Check for console handle */
809  if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject)))
810  {
811  /* Get the real wait handle */
812  hObject = GetConsoleInputWaitHandle();
813  }
814 
815  /* Register the wait now */
816  Status = RtlRegisterWait(phNewWaitObject,
817  hObject,
818  Callback,
819  Context,
820  dwMilliseconds,
821  dwFlags);
822  if (!NT_SUCCESS(Status))
823  {
824  /* Return failure */
826  return FALSE;
827  }
828 
829  /* All good */
830  return TRUE;
831 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IsConsoleHandle(h)
Definition: console.h:14
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
NTSYSAPI NTSTATUS NTAPI RtlRegisterWait(_In_ PHANDLE phNewWaitObject, _In_ HANDLE hObject, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID pvContext, _In_ ULONG ulMilliseconds, _In_ ULONG ulFlags)
Status
Definition: gdiplustypes.h:24
LPFNPSPCALLBACK Callback
Definition: desk.c:111

Referenced by init_funcs(), SvcRegisterStopCallback(), testWaitForConsoleInput(), ThemeStartCallback(), and ThemeWatchForStart().

◆ RegisterWaitForSingleObjectEx()

HANDLE WINAPI RegisterWaitForSingleObjectEx ( IN HANDLE  hObject,
IN WAITORTIMERCALLBACK  Callback,
IN PVOID  Context,
IN ULONG  dwMilliseconds,
IN ULONG  dwFlags 
)

Definition at line 838 of file synch.c.

843 {
845  HANDLE hNewWaitObject;
846 
847  /* Get real handle */
848  hObject = TranslateStdHandle(hObject);
849 
850  /* Check for console handle */
851  if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject)))
852  {
853  /* Get the real wait handle */
854  hObject = GetConsoleInputWaitHandle();
855  }
856 
857  /* Register the wait */
858  Status = RtlRegisterWait(&hNewWaitObject,
859  hObject,
860  Callback,
861  Context,
862  dwMilliseconds,
863  dwFlags);
864  if (!NT_SUCCESS(Status))
865  {
866  /* Return failure */
868  return NULL;
869  }
870 
871  /* Return the object */
872  return hNewWaitObject;
873 }
LONG NTSTATUS
Definition: precomp.h:26
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IsConsoleHandle(h)
Definition: console.h:14
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
NTSYSAPI NTSTATUS NTAPI RtlRegisterWait(_In_ PHANDLE phNewWaitObject, _In_ HANDLE hObject, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID pvContext, _In_ ULONG ulMilliseconds, _In_ ULONG ulFlags)
Status
Definition: gdiplustypes.h:24
LPFNPSPCALLBACK Callback
Definition: desk.c:111

◆ ReleaseMutex()

BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex ( IN HANDLE  hMutex)

Definition at line 564 of file synch.c.

565 {
567 
568  /* Release the mutant */
570  if (NT_SUCCESS(Status)) return TRUE;
571 
572  /* If we got here, then we failed */
574  return FALSE;
575 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
HANDLE hMutex
Definition: mutex.c:11
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:299

Referenced by cache_container_lock_index(), cache_container_open_index(), cache_container_unlock_index(), cache_unlock(), CardRegion::CanDragCards(), CardRegion::CanDropCards(), CloseSharedMemory(), CM_Add_Range(), CM_First_Range(), CM_Free_Range_List(), CM_Next_Range(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBGetCurrentPortUsage(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), DoFinishStartupItems(), FatSetFatRun(), FreeUrlCacheSpaceW(), ifproxy_get_public_ref(), ifproxy_release_public_refs(), INetCfgLock_fnReleaseWriteLock(), LeaveCriticalPolicySection(), LoadUserProfileW(), MouseEventHandler(), MouseGetDataFast(), MouseGetPacket(), CardButton::OnLButtonDown(), OpenSharedMemory(), OutputDebugStringA(), PS2PortQueueRead(), PS2QueuePush(), ReleaseEntrypointMutex(), RPCRT4_sync_with_server_thread(), test_mutex(), thread1(), thread2(), UnloadUserProfile(), CardButton::UnLock(), Mutex::Unlock(), CardRegion::UnLock(), UnlockAudioDeviceList(), VgaConsoleDestroyGraphicsScreen(), VgaUpdateFramebuffer(), and xmlMutexUnlock().

◆ ReleaseSemaphore()

BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore ( IN HANDLE  hSemaphore,
IN LONG  lReleaseCount,
IN LPLONG  lpPreviousCount 
)

Definition at line 488 of file synch.c.

491 {
493 
494  /* Release the semaphore */
495  Status = NtReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount);
496  if (NT_SUCCESS(Status)) return TRUE;
497 
498  /* If we got here, then we failed */
500  return FALSE;
501 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtReleaseSemaphore(IN HANDLE SemaphoreHandle, IN LONG ReleaseCount, OUT PLONG PreviousCount OPTIONAL)
Definition: sem.c:294
Status
Definition: gdiplustypes.h:24

Referenced by alertable_wait_apc(), alertable_wait_thread(), BaseMemAllocator_Decommit(), BaseMemAllocator_ReleaseBuffer(), critsect_locked_thread(), CRYPT_ImportSystemRootCertsToReg(), disassociate2_cb(), disassociate3_cb(), disassociate_cb(), DSoundAdviseThread(), EnumPwrSchemes(), FileIOComplete(), free_urlcache(), get_key_state_thread(), GetPwrDiskSpindownRange(), group_cancel_cleanup_release2_cb(), group_cancel_cleanup_release_cb(), handle_full_cache(), handle_full_cache_worker(), instance_finalization_cb(), iocp_callback(), multi_wait_cb(), ReadGlobalPwrPolicy(), ReadPwrScheme(), release_semaphore_thread(), rtl_wait_apc_cb(), rtl_wait_cb(), rtl_work_cb(), SHGlobalCounterGetValue(), SHGlobalCounterIncrement(), simple_cb(), simple_group_cancel_cb(), simple_release_cb(), SysParamsTestWndProc(), SystemClockAdviseThread(), test_alertable_wait(), test_CoWaitForMultipleHandles(), test_GetKeyState(), test_RtlIsCriticalSectionLocked(), test_RtlRegisterWait(), test_signalandwait(), test_tp_disassociate(), test_tp_multi_wait(), test_tp_wait(), timer_cb(), timer_release_cb(), wait_cb(), wait_release_cb(), window_length_cb(), work_group_cancel_cb(), and work_release_cb().

◆ ResetEvent()

BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent ( IN HANDLE  hEvent)

Definition at line 660 of file synch.c.

661 {
663 
664  /* Clear the event */
666  if (NT_SUCCESS(Status)) return TRUE;
667 
668  /* If we got here, then we failed */
670  return FALSE;
671 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtResetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:389
static HANDLE hEvent
Definition: comm.c:54
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by AVISplitter_done_process(), AVISplitter_first_request(), AVISplitter_Flush(), BaseRendererImpl_EndFlush(), BaseRendererImpl_Pause(), BaseRendererImpl_Run(), child_process(), ConDrvFlushConsoleInputBuffer(), ConDrvGetConsoleInput(), ConDrvReadConsole(), ConSrvTermReadStream(), DeviceInstallThread(), DoEcho(), DSoundRender_EndFlush(), DSoundRender_OnStartStreaming(), DSoundRender_Pause(), EventsQueue_GetEvent(), FileAsyncReader_EndFlush(), FileAsyncReader_WaitForNext(), fileTransfer(), GPNotificationThreadProc(), IDirectSoundCaptureBufferImpl_Stop(), init_bind_test(), init_test(), ISynchronize_fnReset(), main(), MCIAVI_PlayAudioBlocks(), MCIQTZ_mciPlay(), MULTIMEDIA_PlaySound(), Netbios(), open_socket_request(), PauseEventThread(), PlaySound_WaitDone(), prepare_async_request(), ProcessDlgProc(), PullPin_PauseProcessing(), PullPin_StartProcessing(), PullPin_StopProcessing(), read_file_test(), read_pipe_test(), reset_events(), Telnet::Resume(), resync_after_run(), SendFilterMessage(), server_thread(), serverThreadMain5(), ServiceControlHandler(), setup_test(), StartScreenSaver(), StopNote(), sync_threads_and_run_one(), telProcessConsole(), test_async_read(), test_capture(), test_connection_cache(), test_event(), test_GetAddrInfoExW(), test_noprivileges(), test_NtSuspendProcess(), test_open_url_async(), test_overlapped(), test_parameters(), test_parametersEx(), test_peek(), test_persistent_connection(), test_read_device(), test_readdirectorychanges(), test_readfileex_pending(), test_RegisterWaitForSingleObject(), test_signalandwait(), test_WaitForInputIdle(), test_WaitForMultipleObjects(), test_WSARecv(), TestKM(), TestRead(), TestTerminateProcess(), TestWrite(), ThemeServiceDiedCallback(), ThemeServiceMain(), TIME_MMSysTimeCallback(), VideoRenderer_EndFlush(), VideoRenderer_OnStartStreaming(), VideoRenderer_Pause(), WAVE_mciPlayWaitDone(), WAVE_mciRecordWaitDone(), and WSAResetEvent().

◆ SetEvent()

BOOL WINAPI DECLSPEC_HOTPATCH SetEvent ( IN HANDLE  hEvent)

Definition at line 679 of file synch.c.

680 {
682 
683  /* Set the event */
685  if (NT_SUCCESS(Status)) return TRUE;
686 
687  /* If we got here, then we failed */
689  return FALSE;
690 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
static HANDLE hEvent
Definition: comm.c:54
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
NTSTATUS NTAPI NtSetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:458
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by AcceptKillThread(), AcceptProc(), AdapterDiscoveryThread(), CIconWatcher::AddIconToWatcher(), ANIMATE_DoStop(), apartment_hostobject_thread(), apc_deadlock_thread(), async_notifier_proc(), async_proc(), AVISplitter_done_process(), AVISplitter_next_request(), AVISplitter_Sample(), BackgroundCopyJob_Cancel(), BackgroundCopyJob_Resume(), BaseRendererImpl_BeginFlush(), BaseRendererImpl_EndOfStream(), BaseRendererImpl_Receive(), BaseRendererImpl_Run(), BaseRendererImpl_Stop(), bsc_thread(), callback(), callback_func(), callback_thread(), CallSessionThread(), CallSoundThread(), cancel_request(), capture_CheckNotify(), cb(), cbt_global_hook_thread_proc(), check_notification(), child_process(), cleanReq(), client_start(), ClientSideInstallW(), clipboard_wnd_proc(), Telnet::Close(), audio_wavein::close(), close_connection(), CloseDevice(), CloseUserEventLog(), collect_query_thread(), CommandThreadProc(), completion_routine(), ConioProcessInputEvent(), ConioUnpause(), COutputPin_SetState(), crash_and_debug(), create_grand_child_thread(), create_static_win(), create_window(), create_window_thread(), CRYPT_InetStatusCallback(), ctrl_handler(), DereferenceSidCacheMgr(), CDesktopThread::DesktopThreadProc(), DeviceInstallThread(), dialog_proc(), DispatchSAS(), DlgProc(), do_wait_idle_child(), doChild(), doChildren(), doDebugger(), DoEcho(), DoNotifyPositionEvents(), downloadcb_OnStopBinding(), DP_KillEnumSessionThread(), DP_MSG_ReplyReceived(), DPLAYX_ConstructData(), DPLAYX_DestructData(), DPLAYX_GetConnectionSettingsA(), DPLAYX_GetConnectionSettingsW(), DriverCallback(), drop_window_therad(), DSLeaseIpAddress(), DSOUND_CheckEvent(), DSoundAdviseThread(), DSoundRender_BeginFlush(), DSoundRender_OnStartStreaming(), DSoundRender_OnStopStreaming(), DSReleaseIpAddressLease(), DSRenewIpAddressLease(), DSStaticRefreshParams(), dummy_process(), dummy_thread_proc(), duo_marshal_thread_proc(), EnumEvents(), EventsQueue_PutEvent(), FileAsyncReader_BeginFlush(), free_urlcache(), GetDeviceData(), TTelnetHandler::Go(), GuiConsoleGuiThread(), GuiConsoleHandleNcCreate(), header_cb(), hook_thread_proc(), host_object_proc(), IDirectPlaySPImpl_HandleMessage(), ImmGetContextThreadFunc(), implicit_mta_marshal_proc(), inet_ntoa_thread_proc(), init(), COutputPin::IoProcessRoutine(), ISynchronize_fnSignal(), KillService(), CKsInterfaceHandler::KsProcessMediaSamples(), local_server_proc(), logMess(), LsarStartRpcServer(), main(), main_window_procA(), mch(), MCIAVI_mciStop(), MCIAVI_waveCallback(), MCICDA_Play(), MCICDA_playLoop(), MCICDA_Stop(), MCIQTZ_mciStop(), MediaEventSink_Notify(), MessageLoop(), MixerThreadRoutine(), MMSYSTEM_MidiStream_MessageHandler(), MMSYSTEM_MidiStream_Player(), mmTaskRun(), mouse_ll_global_thread_proc(), MsgCheckProc(), MULTIMEDIA_PlaySound(), mutex_thread_proc(), NBCmdQueueComplete(), nbCmdThread(), NetrJobAdd(), NetrJobDel(), no_couninitialize_server_proc(), no_stop_handler(), NotifyGPEvents(), COutputPin::NotifyRelease(), ole_server(), oob_server(), OutputDebugStringA(), OutputQueue_Destroy(), OutputQueue_ReceiveMultiple(), OutputQueue_SendAnyway(), overlapped_server(), PdhCloseQuery(), PdhCollectQueryDataEx(), pipe_thread(), audio_waveout::play(), PlayNote(), PlaySound_Callback(), PlaySound_Free(), PNP_ReportLogOn(), PnpEventThread(), ProcessDlgProc(), processRequest(), progress_callback_http(), Protocol_LockRequest(), Protocol_Read(), Protocol_Start(), Protocol_Terminate(), ProtocolSink_ReportData(), ProtocolSink_Switch(), PullPin_EndOfStream(), PullPin_InitProcessing(), PullPin_PauseProcessing(), PullPin_StartProcessing(), PullPin_StopProcessing(), PullPin_Thread_Pause(), PullPin_Thread_Process(), PullPin_Thread_Stop(), queue_event(), queue_task(), QueueSidLookup(), read_pipe_test(), readex_callback(), audio_wavein::recording_procedure(), ReferenceClock_AdviseTime(), RefreshPolicy(), RefreshPolicyEx(), RegisterGPNotification(), CIconWatcher::RemoveIconFromWatcher(), request_destroy(), Telnet::Resume(), ResumeEventThread(), resync_after_run(), RPC_ExecuteCall(), rpc_renew_in_progress(), rpc_sendreceive_thread(), RPC_StopLocalServer(), rpcrt4_conn_tcp_cancel_call(), rpcrt4_http_internet_callback(), rpcrt4_ncacn_http_cancel_call(), rpcrt4_ncacn_http_close(), rpcrt4_protseq_np_get_wait_array(), rpcrt4_protseq_np_signal_state_changed(), rpcrt4_protseq_sock_signal_state_changed(), RPCRT4_release_server_interface(), RPCRT4_ReleaseConnection(), RPCRT4_server_thread(), RPCRT4_stop_listen(), CKsClockForwarder::Run(), run_server(), runProg(), s_stop(), SASWindowProc(), select_server(), SelectReadThread(), semaphore_thread_proc(), send_msg_thread_2(), server_thread(), service_handler(), ServiceControlHandler(), ServiceHandler(), ServiceMain(), ServiceStop(), session_destroy(), set_foreground_thread(), SetShellReadyEvent(), SHLWAPI_ThreadWrapper(), show_cursor_thread(), ShutdownHandlerRoutine(), signaled_function(), simple_server(), smresult_thread_proc(), smresult_wndproc(), SoundThreadMain(), audio_wavein::start_recording(), START_TEST(), StartScreenSaver(), StartStopEnumEventsThread(), statusclb_OnDataAvailable(), statusclb_OnProgress(), statusclb_OnStopBinding(), StatusDialogProc(), CKsClockForwarder::Stop(), stop_dummy_thread(), sync_threads_and_run_one(), SystemClockAdviseThread(), telProcessConsole(), TerminateSoundThread(), Test1(), Test2(), Test3(), test_async_read(), test_attach_input(), test_binding(), test_conn_close(), test_dde_default_app(), test_debug_children(), test_defwinproc(), test_delegated_methods(), test_getservbyname(), test_http_protocol_url(), test_implicit_mta(), test_inet_ntoa(), test_Input_mouse(), test_interthread_messages(), test_ioctl(), test_local_server(), test_NamedPipe_2(), test_no_couninitialize_server(), test_overlapped(), test_PeekMessage(), test_persistent_connection(), test_read_write(), test_readdirectorychanges(), test_register_local_server(), test_request_content_length(), test_SendMessage_other_thread(), test_SetForegroundWindow(), test_ShowCursor(), test_stop_wait_for_call(), test_tableweak_and_normal_marshal_and_releasedata(), test_tableweak_and_normal_marshal_and_unmarshal(), test_thread_objects(), test_two_tableweak_marshal_and_releasedata(), test_WaitForInputIdle(), test_WaitForMultipleObjects(), test_window_from_point(), TestEventConcurrent(), ThemeServiceMain(), thread(), thread_cb(), thread_proc(), ThreadEntry(), threadFunc1(), threadFunc4(), threadFunc_SetEvent(), TIME_MMSysTimeCallback(), TIME_MMTimeStop(), TIME_SetEventInternal(), TIME_TriggerCallBack(), timeout_function(), timer_thread_proc(), TimerCallback1(), TimerCallback2(), TimerCallback3(), transfer_file_http(), transfer_file_local(), CIconWatcher::Uninitialize(), UninitializeGPNotifications(), UninitializeSAS(), UnlockModuleOOP(), UnregisterGPNotification(), update_layered_proc(), UpdateFromEvent(), UpdateStatus(), VideoRenderer_DoRenderSample(), VideoRenderer_OnStopStreaming(), wait_status_callback(), WAVE_mciPlay(), WAVE_mciPlayCallback(), WAVE_mciRecord(), WAVE_mciRecordCallback(), WaveThread(), wbem_services_CancelAsyncCall(), wbem_services_Release(), WdmAudCloseSoundDeviceByLegacy(), wgl_thread(), win_event_global_thread_proc(), window_from_point_proc(), WindowThreadProc(), wined3d_cs_queue_submit(), work_function(), WSASetEvent(), WsAsyncQueueRequest(), WSPIoctl(), and wWinMain().

◆ SetWaitableTimer()

BOOL WINAPI SetWaitableTimer ( IN HANDLE  hTimer,
IN const LARGE_INTEGER pDueTime,
IN LONG  lPeriod,
IN PTIMERAPCROUTINE pfnCompletionRoutine  OPTIONAL,
IN OPTIONAL LPVOID  lpArgToCompletionRoutine,
IN BOOL  fResume 
)

Definition at line 382 of file synch.c.

388 {
390 
391  /* Set the timer */
392  Status = NtSetTimer(hTimer,
393  (PLARGE_INTEGER)pDueTime,
394  (PTIMER_APC_ROUTINE)pfnCompletionRoutine,
395  lpArgToCompletionRoutine,
396  (BOOLEAN)fResume,
397  lPeriod,
398  NULL);
399  if (NT_SUCCESS(Status)) return TRUE;
400 
401  /* If we got here, then we failed */
403  return FALSE;
404 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
VOID(CALLBACK * PTIMER_APC_ROUTINE)(PVOID, ULONG, LONG)
Definition: winternl.h:2018
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtSetTimer(IN HANDLE TimerHandle, IN PLARGE_INTEGER DueTime, IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL, IN PVOID TimerContext OPTIONAL, IN BOOLEAN WakeTimer, IN LONG Period OPTIONAL, OUT PBOOLEAN PreviousState OPTIONAL)
Definition: timer.c:582

Referenced by InputWait(), main(), and wmain().

◆ SignalObjectAndWait()

DWORD WINAPI SignalObjectAndWait ( IN HANDLE  hObjectToSignal,
IN HANDLE  hObjectToWaitOn,
IN DWORD  dwMilliseconds,
IN BOOL  bAlertable 
)

Definition at line 269 of file synch.c.

273 {
274  PLARGE_INTEGER TimePtr;
277  RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx;
278 
279  /* APCs must execute with the default activation context */
280  if (bAlertable)
281  {
282  /* Setup the frame */
283  RtlZeroMemory(&ActCtx, sizeof(ActCtx));
284  ActCtx.Size = sizeof(ActCtx);
287  }
288 
289  /* Get real handle */
290  hObjectToWaitOn = TranslateStdHandle(hObjectToWaitOn);
291 
292  /* Check for console handle */
293  if ((IsConsoleHandle(hObjectToWaitOn)) &&
294  (VerifyConsoleIoHandle(hObjectToWaitOn)))
295  {
296  /* Get the real wait handle */
297  hObjectToWaitOn = GetConsoleInputWaitHandle();
298  }
299 
300  /* Convert the timeout */
301  TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);
302 
303  /* Start wait loop */
304  do
305  {
306  /* Do the wait */
307  Status = NtSignalAndWaitForSingleObject(hObjectToSignal,
308  hObjectToWaitOn,
309  (BOOLEAN)bAlertable,
310  TimePtr);
311  if (!NT_SUCCESS(Status))
312  {
313  /* The wait failed */
316  }
317  } while ((Status == STATUS_ALERTED) && (bAlertable));
318 
319  /* Cleanup the activation context */
321 
322  /* Return wait status */
323  return Status;
324 }
LONG NTSTATUS
Definition: precomp.h:26
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
#define STATUS_ALERTED
Definition: ntstatus.h:80
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WAIT_FAILED
Definition: winbase.h:394
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:5934
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:246
#define IsConsoleHandle(h)
Definition: console.h:14
Status
Definition: gdiplustypes.h:24
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5857
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI NtSignalAndWaitForSingleObject(IN HANDLE ObjectHandleToSignal, IN HANDLE WaitableObjectHandle, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
Definition: obwait.c:473
static PLARGE_INTEGER Time
Definition: time.c:105

Referenced by test_signalandwait().

◆ Sleep()

VOID WINAPI DECLSPEC_HOTPATCH Sleep ( IN DWORD  dwMilliseconds)

Definition at line 736 of file synch.c.

737 {
738  /* Call the new API */
739  SleepEx(dwMilliseconds, FALSE);
740 }
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:748

Referenced by __declspec(), _locking(), _sleep(), _test_flush_async(), AdapterDiscoveryThread(), check_window_exists(), child_process(), child_process_write_pipe(), ClipTestProc(), Telnet::Close(), audio_wavein::close(), CloseProcessAndVerify_(), CmdRemoveService(), CMP_Report_LogOn(), collect_connections_proc(), CommandDelay(), CompleteProgressBar(), compound_encode_send_decode(), condvar_base_consumer(), condvar_base_producer(), condvar_consumer(), condvar_producer(), connection_collector(), ConsoleEventThread(), create_tabcontrol(), createFilledTabControl(), DECLARE_INTERFACE_(), detectChange(), dispatch_messages(), Display(), do_bind(), do_events(), do_wait_idle_child(), do_wait_idle_child_thread(), doChild(), DoControlService(), DoEntry(), DoStartService(), DoStopService(), DoStuff(), DoWaitForReaders(), drain_socket_thread(), dummy_process(), EnumJoysticks(), CThread::Execute(), exercizeServer(), force_redraw(), FreeUrlCacheSpaceW(), getnetconfigent(), gl_cleanup(), gl_getpass(), InputWait(), iocp_async_closesocket(), iocp_async_read_closesocket(), iocp_async_read_thread(), iocp_async_read_thread_closesocket(), IopAllocateIrpMustSucceed(), ITERATE_StartService(), keep_responsive(), keyed_event_thread(), KmtEnsureServiceState(), KsFilterRegisterPowerCallbacks(), KsPinRegisterPowerCallbacks(), LauncherRoutine2(), MailSlotWriter(), main(), MainDialogProc(), MCIAVI_mciStop(), MCIAVI_player(), MCICDA_playLoop(), MIDI_player(), MixerThreadRoutine(), MonitorChildThread(), MultiWndProc(), my_test_server(), NotifyBalloon(), ok_event_sequence(), openlog(), pipeServer(), PlayLogonSoundThread(), playStream(), post_message_thread(), proc_PlaySound(), ProcessKeys(), read_pipe(), read_pipe_test(), ReadFromPipeThread(), release_avisplitter(), Remove(), renew_session(), reset_CommMask(), Telnet::Resume(), RPC_GetLocalClassObject(), runProg(), RunTraceRoute(), SelectCloseThread(), send_and_post_user_message_thread(), send_message_thread(), send_msg_delay_proc(), service_main_common(), service_process(), ServiceMain(), set_CommBreak(), set_foreground(), simple2_cb(), simple_release_cb(), SockAsyncThread(), srwlock_base_thread1(), srwlock_base_thread2(), srwlock_base_thread3(), srwlock_example_thread(), Defragment::Start(), start_rpcss(), START_TEST(), stopService(), StorageImpl_LockRegionSync(), SystemClockPostMessageToAdviseThread(), test_AbortWaitCts(), test_accept(), test_alertable_wait(), test_apc_deadlock(), test_api(), test_async_HttpSendRequestEx(), test_asyncWAVE(), test_asyncWaveTypeMpegvideo(), test_AutoOpenWAVE(), test_capture(), test_clock(), Test_CloseWhileSelectDuplicatedSocket(), Test_CloseWhileSelectSameSocket(), test_CompleteLocal(), test_CompleteLocalURL(), test_completion_port(), test_condvars_base(), test_condvars_consumer_producer(), test_create_delete_svc(), test_dde(), test_EnumSessions(), test_events(), test_get_displayname(), test_get_input_report(), test_get_state(), test_GetFileInformationByHandleEx(), test_GetPrivateProfileString(), test_handles(), test_HttpOptions(), test_Input_mouse(), test_InputObject(), test_ioctlsocket(), test_IReferenceClock_methods(), test_keyed_events(), Test_LockUnlockServiceDatabaseWithServiceStart(), Test_LongTests(), test_menu_input_thread(), test_midi_infns(), test_midi_outfns(), test_midiOut_device(), test_midiStream(), test_no_stop(), test_NtGetTickCount(), test_openCloseWAVE(), test_overlapped(), test_PeekMessage2(), test_pipes(), test_pipes_child(), test_play(), test_playWAVE(), test_priority(), test_protocol_terminate(), test_queryconfig2(), Test_QueryLockStatusA(), Test_QueryLockStatusW(), test_readwrite(), test_refcount(), test_RegisterWaitForSingleObject(), test_RtlRegisterWait(), test_select(), test_send(), Test_SendInput(), test_SendMessage_other_thread(), test_SendMessageTimeout(), test_sequence(), test_set_state(), test_SetSite(), test_SHCreateStreamOnFileEx(), test_shortcut(), test_srwlock_base(), test_srwlock_example(), test_start_stop(), test_startA(), test_startW(), test_SuspendFlag(), test_SuspendThread(), test_thread_handle_close(), test_timer(), test_timer_queue(), test_timers_no_wnd(), test_Toolhelp(), test_tp_multi_wait(), test_tp_wait(), test_tp_window_length(), test_tp_work_scheduler(), Test_TrackMouseEvent(), test_TrackMouseEvent(), test_TreatAsClass(), Test_UnaffectedMessages(), test_urlcacheA(), Test_VeryLongTests(), test_WaitBreak(), test_WaitCts(), test_WaitRx(), test_worst_case(), test_write_watch(), TestPrivMoveFileIdentityW(), TestProc(), testWaitForConsoleInput(), ThemeWaitForServiceReady(), thread(), thread_1(), thread_main1(), thread_main2(), threadfunc(), threadFunc4(), ThreadProc(), timer_message_dlg_proc(), timer_queue_cb5(), timer_queue_cb6(), timer_release_cb(), TimerCallback2(), TimerCallback3(), toggle_ctlLine(), Desktops::ToggleMinimize(), TryToLockOrUnlockDrive(), VdmShutdown(), VfdCloseImage(), VfdStartDriver(), VfdStopDriver(), wait_for_window(), wait_idle_proc(), wait_move_event(), wait_release_cb(), WaitForService(), WaitService(), WaitWindows(), watch_thread_proc(), WAVE_mciStop(), wave_out_test_deviceOut(), wined3d_pause(), WinMain(), WlanScan(), wmain(), work2_cb(), work_cb(), work_release_cb(), WSPCloseSocket(), CardRegion::ZoomCard(), and Defragment::~Defragment().

◆ SleepEx()

DWORD WINAPI SleepEx ( IN DWORD  dwMilliseconds,
IN BOOL  bAlertable 
)

Definition at line 748 of file synch.c.

750 {
752  PLARGE_INTEGER TimePtr;
753  NTSTATUS errCode;
754  RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx;
755 
756  /* APCs must execute with the default activation context */
757  if (bAlertable)
758  {
759  /* Setup the frame */
760  RtlZeroMemory(&ActCtx, sizeof(ActCtx));
761  ActCtx.Size = sizeof(ActCtx);
764  }
765 
766  /* Convert the timeout */
767  TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);
768  if (!TimePtr)
769  {
770  /* Turn an infinite wait into a really long wait */
771  Time.LowPart = 0;
772  Time.HighPart = 0x80000000;
773  TimePtr = &Time;
774  }
775 
776  /* Loop the delay while APCs are alerting us */
777  do
778  {
779  /* Do the delay */
780  errCode = NtDelayExecution((BOOLEAN)bAlertable, TimePtr);
781  }
782  while ((bAlertable) && (errCode == STATUS_ALERTED));
783 
784  /* Cleanup the activation context */
786 
787  /* Return the correct code */
788  return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0;
789 }
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_ALERTED
Definition: ntstatus.h:80
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
#define WAIT_IO_COMPLETION
Definition: winbase.h:392
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:879
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:5934
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:246
ULONG LowPart
Definition: typedefs.h:104
#define STATUS_USER_APC
Definition: ntstatus.h:78
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5857
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static PLARGE_INTEGER Time
Definition: time.c:105

Referenced by Beep(), gl_getcx(), IDirectPlay4Impl_EnumSessions(), main(), pipeserver(), ProcessPlayingNotes(), read_file_test(), read_pipe_test(), serverThreadMain2(), Sleep(), START_TEST(), StopStreamingInSoundThread(), test_alertable(), test_cancelio(), test_CreatePipe(), test_iocp_fileio(), test_nonalertable(), test_overlapped(), test_read_write(), test_readdirectorychanges_cr(), test_servicenotify(), test_WSARecv(), thread_main1(), and ui_select().

◆ UnregisterWait()

BOOL WINAPI UnregisterWait ( IN HANDLE  WaitHandle)

Definition at line 880 of file synch.c.

881 {
883 
884  /* Check for invalid handle */
885  if (!WaitHandle)
886  {
887  /* Fail */
889  return FALSE;
890  }
891 
892  /* Deregister the wait and check status */
893  Status = RtlDeregisterWaitEx(WaitHandle, NULL);
894  if (!(NT_SUCCESS(Status)) || (Status == STATUS_PENDING))
895  {
896  /* Failure or non-blocking call */
898  return FALSE;
899  }
900 
901  /* All good */
902  return TRUE;
903 }
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWaitEx(_In_ HANDLE hWaitHandle, _In_opt_ HANDLE hCompletionEvent)
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define SetLastError(x)
Definition: compat.h:409
Status
Definition: gdiplustypes.h:24

Referenced by init_funcs(), testWaitForConsoleInput(), ThemeStartCallback(), and ThemeStopCallback().

◆ UnregisterWaitEx()

BOOL WINAPI UnregisterWaitEx ( IN HANDLE  WaitHandle,
IN HANDLE  CompletionEvent 
)

Definition at line 910 of file synch.c.

912 {
914 
915  /* Check for invalid handle */
916  if (!WaitHandle)
917  {
918  /* Fail */
920  return FALSE;
921  }
922 
923  /* Deregister the wait and check status */
924  Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent);
925  if (!(NT_SUCCESS(Status)) ||
926  ((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING)))
927  {
928  /* Failure or non-blocking call */
930  return FALSE;
931  }
932 
933  /* All good */
934  return TRUE;
935 }
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWaitEx(_In_ HANDLE hWaitHandle, _In_opt_ HANDLE hCompletionEvent)
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define SetLastError(x)
Definition: compat.h:409
Status
Definition: gdiplustypes.h:24

◆ WaitForMultipleObjects()

◆ WaitForMultipleObjectsEx()

DWORD WINAPI WaitForMultipleObjectsEx ( IN DWORD  nCount,
IN CONST HANDLE lpHandles,
IN BOOL  bWaitAll,
IN DWORD  dwMilliseconds,
IN BOOL  bAlertable 
)

Definition at line 169 of file synch.c.

174 {
175  PLARGE_INTEGER TimePtr;
177  PHANDLE HandleBuffer;
178  HANDLE Handle[8];
179  DWORD i;
181  RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx;
182 
183  /* APCs must execute with the default activation context */
184  if (bAlertable)
185  {
186  /* Setup the frame */
187  RtlZeroMemory(&ActCtx, sizeof(ActCtx));
188  ActCtx.Size = sizeof(ActCtx);
191  }
192 
193  /* Check if we have more handles then we locally optimize */
194  if (nCount > 8)
195  {
196  /* Allocate a buffer for them */
197  HandleBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
198  0,
199  nCount * sizeof(HANDLE));
200  if (!HandleBuffer)
201  {
202  /* No buffer, fail the wait */
205  return WAIT_FAILED;
206  }
207  }
208  else
209  {
210  /* Otherwise, use our local buffer */
211  HandleBuffer = Handle;
212  }
213 
214  /* Copy the handles into our buffer and loop them all */
215  RtlCopyMemory(HandleBuffer, (LPVOID)lpHandles, nCount * sizeof(HANDLE));
216  for (i = 0; i < nCount; i++)
217  {
218  /* Check what kind of handle this is */
219  HandleBuffer[i] = TranslateStdHandle(HandleBuffer[i]);
220 
221  /* Check for console handle */
222  if ((IsConsoleHandle(HandleBuffer[i])) &&
223  (VerifyConsoleIoHandle(HandleBuffer[i])))
224  {
225  /* Get the real wait handle */
226  HandleBuffer[i] = GetConsoleInputWaitHandle();
227  }
228  }
229 
230  /* Convert the timeout */
231  TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);
232 
233  /* Start wait loop */
234  do
235  {
236  /* Do the wait */
238  HandleBuffer,
239  bWaitAll ? WaitAll : WaitAny,
240  (BOOLEAN)bAlertable,
241  TimePtr);
242  if (!NT_SUCCESS(Status))
243  {
244  /* Wait failed */
247  }
248  } while ((Status == STATUS_ALERTED) && (bAlertable));
249 
250  /* Check if we didn't use our local buffer */
251  if (HandleBuffer != Handle)
252  {
253  /* Free the allocated one */
254  RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer);
255  }
256 
257  /* Cleanup the activation context */
259 
260  /* Return wait status */
261  return Status;
262 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
NTSTATUS NTAPI NtWaitForMultipleObjects(IN ULONG ObjectCount, IN PHANDLE HandleArray, IN WAIT_TYPE WaitType, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
Definition: obwait.c:46
#define STATUS_ALERTED
Definition: ntstatus.h:80
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
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 GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
_In_ HANDLE Handle
Definition: extypes.h:390
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_FAILED
Definition: winbase.h:394
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:5934
#define SetLastError(x)
Definition: compat.h:409
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:246
#define IsConsoleHandle(h)
Definition: console.h:14
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
Status
Definition: gdiplustypes.h:24
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5857
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static PLARGE_INTEGER Time
Definition: time.c:105

Referenced by alertable_wait_thread(), CoWaitForMultipleHandles(), FileAsyncReader_WaitForNext(), NotifyTopLevelWindow(), RealMsgWaitForMultipleObjectsEx(), rpcrt4_protseq_np_wait_for_new_connection(), rpcrt4_protseq_sock_wait_for_new_connection(), WaitForMultipleObjects(), and WSAWaitForMultipleEvents().

◆ WaitForSingleObject()

DWORD WINAPI WaitForSingleObject ( IN HANDLE  hHandle,
IN DWORD  dwMilliseconds 
)

Definition at line 82 of file synch.c.

84 {
85  /* Call the extended API */
86  return WaitForSingleObjectEx(hHandle, dwMilliseconds, FALSE);
87 }
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94

Referenced by _cwait(), _pclose(), _read_request_data(), _send_response_and_wait(), _test_flush_done(), _test_not_signaled(), _test_signaled(), _tmain(), _tWinMain(), AcquireEntrypointMutex(), AcsHlpSendCommand(), alarmThreadMain(), alertable_wait_apc2(), alertable_wait_thread(), ANIMATE_AnimationThread(), ANIMATE_DoStop(), apartment_hostobject_in_hostapt(), async_proc(), AVISplitter_done_process(), AVISplitter_Sample(), AVISplitter_thread_reader(), BackgroundCopyJob_Cancel(), BaseMemAllocator_GetBuffer(), BasepDoTapeOperation(), BaseRendererImpl_GetState(), cache_container_lock_index(), cache_container_open_index(), cache_lock(), CallSessionThread(), CallSoundThread(), cancel_request(), CardRegion::CanDragCards(), CardRegion::CanDropCards(), cfgets(), check_dinput_hooks(), check_hook_thread(), check_messages_(), check_thread_instance(), child_process(), CKsClockForwarder_ThreadStartup(), cleanReq(), client_start(), ClientRpcChannelBuffer_SendReceive(), clipboard_wnd_proc(), clnt_vc_destroy(), close_async_handle(), close_request(), CloseDevice(), CM_Add_Range(), CM_First_Range(), CM_Free_Range_List(), CM_Next_Range(), cmd_start(), CMP_WaitNoPendingInstallEvents(), collect_query_thread(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBGetCurrentPortUsage(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), CommandThreadProc(), CommonInstall(), ConDrvConsoleCtrlEventTimeout(), ConSrvConsoleCtrlEventTimeout(), COutputPin_SetState(), crash_and_debug(), crash_and_winedbg(), create_child_thread(), create_file_test(), create_server_process(), create_window_thread(), CreateClientProcess(), CreateContext(), CreateRenderingSubsystem(), CreateRenderingWindow(), CreateServiceThread(), CreateTestThread(), critsect_locked_thread(), CRYPT_DownloadObject(), CRYPT_ImportSystemRootCertsToReg(), detectChange(), BtrfsVolPropSheet::DeviceDlgProc(), DeviceInstallThread(), disassociate2_cb(), disassociate3_cb(), disassociate_cb(), dispatch_rpc(), dll_entry_point(), do_getservbyname(), do_register_dll(), do_spawnT(), do_test(), do_wait_idle_child(), doChildren(), doDebugger(), DoEntry(), CWineTest::DoListCommand(), TMouse::doMouse(), DosShutdown(), DosStartProcess32(), DoStartStartupItems(), DoWaitForReaders(), download_url(), DP_EnumSessionsSendAsyncRequestThread(), DP_MSG_ExpectReply(), DPL_MSG_ThreadMain(), DSoundRender_BreakConnect(), DSoundRender_HandleEndOfStream(), DSoundRender_Release(), DSoundRender_SendSampleData(), dummy_thread_proc(), end_host_object(), EndLocalThread(), ensurePlayerThread(), EnterCriticalPolicySection(), EnumEventsThread(), event_client(), EventsQueue_GetEvent(), Execute(), exercizeServer(), expect_event(), FileCopyCallback(), FinishNotificationThread(), flush_events(), free_urlcache(), FreeUrlCacheSpaceW(), get_key_state_thread(), GetCharacterTimeout(), GetOverlappedResult(), GetPwrDiskSpindownRange(), GetSocketInformation(), TTelnetHandler::Go(), GUIDisplayStatusMessage(), GuiInit(), GuiInitFrontEnd(), handle_full_cache(), HandleLogoff(), HandleShutdown(), hooked_WaitForInputIdle(), HTTP_RetrieveEncodedObjectW(), IDirectSoundCaptureBufferImpl_Stop(), ifproxy_get_public_ref(), ifproxy_release_public_refs(), implicit_mta_marshal_proc(), inet_ntoa_thread_proc(), INetCfgLock_fnAcquireWriteLock(), init(), InputWait(), install_wine_gecko(), InstallDevice(), instance_finalization_cb(), InternetReadFile_test(), InternetReadFileExA_test(), BtrfsContextMenu::InvokeCommand(), iocp_async_read_thread(), iocp_async_read_thread_closesocket(), COutputPin::IoProcessRoutine(), is_signaled(), ITERATE_RemoveExistingProducts(), launch_exe(), LauncherRoutine2(), LoadUserProfileW(), CardButton::Lock(), Mutex::Lock(), CardRegion::Lock(), LockAudioDeviceList(), logMess(), LogToFile(), LookupThreadProc(), LS_ThreadProc(), MailSlotReader(), main(), main_window_procA(), MainLoop(), MCICDA_GetStatus(), MCICDA_Pause(), MCICDA_Play(), MCICDA_playLoop(), MCICDA_Resume(), MCICDA_Stop(), MCIQTZ_mciStatus(), MCIQTZ_mciStop(), MediaEvent_WaitForCompletion(), MIDI_mciPlay(), MIDI_mciStop(), midiStreamOpen(), MMSYSTEM_MidiStream_PostMessage(), MonitorChildThread(), MouseEventHandler(), MouseGetDataFast(), MouseGetPacket(), StringTest::mt(), MULTIMEDIA_PlaySound(), mutant_thread(), mutex_thread_proc(), NBCmdQueueCancel(), netconn_resolve(), nfs41_send_compound(), no_couninitialize_server_proc(), NonConsoleProcessShutdown(), NotificationThread(), ok_event_sequence(), ole_server(), CardButton::OnLButtonDown(), oob_client(), BtrfsPropSheet::open_as_admin(), open_read_test_request(), open_socket_request(), OpenMidiDevice(), OpenSharedMemory(), OutputDebugStringA(), OutputQueueImpl_ThreadProc(), BtrfsBalance::PauseBalance(), PdhCloseQuery(), PdhCollectQueryDataEx(), audio_waveout::playing_procedure(), PlaySound_WaitDone(), post_rbuttonup_msg(), proc_PlaySound(), ProcessDlgProc(), ProcessPlayingNotes(), processRequest(), ProtocolSink_Switch(), PS2PortQueueRead(), PS2QueuePush(), PullPin_Disconnect(), PullPin_InitProcessing(), PullPin_PauseProcessing(), PullPin_Release(), PullPin_StartProcessing(), PullPin_StopProcessing(), PullPin_Thread_Main(), PullPin_WaitForStateChange(), QualityControlRender_WaitFor(), read_file_test(), read_pipe(), audio_wavein::recording_procedure(), recv_thread(), ReferenceClock_AdvisePeriodic(), ReferenceClock_AdviseTime(), release_host_object(), release_semaphore_thread(), report(), BtrfsVolPropSheet::ResetStats(), resync_after_run(), RPC_StopLocalServer(), RpcMgmtWaitServerListen(), RpcReadFile(), rpcrt4_conn_np_read(), rpcrt4_conn_np_write(), rpcrt4_conn_release_and_wait(), rpcrt4_http_timer_thread(), rpcrt4_sock_wait_for_send(), RPCRT4_sync_with_server_thread(), RpcServerUnregisterIf(), rtl_wait_cb(), run_cmd(), run_ex(), run_reg_exe_(), run_regedit_exe_(), run_script_file(), run_server(), runcmd(), runCmd(), runProg(), RunSetupThreadProc(), RunTests(), s_stop(), ScmControlService(), ScmSendStartCommand(), ScmWaitForLsa(), ScmWaitForServiceConnect(), ScreensaverPreview(), scrollkeys(), semaphore_thread_proc(), send_socket_request(), SendMessage_thread_1(), SendMessage_thread_2(), serv_main(), server(), server_send_reply(), server_thread(), service_main(), ServiceExecutionThread(), ServiceMain(), ServiceStart(), SetSocketInformation(), SHCreateThread(), shell(), shell_execute_(), shell_execute_ex_(), SHGlobalCounterDecrement(), SHGlobalCounterGetValue(), show_cursor_thread(), BtrfsVolPropSheet::ShowScrub(), simple_client(), simple_group_cancel_cb(), simple_mixed_client(), smresult_thread_proc(), smresult_wndproc(), start_dummy_thread(), start_host_object2(), START_TEST(), BtrfsBalance::StartBalance(), StartChild(), StartClients(), CProgressDialog::StartProgressDialog(), StartSessionThread(), StartStopEnumEventsThread(), StartTestCORE10188(), statusclb_OnStopBinding(), CKsClockForwarder::Stop(), stop_dummy_thread(), audio_wavein::stop_recording(), BtrfsBalance::StopBalance(), sub_thread(), sync_threads_and_run_one(), SystemClockImpl_Release(), TerminateShell(), TerminateSoundThread(), Test2(), Test3(), test_AbortWaitCts(), test_accept(), test_AcceptEx(), test_activateapp(), test_alertable(), test_alertable_wait(), test_apc_deadlock(), test_async(), test_async_HttpSendRequestEx(), test_async_read(), test_attach_input(), test_binding(), test_BindToStorage(), test_BreakawayOk(), test_bsc_marshaling(), test_buffer(), test_buffer8(), test_cancelio(), test_capture(), Test_CloseWhileSelectDuplicatedSocket(), Test_CloseWhileSelectSameSocket(), test_CoFreeUnusedLibraries(), Test_CommandLine(), test_CommandLine(), test_completion(), test_CompletionPort(), test_concurrent_header_access(), test_condvars_base(), test_condvars_consumer_producer(), test_conn_close(), test_ConnectEx(), test_connection_cache(), test_connection_closing(), test_Console(), test_CoRegisterPSClsid(), test_CoWaitForMultipleHandles(), test_CoWaitForMultipleHandles_thread(), test_crash_couninitialize(), test_CreateProcessWithDesktop(), test_CreateRemoteThread(), test_CreateThread_basic(), test_CreateThread_stack(), test_CreateThread_suspended(), test_debug_children(), test_DebuggingFlag(), test_default_ime_window_creation(), test_defwinproc(), test_delegated_methods(), test_deletecontext(), test_DetachConsoleHandles(), test_DetachStdHandles(), test_Directory(), test_DisconnectNamedPipe(), test_DragQueryFile(), test_enum_thread_windows(), test_Environment(), test_event(), test_events(), test_ExitCode(), test_ExitProcess(), test_FakeDLL(), test_ffcn(), test_foregroundwindow(), test_fragmentsize(), test_ftp_protocol(), test_GetAddrInfoExW(), test_GetKeyState(), test_getservbyname(), test_GetThreadExitCode(), test_GetThreadTimes(), test_handles(), test_http_connection(), test_http_protocol_url(), test_ImmDefaultHwnd(), test_ImmThreads(), test_ImpersonateNamedPipeClient(), test_implicit_mta(), test_inet_ntoa(), test_Input_mouse(), test_InSendMessage(), test_interthread_messages(), test_iocp_callback(), test_ip_pktinfo(), test_IsProcessInJob(), test_jobInheritance(), test_keyed_events(), test_KillOnJobClose(), test_layered_window(), test_local_server(), test_media_event(), test_menu_input(), test_MessageBox(), test_messages(), test_mixerOpen(), test_multithreaded_clipboard(), test_mutant(), test_mutex(), test_no_content(), test_no_couninitialize_client(), test_no_couninitialize_server(), test_nonalertable(), test_NonExistentPath(), test_noprivileges(), test_NtAtom(), test_ntncdf(), test_ntncdf_async(), test_NtSuspendProcess(), test_open_url_async(), test_overlapped(), test_parameters(), test_parametersEx(), test_PdhCollectQueryDataEx(), test_PeekMessage(), test_persistent_connection(), test_proxy_used_in_wrong_thread(), test_QueryInformationJobObject(), test_QueueUserWorkItem(), test_read_device(), test_read_write(), test_readdirectorychanges(), test_readdirectorychanges_filedir(), test_readdirectorychanges_null(), test_reader_info(), test_readfileex_pending(), test_reconnect(), Test_recv(), test_redirect(), test_registered_object_thread_affinity(), test_RegisterWaitForSingleObject(), test_RegNotifyChangeKeyValue(), test_render_with_multithread(), test_RtlIsCriticalSectionLocked(), test_RtlQueueWorkItem(), test_RtlRegisterWait(), test_runner(), test_section_access(), test_security_flags(), test_select(), test_send(), test_set_clipboard_DRAWCLIPBOARD(), test_SetCursor(), test_SetFocus(), test_SetForegroundWindow(), test_shell_window(), test_ShowCursor(), test_signalandwait(), test_sioAddressListChange(), test_smresult(), test_srwlock_base(), test_srwlock_example(), test_Startup(), test_StartupNoConsole(), test_stop_wait_for_call(), test_successive_HttpSendRequest(), test_SuspendFlag(), test_SuspendThread(), test_tableweak_and_normal_marshal_and_releasedata(), test_tableweak_and_normal_marshal_and_unmarshal(), test_TerminateJobObject(), test_TerminateThread(), test_thread_actctx(), test_thread_handle_close(), test_thread_objects(), test_thread_start_address(), test_threads(), test_timer_queue(), test_timers(), test_Toolhelp(), test_tp_disassociate(), test_tp_group_cancel(), test_tp_group_wait(), test_tp_instance(), test_tp_multi_wait(), test_tp_simple(), test_tp_timer(), test_tp_wait(), test_tp_window_length(), test_TransmitFile(), test_two_tableweak_marshal_and_releasedata(), test_WaitBreak(), test_WaitCommEvent(), test_WaitCts(), test_WaitDcd(), test_WaitDsr(), test_WaitForInputIdle(), test_WaitForJobObject(), test_WaitForSingleObject(), test_WaitRing(), test_waittxempty(), test_winevents(), test_WM_DISPLAYCHANGE(), test_worst_case(), test_write_watch(), test_WSAPoll(), test_WSARecv(), testCtrlHandler(), TestRead(), TestShellExecuteEx(), testWaitForConsoleInput(), TestWrite(), thread(), thread1(), thread2(), thread_proc(), CDownloadManager::ThreadFunc(), TIME_MMSysTimeThread(), TIME_MMTimeStop(), timeKillEvent(), UninitializeGPNotifications(), UnloadUserProfile(), UserClientShutdown(), VgaUpdateFramebuffer(), VideoRenderer_EndFlush(), VideoRendererInner_Release(), VMR9_SurfaceAllocator_TerminateDevice(), WaitExpect_(), waitforkey(), WaitForLsass(), WaitForMachinePolicyForegroundProcessing(), WaitForSCManager(), WaitForUserPolicyForegroundProcessing(), wave_in_test_deviceIn(), WAVE_mciPlayWaitDone(), WAVE_mciRecordWaitDone(), wave_out_test_deviceOut(), wbem_services_CancelAsyncCall(), wbem_services_Release(), window_from_point_proc(), wined3d_cs_wait_event(), WinMain(), work_group_cancel_cb(), WsAsyncThread(), WsCheckCatalogState(), WshExec_Terminate(), WSPAccept(), WSPBind(), WSPCloseSocket(), WSPConnect(), WSPEnumNetworkEvents(), WSPEventSelect(), WSPGetPeerName(), WSPGetSockName(), WSPListen(), WSPRecv(), WSPRecvFrom(), WSPSelect(), WSPSend(), WSPSendTo(), WSPShutdown(), WsSetupCatalogProtection(), wWinMain(), xmlMutexLock(), CHardErrorThread::~CHardErrorThread(), and CThread::~CThread().

◆ WaitForSingleObjectEx()

DWORD WINAPI WaitForSingleObjectEx ( IN HANDLE  hHandle,
IN DWORD  dwMilliseconds,
IN BOOL  bAlertable 
)

Definition at line 94 of file synch.c.

97 {
98  PLARGE_INTEGER TimePtr;
101  RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx;
102 
103  /* APCs must execute with the default activation context */
104  if (bAlertable)
105  {
106  /* Setup the frame */
107  RtlZeroMemory(&ActCtx, sizeof(ActCtx));
108  ActCtx.Size = sizeof(ActCtx);
111  }
112 
113  /* Get real handle */
114  hHandle = TranslateStdHandle(hHandle);
115 
116  /* Check for console handle */
117  if ((IsConsoleHandle(hHandle)) && (VerifyConsoleIoHandle(hHandle)))
118  {
119  /* Get the real wait handle */
120  hHandle = GetConsoleInputWaitHandle();
121  }
122 
123  /* Convert the timeout */
124  TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);
125 
126  /* Start wait loop */
127  do
128  {
129  /* Do the wait */
130  Status = NtWaitForSingleObject(hHandle, (BOOLEAN)bAlertable, TimePtr);
131  if (!NT_SUCCESS(Status))
132  {
133  /* The wait failed */
136  }
137  } while ((Status == STATUS_ALERTED) && (bAlertable));
138 
139  /* Cleanup the activation context */
141 
142  /* Return wait status */
143  return Status;
144 }
LONG NTSTATUS
Definition: precomp.h:26
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
#define STATUS_ALERTED
Definition: ntstatus.h:80
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WAIT_FAILED
Definition: winbase.h:394
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:5934
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:246
#define IsConsoleHandle(h)
Definition: console.h:14
Status
Definition: gdiplustypes.h:24
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5857
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static PLARGE_INTEGER Time
Definition: time.c:105
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by _tWinMain(), DeleteNode(), GetDeviceData(), main(), NotifyTopLevelWindow(), overlapped_server(), serverThreadMain3(), serverThreadMain5(), SoundThreadMain(), StartApplication(), tcp_recv(), tcp_send(), test_AbortWaitCts(), test_alertable(), test_async_file_errors(), test_readfileex_pending(), test_WaitBreak(), test_WaitCts(), test_WaitDcd(), test_WaitDsr(), test_WaitRing(), test_WaitRx(), toggle_ctlLine(), WaitForSingleObject(), WaveThread(), WdmAudCommitWaveBufferByLegacy(), and WriteFileEx_Remixer().