Old 12th June 2006, 18:26   #1
BashLogic
Junior Member
 
Join Date: Jun 2006
Posts: 8
case finally closed!!!

ok guys

just to answer my own question,

appearently the service plugin is not able to enable a disabled service. even if you would enable a service from the registry, the net start (which equate to the service plugin) wont be able to start the service because in the service manager db the service is still registered to be in the previous state.

for each service there are two places (if im not mistaken) where information is stored regarding its state, its own registry path/key and the service manager db.

enabling the service from the registry path/key(start|dword) alone would not suffice, you would either have to do it thru the service mmc gui or... you can you the sc.exe to do it!

so if you have a disabled service, enable it first with the sc tool (if not found on your system, you can find it in the reskit) with the command "sc config msiserver start= demand" and after that use the service plugin to startup the service!

here is a sample script that does that, dirty but does the job

regards
BL
---8<------8<------8<------8<---
OutFile findservices.exe
section
;enable service from console
execwait "sc config msiserver start= demand"

;check if service is running
services::IsServiceRunning 'MSIServer'
Pop $0
StrCmp $0 'Ok' success 0
MessageBox MB_OK|MB_ICONSTOP 'Service running status: $0 (3= enabled!)' 0 0
success:

;read service registry status value
ReadRegDWORD $0 HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\MSIServer" "Start"
Pop $0
MessageBox MB_OK|MB_ICONSTOP 'value: $0' 0 0

;startup service
services::SendServiceCommand 'start' 'MSIServer'
Pop $0
StrCmp $0 'Ok' success1 0
MessageBox MB_OK|MB_ICONSTOP 'Service start command status: $0' 0 0
success1:

; check that service started
services::IsServiceRunning 'MSIServer'
Pop $0
StrCmp $0 'Ok' success2 0
MessageBox MB_OK|MB_ICONSTOP 'Service running status: $0 (3= enabled!)' 0 0
success2:


SectionEnd
---8<------8<------8<------8<---
BashLogic is offline   Reply With Quote
Reply
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