More Registry Functions

[Previous] [Next]

The designers of Windows 2000 added a registry function known as RegOverridePredefKey that allows your code to map one of the predefined registry keys listed in Table 5-1 to another registry key. The intended purpose of RegOverridePredefKey is to redirect registry changes made by a software component (such as an ActiveX control or a DLL) to a temporary key. This allows your application to easily and safely determine what keys and values must be added to the registry to accommodate the component. If necessary, your application can make changes or adjustments to these keys and values before copying them to their intended location in the registry. RegOverridePredefKey has this prototype:

 LONG RegOverridePredefKey( HKEY hkey HKEY hNewKey); 

You should pass one of the predefined registry keys listed in Table 5-1 for the hkey parameter, and you should pass an existing registry key as the hNewKey parameter. Passing NULL as hNewKey causes the predefined key to revert to its default mapping.

Finally, this chapter would not be complete without mention of RegSaveKey and RegRestoreKey. RegSaveKey allows you to copy a registry key and its underlying tree to a file. RegRestoreKey allows you to restore the registry key from a file. The prototypes of these functions are as follows:

 LONG RegSaveKey( HKEY hkey, PCTSTR pszFile, PSECURITY_ATTRIBUTES psa); LONG RegRestoreKey( HKEY hkey, PCTSTR pszFile, DWORD dwFlags); 

Although these functions are somewhat useful in their own right, they are closely related to RegLoadKey and RegUnloadKey and deal with registry hives, which are covered in the Platform SDK documentation.



Programming Server-Side Applications for Microsoft Windows 2000
Programming Server-Side Applications for Microsoft Windows 2000 (Microsoft Programming)
ISBN: 0735607532
EAN: 2147483647
Year: 2000
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net