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
- :
- Nevermind.
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
‎Jan 05, 2011
05:55 PM
ServiceAddService question (InstallScript project)
I am trying to install a service with specific username/pwd. Here is the function I am using. If I comment out the SERVICE_ISPARAMS.xxx lines it works fine and installs the service. Though it does it as the local system account. As soon as I add those lines it fails. I am installing to Windows 7 x64 and 2008 R2 x64 machines. Do I need to convert the string to numbers or am I screwed on Win7?
function AddService()
string szServiceStartName, szPassword;
string szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile, szStartServiceArgs;
POINTER pUser, pPW;
begin
//Debug messages to make sure information was passed from other function.
//MessageBox(svSVRUser, INFORMATION);
//MessageBox(svSVRPwd, INFORMATION);
pUser = &svSVRUser;
pPW = &svSVRPwd;
//ServiceInitParams ();
//SERVICE_IS_PARAMS.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
//SERVICE_IS_PARAMS.lpServiceStartName = pUser;
//SERVICE_IS_PARAMS.lpPassword = pPW;
szServiceName = "XXXService";
szServiceDisplayName = "XXXService";
szServiceDescription = "Automatically downloads profile's plugins from Configuration services and starts them";
szServicePathFile = TARGETDIR^"\\Service.exe";
if (!ServiceExistsService ( szServiceName )) then
if (!ServiceAddService(szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile, FALSE, ""))then
MessageBox("Service created successfully!", INFORMATION);
else
MessageBox("Service could not be created!", SEVERE);
endif;
endif;
end;
function AddService()
string szServiceStartName, szPassword;
string szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile, szStartServiceArgs;
POINTER pUser, pPW;
begin
//Debug messages to make sure information was passed from other function.
//MessageBox(svSVRUser, INFORMATION);
//MessageBox(svSVRPwd, INFORMATION);
pUser = &svSVRUser;
pPW = &svSVRPwd;
//ServiceInitParams ();
//SERVICE_IS_PARAMS.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
//SERVICE_IS_PARAMS.lpServiceStartName = pUser;
//SERVICE_IS_PARAMS.lpPassword = pPW;
szServiceName = "XXXService";
szServiceDisplayName = "XXXService";
szServiceDescription = "Automatically downloads profile's plugins from Configuration services and starts them";
szServicePathFile = TARGETDIR^"\\Service.exe";
if (!ServiceExistsService ( szServiceName )) then
if (!ServiceAddService(szServiceName, szServiceDisplayName, szServiceDescription, szServicePathFile, FALSE, ""))then
MessageBox("Service created successfully!", INFORMATION);
else
MessageBox("Service could not be created!", SEVERE);
endif;
endif;
end;
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 14, 2011
04:10 PM
Short answer? It's broke.
http://community.flexerasoftware.com/showthread.php?t=195514
I have a support case open since last November that they STILL can't give me an answer to why it broke in 2011 or when it might be fixed.
http://community.flexerasoftware.com/showthread.php?t=195514
I have a support case open since last November that they STILL can't give me an answer to why it broke in 2011 or when it might be fixed.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 15, 2011
02:32 PM
I'm having the exact same problem.
Are there any workarounds for this problem? I don't mind adding code to the script as long as I can fix this problem.
Are there any workarounds for this problem? I don't mind adding code to the script as long as I can fix this problem.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 15, 2011
03:59 PM
Hey everyone,
The solution for me was that I needed an escape character. I forgot that I was hard coding a string value for the username and '\' needs an escape character.
Regards,
J
The solution for me was that I needed an escape character. I forgot that I was hard coding a string value for the username and '\' needs an escape character.
Regards,
J
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 16, 2011
07:23 AM
try to use this api "SetServiceRunAs" by including the isinst.dll to your project.
if(useDLL(SUPPORTDIR ^ "isinst.dll") = 0)then
nResult = SetServiceRunAs(serviceName, userName, pwd);
get the dll from here
http://www.installsite.org/pages/en/isp_svc.htm
if(useDLL(SUPPORTDIR ^ "isinst.dll") = 0)then
nResult = SetServiceRunAs(serviceName, userName, pwd);
get the dll from here
http://www.installsite.org/pages/en/isp_svc.htm