rejetto forum

Software => HFS ~ HTTP File Server => F.A.Q.s => Topic started by: ledufe on July 21, 2007, 04:38:01 PM

Title: Run HFS as a Windows Service
Post by: ledufe on July 21, 2007, 04:38:01 PM
Well, after many posts asking the same question... i sense that this topic could be put into a sticky. ;D

??? if you're looking for a way to make your HFS run at startup, but not as it usually does when the user logs in... you want your HFS to run even before you or anybody else logs into the computer, or even after a shutdown/reboot, you are in the right post.....  ;D

If you use the search button of this forum (http://www.rejetto.com/forum/index.php?action=search), you will find at least 3 pages with these words in their posts, here is a current list of threads on this topic:

Topic: Run HFS as a SERVICE - info here!  (Read 4050 times)
http://www.rejetto.com/forum/index.php?topic=2416.0
--
Topic: NewSoftware HFS2Service  (Read 1620 times)
http://www.rejetto.com/forum/index.php?topic=3755.0
--
Topic: How can I set HFS up as a service?  (Read 19 times)
http://www.rejetto.com/forum/index.php?topic=4712.0
--
Topic: hfs2service????  (Read 372 times)
http://www.rejetto.com/forum/index.php?topic=3998.0
--
Topic: Autostart HFS after reboot?  (Read 468 times)
http://www.rejetto.com/forum/index.php?topic=3050.0
--
Topic: HFS as Windows Service  (Read 497 times)
http://www.rejetto.com/forum/index.php?topic=4084.0
--
Topic: Service?!!  (Read 2808 times)
http://www.rejetto.com/forum/index.php?topic=1389
--

and these files are mentioned in all of the posts...at least the files i got here... i have attached the sources of this application i made to create and manipulate the windows process that it creates for HFS... I have attached 2 versions of it, one that makes the service, and manipulate it only, and the other which keeps monitoring the service in the system tray of windows, i must explain that these tools are experimental, and all are virus free, they are one of the my very first programing things in C#, and i'm not updating it, as it works fine to me and others..... i have also got the any2service here, but i did not attach it, i can send it to someone that can host it somewhere for me..... the size is

Any2Service.zip - 2.188kb

i guess there is many other ways to do it... but from now on lets use this sticky post to discuss this topic.
Title: Re: Run HFS as a Windows Service
Post by: TSG on July 22, 2007, 05:25:50 AM
I have made this topic sticky, i also edited your post ledufe... your english was a little off. It makes more sense now :)
Title: Re: Run HFS as a Windows Service
Post by: ledufe on July 22, 2007, 06:24:30 AM
your english was a little off.
It makes more sense now :)
but i am totally nonsense!
and the funny thing is, you understand me!!!
ahuhauahauhaua
sorry, i must decrease the amount im smoking......

Title: Re: Run HFS as a Windows Service
Post by: eliza on July 23, 2007, 02:40:59 PM
log file:

07/23/2007, 16:28:37
    D:\XXX\hsf\HFS-Service.exe
07/23/2007, 16:28:37
    D:\XXX\hsf\HFS-Service.ini
07/23/2007, 16:28:37
    D:\XXX\hsf\HFS-Service.log
07/23/2007, 16:28:37
    HFS-Service
07/23/2007, 16:28:37
    Failed to start program 'HFS_FULL_PATH', error code = 2
07/23/2007, 16:28:37
    Bounced process 0

What this error can be? I'm not able to start the service.
Title: Re: Run HFS as a Windows Service
Post by: ledufe on July 23, 2007, 03:09:32 PM
you was able to create the process, but not to start it? well it apears to me that you somehow have moved the executable when the process was stopped, or chage the name of the hfs.exe that the process is calling...
well, i want to help, but it would be a good idea if we could talk in some instant messaging system
im on brazil, and my msn messenger is ledufe@hotmail.com
we could talk if you preffer, my skype is ledufe
call me and i will try to help....
Title: Re: Run HFS as a Windows Service
Post by: surel on September 14, 2007, 08:15:28 AM
I installing program HFS and hfsservice.exe. And I want it work in service in Windows XP Professional. It work good, but when I start account Administrator, I have two alerts. First ist monoLib error and second is Acess violation at adress 0040439A in module 'hfs.exe'. Read of adress 00000001. What can I do with this alerts? Thank you for your help.
Title: Re: Run HFS as a Windows Service
Post by: ledufe on September 16, 2007, 12:36:00 AM
my guess is that you must change the administrator account to be in every group(so the group of the hfservice) would be accessible to the administrator too, try to set the admin groups, the same groups of the user that installed/created the service, or try to unistall the service, and install it again as administrator...
Title: Re: Run HFS as a Windows Service
Post by: rejetto on September 16, 2007, 12:41:48 AM
I installing program HFS and hfsservice.exe. And I want it work in service in Windows XP Professional. It work good, but when I start account Administrator, I have two alerts. First ist monoLib error and second is Acess violation at adress 0040439A in module 'hfs.exe'. Read of adress 00000001. What can I do with this alerts? Thank you for your help.

can you please report the build number that is giving you such error?
please also re-report the address of the access violation.
Title: Re: Run HFS as a Windows Service
Post by: Surel78 on September 17, 2007, 06:01:21 AM
It's HFS HTTP server version 2.2a build 124 and the newest version HFSservice.exe.
But this problem is only in login as Administrator. When I login as User, alerts are out.
Title: Re: Run HFS as a Windows Service
Post by: TS on January 16, 2008, 03:18:34 PM
The program is reported to be a spyware??!
Trojan.NTsvc
Title: Re: Run HFS as a Windows Service
Post by: rejetto on January 16, 2008, 03:56:36 PM
what program are you talking about?
Title: Re: Run HFS as a Windows Service
Post by: TSG on January 16, 2008, 05:46:30 PM
I would assume he is referring to ledufe's program.
Title: Re: Run HFS as a Windows Service
Post by: ledufe on January 16, 2008, 06:03:30 PM
The program is reported to be a spyware??!
Trojan.NTsvc

who reported it as a spyware?

and the software that pointed it as spy/malware should tell wich EXE with full path like

c:\hfs-folder\hfs2service.exe or hfs.exe

and googling a little with this term(Trojan.NTsvc) that you used, i found nothing, could you point to me where i can find some reference to this kind of malware?

and my only guess is that it could be detected as a trojan becouse it CREATE A SERVICE TO ANOTHER APP and many virus or trojan act like this....

Title: Re: Run HFS as a Windows Service
Post by: TS on January 17, 2008, 06:38:00 AM
i have searched google too, nothing is found, as same as you.
The HFS2Service.exe is reported to contain that spyware, by avg spyware scanner.
Title: Re: Run HFS as a Windows Service
Post by: Foggy on January 17, 2008, 06:40:22 AM
hmm, I have heard that AVG quite often reports false positives.
Title: Re: Run HFS as a Windows Service
Post by: parade on February 13, 2008, 11:20:04 AM
Hi,

I tried hfs2service on an Windows XP HómeSystem and I get an error message on start.
Is there a problem with the home-edition and hfs2service or is there a problem with running programs as service in the home-edition?
Title: Re: Run HFS as a Windows Service
Post by: ledufe on February 14, 2008, 04:47:17 AM
  Fixing “The application failed to initialize properly (0xc0000135)”

When attempting to run Microsoft .Net based applications, you may get the following error on startup:

    The application failed to initialize properly (0xc0000135)

The cause of this error is that the Microsoft .Net framework is not installed or is damaged in some way. Therefore applications will fail to launch.

To fix this error you can run Windows Update and find the Microsoft .Net framework update to install. Alternatively, you can download the Microsoft .Net Framework directly from Microsoft.

    * Microsoft .Net 1.1
    * Microsoft .Net 2.0
    * Microsoft .Net 3.0
    * Microsoft .Net 3.5
Title: Re: Run HFS as a Windows Service
Post by: parade on February 17, 2008, 08:08:00 AM
The cause of this error is that the Microsoft .Net framework is not installed or is damaged in some way. Therefore applications will fail to launch.
Thank you ledufe.
I really forgot to install .Net framework on this special PC.

Another question:
Do I have to reinstall the service everytime there is a new HFS-Build?
Title: Re: Run HFS as a Windows Service
Post by: MarkV on February 17, 2008, 10:25:57 AM
Just overwrite the old HFS.exe with the new one. HFS itself isn't aware of any service installation.
Title: Re: Run HFS as a Windows Service
Post by: ledufe on February 17, 2008, 11:03:37 AM
re-install?
no
just remember to STOP the service before replace the exe file(HFS.exe)

Title: Re: Run HFS as a Windows Service
Post by: H4nd0 on April 02, 2008, 07:03:10 PM
Hi guys,

We have had several requests re: HFS as a service. Here's our post on the subject:

http://forums.firedaemon.com/viewtopic.php?t=1426

Cheers,

James
Title: Re: Run HFS as a Windows Service
Post by: rejetto on April 02, 2008, 07:42:29 PM
great
Title: Re: Run HFS as a Windows Service
Post by: Tuskenraider on May 13, 2009, 07:32:51 PM
ive been gone a long time.... but i just wanted to say... im very glad that ive come back to HFS...   i have a windows home server....  it has a built in webserver...and well it sucks.... HFS is the cats meow...   thank you rejetto for a great product...and Ledufe  thanks for your work on the service side... with out you guys....  id have to have a microshaft home website... 

thanks again


tusken
Title: Re: Run HFS as a Windows Service
Post by: rejetto on May 14, 2009, 08:02:26 AM
nice to see you again  :)
possibilities are quickly expanding here thanks to scripting capabilities

MikeBiasin problem moved to http://www.rejetto.com/forum/index.php?topic=6966.0
Title: Re: Run HFS as a Windows Service
Post by: luca69 on March 19, 2010, 12:16:50 PM
Hi all,
I successfully installed HFS as a service using Any2Service ^__^ It is very simple and works fine.

Thanks Rejetto for this great tool!
Title: Re: Run HFS as a Windows Service
Post by: bmartino1 on June 14, 2014, 02:19:21 PM
I don't understand your issues, if you want "hfs" to startup for any user, then put it into the "all users" startup folder....

---
Your personal startup folder should be C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

The All Users start up folder should be C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup.
----

Or use some other programs or even the suggested... windows 2000 program tool to make it a service...
http://support.microsoft.com/kb/137890
http://support.microsoft.com/kb/137890?wa=wsignin1.0

http://www.howtogeek.com/50786/using-srvstart-to-run-any-application-as-a-windows-service/
---

(Looking for this stick TS, thought that issues on theses have been resolved...
Title: Re: Run HFS as a Windows Service
Post by: rejetto on June 16, 2014, 08:31:52 PM
services don't start FOR every users, but ONCE, before the users
Title: Re: Run HFS as a Windows Service
Post by: bmartino1 on June 17, 2014, 12:57:03 AM
services don't start FOR every users, but ONCE, before the users

Rejetto, i don't understand your sentences...

Windows booting process:
http://resources.infosecinstitute.com/windows-booting-process/
see pic...

services run behind scenes in the background (usual in task manger as svhost....)
This happens(services begin to run) right at or just after the program winlogon.exe is executed...

upon user logon, item with in the startup folder begin to run
either by the selected user or by "any" user depending on which folder you put the program in...
(see previous post..)

if you want the program to run with no user logged in and/or at the user login screen, then you can use
INSTSRV.EXE which is a Microsoft program within the windows 2000 nt resource kit...
To MAKE IT A SERVICE...

so when you say:
quote:
services don't start FOR every users, but ONCE, before the users

Define-ing "FOR" every user, you have me puzzled...
followed by "Once"

Are you defining the boot/startup process to make the program run?
or
Saying that this is not possible???

Please define...
Title: Re: Run HFS as a Windows Service
Post by: bmartino1 on June 17, 2014, 01:56:25 AM
other wise you can add the items to your startup folder user windows:
(super)WIdnows key + "r"
run command:
control userspassword2

have a user auto login
have a startup script (run once) to lock the account, thereby
gives your hfs loaded and brings you back to the login screen...

login script:
Its been a while, looing through my old scripts...
---batch/run comand that locks the current user....
rundll32.exe user32.dll,LockWorkStation
----

info to edit you script:
http://social.technet.microsoft.com/Forums/windows/en-US/64c21a89-8e04-4031-b0d7-dc0355e39590/logging-out-locked-accounts-after-a-period-of-time?forum=w7itprosecurity

--what i have done in the past was make a startup batch script and add programs to that script
I added that to my webroot user  startup folder (that way if i have multiple users) that any one who logs in will not have acess to the server running...

I would have a "runonce" script in the programs that way when i the machine is restarted would log in and lock the account...

acomplished either by startup folder/group policys/ registry entries:
After a user has successfully logged into the machine, winlogon does the following:

http://en.wikipedia.org/wiki/Windows_startup_process#Windows_NT

User and Computer Group Policy settings are applied.

Startup programs are run from the following locations:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
All Users ProfilePath\Start Menu\Programs\Startup\ (this path is localized on non-English versions of Windows)
Current User ProfilePath\Start Menu\Programs\Startup\ (this path is localized on non-English versions of Windows)
Title: Re: Run HFS as a Windows Service
Post by: rejetto on June 29, 2014, 08:22:32 PM
Rejetto, i don't understand your sentences...

"for every user" as "one each".
just specifying a difference between the "all users" and the services: that a service is one and for all users.
Title: Re: Run HFS as a Windows Service
Post by: Guanxi on August 08, 2015, 06:04:20 PM
Some recent experiences, as of August 2015
HFS runs nicely as a Windows service on my Windows 2012 server. As already discussed at lenghts, I had to convert HFS into a service to keep it running independently of users. The other option discussed, putting it into a startup folder of a separate user and logging in automatically seemed not very elegant to me - and was not possible, because I do not have the authority to add users.

To convert HFS to a Windows service I used the nice hfs2service tool found at the beginning of this thread.
I had to overcome two hurdles, that I want to share:

* The current version of HFS is distributed as "hfs4e.exe"
hfs2service however seems to have hfs.exe hard coded somewhere, which prevents the service from starting.
Renaming hfs4e.exe to hfs.exe gets the conversion working

* I run MS IIS and Tomcat on the same web server as HFS. It was already a surprise to me, that HFS was running without interfering with them with the default (I think 8080) port. However when HFS was automatically started as a Windows service, it  interfered with IIS and Tomcat, that finally none of them have been working anymore. Selecting another port for HFS (I took 9090) resolved the issue.

Final tip on launching the HFS application (e.g. to maintain the directories shared), when it is already running as a service.
When I opend the HFS application, while running it as a service already, it showed "Server is currently OFF" (in the top middle of the page).
Reason is that HFS could not start, because another instance of it aleady used the same internet port.
The interesting thing was, that this status survived even reboot and reinstall of the HFS Windows service.
Thus you have to stop the HFS service using the task manager before using the HFS application.
If you incidentially launch the HFS application while the HFS service is still running, you have to switch on the server on again, e.g. by clicking on the "Server is currently OFF" message