Srvany.exe: Applications as Services Utility Topics | Previous

Srvany Notes


Running from the Working Directory

If Srvany fails to start an application, try specifying the directory containing the application as the working directory. As Srvany can run under an account that is different from the user who is currently logged on, environment variables might be set differently, and, as a result, the system might be unable to find a required DLL. Running the application from its root directory might solve the problem.

Interactivity versus Network Access

Due to a restriction enforced by Windows on services, the application can either be interactive (for example, it might read keyboard input) or have network access, but not both at the same time. If you know which servers your interactive service application needs to connect to, it is possible to configure these servers (or selected shares on them) to allow your service (running under the LocalSystem account) to gain access to them.

Programming Considerations

With Win32 graphical applications, all top-level windows receive the WM_QUERYENDSESSION and WM_ENDSESSION messages when the user logs off. Some Win32 applications quit when they receive these messages. In order for a Win32 application to keep running when a user logs off, the default Windows procedure should be called when these messages are received.

Win32 character-based applications receive a CTRL_LOGOFF_EVENT event from the console when the user logs off. If your character-based application registers a console event handler (using SetConsoleCtrlHandler), it must ignore CTRL_LOGOFF_EVENT in order to keep running.

Presentation Manager Applications

When you use Srvany with Presentation Manager applications, special configuration instructions apply. Consult the Readme.wri file shipped on Disk#1 of the Windows NT Add-On Subsystem for Presentation Manager, version 3.51. Presentation Manager is a Microsoft add-on product that allows you to run 16-bit Presentation Manager 1.x applications in addition to the OS/2 character-mode applications supported by the Windows OS/2 subsystem.