VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Install Windows NT Service

Matthew Ruffell  (3 Submissions)   Windows System Services   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

Install a Windows NT service on a local or remote server. Configure how the service is installed. Requires Windows NT and administrator rights.

Inputs
ServiceFileName [string] = binary service file path and name, ServiceName [string] = name of service, DisplayName [string] = unofficial name of service, Interactive [boolean] = communicates with desktop, AutoStart [boolean] = run when system starts, MachineName [optional string] = target server name

Assumes
Requires Windows NT and administrator rights.

Returns
Returns True if serive was successfully installed.

API Declarations
Private Type SERVICE_STATUS
dwServiceType As Long
dwCurrentState As Long
dwControlsAccepted As Long
dwWin32ExitCode As Long
dwServiceSpecificExitCode As Long
dwCheckPoint As Long
dwWaitHint As Long
End Type
Private Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Private Declare Function CreateService Lib "advapi32.dll" Alias "CreateServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal lpDisplayName As String, ByVal dwDesiredAccess As Long, ByVal dwServiceType As Long, ByVal dwStartType As Long, ByVal dwErrorControl As Long, ByVal lpBinaryPathName As String, ByVal lpLoadOrderGroup As String, lpdwTagId As Long, ByVal lpDependencies As String, ByVal lpServiceStartName As String, ByVal lpPassword As String) As Long
Private Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long

Rate Install Windows NT Service (9(9 Vote))
Install Windows NT Service.bas

Install Windows NT Service Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters