MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides

Homepage Register FAQ Members Mark Forums Read Advertise Marketplace FPSowned


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > World of Warcraft > Bots and Programs > WoW Memory Editing
Reload this Page Nofalldmg Detour causes wow to crash
WoW Memory Editing WoW Memory Editing for learning purposes only.

Reply
 
LinkBack Thread Tools
Nofalldmg Detour causes wow to crash
(#1)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
Nofalldmg Detour causes wow to crash - 06-19-2008

Code:
#include <windows.h>
#include <cstring>
DWORD DetourAddress = 0x760D90;
DWORD dwOrig = DetourAddress+6;
typedef struct callsturct
{
       BYTE opCode;
       DWORD adress;
       }Tcallstruct;
       
void __declspec(naked) NoFallDamage_Detour()
{
	__asm
	{
		TEST DWORD PTR [ESI + 0x10], 0x1000
		JNE RESET
		MOV ECX, DWORD PTR [EDI + 0x7C]
		CMP ECX, 0x38D
		JGE RETURN
		MOV DWORD PTR [ESI + 0x3C], ECX
	RETURN:
		PUSH dwOrig
		RET
	RESET:
		MOV ECX, DWORD PTR [EDI + 0x7C]
		MOV DWORD PTR [ESI + 0x3C], ECX
		JMP RETURN
	}
}
void nofalldmg(void)
{
	Tcallstruct call={0xE8, PtrToUlong(NoFallDamage_Detour)};
	DWORD oldprotect;
	VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, sizeof(call),PAGE_EXECUTE_READWRITE, &oldprotect);
    memcpy((PVOID)DetourAddress, &call, sizeof(call));
	VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, sizeof(call), oldprotect, &oldprotect);
     
 }


BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
           nofalldmg();
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }

    /* Returns TRUE on success, FALSE on failure */
    return TRUE;
}
When I move after I injected this dll into wow, wow crashes with a memory error, the instruction at the offset XXXXXXXX referenced memory at XXXXXXXXX, the memory could not be read.
Edit:
I tried injecting the dll while ollydbg was attached to wow, olly told me that my dll is outside of the code segment of the PE or something like that, I'm quite sure my that's causing the crash, yet I've no Idea how to fix that issue :/.


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!

Last edited by Xarg0; 06-19-2008 at 03:47 PM.
Reply With Quote

Donate to remove ads.
(#2)
Old
suicidity is Offline
Banned
Rep Power: 0
Reputation: 89
suicidity will become famous soon enough
 
Posts: 652
Join Date: Oct 2006
Location: In your attic.
06-21-2008

Recheck your math and asm, it sounds like your detour is going out of wow's memory or that your detour is not set up right.
Reply With Quote
(#3)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-21-2008

I double checked every thing, yet I can't find a mistake in my code, maybe I'm doing something wrong when injecting my dll.
I use a createremotethread injection with a LoadLibaryA call, I tried my dll injection on both Linux and Windows, with Linux the detour doesn't work at all, it doesn't write the function call to wows memory, with Windows I'll get an error because the function I want to call is outside of wows code segment :/
wtf am I doing wrong >.<


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#4)
Old
Cursed's Avatar
Cursed is Offline
Contributor
Rep Power: 3
Reputation: 228
Cursed has a spectacular aura aboutCursed has a spectacular aura aboutCursed has a spectacular aura about
 
Posts: 1,125
Join Date: Jun 2007
Location: Germany
06-21-2008

If you are using it on Retail Servers: I think Warden checks for CreateRemoteThread (Could be wrong... Just what I remember) :P


Reply With Quote
(#5)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-21-2008

Knyox WoWObjectdumper worked with my loader ^^


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#6)
Old
Shynd's Avatar
Shynd is Offline
Master Sergeant
Rep Power: 1
Reputation: 28
Shynd is on a distinguished road
 
Posts: 121
Join Date: May 2008
06-22-2008

Inside your nofalldmg function, put in some code that helps you check the size of call. Make sure call is only 5 bytes long, not 9. If that's not the problem, I have no idea.
Reply With Quote
(#7)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-23-2008

Shynd, you're right, the call struct is bigger than 5 bytes, I tried to fix that problem by writing the call instruction without the call struct like this
Code:
BYTE opcode=0xE8;
DWORD nofall=PtrToUlong(NoFallDamage_Detour);
VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, 5,PAGE_EXECUTE_READWRITE, &oldprotect);

memcpy((PVOID)DetourAddress, &opcode, 1);
memcpy((PVOID)(DetourAddress+0x1), &nofall, 4);
VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, 5, oldprotect, &oldprotect);
this will give me a memory write error instead of a memory read error, I think the problem is the size of DWORD, it should be 4byte but it isn't, maybe I need to convert the DWORD into a BYTE Array, yet I've no Idea how to do this.


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#8)
Old
Shynd's Avatar
Shynd is Offline
Master Sergeant
Rep Power: 1
Reputation: 28
Shynd is on a distinguished road
 
Posts: 121
Join Date: May 2008
06-23-2008

How about changing it to look like so:
Code:
BYTE opcode = 0xE8;
DWORD nofall = (DWORD)NoFallDamage_Detour;

VirtualProtect((LPVOID)DetourAddress, 5, PAGE_EXECUTE_READWRITE, &oldprotect);
memcpy((PVOID)DetourAddress, opcode, 1);
memcpy((PVOID)(DetourAddress+1), nofall, 4);
VirtualProtect((LPVOID)DetourAddress, 5, oldprotect, &oldprotect);
I don't know, I just typed that out without testing, but it seems to me that your PtrToULong function returns an 8-byte LONG-type variable, or something. I'm not sure.
Reply With Quote
(#9)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-24-2008

DWORD = unsigned long
and it should be only 4bytes long, yet your code causes another memory error, the memory referenced at 0x0000001 could not be read or something like that.
Maybe I'll just change the Nofalldmgdetour a bit and write the call instruction to another place


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#10)
Old
suicidity is Offline
Banned
Rep Power: 0
Reputation: 89
suicidity will become famous soon enough
 
Posts: 652
Join Date: Oct 2006
Location: In your attic.
06-25-2008

why don't you do what I did for CS:S, write it byte by byte, do what you have to then rewrite it back?

might work.
Reply With Quote
(#11)
Old
Cypher's Avatar
Cypher is Offline
Kynox's Pimp OMGRECURSION
Legendary User
Rep Power: 9
Reputation: 793
Cypher is a splendid one to beholdCypher is a splendid one to beholdCypher is a splendid one to beholdCypher is a splendid one to beholdCypher is a splendid one to beholdCypher is a splendid one to beholdCypher is a splendid one to behold
 
Posts: 2,009
Join Date: Apr 2006
Location: Your mums bedroom
06-30-2008

You didn't write that code, I'm not saying you said you did, but still, credit where credit's due.

[Only registered and activated users can see links. ]



If freedom is outlawed, only outlaws will have freedom.
I'm not being rude, you're just insignificant.
Reply With Quote
(#12)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-30-2008

Yeah sry forgot the credits
btw I think I've done a big mistake in my code, the call offset is just wrong, I need to dynamical calculate it...
I'll try if it works later and maybe upload a dll with a working nofalldmg hook ^^


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#13)
Old
Xarg0's Avatar
Xarg0 is Offline
Sergeant Major
Rep Power: 1
Reputation: 19
Xarg0 is on a distinguished road
 
Posts: 147
Join Date: Jan 2008
Location: High in the sky
06-30-2008

Code:
#include <windows.h>
#include <cstring>
DWORD DetourAddress = 0x760D90;
DWORD dwOrig = DetourAddress+6;
typedef struct callsturct
{
       BYTE opCode;
       unsigned long adress;
	   }Tcallstruct;
       
inline void __declspec(naked) NoFallDamage_Detour()
{
	__asm
	{
		TEST DWORD PTR [ESI + 0x10], 0x1000
		JNE RESET
		MOV ECX, DWORD PTR [EDI + 0x7C]
		CMP ECX, 0x38D
		JGE RETURN
		MOV DWORD PTR [ESI + 0x3C], ECX
	RETURN:
		PUSH dwOrig
		RET
	RESET:
		MOV ECX, DWORD PTR [EDI + 0x7C]
		MOV DWORD PTR [ESI + 0x3C], ECX
		JMP RETURN
	}
}
void nofalldmg(void)
{
	
	DWORD oldprotect;
	BYTE opcode=0xE8;
	DWORD nofall=PtrToUlong(NoFallDamage_Detour)-DetourAddress;
	VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, 5,PAGE_EXECUTE_READWRITE, &oldprotect);
    memcpy((PVOID)DetourAddress, &opcode,1);
	memcpy((PVOID)(DetourAddress+1), &nofall,4);
	VirtualProtectEx(GetCurrentProcess(),(LPVOID) DetourAddress, 5, oldprotect, &oldprotect);
	return;
     
 }


BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
           nofalldmg();
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }

    /* Returns TRUE on success, FALSE on failure */
    return TRUE;
}
still doesn't work for me
Here's the a link to the compiled dll
[Only registered and activated users can see links. ]


Bei 200° 15 Minuten Backen und keine EIER!!!!!!!!
Reply With Quote
(#14)
Old
Shynd's Avatar
Shynd is Offline
Master Sergeant
Rep Power: 1
Reputation: 28
Shynd is on a distinguished road
 
Posts: 121
Join Date: May 2008
06-30-2008

It should be uh... DetourAddress-(NoFallDamage_Detour+5) or something, I think. Something like that.
Reply With Quote
(#15)
Old
beagle is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 1
Reputation: 1
beagle is an unknown quantity at this point
 
Posts: 6
Join Date: Jun 2008
07-01-2008

This is probably a REALLY noob question, but is it possible to get the address for fall damage using a memory editor for say, Age of Conan? Sorry for asking here but theres nothing really about fall damage on the Conan forums. The reason I ask here is because i thought maybe it might be similar to this game, plus you are all very knowledgable on these kinds of things, so i thought i might as well ask .
Reply With Quote
Reply

Donate to remove ads.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344