I know questions asked without first doing research is frowned upon, and rightfully so, so I just want to assure everyone I have searched and read through _a lot_ of posts on this forum aswell as a lot of information found through google.
With that being said, I have encountered a problem which seems like I can not solve by myself. Previously, I have done an out of process bot in C# with basic functionality which sends messages to wow's message queue to do keyturns, etc. I decide, for this remake (in Java combined with JNative and DLL's written in C++ *shrugs*), to use Click To Move instead.
I did some research and came to some conclusions:
I would want to do this by calling wow's internal functions (both WorldToScreen computing with simulated mouse clicks and writing directly to the CTM structure I did not considere a viable option). I have so far been able (with much struggeling with JNative) been able to inject a DLL into wow's process, the DLL then invokes a call to user32's MessageBox from Wow's procedure. The MessageBox is displayed correctly, and when using Process Explorer I can see my DLL is loaded into WoW.
The code this first version DLL should call was only this:
I was unsure how to actually do a function call, so I decided to try something easy and went for ResetCamera. By looking through other posts I assumed the calling convention would look something like this:Code:MessageBox(NULL, TEXT("DLL attached."), TEXT("Message"), MB_OK);
(That is the actual code getting called on DLL_PROCESS_ATTACH)Code:MessageBox(NULL, TEXT("DLL attached."), TEXT("Message"), MB_OK); // From previous DLL version. // 0059AAB0 CGCamera__ResetView typedef void (__thiscall* CGCamera__ResetView)(); CGCamera__ResetView ResetView = (CGCamera__ResetView)0x0059AAB0; ResetView();
I noticed that the MessageBox still gets displayed, however the camera is not moved to default position and, on top of that, the DLL is no longer present in Process Explorer.
My conclusion was that the call I added is not approved by WoW and somehow that causes it to be Ejected. Now, given that I'm very new to all this memory editing, etc. my conclusion may be way off.
So, my question is really what I am doing wrong that's causing my module to get ejected? (I assumed the actual code for injection is not of importance since I can inject the DLL without the ResetView call with no problems).
Thanks alot for any help. Sorry for the long post and the noobish question.
EDIT: Forgot to add I use LoadLibraryA and CreateRemoteThread to inject the DLL.