|
#1
|
|||
|
|||
|
How to check & uncheck an option in a preactivated service?
I have a program that I must follow the following steps manually to run it as a service:
Best Regards |
|
#2
|
||||
|
||||
|
SF has built-in actions to start/stop/query services, so I guess the question is how to set/reset "Allow service to interact with desktop"
Make sure box is un-checked and goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\<service_name> Check the value of "Type" Now check the box "Allow service..", apply, refresh Regedit window and check the value of Type again. If I correctly remember this is the change that has to be made to set/reset desktop interaction directly (but you may do a registry snapshot immediately before and after the change and compare). Needless to say, check this on several systems. Also I'm not sure when the change becomes effective - immediately or after a service (re)start. Last edited by pww; 11-09-2008 at 03:25 AM. |
|
#3
|
|||
|
|||
|
Thank you very much dear PWW,
Worked great Quote:
Best Regards P.S: For future needers: Under windows XP Last edited by searcher123; 11-09-2008 at 06:18 AM. |
|
#4
|
||||
|
||||
|
Quote:
To allow a service to interact with desktop, the 8-th bit of 'Type' value must be set to 1. Or in other words, you should OR the current value (when Desktop interaction is disabled) with 256 decimal to set the 8-th bit to 1 and enable it. To disable Desktop interaction , you should reset the 8-th bit. So values of 16 and 272 are valid for your particular case/service only. Last edited by pww; 11-09-2008 at 08:08 AM. |
|
#5
|
|||
|
|||
|
Quote:
![]() So, the following code will set Allow service to interact with desktop checked for any service: Code:
nType = Registry.GetValue(HKEY_LOCAL_MACHINE, "System\\CurrentcontrolSet\\Services\\<ServiceKeyName>", "Type", true); nNewType = nType + 256 Registry.SetValue(HKEY_LOCAL_MACHINE, "System\\CurrentcontrolSet\\Services\\Alerter", "Type", SessionVar.Expand(nNewType), REG_DWORD); Code:
nType = Registry.GetValue(HKEY_LOCAL_MACHINE, "System\\CurrentcontrolSet\\Services\\<ServiceKeyName>", "Type", true); nNewType = Math.Abs(nType - 256) Registry.SetValue(HKEY_LOCAL_MACHINE, "System\\CurrentcontrolSet\\Services\\Alerter", "Type", SessionVar.Expand(nNewType), REG_DWORD); |
|
#6
|
||||
|
||||
|
well the best way would be to bitwise OR the current value with 256 decimal to enable, and to bitwise AND the current value with 65279 decimal to disable.
But AFAIK Lua doesn't support bitwise operations. Maybe there is a plugin or something for the purpose. In your case Type has known values, so you may -to set - if current value < 256, add 256, else do nothing(already set) -to reset - if current value >256, subtract 256, else do nothing(already reset) Setting Type to Math.Abs(nType - 256) may cause a mess if desktop interaction is already reset |
|
#7
|
|||
|
|||
|
I wrote a simple utility for eliminating this leakage in SF. The attached will bitwise AND, OR and XOR two number and return the result to SF or show it on Command Com window. I hope be useful for future needers.
Best Regards |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command: Stop Service & Start Service ??? | linhardt | Setup Factory 6.0 | 3 | 07-13-2004 01:14 PM |
All times are GMT -6. The time now is 10:39 PM.










Linear Mode

