[PATCH v8 3/4] ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics

Huw Davies huw at codeweavers.com
Tue Jun 11 05:36:14 CDT 2019


On Thu, Jun 06, 2019 at 05:17:45PM +0200, RĂ©mi Bernon wrote:
> --- a/dlls/ntdll/virtual.c
> +++ b/dlls/ntdll/virtual.c
> @@ -2461,19 +2461,17 @@ void virtual_set_large_address_space(void)
>  NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_bits,
>                                           SIZE_T *size_ptr, ULONG type, ULONG protect )
>  {
> -    void *base;
> -    unsigned int vprot;
>      SIZE_T size = *size_ptr;
> -    SIZE_T mask = get_mask( zero_bits );
>      NTSTATUS status = STATUS_SUCCESS;
> -    BOOL is_dos_memory = FALSE;
> -    struct file_view *view;
> -    sigset_t sigset;
>  
>      TRACE("%p %p %08lx %x %08x\n", process, *ret, size, type, protect );
>  
>      if (!size) return STATUS_INVALID_PARAMETER;
> -    if (!mask) return STATUS_INVALID_PARAMETER_3;
> +    if (zero_bits)
> +    {
> +        FIXME("Unimplemented zero_bits handling\n");
> +        return STATUS_INVALID_PARAMETER_3;

Could you move this test to within virtual_alloc_aligned()

This may end up causing regressions, e.g. in an app that asks for memory
with zero_bits != 0 but doesn't really need it.  We may want continue
to return a memory block rather than return an error.  At least in
this patch (which is really about refactoring the code) we probably
should do that (i.e. just print the FIXME and carry on).

Huw.



More information about the wine-devel mailing list