search
HomeComputer TutorialsComputer KnowledgeLocal registry pointing tool under winpe

php editor Banana introduces you a practical tool - the local registry pointing tool under WinPE. In the WinPE system, since there is no ability to directly access the local registry, we cannot modify or query the registry information. This tool provides a simple and effective solution that can point the WinPE system's registry to the local system, allowing us to easily operate the registry. Whether it is fixing system problems or performing system maintenance, this tool can help us save time and energy.

The location where this information is recorded in the registry is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

Therefore, as long as we can access the registry At this location, you can get the name and installation path information of some software.

This blog post uses C# to access the registry to obtain the software installation path and display it.

1 Description of the main screen of the sample program

The main screen of the sample program is as shown below.

Local registry pointing tool under winpe

Enter the name of the executable program in the text box on the screen, and then click the "Get Path" button. Next, the next line of the screen will display the complete installation path information of the program. Note that the executable name you enter must be the name of the program in the registry. For example, the name of Adobe Reader in the registry is "AcroRd32.exe".

2 Complete code of sample program

using System;

using System.Windows.Forms;

using Microsoft.Win32;

namespace GetSoftWarePathExp

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

try

{

string softName = textBox1.Text.ToString();

string strKeyName = string.Empty;

string softPath = @\"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\\";

RegistryKey regKey = Registry.LocalMachine;

RegistryKey regSubKey = regKey.OpenSubKey(softPath softName \".exe\", false);

object objResult = regSubKey.GetValue(strKeyName);

RegistryValueKind regValueKind = regSubKey.GetValueKind(strKeyName);

if (regValueKind == Microsoft.Win32.RegistryValueKind.String)

{

this.label3.Text = objResult.ToString();

}

}

catch

{

this.label3.Text = \"Friend, failed to obtain the program path!\";

}

}

}

}

Note: Need to add reference: using Microsoft.Win32;

3 Code Description

(1) The code "RegistryKey regKey = Registry.LocalMachine" makes regKey point to the registry primary key HKEY_LOCAL_MACHINE .

(2) The code "RegistryKey regSubKey = regKey.OpenSubKey(softPath softName \".exe\", false)" makes regSubKey point to the registry subkey we need to find.

(3) The code "object objResult = regSubKey.GetValue(strKeyName)" obtains the key value of the registry.

(4) Code "RegistryValueKind regValueKind = regSubKey.GetValueKind(strKeyName)" obtains the key value type of the registry.

(5) Finally output the obtained key value information.

(6) If there is an error in the program, the prompt message "Friend, failed to obtain the program path!" will be output.

Note: Both the RegistryKey.GetValue and RegistryKey.GetValueKind methods need to pass in a parameter to indicate the name of the value to be retrieved. When the parameter passed to the RegistryKey.GetValue and RegistryKey.GetValueKind methods is an empty string, What is retrieved is an unnamed value. When this unnamed value is displayed in the Registry Editor, the string "(Default)" will be displayed instead of displaying a name. In this example, an empty string is passed in. If we take the installation information of the software Adobe Reader as an example, we will get the first registry information in the figure below. At this time, the name item displays the string "( default)".

Local registry pointing tool under winpe

4 Program running results

(1) Get the installation path of Adobe Reader

Enter "AcroRd32", click "Get Path", and get the following results, yes It is not consistent with the information recorded in the registry.

Local registry pointing tool under winpe

2) Get the installation path of chrome

Enter "chrome", click "Get Path", and you will get the following results. Is it consistent with the information recorded in the registry?

Local registry pointing tool under winpe

5 A few more words

In development, sometimes a specific program is designated to perform a certain type of operation, which may involve reading registry information to open the program. It's just that some programs may not have such registration information. In this case, we must take other methods.


The above is the detailed content of Local registry pointing tool under winpe. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:电脑知识学习网. If there is any infringement, please contact admin@php.cn delete
Download Hidester VPN/Proxy to Access Your Favorite Content - MiniToolDownload Hidester VPN/Proxy to Access Your Favorite Content - MiniToolApr 22, 2025 am 12:50 AM

Learn about Hidester VPN and Hidester proxy and download Hidester VPN for Windows, Mac, Android, and iOS to use this VPN service to view websites with no limit. For more useful free computer tools and troubleshooting tips, you may visit php.cn Softwa

Windows Keyboard Opening Shortcuts Instead of Typing [Fixed]Windows Keyboard Opening Shortcuts Instead of Typing [Fixed]Apr 22, 2025 am 12:48 AM

Have you ever encountered the trouble of “Windows keyboard opening shortcuts instead of typing”? In this post from php.cn, you will learn how to fix this issue.

Easy Ways to Add the Control Panel Icon to Desktop on Win 10 / 11Easy Ways to Add the Control Panel Icon to Desktop on Win 10 / 11Apr 22, 2025 am 12:46 AM

In this post, php.cn Software will introduce what Control Panel is and how to add the Control Panel icon to desktop on your Windows 10 or Windows 11 computer. You can also learn some related information about desktop icon settings.

Granblue Fantasy Relink Save File Location & Backup Save DataGranblue Fantasy Relink Save File Location & Backup Save DataApr 22, 2025 am 12:45 AM

If you play Granblue Fantasy: Relink on your PC, you may wonder where you can find its save file. In this post, php.cn introduces everything you want to know - Granblue Fantasy Relink save file location and how to back up the savegame of this game.

How to Fix Event ID 1104: The Security Log Is Now Full? - MiniToolHow to Fix Event ID 1104: The Security Log Is Now Full? - MiniToolApr 22, 2025 am 12:44 AM

Event Viewer keeps track of activity for better management. However, if the upper limit of the security log is reached, no more events can be logged. In this post on php.cn Website, we will show you how to deal with Event ID 1104 the security log is

Watch: How to Enable Secure Boot on Gigabyte Motherboard?Watch: How to Enable Secure Boot on Gigabyte Motherboard?Apr 22, 2025 am 12:43 AM

Secure Boot is a security standard that can prevent your computer from booting with untrustworthy software. Enabling it will add an extra layer of security to your device. In this post from php.cn Website, we will show you how to enable Secure Boot o

Windows 11 23H2 Release Date: September 26, 2023 - MiniToolWindows 11 23H2 Release Date: September 26, 2023 - MiniToolApr 22, 2025 am 12:42 AM

Coming to a new year, what Windows 11 users are looking forward to are not only the patch updates but also the annual major update for Windows 11. This post will talk about the Windows 11 23H2 release date. In addition, if you want to recover deleted

How to Turn off Bixby on Samsung Phone? See a Guide! - MiniToolHow to Turn off Bixby on Samsung Phone? See a Guide! - MiniToolApr 22, 2025 am 12:41 AM

Can you completely disable Bixby? How to turn off Bixby on Samsung phones? It is not hard to disable this voice assistant. In this post from php.cn, we will go to any length to help you find the method. Besides, a way to turn off “Hi, Bixby” is also

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools