Commit graph

4206 commits

Author SHA1 Message Date
Paul Gofman c77642ec52 ntdll: Match Windows used block filling.
Test rewritten by Rémi Bernon.
2023-07-27 13:12:06 +09:00
Alexandre Julliard 708d13b035 kernel32/tests: Use nameless unions/structs. 2023-07-20 21:48:39 +02:00
Sven Baars 9559959f95 kernel32/tests: Update a todo that succeeds with the new wow64 architecture. 2023-07-12 10:55:10 +02:00
Alexandre Julliard ef6055c164 kernel32/tests: Avoid sizeof() in traces. 2023-07-06 20:54:30 +02:00
Zhiyi Zhang 884cff8214 kernelbase: Check if locale is NULL before using it in Internal_EnumDateFormats().
Initialize the calendars variable after checking if locale is NULL before using it to avoid NULL
pointer references. Fix a Excel 2016 crash when formatting dates with the custom format 'ddd'.
It calls EnumDateFormatsExEx() with the 'yi-Hebr' locale, which is added in Win10.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55099
2023-06-30 20:24:42 +02:00
Jacek Caban dcf0bf1f38 ntdll: Inherit ConsoleHandle only by CUI processes. 2023-06-26 15:04:26 +02:00
Eric Pouech 766448f8ff kernel32/tests: Extend console inheritance tests.
- Define what the std handles are before inheriting them
- Check access to parent console from child through std handles

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-13 22:10:56 +02:00
Alexandre Julliard 2f3c8be54f kernel32/tests: Fix the PROCESS_BASIC_INFORMATION exit status type. 2023-06-13 22:10:56 +02:00
Alexandre Julliard 0d4f20ca18 kernel32: Use nameless unions/structs. 2023-06-06 21:09:32 +02:00
Jinoh Kang d0d472bb3e ntdll: Don't hard-code DLL manifest resource ID when looking up dependency assembly.
This allows any manifest resource IDs (e.g.,
ISOLATIONAWARE_MANIFEST_RESOURCE_ID) to be recognized when looking up
the assembly manifest of a dependency.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18889
2023-05-29 19:46:33 +02:00
Jinoh Kang 2f78a8f2bb kernel32/tests: Test loading assembly manifest resource inside dependencies. 2023-05-29 19:46:33 +02:00
Jinoh Kang d992e2d0aa ntdll: Move ACTCTX lpResourceName validation to RtlCreateActivationContext.
This prevents passing NULL resource name to get_manifest_in_module().
2023-05-29 19:46:32 +02:00
Jinoh Kang b9507d0e5f kernel32/tests: Test setting lpResourceName to NULL for CreateActCtxW. 2023-05-29 19:46:32 +02:00
Jinoh Kang f0fcce14a7 kernel32/tests: Remove test for ACTCTX_FLAG_HMODULE_VALID with hModule = NULL case.
Today, the test scenario "ACTCTX_FLAG_HMODULE_VALID but hModule if not
set" is broken and unreliable.  This problem is not evident in WineHQ
batch test runs; rather, the test failure seems to only be triggered
when the kernel32:actctx test is run in isolation.

When the flag ACTCTX_FLAG_HMODULE_VALID is specified in ACTCTXW but
hModule is set to NULL, CreateActCtxW() may encounter different failure
modes depending on the test executable file.  Error codes observed so
far include ERROR_SXS_CANT_GEN_ACTCTX and ERROR_SXS_MANIFEST_TOO_BIG.

When the aforementioned test reports ERROR_SXS_CANT_GEN_ACTCTX on
Windows, an event is recorded in the Windows Event Log as follows:

- Log Name:    Application
- Source:      SideBySide
- Event ID:    59
- Level:       Error
- Description:

  Activation context generation failed for "<path..>\kernel32_test.exe".Error in manifest or policy file "<path..>\kernel32_test.exe" on line 0.
  Invalid Xml syntax.

It appears that the inconsistent failure was caused by Windows trying to
interpret the main executable file of the current process as an XML
manifest file.  This fails due to one or more of the following reasons:

- ERROR_SXS_CANT_GEN_ACTCTX: A valid PE executable that starts with the
  "MZ" signature is not a valid XML file.

- ERROR_SXS_MANIFEST_TOO_BIG (or ERROR_NOT_ENOUGH_MEMORY): The
  executable's size may exceed the limit imposed by the manifest parser.
  This is much more likely for binaries with debugging symbols.

  Meanwhile, winetest.exe bundles a stripped version of the test
  executable (kernel32_test-stripped.exe), which is often smaller than
  the original executable (not stripped).  This probably explains why
  the problem was not visible in batch test runs.

Fix this by removing the failing test entirely.
2023-05-29 19:46:30 +02:00
Eric Pouech 2d4742aa93 kernel32/tests: Harden some wow64 module tests.
Showing some cases where loader should unredirect some
module paths from syswow64 to system32.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-05-18 09:09:14 -05:00
Paul Gofman 354a8bb1f4 ntdll: Better match Windows subheap sizes. 2023-05-15 06:09:54 -05:00
Paul Gofman 76fc73f311 kernel32/tests: Add tests for subheap sizes. 2023-05-15 06:09:54 -05:00
Paul Gofman 0fc9a9e426 ntdll: Fix tail padding in mark_block_tail(). 2023-05-15 06:09:54 -05:00
Francois Gouget ab3503bf5c kernel32/tests: Use win_skip() for missing APIs. 2023-05-11 22:53:14 +02:00
Alexandre Julliard 483a2203eb kernelbase: Move Wow64EnableWow64FsRedirection() from kernel32 to kernelbase.
Following recent Windows versions.
2023-05-11 22:53:14 +02:00
Etaash Mathamsetty bd89ab3040 kernelbase: Add GetPackagesByPackageFamily stub. 2023-05-03 22:10:46 +02:00
Alex Henrie 7af7ff872b ntdll: Increment offset by len in build_clr_surrogate_section.
Instead of multiplying it by 2.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54808
Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-23 15:49:48 +02:00
Alex Henrie bd7459579d kernel32/tests: Check that lpSectionBase != NULL before dereferencing.
If lpSectionBase is null then the tests will still crash, but at least
we'll know why.
2023-04-23 15:49:46 +02:00
Alexandre Julliard bddfa07190 kernel32: Move to a higher address on 64-bit. 2023-04-22 17:34:32 +02:00
Francois Gouget 4d3eb56e7c kernel32/tests: Fix the ScrollConsoleScreenBuffer() tests on Windows 10 1909.
On Windows 10 1909 ScrollConsoleScreenBufferA() returns an error if
the destination is not within the clip rectangle but still modifies the
console buffer as expected! So mark this behavior as very_broken().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54871
2023-04-20 22:55:56 +02:00
Jinoh Kang 3268601dae kernelbase: Implement activation context switching for fibers. 2023-04-19 20:26:15 +02:00
Jinoh Kang f7315ebe5b kernel32/tests: Test for activation context switching between fibers. 2023-04-19 20:26:15 +02:00
Tatsuyuki Ishi a612ab6f2a ntdll: Use log-linear bucketing for free lists.
Currently, the free list consists of a "small list" for sizes below 256,
which are linearly spaced, and a "large list" which is manually split
into a few chunks.

This patch replaces it with a single log-linear policy, while expanding
the range the large list covers.

The old implementation had issues when a lot of large allocations
happened. In this case, all the allocations went in the last catch-all
bucket in the "large list", and what happens is:
1. The linked list grew in size over time, causing searching cost to
   skyrocket.
2. With the first-fit allocation policy, fragmentation was also making
   the problem worse.

The new bucketing covers the entire range up until we start allocating
large blocks, which will not enter the free list. It also makes the
allocation policy closer to best-fit (although not exactly), reducing
fragmentation.

The increase in number of free lists does incur some cost when it needs
to be skipped over, but the improvement in allocation performance
outweighs it.

For future work, these ideas (mostly from glibc) might or might not
benefit performance:
- Use an exact best-fit allocation policy.
- Add a bitmap for freelist, allowing empty lists to be skipped with a
  single bit scan.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
2023-04-12 12:03:51 +02:00
Francois Gouget 11934d2c92 kernel32/tests: Improve the WideCharToMultiByte() null-termination and truncation tests.
Check the content of the output buffer in addition to checking the
return value.
Also show that multibyte characters are not truncated when the output
buffer is too small.
2023-04-07 18:00:58 +02:00
Eric Pouech 8ad9ddaa28 kernel32/tests: Workaround broken behavior in Win7 Pro64.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-04-05 15:25:05 +02:00
Eric Pouech b7225671fd kernel32/debugger: Fix a failing test (on Wine).
The failing test was garbled by remaining debug events from previous test.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-04-04 21:20:38 +02:00
Hugh McMaster d350af2455 kernel32/tests: Test GetConsoleOriginalTitleW() with an empty title. 2023-04-03 16:52:01 +02:00
Hugh McMaster 30f1c1be74 kernelbase: Implement GetConsoleOriginalTitleA(). 2023-04-03 16:52:01 +02:00
Hugh McMaster 887aa70e08 kernelbase: Implement GetConsoleOriginalTitleW(). 2023-04-03 16:52:01 +02:00
Hugh McMaster b1dc5a533b kernel32/tests: Check return length of GetConsoleOriginalTitleA/W(). 2023-04-03 16:52:01 +02:00
Etaash Mathamsetty 2a069e4a91 kernel32: Add semi-stub for RemoveDirectoryTransactedA/W(). 2023-03-31 19:10:38 +02:00
Etaash Mathamsetty 121ab8bf83 kernel32: Add semi-stub for GetFileAttributesTransactedA/W(). 2023-03-31 19:10:38 +02:00
Etaash Mathamsetty e89ee645b3 kernel32: Add semi-stub for FindFirstFileTransactedA/W(). 2023-03-31 19:10:38 +02:00
Etaash Mathamsetty 4de32bc980 kernel32: Add semi-stub for DeleteFileTransactedA/W(). 2023-03-31 19:10:38 +02:00
Etaash Mathamsetty 960526dad1 kernel32: Add semi-stub for CreateDirectoryTransactedA/W(). 2023-03-31 19:10:38 +02:00
Etaash Mathamsetty dc938571d6 kernel32: Add semi-stub for CreateFileTransactedA/W(). 2023-03-31 19:10:38 +02:00
Eric Pouech d203beb5e5 kernel32/tests: Extend the tests for load/unload debug events on Wow64.
Showing that:
- load events for 64bit DLLs are generated for a WOW64 process.
- unload events for 64bit DLLs are not generated for a WOW64 process
  (as any other unload event on process teardown).
- a 32bit startup exception is generated as well (with a specific exception
  code)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-22 20:03:51 +01:00
Alexandre Julliard ccd9640493 kernelbase: Use RtlGetNativeSystemInformation() to implement GetNativeSystemInfo(). 2023-03-22 20:03:51 +01:00
Alexandre Julliard 687068e7d6 include: Declare some missing ntdll functions, and fix the sorting. 2023-03-22 20:03:51 +01:00
Jinoh Kang bc854efd7c ntdll: Open application manifest files with FILE_SHARE_DELETE.
Today, RtlCreateActivationContext (CreateActCtxW) opens the source
manifest file via NtOpenFile without the FILE_SHARE_DELETE sharing mode.

This causes CreateActCtxW to fail if the source manifest file was
created with the FILE_DELETE_ON_CLOSE flag.  FILE_DELETE_ON_CLOSE is
often used for temporary files that should be automatically deleted
after use, even if the creator process crashes.

Fix this by specifying FILE_SHARE_DELETE for sharing mode when opening
the source manifest or module file.  This allows the source manifest or
module file to be marked as deleted while it is open.

Note that concurrent deletion is not an issue for the following reasons:

- The ability to read from an open file handle is unaffected by deletion
  of the corresponding file's name.

- RtlCreateActivationContext does not open the source manifest or module
  file by the given filename (lpSource) more than once.
2023-03-20 17:11:10 +01:00
Jinoh Kang 6cabfcc187 kernel32/tests: Test for manifest file open share mode in CreateActCtxW. 2023-03-20 17:11:10 +01:00
Evan Tang a7b49b0e86 kernel32/tests: Fix tls callback tests on Windows 7.
Also add a few more so the full set of callbacks is tested.

Fixes: 2203a8564c
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54657
2023-03-13 10:42:10 +01:00
Evan Tang a8fa80cfb4 ntdll/tests: Move TlsIndex test to kernel32:loader.
Gets us access to a dll with tls to verify.
2023-03-09 18:42:45 +01:00
Evan Tang 2203a8564c kernel32/tests: Add test verifying that tls init functions are called. 2023-03-09 18:41:40 +01:00
Gabriel Ivăncescu 606e0c191e kernel32: Fix GetCurrencyFormatA when input length is 0.
Fixes a regression introduced by 42afb693b1.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2023-03-08 20:05:14 +01:00