View Single Post
  #3   Spotlight this post!  
Unread 25-05-2004, 16:29
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Need Help? Call us!

I'm not really sure what this is doing in this thread, but here's the problem:

Code:
Const 
NumberOfBytes = 2;
Banshee = 159;

GetMem(buf,1);
buf^ := Chr(Banshee);
WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
FreeMem(buf);
You're putting a single byte in the buffer, but you're writing two bytes. It looks like the second byte of the buffer has a random (but consistent?) 89 in it. Thus the two bytes written are 159:89, or hexadecimal 9F:59. On a "little-endian" processor, that's the decimal 22943 you're getting.

The solution is to set the second byte of the buffer to zero before writing it. That means you'll have to make your buffer two bytes long, too.