[bb] Read/Write to an app/process's local memory by skn3 [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : Read/Write to an app/process's local memory
Author : skn3
Posted : 1+ years ago

Description : you need the following userlib:

.lib " "
GetProcessId%(name$)
GetWindowProcessId%(name$)
OpenProcessMemory(class$,name$,access%)
WriteProcessByte(process%,offset%,value%)
WriteProcessShort(process%,offset%,value%)
WriteProcessInt(process%,offset%,value%)
ReadProcessByte(process%,offset%)
ReadProcessShort(process%,offset%)
ReadProcessInt(process%,offset%)
CloseProcessMemory(process%)

.lib "user32.dll"
Pmem_FindWindow%(class%,name$):"FindWindowA"
Pmem_GetWindowThreadProcessId%(hwnd%,processid*):"GetWindowThreadProcessId"
Pmem_GetClassName%(hwnd%,classname*,max%):"GetClassNameA"

.lib "Kernel32.dll"
Pmem_OpenProcess%(access%,inherit%,processid%):"OpenProcess"
Pmem_ReadProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"ReadProcessMemory"
Pmem_WriteProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"WriteProcessMemory"
Pmem_CloseHandle%(object%):"CloseHandle"
Pmem_GetLastError%():"GetLastError"
Pmem_CreateToolhelp32Snapshot%(flags%,processid%):"CreateToolhelp32Snapshot"
Pmem_Process32First%(snapshot%,entry*):"Process32First"
Pmem_Process32Next%(snapshot%,entry*):"Process32Next"
Example:
Include "ProcessMemory.bb"
process = OpenProcessMemory(GetProcessId("someapp.exe"))
For i=0 To 255
WriteProcessByte(process,$20222E8,i)
Delay 10
Next
CloseProcessMemory(process)


Code :
Code (blitzbasic) Select
ml lang="en" >
<!-- Mirrored from www.blitzbasic.com/codearcs/codearcs.php?code=1206 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 09 Jun 2017 07:50:35 GMT -->
<head ><title >Read/Write to an app/process's local memory</title><meta name='description' content='Could be used to modify the health (a trainer) in an external game, language=bb, category=User Libs'><meta name='author' content='skn3'>
    <script type="application/ld+json">
     {
      "@context": "http://schema.org/",
      "@type": "ComputerLanguage",
      "name": "BlitzMax",
      "url":"http://blitzmax.com",
 "description": "BlitzMax is a versatile desktop development environment for game coders with BASIC skills.",
      "image": "http://www.blitzbasic.com/img/blitzmax_512px.png"
     }
   </script><link rel="styleSheet" href=../skins/default/style.css type="text/css"><style type="text/css">div.bbcode {padding: 8px;background: #E5E5E5;color: #000000;border: 1px dashed #B4B4BE;}</style></head><body ><div style="display:block;width:100%;height:30px;"></div><table width=100% cellspacing=0 cellpadding=0><tr ><td align="left" valign="bottom"><table width=100% cellspacing=0 cellpadding=0><tr ><td ><table width=100% cellspacing=0 cellpadding=0><tr ><td class=tableft></td><td class=tab><a href="../Home/_index_.html" class=tab>Home</a></td><td class=tabright></td></tr></table></td><td ><table width=100% cellspacing=0 cellpadding=0><tr ><td class=tableft></td><td class=tab><a href="../Community/_index_.html" class=tab>Community</a></td><td class=tabright></td></tr></table></td><td ><table width=100% cellspacing=0 cellpadding=0><tr ><td class=tableft></td><td class=tab><a href="../Manuals/_index_.html" class=tab>Manuals</a></td><td class=tabright></td></tr></table></td></tr></table></td><td align="right"><a href="../Account/login.html" >Login</a> or <a href="../Account/signup.html" >Signup</a></td></tr></table><table width=100% cellspacing=0 cellpadding=0><tr ><td class="menubarleft"></td><td class="menubar"><table cellspacing="0" cellpadding="0"><tr ><td >&nbsp;</td></tr></table></td><td class="menubarright"></td></tr></table><div class="main"><h1 ><a href=codearcs.html>Code archives</a>/<a href=codearcs49ce.html?cat=14>User Libs</a>/Read/Write to an app/process's local memory</h1><div class="quote">This code has been declared by its author to be Public Domain code.</div><br><a href="codearcs_bb/1206.html">Download source code</a><br><br><table width="100%" cellspacing="0" cellpadding="0"><tr ><td width="100%"><table width=100% cellspacing=0 cellpadding=0><tr ><td class=headleft></td><td class=head><table width=100% cellspacing=0 cellpadding=0><tr ><td >Read/Write to an app/process's local memory by skn3</td><td align="right">1+ years ago </td></tr></table></td><td class=headright></td></tr></table></td></tr><tr ><td class="cell"> you need the following userlib:<br><br>.lib " "<br>GetProcessId%(name$)<br>GetWindowProcessId%(name$)<br>OpenProcessMemory(class$,name$,access%)<br>WriteProcessByte(process%,offset%,value%)<br>WriteProcessShort(process%,offset%,value%)<br>WriteProcessInt(process%,offset%,value%)<br>ReadProcessByte(process%,offset%)<br>ReadProcessShort(process%,offset%)<br>ReadProcessInt(process%,offset%)<br>CloseProcessMemory(process%)<br><br>.lib "user32.dll"<br>Pmem_FindWindow%(class%,name$):"FindWindowA"<br>Pmem_GetWindowThreadProcessId%(hwnd%,processid*):"GetWindowThreadProcessId"<br>Pmem_GetClassName%(hwnd%,classname*,max%):"GetClassNameA"<br><br>.lib "Kernel32.dll"<br>Pmem_OpenProcess%(access%,inherit%,processid%):"OpenProcess"<br>Pmem_ReadProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"ReadProcessMemory"<br>Pmem_WriteProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"WriteProcessMemory"<br>Pmem_CloseHandle%(object%):"CloseHandle"<br>Pmem_GetLastError%():"GetLastError"<br>Pmem_CreateToolhelp32Snapshot%(flags%,processid%):"CreateToolhelp32Snapshot"<br>Pmem_Process32First%(snapshot%,entry*):"Process32First"<br>Pmem_Process32Next%(snapshot%,entry*):"Process32Next"<br><br><br>Example:<br><pre class=code>
Include "ProcessMemory.bb"
process = OpenProcessMemory(GetProcessId("someapp.exe"))
For i=0 To 255
WriteProcessByte(process,$20222E8,i)
Delay 10
Next
CloseProcessMemory(process)


Comments : Mirrored from www.blitzbasic.com/codearcs/codearcs.php?code=1206 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 09 Jun 2017 07:50:35 GMT -->
<head ><title >Read/Write to an app/process's local memory</title><meta name='description' content='Could be used to modify the health (a trainer) in an external game, language=bb, category=User Libs'><meta name='author' content='skn3'>
    <script type="application/ld+json">
     {
      "@context": "http://schema.org/",
      "@type": "ComputerLanguage",
      "name": "BlitzMax",
      "url":"http://blitzmax.com",
     "description": "BlitzMax is a versatile desktop development environment for game coders with BASIC skills.",
      "image": "http://www.blitzbasic.com/img/blitzmax_512px.png"
     }
   </script><link rel="styleSheet" href=../skins/default/style.css type="text/css"><style type="text/css">div.bbcode {padding: 8px;background: #E5E5E5;color: #000000;border: 1px dashed #B4B4BE;}</style></head><body ><div style="display:block;width:100%;height:30px;"></div>

<td align="left" valign="bottom">



<td class=tableft><td class=tab><a href="../Home/_index_.html" class=tab>Home</a><td class=tabright>

<td class=tableft><td class=tab><a href="../Community/_index_.html" class=tab>Community</a><td class=tabright>

<td class=tableft><td class=tab><a href="../Manuals/_index_.html" class=tab>Manuals</a><td class=tabright><td align="right"><a href="../Account/login.html" >Login</a> or <a href="../Account/signup.html" >Signup</a>

<td class="menubarleft"><td class="menubar"><table cellspacing="0" cellpadding="0">&nbsp;<td class="menubarright"><div class="main"><h1 ><a href=codearcs.html>Code archives</a>/<a href=codearcs49ce.html?cat=14>User Libs</a>/Read/Write to an app/process's local memory</h1><div class="quote">This code has been declared by its author to be Public Domain code.</div><a href="codearcs_bb/1206.html">Download source code</a><table width="100%" cellspacing="0" cellpadding="0"><td width="100%">

<td class=headleft><td class=head>

Read/Write to an app/process's local memory by skn3<td align="right">1+ years ago <td class=headright><td class="cell"> you need the following userlib:.lib " "GetProcessId%(name$)GetWindowProcessId%(name$)OpenProcessMemory(class$,name$,access%)WriteProcessByte(process%,offset%,value%)WriteProcessShort(process%,offset%,value%)WriteProcessInt(process%,offset%,value%)ReadProcessByte(process%,offset%)ReadProcessShort(process%,offset%)ReadProcessInt(process%,offset%)CloseProcessMemory(process%).lib "user32.dll"Pmem_FindWindow%(class%,name$):"FindWindowA"Pmem_GetWindowThreadProcessId%(hwnd%,processid*):"GetWindowThreadProcessId"Pmem_GetClassName%(hwnd%,classname*,max%):"GetClassNameA".lib "Kernel32.dll"Pmem_OpenProcess%(access%,inherit%,processid%):"OpenProcess"Pmem_ReadProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"ReadProcessMemory"Pmem_WriteProcessMemory%(process%,address%,buffer*,size%,numberofbytesread%):"WriteProcessMemory"Pmem_CloseHandle%(object%):"CloseHandle"Pmem_GetLastError%():"GetLastError"Pmem_CreateToolhelp32Snapshot%(flags%,processid%):"CreateToolhelp32Snapshot"Pmem_Process32First%(snapshot%,entry*):"Process32First"Pmem_Process32Next%(snapshot%,entry*):"Process32Next"Example:
Include "ProcessMemory.bb"
process = OpenProcessMemory(GetProcessId("someapp.exe"))
For i=0 To 255
WriteProcessByte(process,$20222E8,i)
Delay 10
Next
CloseProcessMemory(process)
</tr[/i]