https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7497f028f4adaef0eb26abe6206c07396efe8bde
commit 7497f028f4adaef0eb26abe6206c07396efe8bde Author: Timo Kreuzer <timo.kreu...@reactos.org> AuthorDate: Fri Sep 8 11:51:41 2023 +0300 Commit: Timo Kreuzer <timo.kreu...@reactos.org> CommitDate: Sun Sep 10 14:58:54 2023 +0300 [KERNEL32_APITEST] Improve InitOnce test --- modules/rostests/apitests/kernel32/InitOnce.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/rostests/apitests/kernel32/InitOnce.c b/modules/rostests/apitests/kernel32/InitOnce.c index 66014197f96..1d20dc445a2 100644 --- a/modules/rostests/apitests/kernel32/InitOnce.c +++ b/modules/rostests/apitests/kernel32/InitOnce.c @@ -154,6 +154,7 @@ _test_sync: /* Re-initialize One-Time initialization structure by using INIT_ONCE_STATIC_INIT */ InitOnce = (INIT_ONCE)INIT_ONCE_STATIC_INIT; + ulContextData = 0xdeadbeef; /* Perform synchronous initialization by using InitOnceBeginInitialize */ fPending = FALSE; @@ -169,6 +170,16 @@ _test_sync: goto _test_async; } + /* Call again to check whether initialization has completed */ + fPending = 0xdeadbeef; + bRet = pfnInitOnceBeginInitialize(&InitOnce, + INIT_ONCE_CHECK_ONLY, + &fPending, + (LPVOID*)&ulContextData); + ok(bRet == FALSE, "InitOnceBeginInitialize should fail\n"); + ok(fPending == 0xdeadbeef, "fPending should be unmodified\n"); + ok(ulContextData == 0xdeadbeef, "ulContextData should be unmodified\n"); + /* Complete the initialization */ InitWorker(&ulInitCount, &ulTempContext); bRet = pfnInitOnceComplete(&InitOnce, 0, (LPVOID)ulTempContext);