Pascal Scripting: DecrementSharedCount


function DecrementSharedCount(const Is64Bit: Boolean; const Filename: String): Boolean;


Decrements the reference count for the specified file in the following registry key:


64-bit versions of Windows have two separate SharedDLLs keys, one for 64-bit files and one for 32-bit files. If Is64Bit is True, the 64-bit SharedDLLs key will be updated, otherwise the 32-bit SharedDLLs key will be updated. The setting of this parameter should correspond to the bitness of the file; for example, if it is a 32-bit DLL located in the 32-bit System directory, you should specify False. You may also specify Is64BitInstallMode in which case it will use the current install mode to determine which key to open.

Returns True if the count reached zero (meaning it's OK to delete the file). Returns False if the new count is greater than zero, or if the value for the file doesn't exist or is in an unrecognizable format.

An exception will be raised if the registry key cannot be opened for write access.