FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Installing a FWH excecutable as a SERVICE
Posts: 86
Joined: Fri Oct 07, 2005 07:59 AM
Installing a FWH excecutable as a SERVICE
Posted: Fri Aug 04, 2006 03:44 PM

I need to run a FWH executable as a service under windows 2000 server
How should I install it if its posible.

I will be executing the programa as a Programable task at 19h00 every day. At the moment the task will not execute if no user is looged onto the windos 2000 server.

Regards/Saludos
Paul

paul@pes-systems.net
Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Installing a FWH excecutable as a SERVICE
Posted: Sat Aug 05, 2006 03:39 AM

Paul,

take a look to

http://fivetechsoft.com/forums/viewtopic.php?t=3807

regards,

Baxajaun

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Installing a FWH excecutable as a SERVICE
Posted: Sun Aug 06, 2006 09:10 AM

Hi

Can anybody translate the following text file related to the subject, into
English Lanugate? It is an interesting topic which I could not read it and
it would be useful to English Readers.

http://hyperupload.com/download/029d9e2 ... pp.txt.htm

Thanks in advance

  • Ramesh Babu P
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Installing a FWH excecutable as a SERVICE
Posted: Sun Aug 06, 2006 09:45 AM
RAMESHBABU wrote:Hi

Can anybody translate the following text file related to the subject, into
English Lanugate? It is an interesting topic which I could not read it and
it would be useful to English Readers.

http://hyperupload.com/download/029d9e2 ... pp.txt.htm

Thanks in advance

- Ramesh Babu P


Sorry Ramesh,

the provided link doesn't work for me.

Regards,
Detlef
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Installing a FWH excecutable as a SERVICE
Posted: Mon Aug 07, 2006 01:28 AM

Hi Detlef Hoefner

Thank you very much for your reply.

The link is already available in the following post by Baxajaun on
Sat Aug 05, 2006 3:39 am

http://fivetechsoft.com/forums/viewtopic.php?t=3807

I am again giving the correct link below:

http://hyperupload.com/download/029d9e2 ... p.txt.html

Regards

  • Ramesh Babu P
Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Installing a FWH excecutable as a SERVICE
Posted: Mon Aug 07, 2006 03:48 PM

Hi Rameshbabu,

on this link you can view a Knowledge Base article of Microsoft:

How to create a Windows Service using sc.exe

http://support.microsoft.com/kb/251192/en-us

I`ll try to translate the link:

http://www.fermu.com/content/view/263/2/lang,es/

Best regards

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Installing a FWH excecutable as a SERVICE
Posted: Mon Aug 07, 2006 07:13 PM
RAMESHBABU wrote:Hi Detlef Hoefner

Thank you very much for your reply.

The link is already available in the following post by Baxajaun on
Sat Aug 05, 2006 3:39 am

http://fivetechsoft.com/forums/viewtopic.php?t=3807

I am again giving the correct link below:

http://hyperupload.com/download/029d9e2 ... p.txt.html

Regards

- Ramesh Babu P


Hi Ramesh Babu P,

here is a very rough translation from a translator ( Google ).
Some words are unknown, but maybe this might help you.

Best regards,
Detlef


Here they are all the forms to execute a program at the beginning of Windows.
Accesses can be added, bony to directly specify feasible route and within the following locations within the Windows registry:
For example:

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ Current Version \ Run
It executes the items stored in this location of your automatically begun registry when the present user is only logeado.
In the users with multiple users or accounts, this information can change dependiento of that was the one that logueo, for example when it is entered to a system connected to a network and wants to have access under Windows NT.    

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ Current Version \ RunOnce     
It in the same way executes the items stored in the location denominated exactly that the previous one, but only once and is automatically removed.

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ Current Version \ Run
The items stored in this location of the registry in each new session are executed automatically, without mattering that logue.

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ Current Version \ RunOnce
The items stored in this location are also executed that the previous point, but only once.     

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ Current Version \ RunOnceEx
The items stored in this location of the registry are executed, without mattering that has been logueado.

HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ Current Version \ RunServices
The Items alamcenados in this location of the registry will be executed automatically like 'services' (more applicable under Windows NT), said programs will be executed before any other program is loaded 
and continuous their execution inclusively after the system is blocked, and will not appear when pressing keys CTRL+ATL+DE.

Them here traducí an article published in the page of Patrick Mast, thanks to him.
This is very good to load hidden applications, but really since I do so that it works?
When installing the application like process on watch, the correra application of bottom in invisible form,  being invisible in carperta of applications of the administrator of tasks. 
The applications that run like a process of services will not stop no matter how hard the user desloguee, will follow ejecutandosé.
As it shows of an application that is executed as process on watch is Symatec WinFax.
The program this always receives incoming faxes, no matter how hard the user is deslogueado. 
There are two main advantages to run an application with process on watch:
To be invisible in the screen of the administrator of tasks, and to follow 
ejecutandosé no matter how hard the user desloguee.
Now, like it is possible to be caused that a FiveWin application is a process of Service? 

Good, the function of the Api de Windows 'RegisterServiceProcess' is the solution. This function registers and desregistra an application like a process on watch.
Funcón of the Api de Windows 'RegisterServiceProcess' accepts two parameters. The first parameter is the identification of the process of application (YOU GO). 

In order to obtain YOU GO of the process, we will use another function of the called Api de Windows 'GetCurrentProcessId'. This call to the function of the Api de Windows does not need parameters. 
The second parameter of 'RegisterServiceProcess' specifies if the service is registered or not.
A value of 1 registers the application, and 0 disregisters it.

A Sample program:

Function Main()
   ServiceProcess(1)

   /*
      Here your code ... 
    */
Return NIL

Function ServiceProcess( mode )
Local nProcessId := 0

   Default mode := 0
   nProcessId := GCP( )
   
   If Abs( nProcessId ) > 0
      RSProcess( nProcessId, mode )
   Endif

RETURN

DLL32 FUNCTION RSProcess( npID  AS LONG , nMode AS LONG ) ;
AS LONG FROM "RegisterServiceProcess" LIB "kernel32.DLL"
DLL32 FUNCTION GCP() AS LONG FROM "GetCurrentProcessId" LIB "kernel32.dll"
 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\RunServicesOnce

The items stored in this location of the registry automatically will be executed like 'services', but only once, 
this more is used under Windows NT, the rest is just as the previous point.
Now accesses just as in the previous points within the file 'Win.ini' can be added. 
The Win.ini file is a boot file that stores the data of configuration of its system and is processed in 
the beginning of each session of Windows. Within this file there are two seccciones where the applications 
can be added just by to place Load or Run, but this more is used by compatibility with Windows 3.11 and 
aoncejo that is used the previous points, since it is more difficult to modify.

In order to modify the previous points I recommend to use class TREG32.
I hope that it serves to you, and it serves all to them and if somebody wants it to publish that 
it publishes it, Daniel Andrade for example.

--   Greetings!

Darío Hernán Irigaray - GE-CO Commercial
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Installing a FWH excecutable as a SERVICE
Posted: Tue Aug 08, 2006 02:33 AM

Hi Mr.Baxajaun and Mr.Detlef Hoefner

Thank you very much for your posts. They are very useful.

Regards to you both

  • Ramesh Babu P
Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Installing a FWH excecutable as a SERVICE
Posted: Tue Apr 29, 2008 04:30 AM

Hi,

RegisterServiceProcess is only for Win9x, is not valid for Windows XP.

Best Regards,

Felix

Continue the discussion