[PATCH v2 1/8] kernel32/tests: Fix NtMapViewOfSection tests results for w1064v1809

Rémi Bernon rbernon at codeweavers.com
Tue Jun 18 05:34:07 CDT 2019


On Mon, 2019-06-17 at 10:39 +0100, Huw Davies wrote:
> On Fri, Jun 14, 2019 at 03:11:10PM +0200, Rémi Bernon wrote:
> > Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> > ---
> >  dlls/kernel32/tests/virtual.c | 23 +++++++++++++++--------
> >  1 file changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/dlls/kernel32/tests/virtual.c
> > b/dlls/kernel32/tests/virtual.c
> > index 0b718606d0e..47e61566c9c 100644
> > --- a/dlls/kernel32/tests/virtual.c
> > +++ b/dlls/kernel32/tests/virtual.c
> > @@ -1265,8 +1265,8 @@ static void test_NtMapViewOfSection(void)
> >      size = 0;
> >      offset.QuadPart = 0;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> 
> So this is trying to map a view into the lowest 1MB of the addr
> space,
> wich is unlikely to succeed.  Let's change the '12' to a '1' in this
> patch since that's what you did in [4/8] anyway.
> 
> > -    todo_wine
> > -    ok( status == STATUS_NO_MEMORY, "NtMapViewOfSection returned
> > %x\n", status );
> > +    ok( status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
> > +        "NtMapViewOfSection returned %x\n", status );
> >      if (status == STATUS_SUCCESS)
> >      {
> >          status = pNtUnmapViewOfSection( hProcess, ptr2 );
> > @@ -1288,7 +1288,8 @@ static void test_NtMapViewOfSection(void)
> >      ptr2 = NULL;
> >      size = 0;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 22, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> > -    ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection
> > returned %x\n", status );
> > +    ok( status == STATUS_INVALID_PARAMETER_4 || status ==
> > STATUS_INVALID_PARAMETER,
> > +        "NtMapViewOfSection returned %x\n", status );
> >      if (status == STATUS_SUCCESS)
> >      {
> >          status = pNtUnmapViewOfSection( hProcess, ptr2 );
> > @@ -1328,25 +1329,30 @@ static void test_NtMapViewOfSection(void)
> >      size = 0;
> >      offset.QuadPart = 0;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> 
> Also, changing this and the other non-zero zero_bits below to '1'
> would improve the tests.  i.e. it's something that one would expect
> to
> succeed if ptr2 was set to NULL.

After doing some testing it looks like it would change the test results
as well. The comment here is wrong in the sense that it looks like
Windows returns INVALID_PARAMETER whenever the fixed address parameter
does not satisfy the provided zero_bits constraint. Whenever it does,
then the tests fail with MAPPED_ALIGNMENT instead.

So with 12 or more zero bits, there was little chance for the provided
address to ever satisfy the check, and INVALID_PARAMETER was returned.
If we change it to 1 zero bit, then the tests will usually succeed.

This also explains the "broken" behaviour that was sometimes seen on
w1064v1809.

This first patch was merely to add results seen on w1064v1809, and I
didn't want to change test logic before moving them to ntdll. I can do
the logic changes before moving the tests, but I don't think doing
logic changes both before and after moving them is very clear.

> > -    ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection
> > returned %x\n", status );
> > +    ok( status == STATUS_INVALID_PARAMETER_4 || status ==
> > STATUS_INVALID_PARAMETER ||
> > +        broken(STATUS_MAPPED_ALIGNMENT) /* w1064v1809
> > inconsistently returns STATUS_MAPPED_ALIGNMENT or
> > STATUS_INVALID_PARAMETER */,
> > +        "NtMapViewOfSection returned %x\n", status );
> >  
> >      ptr2 = (char *)ptr + 0x1000;
> >      size = 0;
> >      offset.QuadPart = 0;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> > -    ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection
> > returned %x\n", status );
> > +    ok( status == STATUS_INVALID_PARAMETER_4 || status ==
> > STATUS_INVALID_PARAMETER,
> > +        "NtMapViewOfSection returned %x\n", status );
> >  
> >      ptr2 = (char *)ptr + 0x1001;
> >      size = 0;
> >      offset.QuadPart = 0;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> > -    ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection
> > returned %x\n", status );
> > +    ok( status == STATUS_INVALID_PARAMETER_4 || status ==
> > STATUS_INVALID_PARAMETER,
> > +        "NtMapViewOfSection returned %x\n", status );
> >  
> >      ptr2 = (char *)ptr + 0x1000;
> >      size = 0;
> >      offset.QuadPart = 1;
> >      status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0,
> > &offset, &size, 1, 0, PAGE_READWRITE );
> > -    ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection
> > returned %x\n", status );
> > +    ok( status == STATUS_INVALID_PARAMETER_4 || status ==
> > STATUS_INVALID_PARAMETER,
> > +        "NtMapViewOfSection returned %x\n", status );
> >  
> 
> Huw.
-- 
Rémi Bernon <rbernon at codeweavers.com>




More information about the wine-devel mailing list