Skip to main content

How to find locked binaries as part of upgrade/fresh installation?

How to find locked binaries as part of upgrade/fresh installation?
When you upgrade an application using windows installer many a time you might have come across issues like the files which you wanted to overwrite or delete is already in use or in another way some other application is already using that binary. In such cases, the windows installer will show a FilesInUse dialog. However, the problem here is this dialog will show only the application name which is consuming the binary and not the actual binary name. This has 2 problems, in case of a simple application which a handful of binaries we can easily figure out the binary getting locked, however in case of a large application with several binaries and run times it might be tricky to find out such locked binaries. The problem gets even more complicated if this scenario occurs in an environment where you don't have access, for example, a customer environment.

Let me briefly explain how installer identifies and shows the application which is consuming our binaries. As part of the install costing process, installer identifies the files which are in use and it populates an internal "FilesInUse" table. As part of the InstallValidate custom action, this table will be queried and the information will be shown in msiRMFileInUse dialog. I have done a lot of google search and I couldn't find a way to extract the file in use information from "FilesInUse" table. Having said that, you can use the below tools to find this,

  1. To check which application is consuming your dll, you can use the Sysinternals utility "Listdlls" and here is the command listdlls -r -d <dll name>
  2. You can run the utility without any parameters and it will dump all the application and its loaded dlls

Sometimes listdlls utility will not find the locked dlls and in that case you can use handle.exe which is another sysinternal utility to find out if somebody has a handle to that binary/file

For example
     handle.exe <full path to the binary>

If both the above fails, another option is to use procmon utility to find out what is happening with the installer and this can give you some clue. As you can see in the below screenshot, the installer is trying to write something to the highlighted registry key (HKEY_CURRENT_USER\Software\Microsoft\RestartManager\Session0000\RegFiles0000) and this key contains the value to locked binaries. Note that the key will be available as long as the FileInUse dialog is active and once you cancel the dialog the registry value will get cleaned up



In summary, based on your situation, you can use one of the above-mentioned tools or registry key to find out locked binaries

Comments

Popular posts from this blog

Unicode and UTF8 Encoding

Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language. Unicode officially encodes 1,114,112 characters, from 0x000000 to 0x10FFFF. (The idea that Unicode is a 16-bit encoding is completely wrong.) For maximum compatibility, individual Unicode values are usually passed around as 32-bit integers (4 bytes per character), even though this is more than necessary. The consensus is that storing four bytes per character is wasteful, so a variety of representations have sprung up for Unicode characters. The most interesting one for C programmers is called UTF-8. UTF-8 is a "multi-byte" encoding scheme, meaning that it requires a variable number of bytes to represent a single Unicode value. Given a so-called "UTF-8 sequence", you can convert it to a Unicode value that refers to a character. http://www.cprogramming.com/tutorial/unicode.html There are 3 types of encoding in unicode, UT

Base64 Encoding

The base-64 encoding converts a series of arbitrary bytes into a longer sequence of common text characters that are all legal header field values. Base-64 encoding takes a sequence of 8-bit bytes, breaks the sequence into 6-bit pieces, and assigns each 6-bit piece to one of 64 characters comprising the base-64 alphabet. Base 64–encoded strings are about 33% larger than the original values. For example “Ow!” -> “T3ch” 1. The string “Ow!” is broken into 3 8-bit bytes (0x4F, 0x77, 0x21). 2. The 3 bytes create the 24-bit binary value 010011110111011100100001. 3. These bits are segmented into the 6-bit sequences 010011, 110111, 01110,100001.

How to configure Microsoft SQL Server in EAP/Wildfly

Wednesday, December 11, 2019 9:19 AM Download the appropriate jdbc driver from https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 Extract the driver package to the modules folder under EAP Here is from where my EAP is running C:\Users\admin\EAP-7.0.0\ Create a folder named "sqlserver" under C:\Users\admin\EAP-7.0.0\modules\system\layers\base\com\microsoft Copy the extracted driver jar file (for example mssql-jdbc-6.4.0.jre8.jar) to C:\Users\admin\EAP-7.0.0\modules\system\layers\base\com\microsoft\main Now create a modules.xml file in   C:\Users\admin\EAP-7.0.0\modules\system\layers\base\com\microsoft\main with the following settings <?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver">     <resources>         <resource