https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b5bb194b0d2ce7dd5ff0…
commit 6b5bb194b0d2ce7dd5ff03dc093e415daeaa4da0
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri May 31 20:23:30 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri May 31 20:23:30 2019 +0900
[KERNEL32_APITEST] dynamic linked RtlIsCriticalSectionLockedByThread (#1592)
Statically linked ntdll.RtlIsCriticalSectionLockedByThread had made kernel32_apitest
unable to run in XP. CORE-16077
---
modules/rostests/apitests/kernel32/FLS.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/apitests/kernel32/FLS.c
b/modules/rostests/apitests/kernel32/FLS.c
index 3d40df76086..712a87403e8 100644
--- a/modules/rostests/apitests/kernel32/FLS.c
+++ b/modules/rostests/apitests/kernel32/FLS.c
@@ -14,6 +14,7 @@ static DWORD (WINAPI *pFlsAlloc)(PFLS_CALLBACK_FUNCTION);
static BOOL (WINAPI *pFlsFree)(DWORD);
static PVOID (WINAPI *pFlsGetValue)(DWORD);
static BOOL (WINAPI *pFlsSetValue)(DWORD,PVOID);
+static BOOL (WINAPI *pRtlIsCriticalSectionLockedByThread)(RTL_CRITICAL_SECTION *);
#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
@@ -46,7 +47,7 @@ VOID WINAPI FlsCallback3(PVOID lpFlsData)
ok(lpFlsData == g_FlsData3, "Expected g_FlsData3(%p), got %p\n",
g_FlsData3, lpFlsData);
if (g_WinVersion <= WINVER_2003)
- ok(RtlIsCriticalSectionLockedByThread(NtCurrentPeb()->FastPebLock),
"Expected lock on PEB\n");
+ ok(pRtlIsCriticalSectionLockedByThread(NtCurrentPeb()->FastPebLock),
"Expected lock on PEB\n");
InterlockedIncrement(&g_FlsCalled3);
if (g_FlsExcept3)
{
@@ -118,6 +119,7 @@ void ok_fls_(DWORD dwIndex, PVOID pValue, PFLS_CALLBACK_FUNCTION
lpCallback)
static VOID init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
+ HMODULE hNTDLL = GetModuleHandleA("ntdll.dll");
#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f);
X(FlsAlloc);
@@ -125,6 +127,7 @@ static VOID init_funcs(void)
X(FlsGetValue);
X(FlsSetValue);
#undef X
+ pRtlIsCriticalSectionLockedByThread = (void*)GetProcAddress(hNTDLL,
"RtlIsCriticalSectionLockedByThread");
}
@@ -141,6 +144,11 @@ START_TEST(FLS)
skip("Fls functions not available\n");
return;
}
+ if (!pRtlIsCriticalSectionLockedByThread)
+ {
+ skip("RtlIsCriticalSectionLockedByThread function not available\n");
+ return;
+ }
RtlGetVersion(&rtlinfo);
g_WinVersion = (rtlinfo.dwMajorVersion << 8) | rtlinfo.dwMinorVersion;
@@ -222,7 +230,7 @@ START_TEST(FLS)
dwErr = 0xdeaddead;
}
_SEH2_END;
- ok(RtlIsCriticalSectionLockedByThread(NtCurrentPeb()->FastPebLock) == FALSE,
"Expected no lock on PEB\n");
+ ok(pRtlIsCriticalSectionLockedByThread(NtCurrentPeb()->FastPebLock) == FALSE,
"Expected no lock on PEB\n");
ok(bRet == 12345, "FlsFree(%lu) should have failed, got %u\n", dwIndex3,
bRet);
ok(dwErr == 0xdeaddead, "Expected GetLastError() to be 0xdeaddead, was
%lx\n", dwErr);