How to Start an Application at Boot Time Under Windows 95Last reviewed: September 25, 1995Article ID: Q125714 |
The information in this article applies to:
SUMMARYWindows NT supports a Win32-based application type known as a Service. A Service may be started at boot time, automatically, by a user with the Service Control Manager facility or by Win32-based applications that use the service-related Win32 APIs. The Service Control subsystem and the associated Win32 APIs are not supported in Windows 95. In place of services, Windows 95 has two registry keys that will allow users to run applications before a user logs in when the system first starts up.
MORE INFORMATIONMicrosoft recognizes the value that Services and the Service Control manager have, therefore, we have implemented a smaller version of the Service Control Manager in Windows 95 so that applications can run before a user logs in. At boot time, the system checks two new registry keys: "RunServices" and "RunServicesOnce".
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion RunServices [key] bubba95=service.exe /params [string value] ... RunServicesOnce [key] ...The value names are arbitrary. The value data is the command line passed to CreateProcess(). Values under the key RunServicesOnce are deleted after the application is launched. Because these applications are started before the user logs onto the system, the user has not been validated and the applications cannot assume that they have particular networking permissions enabled. Windows 95, unlike Windows NT, only has one security context for the entire system. Therefore, don't assume that any application that starts has access to a particular network resource because a particular user has access to this network resource. Applications started by the RunServices and RunServicesOnce keys will be closed when the user selects "Close all programs and log on as a different user" from the Shutdown dialog on the Start Menu. A Win32-based application can prevent itself or any other Win32-based application from being closed when the user logs off by calling RegisterServiceProcess(). Win32-based applications registered in this manner close only when the system is shut down. However, the application must consider that different user can be logged on at different times during its execution. The application can distinguish between a user logging off and the system shutting down by examining the lParam of WM_QUERYENDSESSION and WM_ENDSESSION. If the system is being shut down, lParam is NULL. If the user is logging off, lParam is set to EWX_REALLYLOGOFF. To access RegisterServiceProcess, retrieve a function pointer using GetProcAddress() on KERNEL32.DLL.
RegisterServiceProcessDWORD RegisterServiceProcess( DWORD dwProcessId, // process identifier DWORD dwServiceType // type of service );Parameters:
The return value is 1 if successful or 0 if an error occurs.
|
Additional reference words: 3.95 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |