Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi Everyone!

I have a problem with a memory address.
I know that the memory addresses always change if the softwares close and open.
The problem is the memory address will be different when I close the target application and open another times.

How do I accomplish that my program always find the right memory address?
I wanna read an exact value this is my plan.

Please help with an example (source code). :)
Posted
Comments
[no name] 8-Mar-15 11:54am    
What kind of value do you want to read?
Roland-HE-C# 8-Mar-15 12:01pm    
Hexadecimal values to make a statistic for me and use it.
These hexadecimal values are numbers they don't demand convertion.

But it's boring when I start my program before I must always search the memory address with another program like cheat engine to I'm able to use my program without mistakes.

I wanna my program find the right address.
[no name] 8-Mar-15 12:07pm    
Where do these values originate from? / Who or which program stores them at that memory address that you want to find?
Roland-HE-C# 8-Mar-15 12:17pm    
A flash software (what doesn't have childwindows).
I have an idea for it with opcodes and jump...
but I can't use opcodes programmatically.
Sergey Alexandrovich Kryukov 8-Mar-15 12:15pm    
Why all that? It does not seem to make any sense. Why would you need memory addresses? What are you trying to achieve?
—SA

In C# you almost never deal with memory addresses - in fact, you have to do two things at compile time in order to be allowed anywhere near them! First, you have to change your project properties to allow unsafe code, and then you have to mark the relevant code as an unsafe block in order to use pointers at all - and they are the only way to get an address.

You are not quite right to say "I know that the memory addresses always change if the softwares close and open." Memory addresses change "On the fly" while your application is running, as the stack usage changes, and as the Garbage Collector moved data around invisibly behind the scenes.

The whole idea behind C# is that you don't have to deal with memory yourself: so it's not easy (or safe) to even try.

What are you trying to achieve that you think you need this?
 
Share this answer
 
Comments
Roland-HE-C# 8-Mar-15 12:13pm    
I've read about Garbage Collector something it need unsafe running.

My plan is that I don't wanna use cheat engine before every running of my program.
With Cheat Engine I can find the address, but I want to find without it.
I think the opcodes helps me if I jump from it to the address of my target value.
OriginalGriff 8-Mar-15 12:23pm    
At this point I will say that I will have nothing to do with this, as it is bordering right on the edge (and possibly a distance over the edge) of becoming malicious code: and we do not get involved in that in any way shape or form.

Cheating games is unfair, immoral, and can cause financial loss to others (depending on the game) and we are professionals, on a site for professional. I suggest you take your queries to a hacking site which is less likely to see anything wrong with your behaviour.
Roland-HE-C# 8-Mar-15 12:50pm    
I don't want to cheat I wanna make a statistic for me to I will be better in that game.
[no name] 8-Mar-15 12:57pm    
See if that "Cheat Engine" is a .Net application and if so, try to decompile it and learn how they did it there.
Roland-HE-C# 8-Mar-15 13:34pm    
I don't know how the decompiling works.
I see a lots of opcodes mov, push, dword, xor...etc. and I don't understand they how work.
You are talking about managed memory. Let me tell you that the problem itself is not correctly posed. "Managed addresses" are not just something which is tricky to work with, never needed, or like that. The thing is: in certain sense, they don't even exist. The mapping between process linear memory of the process and CLR references is volatile and can be changed during the whole lifetime of a referenced object and all references to it. You can obtain some pointer only when you pin the object:
https://msdn.microsoft.com/en-us/library/23acw07k%28v=vs.110%29.aspx[^],
http://geekswithblogs.net/robp/archive/2008/08/13/speedy-c-part-3-understanding-memory-references-pinned-objects-and.aspx[^],
http://www.narfsoft.com/blog/memory-control-in-net-pinning-down-objects[^].

In all out discussion, you never explain the purpose of your activity; you simply go rounds. I see no evidence that you know your own purpose. If you think I'm wrong, you are more than welcome to explain this purpose. None of your explanations so far was not related to the purpose.

[EDIT]

You asked for some code sample. You can find one here: https://msdn.microsoft.com/en-us/library/f58wzh21%28VS.80%29.aspx[^].

Please don't tell me "this is not what I want". First, try to convince me that what you want makes sense; so far, I doubt that. That was my note, just in case.

—SA
 
Share this answer
 
v2
Comments
Roland-HE-C# 10-Mar-15 3:54am    
The advantage/target of my plan is that I get the necessary knowledge to my project.
My project is an application that automatically write datas from another program in a txt file and in a textbox.

My program is work well but it's not excellent for me yet.
I can't write in my program constant memory address because that doesn't work more than one times so next time I must be search again the necessary memory address to my program to work well.

The necessary memory address what is needed to me it every runtime changes.
And I need your help to solve my problem. :))
Sergey Alexandrovich Kryukov 10-Mar-15 7:40am    
Well, it is interesting, but what is that program do? What is another program? One fixed program or anything? .NET application?
First, you said that it "writes datas from another program in a text file and in a textbox". It means that it reads from memory. Below, you said "I cannot write in my program...". So, do you read from process's memory or write?
And why doing it all?
—SA
Roland-HE-C# 10-Mar-15 9:14am    
Yes I read process memory (kernell.dll).
And I learn something during the last days about it thank you too.
I wanna use a pointer or pointers to always have a fix memory address for me. :))
But I currently can't work with pointers to write sourcecodes.
Sergey Alexandrovich Kryukov 10-Mar-15 10:54am    
I think I explained the reason why in .NET applications nothing is fixed. And I still don't understand why you are doing all that.
—SA
Roland-HE-C# 10-Mar-15 11:22am    
I've explained everything above.
But I asked a code example for pointer using to memory address.
Please write me one. :))

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900