I need some help...

02/22/2013 08:36 CantShutMyMouth#1
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;
      }
      
         } 
02/22/2013 09:20 theredvex#2
I think your memory address is not static looks like you need a pointer
02/22/2013 09:28 CantShutMyMouth#3
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 :D
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 Delinquenz#4
First learn C++ before you try to do ANYTHING with C++.
02/24/2013 01:20 schneider1424#5
delin he a begginer how he learn without doing anything in C++
+ He need help so help or dont say crap like learn c++ 1st when he already learning it
02/24/2013 01:45 Delinquenz#6
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 ([Only registered and activated users can see links. Click Here To Register...]) 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 CantShutMyMouth#7
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 :D
And thanks "schneider1424" too for supporting me
02/24/2013 16:49 Delinquenz#8
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 CantShutMyMouth#9
#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 snow#10
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 Delinquenz#11
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 CantShutMyMouth#12
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