CreateService with logon as user account error
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CreateService with logon as user account error

  1. #1
    Join Date
    Aug 2004
    Location
    Pakistan
    Posts
    260

    CreateService with logon as user account error

    Hi,

    I am having a very strange error , there is a service that i am using to installing with a logon as user account. By that i get the permission to use network services by a windows service.

    Now the problem is when i install that service using manually entered parameters to the window service on command line then it installed perfectly fine and easily can run from svc.exe .

    But since i need to install it using a setup which i have made using inno setup what i am doing is i just call the RUN command on the innosetup script with the same parameters which i provided in manual installation too.

    I recieve notification that it installed successfully , but when i run it then i recieve error

    ---------------------------
    Services
    ---------------------------
    Could not start the Data Reporter service on Local Computer.



    Error 1069: The service did not start due to a logon failure.


    ---------------------------
    OK
    ---------------------------



    When i try to change the password and id on the same installed service by using properties and enetering the same password and id then still it gives me error.


    I then uninstalled it and i used command line to install my windows service on the same service exe that works fine. Now my question is what could be the reason of such thing? Since the password and id is same that i am providing when installing through the setup script the only thing that is different is i am calling that exe from the Setup process.

    this is my code to install

    SC_HANDLE schService = CreateService
    (
    schSCManager, /* SCManager database */
    pName, /* name of service */
    pName, /* service name to display */
    SERVICE_ALL_ACCESS, /* desired access */
    SERVICE_WIN32_OWN_PROCESS, /* service type */
    SERVICE_AUTO_START, /* start type */
    SERVICE_ERROR_NORMAL, /* error control type */
    pPath, /* service's binary */
    NULL, /* no load ordering group */
    NULL, /* no tag identifier */
    NULL, /* no dependencies */
    g_strUser.c_str(),//L".\\", /* LocalSystem account */
    g_strPass.c_str()//L"" /* Password */
    );



    regards

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,196

    Re: CreateService with logon as user account error

    As a debug aide, put a MessageBox in your code to display the username/password that's getting passed to the CreateService method.

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,923

    Re: CreateService with logon as user account error

    The sample might give you some idea.
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center