Commit b1c3c8c8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32: Added InitOnceInitialize() implementation.

parent 77ad893a
......@@ -747,6 +747,7 @@
@ stdcall InitializeCriticalSectionAndSpinCount(ptr long)
@ stdcall InitializeCriticalSectionEx(ptr long long)
@ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead
@ stdcall InitOnceInitialize(ptr) ntdll.RtlRunOnceInitialize
@ stdcall -arch=i386 InterlockedCompareExchange (ptr long long)
@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr int64 int64) ntdll.RtlInterlockedCompareExchange64
@ stdcall -arch=i386 InterlockedDecrement(ptr)
......
......@@ -37,6 +37,7 @@ static BOOL (WINAPI *pDeleteTimerQueueTimer)(HANDLE, HANDLE, HANDLE);
static HANDLE (WINAPI *pOpenWaitableTimerA)(DWORD,BOOL,LPCSTR);
static HANDLE (WINAPI *pCreateMemoryResourceNotification)(MEMORY_RESOURCE_NOTIFICATION_TYPE);
static BOOL (WINAPI *pQueryMemoryResourceNotification)(HANDLE, PBOOL);
static VOID (WINAPI *pInitOnceInitialize)(PINIT_ONCE);
static void test_signalandwait(void)
{
......@@ -1135,6 +1136,21 @@ static void test_WaitForMultipleObjects(void)
if (maxevents[i]) CloseHandle(maxevents[i]);
}
static void test_initonce(void)
{
INIT_ONCE initonce;
if (!pInitOnceInitialize)
{
win_skip("one-time initialization API not supported\n");
return;
}
initonce.Ptr = (void*)0xdeadbeef;
pInitOnceInitialize(&initonce);
ok(initonce.Ptr == NULL, "got %p\n", initonce.Ptr);
}
START_TEST(sync)
{
HMODULE hdll = GetModuleHandle("kernel32");
......@@ -1147,6 +1163,7 @@ START_TEST(sync)
pOpenWaitableTimerA = (void*)GetProcAddress(hdll, "OpenWaitableTimerA");
pCreateMemoryResourceNotification = (void *)GetProcAddress(hdll, "CreateMemoryResourceNotification");
pQueryMemoryResourceNotification = (void *)GetProcAddress(hdll, "QueryMemoryResourceNotification");
pInitOnceInitialize = (void *)GetProcAddress(hdll, "InitOnceInitialize");
test_signalandwait();
test_mutex();
......@@ -1158,4 +1175,5 @@ START_TEST(sync)
test_timer_queue();
test_WaitForSingleObject();
test_WaitForMultipleObjects();
test_initonce();
}
......@@ -815,6 +815,7 @@
@ stub RtlRevertMemoryStream
@ stub RtlRunDecodeUnicodeString
@ stub RtlRunEncodeUnicodeString
@ stdcall RtlRunOnceInitialize(ptr)
@ stdcall RtlSecondsSince1970ToTime(long ptr)
@ stdcall RtlSecondsSince1980ToTime(long ptr)
# @ stub RtlSeekMemoryStream
......
......@@ -1463,3 +1463,8 @@ NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
SERVER_END_REQ;
return status;
}
VOID NTAPI RtlRunOnceInitialize(PRTL_RUN_ONCE initonce)
{
initonce->Ptr = NULL;
}
......@@ -1316,6 +1316,12 @@ typedef struct _WIN32_STREAM_ID {
#define LOGON_NETCREDENTIALS_ONLY 0x00000002
#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000
/* one-time initialisation API */
typedef RTL_RUN_ONCE INIT_ONCE;
typedef PRTL_RUN_ONCE PINIT_ONCE;
typedef PRTL_RUN_ONCE LPINIT_ONCE;
#define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT
WINBASEAPI BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR *);
WINADVAPI BOOL WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
WINADVAPI BOOL WINAPI AddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
......@@ -1876,6 +1882,7 @@ WINADVAPI BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,
WINADVAPI BOOL WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER);
WINBASEAPI VOID WINAPI InitializeSRWLock(PSRWLOCK);
WINBASEAPI VOID WINAPI InitOnceInitialize(PINIT_ONCE);
WINBASEAPI PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER);
WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER);
WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
......
......@@ -5087,6 +5087,13 @@ typedef struct _RTL_SRWLOCK {
typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
typedef VOID (NTAPI * PFLS_CALLBACK_FUNCTION) ( PVOID );
#define RTL_RUN_ONCE_INIT {0}
typedef union _RTL_RUN_ONCE {
PVOID Ptr;
} RTL_RUN_ONCE, *PRTL_RUN_ONCE;
NTSYSAPI VOID NTAPI RtlRunOnceInitialize(PRTL_RUN_ONCE);
#include <pshpack8.h>
typedef struct _IO_COUNTERS {
ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment