ReactOS 0.4.16-dev-289-g096a551
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 CreateSemaphoreExW (IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL, IN DWORD dwFlags OPTIONAL, IN DWORD dwDesiredAccess OPTIONAL)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreExA (IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL, IN DWORD dwFlags OPTIONAL, IN DWORD dwDesiredAccess 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}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI NtCancelTimer(IN HANDLE TimerHandle, OUT PBOOLEAN CurrentState OPTIONAL)
Definition: timer.c:252
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167

Referenced by SEALED_::ProtocolLoop().

◆ CreateEventA()

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

Definition at line 637 of file synch.c.

641{
642 ConvertWin32AnsiObjectApiToUnicodeApi(Event, lpName, lpEventAttributes, bManualReset, bInitialState);
643}
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54
_In_ LPCSTR lpName
Definition: winbase.h:2814

Referenced by async1(), async2(), create_function_addr_events(), DllMain(), do_test(), execute_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_AddMandatoryAce(), test_apc_deadlock(), test_completion(), 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_ImmThreads(), test_implicit_mta(), test_Input_mouse(), test_interthread_messages(), test_ioctl(), test_ip_pktinfo(), test_layered_window(), test_local_server(), test_midiStream(), 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_SendMessage_other_thread(), 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(), 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 651 of file synch.c.

655{
657 lpEventAttributes,
658 lpName,
660 bInitialState);
661}
#define CreateNtObjectFromWin32Api(obj, ntobj, access, sec, name,...)
Definition: base_x.h:135
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
@ NotificationEvent
@ SynchronizationEvent

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(), CPipe::CPipe(), create_overlapped_pipe(), create_server_process(), CreateGPEvent(), CreatePublicEvent(), CreateRenderingSubsystem(), CreateTestThread(), CRYPT_MakeInetContext(), dispatch_rpc(), DispatcherThread(), DosStartProcess32(), download_url(), DP_MSG_BuildAndLinkReplyStruct(), DPL_CreateAndSetLobbyHandles(), DSoundRender_create(), EmulatorInitialize(), EventsQueue_Init(), FileAsyncReader_RequestAllocator(), FileAsyncReader_SyncRead(), FilterGraph_create(), get_np_event(), GUIDisplayStatusMessage(), Icmp6SendEcho2(), IcmpSendEcho(), IcmpSendEcho2(), IDirectPlay4Impl_EnumSessions(), init(), init_async(), init_events(), init_thread_sync_helpers(), init_urlcache(), CIconWatcher::Initialize(), CDesktopThread::Initialize(), initialize_request(), COutputPin::InitializeIOThread(), InitializePnPManager(), InitializeScreenSaver(), InstallDevice(), KsSynchronousDeviceControl(), local_server_thread(), LsarStartRpcServer(), main(), ManualResetEvent_Construct(), MCI_SendCommandAsync(), MCIAVI_drvOpen(), MCIAVI_OpenAudio(), MCIQTZ_drvOpen(), midiStreamOpen(), mmTaskCreate(), NBCmdQueueCancel(), netconn_resolve(), 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(), SetSecurityServicesEvent(), SHCreateThread(), START_TEST(), StartPortThread(), 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_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_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(), W32TmServiceMain(), WaitForLsass(), WaitForSCManager(), wave_in_test_deviceIn(), WAVE_mciPlay(), WAVE_mciRecord(), wave_out_test_deviceOut(), WdmAudCommitWaveBufferByLegacy(), WdmAudSetMixerDeviceFormatByLegacy(), wined3d_cs_create(), 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 563 of file synch.c.

566{
567 ConvertWin32AnsiObjectApiToUnicodeApi(Mutex, lpName, lpMutexAttributes, bInitialOwner);
568}
Definition: Mutex.h:16

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

◆ CreateMutexW()

◆ CreateSemaphoreA()

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

◆ CreateSemaphoreExA()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreExA ( IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes  OPTIONAL,
IN LONG  lInitialCount,
IN LONG  lMaximumCount,
IN LPCSTR lpName  OPTIONAL,
IN DWORD dwFlags  OPTIONAL,
IN DWORD dwDesiredAccess  OPTIONAL 
)

Definition at line 476 of file synch.c.

482{
484
485 if (!lpName)
486 {
487 return CreateSemaphoreExW(lpSemaphoreAttributes,
488 lInitialCount,
489 lMaximumCount,
490 NULL,
491 dwFlags,
492 dwDesiredAccess);
493 }
494
496
497 if (NT_SUCCESS(Status))
498 {
499 return CreateSemaphoreExW(lpSemaphoreAttributes,
500 lInitialCount,
501 lMaximumCount,
502 UnicodeCache->Buffer,
503 dwFlags,
504 dwDesiredAccess);
505 }
506
508}
#define ConvertAnsiToUnicodeEpilogue
Definition: base_x.h:42
#define ConvertAnsiToUnicodeBody(name)
Definition: base_x.h:38
#define ConvertAnsiToUnicodePrologue
Definition: base_x.h:33
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreExW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL, IN DWORD dwFlags OPTIONAL, IN DWORD dwDesiredAccess OPTIONAL)
Definition: synch.c:459
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ CreateSemaphoreExW()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreExW ( IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes  OPTIONAL,
IN LONG  lInitialCount,
IN LONG  lMaximumCount,
IN LPCWSTR lpName  OPTIONAL,
IN DWORD dwFlags  OPTIONAL,
IN DWORD dwDesiredAccess  OPTIONAL 
)

Definition at line 459 of file synch.c.

465{
466 CreateNtObjectFromWin32Api(Semaphore, Semaphore, dwDesiredAccess,
467 lpSemaphoreAttributes,
468 lpName,
469 lInitialCount,
470 lMaximumCount);
471}

Referenced by CreateSemaphoreExA().

◆ CreateSemaphoreW()

◆ 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

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}
#define TIMER_ALL_ACCESS
Definition: extypes.h:116
@ SynchronizationTimer
@ NotificationTimer

Referenced by ServiceInit().

◆ InitializeCriticalSection()

VOID WINAPI InitializeCriticalSection ( OUT LPCRITICAL_SECTION  lpCriticalSection)

Definition at line 751 of file synch.c.

752{
754
755 /* Initialize the critical section and raise an exception if we failed */
756 Status = RtlInitializeCriticalSection((PVOID)lpCriticalSection);
758}
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)

Referenced by __mingw_TLScallback(), __xmlGlobalInitMutexLock(), _Locale_init(), _tmain(), alloc_device(), alloc_serverprotoseq(), ANIMATE_Create(), apartment_construct(), ApiInit(), AsyncInetDownload(), AtlModuleInit(), audiomediastream_create(), BackgroundCopyJobConstructor(), BaseFilter_Init(), BaseRenderer_Init(), Binding_Create(), BitmapClipper_Create(), BitmapImpl_Create(), BitmapScaler_Create(), BmpDecoder_Create(), ATL::CCriticalSection::CCriticalSection(), chm_dup(), chm_openW(), ATL::CImage::CInitGDIPlus::CInitGDIPlus(), 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(), DnsIntCacheInitialize(), 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(), InitChangeNotifications(), InitD3D9BaseDevice(), InitEventSourceList(), CIconWatcher::Initialize(), initialize_directinput_instance(), InitializeGPNotifications(), InitializePrintMonitor2(), install_addon(), 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(), QCAP_createCaptureGraphBuilder2(), 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(), WinHttpOpen(), WinHttpRequest_create(), WINMM_CreateIData(), wmainCRTStartup(), WsAsyncGlobalInitialize(), WsCreateStartupSynchronization(), WsNcOpen(), WsNqInitialize(), WsProcInitialize(), WsRasInitializeAutodial(), WsTcOpen(), xmlNewMutex(), and xmlNewRMutex().

◆ InitializeCriticalSectionAndSpinCount()

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

Definition at line 765 of file synch.c.

767{
769
770 /* Initialize the critical section */
772 dwSpinCount);
773 if (!NT_SUCCESS(Status))
774 {
775 /* Set failure code */
777 return FALSE;
778 }
779
780 /* Success */
781 return TRUE;
782}
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSectionAndSpinCount(_In_ PRTL_CRITICAL_SECTION CriticalSection, _In_ ULONG SpinCount)

Referenced by _kbhit(), ProcessAttach(), 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:3016

◆ 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}
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ InterlockedExchangeAdd()

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

Definition at line 59 of file synch.c.

61{
63}
IN OUT PLONG Addend
Definition: CrNtStubs.h:25
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 669 of file synch.c.

672{
674}
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86
static BOOL bInheritHandle
Definition: pipe.c:82

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

◆ OpenEventW()

◆ OpenMutexA()

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

Definition at line 592 of file synch.c.

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 605 of file synch.c.

608{
609 OpenNtObjectFromWin32Api(Mutant, dwDesiredAccess, bInheritHandle, lpName);
610}

Referenced by K32CreateDBMonMutex(), and test_mutex().

◆ OpenSemaphoreA()

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

Definition at line 516 of file synch.c.

519{
521}

Referenced by Test_atexit(), test_semaphore(), and test_semaphore_security().

◆ OpenSemaphoreW()

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

Definition at line 529 of file synch.c.

532{
533 OpenNtObjectFromWin32Api(Semaphore, dwDesiredAccess, bInheritHandle, lpName);
534}

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}

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}

Referenced by test_waitable_timer().

◆ PulseEvent()

BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent ( IN HANDLE  hEvent)

Definition at line 695 of file synch.c.

696{
698
699 /* Pulse the event */
701 if (NT_SUCCESS(Status)) return TRUE;
702
703 /* If we got here, then we failed */
705 return FALSE;
706}
static HANDLE hEvent
Definition: comm.c:54
NTSTATUS NTAPI NtPulseEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:244

Referenced by ReleaseReadLock(), 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 850 of file synch.c.

856{
858
859 /* Get real handle */
860 hObject = TranslateStdHandle(hObject);
861
862 /* Check for console handle */
863 if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject)))
864 {
865 /* Get the real wait handle */
866 hObject = GetConsoleInputWaitHandle();
867 }
868
869 /* Register the wait now */
870 Status = RtlRegisterWait(phNewWaitObject,
871 hObject,
872 Callback,
873 Context,
874 dwMilliseconds,
875 dwFlags);
876 if (!NT_SUCCESS(Status))
877 {
878 /* Return failure */
880 return FALSE;
881 }
882
883 /* All good */
884 return TRUE;
885}
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
HANDLE WINAPI GetConsoleInputWaitHandle(VOID)
Definition: console.c:683
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
NTSYSAPI NTSTATUS NTAPI RtlRegisterWait(_In_ PHANDLE phNewWaitObject, _In_ HANDLE hObject, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID pvContext, _In_ ULONG ulMilliseconds, _In_ ULONG ulFlags)
#define IsConsoleHandle(h)
Definition: console.h:14
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458

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 892 of file synch.c.

897{
899 HANDLE hNewWaitObject;
900
901 /* Get real handle */
902 hObject = TranslateStdHandle(hObject);
903
904 /* Check for console handle */
905 if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject)))
906 {
907 /* Get the real wait handle */
908 hObject = GetConsoleInputWaitHandle();
909 }
910
911 /* Register the wait */
912 Status = RtlRegisterWait(&hNewWaitObject,
913 hObject,
914 Callback,
915 Context,
916 dwMilliseconds,
917 dwFlags);
918 if (!NT_SUCCESS(Status))
919 {
920 /* Return failure */
922 return NULL;
923 }
924
925 /* Return the object */
926 return hNewWaitObject;
927}

◆ ReleaseMutex()

BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex ( IN HANDLE  hMutex)

Definition at line 618 of file synch.c.

619{
621
622 /* Release the mutant */
624 if (NT_SUCCESS(Status)) return TRUE;
625
626 /* If we got here, then we failed */
628 return FALSE;
629}
HANDLE hMutex
Definition: mutex.c:11
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:296

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_Dup_Range_List(), CM_First_Range(), CM_Free_Range_List(), CM_Next_Range(), CM_Test_Range_Available(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBGetCurrentPortUsage(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), DeviceInstallThread(), FatSetFatRun(), FreeUrlCacheSpaceW(), ifproxy_get_public_ref(), ifproxy_release_public_refs(), INetCfgLock_fnReleaseWriteLock(), CicMutex::Leave(), LeaveCriticalPolicySection(), LoadUserProfileW(), MouseEventHandler(), MouseGetDataFast(), MouseGetPacket(), CardButton::OnLButtonDown(), OpenSharedMemory(), OutputDebugStringA(), ProcessDeviceInstallEvent(), PS2PortQueueRead(), PS2QueuePush(), ReleaseEntrypointMutex(), ReleaseStartupMutex(), RPCRT4_sync_with_server_thread(), test_mutex(), thread1(), thread2(), UnloadUserProfile(), CardButton::UnLock(), CardRegion::UnLock(), Mutex::Unlock(), UnlockAudioDeviceList(), VgaConsoleDestroyGraphicsScreen(), VgaUpdateFramebuffer(), and CSafeMutex::~CSafeMutex().

◆ ReleaseSemaphore()

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

Definition at line 542 of file synch.c.

545{
547
548 /* Release the semaphore */
549 Status = NtReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount);
550 if (NT_SUCCESS(Status)) return TRUE;
551
552 /* If we got here, then we failed */
554 return FALSE;
555}
NTSTATUS NTAPI NtReleaseSemaphore(IN HANDLE SemaphoreHandle, IN LONG ReleaseCount, OUT PLONG PreviousCount OPTIONAL)
Definition: sem.c:295

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(), exitfunc1(), exitfunc2(), exitfunc3(), 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(), SysParamsTestProc(), 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 714 of file synch.c.

715{
717
718 /* Clear the event */
720 if (NT_SUCCESS(Status)) return TRUE;
721
722 /* If we got here, then we failed */
724 return FALSE;
725}
NTSTATUS NTAPI NtResetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:386

Referenced by AVISplitter_done_process(), AVISplitter_first_request(), AVISplitter_Flush(), BaseRendererImpl_EndFlush(), BaseRendererImpl_Pause(), BaseRendererImpl_Run(), child_process(), DeviceInstallThread(), DoEcho(), DoMainLoop(), DSoundRender_EndFlush(), DSoundRender_OnStartStreaming(), DSoundRender_Pause(), EventsQueue_GetEvent(), FileAsyncReader_EndFlush(), FileAsyncReader_WaitForNext(), fileTransfer(), GPNotificationThreadProc(), IDirectSoundCaptureBufferImpl_Stop(), init_bind_test(), init_test(), CRegWatcher::InitEvent(), ISynchronize_fnReset(), main(), MCIAVI_PlayAudioBlocks(), MCIQTZ_mciPlay(), MULTIMEDIA_PlaySound(), Netbios(), open_socket_request(), PauseEventThread(), 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_NtSuspendProcess(), test_open_url_async(), test_overlapped(), test_peek(), test_persistent_connection(), test_read_device(), test_readdirectorychanges(), test_readfileex_pending(), test_RegisterWaitForSingleObject(), test_signalandwait(), test_WaitForInputIdle(), test_WaitForMultipleObjects(), 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 733 of file synch.c.

734{
736
737 /* Set the event */
739 if (NT_SUCCESS(Status)) return TRUE;
740
741 /* If we got here, then we failed */
743 return FALSE;
744}
NTSTATUS NTAPI NtSetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:455

Referenced by FxIrp::_IrpSynchronousCompletion(), AcceptKillThread(), AcceptProc(), AdapterDiscoveryThread(), CIconWatcher::AddIconToWatcher(), ANIMATE_DoStop(), apartment_hostobject_thread(), apc_deadlock_thread(), async1(), async2(), async_notifier_proc(), async_proc(), AsyncInetStatusCallback(), 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(), ControlHandler(), 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(), DllMain(), 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(), header_cb(), hook_thread_proc(), host_object_proc(), IDirectPlaySPImpl_HandleMessage(), ImmGetContextThreadFunc(), implicit_mta_marshal_proc(), SEALED_::IMsTscAx::Connect(), init(), IntPortThread(), 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(), 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(), ProcessDeviceInstallEvent(), 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(), resolve_proc(), 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(), semaphore_thread_proc(), send_and_receive_proc(), send_msg_thread_2(), server_thread(), service_handler(), ServiceControlHandler(), ServiceHandler(), ServiceMain(), ServiceStop(), session_destroy(), set_foreground_thread(), SetSecurityServicesEvent(), SetShellReadyEvent(), SHLWAPI_ThreadWrapper(), show_cursor_thread(), ShutdownHandlerRoutine(), signaled_function(), simple_server(), smresult_thread_proc(), smresult_wndproc(), SoundThreadMain(), audio_wavein::start_recording(), START_TEST(), StartScreenSaver(), CFindFolder::StartSearch(), StartStopEnumEventsThread(), statusclb_OnDataAvailable(), statusclb_OnProgress(), statusclb_OnStopBinding(), StatusDialogProc(), CKsClockForwarder::Stop(), stop_dummy_thread(), CFindFolder::StopSearch(), sync_threads_and_run_one(), SystemClockAdviseThread(), telProcessConsole(), SEALED_::TerminateProtocolThread(), TerminateSoundThread(), Test1(), Test2(), Test3(), Test_Acquire(), test_async_read(), test_attach_input(), test_binding(), test_conn_close(), test_dde_default_app(), test_debug_children(), test_defwinproc(), test_delegated_methods(), test_http_protocol_url(), test_implicit_mta(), 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(), ThreadProc1(), ThreadProc2(), TIME_MMSysTimeCallback(), TIME_MMTimeStop(), TIME_SetEventInternal(), time_stamp_callback(), 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_for_completion(), 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}
unsigned char BOOLEAN
VOID(CALLBACK * PTIMER_APC_ROUTINE)(PVOID, ULONG, LONG)
Definition: winternl.h:2018
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:583

Referenced by GetNextJobTimeout(), InputWait(), main(), SEALED_::ProtocolLoop(), 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);
286 RtlActivateActivationContextUnsafeFast(&ActCtx, NULL);
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 */
320 if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx);
321
322 /* Return wait status */
323 return Status;
324}
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
static PLARGE_INTEGER Time
Definition: time.c:105
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
#define STATUS_ALERTED
Definition: ntstatus.h:80
NTSTATUS NTAPI NtSignalAndWaitForSingleObject(IN HANDLE ObjectHandleToSignal, IN HANDLE WaitableObjectHandle, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
Definition: obwait.c:473
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define WAIT_FAILED
Definition: winbase.h:439

Referenced by test_signalandwait().

◆ Sleep()

VOID WINAPI DECLSPEC_HOTPATCH Sleep ( IN DWORD  dwMilliseconds)

Definition at line 790 of file synch.c.

791{
792 /* Call the new API */
793 SleepEx(dwMilliseconds, FALSE);
794}
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802

Referenced by _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(), Window::DoAction(), doChild(), DoControlService(), DoStartService(), DoStopService(), DoStuff(), DoTestCaseA(), DoTestCaseB(), DoWaitForReaders(), DoWaitForWindow(), drain_socket_thread(), dummy_process(), EnableUserModePnpManager(), EnumJoysticks(), CThread::Execute(), exercizeServer(), force_redraw(), FreeUrlCacheSpaceW(), getnetconfigent(), GetWindowListForClose(), gl_cleanup(), gl_getpass(), Host_Sleep(), Imm32DelaySetLangBandProc(), InputWait(), IopAllocateIrpMustSucceed(), ITERATE_StartService(), JustDoIt(), 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(), ParseCmdAndExecute(), 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(), send_and_post_user_message_thread(), send_message_thread(), send_msg_delay_proc(), ServeSomeMessages(), 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(), StageThreadFunc(), Defragment::Start(), start_rpcss(), START_TEST(), stopService(), StorageImpl_LockRegionSync(), SystemClockPostMessageToAdviseThread(), test_AbortWaitCts(), Test_Acquire(), 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_condvars_base(), test_condvars_consumer_producer(), test_create_delete_svc(), test_dde(), TEST_End(), 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_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_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(), TestPrivMoveFileIdentityW(), TestProc(), testWaitForConsoleInput(), ThemeWaitForServiceReady(), thread(), thread_1(), thread_main1(), thread_main2(), thread_proc_0(), thread_proc_1(), thread_proc_2(), 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(), wait_for_window(), wait_idle_proc(), wait_move_event(), wait_release_cb(), WaitForForegroundWindow(), WaitForService(), WaitService(), WaitWindows(), watch_thread_proc(), WAVE_mciStop(), wave_out_test_deviceOut(), wined3d_pause(), WinMain(), WlanScan(), wmain(), work2_cb(), work_cb(), work_release_cb(), WorkerThread(), WSPCloseSocket(), CardRegion::ZoomCard(), and Defragment::~Defragment().

◆ SleepEx()

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

Definition at line 802 of file synch.c.

804{
806 PLARGE_INTEGER TimePtr;
807 NTSTATUS errCode;
808 RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx;
809
810 /* APCs must execute with the default activation context */
811 if (bAlertable)
812 {
813 /* Setup the frame */
814 RtlZeroMemory(&ActCtx, sizeof(ActCtx));
815 ActCtx.Size = sizeof(ActCtx);
817 RtlActivateActivationContextUnsafeFast(&ActCtx, NULL);
818 }
819
820 /* Convert the timeout */
821 TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds);
822 if (!TimePtr)
823 {
824 /* Turn an infinite wait into a really long wait */
825 Time.LowPart = 0;
826 Time.HighPart = 0x80000000;
827 TimePtr = &Time;
828 }
829
830 /* Loop the delay while APCs are alerting us */
831 do
832 {
833 /* Do the delay */
834 errCode = NtDelayExecution((BOOLEAN)bAlertable, TimePtr);
835 }
836 while ((bAlertable) && (errCode == STATUS_ALERTED));
837
838 /* Cleanup the activation context */
839 if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx);
840
841 /* Return the correct code */
842 return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0;
843}
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:876
#define STATUS_USER_APC
Definition: ntstatus.h:78
ULONG LowPart
Definition: typedefs.h:106
#define WAIT_IO_COMPLETION
Definition: winbase.h:437

Referenced by Beep(), DirectoryWatcherThreadFuncAPC(), 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(), thread_main1(), ThreadFunc1(), and ui_select().

◆ UnregisterWait()

BOOL WINAPI UnregisterWait ( IN HANDLE  WaitHandle)

Definition at line 934 of file synch.c.

935{
937
938 /* Check for invalid handle */
939 if (!WaitHandle)
940 {
941 /* Fail */
943 return FALSE;
944 }
945
946 /* Deregister the wait and check status */
947 Status = RtlDeregisterWaitEx(WaitHandle, NULL);
948 if (!(NT_SUCCESS(Status)) || (Status == STATUS_PENDING))
949 {
950 /* Failure or non-blocking call */
952 return FALSE;
953 }
954
955 /* All good */
956 return TRUE;
957}
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWaitEx(_In_ HANDLE hWaitHandle, _In_opt_ HANDLE hCompletionEvent)

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

◆ UnregisterWaitEx()

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

Definition at line 964 of file synch.c.

966{
968
969 /* Check for invalid handle */
970 if (!WaitHandle)
971 {
972 /* Fail */
974 return FALSE;
975 }
976
977 /* Deregister the wait and check status */
978 Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent);
979 if (!(NT_SUCCESS(Status)) ||
980 ((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING)))
981 {
982 /* Failure or non-blocking call */
984 return FALSE;
985 }
986
987 /* All good */
988 return TRUE;
989}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731

◆ 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);
190 RtlActivateActivationContextUnsafeFast(&ActCtx, NULL);
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 */
204 if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx);
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 */
258 if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx);
259
260 /* Return wait status */
261 return Status;
262}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG Handle
Definition: gdb_input.c:15
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
@ WaitAll
@ WaitAny
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
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 RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

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(), AdapterDiscoveryThread(), alarmThreadMain(), alertable_wait_apc2(), alertable_wait_thread(), ANIMATE_AnimationThread(), ANIMATE_DoStop(), apartment_hostobject_in_hostapt(), async1(), async2(), async_proc(), AsyncInetCleanUp(), AsyncInetDownload(), 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(), cleanReq(), client_start(), ClientRpcChannelBuffer_SendReceive(), clipboard_wnd_proc(), clnt_vc_destroy(), close_async_handle(), close_request(), CloseDevice(), CM_Add_Range(), CM_Dup_Range_List(), CM_First_Range(), CM_Free_Range_List(), CM_Next_Range(), CM_Test_Range_Available(), cmd_start(), CMP_WaitNoPendingInstallEvents(), collect_query_thread(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBGetCurrentPortUsage(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), CommandThreadProc(), CommonInstall(), ConSrvConsoleCtrlEventTimeout(), 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(), custom_client_thread(), custom_stop_server(), CDesktopThread::Destroy(), detectChange(), BtrfsVolPropSheet::DeviceDlgProc(), DeviceInstallThread(), disassociate2_cb(), disassociate3_cb(), disassociate_cb(), dispatch_rpc(), DispatcherThread(), dll_entry_point(), do_register_dll(), do_spawnT(), do_test(), do_wait_idle_child(), doChildren(), doDebugger(), DoEntry(), CWineTest::DoListCommand(), TMouse::doMouse(), DosShutdown(), DosStartProcess32(), DoTestEntry(), 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(), CicMutex::Enter(), CSafeMutex::Enter(), EnterCriticalPolicySection(), EnumEventsThread(), event_client(), EventsQueue_GetEvent(), RunOnceExEntry::Exec(), Execute(), execute_test(), exercizeServer(), expect_event(), FileCopyCallback(), FinishNotificationThread(), free_urlcache(), FreeUrlCacheSpaceW(), get_key_state_thread(), GetCharacterTimeout(), GetOverlappedResult(), GetPwrDiskSpindownRange(), GetSocketInformation(), TTelnetHandler::Go(), GUIDisplayStatusMessage(), handle_full_cache(), HandleLogoff(), HandleShutdown(), hooked_WaitForInputIdle(), HTTP_RetrieveEncodedObjectW(), IDirectSoundCaptureBufferImpl_Stop(), ifproxy_get_public_ref(), ifproxy_release_public_refs(), implicit_mta_marshal_proc(), INetCfgLock_fnAcquireWriteLock(), init(), InitializeStartupMutex(), InputWait(), install_wine_gecko(), InstallDevice(), instance_finalization_cb(), InternetReadFile_test(), InternetReadFileExA_test(), BtrfsContextMenu::InvokeCommand(), COutputPin::IoProcessRoutine(), is_signaled(), IsProcessRunning(), ITERATE_RemoveExistingProducts(), SEALED_::JoinProtocolThread(), JustDoIt(), launch_exe(), LauncherRoutine2(), LoadUserProfileW(), CardButton::Lock(), CardRegion::Lock(), Mutex::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(), CAutoComplete::OnAutoCompStart(), CardButton::OnLButtonDown(), CZipExtract::CExtractSettingsPage::OnWizardNext(), oob_client(), BtrfsPropSheet::open_as_admin(), open_read_test_request(), open_socket_request(), OpenMidiDevice(), OpenSharedMemory(), OutputDebugStringA(), OutputQueueImpl_ThreadProc(), BtrfsBalance::PauseBalance(), PdhCloseQuery(), PdhCollectQueryDataEx(), PipeSend(), audio_waveout::playing_procedure(), PlaySound_WaitDone(), post_rbuttonup_msg(), ProcessDeviceInstallEvent(), ProcessDlgProc(), ProcessPlayingNotes(), processRequest(), SEALED_::ProtocolLoop(), ProtocolSink_Switch(), PS2PortQueueRead(), PS2QueuePush(), PullPin_Disconnect(), PullPin_InitProcessing(), PullPin_PauseProcessing(), PullPin_Release(), PullPin_StartProcessing(), PullPin_StopProcessing(), PullPin_Thread_Main(), PullPin_WaitForStateChange(), QualityControlRender_WaitFor(), CPipe::Read(), read_file_test(), read_pipe(), read_reg_output_(), audio_wavein::recording_procedure(), RecursiveFind(), ReferenceClock_AdvisePeriodic(), ReferenceClock_AdviseTime(), release_host_object(), release_semaphore_thread(), report(), BtrfsVolPropSheet::ResetStats(), restart_as_admin_elevated(), 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_rapps(), run_reg_exe_(), run_regedit_exe_(), run_script_file(), run_server(), runcmd(), runCmd(), runProg(), runscriptfile(), RunSetupThreadProc(), RunTests(), s_stop(), ScmControlServiceEx(), ScmWaitForLsa(), ScmWaitForServiceConnect(), ScreenSaverPreview(), scrollkeys(), semaphore_thread_proc(), send_socket_request(), FxIrp::SendIrpSynchronously(), 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::ShowChangeDriveLetter(), 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_Acquire(), 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_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_DoInvalidDir(), 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_GetKeyState(), test_GetThreadExitCode(), test_GetThreadTimes(), Test_GradientCaptions(), test_handles(), test_http_connection(), test_http_protocol_url(), test_IInitializeSpy(), test_ImmDefaultHwnd(), test_ImmThreads(), test_ImpersonateNamedPipeClient(), test_implicit_mta(), 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_midiStream(), test_mixerOpen(), test_MultiThreadApartment(), test_multithreaded_clipboard(), test_mutant(), test_mutex(), test_no_content(), test_no_couninitialize_client(), test_no_couninitialize_server(), test_nonalertable(), test_NonExistentPath(), 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_set_clipboard_DRAWCLIPBOARD(), test_SetCursor(), test_SetFocus(), test_SetForegroundWindow(), test_shell_window(), test_ShowCursor(), test_signalandwait(), 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_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(), testCtrlHandler(), TestMultipleUserAPCs(), TestRead(), testWaitForConsoleInput(), TestWrite(), thread(), thread1(), thread2(), thread_proc(), CDownloadManager::ThreadFunc(), ThreadProc1(), ThreadProc2(), TIME_MMSysTimeThread(), TIME_MMTimeStop(), timeKillEvent(), UninitializeGPNotifications(), UnloadUserProfile(), UserClientShutdown(), VgaUpdateFramebuffer(), VideoRenderer_EndFlush(), VideoRendererInner_Release(), VMR9_SurfaceAllocator_TerminateDevice(), W32TmServiceMain(), CicEvent::Wait(), 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(), WshShell3_Run(), WSPAccept(), WSPBind(), WSPCloseSocket(), WSPConnect(), WSPEnumNetworkEvents(), WSPEventSelect(), WSPGetPeerName(), WSPGetSockName(), WSPListen(), WSPRecv(), WSPRecvFrom(), WSPSelect(), WSPSend(), WSPSendTo(), WSPShutdown(), WsSetupCatalogProtection(), wWinMain(), 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);
110 RtlActivateActivationContextUnsafeFast(&ActCtx, NULL);
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 */
140 if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx);
141
142 /* Return wait status */
143 return Status;
144}
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by __drv_when(), _tWinMain(), DirectoryWatcherThreadFuncAPC(), 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(), ThreadFunc2(), toggle_ctlLine(), WaitForSingleObject(), WaveThread(), WdmAudCommitWaveBufferByLegacy(), and WriteFileEx_Remixer().