This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- same problem??
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2010
06:29 PM
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:
The 'GetExtendedErrInfo' call is returning the following:
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:
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:
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?
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:
STRING svUserName1, SERACTPASSWORD;
POINTER pSERACCOUNT, pSERACTPASSWORD;
... custom actions ...
Create User
Grant rights to log on as a service (+r SeServiceLogonRight)
...
Install_Service:
// Define Service Logon Specifics
pSERACCOUNT = &svUserName1;
pSERACTPASSWORD = &SERACTPASSWORD;
ServiceInitParams ();
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.lpServiceStartName = pSERACCOUNT;
SERVICE_IS_PARAMS.lpPassword = pSERACTPASSWORD;
// Install Application Server service
szPath = TARGETDIR ^ "BIN\\DotNet" ^ @SERVICE_NAME;
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);
endif;
POINTER pSERACCOUNT, pSERACTPASSWORD;
... custom actions ...
Create User
Grant rights to log on as a service (+r SeServiceLogonRight)
...
Install_Service:
// Define Service Logon Specifics
pSERACCOUNT = &svUserName1;
pSERACTPASSWORD = &SERACTPASSWORD;
ServiceInitParams ();
SERVICE_IS_PARAMS.dwStartType = SERVICE_AUTO_START;
SERVICE_IS_PARAMS.lpServiceStartName = pSERACCOUNT;
SERVICE_IS_PARAMS.lpPassword = pSERACTPASSWORD;
// Install Application Server service
szPath = TARGETDIR ^ "BIN\\DotNet" ^ @SERVICE_NAME;
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);
endif;
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."
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: ""
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);
endif;
if (LaunchAppAndWait ( "SC.exe", szParameter, LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN | LAAW_OPTION_SHOW_HOURGLASS ) != 0) then
MessageBox ("Still cannot install service.", SEVERE);
endif;
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?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 15, 2011
01:40 PM
Did anybody figure out how to solve this problem? Any support?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 03, 2011
08:01 AM
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;
ServiceAddService(xxxxx,xxxxxx,xxxxx,xxxxx,xxxxx);
What works for us now in IS2011:
STRING szDependencies;
szDependencies = "MSSQLServer";
SERVICE_IS_PARAMS.lpDependencies = &szDependencies;
ServiceAddService(xxxxx,xxxxxx,xxxxx,xxxxx,xxxxx);
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;
ServiceAddService(xxxxx,xxxxxx,xxxxx,xxxxx,xxxxx);
What works for us now in IS2011:
STRING szDependencies;
szDependencies = "MSSQLServer";
SERVICE_IS_PARAMS.lpDependencies = &szDependencies;
ServiceAddService(xxxxx,xxxxxx,xxxxx,xxxxx,xxxxx);
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)