Peretz
Peretz

Reputation: 1126

which process creates my DLL process?

I am integrating a third party's application with my DLL. The DLL is created and destroyed several times per each run of the third party's software.

From my DLL, I need to recognize if it is the same third party's run or a different one that is creating me. Is there a way to recognize which process of the third party software is creating me?

Upvotes: 1

Views: 85

Answers (1)

Mark Wilkins
Mark Wilkins

Reputation: 41252

If the DLL is being unloaded each time, then it will likely need some kind of persistent storage between each time it is loaded. If the calling application does not provide this information, then the DLL itself will need to perform that.

One possibility might be to use named shared memory. If it does not exist, create it and then use that as the "flag" to know that it is being called again in the same execution. When the process exits, it will be destroyed. There are, of course, security implications with this that would need to be considered. Another process could potentially create that shared memory to make your DLL "think" that it was being called again in the same run when it was actually the first invocation.

Upvotes: 2

Related Questions