Valhalla Legends Forums Archive | Advanced Programming | Exception warning while using DLL injection

AuthorMessageTime
thetempest
Hi,

When i try to call my function (that is located in a DLL) from Starcraft. SC crashes and i get an exception warning. saying that the thread tried to read or write to a virtual address for which it doesn't have the right access too.

the function that i'm calling is only designed to store a register into one of the DLL's global variables. however, it's not even able to call this function from sc without crashing.

now, just for fun i created a test moduel that worked fine, it called the function and everything and i'm using LoadLibraryA in both SC and my test moduel. SO i know the DLL is valid and the functions are correct.

Now, i think the problem is that in the ASM code, it shows that it's just calling address 0x00A0010F. but when a dll is called it usally says, "dllnamehere.00a0010F". So i think it's trying to call that address from within sc and NOT my dll.

how could i fix this?

Thanks



any ideas?
TheTempest
December 1, 2003, 8:31 PM
Kp
My guess is that you didn't do the memory patch correctly, so it is adding the wrong amount to eip.
December 2, 2003, 12:12 AM
Etheran
Code examples would be nice.
December 2, 2003, 12:57 AM
thetempest
i fixed the problem, it wasn't a bad jmp, i'm using calls. Which aren't related to EIP in my experience.

anyways, what i was doing was getting the functions address using GetProcAddress(). however, the problem was that SC had about 25 DLL's loaded into memory so the address kept chaning.

finaly i just wrote a simple function to output the addresses of the functions i needed from within starcraft via fstream.h

works great now

thx
December 2, 2003, 1:15 AM
Adron
[quote author=thetempest link=board=23;threadid=3996;start=0#msg33067 date=1070327711]
i fixed the problem, it wasn't a bad jmp, i'm using calls. Which aren't related to EIP in my experience.
[/quote]

Calls like jumps are mostly relative to EIP. Calls to absolute addresses happen when calling through a pointer - like calling functions imported from a DLL.
December 2, 2003, 10:15 AM

Search