Hello colleagues. The task is as follows:

There is my lib loaded into another address space of another application. There is my application with buttons. How can I call functions from my location in a foreign address space? And it is also desirable to receive result from this. One option is to use the CreateRemoteThread function. But I have no experience of using information on the Internet bit. Please, help. Sincerely.

  • one
    There is an option to be attached to the debugger, and after that, immediately a lot becomes available. But if yours, is it possible to finish / rewrite it? or it is impossible to touch her? - KoVadim Nov.
  • one
    If this is at all possible, then it does not matter whether it is its own or “foreign” library. Apparently important are the rights of access to the context of another process. - avp
  • My library, you can add. I look at File-mapping, I just have no experience, I have to read and learn very, very much :) - Grigory Ponomarev

1 answer 1

There are so many different interprocess communication methods. I think that sockets will be suitable for your task. The most common sockets. The library creates itself a thread in which it creates a server socket and listens on localhost. Since the library is in a different address space, it can do a lot in it, which is not allowed so easily to your application.

Here you need to think only about two situations - when to turn on the server (for example, when loading the library itself or after calling a particular function) and what to do if your library uses two or more applications. Here probably a beautiful solution will not create a tcp socket, but udp and all client applications can also exchange data. But on the other hand, no one bothers your application to become a server, and the library tries to connect from time to time.

  • If this is a solution to the problem (the answer is accepted), then is it not clear where is the library in another address space ? - avp