Solved

RegQueryKey and RegDeleteKey (4)

Posted on 1997-05-07
1
1,947 Views
Last Modified: 2012-08-13
Hello,

I wrote already for the same question but I never receipt response.

How to delete a key in the registry found by RegQueryValue.

Ex : in the key HKEY_CURRENT_USER\\Software\\xyz , the value of reg (by example ) is 32568
I want delete the key HKEY\\LOCAL_MACHINE\\Software\\32568

I'm want delete key that is value !!!!! Thanks. The value is the Key !!!!



How do I do ?

Thanks
0
Comment
Question by:puce020497
1 Comment
 
LVL 1

Accepted Solution

by:
shappir earned 50 total points
Comment Utility
First thing first, there is no Win32 API function called RegQueryKey ! You either mean RegQueryInfoKey
or RegQueryValueEx. As to your question, if I understand correctly you want to delete a key called 32568
that is a subkey of HKEY_LOCAL_MACHINE\Software. What you should do is open HKEY_LOCAL_MACHINE\Software using RegOpenKeyEx and then use RegDeleteKey:

HKEY hKey;
if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE,                  TEXT("Software"), 0,                  KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS ) {
  RegDeleteKey(hKey, TEXT("32568"));
  RegCloseKey(hKey);
}

Note that if 32568 has subkeys this will not work on all versions of Windows NT. If you must also support these platforms you must write a recursive decent and delete routine. If 32568 is actually a value use RegDeleteValue instead of RegDeleteKey.

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now