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 a little bit of c++ and reading process memory..
WoW Memory Editing WoW Memory Editing for learning purposes only.

Reply
 
LinkBack Thread Tools
a little bit of c++ and reading process memory..
(#1)
Old
arynock 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
arynock is an unknown quantity at this point
 
Posts: 42
Join Date: May 2008
Location: Ohio
a little bit of c++ and reading process memory.. - 05-17-2008

So i've been trying to work out a simple class for opening processes and reading memory... I'm kinda stuck when it comes to making the call to OpenProcess()... it fails because it says access is denied... So upon google'n that i found that i have to set the privileges in the access token to allow me to open the process..

--------- Function to set SE_DEBUG_NAME privilege -----------
bool MemoryReader::SetDebugPrivilege()
{

TOKEN_PRIVILEGES tp;
LUID luid;
DWORD cbPrevious=sizeof(TOKEN_PRIVILEGES);

if(LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &luid )==0) {
std::cout << "Failed to lookup privilege value...[" << GetLastError() << "]\n";
}

tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;


if (AdjustTokenPrivileges(hToken, FALSE,&tp,sizeof(TOKEN_PRIVILEGES),(PTOKEN_PRIVILEGES)NULL,(PDWORD) NULL)==0)
{
std::cout<<"Failed to adjust token privileges...[" << GetLastError() << "]\n";
return FALSE;
}
}
------------------------------------
so i now when i try to actually set the privileges with the token i get another error on the call to AdjustTokenPrivileges... error 6.... the handle is invalid...

Last edited by arynock; 05-17-2008 at 01:36 PM.
Reply With Quote

Donate to remove ads.
(#2)
Old
KOS0937's Avatar
KOS0937 is Offline
Sergeant
Rep Power: 1
Reputation: 7
KOS0937 is an unknown quantity at this point
 
Posts: 66
Join Date: May 2008
05-17-2008

Code:
TokenHandle

    A handle to the access token that contains the privileges to be modified. The handle must have TOKEN_ADJUST_PRIVILEGES access to the token. If the PreviousState parameter is not NULL, the handle must also have TOKEN_QUERY access.
So, where do you set 'hToken'?
Reply With Quote
(#3)
Old
arynock 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
arynock is an unknown quantity at this point
 
Posts: 42
Join Date: May 2008
Location: Ohio
05-17-2008

eh sorry i meant to reply on this post earlier... i managed to figure out what my problem was and i actually got it to work... but not i'm kinda on pause seeing as my accounts keep getting banned using cheat engine... ugh...
Reply With Quote
(#4)
Old
KOS0937's Avatar
KOS0937 is Offline
Sergeant
Rep Power: 1
Reputation: 7
KOS0937 is an unknown quantity at this point
 
Posts: 66
Join Date: May 2008
05-17-2008

Just don't use your real account!
You can get unlimited free trials accounts to test bots / hacks etc. at [Only registered and activated users can see links. ] or [Only registered and activated users can see links. ] .
Reply With Quote
(#5)
Old
arynock 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
arynock is an unknown quantity at this point
 
Posts: 42
Join Date: May 2008
Location: Ohio
05-17-2008

thats understandable... but has anyone else been having this problem?? 2 days ago i was able to use cheat engine fine with no problem, but today i cant even do one search without one of my trial accounts being banned..
Reply With Quote
(#6)
Old
arynock 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
arynock is an unknown quantity at this point
 
Posts: 42
Join Date: May 2008
Location: Ohio
05-17-2008

okay, so this is probably gonna get me flammed hardcore... but oh well, i'm still in the learning process...

so using c++ i was able to find the base address, and using the offsets i was able to find the address that holds my current health...

now... lets say i want to update my health in my bot program every second... is it possible to point right to the address that holds my current health? or will i have to use my MemoryRead function to reread the address and save it to the health variable??
Reply With Quote
(#7)
Old
KOS0937's Avatar
KOS0937 is Offline
Sergeant
Rep Power: 1
Reputation: 7
KOS0937 is an unknown quantity at this point
 
Posts: 66
Join Date: May 2008
05-18-2008

You have to use your ReadMemory function every time.
Reply With Quote
(#8)
Old
lunitune 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: 3
lunitune is an unknown quantity at this point
 
Posts: 8
Join Date: Apr 2008
05-18-2008

You will have to memory read each time to read the health obviously, however the pointer to that location will stay the same until you zone (eg Zeplin/instance). I have not noticed it change in any other circumstances.

For quick reads I have direct pointers to the x/y/z locs in mem.

--

To gain the right privileges I use wow!sharp's method. I'm using C# but it is using pinvoke.

Code:
internal void EnableDebuggerPrivileges()
		{
			int token = 0;
			TOKEN_PRIVILEGES tp = new TOKEN_PRIVILEGES();
			tp.PrivilegeCount = 1;
			tp.Luid = 0;
			tp.Attributes = SE_PRIVILEGE_ENABLED;

			// We just assume this works
			if( OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token) == 0)
				throw( new Exception( "OpenProcessToken failed"));

			if( LookupPrivilegeValue( null, "SeDebugPrivilege", ref tp.Luid) == 0)
				throw( new Exception( "LookupPrivilegeValue failed"));

			if( AdjustTokenPrivileges( token, 0, ref tp, Marshal.SizeOf(tp), 0, 0) == 0)
				throw( new Exception( "AdjustTokenPrivileges failed"));
		}


[StructLayout(LayoutKind.Sequential, Pack=1)]
		private struct TOKEN_PRIVILEGES
		{
			public int PrivilegeCount;
			public long Luid;
			public int Attributes;
		}
--

With CE try changing the exe name. This is what I've done with tsearch and it has not been a problem so far. I also use Process Guard which stops one process from reading another process.

If you want to take it a little further with CE you can make a few changes to the source and compile it yourself (credit to Greyman for this info).
Reply With Quote
(#9)
Old
arynock 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
arynock is an unknown quantity at this point
 
Posts: 42
Join Date: May 2008
Location: Ohio
05-18-2008

Quote:
Originally Posted by lunitune View Post
For quick reads I have direct pointers to the x/y/z locs in mem.

how exactly do i do this?? this was what i was talking about, i was wondering how i can maek a direct pointers to the players data locations in the memory... i've been reading upon pointers, but i think i'm missing something.. heh..
Reply With Quote
(#10)
Old
KOS0937's Avatar
KOS0937 is Offline
Sergeant
Rep Power: 1
Reputation: 7
KOS0937 is an unknown quantity at this point
 
Posts: 66
Join Date: May 2008
05-19-2008

In theory you have 2^32 possible pointers that you can form with 4 byte (32bit system).
So you can adress exactly 4GiB of data. As you can see, that is enough to adress every byte in the RAM (actually, a part of those pointers are used for the virtual memory, but thats not so important).
If you - for example - should change a pointers adress to 0x00000000 you'dd read some OS-Variable. So you just have to find the offset for the wow-process (i have no idea how to do that in C++... sry)
Reply With Quote
(#11)
Old
lunitune 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: 3
lunitune is an unknown quantity at this point
 
Posts: 8
Join Date: Apr 2008
05-22-2008

The way I make a direct pointer (in fact I do it to the actual data I want, eg player X, another for player Y etc) is I first read all objects through the TLS method listed in a number of places on this site. During that process I get the base pointer for each object and store it. Then as I read X/Y etc I also record the address in memory for that data as part of my own player object.

If you want more info let me know.
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.
LinkBacks Enabled by vBSEO 3.1.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