CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Oct 2007
    Posts
    19

    start service before log on

    Hi,

    How can I get it, that a service starts before the log on?

    Thank you for your help!
    M**
    Last edited by M**; June 10th, 2008 at 12:25 AM.

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: start service before lock on

    What "lock on"?
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before log on

    Sorry, I mine log on.

  4. #4
    Join Date
    Aug 2006
    Posts
    157

    Re: start service before lock on

    When you create your service using the CreateService function you specify the type of service as SERVICE_AUTO_START. See the doco on CreateService for more details and other options.

    s

  5. #5
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before lock on

    I have done that, but the service starts after the log on and not before.
    Or is only the program I started with the service not visible?
    M**

  6. #6
    Join Date
    Aug 2006
    Posts
    157

    Re: start service before lock on

    What does your service do? Can you explain what you mean by visible?
    s

  7. #7
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before log on

    My service starts an OnScreenKeyboard, which I need for the log on.
    M**

  8. #8
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: start service before log on

    what have you specified for the lpServiceStartName? Better yet, please code you are using to install the service and any service configuration

  9. #9
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: start service before lock on

    1) "lock on"? - Phasers or PHoton Torpedeos...
    2) "Sorry, I mine log on."....You want to lock weapons on a space mine???

    (just could not resist...)

    A couple of points....

    1) Automatic Services start Automatically when they are needed. You can configure for an actual start (once you post your code so we can show a relatively compataible way...).

    My service starts an OnScreenKeyboard, which I need for the log on.
    HEre is where you are going to run into trouble. The exact nature will depend on your OS and even SP.

    Login is done by a special "highly secure" program known as a "GINA". It is specifically designed to minimize tampering for fairly objious reasons.

    Even if you get your "On-Screen Keyboard" to START, it is VERY unlikely that you will get it to properly interact with the default GINA.

    You will be much better off simply writing a custom GINA that utilizes the functionallity of your application directly.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  10. #10
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before log on

    my code:
    Code:
    inline BOOL CServiceModule::Install()
    {
        if (IsInstalled())
            return TRUE;
    
        SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
        if (hSCM == NULL)
        {
            MessageBox(NULL, _T("Couldn't open service manager"), m_szServiceName, MB_OK);
            return FALSE;
        }
    
           TCHAR szFilePath[150];
        ::GetModuleFileName(NULL, szFilePath, _MAX_PATH);
    
        SC_HANDLE hService = ::CreateService(hSCM, m_szServiceName, m_szServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, SERVICE_AUTO_START,  SERVICE_ERROR_NORMAL, szFilePath,  NULL, NULL,  NULL,  NULL,  NULL);
    
        if (hService == NULL)
        {
            ::CloseServiceHandle(hSCM);
            MessageBox(NULL, _T("Couldn't create service"), m_szServiceName, MB_OK);
            return FALSE;
        }
    
        ::CloseServiceHandle(hService);
        ::CloseServiceHandle(hSCM);
        return TRUE;
    }
    M**

  11. #11
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before lock on

    at http://msdn.microsoft.com/en-us/library/aa380543.aspx I have found that
    GINA DLLs are ignored in Windows Vista.
    I need something that works on vista and xp.
    M**

  12. #12
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before log on

    Can nobody help me??
    M**

  13. #13
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before LogOn

    I have an another OSK seen that before the LogOn starts, but apparently does not have its own GINA. On the computer I could not found any unknown GINA. I know only that there is a service. Has anyone of you an idea??
    M**

  14. #14
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: start service before LogOn

    Okay-okay, I can't stand your suffering.

    MSDN, CreateService Function
    lpLoadOrderGroup [in, optional]

    The names of the load ordering group of which this service is a member. Specify NULL or an empty string if the service does not belong to a group.

    The startup program uses load ordering groups to load groups of services in a specified order with respect to the other groups. The list of load ordering groups is contained in the following registry value:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder
    A service start order is defined by the group service belongs to. Just create your service with group specification. Base worked fine in my experiments - my service had been started even before main GINA interface had shown login dialog, even in XP which is well known slow goer in aspect of initializing services.
    Best regards,
    Igor

  15. #15
    Join Date
    Oct 2007
    Posts
    19

    Re: start service before lock on

    Hi Igor Vartanov,

    thank you for your post.
    I have done what you have wrote, but it doesn't work.
    Code:
    SC_HANDLE hService = ::CreateService(hSCM, m_szServiceName, m_szServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, szFilePath, "Base", NULL, NULL,  NULL,  NULL );
    With this change it takes a littel bit longer before the main GINA interface hade shown the login dialog, but not more.
    Can you give me your sample code?

    M**

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured