Пример #1
0
/* Remove registry settings */
int RegistryUninstall()
{
	int status = 0;

	/* Remove application and eventlog data */
	if (RegistryDelete(RegistryApplicationDataPath))
		status = 1;
	if (RegistryDelete(RegistryEventlogDataPath))
		status = 1;

	/* Return overall status */
	return status;
}
Пример #2
0
bool RegistryDelete(HKEY base, LPCTSTR path) {

	// Open the key
	CRegistry key;
	if (!key.Open(base, path, true)) return false;

	// Loop for each subkey, deleting them all
	DWORD size;
	TCHAR subkey[MAX_PATH];
	int result;
	while (true) {

		// Get the name of the first subkey
		size = MAX_PATH;
		result = RegEnumKeyEx(key.Key, 0, subkey, &size, NULL, NULL, NULL, NULL);
		if (result == ERROR_NO_MORE_ITEMS) break; // There are no subkeys
		else if (result != ERROR_SUCCESS) return false; // RegEnumKeyEx returned an error

		// Delete it, making the next subkey the new first one
		if (!RegistryDelete(key.Key, subkey)) return false;
	}

	// We've cleared this key of subkeys, close it and delete it
	key.Close();
	result = RegDeleteKey(base, path);
	if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) return false;
	return true;
}
Пример #3
0
void Settings::DeleteConfigValue(const char *name)
{
    CriticalSectionLocker lock(g_csConfigValues);

    RegistryDelete(name);
}
Пример #4
0
// Takes a root key handle name or open base key, and the path to a key beneath it
// Deletes the key from the registry, including its subkeys
// Returns false on error
JNIEXPORT jboolean JNICALL Java_org_limewire_util_SystemUtils_registryDeleteNative(JNIEnv *e, jclass c, jstring root, jstring path) {
	return RegistryDelete(RegistryName(GetJavaString(e, root)), GetJavaString(e, path));
}