I found myself working on another inherited application this week. As it with all inherited applications, especially ones as old as this one, the processes around deployment were a mess. In fact, most deployments had been done by hand with no standards around the deployment location. How was I supposed to write an upgrade for an application when I didn’t even know where it was installed?
At least the ActiveX DLL’s details were in the registry – retrieving them was a pretty simple two step process; you just need to know the name of one of the classes within your DLL.
Step 1 – Find the Class ID
Unfortunately the majority of the details are not stored neatly under the class name, everything is stored under the Class GUID. However, the registry does have a mapping of the name to the GUID. The class name is actually key under HKEY_CLASSES_ROOT.
ReadRegStr $0 HKCR "MCVSEC.ImcvSecurity\CLSID" ""
Look for the Class name under HKEY_CLASSES_ROOT, under which there should exist a CLSID key. The default entry, under the CLSID key, should contain the GUID.
NOTE: if this returns nothing then the DLL has not be registered correctly.
Step 2 – Find the DLL properties
Using the Class GUID, you can now read the registry to find all of the details. All class GUID’s are keys under the CLSID key in HKEY_CLASSES_ROOT.
ReadRegStr $1 HKCR "CLSID\$0\InprocServer32" ""
You can retrieve many details, such as version, but the path to the DLL is the default entry under the ‘InprocServer32’ key.
Thus $1 now has the path to the DLL, so you can now do anything to it such as unregistering and deleting.
A full example script is as follows:
1: ;------------------------------------------------------------------------------------------------------------
2: ;-- Includes
3:
4: !include "Sections.nsh"
5: !include "MUI2.nsh"
6:
7: ;------------------------------------------------------------------------------------------------------------
8: ;-- Installation Configuration
9:
10: Name "DLL Update"
11: Caption "$(^Name) Setup"
12: OutFile "DLLUpdate.exe"
13:
14: SetDateSave on
15: AllowRootDirInstall true
16:
17: ShowInstDetails show
18:
19: ;-- GUI configuration
20: !define MUI_ABORTWARNING
21: !define MUI_FINISHPAGE_NOAUTOCLOSE
22: !define MUI_COMPONENTSPAGE_SMALLDESC
23:
24: ;------------------------------------------------------------------------------------------------------------
25: ;-- Pages
26:
27: !insertmacro MUI_PAGE_WELCOME
28: !insertmacro MUI_PAGE_INSTFILES
29: !insertmacro MUI_PAGE_FINISH
30:
31: ;------------------------------------------------------------------------------------------------------------
32: ;-- Languages
33: !insertmacro MUI_LANGUAGE "English"
34:
35:
36:
37: Section "Upgrade DLLs"
38:
39: DetailPrint "Looking for TidyCOM.dll..."
40:
41: ReadRegStr $0 HKCR "TidyCOM.TidyObject\CLSID" ""
42: StrCmp $0 "" notfound 0
43: DetailPrint "TidyCOM DLL installed! Found CLSID = $0"
44:
45: ReadRegStr $1 HKCR "CLSID\$0\InprocServer32" ""
46: StrCmp $1 "" notfound 0
47: DetailPrint "TidyCOM Registered Path = $1"
48:
49: ; DetailPrint "Unregsitering TidyCom DLL"
50: ; UnRegDll "$1"
51: ; DetailPrint "Deleting old dll"
52: ; Delete /REBOOTOK "$1"
53:
54: Goto close
55:
56: notfound:
57: DetailPrint "TidyCom.DLL not found - or incorrectly registered"
58:
59: close:
60: DetailPrint "Finished"
61: SectionEnd
62:
63:
64:
I am sure that this is only one way to skin this particular cat, any comments or other methods are greatly appreciated.
Trackback URL for this post:
cialis dosage erectile dysfunction
from cialis dosage equivalent on Sun, 11/12/2011 - 21:13gay male brutal ball torture
from gay male clips on Sun, 16/10/2011 - 15:09- dgrinberg's blog
- Login or register to post comments