Commit graph

4137 commits

Author SHA1 Message Date
Brendan Shanks 3bcda5aefa kernel32/tests: Test GetFileType() with additional types of handles. 2023-01-19 19:16:41 +01:00
Eric Pouech 8aeca16ca5 kernel32/tests: Filter spurious thread creation debug events.
On windows, we get some test failures as un-expected thread
create debug events are sent.
Try to filter them out in a couple of places.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-18 22:55:19 +01:00
Eric Pouech 982472d895 kernel32/tests: Merge two debug event loops in test_debugger().
Current test in debugger expects that all breakpoint debug
events appear before all the exit thread events.
On Windows, it happens that sometimes the breakpoint and exit
thread events are intertwined (making the test fail).

So, this patch:
- merges the exception events loop and the exit thread events loop
  into a single loop.
- detects the unordered sequence (mark it broken as windows only)
- extends the test so that we check that all exit thread events
  are received.
- introduce next_event_filter helper to not return some unwanted
  events.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47874
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-18 22:55:19 +01:00
Eric Pouech ce083b37f9 kernel32/tests: Extend share right for debugger's black box tests.
Trying to improve upon previous attempt: 2486f5a002

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53456
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-17 20:20:04 +01:00
Alexandre Julliard 448e68ab5b kernelbase: Fix FindNLSStringEx for strings with no primary weights.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53583
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53837
2023-01-09 16:44:08 +01:00
André Zwing e39c09f5c1 kernel32/tests: Don't test function directly when reporting GetLastError(). 2023-01-06 13:39:44 +01:00
Eric Pouech f5a81ff02a kernel32/tests: Silence a failing test on Win10+.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-20 22:37:02 +01:00
Eric Pouech 26699b3630 kernel32/tests: Test that control characters can be read & stored.
WriteConsole (not in processed mode) and WriteConsoleOutput* functions
allow to write control characters, which can then be read back as is.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-20 22:37:02 +01:00
Eric Pouech 17e5ff7430 kernel32/tests: Handle some variations in process start debug events.
Win10 and Win11 can have some variations in debug events order
(linked to when thread start debug event are generated).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54159
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-16 18:50:52 +01:00
Eric Pouech 2486f5a002 kernel32/tests: Improve loading of debugger's test children results.
Even if there's a synchronisation mechanism between kernel32:debugger
and its children which ensures that child has finished writing to and
closed the blackbox logging file before reading it, there's no
guarantee that the file is not re-opened by another process: antivirus,
file indexing...
And according to [1], even the OS itself can still have opened references
to it.

So, always open/read the blackbox file in read share mode to work around
this issue.

Also, harden the code for potential errors, and be nicer in where
failures come from.

[1] https://learn.microsoft.com/en-us/windows-hardware/drivers/ifs/irp-mj-cleanup

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53456
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-16 18:50:50 +01:00
Eric Pouech 2acacb83d1 kernel32/tests: Fix failing debugger test on Win7.
Investigating the test failures in MR!1823, it turns out
that sometimes in Win7, at process exit, not all the dll unload
debug events are sent (in traces, only the last loaded dll gets the
event).
I don't know what it only shows now :-(, but that seems very
replicable (it happens every time with new job to TestBot).

So mark the case of missing unload dll debug event as broken
(still checking that the load dll debug event has been received).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-12-16 18:50:43 +01:00
Eric Pouech 6e19585112 kernel32/tests: Fix a debugger test failing on Windows.
Testing: kernel32:debugger, there's sometimes the following error:
debugger.c:1760: Test failed: unexpected instruction pointer 778B2A0C

Current test code has a workaround when this happens on last thread, but
this is clearly not sufficient.

Fix the test so that it grabs the thread context only in a place we're
sure it's in stopped state at breakpoint instruction.
(Current code likely catches cases where the thread is in bp signal
handling).

Rewrote the test to be in more logical order.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53143
2022-12-15 22:29:19 +01:00
Alexandre Julliard b771d417d8 kernel32/tests: Fix a string comparison test in utf-8 locales.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52964
2022-12-13 14:31:06 +01:00
Alexandre Julliard e2b8fad779 kernel32/tests: Consistently use %I printf format for ULONG_PTR values. 2022-12-09 17:52:25 +01:00
Francois Gouget 508b793ec9 kernel32/tests: Avoid failures when processes start during the process test.
On Windows processes sometimes start during test_services_exe() so that
the size returned by the first NtQuerySystemInformation() is no longer
sufficient for the second call.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54094
2022-12-08 18:12:51 +01:00
Alexandre Julliard 620089aade kernel32/tests: Fix an uninitialized variable warning. 2022-12-08 18:12:18 +01:00
Alex Henrie 85bf404018 kernel32/tests: Use the strcasecmp function instead of reimplementing it. 2022-12-06 17:04:50 +01:00
Rémi Bernon 54b37a3702 kernel32/tests: Avoid releasing invalid path pointer. 2022-12-02 11:04:45 +01:00
Rémi Bernon 4979ae5a94 kernelbase: Restore HEAP_REALLOC_IN_PLACE_ONLY usage in LocalReAlloc.
This effectively reverts 2be9b0ff4a, which
incorrectly removed the flag, when the reallocation failures the tests
showed were coming from an underlying LFH in-place reallocation failure.

Thus, it restores todo_wine where appropriate while removing other todos
for sizes outside of the LFH block size range.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53996
2022-11-30 20:38:27 +01:00
Rémi Bernon a568704c32 kernel32/tests: Add more GlobalReAlloc tests with larger size.
In place reallocation is possible, although it depends on the underlying
heap strategy. The LFH heap usually fails as it doesn't blocks to grow
or shrink out of their size class. Larger block (LFH is limited to 16K
blocks), more often allow in-place reallocation, and some native DLLs
depend on this.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53996
2022-11-30 20:38:27 +01:00
Rémi Bernon b793367c67 kernel32/tests: Make sure the LFH is enabled for some sizes.
Making the GlobalReAlloc tests more sensible, as they fail to reallocate
when the block was allocated with the LFH and the new size wouldn't.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54012
2022-11-30 20:38:27 +01:00
Nikolay Sivov 8d9eb707c6 kernel32/profile: Trim spaces from section names on load.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53814
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2022-11-24 09:27:48 +01:00
Alexandre Julliard b00a831d3d kernel32/tests: Don't filter out the WINELOADER variable. 2022-11-23 11:07:30 +01:00
Nikolay Sivov 9c09288bf6 kernel32/tests: Remove workarounds for SetThreadIdealProcessor().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2022-11-22 18:40:13 +01:00
Rémi Bernon 03ad947420 kernelbase: Only discard HLOCAL with LMEM_MOVEABLE and if not locked.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon 28bc3b0703 kernel32: Return success from GlobalReAlloc with locked HGLOBAL pointer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon f43fc5121b kernelbase: Avoid moving locked HLOCAL pointer without LMEM_MOVEABLE.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon c2c6536926 kernelbase: Handle LMEM_DISCARDABLE flag specifically in LocalReAlloc.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon 86d09091e6 kernelbase: Handle LMEM_MODIFY flag first in LocalReAlloc.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon 2be9b0ff4a kernelbase: Don't try in-place HeapReAlloc in LocalReAlloc.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Rémi Bernon 170e046480 kernel32/tests: Add more (Global|Local)ReAlloc tests.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
2022-11-22 18:27:31 +01:00
Santino Mazza d5385c7177 kernelbase: Implement GetGeoInfoEx. 2022-11-22 18:27:30 +01:00
Santino Mazza 52ffd338fa kernel32/tests: Test for GetGeoInfoEx. 2022-11-22 18:27:30 +01:00
Santino Mazza f51c752c43 kernelbase: Create GetGeoInfoEx stub. 2022-11-22 18:27:30 +01:00
Alex Henrie 318d02723c kernel32/tests: Avoid using GCC's typeof extension. 2022-11-22 18:27:30 +01:00
Nikolay Sivov ce91ef6426 kernelbase: Add SetProcessInformation().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53954
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2022-11-21 13:09:41 +01:00
Santino Mazza 2581d48e5f kernel32: Forward MapViewOfFileFromApp kernel32 to kernelbase. 2022-11-16 21:24:19 +01:00
Santino Mazza 663e533e7e kernel32: Forward CreateFileMappingFromApp kernel32 to kernelbase. 2022-11-16 21:24:19 +01:00
Rémi Bernon c7eb844ce0 kernel32: Lock heap and validate pointer in LocalHandle. 2022-11-15 18:05:07 +01:00
Rémi Bernon d918919de0 kernel32: Validate pointer before calling HeapSize. 2022-11-15 18:05:07 +01:00
Eric Pouech 1addbe3e1d kernel32/tests: Fix sporadic process test failure.
Current test tries to ensure that a handle, valid in process parent,
hasn't been inherited, but nothing guarantees that a valid handle
isn't present in child process with same value.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-14 13:13:02 +01:00
Rémi Bernon fe3c5e93e2 ntdll: Implement RtlSetUserFlagsHeap.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
2022-11-10 22:00:35 +01:00
Rémi Bernon bba4fa0fbb ntdll: Check block user flags in RtlGetUserInfoHeap.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
2022-11-10 22:00:35 +01:00
Rémi Bernon 0f6e908405 ntdll: Check block user flags in RtlSetUserValueHeap.
Adding the same user flags as native, for Global/Local allocs, and
returning the pointer from Global/LocalHandle by default.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
2022-11-10 22:00:35 +01:00
Rémi Bernon d99e9da90e kernel32/tests: Test (Global|Local)Handle with heap allocated pointers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
2022-11-10 22:00:35 +01:00
Rémi Bernon 5c928bc0ef kernel32/tests: Test more Global/Local functions with invalid pointers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
2022-11-10 22:00:35 +01:00
Evan Tang f181e25a47 kernel32: Null-terminate the atom names passed to NtAddAtom.
Adobe Reader XI patches NtAddAtom() and expects the name to be null-terminated

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53872
2022-11-04 19:23:55 +01:00
Brendan Shanks 0d21e1cbcf server: Only require THREAD_SET_LIMITED_INFORMATION access to set thread description. 2022-10-31 12:13:32 +01:00
Eric Pouech 35c65edcb9 kernel32/tests: Workaround some broken Windows behavior in console tests.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48105
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-26 15:03:05 +02:00
Jinoh Kang ea9c9fe5bd kernel32/tests: Add test for pipe name with a trailing backslash. 2022-10-26 15:03:05 +02:00