Archive: Substring Search


Substring Search
Hi,

I'am trying to write a script that find the path to an OCX or a DLL.


Section "Apex Test" Apex_01

;Open search
registry::Open /NOUNLOAD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs" "/N='apexexchangeXcontrol2.ocx'" .r0
StrCmp $0 -1 error

registry::Find /NOUNLOAD .r1 .r2 .r3 .r4

MessageBox MB_OKCANCEL '$$1 "path" =[$1]$\n\
$$2 "value" =[$2]$\n\
$$3 "string" =[$3]$\n\
$$4 "type" =[$4]$\n\
$\n\'

;Close search
registry::Close

error:


SectionEnd


The problem is that i have to give the full path ("/N='C:\Windows\system32\apexexchangeXcontrol2.ocx'") so that the plugins returm a result.

Is there a way to search for a substring in the key?

nsis already has built in registry support for this, use EnumRegValue and parse each path returned and look for your ocx/dll, to parse the returned string, you can do it yourself, or use the GetFileName macro (see E.1 "File Functions Header" in the nsis help file)