Announcement

Collapse
No announcement yet.

Creating windows service with dependencies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating windows service with dependencies

    I'm creating a setup in SF 9.5 to install a windows service with a dependency on Microsoft Message Queuing.

    For the Service.Create command the help file says the following on the Dependencies parameter....

    "A numerically indexed table containing the names of services or load order groups that must be loaded before this service can start."

    I'm not entirely sure what it means my numerically indexed table and I can't find any examples. I have tried the code below, which creates the services, but doesn't add the dependency....


    local strServicePath = SessionVar.Get("%AppFolder%").."\"..SessionVar.Get ("%MyServiceFileName%");
    local tblServiceDependencies = {};
    tblServiceDependencies[1] = "MSMQ";

    Service.Create(strServicePath, SessionVar.Get("%MyServiceDisplayName%"), SessionVar.Get("%MyServiceName%"), SERVICE_WIN32_OWN_PROCESS, false, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, "", nil, tblServiceDependencies, "", "");

    Can anyone help please?


  • #2
    I see that the Dependencies parameter does not work as expected. Please try this instead:
    Code:
    Service.Create(SessionVar.Expand("%AppFolder%\\%MyServiceFileName%"), SessionVar.Expand("%MyServiceDisplayName%"), SessionVar.Expand("%MyServiceDisplayName%"), SERVICE_WIN32_OWN_PROCESS, false, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL);
    Registry.SetValue(HKEY_LOCAL_MACHINE, SessionVar.Expand("SYSTEM\\CurrentControlSet\\services\\%MyServiceDisplayName%"), "DependOnService", "MSMQ", REG_MULTI_SZ);
    Ulrich

    Comment


    • #3
      Sorry for the delay, the workaround works perfectly. Many thanks for your help.

      Comment

      Working...
      X