CreateService_ fails in PB 6.12
Posted: Fri Dec 20, 2024 4:34 pm
Hi
I have used the following code for years to create Windows services using PB. However in PB6.12 it fails to create the service. When I re-compile my app in PB 5.73 the code creates the service. I am testing this on Windows 2022 Standard Server.
I have used the following code for years to create Windows services using PB. However in PB6.12 it fails to create the service. When I re-compile my app in PB 5.73 the code creates the service. I am testing this on Windows 2022 Standard Server.
Code: Select all
Procedure Service_Install(tcService.s)
Protected lcDir.s, lhSCManager.l, lhService.l, SD.SERVICE_DESCRIPTION
lcDir = GetCurrentDirectory() + #dCServiceAppName
lhSCManager = OpenSCManager_(#Null, #Null, #SC_MANAGER_ALL_ACCESS)
lhService = CreateService_(lhSCManager, tcService, #dCServiceDisplayName, #SERVICE_ALL_ACCESS, #SERVICE_WIN32_OWN_PROCESS, #SERVICE_AUTO_START, #SERVICE_ERROR_NORMAL, lcDir, #Null, #Null, #Null, #Null, #Null)
SD\lpDescription = @"Fuelwize eReceipts"
ChangeServiceConfig2_(lhService, #SERVICE_CONFIG_DESCRIPTION, @SD)
CloseServiceHandle_(lhService)
CloseServiceHandle_(lhSCManager)
EndProcedure