[MPlayer-dev-eng] Re: [PATCH] [RFC] fix GetModuleHandle(0)
Martin Simmons
vyslnqaaxytp at spammotel.com
Mon Mar 19 00:08:16 CET 2007
>>>>> On Sun, 18 Mar 2007 14:23:12 -0700, Alan Nisota said:
> Martin Simmons wrote:
> >>>>>> On Sun, 18 Mar 2007 12:20:44 -0700, Alan Nisota said:
> >> I am trying to fix GetModuleHanldeA(0) to return the base address of the
> >> calling DLL (in general this should be the base address of the filter
> >> we've loaded. What I really want is the address returned by
> >> LoadLibraryExA, but I'm not sure how I can get at it from this context.
> >
> > That doesn't sound right to me -- it should return the handle of the main
> > executable.
> I read MSDN and wasn't sure exactly what 'a handle to the file used to
> create the calling process' meant. I guess I guessed wrong.
>
> >> applied). It is obviously wrong, but is a band-aid until I can figure
> >> out the right way to fix this.
> >
> > The right way probably depends on what CoreAVC does with the value.
> Maybe not much, since feeding it 0x1000000 (which is the address where
> CoreAVC is loaded) works. Perhaps I could create a dummy stub to return
> in this case. I don't know what is supposed to be in memory at the
> beginning of the file handle though. Do you know if this is supposed to
> be mapped to a structure?
The memory contains bytes from the start of the EXE file, but the handle is
opaque so code shouldn't depend on the memory contents or any particular
non-zero value.
I wonder why the old value 1 didn't work? It might be worth trying 0x129
(i.e. the next value like MODULE_HANDLE_winmm).
__Martin
More information about the MPlayer-dev-eng
mailing list