Prev Previous Post   Next Post Next
Old 26th February 2016, 19:13   #1
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
Windows service install directory

Hi All,

In my installer, I have to search for an existing windows service and get the parent directory of the executable that is running this service. Since I don't know the exact name of the service but know what string it begins with, I loop around the
HKLM System\CurrentControlSet\services and get the exact service name. Then I use the SimpleService plugin:

SimpleSC::GetServiceBinaryPath "$servFound"
Pop $0
Pop $1

Which returns($1) something like this:
"C:\Program Files\XXX\YYY\zzz\exec.exe" //RS//XX_YY

I need to get this out from this string : C:\Program Files\XXX\YYY\zzz

The problem is if the service is running in any other directory than the ProgramFiles, there is no quotes around it, something like this:

C:\Blah\XXX\YYY\zzz\exec.exe //RS//XX_YY

I tried using the GetFirstStrPart function,

http://nsis.sourceforge.net/Get_first_part_of_a_string

Which works fine but not if there is Program Files in the path. I have also tried GetInQuotes:

http://nsis.sourceforge.net/GetInQuo...between_quotes

But problem is it wouldn't work if there are no quotes.

Any suggestions on how to get the directory path no matter there are quotes or not will be very helpful.

--Pavan
pkonduru is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump