0

This is a followup question of: RegDeleteKey and RegDeleteKeyEx

Background

So, I have a C++ windows application that uses RegDeleteKey function. However, I need to control the platform-specific view of the registry.

So, based on this:

64-bit Windows: On WOW64, 32-bit applications view a registry tree that is separate from the registry tree that 64-bit applications view. To enable an application to delete an entry in the alternate registry view, use the RegDeleteKeyEx function

Using RegDeleteKeyEx function is great when your app runs on Vista and above, but what about XP?

Question

How to delete registry key on XP while having control over platform-specific view of the registry

Community
  • 1
  • 1
idanshmu
  • 5,061
  • 6
  • 46
  • 92

1 Answers1

1

RegDeleteKeyEx exists on every platform that has a 64 bit version with WOW64. You use it on those platforms. Otherwise you can use RegDeleteKey. And it doesn't matter that it isn't aware of registry views since you won't be calling it on a platform that has different registry views.

64 bit Windows was introduced after XP. There was a 64 bit version of XP and a corresponding 64 bit version of server 2003. These were the first versions that offered 64 bits with WOW64 and both support RegDeleteKeyEx.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Does `RegDeleteKeyEx()` exported from `advapi32.dll` in XP 64 bit? – idanshmu Dec 27 '16 at 12:25
  • Well yes. It is documented such in the documentation you link to in the question. – David Heffernan Dec 27 '16 at 12:27
  • That's solve my problem but it raises another question: What if you want, on XP, to control other _Security and Access Rights_ using `samDesired` that are not related to registry view? – idanshmu Dec 27 '16 at 13:10
  • That's a different question. And I don't even understand it as stated here. – David Heffernan Dec 27 '16 at 13:47
  • using `RegDeleteKeyEx()` give you the ability to control _Security and Access Rights_. You said that "_you can use `RegDeleteKey` And it doesn't matter that it isn't aware of registry views since you won't be calling it on a platform that has different registry views_". I agree. However what if the access right I want to use in function `RegDeleteKeyEx()` is **not** related to the registry views. Then it **would matter** switching from `RegDeleteKeyEx()` to `RegDeleteKey()` – idanshmu Dec 27 '16 at 14:20
  • When deleting a key the registry view is the only information that can be passed in samDesired – David Heffernan Dec 27 '16 at 14:21