Communication between running application and service [C++]


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Communication between running application and service [C++]

  1. #1
    Join Date
    Feb 2005
    Posts
    24

    Question Communication between running application and service [C++]

    Currently I have an application (A.exe) which determines when things need to be done, when such a time arises it launches another application (B.exe) with the appropriate parameters to do the actual work required, some of which could be administrative work (installing MSI, editing registry, etc...).

    This all works perfectly fine in an administrative environment - but soon the application will be migrated to a restricted (user) account where the running application (A) does not have the rights to launch application (B) to the necessary work. The solution, have an administrative service (service installed when logged on as admin during software installation), and have this service communicate between (A.exe) and (B.exe)... Let's call the service (C) ...

    My goal is therefore as follows:
    - (A.exe) tells (C) that something needs to be done (somehow)
    - (C) launches an instance of (B.exe) with admin rights (as it is an admin service) and (B.exe) performs the job just like it did before

    Now this raises a few questions I was hoping to get some feedback on from people who have encountered similar situations or have advice they could give me so I don't shoot myself in the foot :)

    1- My assumption is that I should be using C++ for my admin windows service, because C# requires all the managed DLLs and stuff I didn't want to risk any issues loading anything when running the admin service in a restricted user environment... am I crazy?

    2- What would be the best method of communication between (A.exe) and the service (C), I need to take into account the difference in security (admin vs user), would using POST MESSAGES (windows or not) and have (A.exe) "find by name" work, could I get handle to (C) when I am user and it is admin? I would like to not use the registry or a file (like a mailslot) to communicate between them - but I am not sure what the best approach would be.

    3- Will this actually work, if (C) launches (B.exe) does that imply that (B.exe) will have the admin rights it needs to perform its tasks?


    Any help or hints would be much appreciated - trying to get a good & proper design in place before I start coding ... any ideas or lessons-learned you could provide would be great.
    Thanks,

  2. #2
    Join Date
    Jan 2005
    Location
    UK
    Posts
    604
    Hi,
    short-term solution: communicate through sockets. Make service C listen on a port and when A connects to the port and sends a message like "Start B" then C launches B.
    If your company got some middleware like MQ or Tibco you can make your setup a bit more fault tolerant and stable by using message queues. Your question (C) very much depends on what privileges your give the service user. O/Ss like Server 2003 can be quite specific at what access they allow to which resource, so you have to at least give your user write access to your communication sockets.
    DKyb
    -------------------------------
    Life is a short warm moment -
    Death is the long cold rest.
    Pink Floyd
    -------------------------------

  3. #3
    Join Date
    Feb 2005
    Posts
    24
    Does this cause any issues when it is local (I assume you use the 127.x.x.x), also what about PORT? Do you need to change firewall settings (I don't have that kind of access) if it is local.

    Will this work between a SERVICE and an APPLICATION?

  4. #4
    Join Date
    Jan 2005
    Location
    UK
    Posts
    604
    Your real problem here is to find out exactly what your user-level and access rights are on the different levels. I am talking about domain-level access, network access, share-permissions, application level access-rights (programs like MQ have their extra layer of secutrity). I would liaise with your network admins and discuss if you are unsure. Technically you do not have a problem communicating through Windows-messages, Sockets or Queue-managers, but you have to decide which solution is the most appropriate and set up your security configuration accordingly.
    DKyb
    -------------------------------
    Life is a short warm moment -
    Death is the long cold rest.
    Pink Floyd
    -------------------------------

Similar Threads

  1. Replies: 0
    Last Post: 09-25-2008, 11:56 PM
  2. Replies: 11
    Last Post: 04-09-2008, 09:24 AM
  3. Client - Service communication
    By crypto85 in forum .NET
    Replies: 0
    Last Post: 02-15-2005, 11:53 AM
  4. Replies: 1
    Last Post: 10-15-2001, 10:57 AM
  5. Vb Application as a Service
    By Tausif Farooqi in forum VB Classic
    Replies: 0
    Last Post: 01-18-2001, 03:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center