[ntdll] fix GetProcAddress on mapped modules as data

Vitaliy Margolen wine-devel at kievinfo.com
Mon Nov 28 17:03:54 CST 2005


Monday, November 28, 2005, 3:29:51 PM, Raphael wrote:
> Hi,
> fix crash on Corel 9 start
> (http://bugs.winehq.org/show_bug.cgi?id=2884)
> Changelog:
>   - don't crash on GetProcAddress when input mapped modules as data 

I think you need to make some tests of this. It shouldn't be to hard to
load some dll as a resource and try to get proc address. Also check if
you can do that for already loaded dll (like kernel32.dll).

Now the patch:
> +    if ((ULONG_PTR)module & 1)
> +    {
> +        module = (HMODULE)((ULONG_PTR)module & ~1);
> +    }
Check is some-what redundant. Just use:
module = (HMODULE)((ULONG_PTR)module & ~1);

> -        void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1 )
> -                          : find_ordinal_export( module, exports, exp_size, ord - exports->Base );
> +        void *proc = NULL;
> +       if (name) 
> +       { 
> +            proc = find_named_export( module, exports, exp_size, name->Buffer, -1 );
> +       }
> +        else
> +        {
> +            proc = find_ordinal_export( module, exports, exp_size, ord - exports->Base );
> +       }
Any reason for this? It's the same no matter how you write it only 7
lines longer <g>

Vitaliy Margolen






More information about the wine-devel mailing list