CreateService with logon as user account error

Discussion in 'Win32' started by Wolvorine, Aug 28, 2010.

  1. Wolvorine

    Wolvorine New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice