Your Ad Here Your Ad Here
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to set up your p2p client as a service

  1. #1
    lynx's Avatar .
    Join Date
    Sep 2002
    Location
    Yorkshire, England
    Posts
    9,810
    This feature allows you to have your p2p client running without needing to be logged on.
    This means that if you have to log off for any reason your p2p client will still be running in the background, and it will start up with the system, not when you log on.

    First of all, you need a program from Microsoft's Resource kit tools - srvany.exe - to act as the interface between windows service manager and your application. I can't include it here as it is copyright, but you can download and install the whole resource kit tools from Microsoft:
    http://www.microsoft.com/downloads/d...displaylang=en
    This version is intended for Server 2003, but the program we want works with all NT based versions between NT3.51 and XP and should work with Vista too. It doesn't work with Win9x or WinME, but who cares.

    Ok, first you need to create a service. You need admin rights to do this, and you need the following information:
    <location> of srvany.exe - the full path.
    <service name> for the service - what it is called internally
    <display name> for the service - what you see in service manager - if you leave this out you will get the service name
    If any entry contains spaces then enclose it in double quotes.

    Select Start/Run and enter the following command, replacing the <> boxes with your info. The spaces after the = signs are intentional, it won't work if you leave them out. Unfortunately, unless you've got remarkable eyesight you won't see if it works, so if you can't find your service later on you may want to run this from a command prompt.

    sc create <service name> start= auto binpath= <location> displayname= <displayname>

    For utorrent, it might look like this:
    sc create utorrent start= auto binpath= "D:\Windows Resource Kits\Tools\srvany.exe" displayname= "Micro Torrent"

    Now that you've created a service, you need to give it something to do.
    Run Regedit and find the following key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<service name>
    Right click on that key and select new->key, give the key the name "Parameters" (without the quotes).
    Right click on this new key, select new->string value, give it the name "Application" (without the quotes).
    Double click "Application" and enter the full path of your p2p client.

    Next, you need to make it interactive (so that you can see things on the desktop).
    Open Service Manager (in control panel/administrative tools) and select the service you just created. Right click and select properties, choose the "Log On" tab and tick the box that says "Allow service to interact with desktop", select OK. Don't close service manager, you'll need it in a moment.

    Your service is now runnable, but there may be a one more thing you need to do to get it to work properly, depending on the application. You are no longer running this application, it is being run by LocalService, so if the application stores any information in your user profile you may have to make a copy of it in the LocalService user profile.
    Look in "Documents and Settings\<Your user name>\Application Data", if there is an entry for your application you need to copy that entry into the same area for the LocalService user - "Documents and Settings\LocalService\Application Data". Some of these folders are hidden, so you may need to change your folder options so that you can see them.
    For uTorrent, if you can also move the contents of "Documents and Settings\<Your user name>\Application Data\uTorrent" to the same folder as the uTorrent application, and it will use the same settings and torrent details for all users and services.

    You should now be good to go - find your service in service manager, select it and click the start button at the top of the window - hopefully your application will now start.

    Assuming everything is ok, you need a simple way to start and stop your application. Create two new shortcuts, the target in the first is sc start <service name>, the target in the second is sc stop <service name>. Give the shortcuts whatever names you want. The first will start your application, the second will stop it. You may be able to stop the aplication in the normal way, but this will leave the service program that called it (srvany.exe) running so you won't be able to start it again until you've stopped the service.

    This method works with many applications (and not just p2p either), but I can't guarantee it will work with all of them. If you've followed everything correctly and it doesn't work that's a problem with the application, not the method.

    One last thing to remember, if you are starting your application as a service then you don't want it to run at startup, so uncheck the box in the applications options, remove it from the Startup folder and so on, otherwise you may have 2 copies running when you log in.
    Last edited by lynx; 06-23-2008 at 08:21 PM. Reason: Settings for uTorrent

  2. Guides and Tutorials   -   #2
    SenorBubbz's Avatar /_.-..-._\ BT Rep: +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35
    Join Date
    Jan 2008
    Location
    localhost
    Posts
    1,246
    This is great man, thank you!

    This could also come in handy for other things
    o hai

  3. Guides and Tutorials   -   #3
    kadake's Avatar Hayden's Watching u
    Join Date
    Nov 2005
    Location
    never you mind
    Posts
    260
    are there any down points to doing this.

    When you do login can you see client running ?

    i know i was going to do this with PG2 but you cant see it running when you login ?



  4. Guides and Tutorials   -   #4
    lynx's Avatar .
    Join Date
    Sep 2002
    Location
    Yorkshire, England
    Posts
    9,810
    The only downside I'm aware of is the need to have a copy of the parameters in the local system account, and having to remember that if you change that copy your own copy doesn't get modified automatically.

    Whether you see the client window depends on how the software was written. If it has been written properly to work with XP the client window appears (already running) as soon as you log in.

    Make sure you ticked the box in service manager marked "Allow service to interact with the desktop". If you try to run the software under your own account (which would having a separate copy of the parameters) then the option is disabled and you can't get the service to interact with the desktop at all.

    I've tried it with uTorrent and it behaves correctly. I can't really comment about other software, but if it behaves properly under fast user switching there's a good chance it will work properly as a service.
    Last edited by lynx; 02-07-2008 at 07:59 PM.
    .
    Political correctness is based on the principle that it's possible to pick up a turd by the clean end.

  5. Guides and Tutorials   -   #5
    Poster BT Rep: +10BT Rep +10
    Join Date
    Jan 2008
    Location
    Monaco
    Posts
    113
    thanks mann ı've looking for it everywhere

  6. Guides and Tutorials   -   #6
    alfry1010's Avatar Be aware of the HD BT Rep: +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35BT Rep +35
    Join Date
    Dec 2007
    Location
    near you
    Posts
    454
    that seems useful =) but ATM it's zonealarm which get down after 24~48h :-/

  7. Guides and Tutorials   -   #7
    Cabalo's Avatar FileSharingTalker BT Rep: +24BT Rep +24BT Rep +24BT Rep +24BT Rep +24
    Join Date
    Mar 2007
    Location
    European Union
    Age
    41
    Posts
    12,718
    extremely useful for seedboxes.
    doesn't work for azureus @ win2k3
    Last edited by Cabalo; 02-21-2008 at 03:19 PM.

  8. Guides and Tutorials   -   #8
    Sounds useful. I might have to try it out.

  9. Guides and Tutorials   -   #9
    FST.L0VeR BT Rep: +30BT Rep +30BT Rep +30BT Rep +30BT Rep +30BT Rep +30
    Join Date
    Apr 2008
    Location
    FST
    Posts
    282
    thanks man for this setup

  10. Guides and Tutorials   -   #10
    lynx's Avatar .
    Join Date
    Sep 2002
    Location
    Yorkshire, England
    Posts
    9,810
    Added an extra bit of info about settings for uTorrent.
    .
    Political correctness is based on the principle that it's possible to pick up a turd by the clean end.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •