FreeLibrary question
-
Any way to force process to unload library???? I working on update component ( oracle ), it seems i can do LoadLibrary and FreeLibrary when needed just ok, except for dll's been locked by OS. I am aware of debug setting for that tells XP to unload every library it is not been used, but this is way to drastic. Couple of other options comes to mind, but I don't want to reinvent the wheel and not even sure it would work. 1) From process A create process B, when done exit B hoping cleanup would unload DLL or may be just issue plain kill. 2) allocate memory, load dll (PE), do fixup entry table etc etc etc as long as darn LoadLibrary is not been used. 3) Call freelibrary until XP frees stupid library or I blow away my stack. 4) Other options? Thanks, Brian
-
Any way to force process to unload library???? I working on update component ( oracle ), it seems i can do LoadLibrary and FreeLibrary when needed just ok, except for dll's been locked by OS. I am aware of debug setting for that tells XP to unload every library it is not been used, but this is way to drastic. Couple of other options comes to mind, but I don't want to reinvent the wheel and not even sure it would work. 1) From process A create process B, when done exit B hoping cleanup would unload DLL or may be just issue plain kill. 2) allocate memory, load dll (PE), do fixup entry table etc etc etc as long as darn LoadLibrary is not been used. 3) Call freelibrary until XP frees stupid library or I blow away my stack. 4) Other options? Thanks, Brian
Do what everyone else does. You use MoveFileEx to get the files copied to the correct places during the system restart. Prior to restarting, add a RunOnce program that will register the DLL while the system is starting up. Tell user to reboot system. This is the 'recommended way to repalce DLL that are in use. Look at all the MS security udpates, constant reboots of machine, eh? Works for them.. should work for you!