Archive: Find dll files in all directories listed in the PATH variable


Find dll files in all directories listed in the PATH variable
I need to find a DLL in a list of directories, e.g. in the PATH variable.

PATH = "c:\aaaa;c:\bbbb" etc

I have written a method that reads the registry and splits the string with a STRTOK method I found in the NSIS wiki:

Function readPathVar
ReadRegStr $0 HKLM "${REG_ENVIRONMENT}" "Path"
Push $0
StrCpy $1 $0
${While} $0 != ""
Push ";"
Call StrTok
Pop $0
${If} $0 == ""
FindFirst $2 $3 $0\some.dll
FindClose $2
${If} $3 != ""
${NSD_CB_AddString} $ComboBox "$1"
${EndIf}
${Else}
FindFirst $2 $3 $0\some.dll
FindClose $2
${If} $3 != ""
${NSD_CB_AddString} $ComboBox "$0"
${EndIf}
${EndIf}
Pop $1
Push $1
${EndWhile}
FunctionEnd


I works for all items but the last one, so the path "c:\bbbb" is never searched for the dll.
Also it doesn't work if the PATH looks like this:

PATH = "c:\aaaa;;c:\bbbb" etc

The duplicate ';' character will not deliver all tokens in the string.
Isn't there an easy way to split a string in NSIS?
Or is there a plugin that can find a file in a list of directories?

From the NSIS Users Manual:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2