REG_OPTION_NON_VOLATILE:
该宏是RegCreateKeyEx函数的参数可选项。
LONG RegCreateKeyEx( HKEY hKey,
LPCWSTR lpSubKey,
DWORD Reserved,
LPWSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition );
看看MSDN对它的说明:
Default setting. All registry keys are created as non-volatile and the information stored in memory is preserved when the OS is restarted. The RegSaveKey function saves keys that are non-volatile.
翻译:默认设置。所有注册表项创建作为非易失性和操作系统重新启动时保留在内存中存储的信息。 RegSaveKey功能键是非易失性保存。
意思是说如果参数dwOptions选择REG_OPTION_NON_VOLATILE,则通过RegCreateKeyEx创建的注册表是永久的,不会因为计算机的重启而消失。相反参数选择REG_OPTION_VOLATILE,则表明创建的注册表是临时的,计算机重启后该注册表不存在。
dwOptions [in] Registry key options. The following table shows the possible values for this parameter.| Value | Description |
|---|---|
| REG_OPTION_NON_VOLATILE | Default setting. All registry keys are created as non-volatile and the information stored in memory is preserved when the OS is restarted. The RegSaveKey function saves keys that are non-volatile. |
| REG_OPTION_VOLATILE | All registry keys are created as volatile, and the information is stored in memory and is not preserved when the corresponding registry hive is unloaded. For HKEY_LOCAL_MACHINE, this occurs when the OS is shut down. The RegSaveKey function does not save volatile registry keys. This flag is ignored for keys that already exist. |
理解注册表选项:REG_OPTION_NON_VOLATILE与REG_OPTION_VOLATILE
本文详细解释了在Windows注册表操作中两个关键选项的区别:REG_OPTION_NON_VOLATILE和REG_OPTION_VOLATILE。通过RegCreateKeyEx函数的使用,了解创建永久注册表项与临时注册表项的不同行为,以及它们如何影响注册表信息的持久性。
3256

被折叠的 条评论
为什么被折叠?



