|
You last visited: Today at 23:41
Advertisement
I need some help...
Discussion on I need some help... within the C/C++ forum part of the Coders Den category.
02/22/2013, 08:36
|
#1
|
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 DllMain( IN 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;
}
}
|
|
|
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
|
|
|
02/22/2013, 09:28
|
#3
|
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
|
Quote:
Originally Posted by theredvex
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 ....)
|
|
|
02/23/2013, 20:32
|
#4
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
|
First learn C++ before you try to do ANYTHING with C++.
|
|
|
02/24/2013, 01:20
|
#5
|
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
|
|
|
02/24/2013, 01:45
|
#6
|
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?
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?
|
|
|
02/24/2013, 16:19
|
#7
|
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:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
;
DWORD Id;
HANDLE ProcessHandle;
int value;
unsigned adress = 0x07A4F60;
GetWindowThreadProcessId(FindWindow(0,"Client"),&I d);
cout << Id << endl;
ProcessHandle = OpenProcess(PROCESS_VM_WRITE |PROCESS_VM_OPERATION ,false,Id);
cout << "ProcessHandle: " << ProcessHandle << endl;
value=1967458304;
fflush(stdin);
WriteProcessMemory(ProcessHandle,(LPVOID)adress,&v alue,sizeof(int),NULL);
}
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
|
|
|
02/24/2013, 16:49
|
#8
|
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?
|
|
|
02/24/2013, 16:50
|
#9
|
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 :|
|
|
|
02/24/2013, 19:08
|
#10
|
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).
|
|
|
02/24/2013, 21:13
|
#11
|
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.
|
|
|
03/02/2013, 20:55
|
#12
|
elite*gold: 0
Join Date: Apr 2012
Posts: 380
Received Thanks: 163
|
Quote:
Originally Posted by snow911
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
|
|
|
All times are GMT +1. The time now is 23:42.
|
|