On Mon, Apr 03, 2000 at 07:35:46PM +0000, Eric Pouech wrote:
> I thinkAndreas Mohr wrote:
> >
> > Hello all,
> >
> > a program I tested (VideoSelect.exe) does this:
> > Call KERNEL32.746:
>WriteProcessMemory(7fffffff,78004858,4106b948,00000005,4106b944) ret=0a93b7b3 fs=0247
> that's what I call a brain damaged program.
Oh, sure. Don't hesitate to call it like that ;-)
> WriteProcessMemory(GetCurrentProcess()) is very close to a memcpy... (ok, without
>the exception handling part...)
Oh damn, yes. Of course.
> the server, while processing a WriteProcessMemory(pid, ...) on process pid, that :
> - either the caller is a debugger debugging pid, or pid is not currently debugged
>and the caller
> will (temporaly) act as a debugger
> - in both cases pid and caller shall be two distinct process
>
> Andi, can you try to, in scheduler/process.c, to add, at the top of
>WriteProcessMemory,
> something like:
> if (process == GetCurrentProcess()) {
> memcpy(addr, buffer, size);
> *bytes_written = size;
> return TRUE;
> }
>
> (untested, might not event compile)
Thanks, it worked !
(it doesn't display the MEM_BAD_POINTER MessageBox any more :)
I really could have come to the same conclusion...
Damn, now I know why the program worked when using -debug (different pid)...
I'll send the patch soon.
Andreas Mohr