Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RegisterServiceProcess
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00299401
Message ID:
00299518
Vues:
27
>Ed -
>
>I appreciate the feedback. This is the documentation that I read. It is from the July 1999 MSDN CD. Unless I'm interpretting this incorrectly, it appears that what I want to do can be accomplished under Win 95/98, although I'm not sure if it can be done using VFP.
>
>
>From the July 1999 MSDN CD:
>
>How to Start an Application at Boot Time Under Windows 95
>Article ID: Q125714
>
>The information in this article applies to:
>Microsoft Win32 Application Programming Interface (API) included with:
>
>
> - Microsoft Windows 95 version 4.0
>
>SUMMARY
>Windows 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.
>

This will start a process before the WinLogin, but I do not think it refires if a logout occurs.

>MORE INFORMATION
>Microsoft 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.
>

In addition, I'd suspect that other things that can't be counted on, like the availability of UI services, would be an issue. Win9x doesn't have the issue of execution privileges that NT has.


>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.
>

You don't have direct access to the event loop within VFP to intercept these calls.

>To access RegisterServiceProcess, retrieve a function pointer using GetProcAddress() on KERNEL32.DLL.
>
>RegisterServiceProcess
>DWORD RegisterServiceProcess(
>
> DWORD dwProcessId, // process identifier
> DWORD dwServiceType // type of service
> );
>
>Parameters:
>dwProcessId: Specifies the identifier of the process to register as a
>
> service process or NULL to register the current process. An
> application receives the process ID when it uses CreateProcess() to
> start the application.
>
>dwServiceType: One of the following values:
>
> Define Value Meaning
> RSP_SIMPLE_SERVICE 0x00000001 Registers the process as a
> simple service process.
>
> RSP_UNREGISTER_SERVICE 0x00000000 Unregisters the process as a
> service process.
>
>
>Return Value:
>The return value is 1 if successful or 0 if an error occurs.
>
>Additional reference words: 3.95 4.00 KBCategory: kbprg KBSubcategory: BseService
>
>Last Reviewed: September 25, 1995
>© 1999 Microsoft Corporation. All rights reserved. Terms of Use.
>
>
>>>Has anyone used ever used the RegisterServiceProcess API call in a VFP exe in an attempt to keep an application running when the "Close all programs and log on as a different user" option is selected for Win 95/98 shutdown? This RegisterServiceProcess function is supposed to prevent a Win32-based application from being closed when logoff is selected. I've added the call to a VFP app without causing an error, but the app still wants to shutdown during logoff.
>>
>>This is a case of not reading the docs - Win9x does not support the concept of a service in this fashion. The following is a direct quote from the October MSDN:
>>
>>Windows 95/98 Service Control Manager
>>Microsoft® Windows NT®/Windows® 2000 supports a Win32®-based application type known as a service. A service may be started in two ways: automatically, when the system starts up; or upon demand, by Win32-based applications that use the functions provided by the Service Control Manager. For more information, see Services.
>>
>>The Windows NT/Windows 2000Service Control Manager and its associated functions are not supported by Microsoft® Windows® 95 or Microsoft® Windows® 98. Instead, Windows 95/98 provides a scaled-down Service Control Manager.
>>
>>Built on Tuesday, August 17, 1999
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform