Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

How to search values in the registry


// Below is a sample code that illustrates how to query for a given
// Value 'VisualStudio' in the HKLMSOFTWAREMicrosoft tree.


using System;
using System.Runtime.InteropServices;
using LogQuery = Interop.MSUtil.LogQueryClass;
using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass;
using RegRecordSet = Interop.MSUtil.ILogRecordset;

class Program
{
	public static void Main()
	{
		RegRecordSet rs = null;
		try
		{
			LogQuery qry = new LogQuery();
			RegistryInputFormat registryFormat = new RegistryInputFormat();
			string query = @"SELECT Path from HKLMSOFTWAREMicrosoft where
			Value='VisualStudio'";
			rs = qry.Execute(query, registryFormat);
			for(; !rs.atEnd(); rs.moveNext())
				Console.WriteLine(rs.getRecord().toNativeString(","));
		}
		finally
		{
			rs.close();
		}
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: search for a substring in the registry 
Csharp :: c# creating an array 
Csharp :: how to use double in c# 
Csharp :: viewBag as a list 
Csharp :: convert list string to list enum c# 
Csharp :: csharp csvhelper 
Csharp :: c sharp list 
Csharp :: c# fileupload example 
Csharp :: render section asp.net mvc layout 
Csharp :: c# while loop 
Csharp :: get position of another object unity 
Csharp :: c# webapi return file 
Csharp :: get index brushes properties c# 
Csharp :: push c# array 
Csharp :: dataGridView default error dialog handle 
Csharp :: pubxml environment variables 
Csharp :: int c = new int(); in C# 
Csharp :: C# traverseall elements in class property 
Csharp :: how to check url has parameter in c# 
Csharp :: Get Mouse World Position 
Csharp :: game maker transparent 
Csharp :: access label from another class c# 
Csharp :: c# code to check anagram 
Csharp :: c# convert excel column index to letter 
Csharp :: JavaScriptSerializer() and convert to base64 
Csharp :: do while loop in c# 
Csharp :: c# xml check if attribute exists 
Csharp :: string.insert c# 
Csharp :: how to get properties from json in c# 
Csharp :: unity screen size fix 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =