Windows API Backup Options

I was wondering why some functions have some parameters that must be set to NULL due to the "reserved parameters". For instance:

LONG WINAPI RegQueryValueEx( __in HKEY hKey, __in_opt LPCTSTR lpValueName, __reserved LPDWORD lpReserved, __out_opt LPDWORD lpType, __out_opt LPBYTE lpData, __inout_opt LPDWORD lpcbData ); 

I can not understand why lpReserved exists? I mean, if he reserved, why would it be, would it be easier just to omit it?

Thank you! :) (do not pay attention to my English, please ..)

+4
source share
1 answer

I see at least two reasons.

We can say that this parameter is reserved for future use and the possible expansion of functionality. By making sure that it is set to NULL , you can to some extent guarantee that in the future, when new functionality is added, it will not break old programs.

The second possible reason is that this parameter can actually be used internally as part of the private API, and the public part of the API requires this parameter to be set to NULL .

Why not skip this at all? This is much easier than expanding the functionality of the system without changing the interface. It remains binary and source code compatible with the old API, and does not require re-creating old software.

+11
source

All Articles