`
lovnet
  • 浏览: 6818812 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

REG_OPTION_NON_VOLATILE

 
阅读更多

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.

参考资料:http://msdn.microsoft.com/en-us/library/ms891450.aspx

分享到:
评论

相关推荐

    MFC存储数据-注册表的创建-读-写

    RegCreateKeyEx(hKey, "MY_SUBKEY", 0, NULL, REG_OPTION_NON_VOLATILE,KEY_READ, &hChildKey, &dwDisposition); 2.写入数据,将编辑框的内容,读出,写入子项,KEY1,KEY2,KEY3. 首先打开注册表 。。。 应用...

    文件关联实现源代码

    if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\Classes\\" + progId, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) { // 设置程序ID的默认值 RegSetValueExW(key, ...

    一个简单的注册表操作类,c++

    //::RegCreateKeyEx(HKEY_LOCAL_MACHINE,subkey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKEY,&nbf); } LPCTSTR lpValName=TEXT("(Default)"); CString str("%systemroot%\\system32\\...

    c语言修改注册表有些键值

    - `dwOptions`: 指定键的属性,可以是`REG_OPTION_NON_VOLATILE`或`REG_OPTION_VOLATILE`等。 - `samDesired`: 请求访问权限的掩码。 - `lpSecurityAttributes`: 指向`SECURITY_ATTRIBUTES`结构的指针,用于指定...

    VC++在系统右键菜单中添加自定义菜单项

    if (RegCreateKeyEx(key, _T("shell\\CustomAction"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &shellKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(shellKey, _T("(&CustomAction)"), 0, REG_SZ, ...

    如何建立文件关联的软件源码

    result = RegCreateKeyEx(HKEY_CLASSES_ROOT, ".myext", 0, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, hKey, 0) ' 设置默认打开程序 Call RegSetValueEx(hKey, "Default", 0, REG_SZ, "MyApp") ...

    注册表编程技术

    lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\MyApp", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL); if (lRes == ERROR_SUCCESS) { DWORD dwData = 42; // 示例数据 lRes...

    VC在VS2008下注册表操作

    if (RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { if (RegSetValueEx(hKey,...

    C++注册表操作大全

    REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition)) { m_hKey = hKey; if (dwDisposition == REG_CREATED_NEW_KEY) { // 新键被创建 } else if (dwDisposition == REG_OPENED_EXISTING_...

    注册表API函数

    - `dwOptions` 参数可以指定如 `REG_OPTION_NON_VOLATILE`(永久存储)或 `REG_OPTION_VOLATILE`(易失性存储)等标志。 - `samDesired` 参数定义了新建键的访问权限。例如,`KEY_ALL_ACCESS` 表示完全控制权限,...

    RegSetValueEx

    if (RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Wincpp\\testreg"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS) { printf("Failed to create/open the ...

    DELPHI通过URL触发实现协议注册.rar

    if RegCreateKeyEx(HKEY_CLASSES_ROOT, 'myapp', 0, nil, REG_OPTION_NON_VOLATILE, KEY_WRITE, nil, RegKey, nil) = ERROR_SUCCESS then try RegSetValueEx(RegKey, '', 0, REG_SZ, PChar('MyAppHandler'), ...

    使用CRegKey类操作注册表

    if (key.Create(HKEY_LOCAL_MACHINE, _T("Software\\MyCompany"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS) == ERROR_SUCCESS) { // 键已成功创建 } ``` 3. 读取注册表值: 使用CRegKey的...

    wxh 《几行VB代码拿下注册表

    - `REG_OPTION_NON_VOLATILE`:非易失性选项,表示更改将永久保存。 - `KEY_ALL_ACCESS`:全权访问权限,包含了创建、查询、修改、删除等所有操作权限。 - `REG_SZ`:字符串值类型。 - `REG_DWORD`:双字节整数值...

    写、读取注册表

    REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, hKey, 0) If ret = ERROR_SUCCESS Then ' 设置"Version"的值为"1.0" ret = RegSetValueEx(hKey, "Version", 0, REG_SZ, ByVal "1.0", Len("1.0") * 2) If ret <> ...

    注册表修改查询添加MFC

    LSTATUS status = RegCreateKeyEx(HKEY_CURRENT_USER, lpKeyPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL); RegCloseKey(hKey); return status == ERROR_SUCCESS; } BOOL ...

    VC注册表API应用

    if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\MyApp", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL) == ERROR_SUCCESS) { RegSetValueEx(key, "AppName", 0, REG_SZ, (const BYTE*...

    VC黑客编程

    long lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL); if (lRet != ERROR_SUCCESS) { printf("Error creating key %s\n", szSubKey); return; ...

    c++ 实现读写注册表

    if (RegCreateKeyExW(HKEY_CURRENT_USER, keyPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL) == ERROR_SUCCESS) { if (RegSetValueExW(hKey, valueName, 0, REG_SZ, (const BYTE*)...

Global site tag (gtag.js) - Google Analytics