Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 23:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



I need some help...

Discussion on I need some help... within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
CantShutMyMouth's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
I need some help...

Hello. I modified a value of a memory of a process but with a console application...
now i'm trying to do it with a dll...
What's wrong here?

PHP Code:
#include <windows.h>
#include <iostream> 
using namespace std;
int main() 

BOOLEAN WINAPI DllMainIN HINSTANCE hDllHandle
         
IN DWORD     nReason
         
IN LPVOID    Reserved )

{
;
DWORD Id;
HANDLE ProcessHandle;
int value
    
unsigned adress 0x07A4F60;     
      switch ( 
nReason )
   {
    case 
DLL_PROCESS_ATTACH:
    
DWORD WINAPI GetCurrentProcessId(Id);
    
ProcessHandle OpenProcess(PROCESS_VM_WRITE |PROCESS_VM_OPERATION ,false,Id);
    
value=1967458304;
    
fflush(stdin);
    
WriteProcessMemory(ProcessHandle,(LPVOID)adress,&value,sizeof(int),NULL);
    break;
      }
      
         } 
CantShutMyMouth is offline  
Old 02/22/2013, 09:20   #2
 
elite*gold: 0
Join Date: Aug 2009
Posts: 127
Received Thanks: 27
I think your memory address is not static looks like you need a pointer
theredvex is offline  
Thanks
1 User
Old 02/22/2013, 09:28   #3
 
CantShutMyMouth's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
Quote:
Originally Posted by theredvex View Post
I think your memory address is not static looks like you need a pointer
If i understand what you understand by " static" word, then... I closed the game and used this adress and still worked. wherever and whenever
Else, be more understoodable ( i'm a begginer, sol et me read about pointers in my book ) )


EDIT... Eror:
Code:
--------------------Configuration: test1 - Debug--------------------
Compiling source file(s)...
test1.cpp
test1.cpp: In function `int main()':
test1.cpp:6: error: syntax error before `__attribute__'
test1.cpp: In function `BOOLEAN DllMain(HINSTANCE__*, long unsigned int, void*)
':
test1.cpp:19: warning: `__stdcall__' attribute only applies to function types
test1.cpp:19: warning: unused variable `DWORD GetCurrentProcessId'
test1.cpp:27:2: warning: no newline at end of file
NEW ERROR:, after i eliminated the paramter ( ID) from GetCurrentProcessID:
Code:
error: syntax error before `__attribute__'
( at the line of Boolean Winapi ....)
CantShutMyMouth is offline  
Old 02/23/2013, 20:32   #4

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
First learn C++ before you try to do ANYTHING with C++.
Delinquenz is offline  
Old 02/24/2013, 01:20   #5
 
schneider1424's Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 48
Received Thanks: 32
delin he a begginer how he learn without doing anything in C++
+ He need help so help or dont say **** like learn c++ 1st when he already learning it
schneider1424 is offline  
Thanks
1 User
Old 02/24/2013, 01:45   #6

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
He should use a book.. this code is awful.

Sorry for my bad sound, but why do you want to hack, if your knowledge isn't so wide?

Why?
PHP Code:
int main() 
Just look at your code formatting..

Maybe this () is your solution.

instead of this
PHP Code:
DWORD WINAPI GetCurrentProcessId(Id); 
maybe this (idk if this works)
PHP Code:
Id GetCurrentProcessId(); 
But why do you inject a dll to open a process?
Delinquenz is offline  
Old 02/24/2013, 16:19   #7
 
CantShutMyMouth's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
Thanks for trying to help me. Actually, i changed that memory by console application so:




but i'm trying with dlls, because the game may have other process names, so i need to get it's id by injecting dll. and i'd like that dll to change the memory , too.


But the problem is at the switch( nReason) .... even if i used it as microsoft says,it still doesn't works...


Thanks anyway
And thanks "schneider1424" too for supporting me
CantShutMyMouth is offline  
Old 02/24/2013, 16:49   #8

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
I'm not used to inject DLLs but if you inject the DLL you just have to find out your actual process handle, or am I wrong?
Delinquenz is offline  
Thanks
1 User
Old 02/24/2013, 16:50   #9
 
CantShutMyMouth's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
#include <windows.h>
#include <iostream>
using namespace std;
void dll()

{

DWORD Id;
HANDLE ProcessHandle;
int value;
unsigned adress = 0x07A4F60;
Id = GetCurrentProcessId();
ProcessHandle = OpenProcess(PROCESS_VM_WRITE |PROCESS_VM_OPERATION ,false,Id);
value=1967458304;
fflush(stdin);
WriteProcessMemory(ProcessHandle,(LPVOID)adress,&v alue,sizeof(int),NULL);

}

It has no error when compiling it.. but still doesn't modfiy that value :|
CantShutMyMouth is offline  
Old 02/24/2013, 19:08   #10

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,479
Received Thanks: 3,318
Ehm, so you're in the process, right?

The lazy way:
unsigned long *adr = (unsigned long *)0x07A4F60;
*adr = value;

You don't need to use OpenProcess when your dll is injected (as far as I know).
snow is offline  
Thanks
1 User
Old 02/24/2013, 21:13   #11

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
Quote:
You don't need to use OpenProcess when your dll is injected (as far as I know).
That's what I mean, sorry for my bad English.
Delinquenz is offline  
Old 03/02/2013, 20:55   #12
 
CantShutMyMouth's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
Quote:
Originally Posted by snow911 View Post
Ehm, so you're in the process, right?

The lazy way:
unsigned long *adr = (unsigned long *)0x07A4F60;
*adr = value;

You don't need to use OpenProcess when your dll is injected (as far as I know).
Thank you so much, your method worked :X
CantShutMyMouth is offline  
Reply




All times are GMT +1. The time now is 23:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.