473,806 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search for a registry key with a certain value


Is there any way that we can serach for a registry key value with a
known data. For example if I want to find a registry value with the
known data"InternetSe arch" how can I do it on C#?
for any help, thanks in advance.
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
2 19331
Eranga,

The only way I know of would be to enumerate through all of the keys,
then all of the values, then all of the data for those values. It's a
tedious operation, but AFAIK, that is the only way to do it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Eranga" <km***@yahoo.co m> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .

Is there any way that we can serach for a registry key value with a
known data. For example if I want to find a registry value with the
known data"InternetSe arch" how can I do it on C#?
for any help, thanks in advance.
*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2

"Eranga" <km***@yahoo.co m> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .

Is there any way that we can serach for a registry key value with a
known data. For example if I want to find a registry value with the
known data"InternetSe arch" how can I do it on C#?
for any help, thanks in advance.
*** Sent via Developersdex http://www.developersdex.com ***


Microsoft has a great (but not well known) tool for this - called LogParser
<http://www.microsoft.c om/downloads/details.aspx?Fa milyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&di splaylang=en>
It uses a SQL engine to query all kind of text based data like the Registry,
the Filesystem, the eventlog, AD etc...
To be usable from C#, you need to build an Interop Assembly from the
Logparser.dll COM server using following (adjust LogParser.dll path)
command.
tlbimp "C:\Program Files\Log Parser 2.2\LogParser.d ll"
/out:Interop.MSU til.dll

Following is a small sample, that illustrates how to query for the Value
'VisualStudio' in the \HKLM\SOFTWARE\ Microsoft tree.

using System;
using System.Runtime. InteropServices ;
using LogQuery = Interop.MSUtil. LogQueryClass;
using RegistryInputFo rmat = Interop.MSUtil. COMRegistryInpu tContextClass;
using RegRecordSet = Interop.MSUtil. ILogRecordset;

class Program
{
public static void Main()
{
RegRecordSet rs = null;
try
{
LogQuery qry = new LogQuery();
RegistryInputFo rmat registryFormat = new RegistryInputFo rmat();
string query = @"SELECT Path from \HKLM\SOFTWARE\ Microsoft where
Value='VisualSt udio'";
rs = qry.Execute(que ry, registryFormat) ;
for(; !rs.atEnd(); rs.moveNext())
Console.WriteLi ne(rs.getRecord ().toNativeStri ng(","));
}
finally
{
rs.close();
}
}
}
Hope this helps.
Willy.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
12380
by: Bob Kirkwood | last post by:
I believe the intent in .NET is that we store application setup information in an XML file now instead of the Registry or INI files. Is this correct? Are there any tools, sample apps, or guidelines for how to do this?
28
3184
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple linear search the best here(for loop from beginning to end of array)? It seems like some other search algorithm like binary or whatever would be of no benefit on this data set.
8
1790
by: Fred | last post by:
Hello, Is there a way to read values from the registry as regular instead of verbatim? Regards, Fred
0
3515
by: D. Yates | last post by:
Hi, How exactly do you use the condition property to tell the installer not to overwrite changed registry values? Initially, I want certain registry values within a given key set to the value contained within the registry view (right click the install project and navigate to View->Registry). However, if the user runs the setup.exe again, I don't want the registry values to be overwritten if they have been changed. Thus, I am trying...
1
1182
by: Jonny | last post by:
Hi All I am writing a small app that enumerates a certain registry key & then adds the key values to a listbox When I select one in the listbox & click the delete button I want to delete that item from the registry Example:
7
12109
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested registry access is not allowed." SecurityException when I try and create the performance counter category via PerformanceCounterCategory.Create(). I understand the login used to run the Web Service does not have access to the registry keys...
5
1459
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm looking for a way to programmatically scan all installed drives for programs that are installed. Can someone point me to code to look for say, "keywords" on the installed drives etc? -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR
2
2279
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled.
9
2095
by: Newbie Coder | last post by:
Hello Newsgroup Readers I would like to know how to go & do the following: I have a certain registry key that has sub values Example: Key1 http://www.microsoft.com Key2 http://www.sarc.com
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10618
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.