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 :: registry keys and values 
Csharp :: how to see if a number is even c# 
Csharp :: C# get column of 2d array 
Csharp :: update table in C# 
Csharp :: how to change all values in dictionary c# 
Csharp :: c# import class from another file 
Csharp :: how to use buildcontext in initstate flutter 
Csharp :: Printing pattern in c# 
Csharp :: get key in dictionary c# 
Csharp :: c# callback using delegate 
Csharp :: c# clear console read chache 
Csharp :: read all lines split C# 
Csharp :: open linkedlabel c# 
Csharp :: C# The request was aborted: Could not create SSL/TLS secure 
Csharp :: c# Modulo 10^9+7 (1000000007) 
Csharp :: c# open access database mdb 
Csharp :: monogame print debug 
Csharp :: how to access path position variable in unity 
Csharp :: C# top down view player movement script 
Csharp :: c# internalsvisibleto 
Csharp :: how to parse mongo db json in c# 
Csharp :: cant see my classes in inspector 
Csharp :: unity how to make gamemanager instance 
Csharp :: wpf binding ancestor codebehind 
Csharp :: cursor position c# 
Csharp :: wpf listbox binding change style of selected item 
Csharp :: c# list contains null 
Csharp :: autoit console write 
Csharp :: dotnet core encryption and decryption 
Csharp :: copy-the-entire-contents-of-a-directory-in-c-sharp 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =