当前位置: 首页>>代码示例>>C++>>正文


C++ RegDeleteValueW函数代码示例

本文整理汇总了C++中RegDeleteValueW函数的典型用法代码示例。如果您正苦于以下问题:C++ RegDeleteValueW函数的具体用法?C++ RegDeleteValueW怎么用?C++ RegDeleteValueW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RegDeleteValueW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_config_key

/******************************************************************************
 * set_config_key [internal]
 * Writes a string value to a registry key, deletes the key if value == NULL
 */
static DWORD set_config_key(HKEY defkey, HKEY appkey, const WCHAR *name, const WCHAR *value, DWORD size)
{
    if (value == NULL)
    {
        if (appkey && !RegDeleteValueW(appkey, name))
            return 0;

        if (defkey && !RegDeleteValueW(defkey, name))
            return 0;
    }
    else
    {
        if (appkey && !RegSetValueExW(appkey, name, 0, REG_SZ, (const BYTE*) value, (size + 1)*sizeof(WCHAR)))
            return 0;

        if (defkey && !RegSetValueExW(defkey, name, 0, REG_SZ, (const BYTE*) value, (size + 1)*sizeof(WCHAR)))
            return 0;
    }

    return ERROR_FILE_NOT_FOUND;
}
开发者ID:PatroxGaurab,项目名称:wine,代码行数:25,代码来源:main.c

示例2: Win32U_RegDeleteValue

LONG
Win32U_RegDeleteValue(HKEY keyName,      // IN:
                      LPCSTR valueName)  // IN:
{
   LONG ret;
   utf16_t *valueNameW = Unicode_GetAllocUTF16(valueName);

   ret = RegDeleteValueW(keyName, valueNameW);
   free(valueNameW);

   return ret;
}
开发者ID:dontsueme,项目名称:vmware-view-open-client,代码行数:12,代码来源:win32uRegistry.c

示例3: deleteAllReg

void deleteAllReg()
{
	HKEY  hSubKey = NULL;

	if( ERROR_SUCCESS == RegOpenKeyExW(HKEY_CURRENT_USER,L"Software\\Bank\\Update",0,KEY_ALL_ACCESS,&hSubKey) )
	{
		if(ERROR_SUCCESS !=	RegDeleteValueW(hSubKey,L"InstallFlag") )
		{
			RegCloseKey(hSubKey);
			return ;
		}
		if(ERROR_SUCCESS !=	RegDeleteValueW(hSubKey,L"InstallPack") )
		{
			RegCloseKey(hSubKey);
			return ;
		}
	}

	if(hSubKey != NULL)    
		RegCloseKey(hSubKey);
}
开发者ID:Williamzuckerberg,项目名称:chtmoneyhub,代码行数:21,代码来源:Updater.cpp

示例4: open

void WinRegistryKey::deleteValue(const std::string& name)
{
	open();
#if defined(POCO_WIN32_UTF8)
	std::wstring uname;
	Poco::UnicodeConverter::toUTF16(name, uname);
	if (RegDeleteValueW(_hKey, uname.c_str()) != ERROR_SUCCESS)
		throw NotFoundException(key(name));
#else
	if (RegDeleteValueA(_hKey, name.c_str()) != ERROR_SUCCESS)
		throw NotFoundException(key(name));
#endif
}
开发者ID:austinsc,项目名称:Poco,代码行数:13,代码来源:WinRegistryKey.cpp

示例5: RenameValue

BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName)
{
    LPWSTR value = NULL;
    DWORD type;
    LONG len, lRet;
    BOOL result = FALSE;
    HKEY hKey;

    if (!oldName) return FALSE;
    if (!newName) return FALSE;

    lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
    if (lRet != ERROR_SUCCESS) {
	error_code_messagebox(hwnd, lRet);
	return FALSE;
    }
    /* check if value already exists */
    if (check_value(hwnd, hKey, newName)) goto done;
    value = read_value(hwnd, hKey, oldName, &type, &len);
    if(!value) goto done;
    lRet = RegSetValueExW(hKey, newName, 0, type, (BYTE*)value, len);
    if (lRet != ERROR_SUCCESS) {
	error_code_messagebox(hwnd, lRet);
	goto done;
    }
    lRet = RegDeleteValueW(hKey, oldName);
    if (lRet != ERROR_SUCCESS) {
	RegDeleteValueW(hKey, newName);
	error_code_messagebox(hwnd, lRet);
	goto done;
    }
    result = TRUE;

done:
    HeapFree(GetProcessHeap(), 0, value);
    RegCloseKey(hKey);
    return result;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:38,代码来源:edit.c

示例6: QT_WA_INLINE

bool QSettingsPrivate::sysRemoveEntry( const QString &key )
{
    QString value;
    long ret = -1;

    HKEY hkey = sysd->openKey( key , KEY_SET_VALUE, value, globalScope );
    if ( hkey ) {
        /* This just deletes a value, not a subkey ... */
        ret = QT_WA_INLINE( RegDeleteValueW( hkey, ( LPCTSTR ) value.ucs2() ),
                            RegDeleteValueA( hkey, ( LPCSTR ) value.latin1() ) );
        RegCloseKey( hkey );
    }
    return ( ret == ERROR_SUCCESS );
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:14,代码来源:qsettings_win.cpp

示例7: RegSetValueExW

void CDlgFileAssoc::ExtUnassign(LPWSTR extName) {

	HKEY hKey;
	DWORD len = 100;
	wchar_t buf[100];

	if (RegOpenKeyExW(HKEY_CLASSES_ROOT, extName, 0, 0, &hKey) == ERROR_SUCCESS) {

		if (RegQueryValueExW(hKey, L"Nitrogen backup", NULL, NULL, (BYTE*)buf, &len) == ERROR_SUCCESS) {	

			RegSetValueExW(hKey, NULL, 0, REG_SZ, (BYTE*)buf, len);
			RegDeleteValueW(hKey, L"Nitrogen backup");
	
		} else {

			RegDeleteValueW(hKey, NULL);
	
		}
	
		RegCloseKey(hKey);
	}

}
开发者ID:dps123,项目名称:nitrogenS100,代码行数:23,代码来源:cdlgfileassoc.cpp

示例8: reg_set_string_value

static DWORD reg_set_string_value(HKEY hKey, LPCWSTR value_name, LPCWSTR string)
{
    if (!string)
    {
        DWORD err;
        err = RegDeleteValueW(hKey, value_name);
        if (err != ERROR_FILE_NOT_FOUND)
            return err;

        return ERROR_SUCCESS;
    }

    return RegSetValueExW(hKey, value_name, 0, REG_SZ, (const BYTE*)string, sizeof(WCHAR)*(strlenW(string) + 1));
}
开发者ID:dragon788,项目名称:wine-fracting,代码行数:14,代码来源:services.c

示例9: pxDiMsiDeleteInfPathFromRegistry

HRESULT
pxDiMsiDeleteInfPathFromRegistry(
	__in MSIHANDLE hInstall,
	__in DWORD RegRoot,
	__in LPCWSTR RegKey,
	__in LPCWSTR RegName)
{
	HKEY rootKeyHandle;
	HKEY keyHandle;

	switch (RegRoot)
	{
	case 0: rootKeyHandle = HKEY_CLASSES_ROOT; break;
	case 1: rootKeyHandle = HKEY_CURRENT_USER; break;
	case 2: rootKeyHandle = HKEY_LOCAL_MACHINE; break;
	case 3: rootKeyHandle = HKEY_USERS; break;
	default:
		return HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE);
	}

	LONG result = RegOpenKeyExW(
		rootKeyHandle,
		RegKey,
		0,
		KEY_READ | KEY_WRITE,
		&keyHandle);

	if (ERROR_SUCCESS != result)
	{
		pxMsiTraceW(hInstall, L"RegOpenKeyExW failed, root=%p, key=%ls, hr=0x%x\n",
			rootKeyHandle, RegKey, HRESULT_FROM_WIN32(result));

		return HRESULT_FROM_WIN32(result);
	}

	result = RegDeleteValueW(keyHandle, RegName);

	if (ERROR_SUCCESS != result)
	{
		pxMsiTraceW(hInstall, L"RegDeleteValueW failed, valueName=%ls, hr=0x%x\n",
			RegName, HRESULT_FROM_WIN32(result));

		return HRESULT_FROM_WIN32(result);
	}

	RegCloseKey(keyHandle);

	return S_OK;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:49,代码来源:xdimsiproc.cpp

示例10: assert

BOOL RegistryOp::DeleteKey(HKEY hKey, LPWSTR lpwSubKey)
{
	assert(hKey);
	assert(lpwSubKey);

	long lReturn = RegDeleteValueW(hKey, lpwSubKey);

	if (lReturn == ERROR_SUCCESS)
	{
		return TRUE;
	}

	DOLOG("RegDeleteValue ERROR return:" + lReturn);
	return FALSE;
}
开发者ID:wp4398151,项目名称:TestProjectJar,代码行数:15,代码来源:RegistryOp.cpp

示例11: DeleteRegistryValue

bool DeleteRegistryValue(const wchar_t* pSubKey, const wchar_t* stringName, bool wow64value, bool currentUser)
{
    HKEY root = currentUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
    HKEY hKey = 0;

    if (RegOpenKeyExW(root, pSubKey, 0, KEY_ALL_ACCESS | (wow64value ? KEY_WOW64_32KEY : KEY_WOW64_64KEY), &hKey) != ERROR_SUCCESS)
    {
        RegCloseKey(hKey);
        return false;
    }
    bool result = (RegDeleteValueW(hKey, stringName) == ERROR_SUCCESS);

    RegCloseKey(hKey);
    return result;
}
开发者ID:Interaptix,项目名称:OvrvisionPro,代码行数:15,代码来源:Util_SystemInfo.cpp

示例12: win_DeleteRegValue

// Result = DeleteRegValue (Root, Key, ValueName [, samDesired])
//   Root:      [string], one of "HKLM", "HKCC", "HKCR", "HKCU", "HKU"
//   Key:       registry key, [string]
//   ValueName: value name, [optional string]
//   samDesired: access mask, [flag] ("KEY_WOW64_32KEY" or "KEY_WOW64_64KEY"; the default is 0)
// Returns:
//   Result:    TRUE if success, FALSE if failure, [boolean]
static int win_DeleteRegValue(lua_State *L)
{
	HKEY hKey;
	HKEY hRoot = CheckHKey(L, 1);
	const wchar_t* Key = check_utf8_string(L, 2, NULL);
	const wchar_t* Name = opt_utf8_string(L, 3, NULL);
	REGSAM samDesired = (REGSAM) OptFlags(L, 4, 0) | KEY_SET_VALUE;
	int res = 0;
	if (RegOpenKeyExW(hRoot, Key, 0, samDesired, &hKey) == ERROR_SUCCESS)
	{
		res = (RegDeleteValueW(hKey, Name) == ERROR_SUCCESS);
		RegCloseKey(hKey);
	}
	lua_pushboolean(L, res);
	return 1;
}
开发者ID:FarGroup,项目名称:FarManager,代码行数:23,代码来源:win.c

示例13: e3d_del_process_key

HRESULT e3d_del_process_key()
{
	wchar_t pid[100];
	wsprintfW(pid, L"%d", GetCurrentProcessId());

	HKEY hkey = NULL;
	int ret = RegCreateKeyExW(HKEY_CURRENT_USER, e3d_soft_key, 0,0,REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WRITE |KEY_SET_VALUE, NULL , &hkey, NULL  );
	if (ret != ERROR_SUCCESS)
		return E_FAIL;
	ret = RegDeleteValueW(hkey, pid);
	if (ret != ERROR_SUCCESS)
		return E_FAIL;
	RegCloseKey(hkey);

	return S_OK;
}
开发者ID:my12doom,项目名称:personalProjects,代码行数:16,代码来源:E3DReader.cpp

示例14: XCERegDeleteValueA

LONG 
XCERegDeleteValueA(
				HKEY hKey,	
				LPSTR lpszValue 	
				)
{
	LONG res;
	int len;
	WCHAR *lpszValueW;

	len = strlen(lpszValue);
	lpszValueW = alloca((len+1) * 2);
	MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, lpszValueW, len+1);
	res = RegDeleteValueW(hKey, lpszValueW);

	return res;
}
开发者ID:mmcx,项目名称:cegcc,代码行数:17,代码来源:ceregistry.c

示例15: save_service_config

DWORD save_service_config(struct service_entry *entry)
{
    DWORD err;
    HKEY hKey = NULL;

    err = RegCreateKeyW(entry->db->root_key, entry->name, &hKey);
    if (err != ERROR_SUCCESS)
        goto cleanup;

    if ((err = reg_set_string_value(hKey, SZ_DISPLAY_NAME, entry->config.lpDisplayName)) != 0)
        goto cleanup;
    if ((err = reg_set_string_value(hKey, SZ_IMAGE_PATH, entry->config.lpBinaryPathName)) != 0)
        goto cleanup;
    if ((err = reg_set_string_value(hKey, SZ_GROUP, entry->config.lpLoadOrderGroup)) != 0)
        goto cleanup;
    if ((err = reg_set_string_value(hKey, SZ_OBJECT_NAME, entry->config.lpServiceStartName)) != 0)
        goto cleanup;
    if ((err = reg_set_string_value(hKey, SZ_DESCRIPTION, entry->description)) != 0)
        goto cleanup;
    if ((err = reg_set_multisz_value(hKey, SZ_DEPEND_ON_SERVICE, entry->dependOnServices)) != 0)
        goto cleanup;
    if ((err = reg_set_multisz_value(hKey, SZ_DEPEND_ON_GROUP, entry->dependOnGroups)) != 0)
        goto cleanup;
    if ((err = RegSetValueExW(hKey, SZ_START, 0, REG_DWORD, (LPBYTE)&entry->config.dwStartType, sizeof(DWORD))) != 0)
        goto cleanup;
    if ((err = RegSetValueExW(hKey, SZ_ERROR, 0, REG_DWORD, (LPBYTE)&entry->config.dwErrorControl, sizeof(DWORD))) != 0)
        goto cleanup;
    if ((err = RegSetValueExW(hKey, SZ_TYPE, 0, REG_DWORD, (LPBYTE)&entry->config.dwServiceType, sizeof(DWORD))) != 0)
        goto cleanup;
    if ((err = RegSetValueExW(hKey, SZ_PRESHUTDOWN, 0, REG_DWORD, (LPBYTE)&entry->preshutdown_timeout, sizeof(DWORD))) != 0)
        goto cleanup;

    if (entry->config.dwTagId)
        err = RegSetValueExW(hKey, SZ_TAG, 0, REG_DWORD, (LPBYTE)&entry->config.dwTagId, sizeof(DWORD));
    else
        err = RegDeleteValueW(hKey, SZ_TAG);

    if (err != 0 && err != ERROR_FILE_NOT_FOUND)
        goto cleanup;

    err = ERROR_SUCCESS;
cleanup:
    RegCloseKey(hKey);
    return err;
}
开发者ID:dragon788,项目名称:wine-fracting,代码行数:45,代码来源:services.c


注:本文中的RegDeleteValueW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。