Community Forums
Page 2 of 3 FirstFirst 123 LastLast
Results 6 to 10 of 15

Thread: ServiceAddService returns -1

  1. #6
    Join Date
    Jul 2002
    This probably means that the service did not start in the time alloted by the function. Try calling GetExtendedErrInfo, this may give you more error information.

    Devin Ellingson
    Software Developer
    Acresso Software

  2. #7
    Join Date
    Jan 2006
    ServiceAddService returns a generic success/failure message and the error message can be gathered by calling GetLastError().

    More info can be found here:

  3. #8
    Join Date
    Feb 2008
    The reason for using this script is to give user notifications and it is not flexible enough to run it either under System account or user account depending on user settings during installation.

    GetExtendedErrInfo gives empty string.

    GetLastError is a Windows API function invoked by GetExtendedErrInfo.
    Last edited by Kovalenko; 07-11-2008 at 10:11 AM.

  4. #9
    Join Date
    Jul 2003
    Austin, TX
    If you mean to say that you give the user a choice as to what account to use to install the service, the ServiceInstall table's StartName and Password columns are formattable. You could create a dialog that collects the information into properties and then use that to create the service.

    There are a couple ugly spots in MSI when it comes to authenticating the provided credentials and assining the LogonAsService right however.
    Christopher Painter
    Visit for contact information

  5. #10
    Join Date
    Jan 2006

    So you're saying that the GetExtErrorInfo's 3rd parameter is returning 0?

    Based on how those APIs are invoked, I can't imagine a situation in which that's really possible, but if that's what you're seeing then it sounds like maybe an exception is being thrown.

Page 2 of 3 FirstFirst 123 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