Andrew Wesie
64d70b103d
ntdll: Add NtQueryVirtualMemory(MemoryWorkingSetExInformation).
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45667
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-07 13:25:37 +01:00
Dmitry Timoshkov
bbd73667d7
ntdll: Split logic for MemoryBasicInformation into a separate function.
...
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-07 13:14:07 +01:00
Rémi Bernon
5eca6ffa8b
ntdll: Start find_free_area from address_space_start instead of 0.
...
The search was initiated with base == 0, which returns NULL immediately
if MEM_TOP_DOWN is not used. Use address_space_start instead.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47974
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-27 11:11:19 +01:00
Rémi Bernon
1a44ef3237
ntdll: Replace incorrect find_free_reserved_area function call.
...
This introduces map_free_area function which tries mapping the expected
free areas until it finds one that succeeds. It now also works for
memory regions outside of the reserved region, but could probably be
improved.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-27 11:11:16 +01:00
Rémi Bernon
cec83fede4
ntdll: Split view search initialization to find_view_inside_range function.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-27 11:11:08 +01:00
Rémi Bernon
d840d7852b
ntdll: Rename find_free_area to find_reserved_free_area.
...
We used this function to find free areas outside of the reserved range,
and it's obviously incorrect as there can be some system or external
memory mapping we don't know about.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-27 11:03:19 +01:00
Paul Gofman
923e62eb55
ntdll: Add DECLSPEC_HOTPATCH to NtProtectVirtualMemory().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48077
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-04 16:57:13 +01:00
Alexandre Julliard
5b1fc81908
ntdll: Hardcode address space limits for ARM platforms.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-28 21:07:53 +01:00
Alexandre Julliard
87d9fef2ae
ntdll: Take stack guarantee into account when handling stack overflows.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-26 12:04:25 +02:00
Rémi Bernon
8a765533d6
ntdll: Implement zero_bits parameter in virtual alloc functions.
...
Use alloc_area.limit field to limit the search in reserved areas to the
desired memory range, or call find_free_area to get a pointer to a free
memory region which matches the zero_bits constraint, then mmap it with
MAP_FIXED flag.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:29:45 +02:00
Rémi Bernon
6672fc9d85
ntdll: Use custom internal zero_bits_64 parameter format.
...
The zero_bits parameter can be a pointer mask on Win64 and WoW64 and it
was incorrectly truncated to 16bits in APCs. Testing shows that only the
leading zeroes are used in the mask, so we can safely use the 64 based
number of leading zeroes everywhere instead.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:29:45 +02:00
Rémi Bernon
d1a7b681ea
ntdll: Change zero_bits parameter type to ULONG_PTR for NtMapViewOfSection and NtAllocateVirtualMemory.
...
It can be a pointer mask, eventually 64bit, and ULONG_PTR is what can be
found in several documentation of these functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:15 +02:00
Rémi Bernon
1aa963efd7
ntdll: Add alloc_type parameter to virtual_map_section and top_down to map_image.
...
NtMapViewOfSection also accepts the MEM_TOP_DOWN parameter that can
be used in combination with zero_bits to map memory on the highest
possible address.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 12:11:02 +02:00
Rémi Bernon
4c750a35c3
ntdll: Pass the alignment parameter down to map_view instead of mask.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:32:42 +02:00
Rémi Bernon
be48a56e70
ntdll: Clarify NtMapViewOfSection zero_bits parameter semantics.
...
See 00451d5edf
.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 22:32:42 +02:00
Zebediah Figura
90c3b78bec
ntdll: Implement RtlCreateUserStack() and RtlFreeUserStack().
...
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-17 20:50:10 +02:00
Rémi Bernon
00451d5edf
ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics.
...
This parameter was misinterpreted as an alignment parameter for the
lower bits of the allocated memory region, although it is a constraint
on the higher bits.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-13 20:55:35 +02:00
Alexandre Julliard
546fa12755
server: Add flag for builtin dlls in the image information.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-22 11:34:25 +02:00
Andrew Eikum
12be24af8c
ntdll: Fix memory region check in NtQueryVirtualMemory.
...
Patch by buggy@ifel.se .
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45218
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-27 22:04:01 +01:00
Michael Stefaniuc
244c15fe7b
ntdll: Remove redundant not-NULL check (coccinellery).
...
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-22 12:27:16 +01:00
Gijs Vermeulen
d2d52717af
ntdll: Validate len in NtQueryVirtualMemory.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45632
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-18 16:03:59 +01:00
Alexandre Julliard
f244c3b5eb
server: Add custom flag for fake dlls in PE image information.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-11 12:30:37 +01:00
Sebastian Lackner
a0ab2a7b0c
loader: Implement preloader for macOS.
...
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 11:10:09 +01:00
Alexandre Julliard
c998667bf0
ntdll: Also return the SECTION_IMAGE_INFORMATION data from RtlCreateUserProcess().
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-24 16:58:08 +02:00
Michael Stefaniuc
10f23ddb58
ntdll: Use the ARRAY_SIZE() macro.
...
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-14 10:15:59 +02:00
Michael Müller
556ba38dd1
ntdll: Fix error code when querying too large memory address.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-28 17:24:36 +01:00
Sebastian Lackner
5c2523c6f3
ntdll: Don't fail in NtUnmapViewOfSection when trying to unmap builtin view.
...
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-23 15:54:45 +01:00
Alexandre Julliard
5d088206d2
ntdll: Use the image information data when mapping an image file.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-15 12:23:23 +01:00
Alexandre Julliard
1e036633e8
include: Add definitions for SECTION_IMAGE_INFORMATION flags.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-13 20:23:26 +01:00
Alexandre Julliard
b1f8a91e6c
ntdll: Use MAP_SHARED also for read-only mappings.
...
This essentially reverts commit dac252ecb4
.
It's necessary for macOS.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-06 14:28:10 +01:00
Alexandre Julliard
60e6331520
ntdll: Move file mapping functionality to a helper function.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-30 15:10:23 +01:00
Alexandre Julliard
41275cbabf
ntdll: Don't return 64-bit image info to 32-bit processes.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-30 10:59:12 +01:00
Alexandre Julliard
d108ff79d5
ntdll: NtQuerySection takes SIZE_T parameters.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-28 13:06:43 +01:00
Alexandre Julliard
6fe15e6c41
ntdll: Round the pthread stack size to a page boundary.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-26 10:14:38 +01:00
Alexandre Julliard
dac252ecb4
ntdll: Only require MAP_SHARED for writable mappings.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-12 15:15:02 +01:00
Alexandre Julliard
b526a48a24
ntdll: Pass the stack pointer to virtual_clear_thread_stack().
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-04 15:03:55 +01:00
Alexandre Julliard
f8e0bd1b0d
ntdll: Put the initial pthread stack at the end of the Win32 stack.
...
Create a separate view for it so that the main stack can be freed
independently.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 10:44:21 +01:00
Alexandre Julliard
03993b456c
ntdll: Also check for EACCES to detect noexec failures.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-17 12:02:16 +01:00
Alexandre Julliard
2e364d25cc
ntdll: Fall back to read() on noexec filesystems also for non-image mappings.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-17 12:02:16 +01:00
Alexandre Julliard
42b79375d3
ntdll: Fall back to read() earlier on noexec filesystems.
...
This avoid running into problems setting permissions later on.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-16 21:48:44 +01:00
Sebastian Lackner
959d240cbe
ntdll: Avoid crash when trying to access page prot of address beyond address space limit.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-16 14:14:01 +01:00
Alexandre Julliard
49d3cac9ce
ntdll: Don't try to unmap system views on the server side.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-09 10:45:10 +02:00
Alexandre Julliard
0374d86c57
ntdll: Ignore the preload start address if it is zero.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-09 10:45:10 +02:00
Alexandre Julliard
dc203dd833
ws2_32: Lock the user output buffer during receives.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-03 13:38:29 +02:00
Alexandre Julliard
a27f187503
ntdll: Support loading binaries that start inside the DOS area.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-27 09:30:05 +02:00
Alexandre Julliard
5fa8713ddc
ntdll: No longer store the mapping handle with the view.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-26 17:01:45 +02:00
Alexandre Julliard
aa90910e93
server: Implement NtAreMappedFilesTheSame functionality on the server side.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-26 17:01:45 +02:00
Alexandre Julliard
26314a56d3
server: Access the list of committed ranges directly from the mapped view.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-26 17:01:44 +02:00
Alexandre Julliard
a557934c76
server: Keep track of mapped memory views.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-26 17:01:44 +02:00
Alexandre Julliard
51d348c8c2
ntdll: Add helpers to lock the user output buffer during file reads.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-22 15:10:42 +02:00