[PATCH v11 1/2] ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics

Huw Davies huw at codeweavers.com
Wed Jun 12 06:44:31 CDT 2019


On Wed, Jun 12, 2019 at 01:05:44PM +0200, Rémi Bernon wrote:
> On Wed, 2019-06-12 at 11:59 +0100, Huw Davies wrote:
> > On Wed, Jun 12, 2019 at 10:59:44AM +0200, Rémi Bernon wrote:
> > > +/*****************************************************************
> > > ******
> > > + *             virtual_alloc_aligned   (NTDLL.@)
> > > + *
> > > + * Same as NtAllocateVirtualMemory but with an alignment parameter
> > > + */
> > > +NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits,
> > > SIZE_T *size_ptr,
> > > +                                ULONG type, ULONG protect, ULONG
> > > alignment )
> > > +{
> > > +    void *base;
> > > +    unsigned int vprot;
> > > +    SIZE_T size = *size_ptr;
> > > +    SIZE_T mask = get_mask( alignment );
> > > +    NTSTATUS status = STATUS_SUCCESS;
> > > +    BOOL is_dos_memory = FALSE;
> > > +    struct file_view *view;
> > > +    sigset_t sigset;
> > > +
> > > +    if (zero_bits)
> > > +    {
> > > +        FIXME("Unimplemented zero_bits parameter value\n");
> > > +    }
> > > +
> > 
> > Actually let's put this in map_view() since that is supposed to
> > handle
> > this.  Obviously this patch needs to be extended to also include
> > passing zero_bits to that function.
> > 
> > Huw.
> 
> As we are at it, I was thinking of extending the patch to add the same
> FIXME for NtMapViewOfSection as well.
> 
> For it to be on the same level as NtAllocateVirtualMemory, it would
> require to change the way zero_bits is interpreted as well, but this
> would make some tests fail, and so we're again in the same situation
> were the tests should go to ntdll tests.
> 
> I can do that later in another patch set maybe.
> 
> What do you think?

It should definitely be in a later patch, this one's going to get big already.

For NtMapViewOfSection() you'd change map_image() to take zero_bits not the
mask, which would then pass it on to map_view().  So everything gets dealt
with there.

It doesn't look like there are too many tests for NtMapViewOfSection() with
non-zero zero_bits, so hopefully there won't be too much fixing to do there.

Huw.



More information about the wine-devel mailing list