Search code examples
c++pointers

Make a structure that the compiler always places at a hardcoded offset in the PE file


Basically what I am trying to do, is make a struct, that the compiler always places at a pre-defined position. My goal is to make another program that will be able to find that structure with a hardcoded pointer. Is this possible? Or are there any better ways to do this?

EDIT

To clarify what exactly I am trying to do:

I have a couple of strings in my program which I want to properly protect, without a server. My idea was to make a sort of a metamorphic program, which decrypts the strings everytime it launches, and when it closes, it encrypts the strings again, but with another key. It would run a second process, which would kill the first one, and write the new encrypted strings and keys to the struct, and would then shut down. This might not be the best method to protect the strings, but I recently got interested in the PE format, and I figured it would be fun to do it this way.

Whats the -1 for? I thought I the question was fairly clear D:


Solution

  • I no longer need this. I have only just found out about how to use the resources.

    If anyone needed something similar to this:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms648008(v=vs.85).aspx#_win32_Updating_Resources

    This solved my whole problem.