Perhaps it would be easier for you to just have ProgramA load/unload the DLL
dynamically at runtime rather than link to it statically at compile-time.
That way, ProgramB could send a message to ProgramA asking it to unload the
DLL, then do whatever it needs to do with the DLL, and then send another
message telling ProgramA to re-load the DLL again. That way, ProgramA does
not need to be shut down anymore.
If you are going to go that route, then I would suggest two alternatives
1) have ProgramA run ProgramB with the same rights as ProgramA, then have
ProgramB run ProgramC elevated, and have ProgramC perform the actual tasks
that need to be run on the DLL. ProgramB can then run ProgramA after
2) move the tasks that need to be performed on the DLL into a COM object,
and have ProgramB instantiate it elevated. ProgramB can then be run with
the same rights as ProgramA. Better, if you use a COM object, and let
ProgramA dynamically load/unload the DLL, then ProgramA can instantiate the
elevated COM object directly and you won't need ProgramB at all.
Remy Lebeau (TeamB)