CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2008
    Posts
    5

    Logon failure with Win32 Service using Domain Account

    I am trying to install a local service under the context of a trusted domain account.

    I installed the service correctly and it starts fine running under the LocalSystem context, however the service fails to start under the domain account because of a logon failure.

    The domain account I am using meets all of the following requirements. Please tell me if I am missing anything:

    1). Account is enabled/unlocked
    2). Account password I am using is valid (logged into a few machines with it)
    3). Account has local admin rights on the machine I am installing the service on

    Attached is the CreateService() function I am using to install the service.

    Thank you

    Code:
         TCHAR szPath[MAX_PATH] = (L"\"C:\\Program Files\\Temp.exe\"");
         TCHAR szStartName[50] = (L"Domain\\User");
         TCHAR szStartNamePassword[50] = (L"**********");
    
          schService = CreateService( 
                schSCManager,
                SVCNAME,
                SVCNAME,
                SERVICE_ALL_ACCESS, 
                SERVICE_WIN32_OWN_PROCESS, 
                SERVICE_AUTO_START,
                SERVICE_ERROR_NORMAL,
                szPath,
                NULL,
                NULL,
                NULL,
                szStartName,
                szStartNamePassword);
    Last edited by ovidiucucu; November 16th, 2008 at 03:12 AM. Reason: added [CODE] tags

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Logon failure with Win32 Service using Domain Account

    [ Redirected thread ]

    Is this the real password: L"**********" ?
    Last edited by ovidiucucu; November 16th, 2008 at 03:22 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Nov 2008
    Posts
    5

    Re: Logon failure with Win32 Service using Domain Account

    No, I changed it to that for the sake of the post.

  4. #4
    Join Date
    Nov 2008
    Posts
    5

    Re: Logon failure with Win32 Service using Domain Account

    Update:

    I solved the problem partly.

    Apparently the Domain user account needs "Log in as a service" rights on the local machine. However while this solved the problem I dont know how to do this programatically.

    Any help is appreciated.

    Thanks

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

    Re: Logon failure with Win32 Service using Domain Account

    See this my post.
    Best regards,
    Igor

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