For React Native.
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/rtl.c | 27 +++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/ntddk.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index f4e2ed36710..d207237141a 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -968,7 +968,7 @@ @ stdcall RtlReAllocateHeap(long long ptr long) @ stub RtlReadMemoryStream @ stub RtlReadOutOfProcessMemoryStream -@ stub RtlRealPredecessor +@ stdcall RtlRealPredecessor(ptr) @ stub RtlRealSuccessor @ stub RtlRegisterSecureMemoryCacheCallback @ stdcall RtlRegisterWait(ptr ptr ptr ptr long long) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index e277e56be1b..bc3ee359161 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -274,6 +274,33 @@ RTL_SPLAY_LINKS * WINAPI RtlSubtreeSuccessor(RTL_SPLAY_LINKS *links) return child; }
+/****************************************************************************** + * RtlRealPredecessor [NTDLL.@] + */ +RTL_SPLAY_LINKS * WINAPI RtlRealPredecessor(RTL_SPLAY_LINKS *links) +{ + PRTL_SPLAY_LINKS child; + + TRACE("(%p)\n", links); + + child = RtlLeftChild(links); + if (child) + { + while (RtlRightChild(child)) + child = RtlRightChild(child); + return child; + } + + child = links; + while (RtlIsLeftChild(child)) + child = RtlParent(child); + + if (RtlIsRightChild(child)) + return RtlParent(child); + + return NULL; +} + /****************************************************************************** * RtlInitializeGenericTable [NTDLL.@] */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 2ba1dc88eeb..2a908a35398 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1240,7 +1240,7 @@ @ stdcall RtlRaiseStatus(long) @ stdcall RtlRandom(ptr) @ stdcall RtlRandomEx(ptr) -@ stub RtlRealPredecessor +@ stdcall RtlRealPredecessor(ptr) @ stub RtlRealSuccessor @ stub RtlRemoveUnicodePrefix @ stub RtlReserveChunk diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index 334266d6e1d..110779f6169 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -313,6 +313,7 @@ void WINAPI RtlMapGenericMask(ACCESS_MASK*,const GENERIC_MAPPING*); ULONG WINAPI RtlNumberGenericTableElements(PRTL_GENERIC_TABLE); ULONG WINAPI RtlNumberGenericTableElementsAvl(PRTL_AVL_TABLE); BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); +PRTL_SPLAY_LINKS WINAPI RtlRealPredecessor(PRTL_SPLAY_LINKS); PRTL_SPLAY_LINKS WINAPI RtlSubtreePredecessor(PRTL_SPLAY_LINKS); PRTL_SPLAY_LINKS WINAPI RtlSubtreeSuccessor(PRTL_SPLAY_LINKS); NTSTATUS WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/tests/rtl.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index ae430256855..b2e2052a2d4 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -117,6 +117,7 @@ static DWORD (WINAPI *pRtlConvertDeviceFamilyInfoToString)(DWORD *, DWORD *, static NTSTATUS (WINAPI *pRtlInitializeNtUserPfn)( const UINT64 *client_procsA, ULONG procsA_size, const UINT64 *client_procsW, ULONG procsW_size, const void *client_workers, ULONG workers_size ); +static PRTL_SPLAY_LINKS (WINAPI *pRtlRealPredecessor)(PRTL_SPLAY_LINKS); static NTSTATUS (WINAPI *pRtlRetrieveNtUserPfn)( const UINT64 **client_procsA, const UINT64 **client_procsW, const UINT64 **client_workers ); @@ -171,6 +172,7 @@ static void InitFunctionPtrs(void) pRtlRbRemoveNode = (void *)GetProcAddress(hntdll, "RtlRbRemoveNode"); pRtlConvertDeviceFamilyInfoToString = (void *)GetProcAddress(hntdll, "RtlConvertDeviceFamilyInfoToString"); pRtlInitializeNtUserPfn = (void *)GetProcAddress(hntdll, "RtlInitializeNtUserPfn"); + pRtlRealPredecessor = (void *)GetProcAddress(hntdll, "RtlRealPredecessor"); pRtlRetrieveNtUserPfn = (void *)GetProcAddress(hntdll, "RtlRetrieveNtUserPfn"); pRtlResetNtUserPfn = (void *)GetProcAddress(hntdll, "RtlResetNtUserPfn"); pRtlSubtreePredecessor = (void *)GetProcAddress(hntdll, "RtlSubtreePredecessor"); @@ -4177,6 +4179,46 @@ static void test_RtlSubtreeSuccessor(void) } }
+static void test_RtlRealPredecessor(void) +{ + /* 3 + * / \ + * 1 5 + * / \ / \ + * 0 2 4 6 + */ + static const struct splay_index splay_indices[] = + { + {3, 1, 5}, + {1, 0, 2}, + {5, 4, 6}, + }; + static const int expected_predecessors[] = {-1, 0, 1, 2, 3, 4, 5}; + RTL_SPLAY_LINKS links[7], *predecessor; + unsigned int i; + + if (!pRtlRealPredecessor) + { + win_skip("RtlRealPredecessor is unavailable.\n"); + return; + } + + init_splay_indices(links, ARRAY_SIZE(links), splay_indices, ARRAY_SIZE(splay_indices)); + for (i = 0; i < ARRAY_SIZE(expected_predecessors); i++) + { + winetest_push_context("%d", i); + + predecessor = pRtlRealPredecessor(&links[i]); + if (expected_predecessors[i] == -1) + ok(!predecessor, "Expected NULL, got unexpected %d.\n", (int)(predecessor - links)); + else + ok(predecessor == &links[expected_predecessors[i]], "Expected %d, got unexpected %d.\n", + expected_predecessors[i], (int)(predecessor ? predecessor - links : -1)); + + winetest_pop_context(); + } +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -4231,4 +4273,5 @@ START_TEST(rtl) test_user_procs(); test_RtlSubtreePredecessor(); test_RtlSubtreeSuccessor(); + test_RtlRealPredecessor(); }
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/rtl.c | 27 +++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/ntddk.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d207237141a..b4d9b6969f8 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -969,7 +969,7 @@ @ stub RtlReadMemoryStream @ stub RtlReadOutOfProcessMemoryStream @ stdcall RtlRealPredecessor(ptr) -@ stub RtlRealSuccessor +@ stdcall RtlRealSuccessor(ptr) @ stub RtlRegisterSecureMemoryCacheCallback @ stdcall RtlRegisterWait(ptr ptr ptr ptr long long) @ stdcall RtlReleaseActivationContext(ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index bc3ee359161..575579a551e 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -301,6 +301,33 @@ RTL_SPLAY_LINKS * WINAPI RtlRealPredecessor(RTL_SPLAY_LINKS *links) return NULL; }
+/****************************************************************************** + * RtlRealSuccessor [NTDLL.@] + */ +RTL_SPLAY_LINKS * WINAPI RtlRealSuccessor(RTL_SPLAY_LINKS *links) +{ + PRTL_SPLAY_LINKS child; + + TRACE("(%p)\n", links); + + child = RtlRightChild(links); + if (child) + { + while (RtlLeftChild(child)) + child = RtlLeftChild(child); + return child; + } + + child = links; + while (RtlIsRightChild(child)) + child = RtlParent(child); + + if (RtlIsLeftChild(child)) + return RtlParent(child); + + return NULL; +} + /****************************************************************************** * RtlInitializeGenericTable [NTDLL.@] */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 2a908a35398..46f11cc951b 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1241,7 +1241,7 @@ @ stdcall RtlRandom(ptr) @ stdcall RtlRandomEx(ptr) @ stdcall RtlRealPredecessor(ptr) -@ stub RtlRealSuccessor +@ stdcall RtlRealSuccessor(ptr) @ stub RtlRemoveUnicodePrefix @ stub RtlReserveChunk @ cdecl -arch=!i386 RtlRestoreContext(ptr ptr) diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index 110779f6169..a7c0b1e44b5 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -314,6 +314,7 @@ ULONG WINAPI RtlNumberGenericTableElements(PRTL_GENERIC_TABLE); ULONG WINAPI RtlNumberGenericTableElementsAvl(PRTL_AVL_TABLE); BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); PRTL_SPLAY_LINKS WINAPI RtlRealPredecessor(PRTL_SPLAY_LINKS); +PRTL_SPLAY_LINKS WINAPI RtlRealSuccessor(PRTL_SPLAY_LINKS); PRTL_SPLAY_LINKS WINAPI RtlSubtreePredecessor(PRTL_SPLAY_LINKS); PRTL_SPLAY_LINKS WINAPI RtlSubtreeSuccessor(PRTL_SPLAY_LINKS); NTSTATUS WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/tests/rtl.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index b2e2052a2d4..9abe0d2e9cc 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -118,6 +118,7 @@ static NTSTATUS (WINAPI *pRtlInitializeNtUserPfn)( const UINT64 *client_procsA, const UINT64 *client_procsW, ULONG procsW_size, const void *client_workers, ULONG workers_size ); static PRTL_SPLAY_LINKS (WINAPI *pRtlRealPredecessor)(PRTL_SPLAY_LINKS); +static PRTL_SPLAY_LINKS (WINAPI *pRtlRealSuccessor)(PRTL_SPLAY_LINKS); static NTSTATUS (WINAPI *pRtlRetrieveNtUserPfn)( const UINT64 **client_procsA, const UINT64 **client_procsW, const UINT64 **client_workers ); @@ -173,6 +174,7 @@ static void InitFunctionPtrs(void) pRtlConvertDeviceFamilyInfoToString = (void *)GetProcAddress(hntdll, "RtlConvertDeviceFamilyInfoToString"); pRtlInitializeNtUserPfn = (void *)GetProcAddress(hntdll, "RtlInitializeNtUserPfn"); pRtlRealPredecessor = (void *)GetProcAddress(hntdll, "RtlRealPredecessor"); + pRtlRealSuccessor = (void *)GetProcAddress(hntdll, "RtlRealSuccessor"); pRtlRetrieveNtUserPfn = (void *)GetProcAddress(hntdll, "RtlRetrieveNtUserPfn"); pRtlResetNtUserPfn = (void *)GetProcAddress(hntdll, "RtlResetNtUserPfn"); pRtlSubtreePredecessor = (void *)GetProcAddress(hntdll, "RtlSubtreePredecessor"); @@ -4219,6 +4221,46 @@ static void test_RtlRealPredecessor(void) } }
+static void test_RtlRealSuccessor(void) +{ + /* 3 + * / \ + * 1 5 + * / \ / \ + * 0 2 4 6 + */ + static const struct splay_index splay_indices[] = + { + {3, 1, 5}, + {1, 0, 2}, + {5, 4, 6}, + }; + static const int expected_successors[] = {1, 2, 3, 4, 5, 6, -1}; + RTL_SPLAY_LINKS links[7], *successor; + unsigned int i; + + if (!pRtlRealSuccessor) + { + win_skip("RtlRealSuccessor is unavailable.\n"); + return; + } + + init_splay_indices(links, ARRAY_SIZE(links), splay_indices, ARRAY_SIZE(splay_indices)); + for (i = 0; i < ARRAY_SIZE(expected_successors); i++) + { + winetest_push_context("%d", i); + + successor = pRtlRealSuccessor(&links[i]); + if (expected_successors[i] == -1) + ok(!successor, "Expected NULL, got unexpected %d.\n", (int)(successor - links)); + else + ok(successor == &links[expected_successors[i]], "Expected %d, got unexpected %d.\n", + expected_successors[i], (int)(successor ? successor - links : -1)); + + winetest_pop_context(); + } +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -4274,4 +4316,5 @@ START_TEST(rtl) test_RtlSubtreePredecessor(); test_RtlSubtreeSuccessor(); test_RtlRealPredecessor(); + test_RtlRealSuccessor(); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151022
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000007500F0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got hook 0x0005 instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got winevent_hook 0x0003 instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x030f instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x001c instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x0086 instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x0006 instead msg.c:6995: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got hook 0x0009 instead