Como substituo uma DLL em uso?
Dynamic-Link Library Updates
It is sometimes necessary to replace a DLL with a newer version. Before replacing a DLL, perform a version check to ensure that you are replacing an older version with a newer version. It is possible to replace a DLL that is in use. The method you use to replace DLLs that are in use depends on the operating system you are using. On Windows XP and later, applications should use Isolated Applications and Side-by-side Assemblies.
It is not necessary to restart the computer if you perform the following steps:
- Use the
MoveFileEx
function to rename the DLL being replaced. Do not specifyMOVEFILE_COPY_ALLOWED
, and make sure the renamed file is on the same volume that contains the original file. You could also simply rename the file in the same directory by giving it a different extension.- Copy the new DLL to the directory that contains the renamed DLL. All applications will now use the new DLL.
- Use
MoveFileEx
withMOVEFILE_DELAY_UNTIL_REBOOT
to delete the renamed DLL.Before you make this replacement, applications will use the original DLL until it is unloaded. After you make the replacement, applications will use the new DLL. When you write a DLL, you must be careful to ensure that it is prepared for this situation, especially if the DLL maintains global state information or communicates with other services. If the DLL is not prepared for a change in global state information or communication protocols, updating the DLL will require you to restart the computer to ensure that all applications are using the same version of the DLL.
Fonte Atualizações da biblioteca de vínculo dinâmico (Windows)
How to replace in-use files at Windows restart
This article describes another method you can use to replace files that are in use by Windows. This method uses the registry to replace a file at startup, before the file is accessed by Windows.
The following steps demonstrate how to replace the Win32k.sys file in the
%SystemRoot%\System32
folder with the Win32k.sys file located in the C:\Temp folder. You can use variations of this method to replace any file if your installation of Windows is bootable.
- Start Registry Editor (Regedt32.exe).
- Locate the following key in the Windows registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
- Create a new value by using the following information:
- Value name: PendingFileRenameOperations
- Data type :
REG_MULTI_SZ
- Value data: \??\c:\temp\win32k.sys !\??\c:\winnt\system32\win32k.sys
- Note that the value data is typed on two separate lines.
- Quit Registry Editor.
- Restart the computer.
Origem Como substituir em arquivos de uso no Windows são reiniciados