Sign in to follow this  
Followers 0
Maverick682

Start an application as a Service

6 posts in this topic

Hi Everyone

Wondering if someone could shed a bit of light on this one?

Below is my .reg file to install and run Ultravnc SC as a Service.

Here is my problem:

If I double click the file and install or import it into the registry, it works fine.

All of the instance are installed in the registry as follows:

VNCsupport

+Parameter

+Security

+Enum

If I try and run it with Run("REGEDIT /S "&"VNCsupport.reg") or Run("REGEDIT /S " "VNCsupport.reg")

I can only see the Security one installed as follows:

VNCsupport

+Security

Anyone any ideas, or if anyone has a better way that would be great because this is driving me nuts!!!!

Many Thanks

Maverick

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport]

"Type"=dword:00000110

"Start"=dword:00000002

"ErrorControl"=dword:00000001

"ImagePath"=hex(2):43,00,3a,00,5c,00,72,00,65,00,6d,00,6f,00,74,00,65,00,2d,00,\

74,00,65,00,73,00,74,00,5c,00,73,00,72,00,76,00,61,00,6e,00,79,00,2e,00,65,\

00,78,00,65,00,00,00

"DisplayName"="VNCsupport"

"ObjectName"="LocalSystem"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Parameters]

"Application"="C:\\remote-test\\winvnc.exe"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Security]

"Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\

00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\

00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\

05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\

20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\

00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\

00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Enum]

"0"="Root\\LEGACY_VNCSUPPORT\\0000"

"Count"=dword:00000001

"NextInstance"=dword:00000001

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Are you sure that it's not some slippery char or line in your script? because I tried the two methods - direct reg and Run func and both work great...

Edited by Authenticity

Share this post


Link to post
Share on other sites

Could always try RegWrite()


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Could always try RegWrite()

Thanks for your replies

It definatly won't work with the RUN command within Autoit.

This was the easy option, now it seems I have to go down AzKay's route.

As I have no idea how to start with the RegWrite commands, and I don't understand how to impement the above into Autoit, (Zero programming experience/knowledge) could someone please give me an example using the .reg above.

I looked at the command reference for RegWrite and RegDelete and came out it a cold sweat.

Once I have this one resolved I will need one to remove the entries.

Any assistance much appreciated

Maverick682

Share this post


Link to post
Share on other sites

Opt('MustDeclareVars', 1)

Global $HKLMpath, $HKLMpathPara, $HKLMpathSecurity, $HKLMpathEmum
Global $reg_expand_sz, $reg_binary

$reg_expand_sz = 'C:\remote-test\srvany.exe'

$reg_binary = '01001480900000009c000000140000003000000002001c000100000002801400ff010f000101000000000001000000000200600004'
$reg_binary &= '00000000001400fd01020001010000000000051200000000001800ff010f0001020000000000052000000020020000000014008d01'
$reg_binary &= '020001010000000000050b00000000001800fd01020001020000000000052000000023020000010100000000000512000000010100'
$reg_binary &= '000000000512000000'


$HKLMpath = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport'
$HKLMpathPara = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Parameters'
$HKLMpathSecurity = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Security'
$HKLMpathEmum = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VNCsupport\Emum'


RegWrite($HKLMpath, 'Type', 'REG_DWORD', 0x00000110)
RegWrite($HKLMpath, 'Start', 'REG_DWORD', 0x00000002)
RegWrite($HKLMpath, 'ErrorControl', 'REG_DWORD', 0x00000001)
RegWrite($HKLMpath, 'ImagePath', 'REG_EXPAND_SZ', $reg_expand_sz)
RegWrite($HKLMpath, 'DisplayName', 'REG_SZ', 'VNCsupport')
RegWrite($HKLMpath, 'ObjectName', 'REG_SZ', 'LocalSystem')

RegWrite($HKLMpathPara, 'Application', 'REG_SZ', 'C:\remote-test\winvnc.exe')

RegWrite($HKLMpathSecurity, 'Security', 'REG_BINARY', $reg_binary)

RegWrite($HKLMpathEmum, '0', 'REG_SZ', 'Root\LEGACY_VNCSUPPORT\0000')
RegWrite($HKLMpathEmum, 'Count', 'REG_DWORD', 0x00000001)
RegWrite($HKLMpathEmum, 'NextInstance', 'REG_DWORD', 0x00000001)

- Still need to work around to make the 'REG_EXPAND_SZ' unicode form.

Share this post


Link to post
Share on other sites

WOW WOW

Thanks Authenticty

You guys SCARE the living daylights out of me with what you can do programming in a short space of time.

I am not a programmer as you have probably gathered and know nothing about it.

Is there anything I need to do with the code apart from inserting it into Autoit?

Is there anything else required to make it work?

Thanks again

Maverick682

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0