Flexera beginner

Problem with ServiceAddService call

I have an InstallShield 2011 InstallScript MSI project that has a ServiceAddService problem where it's suddenly now erroring on the user credentials. This is something that used to work in InstallShield 2010 in this exact project.

Some background: This is an existing install from InstallShield 2010 professional that is being rebuilt with InstallShield 2011 professional. The setup was auto converted by being opened in 2011 and rebuilt. The only changes were to update a few files in 'Components' (several were DLLs and one was a .chm help file) and update the digital signature on the 'Release'. I have also tried this on multiple XP machines and a 2003 server with the same results. I have also downloaded and installed HotFix A with no change.

The code for that part in "OnFirstUIAfter" is:


... custom actions ...
Create User
Grant rights to log on as a service (+r SeServiceLogonRight)

// Define Service Logon Specifics
pSERACCOUNT = &svUserName1;
ServiceInitParams ();

// Install Application Server service
nResult = ServiceAddService (@SERVICE_NAME, "Application Server", "Application Server Service", szPath, TRUE, "" );
if (nResult < ISERR_SUCCESS) then
GetExtendedErrInfo ( szName, nResult, nResult2 );
NumToStr ( svResult, nResult );
NumToStr ( svValue, nResult2 );
MessageBox ("Can not install Application Server service.\n" +
"\n Script: " + szName +
"\n Line: " + svResult +
"\n Error#: " + svValue +
"\n Error: " + FormatMessage (nResult2), SEVERE);

The 'GetExtendedErrInfo' call is returning the following:

Script: C:\CodeBases\isdev\Script\ISRT\Src\Service.rul
Line: 150
Error#: 1057
Error: "The account name is invalid or does not exist, or the password is invalid for the account name specified."

Since this has always worked, I assumed that the unicode .dll call changes in 2011 might have something to do with the call format clipping the username or password strings so I changed the variable definition of the username and password to WSTRING and WPOINTER but then I got:

Script: C:\CodeBases\isdev\Script\ISRT\Src\Service.rul
Line: 555
Error#: -1
Error: ""

Lastly, just to make sure that nothing changed from the Windows side with the user account creation and permissions, I changed it to the following:

szParameter = "create \"Application Server\" binPath= " + szPath + " start= auto DisplayName= \"Application Server Service\" obj= " + svUserName1 + " password= " + SERACTPASSWORD;
if (LaunchAppAndWait ( "SC.exe", szParameter, LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN | LAAW_OPTION_SHOW_HOURGLASS ) != 0) then
MessageBox ("Still cannot install service.", SEVERE);

and that WORKED.

The problem is that SC.exe isn't available on Windows 2000 machines by default (resource kit utility) and that is still a required platform for this application. It also isn't as easy to get conditions/feedback from the LaunchApp results when something doesn't work compared to the built in service controls. I have tried the Component level Service controls as well but I ran into a sequence problem (OS specific user setting sequence problem with the custom actions to prompt and select/create the user accounts) that make it much harder than just a ServiceAddService call like we have always done.

I'm a little stumped since this has always worked... Is there any way to see the "ISRT\Src\Service.rul" code, especially for line 150?
Labels (1)
0 Kudos
2 Replies

Did anybody figure out how to solve this problem? Any support?
0 Kudos

Sounds like I have the same problem. We had a project that was converted from IS7->IS12->IS2008->IS2009->IS2010 . The ServiceAddService stopped working properly when we converted to IS2011. Problems only occurred when SERVICE_IS_PARAMS needed to be passed.

This is what worked in the past but no more in IS2011:

POINTER ptrDependencies;
STRING szDependencies;

szDependencies = "MSSQLServer";
ptrDependencies = &szDependencies;

SERVICE_IS_PARAMS.lpDependencies = ptrDependencies;

What works for us now in IS2011:

STRING szDependencies;

szDependencies = "MSSQLServer";

SERVICE_IS_PARAMS.lpDependencies = &szDependencies;
0 Kudos