We have a program that runs as a service (S.EXE) and loads a dll (A.DLL), this dll calls another dll (B.DLL) which in turn calls yet another dll (C.DLL) in order to perform some device functions. We have the source code from S.EXE, A.DLL and B.DLL but C.DLL is an old driver library for a magnetic card reader (MCR) from a third party and i don´t have the source code, i have the LIB files and the header files.
The problem is that under some circunstances C.DLL "hangs" while using the MCR and the service can not longer perform the functions related with it. In development and testing environments we can just restart the service and continue working, however in production environment this is not possible because of user permissions and they have to restart the machine seriously affecting the operation.
How can i unload the dlll in my VC++ program? I need to continue the execution of the service and that the next time C.DLL is needed it loads just like the very first time. I looked at the code of B.DLL and there is not LoadLibrary or CreateInstace or GetProcAddress. In that project there are only the includes of the header files of C.DLL, the LIB files of C.DLL and the function call.
Pd: This is not MFC or ATL, just a DLL with standard windows libraries.