|
Stack memory is managed by your code when it calls push and ret which decrement and increment the stack pointer respectively. (This is of course assembler, which is what your C code ends up as).
Heap is allocated and deallocated respectively by calls to malloc and free, or new and delete, or any of the other heap managemet funcs.
You should be aware of static memory too. It is allocated for the program when it loads, and contains all the variables you declare as static and all global variables. It also contains all the strings you declare in your code, such as char data[] = "my string". Have a shufti here: http://en.wikipedia.org/wiki/Data_segment[^]
==============================
Nothing to say.
|
|
|
|
|
Hey,
I've asked this question on Stack Overflow, as you probably have seen if you're active there, but they said my project was illegal therefore nobody helped me (though, I proved them there are lots of projects like mine) - my project is just about injecting a piece of code into a game (namely Grand Theft Auto VC) to create a big mod (multiplayer, I wouldn't like to say my current ideas just for the sake of not getting stolen, though sooner or later when I release the project there will be someone who will copy some of them anyway; and I think that's not necessary either).
Through the development process of the project, I came up with some questions:
1. Is it better to use Assembly to call a pointer returned by
GetProcAddress or type cast it and call it directly from C++?
__asm call pointer
vs
typedef int (*DOWINMAIN) ( HINSTANCE, HINSTANCE, LPSTR, int );
DOWINMAIN pDoWinMain = (DOWINMAIN)GetProcAddress ( hModule, "DoWinMain" );
2. As I mentioned above, my project is based on code injection, the thing is: DEP (Data Execution Prevention) doesn't let the program edit the game's memory, unless I, of course, disable it. Is there a way to inject the code without DEP caughing the program or do I really have to disable DEP definitely? Can that be made in C++ or do the users have to manually disable it?
Thanks for reading
|
|
|
|
|
Though i don't support idea of injecting code in different application. however you may require it create different feature available in application, which don't expose plugin or support extensiblity.
However it totally depends on person's ethics. since if not coded properly or poorly its may result in bad then good.
ixjf wrote: DEP (Data Execution Prevention) doesn't let the program edit the game's memory, unless I, of course, disable it. Is there a way to inject the code without DEP caughing the program or do I really have to disable DEP definitely? Can that be made in C++ or do the users have to manually disable it?
I doubt that, I believe user should know this before actually confirming it. also it keep your app on high moral ground. since i believe you are not making virus.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I'm not, I can even give you the link to my repository so you can see the code (I haven't uploaded the new code, that one is old and gay ahah).
Repo is here: https://bitbucket.org/ixjf/vice-city-orange/overview[^]
I'll upload the new code ASAP, I know this code doesn't show you much, but I'll keep adding new code and you'll see.
As for the DEP, I think it's quite painful to have to disable DEP for the program, even though the user should know it needs that, and I know some softwares disabled DEP automatically (e.g. MTA:SA (another MP)) and I would like to know how could I do it (perhaps I could leave a message to the user saying DEP will be disabled for the software because..?)
|
|
|
|
|
ixjf wrote: s for the DEP, I think it's quite painful to have to disable DEP for the program, even though the user should know it needs that, and I know some softwares disabled DEP automatically (e.g. MTA:SA (another MP)) and I would like to know how could I do it (perhaps I could leave a message to the user saying DEP will be disabled for the software because..?)
better leave choice to user then you doing for them. also this will reduce complexity in your program
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ixjf wrote: I think it's quite painful to have to disable DEP for the program
and i think it's pretty sh*tty that a program would try to do that without telling me.
|
|
|
|
|
Whatever, it's your opinion.
Anyway, let's leave that question aside. Can somebody answer my 1st question?
|
|
|
|
|
Better compiler decide for the assembly code then you! , though performance wise direct assembly code is good, however it make program difficult to understand, if some other user is working on that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I doubt you will get much help from CP users either.
Disabling DEP, either globally or on individual applications, has to be done by the end user.
|
|
|
|
|
ixjf wrote: 1. Is it better to use Assembly to call a pointer returned by
Shouldn't matter.
ixjf wrote: Can that be made in C++ or do the users have to manually disable it?
Best as I can tell based on what you say you are doing the answer to that shouldn't matter, but another thread said that the user must allow it.
|
|
|
|
|
Right, thanks for answering
|
|
|
|
|
I need to know whether wide characters can be inserted directly into a sqlite3 database...i need some examples of the same..plz help me
|
|
|
|
|
|
|
sir i have tried them but i'm not getting any idea...also my doubt is that whether the insert query only satisfies string variables?
|
|
|
|
|
Hello all,
I am using OnShowWindow() in CDialogs to do somethings when a dialog become visible after it was hidden.
I want to do the same thing for a property page and then calling the function OnShowWindow() doesn't do anyhing, because this function doesn't get called when the property page becomes visible after it was hidden.
I can use OnPaint() and that works fine. But i want to avoid using OnPaint() as that get called for so many reasons.
Where as OnShowWindow() is exclusive when a window is displayed after it was initially hidden.
So is there a different function i can use in CPropertyPage when it becomes visible?
Thanks in advance.
|
|
|
|
|
|
This function get's called only when the Propertypage is displayed, like while navigating through the tabs.
I want it to be called when i go from ShowWindow(false) to ShowWindow(true)
i.e., when the property page is displayed after it was hidden. And this function doesn't get called in that scenario.
And you said override this, can you explain how to do that? Will that work for my scenario?
|
|
|
|
|
I'm not completely clear of your requirement, but I guess my earlier solution should work for you.
What I mean by override is to create a new class that derives from CPropertyPage , write the method OnSetActive in this class and use this class to create the property pages.
|
|
|
|
|
Hi guys. I like to make a parser for my own programming language in c++.can anybody help me. Thank you
|
|
|
|
|
A programming language requires more than just a 'parser'.
If you are serious then you should buy the Dragon book. You might want to look into lexx and yacc as well (there are books for those.)
If you just want to mess around then code it. If you get serious then the first time experience will provide a constrast for later work.
Other than that you define the syntax before you start coding.
|
|
|
|
|
You might write yourself from scratch or use Boost.Spirit[^] (or, if you prefer a C -like approach, the classical tools Flex[^] and Bison[^]).
Veni, vidi, vici.
|
|
|
|
|
Hello
I have a c#.net project which I need to incorporate into c++ project. Preferably compile it as a static library and link it in C++ project.
If this is possible please guide me how to go ahead with this. I came across this link but I found it difficult to understand the procedure. Secondly my application is a desktop based and not client server based. Please learned people help me.
Thanks
|
|
|
|
|
|