Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using advapi32.dll to install a service
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01155465
Message ID:
01155715
Vues:
30
Hi Anatoliy,

what does WMI stand for?

From what I gathered from the link, the code doesn't create a service. The logic I need is:

Check if service exists, if it does delete it.
Create the service and start it.

I've got pretty close, but have a slight problem with the definition of:
DECLARE INTEGER CreateService IN advapi32;
	INTEGER hSCManager,;
	STRING lpServiceName,;
	STRING lpDisplayName,;
	LONG dwDesiredAccess,;
	LONG dwServiceType,;
	LONG dwStartType,;
	LONG dwErrorControl,;
	STRING lpBinaryPathName,;
	STRING lpLoadOrderGroup,;
	INTEGER lpdwTagId,;
	STRING lpDependencies,;
	STRING lpServiceStartName,;
	STRING lpPassword

m.lnService = CreateService(m.lnSCM,;
   m.tcServiceName, ;
   m.tcServiceName, ;
   SERVICE_ALL_ACCESS, ;
   SERVICE_WIN32_OWN_PROCESS, ;	
   SERVICE_AUTO_START,;
   0,;
   m.tcFileName,;
   "",;
   0,;
   "",;
   "",;
   "")
I have a feeling the problem is the INTEGER lpdwTagId.


>Not exactly a sharing, but the WMI version of this code is free:
>
>Encapsulating access to the Windows Services in a class
>http://www.news2news.com/vfp/?example=476
>
>API functions used:
>CloseServiceHandle
>ControlService
>EnumServicesStatus
>GetLastError
>LocalAlloc
>LocalFree
>LockServiceDatabase
>OpenSCManager
>OpenService
>StartService
>UnlockServiceDatabase
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform