ReactOS 0.4.15-dev-6679-g945ee4b
synch.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Win32 Base API
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/kernel32/client/synch.c
5 * PURPOSE: Wrappers for the NT Wait Implementation
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES *****************************************************************/
10#include <k32.h>
11
12#define NDEBUG
13#include <debug.h>
14
15#undef InterlockedIncrement
16#undef InterlockedDecrement
17#undef InterlockedExchange
18#undef InterlockedExchangeAdd
19#undef InterlockedCompareExchange
20
21/* FUNCTIONS *****************************************************************/
22
23/*
24 * @implemented
25 */
26LONG
28InterlockedIncrement(IN OUT LONG volatile *lpAddend)
29{
30 return _InterlockedIncrement(lpAddend);
31}
32
33/*
34 * @implemented
35 */
36LONG
38InterlockedDecrement(IN OUT LONG volatile *lpAddend)
39{
40 return _InterlockedDecrement(lpAddend);
41}
42
43/*
44 * @implemented
45 */
46LONG
50{
52}
53
54/*
55 * @implemented
56 */
57LONG
61{
63}
64
65/*
66 * @implemented
67 */
68LONG
71 IN LONG Exchange,
72 IN LONG Comperand)
73{
74 return _InterlockedCompareExchange(Destination, Exchange, Comperand);
75}
76
77/*
78 * @implemented
79 */
83 IN DWORD dwMilliseconds)
84{
85 /* Call the extended API */
86 return WaitForSingleObjectEx(hHandle, dwMilliseconds, FALSE);
87}
88
89/*
90 * @implemented
91 */
95 IN DWORD dwMilliseconds,
96 IN BOOL bAlertable)
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}
145
146/*
147 * @implemented
148 */
149DWORD
150WINAPI
152 IN CONST HANDLE *lpHandles,
153 IN BOOL bWaitAll,
154 IN DWORD dwMilliseconds)
155{
156 /* Call the extended API */
157 return WaitForMultipleObjectsEx(nCount,
158 lpHandles,
159 bWaitAll,
160 dwMilliseconds,
161 FALSE);
162}
163
164/*
165 * @implemented
166 */
167DWORD
168WINAPI
170 IN CONST HANDLE *lpHandles,
171 IN BOOL bWaitAll,
172 IN DWORD dwMilliseconds,
173 IN BOOL bAlertable)
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}
263
264/*
265 * @implemented
266 */
267DWORD
268WINAPI
270 IN HANDLE hObjectToWaitOn,
271 IN DWORD dwMilliseconds,
272 IN BOOL bAlertable)
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}
325
326/*
327 * @implemented
328 */
329HANDLE
330WINAPI
332 IN BOOL bManualReset,
333 IN LPCWSTR lpTimerName OPTIONAL)
334{
336 lpTimerAttributes,
337 lpTimerName,
338 bManualReset ? NotificationTimer : SynchronizationTimer);
339}
340
341/*
342 * @implemented
343 */
344HANDLE
345WINAPI
347 IN BOOL bManualReset,
348 IN LPCSTR lpTimerName OPTIONAL)
349{
350 ConvertWin32AnsiObjectApiToUnicodeApi(WaitableTimer, lpTimerName, lpTimerAttributes, bManualReset);
351}
352
353/*
354 * @implemented
355 */
356HANDLE
357WINAPI
360 IN LPCWSTR lpTimerName)
361{
362 OpenNtObjectFromWin32Api(Timer, dwDesiredAccess, bInheritHandle, lpTimerName);
363}
364
365/*
366 * @implemented
367 */
368HANDLE
369WINAPI
372 IN LPCSTR lpTimerName)
373{
375}
376
377/*
378 * @implemented
379 */
380BOOL
381WINAPI
383 IN const LARGE_INTEGER *pDueTime,
384 IN LONG lPeriod,
385 IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL,
386 IN OPTIONAL LPVOID lpArgToCompletionRoutine,
387 IN BOOL fResume)
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}
405
406/*
407 * @implemented
408 */
409BOOL
410WINAPI
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}
423
424/*
425 * @implemented
426 */
427HANDLE
428WINAPI
431 IN LONG lInitialCount,
432 IN LONG lMaximumCount,
434{
435 ConvertWin32AnsiObjectApiToUnicodeApi(Semaphore, lpName, lpSemaphoreAttributes, lInitialCount, lMaximumCount);
436}
437
438/*
439 * @implemented
440 */
441HANDLE
442WINAPI
445 IN LONG lInitialCount,
446 IN LONG lMaximumCount,
448{
450 lpSemaphoreAttributes,
451 lpName,
452 lInitialCount,
453 lMaximumCount);
454}
455
456HANDLE
457WINAPI
460 IN LONG lInitialCount,
461 IN LONG lMaximumCount,
464 IN DWORD dwDesiredAccess OPTIONAL)
465{
466 CreateNtObjectFromWin32Api(Semaphore, Semaphore, dwDesiredAccess,
467 lpSemaphoreAttributes,
468 lpName,
469 lInitialCount,
470 lMaximumCount);
471}
472
473HANDLE
474WINAPI
477 IN LONG lInitialCount,
478 IN LONG lMaximumCount,
481 IN DWORD dwDesiredAccess OPTIONAL)
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}
509
510/*
511 * @implemented
512 */
513HANDLE
514WINAPI
516OpenSemaphoreA(IN DWORD dwDesiredAccess,
519{
521}
522
523/*
524 * @implemented
525 */
526HANDLE
527WINAPI
529OpenSemaphoreW(IN DWORD dwDesiredAccess,
532{
533 OpenNtObjectFromWin32Api(Semaphore, dwDesiredAccess, bInheritHandle, lpName);
534}
535
536/*
537 * @implemented
538 */
539BOOL
540WINAPI
543 IN LONG lReleaseCount,
544 IN LPLONG lpPreviousCount)
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}
556
557/*
558 * @implemented
559 */
560HANDLE
561WINAPI
564 IN BOOL bInitialOwner,
566{
567 ConvertWin32AnsiObjectApiToUnicodeApi(Mutex, lpName, lpMutexAttributes, bInitialOwner);
568}
569
570/*
571 * @implemented
572 */
573HANDLE
574WINAPI
577 IN BOOL bInitialOwner,
579{
581 lpMutexAttributes,
582 lpName,
583 bInitialOwner);
584}
585
586/*
587 * @implemented
588 */
589HANDLE
590WINAPI
592OpenMutexA(IN DWORD dwDesiredAccess,
595{
597}
598
599/*
600 * @implemented
601 */
602HANDLE
603WINAPI
605OpenMutexW(IN DWORD dwDesiredAccess,
608{
609 OpenNtObjectFromWin32Api(Mutant, dwDesiredAccess, bInheritHandle, lpName);
610}
611
612/*
613 * @implemented
614 */
615BOOL
616WINAPI
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}
630
631/*
632 * @implemented
633 */
634HANDLE
635WINAPI
638 IN BOOL bManualReset,
639 IN BOOL bInitialState,
641{
642 ConvertWin32AnsiObjectApiToUnicodeApi(Event, lpName, lpEventAttributes, bManualReset, bInitialState);
643}
644
645/*
646 * @implemented
647 */
648HANDLE
649WINAPI
652 IN BOOL bManualReset,
653 IN BOOL bInitialState,
655{
657 lpEventAttributes,
658 lpName,
660 bInitialState);
661}
662
663/*
664 * @implemented
665 */
666HANDLE
667WINAPI
669OpenEventA(IN DWORD dwDesiredAccess,
672{
674}
675
676/*
677 * @implemented
678 */
679HANDLE
680WINAPI
682OpenEventW(IN DWORD dwDesiredAccess,
685{
687}
688
689/*
690 * @implemented
691 */
692BOOL
693WINAPI
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}
707
708/*
709 * @implemented
710 */
711BOOL
712WINAPI
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}
726
727/*
728 * @implemented
729 */
730BOOL
731WINAPI
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}
745
746/*
747 * @implemented
748 */
749VOID
750WINAPI
752{
754
755 /* Initialize the critical section and raise an exception if we failed */
756 Status = RtlInitializeCriticalSection((PVOID)lpCriticalSection);
758}
759
760/*
761 * @implemented
762 */
763BOOL
764WINAPI
766 IN DWORD dwSpinCount)
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}
783
784/*
785 * @implemented
786 */
787VOID
788WINAPI
790Sleep(IN DWORD dwMilliseconds)
791{
792 /* Call the new API */
793 SleepEx(dwMilliseconds, FALSE);
794}
795
796
797/*
798 * @implemented
799 */
800DWORD
801WINAPI
802SleepEx(IN DWORD dwMilliseconds,
803 IN BOOL bAlertable)
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);
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 */
840
841 /* Return the correct code */
842 return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0;
843}
844
845/*
846 * @implemented
847 */
848BOOL
849WINAPI
851 IN HANDLE hObject,
854 IN ULONG dwMilliseconds,
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}
886
887/*
888 * @implemented
889 */
890HANDLE
891WINAPI
895 IN ULONG dwMilliseconds,
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}
928
929/*
930 * @implemented
931 */
932BOOL
933WINAPI
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}
958
959/*
960 * @implemented
961 */
962BOOL
963WINAPI
965 IN HANDLE CompletionEvent)
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}
990
991/* EOF */
unsigned char BOOLEAN
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:243
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedExchange
Definition: armddk.h:54
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name,...)
Definition: base_x.h:54
#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name)
Definition: base_x.h:86
#define ConvertAnsiToUnicodeEpilogue
Definition: base_x.h:42
#define CreateNtObjectFromWin32Api(obj, ntobj, access, sec, name,...)
Definition: base_x.h:135
#define ConvertAnsiToUnicodeBody(name)
Definition: base_x.h:38
#define ConvertAnsiToUnicodePrologue
Definition: base_x.h:33
#define OpenNtObjectFromWin32Api(ntobj, acc, inh, name)
Definition: base_x.h:143
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
Definition: Mutex.h:16
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#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:32
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
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
PLARGE_INTEGER WINAPI BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, IN DWORD dwMilliseconds)
Definition: utils.c:288
IN OUT PLONG Addend
Definition: CrNtStubs.h:25
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
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
VOID(CALLBACK * PTIMER_APC_ROUTINE)(PVOID, ULONG, LONG)
Definition: winternl.h:2018
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define InterlockedCompareExchange
Definition: interlocked.h:104
long __cdecl _InterlockedExchangeAdd(_Interlocked_operand_ long volatile *_Addend, long _Value)
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
long __cdecl _InterlockedCompareExchange(_Interlocked_operand_ long volatile *_Destination, long _Exchange, long _Comparand)
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
HANDLE hMutex
Definition: mutex.c:11
static HANDLE hEvent
Definition: comm.c:54
static WAITORTIMERCALLBACK
Definition: thread.c:81
static BOOL bInheritHandle
Definition: pipe.c:82
static PLARGE_INTEGER Time
Definition: time.c:105
NTSTATUS NTAPI NtReleaseMutant(IN HANDLE MutantHandle, IN PLONG PreviousCount OPTIONAL)
Definition: mutant.c:296
#define TIMER_ALL_ACCESS
Definition: extypes.h:116
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSectionAndSpinCount(_In_ PRTL_CRITICAL_SECTION CriticalSection, _In_ ULONG SpinCount)
NTSYSAPI NTSTATUS NTAPI RtlRegisterWait(_In_ PHANDLE phNewWaitObject, _In_ HANDLE hObject, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID pvContext, _In_ ULONG ulMilliseconds, _In_ ULONG ulFlags)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3004
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
NTSYSAPI NTSTATUS NTAPI RtlDeregisterWaitEx(_In_ HANDLE hWaitHandle, _In_opt_ HANDLE hCompletionEvent)
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
HANDLE WaitableTimer
Definition: notevil.c:39
NTSTATUS NTAPI NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval)
Definition: wait.c:876
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
@ NotificationEvent
@ SynchronizationEvent
@ WaitAll
@ WaitAny
@ SynchronizationTimer
@ NotificationTimer
NTSTATUS NTAPI NtPulseEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:244
NTSTATUS NTAPI NtSetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:455
NTSTATUS NTAPI NtResetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
Definition: event.c:386
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
NTSTATUS NTAPI NtCancelTimer(IN HANDLE TimerHandle, OUT PBOOLEAN CurrentState OPTIONAL)
Definition: timer.c:252
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_ALERTED
Definition: ntstatus.h:80
#define STATUS_USER_APC
Definition: ntstatus.h:78
#define STATUS_PENDING
Definition: ntstatus.h:82
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
NTSTATUS NTAPI NtSignalAndWaitForSingleObject(IN HANDLE ObjectHandleToSignal, IN HANDLE WaitableObjectHandle, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
Definition: obwait.c:473
#define CONST
Definition: pedump.c:81
long LONG
Definition: pedump.c:60
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define IsConsoleHandle(h)
Definition: console.h:14
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5934
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:6011
NTSTATUS NTAPI NtReleaseSemaphore(IN HANDLE SemaphoreHandle, IN LONG ReleaseCount, OUT PLONG PreviousCount OPTIONAL)
Definition: sem.c:295
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
BOOL WINAPI UnregisterWaitEx(IN HANDLE WaitHandle, IN HANDLE CompletionEvent)
Definition: synch.c:964
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: synch.c:476
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:682
HANDLE WINAPI OpenWaitableTimerW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpTimerName)
Definition: synch.c:358
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
BOOL WINAPI InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount)
Definition: synch.c:765
HANDLE WINAPI CreateWaitableTimerA(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, IN BOOL bManualReset, IN LPCSTR lpTimerName OPTIONAL)
Definition: synch.c:346
BOOL WINAPI DECLSPEC_HOTPATCH PulseEvent(IN HANDLE hEvent)
Definition: synch.c:695
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:430
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: synch.c:382
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:637
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:592
HANDLE WINAPI CreateWaitableTimerW(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, IN BOOL bManualReset, IN LPCWSTR lpTimerName OPTIONAL)
Definition: synch.c:331
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:563
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:605
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:669
BOOL WINAPI CancelWaitableTimer(IN HANDLE hTimer)
Definition: synch.c:411
HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:529
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
HANDLE WINAPI RegisterWaitForSingleObjectEx(IN HANDLE hObject, IN WAITORTIMERCALLBACK Callback, IN PVOID Context, IN ULONG dwMilliseconds, IN ULONG dwFlags)
Definition: synch.c:892
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:444
DWORD WINAPI WaitForMultipleObjectsEx(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:169
DWORD WINAPI SignalObjectAndWait(IN HANDLE hObjectToSignal, IN HANDLE hObjectToWaitOn, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:269
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542
HANDLE WINAPI DECLSPEC_HOTPATCH OpenSemaphoreA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:516
BOOL WINAPI RegisterWaitForSingleObject(OUT PHANDLE phNewWaitObject, IN HANDLE hObject, IN WAITORTIMERCALLBACK Callback, IN PVOID Context, IN ULONG dwMilliseconds, IN ULONG dwFlags)
Definition: synch.c:850
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
HANDLE WINAPI OpenWaitableTimerA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpTimerName)
Definition: synch.c:370
BOOL WINAPI UnregisterWait(IN HANDLE WaitHandle)
Definition: synch.c:934
int32_t * LPLONG
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
ULONG LowPart
Definition: typedefs.h:106
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_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
#define WAIT_IO_COMPLETION
Definition: winbase.h:411
#define MUTEX_ALL_ACCESS
Definition: winbase.h:158
_In_ LPCSTR lpName
Definition: winbase.h:2779
#define SEMAPHORE_ALL_ACCESS
Definition: winbase.h:160
#define WAIT_FAILED
Definition: winbase.h:413
void(CALLBACK * PTIMERAPCROUTINE)(PVOID, DWORD, DWORD)
Definition: winbase.h:1443
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define WINAPI
Definition: msvc.h:6
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185