[PATCH] ntdll: Fix QueryVirtual information on builtin DLLs

Marcus Meissner meissner at suse.de
Wed Jul 7 04:45:35 CDT 2010


On Wed, Jul 07, 2010 at 11:29:25AM +0200, Alexandre Julliard wrote:
> Marcus Meissner <marcus at jet.franken.de> writes:
> 
> > @@ -1404,9 +1406,20 @@ static void load_builtin_callback( void *module, const char *filename )
> >          builtin_load_info->status = STATUS_INVALID_IMAGE_FORMAT;
> >          return;
> >      }
> > -    virtual_create_system_view( module, nt->OptionalHeader.SizeOfImage,
> > -                                VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED |
> > -                                VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC );
> > +    sec = (IMAGE_SECTION_HEADER*)((char*)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
> > +    /* This view creation is for the sake of NtQueryVirtualMemory, the data is mapped already by dlopen. */
> > +    for (i=0;i<nt->FileHeader.NumberOfSections;i++) {
> > +        DWORD flags = VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED;
> > +
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_EXECUTE) flags |= VPROT_EXEC;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_READ) flags |= VPROT_READ;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_WRITE) flags |= VPROT_WRITE;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_SHARED) flags |= VPROT_WRITECOPY;
> > +        /* The section handling is incomplete for real PE binaries/dlls, but is sufficient
> > +         * for the builtin ones generated by Wine */
> > +        virtual_create_system_view( (char*)module + sec[i].VirtualAddress, sec[i].Misc.VirtualSize, flags );
> > +       
> > +    }
> 
> You can't do that, it needs to be a single view.

Umm, why?

We could also create overlapping views?

Ciao, Marcus



More information about the wine-devel mailing list